删除安全问题相关功能
This commit is contained in:
parent
f0fc91295d
commit
d9ed67e0ba
@ -3,7 +3,7 @@
|
||||
"appid" : "__UNI__933D519",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "14",
|
||||
"versionCode" : "15",
|
||||
"transformPx" : false,
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
|
||||
12
pages.json
12
pages.json
@ -51,18 +51,6 @@
|
||||
"navigationBarTitleText": "验证邮箱"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/safeQuestion/safeQuestion",
|
||||
"style": {
|
||||
"navigationBarTitleText": "安全问题"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/updateSafeQuestion/updateSafeQuestion",
|
||||
"style": {
|
||||
"navigationBarTitleText": "安全问题"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/webview/webview",
|
||||
"style": {
|
||||
|
||||
@ -1,139 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="text">如果手机丢了,可以通过回答设置的安全问题来登录新设备</view>
|
||||
<view class="safe-question" v-for="item in questionAnswer" :key="item.questionId">
|
||||
<view class="question">
|
||||
<view>{{item.question}}</view>
|
||||
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="input">{{item.answer}}</view>
|
||||
</view>
|
||||
<view class="button" @click="updateAnswer">修改</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getQuestionAnswerRequest, getQuestionListRequest, updateQuestionAnswerRequest } from '@/api/safeAnswer'
|
||||
import { mapActions } from 'pinia'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
questionAnswer: [],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getQuestionAnswer()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump', 'getNetworkType']),
|
||||
async getQuestionAnswer() {
|
||||
const netWork = await this.getNetworkType()
|
||||
if(!netWork) {
|
||||
return
|
||||
}
|
||||
const { code, data, message } = await getQuestionAnswerRequest()
|
||||
if(code === 0) {
|
||||
this.questionAnswer = data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
async updateAnswer() {
|
||||
const netWork = await this.getNetworkType()
|
||||
if(!netWork) {
|
||||
return
|
||||
}
|
||||
this.routeJump({
|
||||
name: 'updateSafeQuestion',
|
||||
params: {
|
||||
questionAnswer: JSON.stringify(this.questionAnswer)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text {
|
||||
padding-top: 20rpx;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.safe-question {
|
||||
width: 710rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.question {
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.icon-arrow {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.input {
|
||||
border-radius: 0 0 32rpx 32rpx;
|
||||
line-height: 40rpx;
|
||||
background: #FFFFFF;
|
||||
padding: 20rpx 32rpx;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #EBEBEB;
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
font-size: 32rpx;
|
||||
height: 100rpx;
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
font-size: 32rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: 32rpx;
|
||||
margin-left: 35rpx;
|
||||
width: 680rpx;
|
||||
height: 96rpx;
|
||||
background: #63b8af;
|
||||
border-radius: 16rpx;
|
||||
line-height: 96rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
@ -1,278 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="text">如果手机丢了,可以通过回答设置的安全问题来登录新设备</view>
|
||||
<view class="safe-question">
|
||||
<view class="question" @click="popup('firstList')">
|
||||
<view>{{answer[0].question}}</view>
|
||||
<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="50" placeholder="请输入答案"
|
||||
placeholder-class="input-placeholder" @input="changeFirstAnswer"></input>
|
||||
</view>
|
||||
<view class="safe-question">
|
||||
<view class="question" @click="popup('secondList')">
|
||||
<view>{{answer[1].question}}</view>
|
||||
<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="50" placeholder="请输入答案"
|
||||
placeholder-class="input-placeholder" @input="changeSecondAnswer"></input>
|
||||
</view>
|
||||
<view class="safe-question">
|
||||
<view class="question" @click="popup('thirdList')">
|
||||
<view>{{answer[2].question}}</view>
|
||||
<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="50" placeholder="请输入答案"
|
||||
placeholder-class="input-placeholder" @input="changeThirdAnswer"></input>
|
||||
</view>
|
||||
<view class="button" @click="updateAnswer">保存</view>
|
||||
</view>
|
||||
<up-popup :show="show" mode="bottom" round="16rpx" @close="close">
|
||||
<view class="popup-title">选择问题</view>
|
||||
<view class="line" style="height: 10rpx"></view>
|
||||
<view v-for="item in currentQuestionList" :key="item.questionId" @click="selectQuestion(item)">
|
||||
<view class="popup-content">{{item.question}}</view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
<view class="line" style="height: 10rpx"></view>
|
||||
<view class="popup-title" @click="close">取消</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getQuestionAnswerRequest, getQuestionListRequest, updateQuestionAnswerRequest } from '@/api/safeAnswer'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
questionList: {},
|
||||
currentQuestionList: [],
|
||||
currentIndex: 0,
|
||||
answer:[{
|
||||
question: '问题一',
|
||||
answer: ''
|
||||
}, {
|
||||
question: '问题二',
|
||||
answer: ''
|
||||
}, {
|
||||
question: '问题三',
|
||||
answer: ''
|
||||
}],
|
||||
show: false,
|
||||
pending: false,
|
||||
questionAnswer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useUserStore, ['userInfo'])
|
||||
},
|
||||
async onLoad (data) {
|
||||
this.getQuestionList()
|
||||
const questionAnswer = JSON.parse(data.questionAnswer)
|
||||
if (questionAnswer) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '安全问题设置'
|
||||
})
|
||||
this.questionAnswer = questionAnswer
|
||||
this.answer = questionAnswer.map(item => {
|
||||
return {
|
||||
question: item.question,
|
||||
answer: item.answer,
|
||||
questionId: item.questionId
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useUserStore, ['updateUserInfo']),
|
||||
...mapActions(useBasicStore, ['backAndToast', 'getNetworkType']),
|
||||
async updateAnswer() {
|
||||
console.log('答案', this.answer)
|
||||
for(let i = 0; i < this.answer.length; i++) {
|
||||
if(!this.answer[i].questionId) {
|
||||
uni.showToast({
|
||||
title: '问题不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
for(let i = 0; i < this.answer.length; i++) {
|
||||
if(this.answer[i].answer === '') {
|
||||
uni.showToast({
|
||||
title: '答案不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
const netWork = await this.getNetworkType()
|
||||
if(!netWork) {
|
||||
return
|
||||
}
|
||||
if(this.pending) {
|
||||
return
|
||||
}
|
||||
this.pending = true
|
||||
const { code, message } = await updateQuestionAnswerRequest({
|
||||
questionAndAnswerList: this.answer
|
||||
})
|
||||
if(code === 0) {
|
||||
this.updateUserInfo({
|
||||
...this.userInfo,
|
||||
haveSafeAnswer: 1
|
||||
})
|
||||
this.backAndToast('设置成功', 2)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
this.pending = false
|
||||
},
|
||||
changeFirstAnswer(data) {
|
||||
this.answer[0].answer = data.detail.value
|
||||
},
|
||||
changeSecondAnswer(data) {
|
||||
this.answer[1].answer = data.detail.value
|
||||
},
|
||||
changeThirdAnswer(data) {
|
||||
this.answer[2].answer = data.detail.value
|
||||
},
|
||||
close() {
|
||||
this.show = false
|
||||
},
|
||||
selectQuestion(item) {
|
||||
this.answer[this.currentIndex].question = item.question
|
||||
this.answer[this.currentIndex].questionId = item.questionId
|
||||
this.show = false
|
||||
},
|
||||
popup(type) {
|
||||
if(type === 'secondList') {
|
||||
this.currentIndex = 1
|
||||
} else if(type === 'thirdList') {
|
||||
this.currentIndex = 2
|
||||
} else {
|
||||
this.currentIndex = 0
|
||||
}
|
||||
this.currentQuestionList = this.questionList[type]
|
||||
this.show = true
|
||||
},
|
||||
async getQuestionList() {
|
||||
const netWork = await this.getNetworkType()
|
||||
if(!netWork) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '未获取到问题列表,请退出重试',
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
const { code, data, message } = await getQuestionListRequest()
|
||||
if(code === 0) {
|
||||
this.questionList = data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text {
|
||||
padding-top: 20rpx;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.safe-question {
|
||||
width: 710rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.question {
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.icon-arrow {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.input {
|
||||
border-radius: 0 0 32rpx 32rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
background: #FFFFFF;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
.input-placeholder {
|
||||
height: 100rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #EBEBEB;
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
font-size: 32rpx;
|
||||
height: 100rpx;
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
font-size: 32rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: 32rpx;
|
||||
margin-left: 35rpx;
|
||||
width: 680rpx;
|
||||
height: 96rpx;
|
||||
background: #63b8af;
|
||||
border-radius: 16rpx;
|
||||
line-height: 96rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
@ -44,14 +44,6 @@
|
||||
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="view-line"></view>
|
||||
<view class="view-button" @click="toSafeQuestion">
|
||||
<view>安全问题</view>
|
||||
<view class="view-button" style="padding: 0">
|
||||
<view v-if="!userInfo.haveSafeAnswer" class="red-dot"></view>
|
||||
<image class="icon-arrow" src="/static/images/icon_arrow.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-line"></view>
|
||||
<view class="view-button">
|
||||
<view>国家/地区</view>
|
||||
<view class="view-button" style="padding: 0">
|
||||
@ -211,17 +203,6 @@ export default {
|
||||
this.routeJump({
|
||||
name: 'updatePassword'
|
||||
})
|
||||
},
|
||||
toSafeQuestion() {
|
||||
if(this.userInfo.haveSafeAnswer) {
|
||||
this.routeJump({
|
||||
name: 'safeQuestion'
|
||||
})
|
||||
} else {
|
||||
this.routeJump({
|
||||
name: 'updateSafeQuestion'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,16 +37,6 @@ const pages = [
|
||||
path: '/pages/verifyEmail/verifyEmail',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'safeQuestion',
|
||||
path: '/pages/safeQuestion/safeQuestion',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'updateSafeQuestion',
|
||||
path: '/pages/updateSafeQuestion/updateSafeQuestion',
|
||||
tabBar: false
|
||||
},
|
||||
{
|
||||
name: 'webview',
|
||||
path: '/pages/webview/webview',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user