set.vue 7.3 KB

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