xunji-rili-tianjia-moban.vue
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<template>
<view class="template-select-page">
<!-- 导航栏 -->
<view class="nav-bar">
<navigator url="/pages4/pages/xunji/xunji-rili-tianjia" open-type="navigate" class="back-btn">
<uni-icons class="back-arrow" type="left" size="26" color="black"></uni-icons>
</navigator>
<text class="page-title">选择模板</text>
</view>
<!-- 标签页 -->
<view class="tab-bar">
<view class="tab-item active">官方</view>
<view class="tab-item">我的</view>
<view class="tab-item">部位▼</view>
<view class="tab-item">场景▼</view>
</view>
<!-- 模板列表 -->
<scroll-view scroll-y="true" class="template-list">
<view v-for="(item, index) in templateList" :key="index" class="template-item">
<image class="template-img"
src="https://fitness-hcxtec-bucket.oss-cn-shenzhen.aliyuncs.com/20260316/order-empty_1773628059920.png"
mode="aspectFill"></image>
<view class="template-content">
<text class="template-title">{{ item.name }}</text>
<text class="template-count">{{ item.templatesCount }}个模板</text>
<text class="template-desc">{{ item.description }}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { onMounted, ref } from 'vue';
import TemplatesApi from '@/sheep/api/Template/Templates';
// 获取模板列表
const templateList = ref([]);
const TemplatesList = async () => {
try {
const response = await TemplatesApi.getTemplates();
templateList.value = response.data;
} catch (error) {
console.log('模板大类获取失败', error);
}
};
onMounted(() => {
TemplatesList();
});
</script>
<style scoped>
.template-select-page {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #f8f9fa;
}
/* 导航栏 */
.nav-bar {
margin-top: 30rpx;
display: flex;
align-items: center;
padding: 30rpx 30rpx 30rpx 30rpx;
position: relative;
background-color: #fff;
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.1);
}
.back-btn {
position: absolute;
left: 30rpx;
top: 30rpx;
z-index: 10;
}
.back-arrow {
font-size: 40rpx;
color: #333;
}
.page-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
flex: 1;
}
/* 标签页 */
.tab-bar {
display: flex;
padding: 20rpx 30rpx;
background-color: #fff;
border-bottom: 1rpx solid #e5e5e5;
}
.tab-item {
padding: 10rpx 20rpx;
border: 1rpx solid #ddd;
border-radius: 16rpx;
margin-right: 20rpx;
font-size: 28rpx;
color: #666;
line-height: 1;
}
.tab-item.active {
border-color: #000;
color: #000;
font-weight: bold;
}
/* 模板列表 */
.template-list {
flex: 1;
padding: 20rpx 30rpx;
background-color: #f8f9fa;
}
.template-item {
display: flex;
margin-bottom: 30rpx;
background-color: #fff;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.template-img {
width: 160rpx;
height: 160rpx;
border-radius: 16rpx;
}
.template-content {
flex: 1;
padding: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.template-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.template-count {
font-size: 24rpx;
color: #999;
margin-bottom: 10rpx;
}
.template-desc {
font-size: 26rpx;
color: #666;
line-height: 1.5;
}
</style>s