index.vue 2.4 KB

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