index.vue 5.4 KB

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