xunji-rili-tianjia-moban.vue 3.38 KB
<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