set.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. logout({}).then((e) => {
  123. uni.navigateBack();
  124. }).catch((e) => {
  125. console.log(e);
  126. })
  127. obj.logout();
  128. }
  129. }
  130. });
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang='scss'>
  136. .container {
  137. padding-top: 30rpx;
  138. }
  139. .listBox {
  140. margin: 0 $page-row-spacing;
  141. background-color: #FFFFFF;
  142. border-radius: 20rpx;
  143. overflow: hidden;
  144. }
  145. .list {
  146. .listItem {
  147. padding: 35rpx 40rpx;
  148. border-bottom: 1px solid $page-color-light;
  149. }
  150. .listIconImg {
  151. width: 36rpx;
  152. }
  153. .right {
  154. color: $font-color-light;
  155. font-size: $font-base;
  156. flex-grow: 1;
  157. justify-content: flex-end;
  158. .img {
  159. width: 26rpx;
  160. }
  161. }
  162. .titleBox {
  163. .title {
  164. color: $font-color-base;
  165. font-size: $font-base;
  166. }
  167. }
  168. }
  169. .row {
  170. display: flex;
  171. align-items: center;
  172. padding: 35rpx 40rpx;
  173. background: #fff;
  174. border-bottom: 1px solid $page-color-light;
  175. .background-img {
  176. width: 80rpx;
  177. height: 80rpx;
  178. border-radius: 50%;
  179. background: #f2f2f2;
  180. }
  181. .tit {
  182. flex-shrink: 0;
  183. width: 120upx;
  184. font-size: $font-base;
  185. color: $font-color-base;
  186. }
  187. .input {
  188. flex: 1;
  189. text-align: right;
  190. font-size: $font-base;
  191. color: $color-gray;
  192. }
  193. }
  194. </style>