setUp.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. this.$store.commit('logout')
  80. this.$api.logout()
  81. uni.navigateTo({
  82. url: `/pages/public/login`
  83. })
  84. },
  85. getList() {
  86. this.userInfo = uni.getStorageSync('userInfo')
  87. this.headUrl = this.userInfo.avatarUrl
  88. if (this.headUrl == null || this.headUrl == "") {
  89. this.headUrl = "../../static/img/myimg/YongHu@3x.png"
  90. }
  91. this.username = this.userInfo.userName
  92. },
  93. switchPicture() {
  94. uni.navigateTo({
  95. url: `/pages/user/set_picture`
  96. })
  97. },
  98. nickname(username) {
  99. uni.navigateTo({
  100. url: `/pages/user/set_nickname?nickname=${username}`
  101. })
  102. },
  103. exitlogin() {
  104. },
  105. fankui() {
  106. uni.navigateTo({
  107. url: `/pages/user/fankui`
  108. })
  109. },
  110. logout() {
  111. // const that = this
  112. this.isShowAlert = true
  113. // uni.showModal({
  114. // title: '询问',
  115. // content: '您确定要退出吗?',
  116. // cancelText: '取消',
  117. // confirmText: '确定',
  118. // success: (e) => {
  119. // if (e.confirm) {
  120. // uni.hideTabBarRedDot({
  121. // index: 3
  122. // })
  123. // uni.clearStorageSync();
  124. // that.$store.commit('logout')
  125. // that.$api.logout()
  126. // uni.navigateTo({
  127. // url: `/pages/public/login`
  128. // })
  129. // }
  130. // }
  131. // })
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. page {
  138. background-color: #F5F6FA;
  139. }
  140. .container {
  141. padding: 10px 0 0px;
  142. }
  143. .headPortrait {
  144. width: 100%;
  145. height: 52px;
  146. margin-top: 15px;
  147. background-color: #FFFFFF;
  148. border-radius: 6px;
  149. // justify-content: flex-end;
  150. }
  151. .title {
  152. font-size: 16px;
  153. line-height: 50px;
  154. font-weight: 600;
  155. margin-left: 10px;
  156. }
  157. .pictures {
  158. justify-content: flex-end;
  159. width: 35px;
  160. height: 35px;
  161. background-color: #E0FAF6;
  162. border-radius: 18px;
  163. }
  164. .picture {
  165. width: 35px;
  166. height: 35px;
  167. }
  168. .arrow {
  169. margin-left: 15px;
  170. width: 8px;
  171. height: 12px;
  172. // justify-content: flex-end
  173. }
  174. .username {
  175. line-height: 50px;
  176. color: #6D6D72;
  177. }
  178. .sign {
  179. width: 18px;
  180. height: 18px;
  181. top: 4px;
  182. margin-right: 6px;
  183. }
  184. .cu-list>.cu-item:after {
  185. border: none;
  186. }
  187. .exitloginwrap {
  188. position: fixed;
  189. bottom: 0;
  190. left: 0;
  191. width: 100%;
  192. padding-bottom: 20px;
  193. }
  194. .exitlogin {
  195. width: 90%;
  196. background: #fff;
  197. border-radius: 30px;
  198. color: #FB1E1E;
  199. font-size: 17px;
  200. }
  201. .exitlogin:after {
  202. border: none;
  203. }
  204. </style>