index.vue 5.4 KB

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