Browse Source

[优化] 路由分发成为分销达人传参

threedate
邓平艺 4 years ago
parent
commit
dac3922c42
  1. 16
      pages/index/index.vue
  2. 7
      pages/route/index.vue

16
pages/index/index.vue

@ -66,14 +66,19 @@
s_id: '' s_id: ''
} }
}, },
onLoad(options) {
this.pt = options.pt || 1;
onLoad() {
this.windowHeight = getApp().globalData.windowHeight; this.windowHeight = getApp().globalData.windowHeight;
this.getCategoryList(); this.getCategoryList();
this.getShareInfo(); this.getShareInfo();
this.s_id = options.share_id
if(this.pt == 2) {
this.bindUsders()
//
let options = uni.getStorageSync('homePageOptions') || {};
if(Object.keys(options).length > 0){
this.pt = options.pt || 1;
this.s_id = options.share_id || '';
uni.removeStorageSync('homePageOptions');
if(this.pt == 2) {
this.bindUsders()
}
} }
}, },
methods: { methods: {
@ -91,6 +96,7 @@
let timeDate = Math.round(new Date().getTime() / 1000).toString(); let timeDate = Math.round(new Date().getTime() / 1000).toString();
let md5TimeDate = SparkMD5.hash(timeDate) let md5TimeDate = SparkMD5.hash(timeDate)
let nowTime = new Date().toLocaleString(); let nowTime = new Date().toLocaleString();
console.log("进来啦~~~~~")
_this.$http(_this.API.API_BINDSALES, { _this.$http(_this.API.API_BINDSALES, {
deed: md5TimeDate, deed: md5TimeDate,
sid: _this.s_id, sid: _this.s_id,

7
pages/route/index.vue

@ -38,9 +38,11 @@
// //
joinPagePath(par){ joinPagePath(par){
let path = par.page_url; let path = par.page_url;
let options = {}; // switch
let flag = true; // let flag = true; //
for(let i in par){ for(let i in par){
if(i != 'route' && i != 'page_url' && i != 'is_tabbar'){ // routepage_urlis_tabbar if(i != 'route' && i != 'page_url' && i != 'is_tabbar'){ // routepage_urlis_tabbar
options[i] = par[i];
if(flag){ if(flag){
path += '?'+ i +'='+ par[i]; path += '?'+ i +'='+ par[i];
flag = false; flag = false;
@ -49,9 +51,10 @@
} }
} }
} }
console.log(par)
console.log(par);
if(par.is_tabbar){ if(par.is_tabbar){
this.$url(path, {type: 'switch'});
uni.setStorageSync('homePageOptions', options);
this.$url(par.page_url, {type: 'switch'});
}else{ }else{
this.$url(path, {type: 'redirect'}); this.$url(path, {type: 'redirect'});
} }

Loading…
Cancel
Save