Refactor API requests and update component imports

This commit is contained in:
wangqiao
2025-08-18 14:28:10 +08:00
parent 07b4d3de99
commit 9ae3abeded
91 changed files with 669 additions and 884 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="flex">
<div>
<div class="my-32px mb-20px text-18px text-[#333333] font-normal"><img src="@/assets/images/2.png" alt="" srcset="" /> 多多排行榜</div>
<div class="my-32px mb-20px text-18px text-[#333333] font-normal"><img src="~/assets/images/2.png" alt="" srcset="" /> 多多排行榜</div>
<div class="flex">
<div class="ma-auto box-border h-470px w-460px border border-[#EEEEEE] rounded-12px border-solid bg-[#FFFFFF] px-28px">
<div class="title-bg ma-auto mb-40px mt-20px">一周图纸作者排行</div>
@ -22,12 +22,12 @@
</div>
<div class="ml-20px flex text-14px text-[#666666] font-normal">
<!-- <el-icon class="text-17px color-#a8abb2!"><Folder /></el-icon> -->
<img src="@/assets/images/file.png" alt="" srcset="" class="h-18px" />
<img src="~/assets/images/file.png" alt="" srcset="" class="h-18px" />
<div class="ellipsis1 ml-10px">作品{{ item.projectCount || 0 }}</div>
</div>
<div class="ml-20px flex text-14px text-[#666666] font-normal">
<!-- <el-icon class="text-17px color-[#e4e7ed!]"><User /></el-icon> -->
<img src="@/assets/images/user4.png" alt="" srcset="" class="h-17px" />
<img src="~/assets/images/user4.png" alt="" srcset="" class="h-17px" />
<div class="ellipsis1 ml-10px">粉丝{{ item.fansCount || 0 }}</div>
</div>
</div>
@ -52,11 +52,11 @@
<span class="ellipsis1 ml-10px">{{ item.nickname }}</span>
</div>
<div class="ml-20px flex text-14px text-[#666666] font-normal">
<img src="@/assets/images/file.png" alt="" srcset="" class="h-18px" />
<img src="~/assets/images/file.png" alt="" srcset="" class="h-18px" />
<div class="ellipsis1 ml-10px">作品{{ item.projectCount || 0 }}</div>
</div>
<div class="ml-20px flex text-14px text-[#666666] font-normal">
<img src="@/assets/images/user4.png" alt="" srcset="" class="h-17px" />
<img src="~/assets/images/user4.png" alt="" srcset="" class="h-17px" />
<div class="ellipsis1 ml-10px">粉丝{{ item.fansCount || 0 }}</div>
</div>
</div>
@ -66,7 +66,7 @@
</div>
</div>
<div class="ml-63px">
<div class="my-32px mb-20px text-18px text-[#333333] font-normal"><img src="@/assets/images/2.png" alt="" srcset="" /> 发布动态</div>
<div class="my-32px mb-20px text-18px text-[#333333] font-normal"><img src="~/assets/images/2.png" alt="" srcset="" /> 发布动态</div>
<div class="box-border h-470px w-437px border border-[#EEEEEE] rounded-12px border-solid bg-[#FFFFFF] p-15px">
<div
v-for="item in newDrawList"
@ -87,11 +87,11 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
// import { Folder, User } from '@element-plus/icons-vue'
import { newDraw, userTop } from '@/api/home/index'
import { ProjectDrawPageRespVO, ProjectTrendingScoreUserInfoVO } from '@/api/home/type'
import { newDraw, userTop } from '~/api/home/index'
import type { ProjectDrawPageRespVO, ProjectTrendingScoreUserInfoVO } from '~/api/home/type'
import dayjs from 'dayjs'
const Url = Object.values(
import.meta.glob('@/assets/images/no*.png', {
import.meta.glob('~/assets/images/no*.png', {
eager: true,
query: 'url',
})
@ -133,7 +133,7 @@
.title-bg {
width: 224px;
height: 52px;
background-image: url('@/assets/images/name_bg.png');
background-image: url('~/assets/images/name_bg.png');
background-size: 100% 100%;
text-align: center;
line-height: 48px;

View File

@ -23,8 +23,8 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { getSettingPage } from '@/api/home/index'
import { PageResultIndexSettingRespVO } from '@/api/home/type'
import { getSettingPage } from '~/api/home/index'
import type { PageResultIndexSettingRespVO } from '~/api/home/type'
const pageReq = reactive({
type: 2,
@ -41,7 +41,7 @@
getBanner()
const handleClick = (url: string) => {
window.open(url, '_blank')
navigateTo(url)
}
</script>

View File

@ -11,29 +11,29 @@
@click="handleUserInfo"
/>
<div class="mt-10px text-16px text-[#333333] font-normal">
<img v-if="userStore.userInfoRes.vipLevel === 1" src="@/assets/svg/vip.svg" alt="" class="relative top-12px" />
<img v-if="userStore.userInfoRes.vipLevel === 2" src="@/assets/svg/svip.svg" alt="" class="relative top-12px" />
<img v-if="userStore.userInfoRes.vipLevel === 1" src="~/assets/svg/vip.svg" alt="" class="relative top-12px" />
<img v-if="userStore.userInfoRes.vipLevel === 2" src="~/assets/svg/svip.svg" alt="" class="relative top-12px" />
Hi{{ userStore.userInfoRes.nickname || '欢迎访问~' }}
</div>
</div>
<div v-if="isLogin" class="mt-20px flex flex-col gap-20px px-20px text-14px text-[#333333] font-normal">
<div class="flex items-center justify-between">
<div class="flex items-center">
<img src="@/assets/images/cad_0 (1).png" alt="" srcset="" />
<img src="~/assets/images/cad_0 (1).png" alt="" srcset="" />
<span class="title ml-4px" :title="`${userStaticInfo?.pointCount}`">我的积分: {{ userStaticInfo?.pointCount || 0 }}</span>
</div>
<div class="flex items-center">
<img src="@/assets/images/cad_0 (2).png" alt="" srcset="" />
<img src="~/assets/images/cad_0 (2).png" alt="" srcset="" />
<span class="title ml-4px" :title="`${userStaticInfo?.followCount}`">我的收藏: {{ userStaticInfo?.followCount || 0 }}</span>
</div>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center">
<img src="@/assets/images/cad_0 (3).png" alt="" srcset="" />
<img src="~/assets/images/cad_0 (3).png" alt="" srcset="" />
<span class="title ml-4px" :title="`${userStaticInfo?.projectCount}`">我的发布: {{ userStaticInfo?.projectCount || 0 }}</span>
</div>
<div class="flex items-center">
<img src="@/assets/images/cad_0 (4).png" alt="" srcset="" />
<img src="~/assets/images/cad_0 (4).png" alt="" srcset="" />
<span class="title ml-4px" :title="`${userStaticInfo?.downloadCount}`">我的下载: {{ userStaticInfo?.downloadCount || 0 }}</span>
</div>
</div>
@ -63,25 +63,25 @@
>
</div>
<div v-if="!isLogin" class="mt-30px flex justify-between px-20px">
<img src="@/assets/images/qq-v2.png" alt="QQ登录" class="social-icon" @click="handleLoginQQ" />
<img src="@/assets/images/weixin-v2.png" alt="微信登录" class="social-icon" @click="handleLoginWechat" />
<img src="@/assets/images/email-v2.png" alt="邮箱登录" class="social-icon" @click="handleLoginEmail" />
<img src="@/assets/images/phone-v2.png" alt="手机登录" class="social-icon" @click="handleLoginPhone" />
<img src="~/assets/images/qq-v2.png" alt="QQ登录" class="social-icon" @click="handleLoginQQ" />
<img src="~/assets/images/weixin-v2.png" alt="微信登录" class="social-icon" @click="handleLoginWechat" />
<img src="~/assets/images/email-v2.png" alt="邮箱登录" class="social-icon" @click="handleLoginEmail" />
<img src="~/assets/images/phone-v2.png" alt="手机登录" class="social-icon" @click="handleLoginPhone" />
</div>
<div class="sign-bonus mt-18px" @click="handleSign">
<img src="@/assets/images/sign.png" alt="签到奖励" class="bonus-image" />
<img src="~/assets/images/sign.png" alt="签到奖励" class="bonus-image" />
</div>
</div>
</template>
<script setup lang="ts">
import { refreshToken as REFRESHTOKEN } from '@/utils/axios'
import { refreshToken as REFRESHTOKEN } from '~/utils/axios'
import { getCurrentInstance, computed, watchEffect, ref } from 'vue'
import { handleLoginQQ, handleLoginWechat } from '@/utils/login'
import { UserStatisticsCountRespVO } from '@/api/personal-center/types'
import { getUserStatistics } from '@/api/personal-center/index'
import useUserStore from '@/store/user'
import { handleLoginQQ, handleLoginWechat } from '~/utils/login'
import type { UserStatisticsCountRespVO } from '~/api/personal-center/types'
import { getUserStatistics } from '~/api/personal-center/index'
import useUserStore from '~/store/user'
const userStore = useUserStore()
const instance = getCurrentInstance()
@ -103,36 +103,36 @@
const handleLogin = () => {
if (instance) {
instance.appContext.config.globalProperties.$openLogin()
// instance.appContext.config.globalProperties.$openLogin()
}
}
const handleRegister = () => {
if (instance) {
instance.appContext.config.globalProperties.$openRegister()
// instance.appContext.config.globalProperties.$openRegister()
}
}
const handleLoginPhone = () => {
if (instance) {
instance.appContext.config.globalProperties.$openLogin('verify')
// instance.appContext.config.globalProperties.$openLogin('verify')
}
}
const handleLoginEmail = () => {
if (instance) {
instance.appContext.config.globalProperties.$openLoginEmail()
// instance.appContext.config.globalProperties.$openLoginEmail()
}
}
const handleUserInfo = () => {
if (!isLogin.value) return
window.open('/personal-detail', '_blank') // 修改为在新窗口打开
navigateTo('/personal-detail') // 修改为在新窗口打开
}
// 发布图纸
const handleDrawe = () => {
window.open('/upnew/drawe', '_blank') // 修改为在新窗口打开
navigateTo('/upnew/drawe') // 修改为在新窗口打开
}
// 推出登录
@ -145,7 +145,7 @@
}
const handleSign = () => {
window.open('/sign-page', '_blank') // 修改为在新窗口打开
navigateTo('/sign-page') // 修改为在新窗口打开
}
watchEffect(() => {

View File

@ -11,7 +11,7 @@
<LoginForm />
</div>
<div class="box-border h-56px w-1219px flex items-center border border-[#EEEEEE] border-solid border-t-none bg-[#FFFFFF] pl-10px line-height-46px">
<img src="@/assets/images/voice.png" alt="" srcset="" class="mr-10px h-15px w-16px" />
<img src="~/assets/images/voice.png" alt="" srcset="" class="mr-10px h-15px w-16px" />
<Vue3Marquee :duration="10" direction="normal" pause-on-hover>· 经典来袭SolidWorks装配经典案例之气动发动机 </Vue3Marquee>
</div>
</div>
@ -21,8 +21,8 @@
import { reactive, ref } from 'vue'
import LoginForm from './LoginForm.vue'
import { getSettingPage } from '@/api/home/index'
import { PageResultIndexSettingRespVO } from '@/api/home/type'
import { getSettingPage } from '~/api/home/index'
import type { PageResultIndexSettingRespVO } from '~/api/home/type'
const pageReq = reactive({
type: 1,
@ -40,7 +40,7 @@
const handleClick = (url: string) => {
if (url) {
window.open(url, '_blank')
navigateTo(url)
}
}
</script>

View File

@ -18,7 +18,7 @@
<div class="content mt-10px flex">
<!-- <div class="sider">
<div class="box-border h-100% h-55px w-221px flex items-center rounded-lg bg-[#1A65FF] pl-24px text-white">
<img src="@/assets/images/1.png" alt="" srcset="" />
<img src="~/assets/images/1.png" alt="" srcset="" />
<span class="ml-12px text-16px">全部资源分类</span>
</div>
<div class="side-menu border border-[#EEEEEE] border-solid">
@ -65,10 +65,10 @@
<script lang="ts" setup>
import { reactive, ref, watch } from 'vue'
import KlTabBar from '@/components/kl-tab-bar/index.vue'
// import KlCardDetail from '@/components/kl-card-detail/index.vue'
import { hotTop, hotTag } from '@/api/home/index'
import { ProjectDrawPageRespVO, ProjectDictNodeVO } from '@/api/home/type'
import KlTabBar from '~/components/kl-tab-bar/index.vue'
// import KlCardDetail from '~/components/kl-card-detail/index.vue'
import { hotTop, hotTag } from '~/api/home/index'
import type { ProjectDrawPageRespVO, ProjectDictNodeVO } from '~/api/home/type'
/** 请求参数 */
const query = reactive({
@ -105,7 +105,7 @@
/** 点击卡片 */
const handleCardClick = (item: ProjectDrawPageRespVO) => {
// 跳转到下载详情页 并且是单独开标签
window.open(`/down-drawe-detail?id=${item.id}`, '_blank') // 修改为在新窗口打开
navigateTo(`/down-drawe-detail?id=${item.id}`) // 修改为在新窗口打开
}
const handleClickType = (primary?: ProjectDictNodeVO, secondary?: ProjectDictNodeVO) => {
@ -118,11 +118,11 @@
level.unshift(normal)
}
if (query.type === 1) {
window.open(`/drawe?level=${JSON.stringify(level)}`)
navigateTo(`/drawe?level=${JSON.stringify(level)}`)
} else if (query.type === 2) {
window.open(`/text?level=${JSON.stringify(level)}`)
navigateTo(`/text?level=${JSON.stringify(level)}`)
} else if (query.type === 3) {
window.open(`/model?level=${JSON.stringify(level)}`)
navigateTo(`/model?level=${JSON.stringify(level)}`)
}
}

View File

@ -16,10 +16,10 @@
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue'
import KlTabBar from '@/components/kl-tab-bar/index.vue'
import CardPicture from '@/components/kl-card-picture/index.vue'
import { recommendTop } from '@/api/home/index'
import { ProjectDrawPageRespVO } from '@/api/home/type'
import KlTabBar from '~/components/kl-tab-bar/index.vue'
import CardPicture from '~/components/kl-card-picture/index.vue'
import { recommendTop } from '~/api/home/index'
import type { ProjectDrawPageRespVO } from '~/api/home/type'
const query = reactive({
type: 1,
@ -55,11 +55,11 @@
const handleClick = () => {
if (query.type === 1) {
window.open('/drawe', '_blank')
navigateTo('/drawe')
} else if (query.type === 2) {
window.open('/text', '_blank')
navigateTo('/text')
} else {
window.open('/model', '_blank')
navigateTo('/model')
}
}

View File

@ -33,8 +33,8 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import type { ComponentPublicInstance } from 'vue'
import { tab2 } from '@/api/home/index'
import { ProjectDictNodeVO } from '@/api/home/type'
import { tab2 } from '~/api/home/index'
import type { ProjectDictNodeVO } from '~/api/home/type'
const activeIndex = ref(-1)
const submenuTop = ref(0)
@ -67,7 +67,7 @@
level.unshift(normal)
}
window.open(`/drawe?level=${JSON.stringify(level)}`, '_blank')
navigateTo(`/drawe?level=${JSON.stringify(level)}`)
}
const keepSubmenuVisible = () => {