Sin descripción

setting.vue 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="content">
  3. <view class="userInfo">
  4. <view class="userInfoLeft">
  5. <image src="/static/person.png" mode=""></image>
  6. </view>
  7. <view class="userInfoRight">
  8. <view>{{ userName }}</view>
  9. <view>{{ userCode }}</view>
  10. </view>
  11. </view>
  12. <view class="userList">
  13. <view class="listCell" v-for="(item,index) in listCell" :key="index">
  14. <image :src="item.imgPath"></image>
  15. <text>{{item.itemText}}</text>
  16. <uni-icons class="fontIcon" type="arrowright" color="#d6d6d4" size="18"></uni-icons>
  17. </view>
  18. <view class="listCell">
  19. <image src="/static/Wd.png"></image>
  20. <text>版本</text>
  21. <text class="versionNum">{{version}}</text>
  22. </view>
  23. </view>
  24. <view class="btnExit">
  25. <button type="primary" @click="btnExit">退出登录</button>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. mapGetters
  32. } from 'vuex';
  33. import store from '@/store';
  34. export default {
  35. data() {
  36. return {
  37. version: '',
  38. listCell: [
  39. // {
  40. // imgPath:'../../static/Wa.png',
  41. // itemText:'服务守则'
  42. // },
  43. ]
  44. }
  45. },
  46. onShow() {
  47. // this.$http.get("InternalMessages/GetCount", {token: uni.getStorageSync("token")}).then((response) => {
  48. // if (response.state.toLowerCase() === "success") {
  49. // if (response.IsRead == 1) {
  50. // uni.showTabBarRedDot({
  51. // index: 1
  52. // })
  53. // } else {
  54. // uni.hideTabBarRedDot({
  55. // index: 1
  56. // })
  57. // }
  58. // }
  59. // })
  60. // .catch((e) => {
  61. // console.log(e)
  62. // })
  63. },
  64. onLoad() {
  65. store.dispatch("GetNowUser") //全局用户信息,目前设置页有用到
  66. // #ifdef APP-PLUS
  67. this.version = plus.runtime.version
  68. // #endif
  69. },
  70. methods: {
  71. btnExit() {
  72. uni.showModal({
  73. title: '确定退出吗?',
  74. content: '退出到登录页面',
  75. success: function(res) {
  76. if (res.confirm) {
  77. uni.setStorageSync('Username', '');
  78. uni.setStorageSync('Password', '');
  79. uni.setStorageSync('token', '');
  80. uni.reLaunch({
  81. url: '/pages/login/login'
  82. });
  83. } else if (res.cancel) {
  84. console.log('用户点击取消');
  85. }
  86. }
  87. });
  88. }
  89. },
  90. computed: {
  91. ...mapGetters([
  92. "userCode", // 用户工号
  93. "userName", // 用户名称
  94. ])
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .userInfo {
  100. background: url(/static/setting_banner.png) no-repeat;
  101. background-size: 100% 100%;
  102. width: 100%;
  103. height: 260rpx;
  104. display: flex;
  105. .userInfoLeft {
  106. width: 150rpx;
  107. height: 150rpx;
  108. border-radius: 75rpx;
  109. margin: 30rpx 30rpx 0rpx 30rpx;
  110. background: #FFFFFF;
  111. image {
  112. width: 100%;
  113. height: 100%;
  114. padding: 30rpx 20rpx 30rpx 35rpx;
  115. box-sizing: border-box;
  116. }
  117. }
  118. .userInfoRight {
  119. margin-top: 50rpx;
  120. view {
  121. color: #FFFFFF;
  122. font-size: 30rpx;
  123. }
  124. }
  125. }
  126. .userList {
  127. width: 100%;
  128. border-top: 1rpx solid #d6d6d4;
  129. border-bottom: 1rpx solid #d6d6d4;
  130. background: #FFFFFF;
  131. margin-top: 40rpx;
  132. overflow: hidden;
  133. .listCell {
  134. width: 720rpx;
  135. margin-left: 30rpx;
  136. height: 84rpx;
  137. line-height: 84rpx;
  138. border-bottom: 1rpx solid #d6d6d4;
  139. position: relative;
  140. display: flex;
  141. image {
  142. width: 40rpx;
  143. height: 40rpx;
  144. margin: 22rpx 22rpx 0 22rpx;
  145. box-sizing: border-box;
  146. }
  147. .fontIcon {
  148. position: absolute;
  149. right: 40rpx;
  150. }
  151. .versionNum {
  152. position: absolute;
  153. right: 80rpx;
  154. color: #999998;
  155. }
  156. }
  157. .listCell:last-child {
  158. border: none;
  159. }
  160. }
  161. .btnExit {
  162. width: 80%;
  163. margin: 30rpx auto;
  164. button {
  165. background: #f1ae53;
  166. }
  167. }
  168. </style>