feat:消息中心和案例库
This commit is contained in:
@@ -6,7 +6,9 @@ import {
|
||||
CASE_FILTER_TIME_RANGES,
|
||||
DEFAULT_CASE_FILTER,
|
||||
} from '@/constants/case-library'
|
||||
import type { CaseFilterValues, CaseItem } from '@/types/case-library'
|
||||
import type { CaseFilterValues } from '@/types/case-library'
|
||||
import type { CaseFilterTarget } from '@/utils/case-filter'
|
||||
import filterIcon from '@/static/icons/icon-filter.svg'
|
||||
import {
|
||||
cloneCaseFilter,
|
||||
getSelectedFilterTags,
|
||||
@@ -16,7 +18,7 @@ import {
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
cases: CaseItem[]
|
||||
cases: CaseFilterTarget[]
|
||||
value: CaseFilterValues
|
||||
}>()
|
||||
|
||||
@@ -152,7 +154,7 @@ function handleConfirm() {
|
||||
<view class="case-filter-panel__title-wrap">
|
||||
<image
|
||||
class="case-filter-panel__title-icon"
|
||||
src="/static/icons/icon-filter.svg"
|
||||
:src="filterIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="case-filter-panel__title">
|
||||
|
||||
345
src/pages/case-library/detail/index.vue
Normal file
345
src/pages/case-library/detail/index.vue
Normal file
@@ -0,0 +1,345 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getCaseDetail } from '@/constants/case-detail'
|
||||
import type { CaseDetail } from '@/types/case-library'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
import deleteIcon from '@/static/icons/X.png'
|
||||
|
||||
const detail = ref<CaseDetail | null>(null)
|
||||
|
||||
const overviewItems = [
|
||||
{ label: '客户类型', key: 'clientType' as const },
|
||||
{ label: '所属行业', key: 'industry' as const },
|
||||
{ label: '规模', key: 'scale' as const },
|
||||
{ label: '项目周期', key: 'cycle' as const },
|
||||
{ label: '服务团队', key: 'teamSize' as const },
|
||||
{ label: '完成时间', key: 'completedAt' as const },
|
||||
]
|
||||
|
||||
onLoad((options) => {
|
||||
const rawId = options?.id
|
||||
const id = rawId ? decodeURIComponent(String(rawId)) : '1'
|
||||
detail.value = getCaseDetail(id)
|
||||
|
||||
if (!detail.value) {
|
||||
uni.showToast({ title: '案例不存在', icon: 'none' })
|
||||
setTimeout(() => uni.navigateBack(), 1500)
|
||||
}
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/case-library/index')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
v-if="detail"
|
||||
class="case-detail"
|
||||
>
|
||||
<view class="case-detail__navbar">
|
||||
<view
|
||||
class="case-detail__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="case-detail__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="case-detail__navbar-title">
|
||||
案例详情
|
||||
</text>
|
||||
<view class="case-detail__navbar-placeholder" />
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="case-detail__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="case-detail__content">
|
||||
<view class="case-detail__hero">
|
||||
<text class="case-detail__tag">
|
||||
{{ detail.category }}
|
||||
</text>
|
||||
<text class="case-detail__title">
|
||||
{{ detail.title }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="case-detail__section">
|
||||
<text class="case-detail__section-title">
|
||||
项目概览
|
||||
</text>
|
||||
<view class="case-detail__overview">
|
||||
<view
|
||||
v-for="item in overviewItems"
|
||||
:key="item.key"
|
||||
class="case-detail__overview-item"
|
||||
>
|
||||
<text class="case-detail__overview-label">
|
||||
{{ item.label }}
|
||||
</text>
|
||||
<text class="case-detail__overview-value">
|
||||
{{ detail[item.key] }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="case-detail__section">
|
||||
<text class="case-detail__section-title">
|
||||
项目背景
|
||||
</text>
|
||||
<view class="case-detail__image-placeholder" />
|
||||
<text class="case-detail__paragraph">
|
||||
{{ detail.background }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="case-detail__section">
|
||||
<text class="case-detail__section-title">
|
||||
客户痛点
|
||||
</text>
|
||||
<text class="case-detail__paragraph">
|
||||
{{ detail.painPoints }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="case-detail__section">
|
||||
<text class="case-detail__section-title">
|
||||
需求描述
|
||||
</text>
|
||||
<text class="case-detail__paragraph">
|
||||
{{ detail.requirement }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="case-detail__section case-detail__section--last">
|
||||
<text class="case-detail__section-title">
|
||||
交付成果
|
||||
</text>
|
||||
<text class="case-detail__paragraph">
|
||||
{{ detail.deliverables }}
|
||||
</text>
|
||||
<scroll-view
|
||||
class="case-detail__attachments"
|
||||
scroll-x
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="case-detail__attachments-inner">
|
||||
<view
|
||||
v-for="file in detail.attachments"
|
||||
:key="file.id"
|
||||
class="case-detail__attachment"
|
||||
>
|
||||
<view class="case-detail__attachment-remove">
|
||||
<image
|
||||
class="case-detail__attachment-remove-icon"
|
||||
:src="deleteIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<image
|
||||
class="case-detail__attachment-icon"
|
||||
:src="file.icon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="case-detail__attachment-name">
|
||||
{{ file.name }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.case-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background: $color-bg-section;
|
||||
}
|
||||
|
||||
.case-detail__navbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.case-detail__back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.case-detail__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.case-detail__navbar-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-detail__navbar-placeholder {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.case-detail__scroll {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.case-detail__content {
|
||||
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.case-detail__hero {
|
||||
padding: 32rpx 28rpx;
|
||||
background: linear-gradient(135deg, #eef4ff 0%, #ffffff 60%);
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.case-detail__tag {
|
||||
display: inline-block;
|
||||
padding: 6rpx 16rpx;
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
background: $color-primary;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.case-detail__title {
|
||||
display: block;
|
||||
margin-top: 20rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-detail__section {
|
||||
margin-top: 24rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: 20rpx;
|
||||
|
||||
&--last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.case-detail__section-title {
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-detail__overview {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.case-detail__overview-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 33.33%;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.case-detail__overview-label {
|
||||
font-size: 22rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.case-detail__overview-value {
|
||||
margin-top: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-detail__image-placeholder {
|
||||
height: 280rpx;
|
||||
margin-bottom: 24rpx;
|
||||
background: #e8eaed;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.case-detail__paragraph {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.8;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-detail__attachments {
|
||||
margin-top: 24rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.case-detail__attachments-inner {
|
||||
display: inline-flex;
|
||||
gap: 20rpx;
|
||||
padding: 10rpx 10rpx 0 0;
|
||||
}
|
||||
|
||||
.case-detail__attachment {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 160rpx;
|
||||
padding: 20rpx 16rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.case-detail__attachment-remove {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.case-detail__attachment-remove-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.case-detail__attachment-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.case-detail__attachment-name {
|
||||
margin-top: 12rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-primary;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
466
src/pages/case-library/favorites/index.vue
Normal file
466
src/pages/case-library/favorites/index.vue
Normal file
@@ -0,0 +1,466 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import {
|
||||
CASE_CATEGORIES,
|
||||
CASE_FILTER_INDUSTRIES,
|
||||
CASE_FILTER_SCALES,
|
||||
CASE_FILTER_TIME_RANGES,
|
||||
CASE_PAGE_SIZE,
|
||||
DEFAULT_CASE_FILTER,
|
||||
} from '@/constants/case-library'
|
||||
import { useCaseFavorites } from '@/hooks/use-case-favorites'
|
||||
import type { CaseCategory, CaseFilterValues } from '@/types/case-library'
|
||||
import filterIcon from '@/static/icons/icon-filter.svg'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
import { cloneCaseFilter, matchCaseFilter } from '@/utils/case-filter'
|
||||
import CaseCard from '../components/CaseCard.vue'
|
||||
import CaseFilterPanel from '../components/CaseFilterPanel.vue'
|
||||
import LoadMoreFooter from '../components/LoadMoreFooter.vue'
|
||||
|
||||
const LOAD_MORE_DELAY = 600
|
||||
|
||||
const { favoriteCases, syncFavoriteIds, toggleFavorite } = useCaseFavorites()
|
||||
|
||||
const keyword = ref('')
|
||||
const activeCategory = ref<CaseCategory>('全部')
|
||||
const caseList = ref(favoriteCases.value.map(item => ({ ...item })))
|
||||
const pageSize = ref(CASE_PAGE_SIZE)
|
||||
const loadingMore = ref(false)
|
||||
const filterVisible = ref(false)
|
||||
const appliedFilter = ref<CaseFilterValues>(cloneCaseFilter(DEFAULT_CASE_FILTER))
|
||||
|
||||
const filteredCases = computed(() => {
|
||||
const text = keyword.value.trim()
|
||||
|
||||
return caseList.value.filter((item) => {
|
||||
const matchCategory = activeCategory.value === '全部' || item.category === activeCategory.value
|
||||
const matchKeyword = !text || item.title.includes(text) || item.industry.includes(text) || item.category.includes(text)
|
||||
const matchFilter = matchCaseFilter(item, appliedFilter.value)
|
||||
return matchCategory && matchKeyword && matchFilter
|
||||
})
|
||||
})
|
||||
|
||||
const visibleCases = computed(() => filteredCases.value.slice(0, pageSize.value))
|
||||
|
||||
const hasMore = computed(() => pageSize.value < filteredCases.value.length)
|
||||
|
||||
const loadFinished = computed(() => !hasMore.value && visibleCases.value.length > 0)
|
||||
|
||||
watch([keyword, activeCategory, appliedFilter], () => {
|
||||
pageSize.value = CASE_PAGE_SIZE
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
syncFavoriteIds()
|
||||
caseList.value = favoriteCases.value.map(item => ({ ...item }))
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/case-library/index')
|
||||
}
|
||||
|
||||
function handleSelectCategory(category: CaseCategory) {
|
||||
activeCategory.value = category
|
||||
}
|
||||
|
||||
function handleToggleFavorite(id: string) {
|
||||
toggleFavorite(id)
|
||||
caseList.value = favoriteCases.value.map(item => ({ ...item }))
|
||||
}
|
||||
|
||||
function handleLoadMore() {
|
||||
if (loadingMore.value || !hasMore.value)
|
||||
return
|
||||
|
||||
loadingMore.value = true
|
||||
|
||||
setTimeout(() => {
|
||||
pageSize.value += CASE_PAGE_SIZE
|
||||
loadingMore.value = false
|
||||
}, LOAD_MORE_DELAY)
|
||||
}
|
||||
|
||||
function handleOpenFilter() {
|
||||
filterVisible.value = true
|
||||
}
|
||||
|
||||
function handleCloseFilter() {
|
||||
filterVisible.value = false
|
||||
}
|
||||
|
||||
function handleConfirmFilter(value: CaseFilterValues) {
|
||||
appliedFilter.value = cloneCaseFilter(value)
|
||||
}
|
||||
|
||||
function handleCaseTap(id: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/case-library/detail/index?id=${id}`,
|
||||
})
|
||||
}
|
||||
|
||||
function showIndustryPicker() {
|
||||
uni.showActionSheet({
|
||||
itemList: [...CASE_FILTER_INDUSTRIES],
|
||||
success: ({ tapIndex }) => {
|
||||
const industry = CASE_FILTER_INDUSTRIES[tapIndex]
|
||||
const next = cloneCaseFilter(appliedFilter.value)
|
||||
next.industries = next.industries.includes(industry)
|
||||
? next.industries.filter(item => item !== industry)
|
||||
: [...next.industries, industry]
|
||||
appliedFilter.value = next
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function showScalePicker() {
|
||||
const options = CASE_FILTER_SCALES.filter(item => item !== '全部')
|
||||
uni.showActionSheet({
|
||||
itemList: options,
|
||||
success: ({ tapIndex }) => {
|
||||
const scale = options[tapIndex]
|
||||
const next = cloneCaseFilter(appliedFilter.value)
|
||||
next.scales = next.scales.includes(scale)
|
||||
? next.scales.filter(item => item !== scale)
|
||||
: [...next.scales, scale]
|
||||
appliedFilter.value = next
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function showTimePicker() {
|
||||
const options = CASE_FILTER_TIME_RANGES.filter(item => item !== '全部')
|
||||
uni.showActionSheet({
|
||||
itemList: options,
|
||||
success: ({ tapIndex }) => {
|
||||
const timeRange = options[tapIndex]
|
||||
const next = cloneCaseFilter(appliedFilter.value)
|
||||
next.timeRanges = next.timeRanges.includes(timeRange)
|
||||
? next.timeRanges.filter(item => item !== timeRange)
|
||||
: [...next.timeRanges, timeRange]
|
||||
appliedFilter.value = next
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="case-favorites">
|
||||
<view class="case-favorites__header">
|
||||
<view class="case-favorites__navbar">
|
||||
<view
|
||||
class="case-favorites__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="case-favorites__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="case-favorites__title">
|
||||
收藏列表
|
||||
</text>
|
||||
<view class="case-favorites__navbar-placeholder" />
|
||||
</view>
|
||||
|
||||
<view class="case-favorites__search-row">
|
||||
<view class="case-favorites__search">
|
||||
<image
|
||||
class="case-favorites__search-icon"
|
||||
src="/static/icons/icon-search.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="case-favorites__search-input"
|
||||
placeholder="搜索案例标题、描述、标签..."
|
||||
placeholder-class="case-favorites__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
<view class="case-favorites__favorite-btn">
|
||||
<image
|
||||
class="case-favorites__favorite-btn-icon"
|
||||
src="/static/icons/icon-heart.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="case-favorites__tabs"
|
||||
scroll-x
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="case-favorites__tabs-inner">
|
||||
<text
|
||||
v-for="category in CASE_CATEGORIES"
|
||||
:key="category"
|
||||
class="case-favorites__tab"
|
||||
:class="{ 'case-favorites__tab--active': activeCategory === category }"
|
||||
@tap="handleSelectCategory(category)"
|
||||
>
|
||||
{{ category }}
|
||||
</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="case-favorites__quick-filters">
|
||||
<view
|
||||
class="case-favorites__quick-filter"
|
||||
@tap="showIndustryPicker"
|
||||
>
|
||||
<text>行业</text>
|
||||
<text class="case-favorites__quick-filter-arrow">
|
||||
∨
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
class="case-favorites__quick-filter"
|
||||
@tap="showScalePicker"
|
||||
>
|
||||
<text>项目规模</text>
|
||||
<text class="case-favorites__quick-filter-arrow">
|
||||
∨
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
class="case-favorites__quick-filter"
|
||||
@tap="showTimePicker"
|
||||
>
|
||||
<text>完成时间</text>
|
||||
<text class="case-favorites__quick-filter-arrow">
|
||||
∨
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
class="case-favorites__filter"
|
||||
@tap="handleOpenFilter"
|
||||
>
|
||||
<text class="case-favorites__filter-text">
|
||||
筛选
|
||||
</text>
|
||||
<image
|
||||
class="case-favorites__filter-icon"
|
||||
:src="filterIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="case-favorites__toolbar">
|
||||
<text class="case-favorites__count">
|
||||
共 {{ filteredCases.length }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="case-favorites__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
:lower-threshold="120"
|
||||
@scrolltolower="handleLoadMore"
|
||||
>
|
||||
<view class="case-favorites__list">
|
||||
<CaseCard
|
||||
v-for="item in visibleCases"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@toggle-favorite="handleToggleFavorite"
|
||||
@tap="handleCaseTap(item.id)"
|
||||
/>
|
||||
|
||||
<LoadMoreFooter
|
||||
:loading="loadingMore"
|
||||
:has-more="hasMore"
|
||||
:finished="loadFinished"
|
||||
@load-more="handleLoadMore"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<CaseFilterPanel
|
||||
:visible="filterVisible"
|
||||
:cases="caseList"
|
||||
:value="appliedFilter"
|
||||
@close="handleCloseFilter"
|
||||
@confirm="handleConfirmFilter"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.case-favorites {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-section;
|
||||
}
|
||||
|
||||
.case-favorites__header {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 24rpx 0;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.case-favorites__navbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.case-favorites__back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.case-favorites__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.case-favorites__title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-favorites__navbar-placeholder {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.case-favorites__search-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.case-favorites__search {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
height: 72rpx;
|
||||
padding: 0 24rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.case-favorites__search-icon {
|
||||
flex-shrink: 0;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.case-favorites__search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-favorites__search-placeholder {
|
||||
color: $color-text-placeholder;
|
||||
}
|
||||
|
||||
.case-favorites__favorite-btn {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.case-favorites__favorite-btn-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.case-favorites__tabs {
|
||||
margin-top: 24rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.case-favorites__tabs-inner {
|
||||
display: inline-flex;
|
||||
gap: 32rpx;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.case-favorites__tab {
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text-secondary;
|
||||
|
||||
&--active {
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
border-bottom: 4rpx solid $color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.case-favorites__quick-filters {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.case-favorites__quick-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.case-favorites__quick-filter-arrow {
|
||||
font-size: 20rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.case-favorites__filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.case-favorites__filter-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.case-favorites__filter-text {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.case-favorites__toolbar {
|
||||
padding: 20rpx 0 24rpx;
|
||||
}
|
||||
|
||||
.case-favorites__count {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.case-favorites__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.case-favorites__list {
|
||||
padding: 0 24rpx calc(32rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import AppTabBar from '@/components/AppTabBar.vue'
|
||||
import { useCaseFavorites } from '@/hooks/use-case-favorites'
|
||||
import {
|
||||
CASE_CATEGORIES,
|
||||
CASE_LIBRARY_LIST,
|
||||
@@ -8,6 +10,7 @@ import {
|
||||
DEFAULT_CASE_FILTER,
|
||||
} from '@/constants/case-library'
|
||||
import type { CaseCategory, CaseFilterValues } from '@/types/case-library'
|
||||
import filterIcon from '@/static/icons/icon-filter.svg'
|
||||
import { cloneCaseFilter, matchCaseFilter } from '@/utils/case-filter'
|
||||
import CaseCard from './components/CaseCard.vue'
|
||||
import CaseFilterPanel from './components/CaseFilterPanel.vue'
|
||||
@@ -15,9 +18,11 @@ import LoadMoreFooter from './components/LoadMoreFooter.vue'
|
||||
|
||||
const LOAD_MORE_DELAY = 600
|
||||
|
||||
const { applyFavoritesToList, syncFavoriteIds, toggleFavorite } = useCaseFavorites()
|
||||
|
||||
const keyword = ref('')
|
||||
const activeCategory = ref<CaseCategory>('全部')
|
||||
const caseList = ref(CASE_LIBRARY_LIST.map(item => ({ ...item })))
|
||||
const caseList = ref(applyFavoritesToList(CASE_LIBRARY_LIST.map(item => ({ ...item }))))
|
||||
const pageSize = ref(CASE_PAGE_SIZE)
|
||||
const loadingMore = ref(false)
|
||||
const filterVisible = ref(false)
|
||||
@@ -44,14 +49,24 @@ watch([keyword, activeCategory, appliedFilter], () => {
|
||||
pageSize.value = CASE_PAGE_SIZE
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
syncFavoriteIds()
|
||||
caseList.value = applyFavoritesToList(CASE_LIBRARY_LIST.map(item => ({ ...item })))
|
||||
})
|
||||
|
||||
function handleSelectCategory(category: CaseCategory) {
|
||||
activeCategory.value = category
|
||||
}
|
||||
|
||||
function handleToggleFavorite(id: string) {
|
||||
caseList.value = caseList.value.map(item =>
|
||||
item.id === id ? { ...item, favorite: !item.favorite } : item,
|
||||
)
|
||||
toggleFavorite(id)
|
||||
caseList.value = applyFavoritesToList(CASE_LIBRARY_LIST.map(item => ({ ...item })))
|
||||
}
|
||||
|
||||
function handleOpenFavorites() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/case-library/favorites/index',
|
||||
})
|
||||
}
|
||||
|
||||
function handleLoadMore() {
|
||||
@@ -77,6 +92,12 @@ function handleCloseFilter() {
|
||||
function handleConfirmFilter(value: CaseFilterValues) {
|
||||
appliedFilter.value = cloneCaseFilter(value)
|
||||
}
|
||||
|
||||
function handleCaseTap(id: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/case-library/detail/index?id=${id}`,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -100,7 +121,10 @@ function handleConfirmFilter(value: CaseFilterValues) {
|
||||
placeholder-class="case-library__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
<view class="case-library__favorite-btn">
|
||||
<view
|
||||
class="case-library__favorite-btn"
|
||||
@tap="handleOpenFavorites"
|
||||
>
|
||||
<image
|
||||
class="case-library__favorite-btn-icon"
|
||||
src="/static/icons/icon-heart.svg"
|
||||
@@ -137,7 +161,7 @@ function handleConfirmFilter(value: CaseFilterValues) {
|
||||
>
|
||||
<image
|
||||
class="case-library__filter-icon"
|
||||
src="/static/icons/icon-filter.svg"
|
||||
:src="filterIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="case-library__filter-text">
|
||||
@@ -160,6 +184,7 @@ function handleConfirmFilter(value: CaseFilterValues) {
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@toggle-favorite="handleToggleFavorite"
|
||||
@tap="handleCaseTap(item.id)"
|
||||
/>
|
||||
|
||||
<LoadMoreFooter
|
||||
@@ -196,7 +221,7 @@ function handleConfirmFilter(value: CaseFilterValues) {
|
||||
|
||||
.case-library__header {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 24rpx 0;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ function handleQuickSubmit() {
|
||||
}
|
||||
|
||||
function handleCustomerService() {
|
||||
uni.showToast({
|
||||
title: '客服中心开发中',
|
||||
icon: 'none',
|
||||
uni.navigateTo({
|
||||
url: '/pages/message-center/customer-service/index',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
106
src/pages/message-center/components/MessageItem.vue
Normal file
106
src/pages/message-center/components/MessageItem.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<script setup lang="ts">
|
||||
import type { MessageItem } from '@/types/message-center'
|
||||
|
||||
defineProps<{
|
||||
item: MessageItem
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
tap: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
class="message-item"
|
||||
@tap="emit('tap')"
|
||||
>
|
||||
<view class="message-item__icon-wrap">
|
||||
<image
|
||||
class="message-item__icon"
|
||||
:src="item.icon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="message-item__content">
|
||||
<view class="message-item__row">
|
||||
<text class="message-item__title">
|
||||
{{ item.title }}
|
||||
</text>
|
||||
<text class="message-item__time">
|
||||
{{ item.time }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="message-item__preview">
|
||||
{{ item.preview }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.message-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx 32rpx;
|
||||
background: $color-bg-page;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.message-item__icon-wrap {
|
||||
flex-shrink: 0;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.message-item__icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
|
||||
.message-item__content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-top: 4rpx;
|
||||
}
|
||||
|
||||
.message-item__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.message-item__title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.message-item__time {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.message-item__preview {
|
||||
margin-top: 8rpx;
|
||||
min-height: 78rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.5;
|
||||
color: $color-text-secondary;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,112 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChatMessage } from '@/types/customer-service'
|
||||
|
||||
defineProps<{
|
||||
message: ChatMessage
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
class="chat-message"
|
||||
:class="`chat-message--${message.role}`"
|
||||
>
|
||||
<image
|
||||
class="chat-message__avatar"
|
||||
:src="message.avatar"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
|
||||
<view class="chat-message__body">
|
||||
<text class="chat-message__nickname">
|
||||
{{ message.nickname }}
|
||||
</text>
|
||||
<view
|
||||
class="chat-message__bubble"
|
||||
:class="`chat-message__bubble--${message.role}`"
|
||||
>
|
||||
<text class="chat-message__text">
|
||||
{{ message.content }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.chat-message {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
&--user {
|
||||
flex-direction: row-reverse;
|
||||
|
||||
.chat-message__body {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.chat-message__nickname {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
&--service {
|
||||
flex-direction: row;
|
||||
|
||||
.chat-message__body {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.chat-message__avatar {
|
||||
flex-shrink: 0;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
background: #fff7e6;
|
||||
}
|
||||
|
||||
.chat-message__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: calc(100% - 96rpx);
|
||||
margin: 0 16rpx;
|
||||
}
|
||||
|
||||
.chat-message__nickname {
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.chat-message__bubble {
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
&--user {
|
||||
background: $color-primary;
|
||||
}
|
||||
|
||||
&--service {
|
||||
background: #f2f3f5;
|
||||
}
|
||||
}
|
||||
|
||||
.chat-message__text {
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
|
||||
.chat-message__bubble--user & {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.chat-message__bubble--service & {
|
||||
color: $color-text-primary;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
299
src/pages/message-center/customer-service/index.vue
Normal file
299
src/pages/message-center/customer-service/index.vue
Normal file
@@ -0,0 +1,299 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { CUSTOMER_SERVICE_MESSAGES } from '@/constants/customer-service'
|
||||
import type { ChatMessage } from '@/types/customer-service'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
import ChatMessageItem from './components/ChatMessage.vue'
|
||||
|
||||
const messages = ref<ChatMessage[]>(CUSTOMER_SERVICE_MESSAGES.map(item => ({ ...item })))
|
||||
const inputValue = ref('')
|
||||
const panelVisible = ref(false)
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/message-center/index')
|
||||
}
|
||||
|
||||
function togglePanel() {
|
||||
panelVisible.value = !panelVisible.value
|
||||
}
|
||||
|
||||
function handleSend() {
|
||||
const content = inputValue.value.trim()
|
||||
if (!content)
|
||||
return
|
||||
|
||||
messages.value.push({
|
||||
id: String(Date.now()),
|
||||
role: 'user',
|
||||
nickname: '昵称',
|
||||
content,
|
||||
avatar: '/static/icons/hi.png',
|
||||
})
|
||||
inputValue.value = ''
|
||||
panelVisible.value = false
|
||||
}
|
||||
|
||||
function handleAttachment(type: 'camera' | 'photo' | 'file') {
|
||||
const labelMap = {
|
||||
camera: '拍摄',
|
||||
photo: '照片',
|
||||
file: '文件',
|
||||
}
|
||||
uni.showToast({ title: `${labelMap[type]}功能开发中`, icon: 'none' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="customer-service">
|
||||
<view class="customer-service__navbar">
|
||||
<view
|
||||
class="customer-service__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="customer-service__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="customer-service__title">
|
||||
在线客服
|
||||
</text>
|
||||
<view class="customer-service__navbar-placeholder" />
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="customer-service__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
:scroll-into-view="messages.length ? `msg-${messages[messages.length - 1].id}` : ''"
|
||||
>
|
||||
<view class="customer-service__messages">
|
||||
<view
|
||||
v-for="message in messages"
|
||||
:id="`msg-${message.id}`"
|
||||
:key="message.id"
|
||||
>
|
||||
<ChatMessageItem :message="message" />
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="customer-service__footer">
|
||||
<view class="customer-service__input-row">
|
||||
<view class="customer-service__tool-btn">
|
||||
<image
|
||||
class="customer-service__tool-icon"
|
||||
src="/static/icons/icon-chat-voice.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<input
|
||||
v-model="inputValue"
|
||||
class="customer-service__input"
|
||||
placeholder="请输入消息..."
|
||||
placeholder-class="customer-service__placeholder"
|
||||
confirm-type="send"
|
||||
@confirm="handleSend"
|
||||
>
|
||||
|
||||
<view
|
||||
class="customer-service__tool-btn"
|
||||
@tap="togglePanel"
|
||||
>
|
||||
<image
|
||||
class="customer-service__tool-icon"
|
||||
src="/static/icons/icon-chat-add.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="panelVisible"
|
||||
class="customer-service__panel"
|
||||
>
|
||||
<view
|
||||
class="customer-service__panel-item"
|
||||
@tap="handleAttachment('camera')"
|
||||
>
|
||||
<view class="customer-service__panel-icon-wrap">
|
||||
<image
|
||||
class="customer-service__panel-icon"
|
||||
src="/static/icons/icon-chat-camera.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="customer-service__panel-label">
|
||||
拍摄
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="customer-service__panel-item"
|
||||
@tap="handleAttachment('photo')"
|
||||
>
|
||||
<view class="customer-service__panel-icon-wrap">
|
||||
<image
|
||||
class="customer-service__panel-icon"
|
||||
src="/static/icons/icon-chat-photo.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="customer-service__panel-label">
|
||||
照片
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="customer-service__panel-item"
|
||||
@tap="handleAttachment('file')"
|
||||
>
|
||||
<view class="customer-service__panel-icon-wrap">
|
||||
<image
|
||||
class="customer-service__panel-icon"
|
||||
src="/static/icons/icon-chat-file.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="customer-service__panel-label">
|
||||
文件
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.customer-service {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.customer-service__navbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
|
||||
background: $color-bg-page;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.customer-service__back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.customer-service__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.customer-service__title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.customer-service__navbar-placeholder {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.customer-service__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.customer-service__messages {
|
||||
padding: 24rpx 24rpx 32rpx;
|
||||
}
|
||||
|
||||
.customer-service__footer {
|
||||
flex-shrink: 0;
|
||||
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
|
||||
background: $color-bg-page;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.customer-service__input-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.customer-service__tool-btn {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.customer-service__tool-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.customer-service__input {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text-primary;
|
||||
background: #f2f3f5;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.customer-service__placeholder {
|
||||
color: $color-text-placeholder;
|
||||
}
|
||||
|
||||
.customer-service__panel {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-around;
|
||||
min-height: 400rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 40rpx 24rpx 48rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.customer-service__panel-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.customer-service__panel-icon-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
}
|
||||
|
||||
.customer-service__panel-icon {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
}
|
||||
|
||||
.customer-service__panel-label {
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
</style>
|
||||
@@ -1,15 +1,76 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import AppTabBar from '@/components/AppTabBar.vue'
|
||||
import { MESSAGE_LIST } from '@/constants/message-center'
|
||||
import type { MessageItem } from '@/types/message-center'
|
||||
import MessageItemCard from './components/MessageItem.vue'
|
||||
|
||||
const messageList = ref<MessageItem[]>(MESSAGE_LIST.map(item => ({ ...item })))
|
||||
|
||||
function handleReadAll() {
|
||||
messageList.value = messageList.value.map(item => ({
|
||||
...item,
|
||||
unread: false,
|
||||
}))
|
||||
uni.showToast({ title: '已全部标为已读', icon: 'none' })
|
||||
}
|
||||
|
||||
function handleMessageTap(item: MessageItem) {
|
||||
if (item.type === 'service') {
|
||||
messageList.value = messageList.value.map(row =>
|
||||
row.id === item.id ? { ...row, unread: false } : row,
|
||||
)
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/message-center/customer-service/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (item.type === 'workorder') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/message-center/status-notification/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (item.type === 'system') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/message-center/system-notification/index',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="placeholder-page">
|
||||
<text class="placeholder-page__title">
|
||||
消息中心
|
||||
</text>
|
||||
<text class="placeholder-page__desc">
|
||||
功能开发中
|
||||
</text>
|
||||
<view class="message-center">
|
||||
<view class="message-center__header">
|
||||
<text class="message-center__title">
|
||||
消息中心
|
||||
</text>
|
||||
<text
|
||||
class="message-center__read-all"
|
||||
@tap="handleReadAll"
|
||||
>
|
||||
全部已读
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="message-center__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="message-center__list">
|
||||
<MessageItemCard
|
||||
v-for="item in messageList"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@tap="handleMessageTap(item)"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<AppTabBar active="message" />
|
||||
</view>
|
||||
</template>
|
||||
@@ -17,25 +78,45 @@ import AppTabBar from '@/components/AppTabBar.vue'
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.placeholder-page {
|
||||
.message-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.placeholder-page__title {
|
||||
.message-center__header {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 32rpx 28rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.message-center__title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.placeholder-page__desc {
|
||||
margin-top: 16rpx;
|
||||
font-size: 28rpx;
|
||||
.message-center__read-all {
|
||||
position: absolute;
|
||||
right: 32rpx;
|
||||
bottom: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.message-center__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.message-center__list {
|
||||
width: 100%;
|
||||
padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<script setup lang="ts">
|
||||
import type { StatusNotificationItem } from '@/types/status-notification'
|
||||
|
||||
defineProps<{
|
||||
item: StatusNotificationItem
|
||||
icon: string
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="status-notification-item">
|
||||
<image
|
||||
class="status-notification-item__icon"
|
||||
:src="icon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
|
||||
<view class="status-notification-item__content">
|
||||
<view class="status-notification-item__row">
|
||||
<text class="status-notification-item__title">
|
||||
{{ item.title }}
|
||||
</text>
|
||||
<text class="status-notification-item__time">
|
||||
{{ item.time }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="status-notification-item__preview">
|
||||
{{ item.preview }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.status-notification-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx 32rpx;
|
||||
background: $color-bg-page;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.status-notification-item__icon {
|
||||
flex-shrink: 0;
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.status-notification-item__content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-top: 4rpx;
|
||||
}
|
||||
|
||||
.status-notification-item__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.status-notification-item__title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.status-notification-item__time {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.status-notification-item__preview {
|
||||
margin-top: 8rpx;
|
||||
min-height: 78rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.5;
|
||||
color: $color-text-secondary;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
182
src/pages/message-center/status-notification/index.vue
Normal file
182
src/pages/message-center/status-notification/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import {
|
||||
STATUS_NOTIFICATION_ICON,
|
||||
STATUS_NOTIFICATION_LIST,
|
||||
} from '@/constants/status-notification'
|
||||
import type { StatusNotificationItem } from '@/types/status-notification'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
import StatusNotificationItemCard from './components/StatusNotificationItem.vue'
|
||||
|
||||
const keyword = ref('')
|
||||
const notificationList = ref<StatusNotificationItem[]>(
|
||||
STATUS_NOTIFICATION_LIST.map(item => ({ ...item })),
|
||||
)
|
||||
|
||||
const filteredList = computed(() => {
|
||||
const text = keyword.value.trim()
|
||||
if (!text)
|
||||
return notificationList.value
|
||||
|
||||
return notificationList.value.filter(item =>
|
||||
item.title.includes(text) || item.preview.includes(text),
|
||||
)
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/message-center/index')
|
||||
}
|
||||
|
||||
function handleReadAll() {
|
||||
notificationList.value = notificationList.value.map(item => ({
|
||||
...item,
|
||||
unread: false,
|
||||
}))
|
||||
uni.showToast({ title: '已全部标为已读', icon: 'none' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="status-notification">
|
||||
<view class="status-notification__header">
|
||||
<view
|
||||
class="status-notification__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="status-notification__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="status-notification__title">
|
||||
状态通知
|
||||
</text>
|
||||
<text
|
||||
class="status-notification__read-all"
|
||||
@tap="handleReadAll"
|
||||
>
|
||||
全部已读
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="status-notification__search">
|
||||
<image
|
||||
class="status-notification__search-icon"
|
||||
src="/static/icons/icon-search.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="status-notification__search-input"
|
||||
placeholder="搜索案例标题、描述、标签..."
|
||||
placeholder-class="status-notification__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="status-notification__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="status-notification__list">
|
||||
<StatusNotificationItemCard
|
||||
v-for="item in filteredList"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
:icon="STATUS_NOTIFICATION_ICON"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.status-notification {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.status-notification__header {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 32rpx 28rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.status-notification__back {
|
||||
position: absolute;
|
||||
left: 32rpx;
|
||||
bottom: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.status-notification__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.status-notification__title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.status-notification__read-all {
|
||||
position: absolute;
|
||||
right: 32rpx;
|
||||
bottom: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.status-notification__search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
height: 72rpx;
|
||||
margin: 0 32rpx 16rpx;
|
||||
padding: 0 24rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.status-notification__search-icon {
|
||||
flex-shrink: 0;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.status-notification__search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.status-notification__search-placeholder {
|
||||
color: $color-text-placeholder;
|
||||
}
|
||||
|
||||
.status-notification__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.status-notification__list {
|
||||
width: 100%;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
</style>
|
||||
182
src/pages/message-center/system-notification/index.vue
Normal file
182
src/pages/message-center/system-notification/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import {
|
||||
SYSTEM_NOTIFICATION_ICON,
|
||||
SYSTEM_NOTIFICATION_LIST,
|
||||
} from '@/constants/system-notification'
|
||||
import type { StatusNotificationItem } from '@/types/status-notification'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
import StatusNotificationItemCard from '../status-notification/components/StatusNotificationItem.vue'
|
||||
|
||||
const keyword = ref('')
|
||||
const notificationList = ref<StatusNotificationItem[]>(
|
||||
SYSTEM_NOTIFICATION_LIST.map(item => ({ ...item })),
|
||||
)
|
||||
|
||||
const filteredList = computed(() => {
|
||||
const text = keyword.value.trim()
|
||||
if (!text)
|
||||
return notificationList.value
|
||||
|
||||
return notificationList.value.filter(item =>
|
||||
item.title.includes(text) || item.preview.includes(text),
|
||||
)
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/message-center/index')
|
||||
}
|
||||
|
||||
function handleReadAll() {
|
||||
notificationList.value = notificationList.value.map(item => ({
|
||||
...item,
|
||||
unread: false,
|
||||
}))
|
||||
uni.showToast({ title: '已全部标为已读', icon: 'none' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="system-notification">
|
||||
<view class="system-notification__header">
|
||||
<view
|
||||
class="system-notification__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="system-notification__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="system-notification__title">
|
||||
系统列表
|
||||
</text>
|
||||
<text
|
||||
class="system-notification__read-all"
|
||||
@tap="handleReadAll"
|
||||
>
|
||||
全部已读
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="system-notification__search">
|
||||
<image
|
||||
class="system-notification__search-icon"
|
||||
src="/static/icons/icon-search.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="system-notification__search-input"
|
||||
placeholder="搜索案例标题、描述、标签..."
|
||||
placeholder-class="system-notification__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="system-notification__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="system-notification__list">
|
||||
<StatusNotificationItemCard
|
||||
v-for="item in filteredList"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
:icon="SYSTEM_NOTIFICATION_ICON"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.system-notification {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.system-notification__header {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 32rpx 28rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.system-notification__back {
|
||||
position: absolute;
|
||||
left: 32rpx;
|
||||
bottom: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.system-notification__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.system-notification__title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.system-notification__read-all {
|
||||
position: absolute;
|
||||
right: 32rpx;
|
||||
bottom: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.system-notification__search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
height: 72rpx;
|
||||
margin: 0 32rpx 16rpx;
|
||||
padding: 0 24rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.system-notification__search-icon {
|
||||
flex-shrink: 0;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.system-notification__search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.system-notification__search-placeholder {
|
||||
color: $color-text-placeholder;
|
||||
}
|
||||
|
||||
.system-notification__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.system-notification__list {
|
||||
width: 100%;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
</style>
|
||||
173
src/pages/project-center/components/ProjectCenterCard.vue
Normal file
173
src/pages/project-center/components/ProjectCenterCard.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<script setup lang="ts">
|
||||
import type { ProjectCenterItem } from '@/types/project-center'
|
||||
|
||||
defineProps<{
|
||||
item: ProjectCenterItem
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
detail: [id: string]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="project-center-card">
|
||||
<view class="project-center-card__header">
|
||||
<text class="project-center-card__title">
|
||||
{{ item.title }}
|
||||
</text>
|
||||
<text class="project-center-card__status">
|
||||
{{ item.status }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="project-center-card__meta">
|
||||
<text class="project-center-card__tag">
|
||||
{{ item.category }}
|
||||
</text>
|
||||
<text class="project-center-card__no">
|
||||
项目编号:{{ item.projectNo }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="item.status === '进行中' && item.progress !== undefined"
|
||||
class="project-center-card__progress"
|
||||
>
|
||||
<view class="project-center-card__progress-bar">
|
||||
<view
|
||||
class="project-center-card__progress-fill"
|
||||
:style="{ width: `${item.progress}%` }"
|
||||
/>
|
||||
</view>
|
||||
<text class="project-center-card__progress-value">
|
||||
{{ item.progress }}%
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="project-center-card__footer"
|
||||
:class="{ 'project-center-card__footer--simple': item.status !== '进行中' }"
|
||||
>
|
||||
<text
|
||||
v-if="item.updateTime"
|
||||
class="project-center-card__time"
|
||||
>
|
||||
更新时间:{{ item.updateTime }}
|
||||
</text>
|
||||
<text
|
||||
class="project-center-card__detail"
|
||||
@tap.stop="emit('detail', item.id)"
|
||||
>
|
||||
查看详情 >
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.project-center-card {
|
||||
padding: 28rpx 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.project-center-card__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.project-center-card__title {
|
||||
flex: 1;
|
||||
padding-right: 16rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-center-card__status {
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-center-card__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.project-center-card__tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 12rpx;
|
||||
font-size: 20rpx;
|
||||
color: $color-primary;
|
||||
background: $color-primary-light;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.project-center-card__no {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 12rpx;
|
||||
font-size: 22rpx;
|
||||
color: #666666;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.project-center-card__progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.project-center-card__progress-bar {
|
||||
flex: 1;
|
||||
height: 12rpx;
|
||||
overflow: hidden;
|
||||
background: #eef2ff;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.project-center-card__progress-fill {
|
||||
height: 100%;
|
||||
background: $color-primary;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.project-center-card__progress-value {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.project-center-card__footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
|
||||
&--simple {
|
||||
justify-content: flex-end;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.project-center-card__time {
|
||||
font-size: 22rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.project-center-card__detail {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
</style>
|
||||
703
src/pages/project-center/detail/index.vue
Normal file
703
src/pages/project-center/detail/index.vue
Normal file
@@ -0,0 +1,703 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getProjectDetail } from '@/constants/project-detail'
|
||||
import cardBg from '@/static/icons/new-card.png'
|
||||
import deleteIcon from '@/static/icons/X.png'
|
||||
import type { ProjectDetail, ProjectDetailTab } from '@/types/project-detail'
|
||||
import { navigateBackWithFallback } from '@/utils/navigate-back'
|
||||
|
||||
const detail = ref<ProjectDetail | null>(null)
|
||||
const activeTab = ref<ProjectDetailTab>('progress')
|
||||
|
||||
const tabs: Array<{ key: ProjectDetailTab, label: string }> = [
|
||||
{ key: 'progress', label: '项目进度' },
|
||||
{ key: 'files', label: '项目文件' },
|
||||
{ key: 'finance', label: '合同财务' },
|
||||
{ key: 'aftersales', label: '售后信息' },
|
||||
]
|
||||
|
||||
onLoad((options) => {
|
||||
const rawId = options?.id
|
||||
const id = rawId ? decodeURIComponent(String(rawId)) : '1'
|
||||
detail.value = getProjectDetail(id)
|
||||
|
||||
if (!detail.value) {
|
||||
uni.showToast({ title: '项目不存在', icon: 'none' })
|
||||
setTimeout(() => uni.navigateBack(), 1500)
|
||||
}
|
||||
})
|
||||
|
||||
function handleBack() {
|
||||
navigateBackWithFallback('/pages/project-center/index')
|
||||
}
|
||||
|
||||
function handleSelectTab(key: ProjectDetailTab) {
|
||||
activeTab.value = key
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
v-if="detail"
|
||||
class="project-detail"
|
||||
>
|
||||
<view class="project-detail__navbar">
|
||||
<view
|
||||
class="project-detail__back"
|
||||
@tap="handleBack"
|
||||
>
|
||||
<image
|
||||
class="project-detail__back-icon"
|
||||
src="/static/icons/icon-back.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<text class="project-detail__navbar-title">
|
||||
项目详情
|
||||
</text>
|
||||
<view class="project-detail__navbar-placeholder" />
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="project-detail__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="project-detail__content">
|
||||
<view class="project-detail__hero">
|
||||
<image
|
||||
class="project-detail__hero-bg"
|
||||
:src="cardBg"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<view class="project-detail__hero-inner">
|
||||
<view class="project-detail__hero-top">
|
||||
<text class="project-detail__tag">
|
||||
{{ detail.category }}
|
||||
</text>
|
||||
<view class="project-detail__hero-status">
|
||||
<text class="project-detail__status">
|
||||
{{ detail.status }}
|
||||
</text>
|
||||
<text
|
||||
v-if="detail.progress !== undefined"
|
||||
class="project-detail__progress-text"
|
||||
>
|
||||
{{ detail.progress }}%
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="project-detail__title">
|
||||
{{ detail.title }}
|
||||
</text>
|
||||
<text class="project-detail__no">
|
||||
项目编号:{{ detail.projectNo }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="project-detail__tabs"
|
||||
scroll-x
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="project-detail__tabs-inner">
|
||||
<text
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
class="project-detail__tab"
|
||||
:class="{ 'project-detail__tab--active': activeTab === tab.key }"
|
||||
@tap="handleSelectTab(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view
|
||||
v-if="activeTab === 'progress'"
|
||||
class="project-detail__panel"
|
||||
>
|
||||
<view class="project-detail__dev-progress">
|
||||
<text class="project-detail__panel-title">
|
||||
开发进度
|
||||
</text>
|
||||
<view class="project-detail__overall">
|
||||
<text class="project-detail__overall-label">
|
||||
总体进度
|
||||
</text>
|
||||
<text class="project-detail__overall-value">
|
||||
{{ detail.progress ?? 0 }}%
|
||||
</text>
|
||||
</view>
|
||||
<view class="project-detail__slider">
|
||||
<view class="project-detail__slider-track">
|
||||
<view
|
||||
class="project-detail__slider-fill"
|
||||
:style="{ width: `${detail.progress ?? 0}%` }"
|
||||
/>
|
||||
<view
|
||||
class="project-detail__slider-thumb"
|
||||
:style="{ left: `${detail.progress ?? 0}%` }"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="project-detail__dates">
|
||||
<text>开始时间:{{ detail.progressStartTime }}</text>
|
||||
<text>结束时间:{{ detail.progressEndTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="project-detail__timeline">
|
||||
<text class="project-detail__panel-title project-detail__timeline-heading">
|
||||
项目进度(里程碑)
|
||||
</text>
|
||||
<view
|
||||
v-for="(step, index) in detail.steps"
|
||||
:key="step.id"
|
||||
class="project-detail__timeline-item"
|
||||
>
|
||||
<view class="project-detail__timeline-left">
|
||||
<view
|
||||
class="project-detail__timeline-dot"
|
||||
:class="{
|
||||
'project-detail__timeline-dot--done': step.status === 'done',
|
||||
'project-detail__timeline-dot--active': step.status === 'active',
|
||||
'project-detail__timeline-dot--pending': step.status === 'pending',
|
||||
}"
|
||||
>
|
||||
<text
|
||||
v-if="step.status === 'done'"
|
||||
class="project-detail__timeline-check"
|
||||
>
|
||||
✓
|
||||
</text>
|
||||
<text
|
||||
v-else
|
||||
class="project-detail__timeline-index"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="index < detail.steps.length - 1"
|
||||
class="project-detail__timeline-line"
|
||||
:class="{ 'project-detail__timeline-line--done': step.status === 'done' }"
|
||||
/>
|
||||
</view>
|
||||
<view class="project-detail__timeline-body">
|
||||
<text class="project-detail__timeline-title">
|
||||
{{ step.title }}
|
||||
</text>
|
||||
<text
|
||||
v-if="step.time"
|
||||
class="project-detail__timeline-time"
|
||||
>
|
||||
{{ step.time }}
|
||||
</text>
|
||||
<text
|
||||
v-else-if="step.statusText"
|
||||
class="project-detail__timeline-status"
|
||||
:class="{ 'project-detail__timeline-status--active': step.status === 'active' }"
|
||||
>
|
||||
{{ step.statusText }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="project-detail__team">
|
||||
<text class="project-detail__panel-title">
|
||||
项目团队
|
||||
</text>
|
||||
<scroll-view
|
||||
class="project-detail__team-scroll"
|
||||
scroll-x
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="project-detail__team-inner">
|
||||
<view
|
||||
v-for="member in detail.team"
|
||||
:key="member.id"
|
||||
class="project-detail__member"
|
||||
>
|
||||
<view class="project-detail__avatar">
|
||||
<text>{{ member.name.slice(0, 2) }}</text>
|
||||
</view>
|
||||
<text class="project-detail__member-name">
|
||||
{{ member.name }}
|
||||
</text>
|
||||
<text class="project-detail__member-role">
|
||||
{{ member.role }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-else-if="activeTab === 'files'"
|
||||
class="project-detail__panel"
|
||||
>
|
||||
<view class="project-detail__files">
|
||||
<view
|
||||
v-for="file in detail.files"
|
||||
:key="file.id"
|
||||
class="project-detail__file"
|
||||
>
|
||||
<view class="project-detail__file-remove">
|
||||
<image
|
||||
class="project-detail__file-remove-icon"
|
||||
:src="deleteIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<image
|
||||
class="project-detail__file-icon"
|
||||
:src="file.icon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="project-detail__file-name">
|
||||
{{ file.name }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-else-if="activeTab === 'finance'"
|
||||
class="project-detail__panel"
|
||||
>
|
||||
<text class="project-detail__paragraph">
|
||||
{{ detail.financeSummary }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-else
|
||||
class="project-detail__panel"
|
||||
>
|
||||
<text class="project-detail__paragraph">
|
||||
{{ detail.afterSalesSummary }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.project-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background: $color-bg-section;
|
||||
}
|
||||
|
||||
.project-detail__navbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 12rpx) 24rpx 20rpx;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.project-detail__back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.project-detail__back-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.project-detail__navbar-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-detail__navbar-placeholder {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.project-detail__scroll {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.project-detail__content {
|
||||
padding: 24rpx 24rpx calc(32rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.project-detail__hero {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.project-detail__hero-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.project-detail__hero-inner {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 28rpx 24rpx;
|
||||
}
|
||||
|
||||
.project-detail__hero-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.project-detail__tag {
|
||||
padding: 4rpx 12rpx;
|
||||
font-size: 20rpx;
|
||||
color: $color-primary;
|
||||
background: $color-primary-light;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.project-detail__hero-status {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.project-detail__status {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__progress-text {
|
||||
margin-top: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__title {
|
||||
display: block;
|
||||
margin-top: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-detail__no {
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
font-size: 22rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.project-detail__tabs {
|
||||
margin-top: 24rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-detail__tabs-inner {
|
||||
display: inline-flex;
|
||||
gap: 32rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
.project-detail__tab {
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text-secondary;
|
||||
|
||||
&--active {
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
border-bottom: 4rpx solid $color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.project-detail__panel {
|
||||
margin-top: 24rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.project-detail__panel-title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-detail__dev-progress {
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.project-detail__overall {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.project-detail__overall-label {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__overall-value {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
.project-detail__slider {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.project-detail__slider-track {
|
||||
position: relative;
|
||||
height: 8rpx;
|
||||
background: #e8eaef;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.project-detail__slider-fill {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
background: $color-primary;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.project-detail__slider-thumb {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-left: -12rpx;
|
||||
background: $color-bg-page;
|
||||
border: 4rpx solid $color-primary;
|
||||
border-radius: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.project-detail__dates {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__timeline {
|
||||
margin-top: 32rpx;
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
|
||||
.project-detail__timeline-heading {
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.project-detail__timeline-item {
|
||||
display: flex;
|
||||
min-height: 96rpx;
|
||||
}
|
||||
|
||||
.project-detail__timeline-left {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 48rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.project-detail__timeline-dot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
|
||||
&--done {
|
||||
background: $color-primary;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: $color-primary;
|
||||
}
|
||||
|
||||
&--pending {
|
||||
background: $color-bg-page;
|
||||
border: 2rpx solid #d8dde6;
|
||||
}
|
||||
}
|
||||
|
||||
.project-detail__timeline-check {
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.project-detail__timeline-index {
|
||||
font-size: 22rpx;
|
||||
color: #ffffff;
|
||||
|
||||
.project-detail__timeline-dot--pending & {
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
.project-detail__timeline-line {
|
||||
flex: 1;
|
||||
width: 2rpx;
|
||||
min-height: 40rpx;
|
||||
margin-top: 8rpx;
|
||||
background: #e8eaef;
|
||||
|
||||
&--done {
|
||||
background: $color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.project-detail__timeline-body {
|
||||
flex: 1;
|
||||
padding-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.project-detail__timeline-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-detail__timeline-time,
|
||||
.project-detail__timeline-status {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__timeline-status--active {
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
.project-detail__team {
|
||||
margin-top: 32rpx;
|
||||
padding-top: 28rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.project-detail__team-scroll {
|
||||
margin-top: 24rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-detail__team-inner {
|
||||
display: inline-flex;
|
||||
gap: 32rpx;
|
||||
}
|
||||
|
||||
.project-detail__member {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 140rpx;
|
||||
}
|
||||
|
||||
.project-detail__avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
background: $color-primary;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.project-detail__member-name {
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-detail__member-role {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-detail__files {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
padding: 10rpx 10rpx 0 0;
|
||||
}
|
||||
|
||||
.project-detail__file {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 160rpx;
|
||||
padding: 20rpx 16rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.project-detail__file-remove {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -10rpx;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.project-detail__file-remove-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.project-detail__file-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.project-detail__file-name {
|
||||
margin-top: 12rpx;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-primary;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.project-detail__paragraph {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.8;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
</style>
|
||||
@@ -1,41 +1,259 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import AppTabBar from '@/components/AppTabBar.vue'
|
||||
import { DEFAULT_CASE_FILTER } from '@/constants/case-library'
|
||||
import {
|
||||
PROJECT_CATEGORIES,
|
||||
PROJECT_CENTER_LIST,
|
||||
} from '@/constants/project-center'
|
||||
import filterIcon from '@/static/icons/icon-filter.svg'
|
||||
import type { CaseFilterValues } from '@/types/case-library'
|
||||
import type { ProjectCategory } from '@/types/project-center'
|
||||
import { cloneCaseFilter, matchCaseFilter } from '@/utils/case-filter'
|
||||
import CaseFilterPanel from '../case-library/components/CaseFilterPanel.vue'
|
||||
import ProjectCenterCard from './components/ProjectCenterCard.vue'
|
||||
|
||||
const keyword = ref('')
|
||||
const activeCategory = ref<ProjectCategory>('全部')
|
||||
const projectList = ref(PROJECT_CENTER_LIST.map(item => ({ ...item })))
|
||||
const filterVisible = ref(false)
|
||||
const appliedFilter = ref<CaseFilterValues>(cloneCaseFilter(DEFAULT_CASE_FILTER))
|
||||
|
||||
const filteredProjects = computed(() => {
|
||||
const text = keyword.value.trim()
|
||||
|
||||
return projectList.value.filter((item) => {
|
||||
const matchCategory = activeCategory.value === '全部' || item.category === activeCategory.value
|
||||
const matchKeyword = !text
|
||||
|| item.title.includes(text)
|
||||
|| item.category.includes(text)
|
||||
|| item.projectNo.includes(text)
|
||||
|| item.status.includes(text)
|
||||
|| item.industry.includes(text)
|
||||
const matchFilter = matchCaseFilter(item, appliedFilter.value)
|
||||
return matchCategory && matchKeyword && matchFilter
|
||||
})
|
||||
})
|
||||
|
||||
function handleSelectCategory(category: ProjectCategory) {
|
||||
activeCategory.value = category
|
||||
}
|
||||
|
||||
function handleOpenFilter() {
|
||||
filterVisible.value = true
|
||||
}
|
||||
|
||||
function handleCloseFilter() {
|
||||
filterVisible.value = false
|
||||
}
|
||||
|
||||
function handleConfirmFilter(value: CaseFilterValues) {
|
||||
appliedFilter.value = cloneCaseFilter(value)
|
||||
}
|
||||
|
||||
function handleViewDetail(id: string) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/project-center/detail/index?id=${encodeURIComponent(id)}`,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="placeholder-page">
|
||||
<text class="placeholder-page__title">
|
||||
项目中心
|
||||
</text>
|
||||
<text class="placeholder-page__desc">
|
||||
功能开发中
|
||||
</text>
|
||||
<view class="project-center">
|
||||
<view class="project-center__header">
|
||||
<text class="project-center__title">
|
||||
项目中心
|
||||
</text>
|
||||
|
||||
<view class="project-center__search">
|
||||
<image
|
||||
class="project-center__search-icon"
|
||||
src="/static/icons/icon-search.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="project-center__search-input"
|
||||
placeholder="搜索案例标题、描述、标签..."
|
||||
placeholder-class="project-center__search-placeholder"
|
||||
>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="project-center__tabs"
|
||||
scroll-x
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="project-center__tabs-inner">
|
||||
<text
|
||||
v-for="category in PROJECT_CATEGORIES"
|
||||
:key="category"
|
||||
class="project-center__tab"
|
||||
:class="{ 'project-center__tab--active': activeCategory === category }"
|
||||
@tap="handleSelectCategory(category)"
|
||||
>
|
||||
{{ category }}
|
||||
</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="project-center__toolbar">
|
||||
<text class="project-center__count">
|
||||
共 {{ filteredProjects.length }}
|
||||
</text>
|
||||
<view
|
||||
class="project-center__filter"
|
||||
@tap="handleOpenFilter"
|
||||
>
|
||||
<image
|
||||
class="project-center__filter-icon"
|
||||
:src="filterIcon"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="project-center__filter-text">
|
||||
筛选
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="project-center__scroll"
|
||||
scroll-y
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="project-center__list">
|
||||
<ProjectCenterCard
|
||||
v-for="item in filteredProjects"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@detail="handleViewDetail"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<AppTabBar active="project" />
|
||||
|
||||
<CaseFilterPanel
|
||||
:visible="filterVisible"
|
||||
:cases="projectList"
|
||||
:value="appliedFilter"
|
||||
@close="handleCloseFilter"
|
||||
@confirm="handleConfirmFilter"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/variables.scss';
|
||||
|
||||
.placeholder-page {
|
||||
.project-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: $color-bg-section;
|
||||
}
|
||||
|
||||
.project-center__header {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 60rpx) 24rpx 0;
|
||||
background: $color-bg-page;
|
||||
}
|
||||
|
||||
.placeholder-page__title {
|
||||
.project-center__title {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.placeholder-page__desc {
|
||||
margin-top: 16rpx;
|
||||
.project-center__search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 72rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 0 24rpx;
|
||||
background: $color-bg-section;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.project-center__search-icon {
|
||||
flex-shrink: 0;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.project-center__search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: $color-text-primary;
|
||||
}
|
||||
|
||||
.project-center__search-placeholder {
|
||||
color: $color-text-placeholder;
|
||||
}
|
||||
|
||||
.project-center__tabs {
|
||||
margin-top: 24rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-center__tabs-inner {
|
||||
display: inline-flex;
|
||||
gap: 32rpx;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.project-center__tab {
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text-secondary;
|
||||
|
||||
&--active {
|
||||
font-weight: 600;
|
||||
color: $color-text-primary;
|
||||
border-bottom: 4rpx solid $color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.project-center__toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 0 24rpx;
|
||||
}
|
||||
|
||||
.project-center__count {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.project-center__filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.project-center__filter-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.project-center__filter-text {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.project-center__scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.project-center__list {
|
||||
padding: 0 24rpx calc(140rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user