set.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. // import APPUpdate, {
  72. // getCurrentNo
  73. // } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  74. // import * as config from '@/config/index.js'
  75. export default {
  76. data() {
  77. return {
  78. alertTitle: '',
  79. isShowAlert: false,
  80. alertContent: '您确定要退出吗?',
  81. headUrl: "../../static/images/myimg/YongHu@3x.png",
  82. username: "",
  83. gridList: [{
  84. num: 0,
  85. name: '退出登录',
  86. // icon:'cuIcon-exit',
  87. src: '../../static/images/sign/return@3x.png',
  88. tips: 0,
  89. url: '',
  90. show: true
  91. }, ],
  92. version: "1.1.0" //版本号
  93. }
  94. },
  95. computed: {
  96. ...mapState(['hasLogin', 'userInfo'])
  97. },
  98. onShow() {
  99. this.getList()
  100. this.firstAuthentication = uni.getStorageSync("firstAuthentication")
  101. // // #ifdef APP-PLUS
  102. // this.version = plus.runtime.version
  103. // this.checkVersion()
  104. // // #endif
  105. },
  106. onLoad() {
  107. _this = this
  108. },
  109. methods: {
  110. // 检查APP是否有新版本
  111. // onAPPUpdate() {
  112. // // true 没有新版本的时候有提示,默认:false
  113. // if (this.version == "发现新版本,立即更新") {
  114. // APPUpdate(true);
  115. // }
  116. // },
  117. // checkVersion() { //检查版本
  118. // const baseUrlNew = config.def().baseUrlNew
  119. // uni.request({
  120. // url: baseUrlNew + '/appVersion/selectInfo',
  121. // data: {
  122. // appid: plus.runtime.appid,
  123. // version: plus.runtime.version,
  124. // imei: "1",
  125. // type: 'sj'
  126. // },
  127. // method: 'GET',
  128. // success: (res) => {
  129. // if (this.version == res.data.data.version) {
  130. // this.version = "当前为最新版" + this.version
  131. // } else {
  132. // this.version = "发现新版本,立即更新"
  133. // }
  134. // }
  135. // })
  136. // },
  137. editName() {
  138. uni.showToast({
  139. icon: 'none',
  140. title: '可在司机认证中修改'
  141. })
  142. },
  143. UpdataAccount() {
  144. uni.navigateTo({
  145. url: `/pages/mine/settings/editPhone`
  146. })
  147. },
  148. UpdataPassword() {
  149. uni.navigateTo({
  150. url: `/pages/mine/settings/editPassword?phone=${this.userInfo.phone}`
  151. })
  152. },
  153. clearStorage() {
  154. let that = this
  155. uni.clearStorageSync();
  156. this.$request.baseRequest('post', '/auth/api/logout').then(res => {
  157. if (res.code == 200) {
  158. that.$store.commit('logout')
  159. // that.$api.logout()
  160. uni.navigateTo({
  161. url: `/pages/public/login`
  162. })
  163. }
  164. })
  165. },
  166. cancelClick() {
  167. this.isShowAlert = false
  168. },
  169. logOut() {
  170. uni.clearStorageSync();
  171. this.$request.baseRequest('post', '/auth/api/logout', {}).then(res => {
  172. uni.removeStorage({
  173. key: 'userInfo'
  174. })
  175. this.isShowAlert = false
  176. this.$store.commit('logout')
  177. uni.switchTab({
  178. url: `/pages/goodSource/index`
  179. })
  180. })
  181. .catch(res => {
  182. uni.$u.toast(res.message);
  183. });
  184. },
  185. getList() {
  186. this.headUrl = this.userInfo.avatarUrl
  187. if (this.headUrl == null || this.headUrl == "") {
  188. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  189. }
  190. this.username = this.userInfo.userName
  191. },
  192. switchPicture() {
  193. uni.navigateTo({
  194. url: `/pages/mine/settings/editAvatar`
  195. })
  196. },
  197. exitlogin() {
  198. },
  199. fankui() {
  200. uni.navigateTo({
  201. url: `/pages/mine/fankui`
  202. })
  203. },
  204. logout() {
  205. // const that = this
  206. this.isShowAlert = true
  207. // uni.showModal({
  208. // title: '询问',
  209. // content: '您确定要退出吗?',
  210. // cancelText: '取消',
  211. // confirmText: '确定',
  212. // success: (e) => {
  213. // if (e.confirm) {
  214. // uni.hideTabBarRedDot({
  215. // index: 3
  216. // })
  217. // uni.clearStorageSync();
  218. // that.$store.commit('logout')
  219. // that.$api.logout()
  220. // uni.navigateTo({
  221. // url: `/pages/public/login`
  222. // })
  223. // }
  224. // }
  225. // })
  226. },
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .content {
  232. height: calc(100vh);
  233. color: #333333;
  234. }
  235. .content1,
  236. .content2 {
  237. background: white;
  238. padding: 20rpx 40rpx;
  239. }
  240. .content2 {
  241. margin-top: 10rpx;
  242. .flex {
  243. height: 70rpx;
  244. }
  245. }
  246. .pictures {
  247. justify-content: flex-end;
  248. width: 35px;
  249. height: 35px;
  250. background-color: #E0FAF6;
  251. border-radius: 18px;
  252. }
  253. .picture {
  254. width: 35px;
  255. height: 35px;
  256. border-radius: 18px;
  257. }
  258. .arrow {
  259. margin-left: 15px;
  260. width: 8px;
  261. height: 12px;
  262. // justify-content: flex-end
  263. }
  264. .username {
  265. color: #6D6D72;
  266. }
  267. .sign {
  268. width: 18px;
  269. height: 18px;
  270. top: 4px;
  271. margin-right: 6px;
  272. }
  273. .exitloginwrap {
  274. position: fixed;
  275. bottom: 0;
  276. left: 0;
  277. width: 100%;
  278. padding-bottom: 20px;
  279. }
  280. .exitlogin {
  281. width: 90%;
  282. background: #fff;
  283. border-radius: 30px;
  284. color: #FB1E1E;
  285. font-size: 17px;
  286. }
  287. .exitlogin:after {
  288. border: none;
  289. }
  290. .line {
  291. margin: 20rpx 0 !important;
  292. }
  293. </style>