set.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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:firstAuthentication.authenticationStatus=='已过期'?'已过期':'未认证'}}
  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'])
  92. },
  93. onShow() {
  94. this.getList()
  95. this.firstAuthentication=uni.getStorageSync("firstAuthentication")
  96. },
  97. onLoad() {
  98. _this = this
  99. console.log(this.userInfo)
  100. console.log(this.hasLogin)
  101. },
  102. methods: {
  103. editName(){
  104. uni.showToast({
  105. icon:'none',
  106. title:'可在司机认证中修改'
  107. })
  108. },
  109. UpdataAccount() {
  110. uni.navigateTo({
  111. url: `/pages/mine/settings/editPhone`
  112. })
  113. },
  114. UpdataPassword() {
  115. uni.navigateTo({
  116. url: `/pages/mine/settings/editPassword?phone=${this.userInfo.phone}`
  117. })
  118. },
  119. clearStorage() {
  120. let that = this
  121. uni.clearStorageSync();
  122. this.$request.baseRequest('post', '/auth/api/logout').then(res => {
  123. if (res.code==200) {
  124. that.$store.commit('logout')
  125. // that.$api.logout()
  126. uni.navigateTo({
  127. url: `/pages/public/login`
  128. })
  129. }
  130. })
  131. },
  132. cancelClick() {
  133. this.isShowAlert = false
  134. },
  135. logOut() {
  136. uni.clearStorageSync();
  137. this.$request.baseRequest('post', '/auth/api/logout', {}).then(res => {
  138. uni.removeStorage({
  139. key: 'userInfo'
  140. })
  141. this.isShowAlert = false
  142. this.$store.commit('logout')
  143. uni.switchTab({
  144. url: `/pages/goodSource/index`
  145. })
  146. })
  147. .catch(res => {
  148. uni.$u.toast(res.message);
  149. });
  150. },
  151. getList() {
  152. this.headUrl = this.userInfo.avatarUrl
  153. if (this.headUrl == null || this.headUrl == "") {
  154. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  155. }
  156. this.username = this.userInfo.userName
  157. },
  158. switchPicture() {
  159. uni.navigateTo({
  160. url: `/pages/mine/settings/editAvatar`
  161. })
  162. },
  163. exitlogin() {
  164. },
  165. fankui() {
  166. uni.navigateTo({
  167. url: `/pages/mine/fankui`
  168. })
  169. },
  170. logout() {
  171. // const that = this
  172. this.isShowAlert = true
  173. // uni.showModal({
  174. // title: '询问',
  175. // content: '您确定要退出吗?',
  176. // cancelText: '取消',
  177. // confirmText: '确定',
  178. // success: (e) => {
  179. // if (e.confirm) {
  180. // uni.hideTabBarRedDot({
  181. // index: 3
  182. // })
  183. // uni.clearStorageSync();
  184. // that.$store.commit('logout')
  185. // that.$api.logout()
  186. // uni.navigateTo({
  187. // url: `/pages/public/login`
  188. // })
  189. // }
  190. // }
  191. // })
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .content {
  198. height: 100vh;
  199. color: #333333;
  200. }
  201. .content1,
  202. .content2 {
  203. background: white;
  204. padding: 20rpx 40rpx;
  205. }
  206. .content2 {
  207. margin-top: 10rpx;
  208. .flex{
  209. height: 70rpx;
  210. }
  211. }
  212. .pictures {
  213. justify-content: flex-end;
  214. width: 35px;
  215. height: 35px;
  216. background-color: #E0FAF6;
  217. border-radius: 18px;
  218. }
  219. .picture {
  220. width: 35px;
  221. height: 35px;
  222. border-radius: 18px;
  223. }
  224. .arrow {
  225. margin-left: 15px;
  226. width: 8px;
  227. height: 12px;
  228. // justify-content: flex-end
  229. }
  230. .username {
  231. color: #6D6D72;
  232. }
  233. .sign {
  234. width: 18px;
  235. height: 18px;
  236. top: 4px;
  237. margin-right: 6px;
  238. }
  239. .exitloginwrap {
  240. position: fixed;
  241. bottom: 0;
  242. left: 0;
  243. width: 100%;
  244. padding-bottom: 20px;
  245. }
  246. .exitlogin {
  247. width: 90%;
  248. background: #fff;
  249. border-radius: 30px;
  250. color: #FB1E1E;
  251. font-size: 17px;
  252. }
  253. .exitlogin:after {
  254. border: none;
  255. }
  256. .line {
  257. margin: 20rpx 0 !important;
  258. }
  259. </style>