index.vue 5.4 KB

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