userCenter.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 { checkVersionToLoadUpdate, clzConfirm } from '@/libs/tools';
  40. import market from "@/js_sdk/dc-market/market.js"
  41. export default {
  42. data() {
  43. const curVer = getApp().globalData.version;
  44. return {
  45. list: [
  46. { type: 'line', auth: true },
  47. {
  48. title: '个人信息',
  49. auth: true,
  50. url: '/pages/userCenter/personInfo',
  51. icon: 'tarenxundian',
  52. color: '#55aaff'
  53. },
  54. {
  55. title: '修改密码',
  56. auth: true,
  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: '#00aa00'
  68. },
  69. {
  70. title: '用户协议及隐私保护政策',
  71. auth: true,
  72. url: '/pages/login/userAuthYs',
  73. icon: 'xieyi1',
  74. color: '#8067ff'
  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. const newVer = this.$store.state.vuex_versionInfo;
  154. //进行版本型号的比对 以及下载更新请求
  155. checkVersionToLoadUpdate(newVer, 1, market);
  156. }
  157. }
  158. };
  159. </script>
  160. <style lang="less">
  161. .container {
  162. background: #fff;
  163. font-size: 28rpx;
  164. box-sizing: border-box;
  165. height: calc(100vh - var(--window-top) - var(--window-bottom) - 55px);
  166. overflow: auto;
  167. color: #666;
  168. // 头部门店信息
  169. .store {
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. padding: 20rpx 30rpx;
  174. background: rgb(11, 108, 224);
  175. color: #fff;
  176. .storeInfo {
  177. display: flex;
  178. align-items: center;
  179. font-size: 32rpx;
  180. .storeName {
  181. view {
  182. padding: 6upx 0;
  183. &:first-child {
  184. font-weight: bold;
  185. }
  186. }
  187. .font28 {
  188. color: #666;
  189. }
  190. }
  191. .personImg {
  192. width: 100rpx;
  193. height: 100rpx;
  194. margin-right: 20rpx;
  195. border-radius: 100rpx;
  196. }
  197. .storeRightIcon {
  198. line-height: 58rpx;
  199. }
  200. }
  201. }
  202. // 我的页面列表
  203. .lineItem {
  204. padding: 10upx;
  205. background-color: #f8f8f8;
  206. }
  207. .listItem {
  208. display: flex;
  209. flex-direction: row;
  210. justify-content: space-between;
  211. padding: 20rpx 30rpx;
  212. border-bottom: 1px solid #efefef;
  213. align-items: center;
  214. color: #666;
  215. .listItemLeft {
  216. display: flex;
  217. align-items: center;
  218. }
  219. .leftImg {
  220. flex-grow: 1;
  221. padding: 10upx;
  222. }
  223. .number {
  224. display: inline-block;
  225. width: 32rpx;
  226. border-radius: 50%;
  227. color: #ffffff;
  228. font-size: 24rpx;
  229. background-color: red;
  230. text-align: center;
  231. line-height: 32rpx;
  232. position: relative;
  233. bottom: 8rpx;
  234. right: 20rpx;
  235. }
  236. .banbenhao {
  237. position: relative;
  238. bottom: 8rpx;
  239. right: 20rpx;
  240. }
  241. }
  242. .listItem:last-child {
  243. margin-bottom: 40rpx;
  244. }
  245. // logo 联系方式
  246. .logoContent {
  247. margin: 100upx 0;
  248. text-align: center;
  249. .logoImg {
  250. .logo {
  251. width: 300rpx;
  252. height: 105rpx;
  253. }
  254. }
  255. .phone {
  256. margin-top: 20upx;
  257. color: #989898;
  258. .phoneImg {
  259. position: relative;
  260. bottom: 8rpx;
  261. }
  262. }
  263. }
  264. }
  265. </style>