blob: 17b0ede39f5dde223233f56aa57fa845e3427dbb [file] [log] [blame]
guangchao.xuc43cf972021-01-18 13:37:55 +08001<template>
2 <view class="question">
3 <u-cell-group>
4 <u-cell-item title="开启\删除密保" :arrow="false">
5 <u-icon name="mibao" custom-prefix="custom-icon" size="32" slot="icon"></u-icon>
6 <u-switch slot="right-icon" v-model="question" @change="open"></u-switch>
7 </u-cell-item>
8 </u-cell-group>
9 </view>
10</template>
11
12<script>
13 export default {
14 data() {
15 return {
16 question: false
17 }
18 },
19 methods: {
20 open(e) {
21 if (e) {
22 uni.navigateTo({
guangchao.xu6cdd45e2021-04-16 17:44:30 +080023 url: '/pages/sub_mine/setQuestion'
guangchao.xuc43cf972021-01-18 13:37:55 +080024 })
25 } else {
26 uni.showModal({
27 title: "提示",
28 content: "该操作将删除您设置的密保问题,是否继续?",
29 success: (res) => {
30 if (res.confirm) {
31 this.delate_question()
32 } else if (res.cancel) {
33 this.question = true
34 }
35 }
36 })
37 }
38 },
39 delate_question() {
40 let that = this
41 that.$u.post('/v1/security/delete').then(res => {
42 uni.showToast({
43 title: '删除成功',
44 icon: 'none'
45 })
46 })
47 },
48 get_status() {
49 let that = this
50 that.$u.get('/i/security/list?phone=').then(res => {
51 let list = res.data
52 list.length ? that.question = true : that.question = false
53 })
54 }
55 },
56 onShow() {
57 this.get_status()
58 },
59 }
60</script>
61
62<style>
63</style>