index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <scroll-view class="bg-white scroll-height" :scroll-y="true" :data-theme="'theme-' + proxy.$settingStore.themeColor.type">
  3. <u-grid :border="true">
  4. <u-grid-item v-for="(base, index) in dataList" :key="index" @click="handleToDevice(base.id, base.productName)">
  5. <u-badge type="primary" max="9999" :value="base.deviceCount" :showZero="true" :absolute="true" :offset="[10, 10, 0, 0]"></u-badge>
  6. <image class="margin-b-15" style="width: 40px; height: 40px; margin-top: 35px" :src="base.imagePath" mode="aspectFill"></image>
  7. <text class="margin-b-15 grid-text">{{ base.productName }}</text>
  8. </u-grid-item>
  9. </u-grid>
  10. <!-- <uni-pagination class="app-pagination bg-white" :current="current" :total="total" :pageSize="pageSize" prev-text="前一页" next-text="后一页" @change="paginationChange" /> -->
  11. </scroll-view>
  12. </template>
  13. <script setup>
  14. import { onReady, onLoad, onShow, onNavigationBarButtonTap, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
  15. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
  16. import { useStores, publicStores } from "@/store/modules/index";
  17. import { dmpProductInfo } from "@/api/business/fireIot/deviceSelect/index";
  18. const { proxy } = getCurrentInstance();
  19. const dataList = ref([]);
  20. const pageSize = ref(1000);
  21. const current = ref(1);
  22. const total = ref(0);
  23. /**
  24. * @页面初始化
  25. */
  26. function init() {
  27. dmpProductInfo({ productName: "", current: current.value, size: pageSize.value }).then((requset) => {
  28. if (requset.status === "SUCCESS") {
  29. requset.data.records.forEach((el) => {
  30. if ("imagePath" in el == false) {
  31. el.imagePath = "/static/images/404.png";
  32. }
  33. if (el.deviceCount == null) {
  34. el.deviceCount = 0;
  35. }
  36. });
  37. dataList.value = requset.data.records;
  38. total.value = requset.data.total;
  39. }
  40. });
  41. }
  42. function handleToDevice(id, productName) {
  43. proxy.$tab.navigateTo(`/pages/business/fireIot/deviceSelect/components/deviceDetailsList?id=${id}&productName=${productName}`);
  44. }
  45. onShow(() => {
  46. //调用系统主题颜色
  47. proxy.$settingStore.systemThemeColor([1]);
  48. init();
  49. });
  50. </script>