set.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="content">
  3. <view class="content1">
  4. <view class='flex flex-space-between' @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/images/myimg/gengduo1@3x.png" class="arrow"></image>
  13. </view>
  14. </view>
  15. <u-line color="#EEEEEE" class="line"></u-line>
  16. <view class='flex flex-space-between'>
  17. <view>
  18. <text>姓名</text>
  19. </view>
  20. <view style='align-items: center;' class="flex" @click="editName">
  21. <view class="username">
  22. {{firstAuthentication.authenticationStatus=='已认证'?firstAuthentication.driverName:'未认证'}}
  23. </view>
  24. <!-- <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image> -->
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content2">
  29. <!--
  30. <view class='flex flex-space-between' @click='UpdataAccount'>
  31. <view>
  32. <text>修改账号</text>
  33. </view>
  34. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  35. </view> -->
  36. <!-- <u-line color="#EEEEEE" class="line"></u-line> -->
  37. <view class='flex flex-space-between' @click='UpdataPassword'>
  38. <view>
  39. <text>修改密码</text>
  40. </view>
  41. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  42. </view>
  43. <u-line color="#EEEEEE" class="line"></u-line>
  44. <view class='flex flex-space-between' @click='fankui'>
  45. <view>
  46. <text>意见反馈</text>
  47. </view>
  48. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  49. </view>
  50. <u-line color="#EEEEEE" class="line"></u-line>
  51. <view class='flex flex-space-between' @click='clearStorage'>
  52. <view>
  53. <text>清除缓存</text>
  54. </view>
  55. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  56. </view>
  57. </view>
  58. <view class='exitloginwrap'>
  59. <button @click='logout()' class='exitlogin'>退出登录</button>
  60. </view>
  61. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  62. :showCancelButton='true' confirmColor='#2772FB' @confirm="logOut" @close="cancelClick"
  63. @cancel="cancelClick"></u-modal>
  64. </view>
  65. </template>
  66. <script>
  67. var _this
  68. import {
  69. mapState
  70. } from 'vuex';
  71. export default {
  72. data() {
  73. return {
  74. alertTitle: '',
  75. isShowAlert: false,
  76. alertContent: '您确定要退出吗?',
  77. headUrl: "../../static/images/myimg/YongHu@3x.png",
  78. username: "",
  79. gridList: [{
  80. num: 0,
  81. name: '退出登录',
  82. // icon:'cuIcon-exit',
  83. src: '../../static/images/sign/return@3x.png',
  84. tips: 0,
  85. url: '',
  86. show: true
  87. }, ],
  88. }
  89. },
  90. computed: {
  91. ...mapState(['hasLogin', 'userInfo','firstAuthentication'])
  92. },
  93. onShow() {
  94. this.getList()
  95. },
  96. onLoad() {
  97. _this = this
  98. console.log(this.userInfo)
  99. console.log(this.hasLogin)
  100. },
  101. methods: {
  102. editName(){
  103. uni.showToast({
  104. icon:'none',
  105. title:'可在司机认证中修改'
  106. })
  107. },
  108. UpdataAccount() {
  109. uni.navigateTo({
  110. url: `/pages/mine/settings/editPhone`
  111. })
  112. },
  113. UpdataPassword() {
  114. uni.navigateTo({
  115. url: `/pages/mine/settings/editPassword?phone=${this.userInfo.phone}`
  116. })
  117. },
  118. clearStorage() {
  119. let that = this
  120. uni.clearStorageSync();
  121. this.$request.baseRequest('post', '/auth/api/logout').then(res => {
  122. if (res.code==200) {
  123. that.$store.commit('logout')
  124. // that.$api.logout()
  125. uni.navigateTo({
  126. url: `/pages/public/login`
  127. })
  128. }
  129. })
  130. },
  131. cancelClick() {
  132. this.isShowAlert = false
  133. },
  134. logOut() {
  135. uni.clearStorageSync();
  136. this.$request.baseRequest('post', '/auth/api/logout', {}).then(res => {
  137. uni.removeStorage({
  138. key: 'userInfo'
  139. })
  140. this.isShowAlert = false
  141. this.$store.commit('logout')
  142. uni.switchTab({
  143. url: `/pages/goodSource/index`
  144. })
  145. })
  146. .catch(res => {
  147. uni.$u.toast(res.message);
  148. });
  149. },
  150. getList() {
  151. this.headUrl = this.userInfo.avatarUrl
  152. if (this.headUrl == null || this.headUrl == "") {
  153. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  154. }
  155. this.username = this.userInfo.userName
  156. },
  157. switchPicture() {
  158. uni.navigateTo({
  159. url: `/pages/mine/settings/editAvatar`
  160. })
  161. },
  162. exitlogin() {
  163. },
  164. fankui() {
  165. uni.navigateTo({
  166. url: `/pages/mine/settings/feedback`
  167. })
  168. },
  169. logout() {
  170. // const that = this
  171. this.isShowAlert = true
  172. // uni.showModal({
  173. // title: '询问',
  174. // content: '您确定要退出吗?',
  175. // cancelText: '取消',
  176. // confirmText: '确定',
  177. // success: (e) => {
  178. // if (e.confirm) {
  179. // uni.hideTabBarRedDot({
  180. // index: 3
  181. // })
  182. // uni.clearStorageSync();
  183. // that.$store.commit('logout')
  184. // that.$api.logout()
  185. // uni.navigateTo({
  186. // url: `/pages/public/login`
  187. // })
  188. // }
  189. // }
  190. // })
  191. },
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .content {
  197. height: 100vh;
  198. color: #333333;
  199. }
  200. .content1,
  201. .content2 {
  202. background: white;
  203. padding: 20rpx 40rpx;
  204. }
  205. .content2 {
  206. margin-top: 10rpx;
  207. .flex{
  208. height: 70rpx;
  209. }
  210. }
  211. .pictures {
  212. justify-content: flex-end;
  213. width: 35px;
  214. height: 35px;
  215. background-color: #E0FAF6;
  216. border-radius: 18px;
  217. }
  218. .picture {
  219. width: 35px;
  220. height: 35px;
  221. border-radius: 18px;
  222. }
  223. .arrow {
  224. margin-left: 15px;
  225. width: 8px;
  226. height: 12px;
  227. // justify-content: flex-end
  228. }
  229. .username {
  230. color: #6D6D72;
  231. }
  232. .sign {
  233. width: 18px;
  234. height: 18px;
  235. top: 4px;
  236. margin-right: 6px;
  237. }
  238. .exitloginwrap {
  239. position: fixed;
  240. bottom: 0;
  241. left: 0;
  242. width: 100%;
  243. padding-bottom: 20px;
  244. }
  245. .exitlogin {
  246. width: 90%;
  247. background: #fff;
  248. border-radius: 30px;
  249. color: #FB1E1E;
  250. font-size: 17px;
  251. }
  252. .exitlogin:after {
  253. border: none;
  254. }
  255. .line {
  256. margin: 20rpx 0 !important;
  257. }
  258. </style>