|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-03-17 19:15:10
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-05-31 15:17:45
|
|
|
|
|
* @LastEditTime: 2022-05-31 17:36:08
|
|
|
|
|
* @Description: 一些无法归类的公共方法容器
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@ -15,6 +15,7 @@ import {
|
|
|
|
|
|
|
|
|
|
} from "js-util-all";
|
|
|
|
|
import ENV from '@/common/config/env';
|
|
|
|
|
import {AD_JUMP_TYPE} from '@/common/dicts/ad';
|
|
|
|
|
|
|
|
|
|
/** 防抖函数
|
|
|
|
|
* 首次运行时把定时器赋值给一个变量, 第二次执行时,
|
|
|
|
@ -40,26 +41,34 @@ const Debounce = (fn, delay) => {
|
|
|
|
|
* 兼容APP,根据域名判断站内跳转还是站外跳转
|
|
|
|
|
* @param {*} link
|
|
|
|
|
*/
|
|
|
|
|
const AdJump = (link) => {
|
|
|
|
|
if (!/^(http|https):\/\/./.test(link)) {
|
|
|
|
|
uni.$u.toast('非法链接,暂不跳转!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
console.log(link);
|
|
|
|
|
const isInner = link.includes(ENV.staticUrl);
|
|
|
|
|
if (isInner) {
|
|
|
|
|
const AdJump = (item) => {
|
|
|
|
|
// if (!/^(http|https):\/\/./.test(link)) {
|
|
|
|
|
// uni.$u.toast('非法链接,暂不跳转!');
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
console.log(item);
|
|
|
|
|
switch (item.jumpType) {
|
|
|
|
|
case AD_JUMP_TYPE.GOODS:
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/goodsDetail?id=${item.jumpUrl}`
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case AD_JUMP_TYPE.CATEGORY:
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url : link.replace(ENV.staticUrl,'')
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
url: `/goodsList?categoryId=${item.jumpUrl}`
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case AD_JUMP_TYPE.LINK:
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
window.location.href = link;
|
|
|
|
|
window.location.href = item.jumpUrl;
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
plus.runtime.openURL(link);
|
|
|
|
|
plus.runtime.openURL(item.jumpUrl);
|
|
|
|
|
// #endif
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 工具类的文件需要把文件提供的工具类统一放最下方做一个统一输出
|
|
|
|
|
export {
|
|
|
|
|