setUp.vue 4.5 KB

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