Skip to content

Commit 9aecb32

Browse files
committed
feat: 静态页面-完成
1 parent 69e309c commit 9aecb32

File tree

14 files changed

+597
-104
lines changed

14 files changed

+597
-104
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gf-bank",
3-
"homepage": "https://yulimchen.github.io/vue3-h5-template/",
3+
"homepage": "",
44
"version": "0.5.8",
55
"license": "MIT",
66
"repository": {

src/App.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
<router-view />
33
</template>
44

5-
<style></style>
5+
<style lang="less">
6+
.van-toast {
7+
--van-toast-default-width: 70%;
8+
--van-toast-font-size: 28px;
9+
}
10+
</style>

src/components/Tabbar/index.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ const active = ref(0);
1818
const tabbarData = reactive([
1919
{
2020
icon: "wap-home-o",
21-
title: "主页",
21+
title: "数据",
2222
to: {
2323
name: "Demo"
2424
}
2525
},
2626
{
27-
icon: "gem-o",
28-
title: "工具",
27+
icon: "manager-o",
28+
title: "客户",
2929
to: {
30-
name: "Tools"
30+
name: "CustomerList"
3131
}
3232
},
33-
{
34-
icon: "user-o",
35-
title: "关于",
36-
to: {
37-
name: "About"
38-
}
39-
}
4033
]);
4134
</script>
35+
<style lang="less">
36+
.van-tabbar__placeholder {
37+
--van-tabbar-height: 120px;
38+
--van-tabbar-item-font-size: 26px;
39+
--van-tabbar-item-icon-size: 52px;
40+
--van-tabbar-item-text-color: #333333;
41+
--van-tabbar-item-active-color: #e81414;
42+
}
43+
</style>

src/layout/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import tabbar from "@/components/Tabbar/index.vue";
3-
import NavBar from "@/components/NavBar/index.vue";
3+
// import NavBar from "@/components/NavBar/index.vue";
44
import { useCachedViewStoreHook } from "@/store/modules/cachedView";
55
import { useDarkMode } from "@/hooks/useToggleDarkMode";
66
import { computed } from "vue";
@@ -13,7 +13,7 @@ const cachedViews = computed(() => {
1313
<template>
1414
<div class="app-wrapper">
1515
<van-config-provider :theme="useDarkMode() ? 'dark' : 'light'">
16-
<!-- <nav-bar />-->
16+
<!-- <nav-bar />-->
1717
<router-view v-slot="{ Component }">
1818
<keep-alive :include="cachedViews">
1919
<component :is="Component" />
@@ -32,5 +32,6 @@ const cachedViews = computed(() => {
3232
position: relative;
3333
height: 100%;
3434
width: 100%;
35+
color: #9aa0a8;
3536
}
3637
</style>

src/router/routes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ const routes: Array<RouteRecordRaw> = [
1919
}
2020
},
2121
{
22-
path: "/tools",
23-
name: "Tools",
24-
component: () => import("@/views/tools/index.vue"),
22+
path: "/customerList",
23+
name: "CustomerList",
24+
component: () => import("@/views/customerList/index.vue"),
2525
meta: {
26-
title: "工具",
27-
requireAuth: true
26+
title: "客户",
27+
requireAuth: false
2828
}
2929
},
3030
{

src/utils/utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ export function isUsercaptchaValue(value) {
2727
}
2828
}
2929

30+
// 手机号码验证
31+
export function isNameValid(name) {
32+
const regExp = /^[\u4e00-\u9fa5·\s]{2,20}$/;
33+
if (!name) {
34+
showToast("请输入名字!");
35+
return false;
36+
} else if (!regExp.test(name)) {
37+
showToast("请输入正确的名字!");
38+
return false;
39+
} else {
40+
return true;
41+
}
42+
}
43+
3044
// 手机号码验证
3145
export function isPhoneNumberValid(phoneNumber) {
3246
const regExp =
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<template>
2+
<div class="my-[30px] box-border">
3+
<div class="w-full">
4+
<!-- 表格头部 -->
5+
<div>
6+
<div
7+
class="px-[20px] py-[10px] text-[26px] text-[#333333] flex justify-between"
8+
>
9+
<div class="w-[10%] text-left">姓名</div>
10+
<div class="w-[25%] text-center">手机号</div>
11+
<div class="w-[20%] text-center">领券状态</div>
12+
<div class="w-[20%] text-center">金额(元)</div>
13+
<div class="w-[25%] text-right">领券时间</div>
14+
</div>
15+
</div>
16+
<!-- 表格内容 -->
17+
<div
18+
v-for="(item, index) in currentPageData"
19+
:key="index"
20+
class="my-[10px] py-[10px] px-[20px] bg-[#f2f2f2] flex justify-between overflow-hidden border-[2px] border-[#e0e0e0] border-solid rounded-[10px] text-[#333333]"
21+
>
22+
<div class="w-[10%] text-left">{{ item.name }}</div>
23+
<div class="w-[25%] text-center">{{ item.phone }}</div>
24+
<div class="w-[20%] text-center text-[#ff4343]">
25+
{{ item.couponStatus === 1 ? "未领取" : "已领取" }}
26+
</div>
27+
<div class="w-[20%] text-center">{{ item.amount }}</div>
28+
<div class="w-[25%] text-right">{{ item.couponTime }}</div>
29+
</div>
30+
</div>
31+
<!-- 分页控件 -->
32+
<div class="flex my-[30px] justify-end">
33+
<button
34+
class="mx-[10px] py-[4px] px-[16px] bg-[#e1eaff] border-2 border-[#ff4343] border-solid rounded-[10px]"
35+
@click="prevPage"
36+
:disabled="currentPage === 1"
37+
>
38+
上一页
39+
</button>
40+
<button
41+
class="mx-[10px] py-[4px] px-[16px] bg-[#e1eaff] border-2 border-[#ff4343] border-solid rounded-[10px]"
42+
@click="nextPage"
43+
:disabled="currentPage === totalPages"
44+
>
45+
下一页
46+
</button>
47+
<!-- <span>当前页:{{ currentPage }} / 总页数:{{ totalPages }}</span>-->
48+
</div>
49+
</div>
50+
</template>
51+
52+
<script setup lang="ts">
53+
import { ref, toRef, computed, defineProps } from "vue";
54+
55+
const props = defineProps<{
56+
allData: any;
57+
}>();
58+
59+
const listData = toRef(props, "allData");
60+
61+
const pageSize = ref(10); // 每页显示的数据条数
62+
const currentPage = ref(1); // 当前页码
63+
64+
// 计算当前页的数据
65+
const currentPageData = computed(() => {
66+
const start = (currentPage.value - 1) * pageSize.value;
67+
const end = start + pageSize.value;
68+
return listData.value.slice(start, end);
69+
});
70+
71+
// 计算总页数
72+
const totalPages = computed(() => {
73+
return Math.ceil(listData.value.length / pageSize.value);
74+
});
75+
76+
// 上一页
77+
function prevPage() {
78+
if (currentPage.value > 1) {
79+
currentPage.value--;
80+
}
81+
}
82+
83+
// 下一页
84+
function nextPage() {
85+
if (currentPage.value < totalPages.value) {
86+
currentPage.value++;
87+
}
88+
}
89+
</script>
90+
<style scoped>
91+
/* 样式 */
92+
</style>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<template>
2+
<div class="pet-select-container">
3+
<select
4+
name="pets"
5+
id="pet-select"
6+
v-model="selectedPet"
7+
@change="handlePetChange"
8+
>
9+
<option value="">-- 领取状态 --</option>
10+
<option v-for="pet in pets" :key="pet.value" :value="pet.value">
11+
{{ pet.label }}
12+
</option>
13+
</select>
14+
</div>
15+
</template>
16+
17+
<script setup>
18+
import { ref, defineProps, defineEmits } from "vue";
19+
20+
// 定义 props
21+
const props = defineProps({
22+
// 假设父组件可以传入初始选中的宠物值
23+
initialPet: {
24+
type: String,
25+
default: ""
26+
}
27+
});
28+
29+
// 定义 emit 事件
30+
const emit = defineEmits(["handleSelected"]);
31+
32+
// 响应式数据
33+
const selectedPet = ref(props.initialPet);
34+
const pets = ref([
35+
{ value: "2", label: "已领取" },
36+
{ value: "1", label: "未领取" }
37+
]);
38+
39+
// 监听选中值的变化
40+
// watch(selectedPet, (newVal, oldVal) => {
41+
// if (newVal !== oldVal) {
42+
// emit("handleSelected", newVal);
43+
// }
44+
// });
45+
46+
// 处理宠物改变的方法
47+
function handlePetChange() {
48+
// 在这里可以添加额外的逻辑
49+
emit("handleSelected", selectedPet.value);
50+
}
51+
</script>
52+
53+
<style scoped>
54+
select {
55+
width: 100%;
56+
padding: 16px 10px;
57+
border: 2px solid #ccc;
58+
border-radius: 10px;
59+
font-size: 26px;
60+
color: #333333;
61+
box-sizing: border-box;
62+
}
63+
</style>

0 commit comments

Comments
 (0)