feat: requirements changed

This commit is contained in:
Mrxtyyp 2024-07-30 10:13:39 +08:00
parent 729eb7c861
commit d31ca6fc16
6 changed files with 172 additions and 20 deletions

View File

@ -274,6 +274,10 @@ export default {
let userProfile = uni.getStorageSync('userProfile'); let userProfile = uni.getStorageSync('userProfile');
return userProfile; return userProfile;
}, },
async refreshCurUserCache() {
let newUserInfo = await this.getCurUserNoCache();
uni.setStorageSync('userProfile', newUserInfo);
},
updateCache(cacheKey, cacheVal) { updateCache(cacheKey, cacheVal) {
uni.setStorageSync(cacheKey, cacheVal); uni.setStorageSync(cacheKey, cacheVal);
}, },

View File

@ -41,6 +41,10 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
isAutoClose: {
type: Boolean,
default: true
},
}, },
data() { data() {
return { return {
@ -57,7 +61,9 @@
}, },
confirmCallback(e) { confirmCallback(e) {
this.$emit('confirm'); this.$emit('confirm');
this.hideModal(); if(this.isAutoClose) {
this.isShow = false;
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name" : "dingdong-master", "name" : "dingdong-master",
"appid" : "", "appid" : "__UNI__EF8108C",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -52,7 +52,6 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
/* */
"appid" : "wx105ce607b514ff2a", "appid" : "wx105ce607b514ff2a",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,

View File

@ -44,7 +44,7 @@
<view class="bg-white"> <view class="bg-white">
<view class="margin-top margin-lr-sm"> <view class="margin-top margin-lr-sm">
<view class="flex justify-between align-center solid-bottom padding padding-lr-lg text-lg" <view class="flex justify-between align-center solid-bottom padding padding-lr-lg text-lg"
v-for="(item, index) in menuList" @click="clickMenuItem(item)" v-for="(item, index) in menuList" :key="index" @click="clickMenuItem(item)"
v-if="item.show || (item.showByStatus ? curUserInfo.status != -1 : false)"> v-if="item.show || (item.showByStatus ? curUserInfo.status != -1 : false)">
<view class="flex justify-start align-center"> <view class="flex justify-start align-center">
<view class="margin-right-sm text-main-color text-xl"><view :class="'cuIcon-' + item.icon"></view></view> <view class="margin-right-sm text-main-color text-xl"><view :class="'cuIcon-' + item.icon"></view></view>
@ -55,6 +55,17 @@
</view> </view>
</view> </view>
</view> </view>
<confirm-modal ref="focusModal" :showCancel="false" :isAutoClose="false" confirmMsg="已关注" @confirm="checkIfFollow()">
<template #contentView>
<view style="display: flex;flex-direction: column;justify-content: center;align-items: center;">
<text style="font-size: 30rpx;margin-bottom: 30rpx;font-weight: 500;">先关注公众号绑定订单通知</text>
<image style="width: 400upx;height: 400upx;margin-bottom: 20upx;" :show-menu-by-longpress="true" src="http://gqz.opsoul.com/qrcode_for_gh_e1c9ac86741f_860.jpg" mode="aspectFill"></image>
<text style="margin-bottom: 20upx;">操作方式</text>
<text>长按二维码前往公众号点关注</text>
</view>
</template>
</confirm-modal>
</view> </view>
</template> </template>
@ -86,8 +97,15 @@
icon: 'profile', icon: 'profile',
pageUrl: '/pages/my/master-settled-info', pageUrl: '/pages/my/master-settled-info',
show: true show: true
}, { },
name: '个人信息', {
name: '订单通知绑定',
icon: 'roundcheck',
show: true,
prefixFun: 'showFollowBox'
},
{
name: '商家信息',
icon: 'lock', icon: 'lock',
pageUrl: '/pages/my/personal-info', pageUrl: '/pages/my/personal-info',
show: true show: true
@ -123,6 +141,7 @@
}, },
methods: { methods: {
async loadData() { async loadData() {
await this.$request.refreshCurUserCache();
this.curUserInfo = this.$request.getCurUserInfo(); this.curUserInfo = this.$request.getCurUserInfo();
let res = await this.$request.getWorkerCertify(); let res = await this.$request.getWorkerCertify();
this.curCertifyInfo = res.data; this.curCertifyInfo = res.data;
@ -142,6 +161,58 @@
uni.navigateTo({ uni.navigateTo({
url: pageUrl 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;
}
} }
}, },
} }

View File

@ -84,11 +84,13 @@
<!-- <invite-master ref="inviteMasterModal" :inviteMasterObj="inviter" @confirm="inviteMaster"></invite-master> --> <!-- <invite-master ref="inviteMasterModal" :inviteMasterObj="inviter" @confirm="inviteMaster"></invite-master> -->
<confirm-modal ref="inviteMasterModal" :content="'是否确认加入' + inviter.name + '的团队?'" @confirm="inviteMaster(inviter)"></confirm-modal> <confirm-modal ref="inviteMasterModal" :content="'是否确认加入' + inviter.name + '的团队?'" @confirm="inviteMaster(inviter)"></confirm-modal>
<confirm-modal ref="focusModal" :showCancel="false"> <confirm-modal ref="focusModal" cancelMsg="返回" :isAutoClose="false" confirmMsg="已关注,继续注册" @cancel="cancelFollow" @confirm="checkIfFollow()">
<template #contentView> <template #contentView>
<view style="display: flex;flex-direction: column;justify-content: center;align-items: center;"> <view style="display: flex;flex-direction: column;justify-content: center;align-items: center;">
<image style="width: 400upx;height: 400upx;margin-bottom: 50upx;" :show-menu-by-longpress="true" src="http://gqz.opsoul.com/qrcode_for_gh_e1c9ac86741f_860.jpg" mode="aspectFill"></image> <text style="font-size: 30rpx;margin-bottom: 30rpx;font-weight: 500;">先关注公众号绑定订单通知</text>
<text>为了方便工单进度通知请关注公众号</text> <image style="width: 400upx;height: 400upx;margin-bottom: 20upx;" :show-menu-by-longpress="true" src="http://gqz.opsoul.com/qrcode_for_gh_e1c9ac86741f_860.jpg" mode="aspectFill"></image>
<text style="margin-bottom: 20upx;">操作方式</text>
<text>长按二维码前往公众号点关注</text>
</view> </view>
</template> </template>
</confirm-modal> </confirm-modal>
@ -126,13 +128,17 @@
changeAgreeContract() { changeAgreeContract() {
this.agreeContract = !this.agreeContract; this.agreeContract = !this.agreeContract;
}, },
changeOperType() { async changeOperType() {
this.reset(); this.reset();
this.operType = this.operType === 0 ? 1 : 0; this.operType = this.operType === 0 ? 1 : 0;
if (this.operType === 1) { if (this.operType === 1) {
const status = await this.checkBeforeFollow()
if(!status) {
this.$refs.focusModal.showModal(); this.$refs.focusModal.showModal();
} else {
this.authLogin(); this.authLogin();
} }
}
}, },
reset() { reset() {
this.formData = {}; this.formData = {};
@ -320,6 +326,41 @@
icon: 'error' 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();
} }
}, },
} }
@ -379,5 +420,6 @@
position: relative; position: relative;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
flex-basis: 140rpx;
} }
</style> </style>

View File

@ -3,13 +3,18 @@
<!-- 顶部操作条 --> <!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true"> <cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block> <block slot="backText">返回</block>
<block slot="content">个人信息</block> <block slot="content">商家信息</block>
</cu-custom> </cu-custom>
<form @submit="submit"> <form @submit="submit">
<view class="text-center padding-tb-lg">
<button class="cu-avatar round"
:style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.workerLogoUrl + ');'"
open-type="chooseAvatar" @chooseavatar="onChooseAvatar"></button>
</view>
<view class="margin-top-sm bg-white"> <view class="margin-top-sm bg-white">
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">用户昵称</view> <view class="title">商家昵称</view>
<input name="name" :value="curUserInfo.name"></input> <input name="name" v-model="curUserInfo.name"></input>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">公司名称</view> <view class="title">公司名称</view>
@ -31,9 +36,9 @@
</view> </view>
</view> </view>
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<!-- <view class="cu-bar tabbar border shop fixed-bottom-bar"> <view class="cu-bar tabbar border shop fixed-bottom-bar">
<button class="cu-btn bg-main-color long-btn margin-lr-sm shadow-blur" form-type="submit">保存</button> <button class="cu-btn bg-main-color long-btn margin-lr-sm shadow-blur" form-type="submit">保存</button>
</view> --> </view>
</form> </form>
</view> </view>
</template> </template>
@ -42,13 +47,19 @@
export default { export default {
data() { data() {
return { return {
curUserInfo: {} curUserInfo: {},
avatarUrl: '',
} }
}, },
onLoad() { onLoad() {
this.loadData(); this.loadData();
}, },
methods: { methods: {
onChooseAvatar(e) {
this.$request.uploadFile(e.detail.avatarUrl).then((url) => {
this.curUserInfo.workerLogoUrl = url;
});
},
async loadData() { async loadData() {
this.curUserInfo = await this.$request.getCurUserNoCache(); this.curUserInfo = await this.$request.getCurUserNoCache();
}, },
@ -56,6 +67,25 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/my/account-security' 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);
}
} }
}, },
} }