set.vue 5.5 KB

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