userCenter.vue 5.7 KB

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