Merge branch 'fanpeng' into 'develop'

Fanpeng

See merge request StarlockTeam/wx-starlock!52
This commit is contained in:
范鹏 2025-07-15 06:49:47 +00:00
commit bc155e6b48
11 changed files with 563 additions and 215 deletions

View File

@ -31,7 +31,7 @@
return 'XHJ' return 'XHJ'
} }
// #endif // #endif
return 'PRE' return 'XHJ'
} }
}, },
computed: { computed: {

View File

@ -38,6 +38,15 @@ export function unbindEmailTokenRequest(data) {
}) })
} }
// 获取解绑手机号token
export function unbindPhoneTokenRequest(data) {
return request({
url: '/user/unbindPhoneToken',
method: 'POST',
data
})
}
// 修改绑定邮箱 // 修改绑定邮箱
export function updateEmailRequest(data) { export function updateEmailRequest(data) {
return request({ return request({
@ -47,6 +56,15 @@ export function updateEmailRequest(data) {
}) })
} }
// 修改绑定手机号
export function updatePhoneRequest(data) {
return request({
url: '/user/bindPhone',
method: 'POST',
data
})
}
// 获取邮箱验证码 // 获取邮箱验证码
export function getEmailCodeRequest(data) { export function getEmailCodeRequest(data) {
return request({ return request({
@ -137,6 +155,15 @@ export function getWebUrlRequest(data) {
}) })
} }
// 删除账号
export function deleteAccountRequest(data) {
return request({
url: '/user/delete',
method: 'POST',
data
})
}
// 退出登录 // 退出登录
export function logoutRequest(data) { export function logoutRequest(data) {
return request({ return request({

View File

@ -1,114 +1,114 @@
{ {
"name" : "星星锁Lite", "name": "星星锁Lite",
"appid" : "__UNI__933D519", "appid": "__UNI__933D519",
"description" : "", "description": "",
"versionName" : "1.3.1", "versionName": "1.3.2",
"versionCode" : "39", "versionCode": "40",
"mp-weixin" : { "mp-weixin": {
"appid" : "wx9829a39e65550757", "appid": "wx9829a39e65550757",
"setting" : { "setting": {
"urlCheck" : true, "urlCheck": true,
"minified" : true "minified": true
},
"permission" : {
"scope.bluetooth" : {
"desc" : "蓝牙将用于控制和管理您的智能门锁"
}
},
"usingComponents" : true,
"lazyCodeLoading" : "requiredComponents",
"optimization" : {
"subPackages" : true
},
"plugins" : {
"wmpf-voip" : {
"version" : "latest",
"provider" : "wxf830863afde621eb",
"genericsImplementation" : {
"call-page-plugin" : {
"custombox" : "pages/main/customBox"
}
}
}
}
}, },
"vueVersion" : "3", "permission": {
"app-plus" : { "scope.bluetooth": {
"distribute" : { "desc": "蓝牙将用于控制和管理您的智能门锁"
"icons" : { }
"android" : { },
"hdpi" : "unpackage/res/icons/72x72.png", "usingComponents": true,
"xhdpi" : "unpackage/res/icons/96x96.png", "lazyCodeLoading": "requiredComponents",
"xxhdpi" : "unpackage/res/icons/144x144.png", "optimization": {
"xxxhdpi" : "unpackage/res/icons/192x192.png" "subPackages": true
}, },
"ios" : { "plugins": {
"appstore" : "unpackage/res/icons/1024x1024.png", "wmpf-voip": {
"ipad" : { "version": "latest",
"app" : "unpackage/res/icons/76x76.png", "provider": "wxf830863afde621eb",
"app@2x" : "unpackage/res/icons/152x152.png", "genericsImplementation": {
"notification" : "unpackage/res/icons/20x20.png", "call-page-plugin": {
"notification@2x" : "unpackage/res/icons/40x40.png", "custombox": "pages/main/customBox"
"proapp@2x" : "unpackage/res/icons/167x167.png", }
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\"/>"
],
"targetSdkVersion" : 34,
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
},
"ios" : {
"dSYMs" : false
}
},
"modules" : {
"Bluetooth" : {},
"VideoPlayer" : {},
"Camera" : {},
"Record" : {}
},
"splashscreen" : {
"waiting" : false
} }
}
} }
},
"vueVersion": "3",
"app-plus": {
"distribute": {
"icons": {
"android": {
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
},
"ios": {
"appstore": "unpackage/res/icons/1024x1024.png",
"ipad": {
"app": "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png"
},
"iphone": {
"app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png"
}
}
},
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\"/>"
],
"targetSdkVersion": 34,
"abiFilters": ["armeabi-v7a", "arm64-v8a"]
},
"ios": {
"dSYMs": false
}
},
"modules": {
"Bluetooth": {},
"VideoPlayer": {},
"Camera": {},
"Record": {}
},
"splashscreen": {
"waiting": false
}
}
} }

View File

@ -107,13 +107,13 @@
} }
}, },
{ {
"path": "updateEmail", "path": "updateAccount",
"style": { "style": {
"navigationBarTitleText": "修改邮箱" "navigationBarTitleText": "修改邮箱"
} }
}, },
{ {
"path": "verifyEmail", "path": "verifyAccount",
"style": { "style": {
"navigationBarTitleText": "验证邮箱" "navigationBarTitleText": "验证邮箱"
} }
@ -150,6 +150,13 @@
"style": { "style": {
"navigationBarTitleText": "安全验证" "navigationBarTitleText": "安全验证"
} }
},
{
"path": "deleteAccount",
"style": {
"navigationBarTitleText": "删除账号",
"disableScroll": true
}
} }
] ]
}, },

View File

@ -77,6 +77,7 @@
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view class="switch-account !bg-red-500" @click="logout">退出</view> <view class="switch-account !bg-red-500" @click="logout">退出</view>
<view class="delete-account" @click="deleteAccount">删除账号</view>
<!-- #endif --> <!-- #endif -->
</view> </view>
<view v-else> <view v-else>
@ -175,6 +176,19 @@
'getUserInfo', 'getUserInfo',
'checkSession' 'checkSession'
]), ]),
deleteAccount() {
uni.showModal({
title: '提示',
content: '删除账号后,你的所有信息及相关记录都会从平台彻底删除,且不可恢复,是否删除?',
success: res => {
if (res.confirm) {
this.routeJump({
name: 'deleteAccount'
})
}
}
})
},
selectEnv(env) { selectEnv(env) {
setStorage('envVersion', env.key) setStorage('envVersion', env.key)
removeStorage('token') removeStorage('token')
@ -364,7 +378,7 @@
.switch-account { .switch-account {
position: absolute; position: absolute;
bottom: 60rpx; bottom: 120rpx;
width: 600rpx; width: 600rpx;
height: 80rpx; height: 80rpx;
margin-left: 75rpx; margin-left: 75rpx;
@ -377,9 +391,17 @@
border-radius: 46rpx; border-radius: 46rpx;
} }
.delete-account {
position: absolute;
right: 75rpx;
bottom: 60rpx;
font-size: 28rpx;
color: #666;
}
.env { .env {
position: absolute; position: absolute;
bottom: 180rpx; bottom: 240rpx;
width: 600rpx; width: 600rpx;
margin-left: 75rpx; margin-left: 75rpx;
line-height: 80rpx; line-height: 80rpx;

View File

@ -1,27 +1,19 @@
<template> <template>
<view> <view>
<view class="tips">在APP上找回密码和登录新设备时可通过绑定的邮箱验证</view> <view class="tips">为了你的账号安全删除账号前请先使用验证码验证</view>
<input
class="input-email"
:value="email"
placeholder="请输入邮箱"
placeholder-class="input-placeholder"
:focus="true"
@input="updateInputEmail"
/>
<view class="view-top"> <view class="view-top">
<input <input
type="number" type="number"
class="input-verify" class="input"
:value="verificationCode" :value="verificationCode"
maxlength="6" maxlength="6"
placeholder="请输入验证码" placeholder="请输入验证码"
placeholder-class="input-placeholder" placeholder-class="input-placeholder"
@input="updateInputCode" @input="updateInput"
/> />
<view class="button-verify" @click="getEmailCode">{{ text }}</view> <view class="button-verify" @click="getEmailCode">{{ text }}</view>
</view> </view>
<view class="button" @click="toUpdateEmail">确定</view> <view class="button" @click="verify">验证</view>
</view> </view>
</template> </template>
@ -29,107 +21,77 @@
import { mapActions, mapState } from 'pinia' import { mapActions, mapState } from 'pinia'
import { test } from 'uview-plus' import { test } from 'uview-plus'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { getEmailCodeRequest, updateEmailRequest } from '@/api/user' import { getEmailCodeRequest, deleteAccountRequest } from '@/api/user'
import { useBasicStore } from '@/stores/basic' import { useBasicStore } from '@/stores/basic'
import { removeStorage } from '@/utils/storage'
export default { export default {
data() { data() {
return { return {
text: '获取验证码', text: '获取验证码',
verificationCode: '', verificationCode: '',
token: '',
email: '',
pending: false pending: false
} }
}, },
computed: { computed: {
...mapState(useUserStore, ['userInfo']) ...mapState(useUserStore, ['userInfo'])
}, },
onLoad(option) {
if (option.token) {
this.token = option.token
} else {
uni.setNavigationBarTitle({
title: '绑定邮箱'
})
}
},
methods: { methods: {
...mapActions(useUserStore, ['updateUserInfo']), ...mapActions(useBasicStore, ['routeJump', 'getNetworkType']),
...mapActions(useBasicStore, ['routeJump', 'backAndToast', 'getNetworkType']),
updateInputEmail(data) {
this.email = data.detail.value
},
updateInputCode(data) {
this.verificationCode = data.detail.value
},
async getEmailCode() { async getEmailCode() {
if (this.text !== '获取验证码') { if (this.text !== '获取验证码') {
return return
} }
if (!test.email(this.email)) {
uni.showToast({
title: '请输入正确的邮箱',
icon: 'none'
})
return
}
const netWork = await this.getNetworkType() const netWork = await this.getNetworkType()
if (!netWork) { if (!netWork) {
return return
} }
const { code } = await getEmailCodeRequest({ const { code, message } = await getEmailCodeRequest({
account: this.email, channel: this.userInfo.mobile !== '' ? '1' : '2',
channel: '2', codeType: 5
codeType: 6
}) })
if (code === 0) { if (code === 0) {
this.updateTime() this.updateTime()
} else { } else {
uni.showToast({ uni.showToast({
title: '验证码获取失败', title: message,
icon: 'none' icon: 'none'
}) })
} }
}, },
async toUpdateEmail() { async verify() {
if (!test.email(this.email)) {
uni.showToast({
title: '请输入正确的邮箱',
icon: 'none'
})
return
}
if (this.verificationCode.length === 6 && test.digits(this.verificationCode)) { if (this.verificationCode.length === 6 && test.digits(this.verificationCode)) {
const netWork = await this.getNetworkType() const netWork = await this.getNetworkType()
if (!netWork) { if (!netWork) {
return return
} }
if (this.pending) {
return
}
this.pending = true this.pending = true
const params = {
verificationCode: this.verificationCode, const { code, message } = await deleteAccountRequest({
email: this.email channel: this.userInfo.mobile !== '' ? 1 : 2,
} verificationCode: this.verificationCode
if (this.token !== '') { })
params.unbindToken = this.token this.pending = false
}
const { code, message } = await updateEmailRequest(params)
if (code === 0) { if (code === 0) {
this.updateUserInfo({ removeStorage('token')
...this.userInfo, removeStorage('openid')
email: this.email removeStorage('userInfo')
removeStorage('lockList')
this.routeJump({
name: 'login',
type: 'reLaunch'
})
uni.showToast({
title: '删除成功',
icon: 'none'
}) })
this.backAndToast('邮箱绑定成功')
} else { } else {
uni.showToast({ uni.showToast({
title: message, title: message,
icon: 'none' icon: 'none'
}) })
} }
this.pending = false
} else { } else {
uni.showToast({ uni.showToast({
title: '验证码为6位纯数字', title: '验证码为6位纯数字',
@ -149,6 +111,9 @@
this.text = '获取验证码' this.text = '获取验证码'
} }
}, 1000) }, 1000)
},
updateInput(data) {
this.verificationCode = data.detail.value
} }
} }
} }
@ -167,17 +132,6 @@
color: #999999; color: #999999;
} }
.input-email {
width: 616rpx;
height: 108rpx;
padding-right: 32rpx;
padding-left: 32rpx;
margin-top: 48rpx;
margin-left: 35rpx;
background: #ffffff;
border-radius: 16rpx;
}
.button-verify { .button-verify {
width: 265rpx; width: 265rpx;
height: 108rpx; height: 108rpx;
@ -196,7 +150,7 @@
align-items: center; align-items: center;
} }
.input-verify { .input {
width: 316rpx; width: 316rpx;
height: 108rpx; height: 108rpx;
padding-right: 32rpx; padding-right: 32rpx;

View File

@ -94,10 +94,10 @@
abbreviation: 'CN', abbreviation: 'CN',
group: 'Z' group: 'Z'
}) })
const username = ref('18174429647') const username = ref('')
const password = ref('..022059') const password = ref('')
const select = ref(true) const select = ref(false)
const pending = ref(false) const pending = ref(false)

View File

@ -0,0 +1,302 @@
<template>
<view>
<view class="tips">
<!-- #ifdef MP-WEIXIN -->
{{
type === 'email'
? '在APP上找回密码和登录新设备时可通过绑定的邮箱验证'
: '在APP上找回密码和登录新设备时可通过绑定的手机号验证'
}}
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
{{
type === 'email'
? '找回密码和登录新设备时,可通过绑定的邮箱验证'
: '找回密码和登录新设备时,可通过绑定的手机号验证'
}}
<!-- #endif -->
</view>
<view class="view-country" v-if="type === 'mobile'" @click="toJump('countryList')">
<view>国家/地区</view>
<view class="text-#63b8af">{{ country.name }} +{{ country.code }}</view>
</view>
<input
:type="type === 'email' ? 'text' : 'number'"
class="input-account"
:value="email"
:placeholder="type === 'email' ? '请输入邮箱' : '请输入手机号'"
placeholder-class="input-placeholder"
:focus="true"
@input="updateInputEmail"
/>
<view class="view-top">
<input
type="number"
class="input-verify"
:value="verificationCode"
maxlength="6"
placeholder="请输入验证码"
placeholder-class="input-placeholder"
@input="updateInputCode"
/>
<view class="button-verify" @click="getEmailCode">{{ text }}</view>
</view>
<view class="button" @click="toUpdateEmail">确定</view>
</view>
</template>
<script>
import { mapActions, mapState } from 'pinia'
import { useUserStore } from '@/stores/user'
import { getEmailCodeRequest, updateEmailRequest, updatePhoneRequest } from '@/api/user'
import { useBasicStore } from '@/stores/basic'
import { PHONE_REG, EMAIL_REG } from '@/constant/reg'
export default {
data() {
return {
text: '获取验证码',
verificationCode: '',
token: '',
email: '',
pending: false,
type: '',
country: {
name: '中国',
code: '86'
}
}
},
computed: {
...mapState(useUserStore, ['userInfo']),
isAccountValid() {
if (!this.email) {
return false
}
if (this.type === 'email') {
return EMAIL_REG.test(this.email)
}
if (this.type === 'mobile') {
return PHONE_REG.test(this.email)
}
return false
}
},
onLoad(option) {
this.type = option.type
uni.setNavigationBarTitle({
title: this.type === 'email' ? '验证邮箱' : '验证手机号'
})
if (option.token) {
this.token = option.token
} else {
uni.setNavigationBarTitle({
title: this.type === 'email' ? '绑定邮箱' : '绑定手机号'
})
}
},
methods: {
...mapActions(useUserStore, ['updateUserInfo']),
...mapActions(useBasicStore, ['routeJump', 'backAndToast', 'getNetworkType']),
toJump(path) {
this.routeJump({
name: path,
events: {
country: data => {
this.country = data
}
}
})
},
updateInputEmail(data) {
this.email = data.detail.value
},
updateInputCode(data) {
this.verificationCode = data.detail.value
},
async getEmailCode() {
if (this.text !== '获取验证码') {
return
}
if (!this.isAccountValid) {
uni.showToast({
title: this.type === 'email' ? '请输入正确的邮箱' : '请输入正确的手机号',
icon: 'none'
})
return
}
const netWork = await this.getNetworkType()
if (!netWork) {
return
}
const { code, message } = await getEmailCodeRequest({
account: this.email,
channel: this.type === 'email' ? '2' : '1',
codeType: this.type === 'email' ? 6 : 3,
countryCode: this.type === 'mobile' ? this.country.code : undefined
})
if (code === 0) {
this.updateTime()
} else {
uni.showToast({
title: message,
icon: 'none'
})
}
},
async toUpdateEmail() {
if (!this.isAccountValid) {
uni.showToast({
title: this.type === 'email' ? '请输入正确的邮箱' : '请输入正确的手机号',
icon: 'none'
})
return
}
if (/^\d{6}$/.test(this.verificationCode)) {
const netWork = await this.getNetworkType()
if (!netWork) {
return
}
if (this.pending) {
return
}
this.pending = true
const params = {
verificationCode: this.verificationCode
}
if (this.type === 'email') {
params.email = this.email
} else {
params.account = this.email
params.countryCode = this.country.code
}
if (this.token !== '') {
params.unbindToken = this.token
}
const request = this.type === 'email' ? updateEmailRequest : updatePhoneRequest
const { code, message } = await request(params)
if (code === 0) {
this.updateUserInfo({
...this.userInfo,
[this.type]: this.email
})
this.backAndToast(this.type === 'email' ? '邮箱绑定成功' : '手机号绑定成功')
} else {
uni.showToast({
title: message,
icon: 'none'
})
}
this.pending = false
} else {
uni.showToast({
title: '验证码为6位纯数字',
icon: 'none'
})
}
},
updateTime() {
let time = 120
this.text = `${time} s`
const now = new Date().getTime()
const timer = setInterval(() => {
const second = parseInt((new Date().getTime() - now) / 1000, 10)
this.text = `${time - second} s`
if (time <= second) {
clearInterval(timer)
this.text = '获取验证码'
}
}, 1000)
}
}
}
</script>
<style lang="scss">
page {
background-color: $uni-bg-color-grey;
}
</style>
<style scoped lang="scss">
.tips {
padding: 24rpx 32rpx 0 32rpx;
font-size: 28rpx;
color: #999999;
}
.view-country {
display: flex;
justify-content: space-between;
width: 616rpx;
height: 108rpx;
padding-right: 32rpx;
padding-left: 32rpx;
margin-top: 48rpx;
margin-left: 35rpx;
font-size: 28rpx;
line-height: 108rpx;
background: #ffffff;
border-radius: 16rpx;
}
.input-account {
width: 616rpx;
height: 108rpx;
padding-right: 32rpx;
padding-left: 32rpx;
margin-top: 48rpx;
margin-left: 35rpx;
background: #ffffff;
border-radius: 16rpx;
}
.button-verify {
width: 265rpx;
height: 108rpx;
margin-top: 48rpx;
margin-left: 35rpx;
font-size: 32rpx;
line-height: 108rpx;
color: #ffffff;
text-align: center;
background: #63b8af;
border-radius: 16rpx;
}
.view-top {
display: flex;
align-items: center;
}
.input-verify {
width: 316rpx;
height: 108rpx;
padding-right: 32rpx;
padding-left: 32rpx;
margin-top: 48rpx;
margin-left: 35rpx;
background: #ffffff;
border-radius: 16rpx;
}
.input-placeholder {
height: 108rpx;
font-size: 36rpx;
font-weight: bold;
line-height: 108rpx;
}
.button {
width: 680rpx;
height: 96rpx;
margin-top: 32rpx;
margin-left: 35rpx;
font-size: 32rpx;
line-height: 96rpx;
color: #ffffff;
text-align: center;
background: #63b8af;
border-radius: 16rpx;
}
</style>

View File

@ -44,6 +44,7 @@
</view> </view>
</view> </view>
<view class="view-line"></view> <view class="view-line"></view>
<!-- #ifdef MP-WEIXIN -->
<label for="phone"> <label for="phone">
<view class="view-button"> <view class="view-button">
<view>手机号</view> <view>手机号</view>
@ -58,8 +59,23 @@
</view> </view>
</view> </view>
</label> </label>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="view-button" @click="toUpdateAccount('mobile')">
<view>手机号</view>
<view class="view-button" style="padding: 0">
<view v-if="userInfo.mobile !== ''" class="info">{{ userInfo.mobile }}</view>
<view v-else class="red-dot"></view>
<image
class="icon-arrow"
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
mode="aspectFill"
></image>
</view>
</view>
<!-- #endif -->
<view class="view-line"></view> <view class="view-line"></view>
<view class="view-button" @click="toUpdateEmail"> <view class="view-button" @click="toUpdateAccount('email')">
<view>邮箱</view> <view>邮箱</view>
<view class="view-button" style="padding: 0"> <view class="view-button" style="padding: 0">
<view v-if="userInfo.email !== ''" class="info">{{ userInfo.email }}</view> <view v-if="userInfo.email !== ''" class="info">{{ userInfo.email }}</view>
@ -262,14 +278,20 @@
name: 'updateName' name: 'updateName'
}) })
}, },
toUpdateEmail() { toUpdateAccount(type) {
if (this.userInfo.email === '') { if (this.userInfo[type] === '') {
this.routeJump({ this.routeJump({
name: 'updateEmail' name: 'updateAccount',
params: {
type
}
}) })
} else { } else {
this.routeJump({ this.routeJump({
name: 'verifyEmail' name: 'verifyAccount',
params: {
type
}
}) })
} }
}, },

View File

@ -21,19 +21,26 @@
import { mapActions, mapState } from 'pinia' import { mapActions, mapState } from 'pinia'
import { test } from 'uview-plus' import { test } from 'uview-plus'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { getEmailCodeRequest, unbindEmailTokenRequest } from '@/api/user' import { getEmailCodeRequest, unbindEmailTokenRequest, unbindPhoneTokenRequest } from '@/api/user'
import { useBasicStore } from '@/stores/basic' import { useBasicStore } from '@/stores/basic'
export default { export default {
data() { data() {
return { return {
text: '获取验证码', text: '获取验证码',
verificationCode: '' verificationCode: '',
type: ''
} }
}, },
computed: { computed: {
...mapState(useUserStore, ['userInfo']) ...mapState(useUserStore, ['userInfo'])
}, },
onLoad(options) {
this.type = options.type
uni.setNavigationBarTitle({
title: this.type === 'email' ? '验证邮箱' : '验证手机号'
})
},
methods: { methods: {
...mapActions(useUserStore, ['updateUserInfo']), ...mapActions(useUserStore, ['updateUserInfo']),
...mapActions(useBasicStore, ['routeJump', 'getNetworkType']), ...mapActions(useBasicStore, ['routeJump', 'getNetworkType']),
@ -45,15 +52,15 @@
if (!netWork) { if (!netWork) {
return return
} }
const { code } = await getEmailCodeRequest({ const { code, message } = await getEmailCodeRequest({
channel: '2', channel: this.type === 'email' ? '2' : '1',
codeType: 7 codeType: this.type === 'email' ? 7 : 4
}) })
if (code === 0) { if (code === 0) {
this.updateTime() this.updateTime()
} else { } else {
uni.showToast({ uni.showToast({
title: '验证码获取失败', title: message,
icon: 'none' icon: 'none'
}) })
} }
@ -64,15 +71,17 @@
if (!netWork) { if (!netWork) {
return return
} }
const { code, data, message } = await unbindEmailTokenRequest({ const request = this.type === 'email' ? unbindEmailTokenRequest : unbindPhoneTokenRequest
const { code, data, message } = await request({
verificationCode: this.verificationCode verificationCode: this.verificationCode
}) })
if (code === 0) { if (code === 0) {
this.routeJump({ this.routeJump({
type: 'redirectTo', type: 'redirectTo',
name: 'updateEmail', name: 'updateAccount',
params: { params: {
token: data.token token: data.token,
type: this.type
} }
}) })
} else { } else {

View File

@ -28,13 +28,13 @@ const pages = [
tabBar: false tabBar: false
}, },
{ {
name: 'updateEmail', name: 'updateAccount',
path: '/pages/user/updateEmail', path: '/pages/user/updateAccount',
tabBar: false tabBar: false
}, },
{ {
name: 'verifyEmail', name: 'verifyAccount',
path: '/pages/user/verifyEmail', path: '/pages/user/verifyAccount',
tabBar: false tabBar: false
}, },
{ {
@ -431,6 +431,11 @@ const pages = [
name: 'safeVerify', name: 'safeVerify',
path: '/pages/user/safeVerify', path: '/pages/user/safeVerify',
tabBar: false tabBar: false
},
{
name: 'deleteAccount',
path: '/pages/user/deleteAccount',
tabBar: false
} }
] ]