Refactor code structure and remove redundant changes
This commit is contained in:
100
pages/foreign/components/BannerTips.vue
Normal file
100
pages/foreign/components/BannerTips.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div class="banner">
|
||||
<div class="banner-content">
|
||||
<div class="banner-text">
|
||||
<h1 class="title">开启 CAD 学习之旅</h1>
|
||||
<p class="subtitle">为你的创意引擎注入强劲动力,驱动设计梦想在市场中乘风破浪</p>
|
||||
<button class="join-button">快来加入</button>
|
||||
</div>
|
||||
<div class="banner-image">
|
||||
<img src="@/assets/images/foreign_banner.png" alt="CAD工作环境" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// 组件逻辑可以在这里添加
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.banner {
|
||||
background: #f4f6f6;
|
||||
padding: 60px 40px;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.banner-content {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
/* gap: 40px; */
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.2rem;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.join-button {
|
||||
background-color: #1a73e8;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 32px;
|
||||
border-radius: 4px;
|
||||
font-size: 1.1rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.join-button:hover {
|
||||
background-color: #1557b0;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.banner-image img {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.banner {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.banner-content {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
16
pages/foreign/components/FeaturedSpecials.vue
Normal file
16
pages/foreign/components/FeaturedSpecials.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="box-border w-100% border border-[#EEEEEE] rounded-12px border-solid bg-[#FFFFFF] px-26px py-30px">
|
||||
<div class="flex items-center">
|
||||
<div class="text-28px text-[#333333] font-normal">精选专题</div>
|
||||
<div class="ml-50px text-21px text-[#999999] font-normal">了解最新趋势发展</div>
|
||||
</div>
|
||||
<div class="mt-36px flex justify-between">
|
||||
<div v-for="item in 4" :key="item" class="flex flex-col items-center">
|
||||
<img :src="`https://picsum.photos/320/190?_t${new Date().getTime()}`" alt="" srcset="" class="h-190px w320 rounded-4px" />
|
||||
<div class="mt-10px text-18px text-[#333333] font-normal">机器人</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
251
pages/foreign/components/ImageTips.vue
Normal file
251
pages/foreign/components/ImageTips.vue
Normal file
@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div class="tech-showcase">
|
||||
<div class="showcase-grid">
|
||||
<!-- 五金工具卡片 -->
|
||||
<div class="showcase-card large-card">
|
||||
<div class="card-content">
|
||||
<h2 class="card-title">五金工具</h2>
|
||||
<div class="card-divider"></div>
|
||||
<p class="card-description">小五金模具、电动工具、手动工具</p>
|
||||
<button class="learn-button">Learn more</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 上排卡片: CAD设计工作站和笔记本工作站 -->
|
||||
<div class="top-row">
|
||||
<!-- CAD设计工作站卡片 - 较宽 -->
|
||||
<div class="showcase-card card-wide medium-card">
|
||||
<div class="card-overlay"></div>
|
||||
</div>
|
||||
|
||||
<!-- 工作站卡片 - 较窄 -->
|
||||
<div class="showcase-card medium-card card-narrow">
|
||||
<div class="card-overlay"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下排卡片: 工业机器人和CAD工业设计 -->
|
||||
<div class="bottom-row">
|
||||
<!-- 工业机器人卡片 - 较窄 -->
|
||||
<div class="showcase-card medium-card card-narrow">
|
||||
<div class="card-overlay"></div>
|
||||
</div>
|
||||
|
||||
<!-- CAD工业设计卡片 - 较宽 -->
|
||||
<div class="showcase-card medium-card card-wide">
|
||||
<div class="card-overlay"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// 组件逻辑可以在此添加
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tech-showcase {
|
||||
width: 100%;
|
||||
max-width: 1440px;
|
||||
margin: 0 auto;
|
||||
padding: 80px 0px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.showcase-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
gap: 20px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
.top-row,
|
||||
.bottom-row {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
.showcase-card {
|
||||
position: relative;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||
}
|
||||
|
||||
.showcase-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* 五金工具卡片 */
|
||||
.large-card {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2;
|
||||
background-image: url('@/assets/images/hardware-tools.png');
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 宽卡片占70% */
|
||||
.card-wide {
|
||||
flex: 7;
|
||||
}
|
||||
|
||||
/* 窄卡片占30% */
|
||||
.card-narrow {
|
||||
flex: 3;
|
||||
}
|
||||
|
||||
/* CAD设计工作站卡片 - 较宽 */
|
||||
.top-row .card-wide {
|
||||
background-image: url('@/assets/images/cad-workstation.png');
|
||||
}
|
||||
|
||||
/* 工作站卡片 - 较窄 */
|
||||
.top-row .card-narrow {
|
||||
background-image: url('@/assets/images/laptop-workspace.png');
|
||||
}
|
||||
|
||||
/* 工业机器人卡片 - 较窄 */
|
||||
.bottom-row .card-narrow {
|
||||
background-image: url('@/assets/images/industrial-robots.png');
|
||||
}
|
||||
|
||||
/* CAD工业设计卡片 - 较宽 */
|
||||
.bottom-row .card-wide {
|
||||
background-image: url('@/assets/images/cad-industrial-design.png');
|
||||
}
|
||||
|
||||
.card-content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 30px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.large-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.card-divider {
|
||||
width: 40px;
|
||||
height: 3px;
|
||||
background-color: white;
|
||||
margin: 0 auto 15px;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.learn-button {
|
||||
background-color: #1a73e8;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
align-self: center;
|
||||
transition: background-color 0.3s;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.learn-button:hover {
|
||||
background-color: #1557b0;
|
||||
}
|
||||
|
||||
.card-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.medium-card:hover .card-overlay {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.showcase-grid {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.large-card {
|
||||
height: 300px;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.top-row,
|
||||
.bottom-row {
|
||||
grid-column: 1;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
grid-row: 3;
|
||||
}
|
||||
|
||||
.card-wide,
|
||||
.card-narrow {
|
||||
height: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.top-row,
|
||||
.bottom-row {
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.card-wide,
|
||||
.card-narrow {
|
||||
height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
58
pages/foreign/components/RecommendedColumnsV2.vue
Normal file
58
pages/foreign/components/RecommendedColumnsV2.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="relative mt-34px w-100%">
|
||||
<KlTabBar v-model="tabIndex" :data="tabBar" />
|
||||
<KlWallpaperCategory v-model="query" v-model:level="level" :type="1" />
|
||||
<div class="absolute right-0px top-10px text-16px text-[#999999] font-normal"
|
||||
>共<span class="color-#1A65FF">{{ result.total }}</span
|
||||
>个筛选结果</div
|
||||
>
|
||||
<div class="content mt-10px">
|
||||
<el-row :gutter="20">
|
||||
<el-col v-for="(item, index) in result.list" :key="index" :span="6">
|
||||
<CardPicture :item-info="item" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-empty v-if="!result.list.length" description="暂无数据"></el-empty>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import KlTabBar from '@/components/kl-tab-bar/index.vue'
|
||||
import CardPicture from '@/components/kl-card-picture/index.vue'
|
||||
import { ref } from 'vue'
|
||||
import { pageRes } from '@/api/upnew/types'
|
||||
|
||||
const level = ref([
|
||||
{
|
||||
id: '0',
|
||||
name: '图纸库',
|
||||
isChildren: false,
|
||||
},
|
||||
])
|
||||
|
||||
const result = defineModel<pageRes>('modelValue', {
|
||||
required: true,
|
||||
})
|
||||
const query = defineModel<any>('query', {
|
||||
required: true,
|
||||
})
|
||||
|
||||
const tabIndex = ref(1)
|
||||
const tabBar = ref([
|
||||
{
|
||||
label: '图纸推荐',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '原创图纸',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '最新上传',
|
||||
value: 3,
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
86
pages/foreign/index.vue
Normal file
86
pages/foreign/index.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<!-- 导航 -->
|
||||
<KlNavTab active="国外专区" />
|
||||
<!-- banneer提示 -->
|
||||
<BannerTips />
|
||||
<div class="ma-auto w-1440px">
|
||||
<!-- 图片展示鼠标移上去展示提示语 -->
|
||||
<!-- <ImageTips /> -->
|
||||
<!-- 推荐栏目 -->
|
||||
<RecommendedColumnsV2 v-model:query="query" v-model="result"></RecommendedColumnsV2>
|
||||
<!-- 精选专题 -->
|
||||
<!-- <FeaturedSpecials></FeaturedSpecials> -->
|
||||
<!-- 分页 -->
|
||||
<div class="mt-10px flex justify-center">
|
||||
<el-pagination
|
||||
v-model:current-page="query.pageNo"
|
||||
v-model:page-size="query.pageSize"
|
||||
:page-sizes="[10, 20, 30]"
|
||||
:total="result.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleChangeSize"
|
||||
@current-change="handleChangeCurrent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import KlNavTab from '@/components/kl-nav-tab/index.vue'
|
||||
import RecommendedColumnsV2 from './components/RecommendedColumnsV2.vue'
|
||||
// import FeaturedSpecials from './components/FeaturedSpecials.vue'
|
||||
import BannerTips from './components/BannerTips.vue'
|
||||
// import ImageTips from './components/ImageTips.vue'
|
||||
|
||||
import { reactive, watch } from 'vue'
|
||||
import { page } from '@/api/upnew/index'
|
||||
import { pageRes, pageReq } from '@/api/upnew/types'
|
||||
|
||||
const query = reactive<pageReq>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectType: '',
|
||||
editions: '',
|
||||
source: '',
|
||||
type: 1,
|
||||
})
|
||||
const result = reactive<pageRes>({
|
||||
list: [],
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const getPage = () => {
|
||||
page(query).then((res) => {
|
||||
const { data, code } = res
|
||||
if (code === 0) {
|
||||
result.list = data.list
|
||||
result.total = data.total
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getPage()
|
||||
|
||||
const handleChangeSize = (val: number) => {
|
||||
query.pageSize = val
|
||||
query.pageNo = 1
|
||||
getPage()
|
||||
}
|
||||
|
||||
const handleChangeCurrent = (val: number) => {
|
||||
query.pageNo = val
|
||||
getPage()
|
||||
}
|
||||
|
||||
watch([() => query.projectType, () => query.editions, () => query.source], (val) => {
|
||||
if (val) {
|
||||
getPage()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-pagination) {
|
||||
.el-input__inner {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user