Commit 56b4fc0e by 李嘉林

五粮液uat

parent 09731eb7
...@@ -15,8 +15,11 @@ export default { ...@@ -15,8 +15,11 @@ export default {
console.log(extConfig, "-----------extConfig"); console.log(extConfig, "-----------extConfig");
if (JSON.stringify(extConfig) == "{}") { if (JSON.stringify(extConfig) == "{}") {
let shopItem = { let shopItem = {
// development: { mixid: "ssa", "shopid": 2342}, //五粮液uat
development: { mixid: "antgood", "shopid": 67}, development: { mixid: "antgood", "shopid": 67},
production: { "mixid":"qiyeCT", "shopid": 1045 }, // 道可 // production: { "mixid":"qiyeCT", "shopid": 1045 }, // 道可
// production: { "mixid":"metasense_doctors", "shopid": 1238 }, // 册为医护端
production: { "mixid":"3QqsFT", "shopid": 1337 },
// production: { "mixid":"5I5Dyk", "shopid": 1306 }, // 星期八 // production: { "mixid":"5I5Dyk", "shopid": 1306 }, // 星期八
// production: { "mixid":"RON", "shopid": 1503 }, // 荣恩 // production: { "mixid":"RON", "shopid": 1503 }, // 荣恩
// production: { "mixid":"ant", "shopid": 6 }, // 小工蚁 // production: { "mixid":"ant", "shopid": 6 }, // 小工蚁
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
</template> </template>
<script> <script>
let forUrlAddKey = require("mayi-front-tools/forUrlAddKey").default;
import { import {
getUrlofLink, getUrlofLink,
checkTabbarPage, checkTabbarPage,
...@@ -53,10 +54,10 @@ export default { ...@@ -53,10 +54,10 @@ export default {
if (offlineShopCode) { if (offlineShopCode) {
this.params+=`&offlineShopCode=${offlineShopCode}&offlineShopName=${offlineShopName}` this.params+=`&offlineShopCode=${offlineShopCode}&offlineShopName=${offlineShopName}`
} }
return ( let pageUrl1 = (this.page.startsWith('http://') || this.page.startsWith('https://'))? (this.page + this.params) : this.link+this.page+this.params
this.link + let pageUrl = forUrlAddKey(decodeURIComponent(pageUrl1));
this.page + this.params + this.ss+this.timestamp console.log(pageUrl,'--pageUrl')
); return pageUrl + this.ss + this.timestamp;
} }
}, },
onLoad(options) { onLoad(options) {
......
!function i(o,a,l){function r(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 r(o[t][1][e]||e)},n,n.exports,i,o,a,l)}return a[t].exports}for(var s="function"==typeof require&&require,e=0;e<l.length;e++)r(l[e]);return r}({1:[function(e,t,n){var i,o,t=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function r(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:l}catch(e){o=l}}();var s,c=[],p=!1,g=-1;function u(){p&&s&&(p=!1,s.length?c=s.concat(c):g=-1,c.length&&d())}function d(){if(!p){var e=r(u);p=!0;for(var t=c.length;t;){for(s=c,c=[];++g<t;)s&&s[g].run();g=-1,t=c.length}s=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===l||!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 h(e,t){this.fun=e,this.array=t}function m(){}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];c.push(new h(e,t)),1!==c.length||p||r(d)},h.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=m,t.addListener=m,t.once=m,t.off=m,t.removeListener=m,t.removeAllListeners=m,t.emit=m,t.prependListener=m,t.prependOnceListener=m,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,a){!function(o,t){!function(){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hylBannerLink=i,a.hylToLink=c;var r=void 0,h=void 0,m=void 0,f=void 0,k=void 0,s=void 0,v="",n=null;function i(e){var t,n,i,o,a,l,r,s,c,p,g,u,d;v=$nuxt.$store,console.log("hylBannerLink",e),3!=e.type?1.1==e.type&&(1==v.state.miniProgram||2==v.state.miniProgram?-1<e.link.indexOf("pages/hiberDrawEntity/hiberDrawEntity")?(t=e.link.split("?"))[1]&&t[1].split("=")[1]&&(r=JSON.parse(decodeURIComponent(t[1].split("=")[1])),c=(s=r).id,p=r.type,g=r.isOpenDraw,u=k.formatDate.format(new Date),d=(d=r.validTimeEnd).split(".").join("-"),2==r.validTimeEnd.split(" ").length||(u=u.split(" ")[0]),u=(u=new Date(d.replace(/-/g,"/")).getTime()-new Date(u.replace(/-/g,"/")).getTime())/1e3,2==g?0<=u?(1==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),2==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),3==p&&$mp.miniProgram.navigateTo({url:"/pages/draw/turntable/turntable?id="+c})):2==p&&null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?perdraw=33&id="+c}):2==p&&null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):h.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):1==p?null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):2==p?null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):null==s.drawRecordEntity?h.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c})):-1<e.link.indexOf("type")?(t=e.link.split("?"),"[object Array]"==Object.prototype.toString.call(t)&&t.length&&(l=t[1].split("&"),n={},l.forEach(function(e){e.split("="),n[e.split("=")[0]]=e.split("=")[1]}),console.log(n),i=n.id,o=n.jumpScore,a=n.type,v.state.sessionId?f.getConsumerScoreFlag({outId:v.state.userInfo.mixId,advertisementId:i}).then(function(e){0==e.code&&(1==e.object?(o&&0<o&&f.changeScore({outId:v.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:v.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"))&&(l=y($nuxt.$route.query.mixid+"_location")&&JSON.parse(y($nuxt.$route.query.mixid+"_location")).outId,console.log(l,"跳转id"),l&&(e.link.includes("?")?e.link=e.link+"&addressId="+l:e.link=e.link+"?addressId="+l)),$mp.miniProgram.navigateTo({url:e.link})):m("暂不支持")):1==v.state.miniProgram||2==v.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/toMini/toMini?weappPage="+encodeURIComponent(e.link)+"&weappAppId="+e.name}):m("暂不支持")}function c(e){if(e=e.data,console.log("----工具中hyl"),n=e.type,(v=$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!=v.state.miniProgram&&2!=v.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(s.GUIDE_URL,"-----shopConfig.GUIDE_URL"),t=s.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==v.state.miniProgram||2==v.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 y(e){if(o.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(a,"__esModule",{value:!0}),a.themeToLinkInit=e,a.$themeToLink=M;var p=null,g=null,u=null,r=void 0,d=void 0,s=void 0,m=void 0,c=void 0,w=void 0,C=void 0,P=void 0,T=999999;function I(e,t){t=1<arguments.length&&void 0!==t?t:"";return"../index/main?from=themeLink&backpath="+encodeURIComponent(e)+"&params="+encodeURIComponent(t)}function b(){return 1==p?this.$store&&this.$store.state.sessionId&&this.$store.state.sessionId:2==p?C&&C.getStorageSync("sessionid"):void 0}function $(){return 1==p&&this.$store&&this.$store.state.miniProgram}function x(){return 1==p?s.GUIDE_URL:2==p?config.GUIDE_URL:void 0}function D(e){return e.link?e.link.split("?")[0]:""}function L(e){var e=e.link.split("?"),n=[];return e.forEach(function(e,t){1<=t&&n.push(e)}),n.join("?")||""}function U(t){var e=getApp();return e.globalData.footerVal?e.globalData.footerVal.componentData.list.findIndex(function(e){return D(e.link)==t.split("?")[0]}):-1}var R=["index","media-video","goods-goodsInfo","goods-commodityMenu","goodsSearch-goodsSearch", "goodsSearch-searchAllGoods", "contentSearch-contentSearch","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","enterpriseCustomerRegistration","merchantsDetail"].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,a=e.themeScanningCodeClick,l=e.requireFun,e=e.extend;if(P=e,p=t,w=l,console.log(w,"-------------------------115"),d=w.createdUserJWT,w.getBcakUrl,!(C=n)||(n=C.getAccountInfoSync&&C.getAccountInfoSync())&&(T=n.miniProgram.version||999999),console.log(T,"---------------miniVersion"),console.log(p,"-------------themeToLinkInit"),console.log("toPage-------------"),u=1==p?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==p?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?(console.log("pagePath",t),C.navigateTo({url:t})):2==e&&C.reLaunch({url:t})}:void 0,1==p)try{r=w.Vue,s=w.shopConfig,w.shopMixid,r.prototype.$themeToLink=M,m=w.Toast,c=w.hylToLink}catch(e){}else 2==p&&((g=getApp()).$themeToLink=M,g.getCoupon=i,g.themeMemberCardClick=o,g.themeScanningCodeClick=a)}function S(e){if(!(e=e.split("?")[1]))return{};for(var t=e.split("&"),n={},i=0;i<t.length;i++){var o=t[i].indexOf("="),a=t[i].slice(0,o),o=t[i].slice(o+1);console.log(81,this),n[a]=o}return console.log(n,"-------------obj"),n}async function M(t){if(console.log(t,"$themeToLink"),console.log(P,"extend======="),console.log("data",t),0!=t.type){var e,n,i,o,a,l,r=t.type;if(r){if(P.loginIntercept&&!b.call(this)){console.log("走进来了");var s="/pages/login/main?back="+D(t)+"&params="+JSON.stringify(S(t.link));return u({pagePath:s}),!1}if(t.link&&t.link.includes("dynamicForm")){if(!b.call(this))return console.log("走进来了--dynamicForm"),s="/pages/login/main?back="+D(t)+"&params="+JSON.stringify(S(t.link)),u({pagePath:s}),!1;await d().then(function(e){t.link+="&token="+e}).catch(function(e){})}}1==p&&this.$store.getters["sceneModule/flushbonadingVisible"]?c.call(this,{data:t,Vue:w.Vue,Dialog:w.Dialog,Toast:w.Toast,hyl:w.hyl,dateFilter:w.dateFilter,shopConfig:w.shopConfig}):(console.log(t.key,"----------------------key"),(2==r||2!=p||t.key&&t.key.startsWith("1.9")||t.link.startsWith("/article/")||function(e){var t=D(e),n=L(e);if(R.includes(t)||"/goods/"==t.substr(0,7)||t.includes("/brandTopics")||t.startsWith("/activty/")||t.includes("dk.taokor.cn")||b.call(this))return i=U(t),console.log(e.link,"------------data.link"),!(0<=i||e.link.includes("/activty/")&&e.link.includes("tabClick"))||(console.log("底部栏"),i=0==i?U("/"):i,t="/"==t?"/pages/home/main":"/pages/tabBar"+i+"/main",(i=getCurrentPages())[i.length-1].route!=t&&(n=n?"?"+n:"",console.log(n,"--------------247"),u({pagePath:t+n,pageType:2}),0));var i="",i=-1<n.indexOf("scene=sso")?"/pages/login/main?back="+t+"&ossLink="+encodeURIComponent(n):(console.log(encodeURIComponent(JSON.stringify(S(e.link))),"------------------------JSON.stringify(parseQueryString(data.link))"),"/pages/login/main?back="+t+"&params="+encodeURIComponent(JSON.stringify(S(e.link))));return console.log(i,"------------------------190"),u({pagePath:i}),0}(t))&&(null!=r&&"undefined"!=r?(console.log("---------跳过登录判断"),1==r?"/"==t.link.substring(0,1)?t.link&&t.link.startsWith("/personalCenter/userInfo")?(console.log(1==$.call(this),2==p,"------getIsMini.call(this) == 1 || homeNative == 2"),1==$.call(this)||2==p?(e="/pages/userInfo/main",console.log("url",e),u({pagePath:e,pageType:2==p?1:3})):u.call(this,{pagePath:t.link})):t.link&&t.link.startsWith("/pay/paySuccess")?(console.log(1==$.call(this),2==p,"------getIsMini.call(this) == 1 || homeNative == 2"),console.log(T,"--miniVersion"),(1==$.call(this)||2==p)&&284<T?(e="/pages/paySuccess/main?"+t.link.split("?")[1],console.log("url",e),u({pagePath:e,pageType:2==p?2:3})):u.call(this,{pagePath:t.link})):t.link&&t.link.startsWith("/personalCenter/vip/vipMobileCard")?(console.log(1==$.call(this),2==p,"------getIsMini.call(this) == 1 || homeNative == 2"),1==$.call(this)||2==p?(n="/pages/memberCode/main",console.log("url",n),u({pagePath:n,pageType:2==p?1:3})):u.call(this,{pagePath:t.link})):t.link&&t.link.startsWith("/article/")&&!t.link.startsWith("/article/articleList")?(console.log(t.link&&t.link.startsWith("/article/")&&!t.link.startsWith("/article/articleList"),t.link,p,"--data.link"),console.log(1==$.call(this),2==p,"------getIsMini.call(this) == 1 || homeNative == 2"),1==$.call(this)||2==p?(n="/pages/pages_subpack/article/main?article_id="+(n=t.link.split("/"))[n.length-1],console.log("url",n),u({pagePath:n,pageType:2==p?1:3})):u.call(this,{pagePath:t.link})):1==p?u.call(this,{pagePath:t.link}):2==p&&(i=I(D(t),L(t)),console.log("url",i),u({pagePath:i})):t.link.startsWith("http")||t.link.startsWith("https")?1==p?u.call(this,{pagePath:t.link,pageType:2}):(i="/pages/wxArticle/main?link="+encodeURIComponent(t.link),u({pagePath:i})):u({pagePath:t.link,pageType:2}):1.1==r?2==p?u({pagePath:t.link}):1==p&&(1==$.call(this)||2==$.call(this)?u.call(this,{pagePath:t.link,pageType:3}):m("暂不支持")):1.2==r?"outerChain:businessCenter"!=t.link?"/"==t.link.substring(0,1)?u.call(this,{pagePath:t.link}):1==p?1==this.$store.state.miniProgram||2==this.$store.state.miniProgram?(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),u.call(this,{pagePath:o,pageType:3})):u.call(this,{pagePath:t.link,pageType:2}):2==p&&(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),u.call(this,{pagePath:o,pageType:1})):(console.log(x(),"-----getGUIDE_URL()"),a=x()+"/login?mixid="+this.$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),u.call(this,{pagePath:a,pageType:2})):2==r?"themeCouponClick"==(a=t.feature.type)||0==a?1==p?this.$themeCouponClick(t.feature.value.couponCode,t.feature.value):2==p&&g.getCoupon(t.feature.value.couponCode,t.feature.value):1==a?2==t.type&&1==t.feature.type&&function(e){1==p?this.$nuxt.$SHARE({itemList:e.feature.value}):2==p&&g.shareInit({itemList:e.feature.value})}.call(this,t):"themeMemberCardClick"==a||2==a?1==p?this.$themeMemberCardClick(t.feature.value):2==p&&g.themeMemberCardClick(t.feature.value):3==a&&(1==p?this.$themeScanningCodeClick():2==p&&g.themeScanningCodeClick()):3==r?(console.log(p,"-----------------homeNative"),1==p?1==$.call(this)||2==$.call(this)?(r=this.$store.getters["sceneModule/flushbonadingVisible"]?"/pages/toMini/toMini?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name:"/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,u.call(this,{pagePath:r,pageType:3})):m("暂不支持"):t.key&&t.key.startsWith("1.9")?function(e){if(console.log("sss",e),2==p)switch(e.key){case"1.9.1":console.log("begin"),C.openChannelsActivity?C.openChannelsActivity({finderUserName:e.name,feedId:e.link,success:function(){console.log("success")},fail:function(){console.log("fail"),E.call(this,"提示","打开视频号失败")}}):E.call(this),console.log("end");break;case"1.9.2":console.log("begin"),C.openChannelsEvent?C.openChannelsEvent({finderUserName:e.name,eventId:e.link,fail:function(){E.call(this,"提示","打开视频号活动失败")}}):E.call(this),console.log("end")}}.call(this,t):(l="/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,u({pagePath:l}))):0<t.length&&u.call(this,{pagePath:t.link})):0<t.length&&(1==p?u.call(this,{pagePath:t}):2==p&&(l=I(D(t),L(t)),u({pagePath:l})))))}else console.log("无链接--return")}function E(){C.showModal({title:0<arguments.length&&void 0!==arguments[0]?arguments[0]:"提示",content:1<arguments.length&&void 0!==arguments[1]?arguments[1]:"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"}),console.log("不支持")}t.themeToLinkInit=e}.call(this)}.call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}]},{},[2]); let homeNative = null; //首页环境 1:h5 2:小程序 3:头条
\ No newline at end of file let miniApp = null;
let toPageFun = null;
let Vue,
createdUserJWT,
getBcakUrl,
shopConfig,
shopMixid,
Toast,
hylToLink,
requireFun,
wx,
extend,
miniVersion = 999999;
// 登录白名单 name
const noLoginList = [
"index",
"media-video",
"goods-goodsInfo",
"goods-commodityMenu",
"goodsSearch-goodsSearch",
"contentSearch-contentSearch",
"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",
"enterpriseCustomerRegistration",
"merchantsDetail"
];
// 函数柯里化
/**
* @pageUrl pageUrlVal:跳转链接
*/
// 调用方法使用.call
function toPage() {
console.log("toPage-------------");
if (homeNative == 1) {
return function({ pagePath, pageType = 1 }) {
if (pageType == 1) {
this.$router.push(pagePath);
} else if (pageType == 2) {
window.location.href = pagePath;
} else if (pageType == 3) {
wx.navigateTo({ url: pagePath }); // 指定页面的url
}
};
} else if (homeNative == 2) {
return function({ pagePath, pageType = 1 }) {
if (pageType == 1) {
console.log('pagePath',pagePath);
wx.navigateTo({ url: pagePath });
} else if (pageType == 2) {
wx.reLaunch({ url: pagePath });
}
};
}
}
function toPageUrl(backPath, backParams = "") {
return `../index/main?from=themeLink&backpath=${encodeURIComponent(
backPath
)}&params=${encodeURIComponent(backParams)}`;
}
function getSessionId() {
if (homeNative == 1) {
return (
this.$store && this.$store.state.sessionId && this.$store.state.sessionId
);
} else if (homeNative == 2) {
return wx && wx.getStorageSync("sessionid");
}
}
function getIsMini() {
return homeNative == 1 && this.$store && this.$store.state.miniProgram;
}
function getUserInfo() {
if (homeNative == 1) {
return this.$store && this.$store.state.userInfo;
} else if (homeNative == 2) {
console.log(
wx.getStorageSync("userInfo"),
'---wx.getStorageSync("userInfo")'
);
return (
wx &&
wx.getStorageSync("userInfo") &&
JSON.parse(wx.getStorageSync("userInfo"))
);
}
}
//商家中心外链(小程序使用 /pages/wxArticle/main?link 这个方法跳转)
function getGUIDE_URL() {
if (homeNative == 1) {
return shopConfig.GUIDE_URL;
} else if (homeNative == 2) {
return config.GUIDE_URL;
}
}
// 分享
function toShare(data) {
if (homeNative == 1) {
this.$nuxt.$SHARE({ itemList: data.feature.value });
} else if (homeNative == 2) {
miniApp.shareInit({ itemList: data.feature.value });
}
}
// 获取link 中页面地址(link兼容 有object或者string)
function getUrlofLink(data) {
return data.link?data.link.split("?")[0] : "";
}
function getUrlofQuery(data) {
let arr = data.link.split("?")
let params = [];
arr.forEach((res,index)=>{
if(index>=1) {
params.push(res)
}
})
return params.join("?") || "";
}
// check 链接是否为底部导航栏页面 返回索引
function checkTabbarPage(link) {
let app = getApp();
if (!app.globalData.footerVal) return -1;
let footerVal = app.globalData.footerVal.componentData.list;
let isFooter = footerVal.findIndex(item => {
return getUrlofLink(item.link) == link.split("?")[0];
});
return isFooter;
}
const noLoginListPath = noLoginList.map(item => {
item = item.replace(/-/g, "/");
item = "/" + item;
item == "/index" && (item = "/");
return item;
});
export function themeToLinkInit({
homeNative: shop_env,
wx: wxName,
getCoupon,
themeMemberCardClick,
themeScanningCodeClick,
requireFun: requireFun2,
extend : extend2
}) {
extend = extend2
homeNative = shop_env;
requireFun = requireFun2;
console.log(requireFun, "-------------------------115");
createdUserJWT = requireFun.createdUserJWT;
getBcakUrl = requireFun.getBcakUrl;
wx = wxName;
if (wx) {
// 获取小程序版本号
let accountInfo = wx.getAccountInfoSync && wx.getAccountInfoSync();
if (accountInfo) {
miniVersion = accountInfo.miniProgram.version || 999999; // 1.0.0 小程序版本号
}
}
console.log(miniVersion,'---------------miniVersion')
console.log(homeNative, "-------------themeToLinkInit");
toPageFun = toPage(homeNative);
if (homeNative == 1) {
try {
Vue = requireFun.Vue;
shopConfig = requireFun.shopConfig;
shopMixid = requireFun.shopMixid;
Vue.prototype.$themeToLink = $themeToLink;
Toast = requireFun.Toast;
hylToLink = requireFun.hylToLink;
} catch (error) {}
} else if (homeNative == 2) {
miniApp = getApp();
miniApp.$themeToLink = $themeToLink;
miniApp.getCoupon = getCoupon;
miniApp.themeMemberCardClick = themeMemberCardClick;
miniApp.themeScanningCodeClick = themeScanningCodeClick;
}
}
function parseQueryString(url) {
let str = url.split("?")[1]
if(!str){
return {}
}
let items = str.split("&");
let arr, name, value;
let obj={}
for (var i = 0; i < items.length; i++) {
let spliceIndex = items[i].indexOf("=");
// arr = items[i].split("="); //["key0", "0"]
name = items[i].slice(0,spliceIndex);
value = items[i].slice(spliceIndex + 1);
console.log(81, this)
obj[name]=value
}
console.log(obj,'-------------obj')
return obj
}
function loginInterception(data) {
// 登录拦截
let parseLink = getUrlofLink(data);
let parseQuery = getUrlofQuery(data);
let noLogin =
noLoginListPath.includes(parseLink) ||
parseLink.substr(0, 7) == "/goods/" ||
parseLink.includes("/brandTopics") ||
parseLink.startsWith('/activty/') ||
parseLink.includes('dk.taokor.cn') || // 道可
parseLink.includes('uat-zanmall-m.cipmp.com') || // 五粮液uat
parseLink.includes('swt.wuliangye.com.cn'); // 五粮液prod
if (!noLogin && !getSessionId.call(this)) {
let url = ''
if(parseQuery.indexOf('scene=sso')>-1) {
url = `/pages/login/main?back=${parseLink}&ossLink=${encodeURIComponent(parseQuery)}`;
} else {
console.log(encodeURIComponent(JSON.stringify(parseQueryString(data.link))),'------------------------JSON.stringify(parseQueryString(data.link))')
url = `/pages/login/main?back=${parseLink}&params=${encodeURIComponent(JSON.stringify(parseQueryString(data.link)))}`;
}
console.log(url,'------------------------190')
toPageFun({ pagePath: url});
return false;
}
//判断是否市跳转到tabbar页面 替换首页位置
let isTabbarIndex = checkTabbarPage(parseLink);
/**
* 如果是点击底部导航或者底部导航有自定义页面且点击的为底部导航设置的自定义页面有tabClick这个参数(不是页面设置的自定义页面链接没有)
* 以此来区分
*/
console.log(data.link, '------------data.link')
if (isTabbarIndex >= 0 || ((data.link.includes("/activty/") && data.link.includes("tabClick")))) {
console.log('底部栏')
// 无底部栏h5页面
// if (!containFooterPage.includes(parseLink)) {
// toPage(getUrlofLink(data), getUrlofQuery(data))
// return
// }
isTabbarIndex = isTabbarIndex == 0 ? checkTabbarPage("/") : isTabbarIndex;
let url =
parseLink == "/"
? `/pages/home/main`
: `/pages/tabBar${isTabbarIndex}/main`;
let routes = getCurrentPages();
let currentPage = routes[routes.length - 1].route;
if (currentPage == url) return;
let query = parseQuery ? `?${parseQuery}` : "";
console.log(url,query,parseQuery, '--------------247')
toPageFun({ pagePath: url + query, pageType: 2 });
return false;
}
return true;
}
export async function $themeToLink(data) {
console.log(data, "$themeToLink");
console.log(extend,'extend=======')
console.log('data',data);
if (data.type == 0) {
console.log("无链接--return")
return;
}
// 第三方嵌入系统
let type = data.type;
if (type) {
if(extend.loginIntercept && !getSessionId.call(this)){
console.log('走进来了')
let url = `/pages/login/main?back=${getUrlofLink(data)}&params=${JSON.stringify(parseQueryString(data.link))}`;
toPageFun({ pagePath: url});
return false
}
// if (data.link && data.link.includes("scene=sso")) {
// //?token=${token}&scene=sso
// if (!getSessionId.call(this)) {
// Toast("请先登录");
// return;
// }
// let { mobilephone: phoneNumber, email } = getUserInfo.call(
// this,
// homeNative
// );
// data.link = await getBcakUrl({
// toAppid: "hgFTLLhgnBmeOyCkcbyv",
// callbackUrl: data.link,
// phoneNumber,
// email
// });
// }
if (data.link && data.link.includes("dynamicForm")) {
if (!getSessionId.call(this)) {
console.log('走进来了--dynamicForm')
let url = `/pages/login/main?back=${getUrlofLink(data)}&params=${JSON.stringify(parseQueryString(data.link))}`;
toPageFun({ pagePath: url});
return false
} else {
await createdUserJWT().then(res => {
data.link += `&token=${res}`;
}).catch(err => {
});
}
}
}
//商城跳转到嗨有料首页
if (homeNative == 1 && this.$store.getters["sceneModule/flushbonadingVisible"]) {
hylToLink.call(this, {
data,
Vue: requireFun.Vue,
Dialog: requireFun.Dialog,
Toast: requireFun.Toast,
hyl: requireFun.hyl,
dateFilter: requireFun.dateFilter,
shopConfig: requireFun.shopConfig
});
return;
}
console.log(data.key,'----------------------key')
if (type != 2 && homeNative == 2 && !(data.key && data.key.startsWith("1.9")) && !(data.link.startsWith('/article/'))) {
let loginInterceptionVal = loginInterception(data);
if (!loginInterceptionVal) {
return;
}
}
////向后兼容 兼容老数据
if (type == undefined || type == "undefined") {
if (data.length > 0) {
if (homeNative == 1) {
toPageFun.call(this, { pagePath: data });
} else if (homeNative == 2) {
let url = toPageUrl(getUrlofLink(data), getUrlofQuery(data));
toPageFun({ pagePath: url });
}
}
return;
}
console.log('---------跳过登录判断')
//----
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);
// }
// 文章页面跳转 小程序环境(getIsMini.call(this) == 1)都跳转到小程序页面
// web环境下(h5,webview)跳转到h5页面
if (data.link && (data.link.startsWith('/personalCenter/userInfo'))) {
console.log(getIsMini.call(this) == 1, homeNative == 2,'------getIsMini.call(this) == 1 || homeNative == 2')
if ((getIsMini.call(this) == 1 || homeNative == 2)) {
let url = `/pages/userInfo/main`
console.log('url',url);
toPageFun({ pagePath: url, pageType: homeNative == 2?1:3 });
} else {
toPageFun.call(this, { pagePath: data.link });
}
} else if (data.link && (data.link.startsWith('/pay/paySuccess'))) {
console.log(getIsMini.call(this) == 1, homeNative == 2,'------getIsMini.call(this) == 1 || homeNative == 2')
// 判断小程序版本号
console.log(miniVersion,'--miniVersion')
if ((getIsMini.call(this) == 1 || homeNative == 2) && miniVersion > 284) {
let url = `/pages/paySuccess/main?${data.link.split('?')[1]}`
console.log('url',url);
toPageFun({ pagePath: url, pageType: homeNative == 2?2:3 });
} else {
toPageFun.call(this, { pagePath: data.link });
}
} else if (data.link && (data.link.startsWith('/personalCenter/vip/vipMobileCard'))) {
console.log(getIsMini.call(this) == 1, homeNative == 2,'------getIsMini.call(this) == 1 || homeNative == 2')
if (getIsMini.call(this) == 1 || homeNative == 2) {
let url = `/pages/memberCode/main`
console.log('url',url);
toPageFun({ pagePath: url, pageType: homeNative == 2?1:3 });
} else {
toPageFun.call(this, { pagePath: data.link });
}
} else if (data.link && (data.link.startsWith('/article/') && !data.link.startsWith('/article/articleList'))) {
console.log(data.link && (data.link.startsWith('/article/') && !data.link.startsWith('/article/articleList')),data.link,homeNative,'--data.link')
console.log(getIsMini.call(this) == 1, homeNative == 2,'------getIsMini.call(this) == 1 || homeNative == 2')
if (getIsMini.call(this) == 1 || homeNative == 2) {
let idList = data.link.split('/')
let id = idList[idList.length - 1]
let url = `/pages/pages_subpack/article/main?article_id=${id}`
console.log('url',url);
toPageFun({ pagePath: url, pageType: homeNative == 2?1:3 });
} else {
toPageFun.call(this, { pagePath: data.link });
}
} else if (homeNative == 1) {
toPageFun.call(this, { pagePath: data.link });
} else if (homeNative == 2) {
let url = toPageUrl(getUrlofLink(data), getUrlofQuery(data));
console.log('url',url);
toPageFun({ 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({ pagePath: url });
}
} else {
toPageFun({ pagePath: data.link, pageType: 2 });
}
}
} else if (type == 1.1) {
//小程序页面 可能增加登录态拦截
if (homeNative == 2) {
toPageFun({ pagePath: data.link });
} else if (homeNative == 1) {
if (
getIsMini.call(this) == 1 ||
getIsMini.call(this) == 2
) {
toPageFun.call(this, { pagePath: data.link, pageType: 3 });
} 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 (homeNative == 1) {
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, pageType: 3 });
} else {
toPageFun.call(this, { pagePath: data.link, pageType: 2 });
}
} else if (homeNative == 2) {
let url = "/pages/wxArticle/main?link=" + encodeURIComponent(data.link);
toPageFun.call(this, { pagePath: url, pageType: 1 });
}
}
} 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, 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 (featureType == 3) {
// 扫码
if (homeNative == 1) {
this.$themeScanningCodeClick();
} else if (homeNative == 2) {
miniApp.themeScanningCodeClick();
}
}
} else if (type == 3) {
//小程序跳转到小程序
console.log(homeNative,'-----------------homeNative')
if (homeNative == 1) {
if (
getIsMini.call(this) == 1 ||
getIsMini.call(this) == 2
) {
if (this.$store.getters["sceneModule/flushbonadingVisible"]) {
let url = `/pages/toMini/toMini?weappPage=${encodeURIComponent(
data.link
)}&weappAppId=${data.name}`;
toPageFun.call(this, { pagePath: url, pageType: 3 });
return;
}
let url2 = `/pages/toMini/main?weappPage=${encodeURIComponent(
data.link
)}&weappAppId=${data.name}`;
toPageFun.call(this, { pagePath: url2, pageType: 3 });
} else {
Toast("暂不支持");
}
} else {
if (data.key && data.key.startsWith("1.9")) {
openChannelsActivity.call(this, data)
return
}
let url2 = `/pages/toMini/main?weappPage=${encodeURIComponent(
data.link
)}&weappAppId=${data.name}`;
toPageFun({ pagePath: url2 });
}
} else {
//向后兼容
if (data.length > 0) {
toPageFun.call(this, { pagePath: data.link });
}
}
}
//小程序跳转视频号
function openChannelsActivity(data) {
console.log('sss', data);
if (homeNative == 2) {
switch (data.key) {
// 跳转视频号
case '1.9.1':
console.log('begin');
if (wx.openChannelsActivity) {
wx.openChannelsActivity({
finderUserName: data.name,
feedId: data.link,
success:function(){
console.log('success');
},
fail: function () {
console.log('fail');
wxModel.call(this,'提示','打开视频号失败')
}
})
} else {
wxModel.call(this)
}
console.log('end');
break;
// 跳转视频号活动页
case '1.9.2':
console.log('begin');
if (wx.openChannelsEvent) {
wx.openChannelsEvent({
finderUserName: data.name, eventId: data.link, fail: function () {
wxModel.call(this,'提示','打开视频号活动失败')
}
})
} else {
wxModel.call(this)
}
console.log('end');
break
default:
break;
}
}
}
// 版本号兼容提示
function wxModel(title = '提示', content = '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。') {
wx.showModal({
title: title,
content: content
})
console.log('不支持');
}
global.themeToLinkInit = themeToLinkInit;
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