需求:小程序端代码要同时同步到服务器与 git 远程仓库,此前前端仅存在于本地目录(无 remote,从未推送), 服务器与 gitcode 上只有后端。现并入本仓库,复用现有「push 即部署」链路,一次推送双端落地。 - 新增 uniapp/:小程序端源码全量快照(150 文件 / 1.2M) pages(13 页面) · components(fc-navbar/fc-tabbar/fc-post-card/fc-empty) · common(api·utils·mock·assets·store·config) · static(74 图标 + 3 轮播插画 + LOGO) · docs(01-04 交付文档) · tests(零依赖全链路用例) · tools(图标/主题/轮播配图生成脚本) - 明确排除:AGENTS.md(含后台密码、服务器 root 密码、小程序 AppSecret,切勿入库)、 unpackage/(构建产物,由 uniapp/.gitignore 忽略)、node_modules、.DS_Store、*.log - .gitignore 新增 /uniapp/AGENTS.md 兜底(与根 /AGENTS.md、/fluniapp/ 同一约定) - README.md 增补「本项目结构 + 部署链路」章节,说明 uniapp/ 为源码快照、 小程序真正上线仍需微信开发者工具 cli upload 说明:本次为源码快照,未携带前端本地仓库历史——其历史提交中含 AGENTS.md 凭据, 若做 subtree 合并会把密码永久写入本仓库历史,故采用快照方式。
178 行
3.6 KiB
Vue
178 行
3.6 KiB
Vue
<template>
|
|
<view class="msg fc-page">
|
|
<!-- 分类 tab -->
|
|
<view class="msg__tabs">
|
|
<view v-for="t in tabs" :key="t.value" class="msg__tab"
|
|
:class="{ 'msg__tab--active': type === t.value }" @click="changeType(t.value)">
|
|
<text>{{ t.label }}</text>
|
|
<view v-if="type === t.value" class="msg__tab-line"></view>
|
|
</view>
|
|
</view>
|
|
|
|
<fc-empty v-if="!loading && !list.length" icon="inbox" text="暂无消息" />
|
|
|
|
<view v-else class="msg__list">
|
|
<view v-for="m in list" :key="m.id" class="msg__item" :class="{ 'msg__item--unread': !m.read }"
|
|
@click="openMsg(m)">
|
|
<view class="msg__icon">
|
|
<image class="fc-icon--badge-sm" :src="iconUrl(meta(m.type).iconKey)" mode="aspectFit" />
|
|
</view>
|
|
<view class="msg__body">
|
|
<view class="msg__head">
|
|
<text class="msg__title">{{ m.title }}</text>
|
|
<text class="msg__time">{{ timeText(m.createdAt) }}</text>
|
|
</view>
|
|
<text class="msg__content fc-ellipsis-2">{{ m.content }}</text>
|
|
</view>
|
|
<view v-if="!m.read" class="msg__dot"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
|
import messageApi from '@/common/api/message.js'
|
|
import { MESSAGE_TYPE } from '@/common/constants/ui.js'
|
|
import { fromNow } from '@/common/utils/format.js'
|
|
import { iconUrl } from '@/common/store/ui.js'
|
|
|
|
export default {
|
|
components: { FcEmpty },
|
|
data() {
|
|
return {
|
|
type: 'system',
|
|
list: [],
|
|
loading: false,
|
|
tabs: [
|
|
{ label: '系统通知', value: 'system' },
|
|
{ label: '互动消息', value: 'interact' },
|
|
],
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.fetch()
|
|
},
|
|
methods: {
|
|
iconUrl,
|
|
meta(t) {
|
|
return MESSAGE_TYPE[t] || MESSAGE_TYPE.system
|
|
},
|
|
timeText(t) {
|
|
return fromNow(t)
|
|
},
|
|
async fetch() {
|
|
this.loading = true
|
|
try {
|
|
const res = await messageApi.list({ type: this.type, page: 1, size: 20 })
|
|
this.list = res.list
|
|
} catch (e) {
|
|
uni.showToast({ title: '消息加载失败', icon: 'none' })
|
|
} finally {
|
|
this.loading = false
|
|
}
|
|
},
|
|
changeType(v) {
|
|
if (this.type === v) return
|
|
this.type = v
|
|
this.fetch()
|
|
},
|
|
async openMsg(m) {
|
|
if (m.read) return
|
|
m.read = true
|
|
try {
|
|
await messageApi.read(m.id)
|
|
} catch (e) {}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.msg__tabs {
|
|
display: flex;
|
|
background: #ffffff;
|
|
padding: 0 24rpx;
|
|
border-bottom: 2rpx solid $fc-border;
|
|
}
|
|
.msg__tab {
|
|
flex: 1;
|
|
height: 92rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: $fc-font;
|
|
color: $fc-text-secondary;
|
|
&--active {
|
|
color: $fc-primary-text;
|
|
font-weight: 700;
|
|
}
|
|
}
|
|
.msg__tab-line {
|
|
width: 48rpx;
|
|
height: 6rpx;
|
|
border-radius: 3rpx;
|
|
background: $fc-gradient-primary;
|
|
margin-top: 8rpx;
|
|
}
|
|
.msg__list {
|
|
padding: 16rpx 0;
|
|
}
|
|
.msg__item {
|
|
position: relative;
|
|
margin: 16rpx 24rpx;
|
|
padding: 24rpx;
|
|
background: #ffffff;
|
|
border-radius: $fc-radius-lg;
|
|
display: flex;
|
|
box-shadow: $fc-shadow;
|
|
&--unread {
|
|
background: $fc-primary-lighter;
|
|
}
|
|
}
|
|
.msg__icon {
|
|
width: 84rpx;
|
|
height: 84rpx;
|
|
flex: 0 0 84rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.msg__body {
|
|
flex: 1;
|
|
margin-left: 20rpx;
|
|
min-width: 0;
|
|
}
|
|
.msg__head {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
.msg__title {
|
|
font-size: $fc-font-lg;
|
|
font-weight: 600;
|
|
color: $fc-text;
|
|
}
|
|
.msg__time {
|
|
font-size: $fc-font-xs;
|
|
color: $fc-text-placeholder;
|
|
}
|
|
.msg__content {
|
|
display: block;
|
|
margin-top: 10rpx;
|
|
font-size: $fc-font-sm;
|
|
color: $fc-text-regular;
|
|
line-height: 1.5;
|
|
}
|
|
.msg__dot {
|
|
position: absolute;
|
|
top: 24rpx;
|
|
right: 24rpx;
|
|
width: 16rpx;
|
|
height: 16rpx;
|
|
border-radius: 50%;
|
|
background: $fc-primary;
|
|
}
|
|
</style>
|