setUp.vue 4.9 KB

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