1. 修改安全问题最大输入长度

2. 修改安全问题时显示原来的答案
This commit is contained in:
范鹏 2024-09-13 14:45:49 +08:00
parent b6620dd4ad
commit 8ee2fc8dc1
3 changed files with 25 additions and 11 deletions

View File

@ -60,7 +60,7 @@
{
"path": "pages/updateSafeQuestion/updateSafeQuestion",
"style": {
"navigationBarTitleText": "修改安全问题"
"navigationBarTitleText": "安全问题"
}
},
{

View File

@ -7,7 +7,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view>
<view class="line"></view>
<input class="input" :value="item.answer" maxlength="16" placeholder="请输入答案"
<input class="input" :value="item.answer" maxlength="50" placeholder="请输入答案"
placeholder-class="input-placeholder" :disabled="true"></input>
</view>
<view class="button" @click="updateAnswer">修改</view>
@ -51,8 +51,10 @@ export default {
return
}
this.routeJump({
type: 'redirectTo',
name: 'updateSafeQuestion'
name: 'updateSafeQuestion',
params: {
questionAnswer: JSON.stringify(this.questionAnswer)
}
})
}
}

View File

@ -7,7 +7,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view>
<view class="line"></view>
<input class="input" :value="answer[0].answer" maxlength="16" placeholder="请输入答案"
<input class="input" :value="answer[0].answer" maxlength="50" placeholder="请输入答案"
placeholder-class="input-placeholder" @input="changeFirstAnswer"></input>
</view>
<view class="safe-question">
@ -16,7 +16,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view>
<view class="line"></view>
<input class="input" :value="answer[1].answer" maxlength="16" placeholder="请输入答案"
<input class="input" :value="answer[1].answer" maxlength="50" placeholder="请输入答案"
placeholder-class="input-placeholder" @input="changeSecondAnswer"></input>
</view>
<view class="safe-question">
@ -25,7 +25,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view>
<view class="line"></view>
<input class="input" :value="answer[2].answer" maxlength="16" placeholder="请输入答案"
<input class="input" :value="answer[2].answer" maxlength="50" placeholder="请输入答案"
placeholder-class="input-placeholder" @input="changeThirdAnswer"></input>
</view>
<view class="button" @click="updateAnswer">保存</view>
@ -65,14 +65,26 @@ export default {
answer: ''
}],
show: false,
pending: false
pending: false,
questionAnswer: null
}
},
computed: {
...mapState(useUserStore, ['userInfo'])
},
onLoad() {
this.getQuestionList()
async onLoad (data) {
await this.getQuestionList()
const questionAnswer = JSON.parse(data.questionAnswer)
if (questionAnswer) {
this.questionAnswer = questionAnswer
this.answer = questionAnswer.map(item => {
return {
question: item.question,
answer: item.answer,
questionId: item.questionId
}
})
}
},
methods: {
...mapActions(useUserStore, ['updateUserInfo']),
@ -113,7 +125,7 @@ export default {
...this.userInfo,
haveSafeAnswer: 1
})
this.backAndToast('设置成功')
this.backAndToast('设置成功', 2)
} else {
uni.showToast({
title: message,