set.vue 5.5 KB

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