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/center/invite.vue b/pages/center/invite.vue index 502a37c..e2fd6c9 100644 --- a/pages/center/invite.vue +++ b/pages/center/invite.vue @@ -63,7 +63,7 @@ _this.$http(_this.API.API_BILLBACKGROUND, { type: 'telent_share' }).then(res => { - let img = res.data.img_url + let img = res.data?.img_url; // ?. 运算符,解决没有图片的情况下报错 if (img) { wx.getImageInfo({ src: img, diff --git a/pages/contactService/index.vue b/pages/contactService/index.vue index f232551..225ea94 100644 --- a/pages/contactService/index.vue +++ b/pages/contactService/index.vue @@ -6,22 +6,23 @@ 服务时间 - {{ info.service_period }} + {{ info.service_period || '-' }} 客服电话 - {{ info.phone }} + {{ info.phone || '-' }} 联系地址 - {{ info.address }} + {{ info.address || '-' }} 客服微信 - + {{ info.wechat }} 复制 + - 当前版本 @@ -46,11 +47,12 @@ // 获取信息 getInfo(){ this.$http(this.API.API_CONTACT).then(res => { - this.info = res.data; + this.info = res.data || {}; }) }, // 拨打电话 makePhoneCall(){ + if(!this.info?.phone) return; uni.makePhoneCall({ phoneNumber: this.info.phone }) diff --git a/pages/goodsDetail/index.vue b/pages/goodsDetail/index.vue index 0b8b20a..8530ba4 100644 --- a/pages/goodsDetail/index.vue +++ b/pages/goodsDetail/index.vue @@ -401,7 +401,7 @@ } }, - //海报结束 + //获取商品详情 getGoodsDetail() { let that = this; this.$http(this.API.API_GOODS_DETAIL, { @@ -516,7 +516,9 @@ let options = { id: goods.id, route: 'goods', - scene_code: this.$scene.V2_GOODS_SHAREPOSTER + scene_code: this.$scene.V2_GOODS_SHAREPOSTER, + share_id: this.userInfo.id, + pt: 2 } this.generateKooken(token, options); // 谁分享了就生成一个token diff --git a/pages/index/index.vue b/pages/index/index.vue index 7bfe630..3e76152 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 => { @@ -157,6 +166,7 @@ getGoodsList(){ let per_page = this.pageSize; let tab_item = this.tab_list[this.current]; + if(this.$shared.isValueType(tab_item) == 'undefined') return; this.$http(this.API.API_GOODS_LIST, { category_id: tab_item.id, type: tab_item.type, @@ -219,16 +229,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; }