Files
sweekar-app/pages/index/index.vue
T
2026-01-08 11:07:35 +08:00

151 lines
4.3 KiB
Vue

<script setup>
import { ref, onMounted, getCurrentInstance, nextTick } from 'vue';
import { onLoad, onShow, onReady, onHide, onPullDownRefresh } from '@dcloudio/uni-app';
import CustomTabBar from '@/components/CustomTabBar.vue'
import { getSystemSafeArea, getSystemInfo, isEmpty, showToast, showLoadingToast, closeToast } from '@/common/common.js';
import LoginPopup from '@/components/login-popup.vue';
import { getProducts } from './api.js';
import { useUserStore } from '@/store/user.js';
import { useI18n } from 'vue-i18n';
const { t, locale } = useI18n();
const props = defineProps(['status']);
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const tabList = ref([]); //tab列表
const tabsIndex = ref(0); //当前选中的tab索引
// const modelTypeList = ref([]);
const tabsLeft = ref(0); //下划线移动的距离
const finished = ref(false); //数据是否全部加载完成
const windowWidth = ref(0); //tab元素的宽度
const orderRows = ref([]); //订单列表
const showLogin = ref(false); //显示登录
const triggered = ref(false); //是否下拉刷新状态,true为是
const loading = ref(false); // 添加loading状态
const productData = ref();
const scrollHeight = ref(0); //scroll-view滚动高度
const pageView = ref({});
/**
* @desc 获取可视内容高度
*/
const getContentHeight = (e) => {
pageView.value = e;
};
/**
* @desc 跳转至详情页面
*/
const toDetailPage = (productId) => {
uni.navigateTo({
url: '/pages/product/detail',
});
};
//获取首页数据
const getProductList = async()=>{
const res = await getProducts();
productData.value=res.data;
console.log("商品数据",productData.value);
}
onLoad(()=>{
// getProductList();
});
// 模拟数据
/**
* @desc 处理预订事件
*/
const handleBook = (productId) => {
// 这里可以添加预订逻辑,比如跳转到详情页
uni.navigateTo({
url: `/pages/product/detail?id=${productId}`,
});
};
</script>
<template>
<view class="h-[100vh] bg-[#fff] flex flex-col mx-[30rpx] items-center">
<!-- title -->
<view class="bg-[#fff] flex justify-between items-center w-full">
<view class="w-full flex items-center gap-[10px]">
<text class="text-[#33333] text-[20px] font-bold" >Sweekar Alpha</text>
<u-icon name="level" color="#fff" class="bg-theme border-round-theme rounded-full"></u-icon>
</view>
<view class="w-[80px] border-round-theme border-[2px] rounded-full flex justify-center py-[6px] shadow-[4px_4px_1px_0_rgba(0,0,0,1)]">
<u-icon name="level"></u-icon>
<text>1205</text>
</view>
</view>
<!-- row2 -->
<view class="flex justify-between items-center mt-[15px] w-full">
<!-- 状态 -->
<view class=" bg-[#fff] border-solid border py-[6px] px-[10px] rounded-full flex items-center gap-[10px] shadow-[4px_4px_1px_0_rgba(0,0,0,1)]">
<view class="border-bottom-theme rounded-full flex justify-center items-center h-[40px] w-[40px] bg-theme">
<text class="text-[#fff]">5</text>
</view>
<view class="flex flex-col">
<text class="text-[13px]">STAGE</text>
<text class="text-[16px] font-bold">CHILDHOOD</text>
</view>
</view>
<!-- 日期 -->
<view class="border border-solid border-[#cdcdcd] bg-[#fff] py-[2px] px-[4px] gap-[6px] flex">
<u-icon name="clock"></u-icon>
<text>42</text>
<text>DAYS</text>
</view>
</view>
<!-- EXP -->
<view class="flex gap-[10px] mt-[15px] w-full ">
<text class="text-[12px]">EXP</text>
<view class="w-[150px]">
<uv-line-progress :percentage="60" activeColor="#333333" :showText="false" class="border-round-theme"></uv-line-progress>
</view>
</view>
<!-- MODEL X -->
<view class="border border-solid border-[#cdcdcd] rounded-full h-[280px] w-[280px] mt-[100px] p-[20px] flex justify-center items-center">
<!-- 中心圆圈 -->
<view class="border-[4px] border-solid border-theme rounded-full h-[220px] w-[220px] p-[20px] flex justify-center items-center">
<view class="flex flex-col justify-center items-center">
<u-icon name="star" size="80"></u-icon>
<text>MODEL X</text>
</view>
</view>
<!-- 交流栏 -->
<!-- <view class="w-[150px] h-[80px] border-[4px]" >
</view> -->
</view>
<CustomTabBar />
</view>
</template>
<style>
</style>