security.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="page">
  3. <!-- 基本资料组 -->
  4. <view class="group">
  5. <view class="item" @click="goPage('/pages/my/editInfo')">
  6. <text class="title">基本资料</text>
  7. <view class="right">
  8. <text class="value">去完善</text>
  9. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  10. </view>
  11. </view>
  12. </view>
  13. <!-- 账号安全组 -->
  14. <view class="group">
  15. <view class="item" @click="goPage('/pages/my/editMobile?originalPhoneNumber=' + phoneNumber)">
  16. <text class="title">手机号</text>
  17. <view class="right">
  18. <text class="value">{{ formatPhoneNumber(phoneNumber) || '未绑定' }}</text>
  19. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  20. </view>
  21. </view>
  22. <view class="item" @click="goPage('/pages/my/editPass')" v-if="false">
  23. <text class="title">登录密码</text>
  24. <view class="right">
  25. <text class="value">未设置</text>
  26. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 第三方账号组 -->
  31. <view class="group">
  32. <view class="item" @click="bindWechat">
  33. <text class="title">微信账号</text>
  34. <view class="right">
  35. <text class="value">{{ wechat || '未绑定' }}</text>
  36. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  37. </view>
  38. </view>
  39. <view class="item" @click="bindQQ" v-if="false">
  40. <text class="title">QQ账号</text>
  41. <view class="right">
  42. <text class="value">未授权</text>
  43. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 删除账号组 -->
  48. <view class="group">
  49. <view class="item" @click="goPage('/pages/my/DelMemConfirm')">
  50. <text class="title red">删除用户</text>
  51. <view class="right">
  52. <text class="value red">注销账户</text>
  53. <image class="arrow" style="width: 30rpx; height: 30rpx;" src="../../static/me/wd_icon_jiantou_red.png"
  54. mode="widthFix"></image>
  55. </view>
  56. </view>
  57. </view>
  58. <DialogBox ref="DialogBox"></DialogBox>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. components: {}, // 注册组件
  64. data() {
  65. return {
  66. phoneNumber: '', // 用户手机号
  67. wechat: '',
  68. }
  69. },
  70. onLoad() {
  71. this.loadUserInfo()
  72. },
  73. methods: {
  74. loadUserInfo() {
  75. // 这里添加获取用户信息的逻辑
  76. // 获取手机号等信息
  77. uni.request({
  78. url: this.$apiHost + "/User/getinfo",
  79. data: {
  80. uuid: getApp().globalData.uuid,
  81. skey: getApp().globalData.skey,
  82. },
  83. header: {
  84. "content-type": "application/json",
  85. sign: getApp().globalData.headerSign,
  86. },
  87. success: (res) => {
  88. this.phoneNumber = res.data.mobile;
  89. this.wechat = res.data.wechat;
  90. },
  91. complete: (com) => {
  92. },
  93. fail: (e) => {
  94. console.log("----e:", e);
  95. },
  96. });
  97. },
  98. goPage(url) {
  99. uni.navigateTo({
  100. url: url
  101. })
  102. },
  103. bindWechat() {
  104. // 微信绑定逻辑
  105. // uni.showToast({
  106. // title: '暂未开放',
  107. // icon: 'none'
  108. // })
  109. if (this.wechat == '' || this.wechat == null) {
  110. uni.showToast({
  111. title:'暂未开通绑定微信',
  112. icon: 'none'
  113. })
  114. }
  115. this.$refs['DialogBox'].confirm({
  116. title: '确认解绑',
  117. content: '解绑微信账号后将无法继续使用它登录该App账号',
  118. DialogType: 'inquiry',
  119. btn1: '再考虑一下',
  120. btn2: '确认解绑',
  121. animation: 0
  122. }).then(() => {
  123. uni.request({
  124. url: this.$apiHost + "/User/getinfo",
  125. data: {
  126. uuid: getApp().globalData.uuid,
  127. },
  128. header: {
  129. "content-type": "application/json",
  130. sign: getApp().globalData.headerSign,
  131. },
  132. success: (res) => {
  133. uni.showToast({
  134. title: res.data.str,
  135. icon: 'none'
  136. })
  137. },
  138. complete: (com) => {
  139. },
  140. fail: (e) => {
  141. console.log("----e:", e);
  142. },
  143. });
  144. })
  145. },
  146. bindQQ() {
  147. // QQ绑定逻辑
  148. uni.showToast({
  149. title: '暂未开放',
  150. icon: 'none'
  151. })
  152. },
  153. formatPhoneNumber(phoneNumber) {
  154. if (phoneNumber && phoneNumber.length === 11) {
  155. return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  156. }
  157. return phoneNumber;
  158. },
  159. }
  160. }
  161. </script>
  162. <style scoped lang="scss">
  163. @import 'security.scss';
  164. </style>