index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="warp">
  3. <uni-grid class="grid" :column="3" :show-border="false" :square="false" @change="change">
  4. <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
  5. <view class="grid-item-box" @click="itemClick(item.url)">
  6. <image class="image" :src="item.src" mode="aspectFill" />
  7. <text class="text">{{ item.text }}</text>
  8. </view>
  9. </uni-grid-item>
  10. </uni-grid>
  11. </view>
  12. </template>
  13. <script setup lang="ts">
  14. import { ref } from 'vue';
  15. import { onShow } from '@dcloudio/uni-app';
  16. const token = ref(null);
  17. const user = ref(null);
  18. const list = ref([
  19. // {
  20. // url: '/pages/scan/index',
  21. // src: '/static/scan_fill.png',
  22. // text: '扫描入库'
  23. // },
  24. {
  25. url: '/pages/instock/index',
  26. src: '/static/weigh_fill.png',
  27. text: '称重'
  28. },
  29. {
  30. url: '/pages/warehouseScan/index',
  31. src: '/static/houscan.png',
  32. text: '仓库扫描'
  33. },
  34. {
  35. url: '/pages/scanLotno/index',
  36. src: '/static/link.png',
  37. text: '托盘/批次'
  38. },
  39. {
  40. url: '/pages/waybillNo/index',
  41. src: '/static/link.png',
  42. text: '库位绑定'
  43. },
  44. {
  45. url:'/pages/waybillDeliveryOrder/index',
  46. src: '/static/dispatch.png',
  47. text: '派送单'
  48. }
  49. ]);
  50. onShow(() => {
  51. token.value = uni.getStorageSync('token');
  52. user.value = uni.getStorageSync('user');
  53. console.log('show---', { token: token.value, user: user.value });
  54. });
  55. const itemClick = (url) => {
  56. console.log(url);
  57. if (token.value) {
  58. uni.navigateTo({
  59. url
  60. });
  61. } else {
  62. uni.navigateTo({
  63. url: '/pages/login/index'
  64. });
  65. }
  66. };
  67. const change = () => {};
  68. const logout = () => {
  69. uni.removeStorageSync('token');
  70. uni.removeStorageSync('user');
  71. token.value = uni.getStorageSync('token');
  72. user.value = uni.getStorageSync('user');
  73. };
  74. </script>
  75. <style lang="scss">
  76. .image {
  77. width: 36px;
  78. height: 36px;
  79. }
  80. .text {
  81. font-size: 14px;
  82. margin-top: 10px;
  83. }
  84. .grid {
  85. margin-top: 20px;
  86. }
  87. .grid-item-box {
  88. flex: 1;
  89. // position: relative;
  90. /* #ifndef APP-NVUE */
  91. display: flex;
  92. /* #endif */
  93. flex-direction: column;
  94. align-items: center;
  95. justify-content: center;
  96. padding: 15px 0;
  97. }
  98. .grid-dot {
  99. position: absolute;
  100. top: 5px;
  101. right: 15px;
  102. }
  103. </style>