diff --git a/common/api.js b/common/api.js index 1e4d43e..62dfe1f 100644 --- a/common/api.js +++ b/common/api.js @@ -9,6 +9,7 @@ export const PRODURL = 'https://mall.gxsky.com'; // 正式服请求地址 export const API_CATEGORY_LIST = '/api/category/list'; // 首页-分类 export const API_GOODS_LIST = '/api/goods/list'; // 首页-分类下商品列表 export const API_SHARE_HOME = '/api/share/home'; // 首页分享信息 +export const API_SALESMAN_BINDALL = '/api/salesman/bindAll'; // 点击链接就可以被绑定 // 用户订单 export const API_USERORDER = '/api/order/list'; diff --git a/pages/center/fans.vue b/pages/center/fans.vue index ea8e688..d1e928a 100644 --- a/pages/center/fans.vue +++ b/pages/center/fans.vue @@ -21,7 +21,7 @@ {{item.username}} {{item.state}} - {{item.share_time}} + {{item.share_time || 0}} diff --git a/pages/index/index.vue b/pages/index/index.vue index 7bfe630..e6bfc92 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -78,6 +78,8 @@ uni.removeStorageSync('homePageOptions'); if(this.pt == 2) { this.bindUsders() + }else if(this.pt == 3){ + this.bindAllUsders(); } } }, @@ -96,7 +98,6 @@ let timeDate = Math.round(new Date().getTime() / 1000).toString(); let md5TimeDate = SparkMD5.hash(timeDate) let nowTime = new Date().toLocaleString(); - console.log("进来啦~~~~~") _this.$http(_this.API.API_BINDSALES, { deed: md5TimeDate, sid: _this.s_id, @@ -107,6 +108,14 @@ console.log(err) }) }, + // 小程序卡片分享的绑定 + bindAllUsders(){ + this.$http(this.API.API_SALESMAN_BINDALL, { + pid: this.s_id + }).then(res => { + this.$msg('提交审核成功'); + }) + }, // 获取分享信息 getShareInfo(){ this.$http(this.API.API_SHARE_HOME).then(res => { @@ -219,16 +228,21 @@ // this.getGoodsList(); }, onShareAppMessage(){ - const token = this.$shared.createToken(); + const userInfo = uni.getStorageSync('userinfo') || {}; + const token = this.$shared.createToken({user_id: userInfo.id}); const scene_code = this.$scene.V2_HOME_SHAREBUTTON; - let options = {route: 'home', scene_code}; + let options = { + route: 'home', + scene_code, + share_id: userInfo.id, + pt: 3 + }; this.generateKooken(token, options); // 谁分享了就生成一个token let shareInfo = { title: this.shareInfo.title || '欢迎使用时空网小程序', path: '/pages/route/index?token='+ token } - if(this.shareInfo.cover){ shareInfo.imageUrl = this.shareInfo.cover; }