diff --git a/common/js/request.js b/common/js/request.js
index 639c7f6..3020eb1 100644
--- a/common/js/request.js
+++ b/common/js/request.js
@@ -274,6 +274,10 @@ export default {
let userProfile = uni.getStorageSync('userProfile');
return userProfile;
},
+ async refreshCurUserCache() {
+ let newUserInfo = await this.getCurUserNoCache();
+ uni.setStorageSync('userProfile', newUserInfo);
+ },
updateCache(cacheKey, cacheVal) {
uni.setStorageSync(cacheKey, cacheVal);
},
diff --git a/components/modal/confirm-modal.vue b/components/modal/confirm-modal.vue
index 73a3e15..9d22f8d 100644
--- a/components/modal/confirm-modal.vue
+++ b/components/modal/confirm-modal.vue
@@ -41,6 +41,10 @@
type: Boolean,
default: true
},
+ isAutoClose: {
+ type: Boolean,
+ default: true
+ },
},
data() {
return {
@@ -57,7 +61,9 @@
},
confirmCallback(e) {
this.$emit('confirm');
- this.hideModal();
+ if(this.isAutoClose) {
+ this.isShow = false;
+ }
}
}
}
diff --git a/manifest.json b/manifest.json
index 81c180c..df5d060 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "dingdong-master",
- "appid" : "",
+ "appid" : "__UNI__EF8108C",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@@ -52,7 +52,6 @@
"quickapp" : {},
/* 快应用特有相关 */
"mp-weixin" : {
- /* 小程序特有相关 */
"appid" : "wx105ce607b514ff2a",
"setting" : {
"urlCheck" : false,
diff --git a/pages/index/my-home.vue b/pages/index/my-home.vue
index 2192d86..db26246 100644
--- a/pages/index/my-home.vue
+++ b/pages/index/my-home.vue
@@ -44,7 +44,7 @@
@@ -54,7 +54,18 @@
-
+
+
+
+
+
+ 先关注公众号,绑定订单通知!
+
+ 操作方式
+ 长按二维码,前往公众号点关注
+
+
+
@@ -86,8 +97,15 @@
icon: 'profile',
pageUrl: '/pages/my/master-settled-info',
show: true
- }, {
- name: '个人信息',
+ },
+ {
+ name: '订单通知绑定',
+ icon: 'roundcheck',
+ show: true,
+ prefixFun: 'showFollowBox'
+ },
+ {
+ name: '商家信息',
icon: 'lock',
pageUrl: '/pages/my/personal-info',
show: true
@@ -123,6 +141,7 @@
},
methods: {
async loadData() {
+ await this.$request.refreshCurUserCache();
this.curUserInfo = this.$request.getCurUserInfo();
let res = await this.$request.getWorkerCertify();
this.curCertifyInfo = res.data;
@@ -142,6 +161,58 @@
uni.navigateTo({
url: pageUrl
})
+ },
+ async showFollowBox() {
+ const status = await this.checkBeforeFollow()
+ if(!status) {
+ this.$refs.focusModal.showModal();
+ } else {
+ uni.showToast({
+ title: '您已绑定消息通知',
+ icon: 'none'
+ })
+ }
+ },
+ async checkBeforeFollow() {
+ const wxLoginRes = await wx.login();
+ console.log(wxLoginRes);
+ const wxAuthRes = await uni.request({
+ url: '/wx/check',
+ header: {
+ code: wxLoginRes.code
+ }
+ })
+ // const wxAuthRes = await uni.request({
+ // url: '/wx/auth',
+ // header: {
+ // code: wxLoginRes.code
+ // }
+ // })
+ return wxAuthRes[1].data.data
+ },
+ async checkIfFollow() {
+ const status = await this.checkBeforeFollow()
+ // const wxLoginRes = await wx.login();
+ // const wxAuthRes = await uni.request({
+ // url: '/wx/check',
+ // header: {
+ // code: wxLoginRes.code
+ // }
+ // })
+ if(!status) {
+ uni.showToast({
+ title: '请完成公众号关注',
+ icon: 'none'
+ })
+ return;
+ } else {
+ // uni.showToast({
+ // title: '感谢您的关注!',
+ // icon: 'success'
+ // })
+ this.$refs.focusModal.hideModal();
+ return;
+ }
}
},
}
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 3ae6c37..3a7a93b 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -84,11 +84,13 @@
-
+
-
- 为了方便工单进度通知,请关注公众号
+ 先关注公众号,绑定订单通知!
+
+ 操作方式
+ 长按二维码,前往公众号点关注
@@ -126,12 +128,16 @@
changeAgreeContract() {
this.agreeContract = !this.agreeContract;
},
- changeOperType() {
+ async changeOperType() {
this.reset();
this.operType = this.operType === 0 ? 1 : 0;
if (this.operType === 1) {
- this.$refs.focusModal.showModal();
- this.authLogin();
+ const status = await this.checkBeforeFollow()
+ if(!status) {
+ this.$refs.focusModal.showModal();
+ } else {
+ this.authLogin();
+ }
}
},
reset() {
@@ -320,6 +326,41 @@
icon: 'error'
})
}
+ },
+ cancelFollow() {
+ this.reset();
+ this.operType = 0;
+ this.$refs.focusModal.isShow = false;
+ },
+
+ async checkBeforeFollow() {
+ const wxLoginRes = await wx.login();
+ const wxAuthRes = await uni.request({
+ url: '/wx/check',
+ header: {
+ code: wxLoginRes.code
+ }
+ })
+ return wxAuthRes[1].data.data
+ },
+ async checkIfFollow() {
+ const res = await this.checkBeforeFollow()
+ // const wxLoginRes = await wx.login();
+ // const wxAuthRes = await uni.request({
+ // url: '/wx/check',
+ // header: {
+ // code: wxLoginRes.code
+ // }
+ // })
+ if(!res) {
+ uni.showToast({
+ title: '请先关注公众号',
+ icon: 'error'
+ })
+ return
+ }
+ this.$refs.focusModal.isShow = false;
+ this.authLogin();
}
},
}
@@ -378,6 +419,7 @@
font-size: 30rpx;
position: relative;
height: 60rpx;
- line-height: 60rpx;
+ line-height: 60rpx;
+ flex-basis: 140rpx;
}
diff --git a/pages/my/personal-info.vue b/pages/my/personal-info.vue
index 3d76d50..5f294f9 100644
--- a/pages/my/personal-info.vue
+++ b/pages/my/personal-info.vue
@@ -3,13 +3,18 @@
返回
- 个人信息
+ 商家信息
@@ -42,13 +47,19 @@
export default {
data() {
return {
- curUserInfo: {}
+ curUserInfo: {},
+ avatarUrl: '',
}
},
onLoad() {
this.loadData();
},
methods: {
+ onChooseAvatar(e) {
+ this.$request.uploadFile(e.detail.avatarUrl).then((url) => {
+ this.curUserInfo.workerLogoUrl = url;
+ });
+ },
async loadData() {
this.curUserInfo = await this.$request.getCurUserNoCache();
},
@@ -56,6 +67,25 @@
uni.navigateTo({
url: '/pages/my/account-security'
})
+ },
+ async submit() {
+ let res = await this.$request.updateWorker({
+ workerId: this.curUserInfo.workerId,
+ name: this.curUserInfo.name,
+ workerLogoUrl: this.curUserInfo.workerLogoUrl
+ })
+ if (res && res.code === 0) {
+ uni.showToast({
+ icon: 'success',
+ title: '更新成功'
+ })
+ let timeout = setTimeout(() => {
+ uni.navigateTo({
+ url: '/pages/index/index?menuCode=myPage'
+ })
+ clearTimeout(timeout);
+ }, 1500);
+ }
}
},
}