宜呗小程序--微信小程序
Lzk
2025-08-05 b7bcaf556aa2424e808b6e6426ab22df9cfe11c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template xmlns="">
  <view class="setting-container">
    <view class="setting-list">
      <uv-cell-group>
        <uv-cell @click="toProtocol('A')" title="用户协议" :isLink="true"></uv-cell>
        <uv-cell @click="toProtocol('B')" title="用户隐私协议" :isLink="true"></uv-cell>
        <uv-cell @click="toProtocol('C')" title="关于我们" :isLink="true"></uv-cell>
        <uv-cell @click="handleShowDeleteConfirm" title="自动注销" :isLink="true"></uv-cell>
      </uv-cell-group>
      <!-- 设置项列表 -->
 
    </view>
 
    <view class="but">
 
      <uv-button @click="toLogin" shape="circle" type="primary" text="退出登录"></uv-button>
    </view>
  </view>
</template>
 
<script >
import {logoutUser} from '@/api/modules/user'
export default defineComponent({
  methods: {
    toLogin(){
      uni.reLaunch({
        url: '/pages/login/index'
      })
    },
    toProtocol(flg) {
      let obj = {
        "A":{
          title: '用户注册协议',
          code:  this.$Protocol.user
        },
        "B":{
          title: '用户隐私协议',
          code: this.$Protocol.privacy
        },
        "C":{
          title: '关于我们',
          code: this.$Protocol.about
        },
        "D":{
          title: '自动注销',
         code: 'AUTO_CANCEL_APP_KD'
        }
      };
      const code = obj[flg]['code'];
      const title = obj[flg]['title'];
      console.log(code);
      uni.navigateTo({
        url: `/pages/protocol/index?code=${code}&title=${title}`
      })
    },
 
    async handleDeleteUser() {
      logoutUser().then(res=>{
        uni.showToast({
          title: '注销成功',
          icon: 'none',
          duration: 1000,
        })
        uni.clearStorageSync();
        setTimeout(() => {
 
          uni.reLaunch({
            url: '/pages/login/index'
          })
 
        }, 300)
      })
 
    },
    handleShowDeleteConfirm() {
      uni.showModal({
        title: '提示',
        content: '注销后,您的所有信息将会被删除且无法恢复。确认注销吗?',
        confirmText: '确认',
        cancelText: '取消',
        success: (res) => {
          if (res.confirm) {
            this.handleDeleteUser()
          }
        },
      })
    },
  },
  name: "index"
})
 
 
 
 
</script>
 
<style lang="scss">
.setting-container {
  background-color: #f5f5f5;
}
 
.setting-list {
  background-color: #ffffff;
}
 
 
 
.item-text {
  font-size: 28rpx;
  color: #333333;
}
.but{
  position: fixed;
  bottom: 100rpx;
  width: 100%;
  padding: 0 60rpx;
 
  :deep(.uv-button) {
    height: 100rpx;
    background-color: #4766FE !important;
    border-color: #4766FE !important;
    font-size: 28rpx;
  }
}
 
 
</style>