移动端登录,首次登录改密

This commit is contained in:
Paidax
2025-04-03 16:13:29 +08:00
parent c3d023c374
commit cd0b54950a
6 changed files with 79 additions and 23 deletions
+17 -3
View File
@@ -444,9 +444,9 @@ layout("/mobile/platform.html"){
<van-popup v-model="updatePwdShow" class="pwd_popup">
<div class="card modify-password">
<div class="card-content">
<h2>修改密码</h2>
<h2>{{ formData.isFirstLogin ? '首次登录,请修改密码' : '修改密码' }}</h2>
<form id="password-form">
<div class="form-group">
<div class="form-group" v-if="!formData.isFirstLogin">
<label for="current-password">当前密码</label>
<input type="password" id="current-password" name="current-password" maxlength="20" v-model="formData.sourcePwd" />
<span class="toggle-password" data-target="current-password">🔒</span>
@@ -518,7 +518,9 @@ layout("/mobile/platform.html"){
newPwd: "",
confirmPwd: ""
},
errorInfo: ""
errorInfo: "",
// 微信端登录次数
isFirstLogin: false
}
},
methods: {
@@ -526,6 +528,9 @@ layout("/mobile/platform.html"){
this.updatePwdShow = true
},
async updatePwdSubmit() {
if (!this.formData.isFirstLogin && !this.formData.sourcePwd) {
this.$toast("请输入原密码")
}
const resp = await $.post("/mobile/login/updatePwd", this.formData)
if (resp.code === 0) {
this.$toast("修改成功")
@@ -655,6 +660,14 @@ layout("/mobile/platform.html"){
switchFirstModule() {
const data = this.moduleMenus.find((v) => v.orderNum === 1)
this.switchModuleMenus(data)
},
// 获取微信端的登录次数
async getWeAppLoginCount() {
const resp = await $.post("/mobile/login/checkIsFirstLogin")
this.formData.isFirstLogin = resp.code !== 0
if (this.formData.isFirstLogin) {
this.updatePwdShow = true
}
}
},
beforeMount() {
@@ -667,6 +680,7 @@ layout("/mobile/platform.html"){
}
await this.getMenus()
this.initData()
await this.getWeAppLoginCount()
}
})
window.addEventListener("pageshow", (e) => {