set.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="content">
  3. <view class="content1">
  4. <view class='flex flex-space-between' @click="switchPicture">
  5. <view>
  6. <text>头像</text>
  7. </view>
  8. <view style='align-items: center;' class="flex">
  9. <view class="pictures">
  10. <image :src="headUrl" class="picture"></image>
  11. </view>
  12. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  13. </view>
  14. </view>
  15. <u-line color="#EEEEEE" class="line"></u-line>
  16. <view class='flex flex-space-between'>
  17. <view>
  18. <text>姓名</text>
  19. </view>
  20. <view style='align-items: center;' class="flex">
  21. <view class="username">
  22. <!-- {{username}} -->
  23. 未认证
  24. </view>
  25. <!-- <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image> -->
  26. </view>
  27. </view>
  28. </view>
  29. <view class="content2">
  30. <view class='flex flex-space-between' @click='UpdataAccount'>
  31. <view>
  32. <text>修改账号</text>
  33. </view>
  34. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  35. </view>
  36. <u-line color="#EEEEEE" class="line"></u-line>
  37. <view class='flex flex-space-between' @click='UpdataPassword'>
  38. <view>
  39. <text>修改密码</text>
  40. </view>
  41. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  42. </view>
  43. <u-line color="#EEEEEE" class="line"></u-line>
  44. <view class='flex flex-space-between' @click='fankui'>
  45. <view>
  46. <text>意见反馈</text>
  47. </view>
  48. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  49. </view>
  50. <u-line color="#EEEEEE" class="line"></u-line>
  51. <view class='flex flex-space-between' @click='clearStorage'>
  52. <view>
  53. <text>清除缓存</text>
  54. </view>
  55. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  56. </view>
  57. </view>
  58. <view class='exitloginwrap'>
  59. <button @click='logout()' class='exitlogin'>退出登录</button>
  60. </view>
  61. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  62. :showCancelButton='true' confirmColor='#2772FB' @confirm="logOut" @close="cancelClick"
  63. @cancel="cancelClick"></u-modal>
  64. </view>
  65. </template>
  66. <script>
  67. var _this
  68. import {
  69. mapState
  70. } from 'vuex';
  71. export default {
  72. data() {
  73. return {
  74. alertTitle: '',
  75. isShowAlert: false,
  76. alertContent: '您确定要退出吗?',
  77. headUrl: "../../static/images/myimg/YongHu@3x.png",
  78. username: "",
  79. gridList: [{
  80. num: 0,
  81. name: '退出登录',
  82. // icon:'cuIcon-exit',
  83. src: '../../static/images/sign/return@3x.png',
  84. tips: 0,
  85. url: '',
  86. show: true
  87. }, ],
  88. }
  89. },
  90. computed: {
  91. // ...mapState(['hasLogin', 'userInfo'])
  92. },
  93. onShow() {
  94. this.getList()
  95. },
  96. onLoad() {
  97. _this = this
  98. },
  99. methods: {
  100. UpdataAccount() {
  101. uni.navigateTo({
  102. url: `/pages/mine/settings/editPhone`
  103. })
  104. },
  105. UpdataPassword() {
  106. uni.navigateTo({
  107. url: `/pages/mine/settings/editPassword?phone=${this.userInfo.phone}`
  108. })
  109. },
  110. clearStorage() {
  111. let that = this
  112. uni.clearStorageSync();
  113. this.$request.baseRequest('post', '/auth/api/logout').then(res => {
  114. if (res.code==200) {
  115. that.$store.commit('logout')
  116. // that.$api.logout()
  117. uni.navigateTo({
  118. url: `/pages/public/login`
  119. })
  120. }
  121. })
  122. },
  123. cancelClick() {
  124. this.isShowAlert = false
  125. },
  126. logOut() {
  127. uni.clearStorageSync();
  128. this.$request.baseRequest('post', '/auth/api/logout', {}).then(res => {
  129. uni.removeStorage({
  130. key: 'userInfo'
  131. })
  132. this.isShowAlert = false
  133. this.$store.commit('logout')
  134. uni.switchTab({
  135. url: `/pages/goodSource/index`
  136. })
  137. })
  138. .catch(res => {
  139. uni.$u.toast(res.message);
  140. });
  141. },
  142. getList() {
  143. this.userInfo = uni.getStorageSync('userInfo')
  144. this.headUrl = this.userInfo.avatarUrl
  145. if (this.headUrl == null || this.headUrl == "") {
  146. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  147. }
  148. this.username = this.userInfo.userName
  149. },
  150. switchPicture() {
  151. uni.navigateTo({
  152. url: `/pages/mine/settings/editAvatar`
  153. })
  154. },
  155. exitlogin() {
  156. },
  157. fankui() {
  158. uni.navigateTo({
  159. url: `/pages/mine/settings/feedback`
  160. })
  161. },
  162. logout() {
  163. // const that = this
  164. this.isShowAlert = true
  165. // uni.showModal({
  166. // title: '询问',
  167. // content: '您确定要退出吗?',
  168. // cancelText: '取消',
  169. // confirmText: '确定',
  170. // success: (e) => {
  171. // if (e.confirm) {
  172. // uni.hideTabBarRedDot({
  173. // index: 3
  174. // })
  175. // uni.clearStorageSync();
  176. // that.$store.commit('logout')
  177. // that.$api.logout()
  178. // uni.navigateTo({
  179. // url: `/pages/public/login`
  180. // })
  181. // }
  182. // }
  183. // })
  184. },
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .content {
  190. height: 100vh;
  191. color: #333333;
  192. }
  193. .content1,
  194. .content2 {
  195. background: white;
  196. padding: 20rpx 40rpx;
  197. }
  198. .content2 {
  199. margin-top: 10rpx;
  200. .flex{
  201. height: 70rpx;
  202. }
  203. }
  204. .pictures {
  205. justify-content: flex-end;
  206. width: 35px;
  207. height: 35px;
  208. background-color: #E0FAF6;
  209. border-radius: 18px;
  210. }
  211. .picture {
  212. width: 35px;
  213. height: 35px;
  214. }
  215. .arrow {
  216. margin-left: 15px;
  217. width: 8px;
  218. height: 12px;
  219. // justify-content: flex-end
  220. }
  221. .username {
  222. color: #6D6D72;
  223. }
  224. .sign {
  225. width: 18px;
  226. height: 18px;
  227. top: 4px;
  228. margin-right: 6px;
  229. }
  230. .exitloginwrap {
  231. position: fixed;
  232. bottom: 0;
  233. left: 0;
  234. width: 100%;
  235. padding-bottom: 20px;
  236. }
  237. .exitlogin {
  238. width: 90%;
  239. background: #fff;
  240. border-radius: 30px;
  241. color: #FB1E1E;
  242. font-size: 17px;
  243. }
  244. .exitlogin:after {
  245. border: none;
  246. }
  247. .line {
  248. margin: 20rpx 0 !important;
  249. }
  250. </style>