setUp.vue 5.3 KB

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