diff --git a/pages.json b/pages.json index c8331f0..c6faf86 100644 --- a/pages.json +++ b/pages.json @@ -60,7 +60,7 @@ { "path": "pages/updateSafeQuestion/updateSafeQuestion", "style": { - "navigationBarTitleText": "修改安全问题" + "navigationBarTitleText": "安全问题" } }, { diff --git a/pages/safeQuestion/safeQuestion.vue b/pages/safeQuestion/safeQuestion.vue index fc67494..6d4d2ae 100644 --- a/pages/safeQuestion/safeQuestion.vue +++ b/pages/safeQuestion/safeQuestion.vue @@ -7,7 +7,7 @@ - 修改 @@ -51,8 +51,10 @@ export default { return } this.routeJump({ - type: 'redirectTo', - name: 'updateSafeQuestion' + name: 'updateSafeQuestion', + params: { + questionAnswer: JSON.stringify(this.questionAnswer) + } }) } } diff --git a/pages/updateSafeQuestion/updateSafeQuestion.vue b/pages/updateSafeQuestion/updateSafeQuestion.vue index c4fb2a0..c7b88f9 100644 --- a/pages/updateSafeQuestion/updateSafeQuestion.vue +++ b/pages/updateSafeQuestion/updateSafeQuestion.vue @@ -7,7 +7,7 @@ - @@ -16,7 +16,7 @@ - @@ -25,7 +25,7 @@ - 保存 @@ -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,