From df52535848722485dbbbba0d41747ad6bdec61e7 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Sat, 15 Aug 2020 17:16:11 +0800 Subject: [PATCH 1/4] mine concerns 8.15 --- common/api/user.js | 6 +- common/store/index.js | 6 +- components/mine/collection-item/index.vue | 12 + pageB/sdetails/index.vue | 15 +- pageC/merchant/index.vue | 6 +- pageE/mine/MineConcerns.vue | 276 ++++++---------------- pageE/mine/storeConcerns.vue | 176 ++++++++++++++ pageE/setting/Index.vue | 4 +- pageE/setting/feedback.vue | 35 ++- pageE/setting/question.vue | 51 ++++ pages.json | 17 +- 11 files changed, 377 insertions(+), 227 deletions(-) create mode 100644 pageE/mine/storeConcerns.vue create mode 100644 pageE/setting/question.vue diff --git a/common/api/user.js b/common/api/user.js index f45dc6f..a3f8cba 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -415,7 +415,7 @@ export default { }, // 关注用户列表 attentionMemberList({ page = 1,role } = {}) { - return vm.$u.post('member/attentionMemberList', { page,role }); + return vm.$u.post('member/attentionMemberList', { page, role }); }, // 可用优惠券商品 couponGoodsList({ voucher_id, page, order }) { @@ -437,6 +437,10 @@ export default { friend_tomid:id }); }, + // 设置里的帮助 + getSettingHelpList() { + return vm.$u.post('document/help'); + } } } diff --git a/common/store/index.js b/common/store/index.js index d3f4929..91a1a40 100644 --- a/common/store/index.js +++ b/common/store/index.js @@ -18,7 +18,8 @@ const store = new Vuex.Store({ loadmore: {}, // 下拉加载返回的数据 hasLogin: false, // 登录状态 token: "", // 储存token - showLoginModel: false, // 登录框 + showLoginModel: false, // 登录框 + question: {}, // 帮助与反馈 }, getters: { getOrderAddress(state) { @@ -75,6 +76,9 @@ const store = new Vuex.Store({ }, setLoadMore(state, info) { state.loadmore = info; + }, + setQuestion(state, question) { + state.question = question; } } }) diff --git a/components/mine/collection-item/index.vue b/components/mine/collection-item/index.vue index f10dca3..6c3f3a9 100644 --- a/components/mine/collection-item/index.vue +++ b/components/mine/collection-item/index.vue @@ -46,6 +46,7 @@ export default { }, methods: { viewGoodsDetails(item) { + if(this.closeAction()) return false; const list = this.list.filter(item => { return item.show; }) @@ -57,6 +58,17 @@ export default { } }) }, + closeAction() { + let status = false; + this.list.map((val, idx) => { + if(val.show) { + status = true; + this.$set(this.list[idx], 'show', false); + }; + }) + this.$forceUpdate(); + return status; + }, getGoodsFavoritesList() { this.$u.api.getFavoritesList().then(res => { if(res.errCode == 0) { diff --git a/pageB/sdetails/index.vue b/pageB/sdetails/index.vue index c8d4af4..5e80184 100644 --- a/pageB/sdetails/index.vue +++ b/pageB/sdetails/index.vue @@ -31,9 +31,9 @@ ¥{{ goodsInfo.goods_price || '0.00' }} - - - {{ !goodsInfo.is_collect == 1 ? '收藏' : '已收藏' }} + + + {{ goodsInfo.is_collect == 1 ? '已收藏' : '收藏' }} @@ -638,7 +638,7 @@ export default { current: arr[index] }) }, - switchCollect(status) { + switchCollect(status = 0) { if(status == 1) { this.removeFavorite(); } else { @@ -646,6 +646,13 @@ export default { } }, addFavoriteGoods() { + // // 尝试登录 + // if (!this.$store.state.hasLogin) { + // uni.navigateTo({ + // url: "pageA/login/login" + // }) + // return false; + // } this.$u.api.addFavoriteGoods({ fid: this.goodsInfo.goods_id }).then(res => { if(res.errCode == 0) { this.getGoodsDetails(this.id); diff --git a/pageC/merchant/index.vue b/pageC/merchant/index.vue index 0c1b0b7..f709d3a 100644 --- a/pageC/merchant/index.vue +++ b/pageC/merchant/index.vue @@ -169,9 +169,9 @@ export default { } }, getStoreInfo() { - console.log(this.sid ) + // console.log(this.sid ) this.$u.api.getStoreInfo({ id: this.sid }).then((res)=>{ - console.log(JSON.stringify(res)) + // console.log(JSON.stringify(res)) this.info = res.data; uni.stopPullDownRefresh(); }) @@ -221,7 +221,7 @@ export default { const res = uni.getSystemInfoSync(); this.scrollHeiht = res.windowHeight - (73 + 20 + 170) + 'px'; this.paddingTop = res.windowWidth / 750 * (90 + 50) + 'px'; - console.log(this.paddingTop); + // console.log(this.paddingTop); } }, onLoad(option){ diff --git a/pageE/mine/MineConcerns.vue b/pageE/mine/MineConcerns.vue index 15de9ce..e07ff62 100644 --- a/pageE/mine/MineConcerns.vue +++ b/pageE/mine/MineConcerns.vue @@ -1,259 +1,121 @@ \ No newline at end of file diff --git a/pageE/setting/Index.vue b/pageE/setting/Index.vue index d7b084d..f89d52c 100644 --- a/pageE/setting/Index.vue +++ b/pageE/setting/Index.vue @@ -1,11 +1,11 @@ @@ -36,81 +32,151 @@ export default { data() { return { - list: [{ - checked: false, - disabled: false - }], - value: '', - login: '注册', - show: true + phone: "", + sms_code: "", + login: '绑定', + show: true, + checked: false, + // 时间 + timer: null, + is_sendcode: false, // 60s + time_count: 60, + pactList: [ "《用户协议》", "《隐私协议》", "《使用协议》" ], }; }, methods: { - // 选中某个复选框时,由checkbox时触发 - checkboxChange(e) { - //console.log(e); - }, - // 选中任一checkbox时,由checkbox-group触发 - checkboxGroupChange(e) { - // console.log(e); - }, - mask_u(){ - this.show = !this.show - }, + // 勾选协议 + change(e) { + this.checked = !this.checked; + console.log(this.checked); + }, + // 获取验证码 + getCode() { + if (this.$u.test.isEmpty(this.phone)) { + this.$refs.uToast.show({ + title: '手机号格式不能为空!', + type: 'error', + }) + return; + } + if(!(/^1[3456789]\d{9}$/.test(this.phone))){ + this.$refs.uToast.show({ + title: '手机号格式不正确!', + type: 'warning', + }) + return; + } + this.$u.api.sendSmsCode({ + member_mobile: this.phone, + smslog_type: 4, + }).then(res => { + if (res.errCode == 0) { + console.log(res); + this.$refs.uToast.show({ + title: res.message, + type: 'success', + }) + // 发送验证码 + this.getSendCode(); + } else { + this.$refs.uToast.show({ + title: res.message, + type: 'warning', + }) + } + }) + }, + // 绑定手机号 + bindPhone() { + if (this.$u.test.isEmpty(this.phone)) { + this.$refs.uToast.show({ + title: '手机号不能为空!', + type: 'error', + }) + return; + } + if(!(/^1[3456789]\d{9}$/.test(this.phone))){ + this.$refs.uToast.show({ + title: '手机号格式不正确!', + type: 'warning', + }) + return; + } + if(this.$u.test.isEmpty(this.sms_code)){ + this.$refs.uToast.show({ + title: '验证码不能为空!', + type: 'warning', + }) + return; + } + if(this.sms_code.length == 0){ + this.$refs.uToast.show({ + title: '验证码有误!', + type: 'warning', + }) + return; + } + if(!this.checked){ + this.$refs.uToast.show({ + title: '请同意协议!', + type: 'warning', + }) + return; + } + this.$u.api.mobileBind({ + member_mobile: this.phone, + sms_code: this.sms_code, + }).then(res => { + console.log(res); + if (res.errCode == 0) { + this.$refs.uToast.show({ + title: res.message, + type: 'success', + }) + uni.switchTab({ + url: '/pages/index/index' + }); + } else { + this.$refs.uToast.show({ + title: res.message, + type: 'warning', + }) + } + }) + }, + // 协议详情 + infoPact(index) { + // console.log(index); + uni.navigateTo({ + url: '/pageA/pactList/pactList?index=' + index + }); + }, + // 60s + getSendCode() { + const TIME_COUNT = 60; + if (!this.timer) { + this.time_count = TIME_COUNT; + this.is_sendcode = true; + this.timer = setInterval(() => { + if (this.time_count > 0 && this.time_count <= TIME_COUNT) { + this.time_count--; + } else { + this.is_sendcode = false; + clearInterval(this.timer); + this.timer = null; + } + }, 1000); + } + }, } }; diff --git a/pageA/login/login.vue b/pageA/login/login.vue index 97f75df..834699b 100644 --- a/pageA/login/login.vue +++ b/pageA/login/login.vue @@ -226,14 +226,20 @@ member_nickname: data.userInfo.nickName, member_avatar: data.userInfo.avatarUrl, }).then(res => { - console.log(res.errCode); if (res.errCode == 0) { this.loginIn(res.data.token); - uni.setStorageSync('user_info',res.data); + uni.setStorageSync('user_info',res.data); this.show = false; - uni.switchTab({ - url: "../../pages/index/index" - }) + console.log(res.data.member.member_mobilebind); + if(res.data.member.member_mobilebind) { + uni.switchTab({ + url: "/pages/index/index" + }); + } else { + uni.navigateTo({ + url: '/pageA/bindinges/bindinges' + }); + } } }) } @@ -247,11 +253,11 @@ uni.login({ provider: 'weixin', success: (wxres) => { - console.log(wxres); + // console.log(wxres); uni.getUserInfo({ provider: 'weixin', success: (data) => { - console.log(data); + // console.log(data); this.$u.api.wechatLogin({ member_wxopenid: data.userInfo.openId, member_nickname: data.userInfo.nickName, @@ -260,11 +266,18 @@ console.log(res); if (res.errCode == 0) { this.loginIn(res.data.token); - uni.setStorageSync('user_info',res.data); + uni.setStorageSync('user_info',res.data); this.show = false; - uni.switchTab({ - url: "../../pages/index/index" - }) + console.log(res.data.member.member_mobilebind); + if(res.data.member.member_mobilebind) { + uni.switchTab({ + url: "/pages/index/index" + }); + } else { + uni.navigateTo({ + url: '/pageA/bindinges/bindinges' + }); + } } }) } @@ -301,11 +314,11 @@ tochange() { }, - goIndex() { - uni.switchTab({ - url: "/pages/index/index" - }) - } + goIndex() { + uni.switchTab({ + url: "/pages/index/index" + }) + } }, components: { identifying diff --git a/pageA/pactList/pactList.vue b/pageA/pactList/pactList.vue index a2c407e..53f53a3 100644 --- a/pageA/pactList/pactList.vue +++ b/pageA/pactList/pactList.vue @@ -29,9 +29,9 @@ export default { document_code: 'agreement' }).then((res)=>{ // console.log(res.data.document_title); - uni.setNavigationBarTitle({ - title: res.data.document_title - }) + uni.setNavigationBarTitle({ + title: res.data.document_title + }) let data = common.unescapeHTML(res.data.document_content); this.document_content = data; }) @@ -41,9 +41,9 @@ export default { document_code: 'privacy' }).then((res)=>{ // console.log(res.data.document_title); - uni.setNavigationBarTitle({ - title: res.data.document_title - }) + uni.setNavigationBarTitle({ + title: res.data.document_title + }) let data = common.unescapeHTML(res.data.document_content); this.document_content = data }) @@ -53,9 +53,9 @@ export default { document_code: 'use' }).then((res)=>{ // console.log(res.data.document_title); - uni.setNavigationBarTitle({ - title: res.data.document_title - }) + uni.setNavigationBarTitle({ + title: res.data.document_title + }) let data = common.unescapeHTML(res.data.document_content); this.document_content = data }) @@ -69,7 +69,6 @@ export default {