hookehuyr

新增物资情况列表页面

1 /* 1 /*
2 * @Date: 2023-09-01 10:29:30 2 * @Date: 2023-09-01 10:29:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-07-23 10:34:10 4 + * @LastEditTime: 2024-07-23 10:50:32
5 * @FilePath: /temple_material_request/src/route.js 5 * @FilePath: /temple_material_request/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 export default [{ 8 export default [{
9 - path: '/', 9 + path: '/material_list',
10 - component: () => import('@/views/index.vue'), 10 + component: () => import('@/views/material_list.vue'),
11 meta: { 11 meta: {
12 - title: '首页', 12 + title: '物资情况',
13 } 13 }
14 }, { 14 }, {
15 path: '/auth', 15 path: '/auth',
......
1 <!-- 1 <!--
2 * @Date: 2024-07-23 10:34:37 2 * @Date: 2024-07-23 10:34:37
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-07-23 10:34:49 4 + * @LastEditTime: 2024-07-23 10:46:40
5 * @FilePath: /temple_material_request/src/views/index.vue 5 * @FilePath: /temple_material_request/src/views/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
......
1 +<!--
2 + * @Date: 2024-07-23 10:50:38
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2024-07-23 11:34:47
5 + * @FilePath: /temple_material_request/src/views/material_list.vue
6 + * @Description: 文件描述
7 +-->
8 +<template>
9 + <div class="material-list-page">
10 + <van-tabs v-model:active="active" @change="onChange" sticky :color="styleColor.baseColor">
11 + <van-tab v-for="index in 8" :title="'标签 ' + index">
12 + <van-list
13 + v-model:loading="loading"
14 + :finished="finished"
15 + finished-text="没有更多了"
16 + @load="onLoad"
17 + >
18 + <div v-for="item in list" :key="item" class="material-list-item">
19 + <van-row>
20 + <van-col span="14">
21 + <div class="item-title van-ellipsis" :style="{ color: styleColor.baseColor }" @click="onClickTitle(item)">床垫 1.2m*2m</div>
22 + <div class="item-attr">申领人:醒莲 2024/05/23使用 </div>
23 + </van-col>
24 + <van-col span="5">
25 + <div class="item-num-title">申请数量</div>
26 + <div class="item-num van-ellipsis">200个</div>
27 + </van-col>
28 + <van-col span="5">
29 + <div class="item-num-title">实际领用</div>
30 + <div class="item-num van-ellipsis">200个</div>
31 + </van-col>
32 + </van-row>
33 + </div>
34 + </van-list>
35 + </van-tab>
36 + </van-tabs>
37 + <div style="height: 4rem;"></div>
38 + <div style="position: fixed; left: 0; right: 0; bottom: 0; padding: 1rem; background-color: white;">
39 + <van-button @click="onClickRequest" type="primary" block :color="styleColor.baseColor">我要申领</van-button>
40 + </div>
41 + </div>
42 +</template>
43 +
44 +<script setup>
45 +import { ref } from 'vue'
46 +import { useRoute, useRouter } from 'vue-router'
47 +
48 +import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
49 +//import { } from '@/utils/generateModules.js'
50 +//import { } from '@/utils/generateIcons.js'
51 +//import { } from '@/composables'
52 +import { styleColor } from "@/constant.js";
53 +
54 +const $route = useRoute();
55 +const $router = useRouter();
56 +useTitle($route.meta.title);
57 +
58 +const active = ref(0);
59 +const onChange = (index) => {
60 + console.warn(index);
61 +}
62 +
63 +const list = ref([]);
64 +const loading = ref(false);
65 +const finished = ref(false);
66 +
67 +const onLoad = () => {
68 + // 异步更新数据
69 + // setTimeout 仅做示例,真实场景中一般为 ajax 请求
70 + setTimeout(() => {
71 + for (let i = 0; i < 10; i++) {
72 + list.value.push(list.value.length + 1);
73 + }
74 +
75 + // 加载状态结束
76 + loading.value = false;
77 +
78 + // 数据全部加载完成
79 + if (list.value.length >= 40) {
80 + finished.value = true;
81 + }
82 + }, 1000);
83 +};
84 +
85 +const onClickTitle = (item) => { // 点击物资标题回调
86 + console.warn(item);
87 +}
88 +
89 +const onClickRequest = () => { // 我要申领物资
90 +
91 +}
92 +</script>
93 +
94 +<style lang="less" scoped>
95 +.material-list-page {
96 + position: relative;
97 + .material-list-item {
98 + padding: 1rem;
99 + border-top: 1px solid #F5F5F5;
100 + .item-title {
101 + font-size: 1rem;
102 + text-decoration: underline;
103 + margin-bottom: 0.5rem;
104 + }
105 + .item-attr {
106 + font-size: 0.85rem;
107 + color: #8F8F8F;
108 + }
109 + .item-num-title {
110 + font-size: 0.85rem;
111 + color: #8F8F8F;
112 + text-align: center;
113 + margin-bottom: 0.5rem;
114 + }
115 + .item-num {
116 + font-size: 1rem;
117 + text-align: center;
118 + }
119 + }
120 +}
121 +</style>