index.vue 5.6 KB

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