setlist.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="_select">
  3. <view class="list">
  4. <view class="li" @click="touser">
  5. <view class="title">
  6. 个人中心
  7. </view>
  8. <u-icon name="arrow-right" size="20"></u-icon>
  9. </view>
  10. <view class="li" @click="topass">
  11. <view class="title">
  12. 修改密码
  13. </view>
  14. <u-icon name="arrow-right" size="20"></u-icon>
  15. </view>
  16. <!-- <view class="li">
  17. <view class="title">
  18. 聊天
  19. </view>
  20. <u-icon name="arrow-right" size="20"></u-icon>
  21. </view>
  22. <view class="li">
  23. <view class="title">
  24. 通用
  25. </view>
  26. <u-icon name="arrow-right" size="20"></u-icon>
  27. </view>
  28. <view class="li">
  29. <view class="title">
  30. 帮助与反馈
  31. </view>
  32. <u-icon name="arrow-right" size="20"></u-icon>
  33. </view> -->
  34. <view class="li" @click="todetail()">
  35. <view class="title">
  36. 关于我们
  37. </view>
  38. <u-icon name="arrow-right" size="20"></u-icon>
  39. </view>
  40. <view class="li" @click="toGenxin" v-if='isApp'>
  41. <view class="title">
  42. 当前版本
  43. </view>
  44. <view :class="update?'update':''">
  45. {{version}}
  46. </view>
  47. </view>
  48. </view>
  49. <view class="logout" @click="logout">
  50. 退出登录
  51. </view>
  52. <u-toast ref="uToast"></u-toast>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. version: "1.0.50",
  60. update: false,
  61. isApp: false
  62. }
  63. },
  64. onShow() {
  65. //#ifdef APP-PLUS
  66. this.isApp = true
  67. let that = this
  68. this.getVersion()
  69. that.$api.to_http(`/basic/zhkjsysappversion/latestVersion`,
  70. "GET").then((res) => {
  71. let a = res.data.data.version.split('.')
  72. let b = that.version.split('.')
  73. console.log(a, b);
  74. console.log(a[0] > b[0] || a[1] > b[1] || a[2] > b[2]);
  75. if (a[0] > b[0] || a[1] > b[1] || a[2] > b[2]) {
  76. that.update = true
  77. }
  78. })
  79. //#endif
  80. },
  81. methods: {
  82. toGenxin() {
  83. if (!this.update) {
  84. return this.$refs.uToast.show({
  85. message: '已经是最新版本了',
  86. type: 'success',
  87. })
  88. }
  89. uni.navigateTo({
  90. url: '/pages/genxin/genxin'
  91. })
  92. },
  93. getVersion() {
  94. // 获取本地应用资源版本号
  95. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  96. this.version = info.version;
  97. console.log(this.version);
  98. })
  99. },
  100. todetail(e) {
  101. uni.navigateTo({
  102. url: '/pages/main/set/aboutUs/aboutUs'
  103. })
  104. },
  105. topass() {
  106. uni.navigateTo({
  107. url: '/pages/main/set/changePassword'
  108. })
  109. },
  110. touser() {
  111. uni.navigateTo({
  112. url: '/pages/main/set/userinfo/userinfo'
  113. })
  114. },
  115. logout() {
  116. this.$api.to_http(`/logout`, {}, "POST").then((res) => {
  117. console.log(res);
  118. if (res.data.code == 0) {
  119. uni.removeStorageSync('token');
  120. this.$refs.uToast.show({
  121. message: '退出成功',
  122. type: 'success',
  123. })
  124. setTimeout(() => {
  125. uni.navigateTo({
  126. url: '/pages/login/login'
  127. })
  128. }, 800)
  129. }
  130. })
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang='less'>
  136. .logout {
  137. background-color: #fff;
  138. margin-top: 20rpx;
  139. text-align: center;
  140. padding: 10rpx;
  141. }
  142. ._select {
  143. background: #F2F6FF;
  144. position: absolute;
  145. min-height: 100%;
  146. width: 100%;
  147. box-sizing: border-box;
  148. }
  149. ._select .list {
  150. background-color: #fff;
  151. padding: 40rpx;
  152. }
  153. ._select .li {
  154. display: flex;
  155. justify-content: space-between;
  156. margin-bottom: 40rpx;
  157. position: relative;
  158. .update::after {
  159. content: '';
  160. width: 15rpx;
  161. height: 15rpx;
  162. background: red;
  163. border-radius: 50%;
  164. position: absolute;
  165. }
  166. }
  167. </style>