userCenter.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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.orgName : '-' }}</view>
  9. <view class="font28">{{ pageData ? pageData.userNameCN : '-' }}</view>
  10. </view>
  11. </view>
  12. </view>
  13. <!-- 列表 -->
  14. <view class="list">
  15. <view
  16. hover-class="navigator-hover"
  17. v-for="(item, index) in list"
  18. :key="index"
  19. @click="goToInfo(item)"
  20. :class="item.type != 'line' ? 'listItem' : 'lineItem'"
  21. v-if="((pageData && item.pageType == pageData.orgType) || !item.pageType) && item.auth"
  22. >
  23. <view class="listItemLeft" v-if="item.type != 'line'">
  24. <view class="leftImg">
  25. <u-icon :name="item.icon" size="36" :color="item.color" ></u-icon>
  26. </view>
  27. <text>{{ item.title }}</text>
  28. </view>
  29. <view v-if="item.type != 'line'">
  30. <text class="number">{{ item.number }}</text>
  31. <text class="banbenhao">{{ item.banbenhao }}</text>
  32. <u-icon name="arrow-right" size="24" color="#999" ></u-icon>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { logout } from '@/api/user.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: 'account-fill',
  53. color: '#55aaff'
  54. },
  55. {
  56. title: '修改密码',
  57. auth: true,
  58. url: '/pages/userCenter/changePwd',
  59. icon: 'lock-fill',
  60. color: '#ffaa7f'
  61. },
  62. { type: 'line', auth: true },
  63. {
  64. title: '关于我们',
  65. auth: true,
  66. url: '/pages/userCenter/aboutUs',
  67. icon: 'question-circle-fill',
  68. color: '#55aaff'
  69. },
  70. {
  71. title: '用户协议及隐私保护政策',
  72. auth: true,
  73. url: '/pages/login/userAuthYs',
  74. icon: 'info-circle-fill',
  75. color: '#00aa00'
  76. },
  77. {
  78. title: '版本检查',
  79. auth: true,
  80. banbenhao: curVer.version,
  81. fun: 'getVersion',
  82. icon: 'checkmark-circle-fill',
  83. color: '#ffaa7f'
  84. },
  85. { type: 'line', auth: true },
  86. {
  87. title: '退出登录',
  88. auth: true,
  89. fun: 'quitOutSys',
  90. icon: 'play-right-fill',
  91. color: '#ff0000'
  92. }
  93. ],
  94. pageData: null, // 门店信息
  95. storeData: null, // 单店门店信息
  96. personIcon: '/static/defaultMe.png' // 默认门店图片
  97. };
  98. },
  99. onLoad() {},
  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: 40rpx 30rpx;
  174. background: #ffffff;
  175. .storeInfo {
  176. display: flex;
  177. align-items: center;
  178. font-size: 32rpx;
  179. .storeName {
  180. view {
  181. padding: 6upx 0;
  182. &:first-child {
  183. font-weight: bold;
  184. }
  185. }
  186. .font28 {
  187. color: #666;
  188. }
  189. }
  190. .personImg {
  191. width: 100rpx;
  192. height: 100rpx;
  193. margin-right: 20rpx;
  194. border-radius: 100rpx;
  195. }
  196. .storeRightIcon {
  197. line-height: 58rpx;
  198. }
  199. }
  200. }
  201. // 我的页面列表
  202. .lineItem {
  203. padding: 10upx;
  204. background-color: #f8f8f8;
  205. }
  206. .listItem {
  207. display: flex;
  208. flex-direction: row;
  209. justify-content: space-between;
  210. padding: 20rpx 30rpx;
  211. border-bottom: 1px solid #efefef;
  212. align-items: center;
  213. color: #666;
  214. .listItemLeft {
  215. display: flex;
  216. align-items: center;
  217. }
  218. .leftImg {
  219. flex-grow: 1;
  220. padding: 10upx;
  221. }
  222. .number {
  223. display: inline-block;
  224. width: 32rpx;
  225. border-radius: 50%;
  226. color: #ffffff;
  227. font-size: 24rpx;
  228. background-color: red;
  229. text-align: center;
  230. line-height: 32rpx;
  231. position: relative;
  232. bottom: 8rpx;
  233. right: 20rpx;
  234. }
  235. .banbenhao {
  236. position: relative;
  237. bottom: 8rpx;
  238. right: 20rpx;
  239. }
  240. }
  241. .listItem:last-child {
  242. margin-bottom: 40rpx;
  243. }
  244. // logo 联系方式
  245. .logoContent {
  246. margin: 100upx 0;
  247. text-align: center;
  248. .logoImg {
  249. .logo {
  250. width: 300rpx;
  251. height: 105rpx;
  252. }
  253. }
  254. .phone {
  255. margin-top: 20upx;
  256. color: #989898;
  257. .phoneImg {
  258. position: relative;
  259. bottom: 8rpx;
  260. }
  261. }
  262. }
  263. }
  264. </style>