set.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="container">
  3. <view class="listBox">
  4. <view class="row flex" @click="navTo('/pages/set/userinfo')">
  5. <text class="tit">头像</text>
  6. <view>
  7. <image class="background-img" v-model="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill">
  8. </image>
  9. </view>
  10. </view>
  11. <view class="list">
  12. <view class="flex listItem" @click="navTo('/pages/set/userinfo')">
  13. <view class="flex titleBox">
  14. <text class="title">昵称</text>
  15. </view>
  16. <view class="right flex">
  17. <text>{{userInfo.nickname}}</text>
  18. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  19. </view>
  20. </view>
  21. <view class="flex listItem" >
  22. <view class="flex titleBox">
  23. <text class="title">手机号</text>
  24. </view>
  25. <view class="right flex">
  26. <text>{{userInfo.mobile}}</text>
  27. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  28. </view>
  29. </view>
  30. <!-- <view class="flex listItem" @click="navTo('/pages/user/realName/realNameAuthentication')">
  31. <view class="flex titleBox">
  32. <text class="title">实名认证</text>
  33. </view>
  34. <view class="right flex">
  35. <text></text>
  36. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  37. </view>
  38. </view> -->
  39. <!-- <view class="flex listItem" @click="navTo('/pages/set/password')">
  40. <view class="flex titleBox">
  41. <text class="title">修改密码</text>
  42. </view>
  43. <view class="right flex">
  44. <text></text>
  45. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  46. </view>
  47. </view> -->
  48. <!-- #ifdef APP -->
  49. <view class="flex listItem" @click="$refs.inputDialog.open()">
  50. <view class="flex titleBox">
  51. <text class="title">注销账号</text>
  52. </view>
  53. <view class="right flex">
  54. <text></text>
  55. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  56. </view>
  57. </view>
  58. <!-- #endif -->
  59. </view>
  60. </view>
  61. <view class="base-buttom" @click="toLogout">
  62. 退出账号
  63. </view>
  64. <!-- #ifdef APP -->
  65. <uni-popup ref="inputDialog" type="dialog">
  66. <uni-popup-dialog ref="inputClose" mode="input" title="注销账号" value="" placeholder="请输入账号密码"
  67. @confirm="outAccount"></uni-popup-dialog>
  68. </uni-popup>
  69. <!-- #endif -->
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. logout,
  75. uploads
  76. } from '@/api/set.js';
  77. import {
  78. mapMutations,
  79. mapState
  80. } from 'vuex';
  81. export default {
  82. data() {
  83. return {
  84. };
  85. },
  86. computed: {
  87. ...mapState('user', ['userInfo'])
  88. },
  89. methods: {
  90. ...mapMutations('user', ['logout']),
  91. // #ifdef APP
  92. outAccount() {
  93. uni.showModal({
  94. title: '警告',
  95. content: '注销后账号不可恢复是否注销?',
  96. cancelText: '取消',
  97. confirmText: '立即注销',
  98. success: res => {
  99. if (res.confirm) {
  100. uni.showModal({
  101. title: '提示',
  102. content: '已提交注销申请!请等待处理结果',
  103. showCancel: false,
  104. });
  105. }
  106. },
  107. });
  108. },
  109. // #endif
  110. navTo(url) {
  111. uni.navigateTo({
  112. url: url
  113. })
  114. },
  115. //退出登录
  116. toLogout() {
  117. let obj = this;
  118. uni.showModal({
  119. content: '确定要退出登录么',
  120. success: (e) => {
  121. if (e.confirm) {
  122. obj.logout();
  123. uni.setStorageSync('token', '');
  124. uni.navigateBack();
  125. }
  126. }
  127. });
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang='scss'>
  133. .container {
  134. padding-top: 30rpx;
  135. }
  136. .listBox {
  137. margin: 0 $page-row-spacing;
  138. background-color: #FFFFFF;
  139. border-radius: 20rpx;
  140. overflow: hidden;
  141. }
  142. .list {
  143. .listItem {
  144. padding: 35rpx 40rpx;
  145. border-bottom: 1px solid $page-color-light;
  146. }
  147. .listIconImg {
  148. width: 36rpx;
  149. }
  150. .right {
  151. color: $font-color-light;
  152. font-size: $font-base;
  153. flex-grow: 1;
  154. justify-content: flex-end;
  155. .img {
  156. width: 26rpx;
  157. }
  158. }
  159. .titleBox {
  160. .title {
  161. color: $font-color-base;
  162. font-size: $font-base;
  163. }
  164. }
  165. }
  166. .row {
  167. display: flex;
  168. align-items: center;
  169. padding: 35rpx 40rpx;
  170. background: #fff;
  171. border-bottom: 1px solid $page-color-light;
  172. .background-img {
  173. width: 80rpx;
  174. height: 80rpx;
  175. border-radius: 50%;
  176. background: #f2f2f2;
  177. }
  178. .tit {
  179. flex-shrink: 0;
  180. width: 120upx;
  181. font-size: $font-base;
  182. color: $font-color-base;
  183. }
  184. .input {
  185. flex: 1;
  186. text-align: right;
  187. font-size: $font-base;
  188. color: $color-gray;
  189. }
  190. }
  191. </style>