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", "path": "pages/updateSafeQuestion/updateSafeQuestion",
"style": { "style": {
"navigationBarTitleText": "修改安全问题" "navigationBarTitleText": "安全问题"
} }
}, },
{ {

View File

@ -7,7 +7,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image> <image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view> </view>
<view class="line"></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> placeholder-class="input-placeholder" :disabled="true"></input>
</view> </view>
<view class="button" @click="updateAnswer">修改</view> <view class="button" @click="updateAnswer">修改</view>
@ -51,8 +51,10 @@ export default {
return return
} }
this.routeJump({ 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> <image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view> </view>
<view class="line"></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> placeholder-class="input-placeholder" @input="changeFirstAnswer"></input>
</view> </view>
<view class="safe-question"> <view class="safe-question">
@ -16,7 +16,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image> <image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view> </view>
<view class="line"></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> placeholder-class="input-placeholder" @input="changeSecondAnswer"></input>
</view> </view>
<view class="safe-question"> <view class="safe-question">
@ -25,7 +25,7 @@
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image> <image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
</view> </view>
<view class="line"></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> placeholder-class="input-placeholder" @input="changeThirdAnswer"></input>
</view> </view>
<view class="button" @click="updateAnswer">保存</view> <view class="button" @click="updateAnswer">保存</view>
@ -65,14 +65,26 @@ export default {
answer: '' answer: ''
}], }],
show: false, show: false,
pending: false pending: false,
questionAnswer: null
} }
}, },
computed: { computed: {
...mapState(useUserStore, ['userInfo']) ...mapState(useUserStore, ['userInfo'])
}, },
onLoad() { async onLoad (data) {
this.getQuestionList() 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: { methods: {
...mapActions(useUserStore, ['updateUserInfo']), ...mapActions(useUserStore, ['updateUserInfo']),
@ -113,7 +125,7 @@ export default {
...this.userInfo, ...this.userInfo,
haveSafeAnswer: 1 haveSafeAnswer: 1
}) })
this.backAndToast('设置成功') this.backAndToast('设置成功', 2)
} else { } else {
uni.showToast({ uni.showToast({
title: message, title: message,