index.vue 5.1 KB

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