set.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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" @click="navTo('/pages/set/phone')">
  22. <view class="flex titleBox">
  23. <text class="title">手机号</text>
  24. </view>
  25. <view class="right flex">
  26. <text>{{userInfo.phone}}</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. uploads
  75. } from '@/api/user.js';
  76. import {
  77. logout
  78. } from '@/api/set.js';
  79. import {
  80. mapMutations,
  81. mapState
  82. } from 'vuex';
  83. export default {
  84. data() {
  85. return {
  86. };
  87. },
  88. computed: {
  89. ...mapState('user', ['userInfo'])
  90. },
  91. methods: {
  92. ...mapMutations('user', ['logout']),
  93. // #ifdef APP
  94. outAccount() {
  95. uni.showModal({
  96. title: '警告',
  97. content: '注销后账号不可恢复是否注销?',
  98. cancelText: '取消',
  99. confirmText: '立即注销',
  100. success: res => {
  101. if (res.confirm) {
  102. uni.showModal({
  103. title: '提示',
  104. content: '已提交注销申请!请等待处理结果',
  105. showCancel: false,
  106. });
  107. }
  108. },
  109. });
  110. },
  111. // #endif
  112. navTo(url) {
  113. uni.navigateTo({
  114. url: url
  115. })
  116. },
  117. //退出登录
  118. toLogout() {
  119. let obj = this;
  120. uni.showModal({
  121. content: '确定要退出登录么',
  122. success: (e) => {
  123. if (e.confirm) {
  124. logout({}).then((e) => {
  125. uni.navigateBack();
  126. }).catch((e) => {
  127. console.log(e);
  128. })
  129. obj.logout();
  130. }
  131. }
  132. });
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang='scss'>
  138. .container {
  139. padding-top: 30rpx;
  140. }
  141. .listBox {
  142. margin: 0 $page-row-spacing;
  143. background-color: #FFFFFF;
  144. border-radius: 20rpx;
  145. overflow: hidden;
  146. }
  147. .list {
  148. .listItem {
  149. padding: 35rpx 40rpx;
  150. border-bottom: 1px solid $page-color-light;
  151. }
  152. .listIconImg {
  153. width: 36rpx;
  154. }
  155. .right {
  156. color: $font-color-light;
  157. font-size: $font-base;
  158. flex-grow: 1;
  159. justify-content: flex-end;
  160. .img {
  161. width: 26rpx;
  162. }
  163. }
  164. .titleBox {
  165. .title {
  166. color: $font-color-base;
  167. font-size: $font-base;
  168. }
  169. }
  170. }
  171. .row {
  172. display: flex;
  173. align-items: center;
  174. padding: 35rpx 40rpx;
  175. background: #fff;
  176. border-bottom: 1px solid $page-color-light;
  177. .background-img {
  178. width: 80rpx;
  179. height: 80rpx;
  180. border-radius: 50%;
  181. background: #f2f2f2;
  182. }
  183. .tit {
  184. flex-shrink: 0;
  185. width: 120upx;
  186. font-size: $font-base;
  187. color: $font-color-base;
  188. }
  189. .input {
  190. flex: 1;
  191. text-align: right;
  192. font-size: $font-base;
  193. color: $color-gray;
  194. }
  195. }
  196. </style>