userCenter.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="container">
  3. <!-- 门店信息 -->
  4. <view class="store">
  5. <view class="storeInfo">
  6. <image :src="personIcon" class="personImg"></image>
  7. <view class="storeName">
  8. <view>{{ pageData ? pageData.userNameCN : '-' }}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <!-- 列表 -->
  13. <view class="list">
  14. <view
  15. hover-class="navigator-hover"
  16. v-for="(item, index) in list"
  17. :key="index"
  18. @click="goToInfo(item)"
  19. :class="item.type != 'line' ? 'listItem' : 'lineItem'"
  20. v-if="item.auth"
  21. >
  22. <view class="listItemLeft" v-if="item.type != 'line'">
  23. <view class="leftImg">
  24. <u-icon custom-prefix="xd-icon" :name="item.icon" size="45" :color="item.color"></u-icon>
  25. </view>
  26. <text>{{ item.title }}</text>
  27. </view>
  28. <view v-if="item.type != 'line'">
  29. <text class="number">{{ item.number }}</text>
  30. <text class="banbenhao">{{ item.banbenhao }}</text>
  31. <u-icon name="icon-xian-11" custom-prefix="xd-icon" size="32" color="#888888"></u-icon>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { logout } from '@/api/user.js';
  39. import { getSysVersion } from '@/api/data.js'
  40. import { checkVersionToLoadUpdate, clzConfirm } from '@/libs/tools';
  41. import market from "@/js_sdk/dc-market/market.js"
  42. export default {
  43. data() {
  44. const curVer = getApp().globalData.version;
  45. return {
  46. list: [
  47. {
  48. title: '个人信息',
  49. auth: this.$hasPermissions("M_userInfoView_mobile"),
  50. url: '/pages/userCenter/personInfo',
  51. icon: 'tarenxundian',
  52. color: '#55aaff'
  53. },
  54. {
  55. title: '修改密码',
  56. auth: this.$hasPermissions("M_editUserPws_mobile"),
  57. url: '/pages/userCenter/changePwd',
  58. icon: 'mimaxiugai',
  59. color: '#ff5500'
  60. },
  61. { type: 'line', auth: true },
  62. {
  63. title: '关于我们',
  64. auth: true,
  65. url: '/pages/userCenter/aboutUs',
  66. icon: 'guanyuwomen1',
  67. color: '#00aaff'
  68. },
  69. {
  70. title: '用户协议及隐私保护政策',
  71. auth: true,
  72. url: '/pages/login/userAuthYs',
  73. icon: 'xieyi1',
  74. color: '#07b584'
  75. },
  76. {
  77. title: '版本检查',
  78. auth: true,
  79. banbenhao: curVer.version,
  80. fun: 'getVersion',
  81. icon: 'banben',
  82. color: '#ff8c57'
  83. },
  84. { type: 'line', auth: true },
  85. {
  86. title: '退出登录',
  87. auth: true,
  88. fun: 'quitOutSys',
  89. icon: 'tuichuxitong',
  90. color: '#ff0000'
  91. }
  92. ],
  93. pageData: null, // 门店信息
  94. personIcon: '/static/defaultMe.png' // 默认门店图片
  95. };
  96. },
  97. onShow() {
  98. this.pageData = this.$store.state.vuex_userData
  99. },
  100. methods: {
  101. // 拨打电话
  102. call() {
  103. console.log('联系公司');
  104. },
  105. // 点击我的页面列表
  106. goToInfo(item) {
  107. if (item.url && item.url != '') {
  108. uni.navigateTo({
  109. url: item.url
  110. });
  111. }
  112. if (item.fun) {
  113. this[item.fun]();
  114. }
  115. },
  116. // 退出登录确认弹框
  117. quitOutSys() {
  118. const _this = this;
  119. clzConfirm({
  120. title: '提示',
  121. content: '确定退出登录?',
  122. success: function(res) {
  123. if (res.confirm || res.index == 0) {
  124. _this.quitSys();
  125. }
  126. }
  127. });
  128. },
  129. // 退出登录,返回登录页
  130. quitSys() {
  131. logout().then(res => {
  132. console.log(res);
  133. uni.showToast({
  134. icon: 'none',
  135. title: res.message
  136. });
  137. if (res.status == 200) {
  138. this.$store.commit("$closeWebsocket")
  139. this.$store.state.vuex_token = '';
  140. this.$store.state.vuex_userData = '';
  141. uni.setStorageSync('setStatusIndexFunc', 0);
  142. setTimeout(function() {
  143. uni.reLaunch({
  144. url: '/pages/login/login'
  145. });
  146. }, 1000);
  147. }
  148. });
  149. },
  150. // 获取最新版本信息
  151. getVersion() {
  152. //最新版本
  153. getSysVersion().then(ret => {
  154. console.log(JSON.stringify(ret))
  155. if(ret.status == 200){
  156. console.log(ret.data)
  157. this.$store.state.vuex_versionInfo = ret.data
  158. //进行版本型号的比对 以及下载更新请求
  159. checkVersionToLoadUpdate(ret.data, 1, market);
  160. }
  161. })
  162. }
  163. }
  164. };
  165. </script>
  166. <style lang="less">
  167. .container {
  168. background: #fff;
  169. font-size: 28rpx;
  170. box-sizing: border-box;
  171. height: calc(100vh - var(--window-top) - var(--window-bottom) - 55px);
  172. overflow: auto;
  173. color: #666;
  174. // 头部门店信息
  175. .store {
  176. display: flex;
  177. align-items: center;
  178. justify-content: space-between;
  179. padding: 20rpx 30rpx;
  180. background: rgb(11, 108, 224);
  181. color: #fff;
  182. .storeInfo {
  183. display: flex;
  184. align-items: center;
  185. font-size: 32rpx;
  186. .storeName {
  187. view {
  188. padding: 6upx 0;
  189. &:first-child {
  190. font-weight: bold;
  191. }
  192. }
  193. .font28 {
  194. color: #666;
  195. }
  196. }
  197. .personImg {
  198. width: 100rpx;
  199. height: 100rpx;
  200. margin-right: 20rpx;
  201. border-radius: 100rpx;
  202. }
  203. .storeRightIcon {
  204. line-height: 58rpx;
  205. }
  206. }
  207. }
  208. // 我的页面列表
  209. .lineItem {
  210. padding: 10upx;
  211. background-color: #f8f8f8;
  212. }
  213. .listItem {
  214. display: flex;
  215. flex-direction: row;
  216. justify-content: space-between;
  217. padding: 20rpx 30rpx;
  218. border-bottom: 1px solid #efefef;
  219. align-items: center;
  220. color: #666;
  221. .listItemLeft {
  222. display: flex;
  223. align-items: center;
  224. }
  225. .leftImg {
  226. flex-grow: 1;
  227. padding: 10upx;
  228. }
  229. .number {
  230. display: inline-block;
  231. width: 32rpx;
  232. border-radius: 50%;
  233. color: #ffffff;
  234. font-size: 24rpx;
  235. background-color: red;
  236. text-align: center;
  237. line-height: 32rpx;
  238. position: relative;
  239. bottom: 8rpx;
  240. right: 20rpx;
  241. }
  242. .banbenhao {
  243. position: relative;
  244. bottom: 8rpx;
  245. right: 20rpx;
  246. }
  247. }
  248. .listItem:last-child {
  249. margin-bottom: 40rpx;
  250. }
  251. // logo 联系方式
  252. .logoContent {
  253. margin: 100upx 0;
  254. text-align: center;
  255. .logoImg {
  256. .logo {
  257. width: 300rpx;
  258. height: 105rpx;
  259. }
  260. }
  261. .phone {
  262. margin-top: 20upx;
  263. color: #989898;
  264. .phoneImg {
  265. position: relative;
  266. bottom: 8rpx;
  267. }
  268. }
  269. }
  270. }
  271. </style>