Commit d8546463 by 程默

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 7d93cbf7 b559d7b3
import indexApi from "@/api/index";
export function getBcakUrlApi(data) {
return new Promise((resolve, reject) => {
data.fromAppid = 'VsEOuDJqBnGNyXZJWCQS'
indexApi.getSsoCallbackUrl(data).then(res => {
if (res.data.code == 200) {
resolve(res.data.data);
}
});
})
}
export function createdUserJWTApi(data) {
return new Promise((resolve, reject) => {
indexApi.createdUserJWT().then(res => {
if (res.data.code == 200) {
resolve(res.data.data);
}
});
})
}
......@@ -33,6 +33,22 @@ console.log(process.env,'-----------------config------')
},
get_multi_merchant_by_tags(data){
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_multi_merchant_by_tags`,data)
},
getSsoCallbackUrl(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/common/getSsoCallbackUrl`,
{ data }
);
},
// 动态表单获取token 信息
createdUserJWT(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/user/createUserJWT`,
{
data
}
);
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
import orderApi from "./api/order"
import promoteApi from "./api/promote";
import indexApi from './api/index'
import { createdUserJWTApi, getBcakUrlApi } from "./api/daoke";
import cartApi from './api/cart'
import classificationApi from "./api/classification";
import spokesmanApi from './api/spokesman'
......@@ -18,6 +19,7 @@ import fenxiaoModel from "@/utils/fenxiaoModel";
// themeMemberCardClick
// } from "@/utils/mayi";
import { $themeToLink, $themeAddToCard, $themeArticleLike } from "@/utils/mayi";
import "@/utils/themeModule";
// import { themeToLinkInit } from "@/utils/themeModule";
import shop from "./api/shop";
import spokesman from "@/api/spokesman";
......@@ -38,12 +40,11 @@ Vue.prototype.$mpAnalytics = mpAnalytics;
const app = new Vue(App)
app.$mount()
// 初始化
// themeToLinkInit({ homeNative: 2, getCoupon, themeMemberCardClick });
// glob挂载到
let mpApp = getApp();
Vue.prototype.mpApp = mpApp
// 初始化
mpApp.fenxiaoModel = new fenxiaoModel({
query_login_spoken:spokesman.query_login_spoken,
becomepokesmanCustomer:spokesman.becomepokesmanCustomer,
......@@ -56,7 +57,17 @@ mpApp.fenxiaoModel = new fenxiaoModel({
oneClickShopQuickCopy: spokesman.oneClickShopQuickCopy,
apply_for_withdraw: spokesman.apply_for_withdraw
});
// 多主题方法初始化
global.themeToLinkInit({
homeNative: 2,
wx,
getCoupon,
themeMemberCardClick,
requireFun: {
createdUserJWT: createdUserJWTApi,
getBcakUrl: getBcakUrlApi
}
});
// 数据异步回调函数
// 商城
mpApp.shopCallBack = function () { }
......
......@@ -156,6 +156,7 @@ export function $themeAddToCard(item, callback) {
}
function toPage(backPath, backParams = "") {
console.log(backPath, backParams,'--------------------------159');
wx.navigateTo({
url: `../index/main?from=themeLink&backpath=${encodeURIComponent(backPath)}&params=${encodeURIComponent(backParams)}`
});
......@@ -299,9 +300,9 @@ export function themeMemberCardClick (item) {
});
} else {
if (res.data.msg == "不能重复领卡") {
let query = { cardId: cardData.id, userTel: userInfo.mobilephone };
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/personalCenter/membershipCard")}&params=${encodeURIComponent(query)}`;
wx.navigateTo({url});
console.log("---------------------------to-----1")
let backParams = `&cardId=${cardData.id}&userTel=${userInfo.mobilephone}`;
toPage("/personalCenter/membershipCard",backParams);
} else {
wx.showToast({ title: res.data.msg, icon: "none" });
}
......@@ -313,16 +314,13 @@ export function themeMemberCardClick (item) {
} else if (cardData.receiveWay == 2) {
// 付费购买
if (cardData.receiveStatus == 0) {
let query= { cardId: cardData.id };
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/pay/payCard")}&params=${encodeURIComponent(query)}`;
wx.navigateTo({ url });
console.log("---------------------------to-----2")
let backParams = `&cardId=${cardData.id}`;
toPage("/pay/payCard", backParams);
} else {
let query = {
cardId: cardData.id,
userTel: userInfo.mobilephone
};
let url = `../index/main?from=themeLink&backpath=${encodeURIComponent("/personalCenter/membershipCard")}&params=${encodeURIComponent(query)}`;
wx.navigateTo({ url });
console.log("---------------------------to-----3")
let backParams = `&cardId=${cardData.id}&userTel=${userInfo.mobilephone}`;
toPage("/personalCenter/membershipCard", backParams);
}
} else {
console.error("无效的领取方式");
......
let Vue = null;
let homeNative = null; //首页环境 1:h5 2:小程序 3:头条
let miniApp = null;
let Toast = null; // 弹窗方法
let hylToLink = null;
let toPageFun = null;
let h5Config = null;
// 函数柯里化
/**
* @toPage type:环境变量
* @pageUrl pageUrlVal:跳转链接
*/
// 调用方法使用.call
function toPage(type) {
if (type == 1) {
return function({ pagePath, pageType = 1 }) {
if (pageType == 1) {
this.$router.push(pagePath);
} else if (pageType == 2) {
window.location.href = pagePath;
}
};
} else if (type == 2) {
return function({ pagePath, pageType = 1 }) {
if (pageType == 1) {
wx.navigateTo({ url: pagePath });
}
};
}
}
function toPageUrl(backPath, backParams = "") {
return `../index/main?from=themeLink&backpath=${encodeURIComponent(
backPath
)}&params=${encodeURIComponent(backParams)}`;
}
/**
*
* @param {*} type 环境变量
*/
function getSessionId(type) {
if (type == 1) {
return (
this.$store &&
this.$store.state.sessionId &&
this.$store.state.sessionId &&
null
);
} else if (type == 2) {
return (
wx &&
wx.getStorageSync("sessionid") &&
JSON.parse(wx.getStorageSync("sessionid")) &&
null
);
}
}
function getIsMini(type) {
return type == 1 && this.$store && this.$store.state.miniProgram;
};
/**
*
* @param {*} type 环境变量
*/
function getUserInfo(type) {
if (type == 1) {
return this.$store && this.$store.state.userInfo && null;
} else if (type == 2) {
return (
wx &&
wx.getStorageSync("userInfo") &&
JSON.parse(wx.getStorageSync("userInfo")) &&
null
);
}
}
function createdUserJWTApi(homeNative) {
if (homeNative == 1) {
try {
return require("~/assets/js/daoke.js").createdUserJWT;
} catch (error) {}
}
return null;
}
function getBcakUrlApi(homeNative) {
if (homeNative == 1) {
try {
return require("~/assets/js/daoke.js").getBcakUrl;
} catch (error) {}
}
return null;
}
//商家中心外链(小程序使用 /pages/wxArticle/main?link 这个方法跳转)
function getGUIDE_URL(type) {
if (type == 1) {
return h5Config.GUIDE_URL;
} else if (type == 2) {
return config.GUIDE_URL;
}
}
// 分享
function toShare(type,data) {
if (type == 1) {
this.$nuxt.$SHARE({ itemList: data.feature.value });
} else if (type == 2) {
miniApp.shareInit({ itemList: data.feature.value });
}
};
// 获取link 中页面地址(link兼容 有object或者string)
function getUrlofLink(data) {
return data.link.split("?")[0];
}
function getUrlofQuery(data) {
return data.link.split("?")[1] || "";
}
export function themeToLinkInit({ homeNative: shop_env, getCoupon, themeMemberCardClick }) {
homeNative = shop_env;
console.log(homeNative, "-------------themeToLinkInit");
toPageFun = toPage(homeNative);
if (homeNative == 1) {
try {
Vue = require("vue") || null;
h5Config = require("~/config") || null;
Vue.default.prototype.$themeToLink = $themeToLink;
Toast = require("vant").Toast || null;
hylToLink = require("~/utils/hylModule.js").hylToLink || null;
} catch (error) {}
} else if (homeNative == 2) {
miniApp = getApp();
miniApp.$themeToLink = $themeToLink;
miniApp.getCoupon = getCoupon;
miniApp.themeMemberCardClick = themeMemberCardClick;
}
}
export async function $themeToLink(data) {
console.log(data, "$themeToLink");
// 第三方嵌入系统
if (data.type) {
if (data.link && data.link.includes("scene=sso")) {
//?token=${token}&scene=sso
Toast.loading({
message: "加载中...",
forbidClick: true
});
if (!getSessionId.call(this)) {
Toast("请先登录");
return;
}
if (homeNative == 1) {
let { mobilephone: phoneNumber, email } = getUserInfo.call(this);
data.link = await getBcakUrlApi({
toAppid: "hgFTLLhgnBmeOyCkcbyv",
callbackUrl: data.link,
phoneNumber,
email
});
}
}
if (data.link && data.link.includes("dynamicForm") && homeNative == 1) {
await createdUserJWTApi(homeNative)().then(res => {
data.link += `&token=${res}`;
});
}
}
//商城跳转到嗨有料首页
if (homeNative == 1) {
hylToLink.call(this,data);
}
let type = data.type;
////向后兼容 兼容老数据
if (type == undefined || type == "undefined") {
if (data.length > 0) {
this.$nuxt.$router.push(data);
}
return;
}
//----
if (type == 0) {
//无链接
return;
} else if (type == 1) {
//h5页面
//兼容
if (data.link.substring(0, 1) == "/") {
// 跳转类型 targetType 0 push 1 replace
// if (data.targetType && data.targetType == 1) {
// this.$nuxt.$router.push({
// path: data.link,
// });
// } else {
// this.$nuxt.$router.push(data.link);
// }
if (homeNative == 1) {
toPageFun.call(this, { pagePath: data.link });
} else if (homeNative == 2) {
let url = toPageUrl(getUrlofLink(data), getUrlofQuery(data));
toPageFun.call(this, { pagePath: url });
}
} else {
if (data.link.startsWith("http") || data.link.startsWith("https")) {
if (
homeNative==1
) {
toPageFun.call(this, { pagePath: data.link, pageType:2 });
} else {
let url = "/pages/wxArticle/main?link=" + encodeURIComponent(data.link);
toPageFun.call(this, { pagePath: url });
}
} else {
toPageFun.call(this, { pagePath: data.link, pageType:2 });
}
}
} else if (type == 1.1) {
//小程序页面 可能增加登录态拦截
if (homeNative == 2) {
toPageFun.call(this, { pagePath: data.link });
} else {
Toast("暂不支持");
}
} else if (type == 1.2) {
//第三方链接
if (data.link == "outerChain:businessCenter") {
// 进入商家中心外链
console.log(getGUIDE_URL(), "-----getGUIDE_URL()");
let url = `${getGUIDE_URL()}/login?mixid=${this.$nuxt.$route.query
.mixid}&back=${encodeURIComponent(window.location.href)}`;
toPageFun.call(this, { pagePath: url, pageType:2 });
return;
}
if (data.link.substring(0, 1) == "/") {
toPageFun.call(this, { pagePath: data.link });
} else {
if (
this.$store.state.miniProgram == 1 ||
this.$store.state.miniProgram == 2
) {
let url = "/pages/wxArticle/main?link=" + encodeURIComponent(data.link);
toPageFun.call(this, { pagePath: url });
} else {
toPageFun.call(this, { pagePath: data.link, pageType:2 });
}
}
} else if (type == 2) {
//功能
let featureType = data.feature.type;
if (featureType == "themeCouponClick" || featureType == 0) {
//优惠券
if (homeNative == 1) {
this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
} else if (homeNative == 2) {
miniApp.getCoupon(data.feature.value.couponCode, data.feature.value);
}
} else if (featureType == 1) {
//分享
if (data.type == 2 && data.feature.type == 1) {
//分享
toShare.call(this,homeNative,data)
}
// if (cb) {
// cb();
// }
} else if (featureType == "themeMemberCardClick" || featureType == 2) {
//会员卡
if (homeNative == 1) {
this.$themeMemberCardClick(data.feature.value);
} else if (homeNative == 2) {
miniApp.themeMemberCardClick(data.feature.value);
}
}
} else if (type == 3) {
//小程序跳转到小程序
if (homeNative == 1) {
if (getIsMini.call(this,homeNative) == 1 || getIsMini.call(this,homeNative) == 2) {
if (this.$store.getters["sceneModule/flushbonadingVisible"]) {
let url = `/pages/toMini/toMini?weappPage=${encodeURIComponent(data.link)}&weappAppId=${data.name}`;
toPageFun.call(this, { pagePath: url });
return;
}
let url2 = `/pages/toMini/main?weappPage=${encodeURIComponent(data.link)}&weappAppId=${data.name}`;
toPageFun.call(this, { pagePath: url2 });
} else {
Toast("暂不支持");
}
} else {
let url2 = `/pages/toMini/main?weappPage=${encodeURIComponent(data.link)}&weappAppId=${data.name}`;
toPageFun.call(this, { pagePath: url2 });
}
} else {
//向后兼容
if (data.length > 0) {
toPageFun.call(this, { pagePath: data.link });
}
}
}
!function i(o,a,r){function l(t,e){if(!a[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=a[t]={exports:{}},o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,i,o,a,r)}return a[t].exports}for(var s="function"==typeof require&&require,e=0;e<r.length;e++)l(r[e]);return l}({1:[function(e,t,n){var i,o,t=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{o="function"==typeof clearTimeout?clearTimeout:r}catch(e){o=r}}();var s,u=[],p=!1,c=-1;function d(){p&&s&&(p=!1,s.length?u=s.concat(u):c=-1,u.length&&g())}function g(){if(!p){var e=l(d);p=!0;for(var t=u.length;t;){for(s=u,u=[];++c<t;)s&&s[c].run();c=-1,t=u.length}s=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===r||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}t.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||p||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=h,t.addListener=h,t.once=h,t.off=h,t.removeListener=h,t.removeAllListeners=h,t.emit=h,t.prependListener=h,t.prependOnceListener=h,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],2:[function(e,t,R){!function(U,t){!function(){"use strict";Object.defineProperty(R,"__esModule",{value:!0}),R.hylBannerLink=i,R.hylToLink=s;var a=void 0,m=void 0,h=void 0,f=void 0,v=void 0,r=void 0,k="",n=null;function i(e){var t,n,i,o,a,r,l,s,u,p,c,d,g;k=$nuxt.$store,console.log("hylBannerLink",e),3!=e.type?1.1==e.type&&(1==k.state.miniProgram||2==k.state.miniProgram?-1<e.link.indexOf("pages/hiberDrawEntity/hiberDrawEntity")?(t=e.link.split("?"))[1]&&t[1].split("=")[1]&&(l=JSON.parse(decodeURIComponent(t[1].split("=")[1])),u=(s=l).id,p=l.type,c=l.isOpenDraw,d=v.formatDate.format(new Date),g=(g=l.validTimeEnd).split(".").join("-"),2==l.validTimeEnd.split(" ").length||(d=d.split(" ")[0]),d=(d=new Date(g.replace(/-/g,"/")).getTime()-new Date(d.replace(/-/g,"/")).getTime())/1e3,2==c?0<=d?(1==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+u}),2==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+u}),3==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/turntable/turntable?id="+u})):2==p&&null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?perdraw=33&id="+u}):2==p&&null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+u}):m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):1==p?null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+u}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+u}):2==p?null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+u}):$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+u}):null==s.drawRecordEntity?m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+u})):-1<e.link.indexOf("type")?(t=e.link.split("?"),"[object Array]"==Object.prototype.toString.call(t)&&t.length&&(r=t[1].split("&"),n={},r.forEach(function(e){e.split("="),n[e.split("=")[0]]=e.split("=")[1]}),console.log(n),i=n.id,o=n.jumpScore,a=n.type,k.state.sessionId?f.getConsumerScoreFlag({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){0==e.code&&(1==e.object?(o&&0<o&&f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}),o&&o<0&&C.showModal({title:"提示",content:"跳转扣除"+Math.abs(o)+"积分",success:function(e){e.confirm?f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}):e.cancel&&console.log("用户点击取消")}}),o||$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})):$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i}))}):$mp.miniProgram.navigateTo({url:"/pages/login/login"}))):((e.link.includes("pages/draw/draw/draw")||e.link.includes("pages/question/question")||e.link.includes("pages/live/live"))&&(r=w($nuxt.$route.query.mixid+"_location")&&JSON.parse(w($nuxt.$route.query.mixid+"_location")).outId,console.log(r,"跳转id"),r&&(e.link.includes("?")?e.link=e.link+"&addressId="+r:e.link=e.link+"?addressId="+r)),$mp.miniProgram.navigateTo({url:e.link})):h("暂不支持")):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/toMini/toMini?weappPage="+encodeURIComponent(e.link)+"&weappAppId="+e.name}):h("暂不支持")}function s(e){if(n=e.type,(k=$nuxt.$store).getters["sceneModule/flushbonadingVisible"])if(null!=n&&"undefined"!=n){if(0!=n)if(1==n)"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):!e.link.startsWith("http")&&!e.link.startsWith("https")||1!=k.state.miniProgram&&2!=k.state.miniProgram?window.location.href=e.link:$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)});else if(2==n){var t=e.feature.type;"themeCouponClick"==t||0==t?this.$themeCouponClick(e.feature.value.couponCode,e.feature.value):1==t?(console.log("是分享了。。。。"),2==e.type&&1==e.feature.type&&$nuxt.$SHARE({itemList:e.feature.value})):"themeMemberCardClick"!=t&&2!=t||this.$themeMemberCardClick(e.feature.value)}else if(1.1==n||3==n)i(e);else if(1.2==n){if("outerChain:businessCenter"==e.link)return console.log(r.GUIDE_URL,"-----shopConfig.GUIDE_URL"),t=r.GUIDE_URL+"/login?mixid="+$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),void(window.location.href=t);"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)}):window.location.href=e.link}else 0<e.length&&$nuxt.$router.push(e.link)}else 0<e.length&&$nuxt.$router.push(e)}function w(e){if(U.browser&&"undefined"!=typeof document)for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var i=t[n].split("=");if(i[0].trim()==e)return decodeURIComponent(i[1])}}Object.defineProperty(R,"__esModule",{value:!0}),R.themeToLinkInit=e,R.$themeToLink=L;var u=null,p=null,c=null,a=void 0,d=void 0,g=void 0,r=void 0,h=void 0,s=void 0,y=void 0,C=void 0;function T(e,t){t=1<arguments.length&&void 0!==t?t:"";return"../index/main?from=themeLink&backpath="+encodeURIComponent(e)+"&params="+encodeURIComponent(t)}function P(e){return 1==e?this.$store&&this.$store.state.sessionId&&this.$store.state.sessionId&&null:2==e?C&&C.getStorageSync("sessionid"):void 0}function $(e){return 1==e&&this.$store&&this.$store.state.miniProgram}function b(e){return 1==e?r.GUIDE_URL:2==e?config.GUIDE_URL:void 0}function I(e){return e.link.split("?")[0]}function x(e){return e.link.split("?")[1]||""}function o(t){var e=getApp();return e.globalData.footerVal?e.globalData.footerVal.componentData.list.findIndex(function(e){return I(e.link)==t.split("?")[0]}):-1}var l=["index","media-video","goods-goodsInfo","goods-commodityMenu","goodsSearch-goodsSearch","chooseStores","activty-receivingGift","activty","login-register","login-phoneLogin","login-authInformation","login-forgetPassWord","login-accountLogin","login-wxRegister","pay-payList","comment-evaluateList","goods-commonProblemList","article-articlePage","article-articleList","goods-posters","liveBroadcast","liveBroadcast-list","personalCenter-coupon-getCoupon","buyerShow-showDetail","goods-addGoodsList","personalCenter-CDkey-exchange","giftCards-linkReceive","giftCoupon-preview","smartForm","shopCart-shareShopCart","groupBuying-beInvite","brandTopics","personalCenter-spokesmanCenter","personalCenter-spokesmanCenter-mine-spokesmanHomePage","liveBroadcast-lived","personalCenter-spokesmanCenter-mine-getBusinessCard","changeAdr"].map(function(e){return"/index"==(e="/"+e.replace(/-/g,"/"))?"/":e});function e(e){var t=e.homeNative,n=e.wx,i=e.getCoupon,o=e.themeMemberCardClick,e=e.requireFun;if(u=t,y=e,console.log(y,"-------------------------115"),d=y.createdUserJWT,g=y.getBcakUrl,C=n,console.log(u,"-------------themeToLinkInit"),n=u,console.log("toPage-------------"),c=1==n?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?this.$router.push(t):2==e?window.location.href=t:3==e&&C.navigateTo({url:t})}:2==n?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?C.navigateTo({url:t}):2==e&&C.reLaunch({url:t})}:void 0,1==u)try{a=y.Vue,r=y.shopConfig,a.prototype.$themeToLink=L,h=y.Toast,s=y.hylToLink}catch(e){}else 2==u&&((p=getApp()).$themeToLink=L,p.getCoupon=i,p.themeMemberCardClick=o)}function D(e){var t=I(e),n=x(e);return(e=l.includes(t)||"/goods/"==t.substr(0,7)||t.includes("/brandTopics"))||P(u)?!(0<=(e=o(t)))||(e=0==e?o("/"):e,t="/"==t?"/pages/home/main":"/pages/tabBar"+e+"/main",(e=getCurrentPages())[e.length-1].route!=t&&(c({pagePath:t+(n?"?"+n:""),pageType:2}),0)):(c({pagePath:"/pages/login/main?back="+t}),0)}async function L(t){if(console.log(t,"$themeToLink"),t.type){if(t.link&&t.link.includes("scene=sso")){if(h.loading({message:"加载中...",forbidClick:!0}),!P.call(this))return void h("请先登录");var e;1==u&&(e=(l=function(e){return 1==e?this.$store&&this.$store.state.userInfo&&null:2==e?C&&C.getStorageSync("userInfo")&&JSON.parse(C.getStorageSync("userInfo"))&&null:void 0}.call(this)).mobilephone,l=l.email,t.link=await g({toAppid:"hgFTLLhgnBmeOyCkcbyv",callbackUrl:t.link,phoneNumber:e,email:l}))}t.link&&t.link.includes("dynamicForm")&&await d().then(function(e){t.link+="&token="+e})}1==u&&s.call(this,{data:t,Vue:y.Vue,Dialog:y.Dialog,Toast:y.Toast,hyl:y.hyl,dateFilter:y.dateFilter,shopConfig:y.shopConfig});var n,i,o,a,r,l=t.type;2!=l&&2==u&&(D(t),!D(t))||(null!=l&&"undefined"!=l?0==l||(1==l?"/"==t.link.substring(0,1)?1==u?c.call(this,{pagePath:t.link}):2==u&&(n=T(I(t),x(t)),c({pagePath:n})):t.link.startsWith("http")||t.link.startsWith("https")?1==u?c.call(this,{pagePath:t.link,pageType:2}):(n="/pages/wxArticle/main?link="+encodeURIComponent(t.link),c({pagePath:n})):c({pagePath:t.link,pageType:2}):1.1==l?2==u?c({pagePath:t.link}):1==u&&(1==$.call(this,u)||2==$.call(this,u)?c.call(this,{pagePath:t.link,pageType:3}):h("暂不支持")):1.2==l?"outerChain:businessCenter"!=t.link?"/"==t.link.substring(0,1)?c.call(this,{pagePath:t.link}):1==u?1==this.$store.state.miniProgram||2==this.$store.state.miniProgram?(i="/pages/wxArticle/main?link="+encodeURIComponent(t.link),c.call(this,{pagePath:i,pageType:3})):c.call(this,{pagePath:t.link,pageType:2}):2==u&&(i="/pages/wxArticle/main?link="+encodeURIComponent(t.link),c.call(this,{pagePath:i,pageType:1})):(console.log(b(),"-----getGUIDE_URL()"),o=b()+"/login?mixid="+this.$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),c.call(this,{pagePath:o,pageType:2})):2==l?"themeCouponClick"==(o=t.feature.type)||0==o?1==u?this.$themeCouponClick(t.feature.value.couponCode,t.feature.value):2==u&&p.getCoupon(t.feature.value.couponCode,t.feature.value):1==o?2==t.type&&1==t.feature.type&&function(e,t){1==e?this.$nuxt.$SHARE({itemList:t.feature.value}):2==e&&p.shareInit({itemList:t.feature.value})}.call(this,u,t):"themeMemberCardClick"!=o&&2!=o||(1==u?this.$themeMemberCardClick(t.feature.value):2==u&&p.themeMemberCardClick(t.feature.value)):3==l?1==u?1==$.call(this,u)||2==$.call(this,u)?this.$store.getters["sceneModule/flushbonadingVisible"]?(a="/pages/toMini/toMini?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,c.call(this,{pagePath:a,pageType:3})):(a="/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,c({pagePath:a})):h("暂不支持"):(r="/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,c({pagePath:r})):0<t.length&&c.call(this,{pagePath:t.link})):0<t.length&&(1==u?c.call(this,{pagePath:t}):2==u&&(r=T(I(t),x(t)),c({pagePath:r}))))}t.themeToLinkInit=e}.call(this)}.call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}]},{},[2]);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment