index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view>
  3. <view class="top-nav">
  4. <view class="l">
  5. <block v-if="isLogin">
  6. <image class="user-img" src="../../static/user.png" @click="toAccount"></image>
  7. <view class="l-r">
  8. <text class="u-name">{{ userName }}</text>
  9. <text class="c-name" v-if="customerId!=='1'">{{ companyName }}</text>
  10. </view>
  11. </block>
  12. <block v-else>
  13. <view class="login-btn" @click="toLogin">登录</view>
  14. </block>
  15. </view>
  16. <view class="r" v-if="isLogin">
  17. <view class="l-out" @click="exitFn">
  18. 退出登录
  19. </view>
  20. </view>
  21. </view>
  22. <view class="top-bg"></view>
  23. <view class="top">
  24. <text class="title">场站管理系统</text>
  25. </view>
  26. <view class="item-box">
  27. <view class="item" hover-class="hover-class" v-for="(indexItem,index) in indexItemList" :key="index"
  28. @click="navTo(indexItem)" v-show="indexItem.show">
  29. <image class="icon" :src="indexItem.icon"></image>
  30. <view class="text">
  31. <text v-if="indexItem.text=='企业管理'&&customerId!='1'">信息管理</text>
  32. <text v-else>{{ indexItem.text }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="qrcode">
  37. <image class="qrcode" :src="qrcoderlc"></image>
  38. <text class="text">长按二维码保存分享</text>
  39. </view>
  40. <view style="text-align: center;font-size: 23rpx;">
  41. <a href="https://beian.miit.gov.cn/" target="_blank">桂ICP备12007573号-1</a>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. isLogin: false, //是否登录状态
  50. userName: '',
  51. companyName: '',
  52. customerId: '',
  53. qrcoderlc: '../../static/qrcode.png',
  54. indexItemList: []
  55. }
  56. },
  57. onShow() {
  58. this.getStoreInfo();
  59. this.setList();
  60. },
  61. onBackPress() {
  62. return true;
  63. },
  64. methods: {
  65. setList() {
  66. this.indexItemList = [{
  67. auth: false,
  68. icon: '../../static/home-icon-01.png',
  69. text: '企业注册',
  70. url: '/pages/enterprise-reg/enterprise-reg',
  71. show: uni.getStorageSync('info') ? false : true
  72. },
  73. {
  74. auth: false,
  75. icon: '../../static/home-icon-07.jpg',
  76. text: '申报录入',
  77. url: '/pages/declare/add',
  78. show: true
  79. },
  80. {
  81. auth: false,
  82. icon: '../../static/home-icon-06.jpg',
  83. text: '消杀申报',
  84. url: '/pages/disinfect/addDisinfect',
  85. show: true
  86. },
  87. {
  88. auth: true,
  89. icon: '../../static/home-icon-02.png',
  90. text: '业务录入',
  91. url: '/pages/business-entering/business-entering',
  92. show: uni.getStorageSync('perList').indexOf('tb-business-add') !== -1
  93. },
  94. {
  95. auth: true,
  96. icon: '../../static/home-icon-03.png',
  97. text: '业务订单',
  98. url: '/pages/business-order/business-order',
  99. show: true
  100. },
  101. {
  102. auth: true,
  103. icon: '../../static/home-icon-04.png',
  104. text: '企业管理',
  105. url: '/pages/customer-management/customer-list',
  106. show: true
  107. },
  108. {
  109. auth: true,
  110. icon: '../../static/home-icon-05.png',
  111. text: '出入记录',
  112. url: '/pages/inout-record/inout-record',
  113. show: true
  114. },
  115. // {
  116. // auth: true,
  117. // icon: '../../static/home-icon-06.jpg',
  118. // text: '账户充值',
  119. // url: '/pages/account/index',
  120. // show:true
  121. // },
  122. ]
  123. },
  124. toAccount() {
  125. if (this.customerId !== '1') {
  126. this.$common.to('/pages/account/account-redirect')
  127. }
  128. },
  129. getStoreInfo() {
  130. let info = uni.getStorageSync('info');
  131. if (info) {
  132. this.isLogin = true;
  133. this.userName = info.name;
  134. this.customerId = info.customerId;
  135. }
  136. },
  137. toLogin() {
  138. this.$common.to('/pages/login/login')
  139. },
  140. exitFn() {
  141. uni.removeStorageSync('token')
  142. uni.removeStorageSync('info')
  143. this.isLogin = false;
  144. this.setList();
  145. },
  146. navTo(item) {
  147. let auth = item.auth;
  148. let token = uni.getStorageSync('token');
  149. if (!auth || token) {
  150. this.$common.to(item.url)
  151. } else {
  152. this.$common.to('/pages/login/login')
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss">
  159. page {
  160. background-color: #fff;
  161. }
  162. .top-nav {
  163. position: fixed;
  164. top: 0;
  165. left: 0;
  166. right: 0;
  167. z-index: 999;
  168. display: flex;
  169. align-items: center;
  170. justify-content: space-between;
  171. padding: 20rpx 0;
  172. background-color: #0080ff;
  173. .l {
  174. display: flex;
  175. align-items: center;
  176. .login-btn {
  177. border: 1rpx solid #359aff;
  178. border-radius: 8rpx;
  179. color: #fff;
  180. padding: 10rpx 20rpx;
  181. font-size: 28rpx;
  182. margin-left: 30rpx;
  183. }
  184. .user-img {
  185. width: 80rpx;
  186. height: 80rpx;
  187. border-radius: 50%;
  188. margin-left: 30rpx;
  189. margin: 20rpx;
  190. }
  191. .l-r {
  192. display: flex;
  193. flex-direction: column;
  194. .u-name {
  195. font-size: 30rpx;
  196. color: #fff;
  197. font-weight: bold;
  198. }
  199. .c-name {
  200. font-size: 24rpx;
  201. color: #fff;
  202. }
  203. }
  204. }
  205. .r {
  206. display: flex;
  207. align-items: center;
  208. .l-out {
  209. border: 1rpx solid #359aff;
  210. border-radius: 8rpx;
  211. color: #c8e4ff;
  212. padding: 10rpx 20rpx;
  213. font-size: 28rpx;
  214. margin-right: 30rpx;
  215. }
  216. }
  217. }
  218. .top-bg {
  219. position: relative;
  220. top: 0;
  221. left: 0;
  222. right: 0;
  223. height: 400rpx;
  224. background-color: #0080ff;
  225. border-radius: 0 0 20rpx 20rpx;
  226. }
  227. .top {
  228. display: flex;
  229. width: 100%;
  230. align-items: center;
  231. justify-content: center;
  232. margin: 60rpx 0;
  233. margin-top: -400rpx;
  234. position: relative;
  235. z-index: 2;
  236. .title {
  237. font-size: 50rpx;
  238. font-weight: bold;
  239. color: #fff;
  240. }
  241. }
  242. .item-box {
  243. display: flex;
  244. flex-wrap: wrap;
  245. align-content: flex-start;
  246. padding: 40rpx;
  247. box-sizing: border-box;
  248. background-color: #fff;
  249. margin: 0 30rpx;
  250. border-radius: 20rpx;
  251. position: relative;
  252. z-index: 2;
  253. //height: calc(100vh - 170rpx - 500rpx);
  254. box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.03);
  255. .item {
  256. width: 33.333%;
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. justify-content: center;
  261. padding: 40rpx 0;
  262. .icon {
  263. width: 90rpx;
  264. height: 90rpx;
  265. }
  266. .text {
  267. font-size: 28rpx;
  268. color: #191919;
  269. margin-top: 20rpx;
  270. }
  271. }
  272. }
  273. .qrcode {
  274. display: flex;
  275. width: 100%;
  276. flex-direction: column;
  277. align-items: center;
  278. justify-content: center;
  279. margin: 30rpx 0;
  280. .qrcode {
  281. width: 350rpx;
  282. height: 350rpx;
  283. border: 1px solid #191919;
  284. }
  285. .text {
  286. color: #191919;
  287. font-size: 28rpx;
  288. margin-top: 5rpx;
  289. }
  290. }
  291. </style>