260720
This commit is contained in:
355
pages/mine/declare.vue
Normal file
355
pages/mine/declare.vue
Normal file
@@ -0,0 +1,355 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view class="hero-card">
|
||||
<view class="hero-title">我的申报</view>
|
||||
<view class="hero-desc">汇总本地草稿、已提交记录和当前开放的申报项目。</view>
|
||||
<view class="hero-stats">
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ localRecords.length }}</view>
|
||||
<view class="stat-label">本地记录</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ submittedCount }}</view>
|
||||
<view class="stat-label">已提交</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ openDeclareList.length }}</view>
|
||||
<view class="stat-label">开放项目</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-card">
|
||||
<view class="section-head">
|
||||
<view class="section-title">本地申报记录</view>
|
||||
<view class="section-action" @tap="loadData()">刷新</view>
|
||||
</view>
|
||||
<view v-if="!localRecords.length" class="empty-block">
|
||||
当前还没有本地草稿或提交记录,可先前往申报页填写。
|
||||
</view>
|
||||
<view v-else class="card-list">
|
||||
<view v-for="item in localRecords" :key="item.key" class="data-card">
|
||||
<view class="card-top">
|
||||
<view class="card-main">
|
||||
<view class="card-title">{{ item.title }}</view>
|
||||
<view class="card-subtitle">{{ item.year || '未设置年度' }} · {{ item.group }}</view>
|
||||
</view>
|
||||
<view class="status-tag" :class="item.status === '已提交' ? 'status-tag--success' : 'status-tag--warning'">
|
||||
{{ item.status }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="meta-row">保存时间:{{ item.savedAt || '-' }}</view>
|
||||
<view class="card-actions">
|
||||
<view class="card-action" @tap="continueEdit(item)">继续编辑</view>
|
||||
<view class="card-action" @tap="copyText(item.title)">复制标题</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-card">
|
||||
<view class="section-head">
|
||||
<view class="section-title">当前开放项目</view>
|
||||
<view class="section-action" @tap="goDeclareList">全部查看</view>
|
||||
</view>
|
||||
<view v-if="loading" class="empty-block">正在加载开放项目...</view>
|
||||
<view v-else-if="errorText" class="empty-block empty-block--error">{{ errorText }}</view>
|
||||
<view v-else-if="!openDeclareList.length" class="empty-block">当前暂无开放的申报项目。</view>
|
||||
<view v-else class="card-list">
|
||||
<view v-for="item in openDeclareList" :key="item.id || `${item.module}-${item.year}`" class="data-card">
|
||||
<view class="card-top">
|
||||
<view class="card-main">
|
||||
<view class="card-title">{{ getDeclareTitle(item) }}</view>
|
||||
<view class="card-subtitle">{{ getDeclareGroup(item.module) }} · {{ item.year || '未设置年度' }}</view>
|
||||
</view>
|
||||
<view class="status-tag status-tag--default">可申报</view>
|
||||
</view>
|
||||
<view class="meta-row">时间范围:{{ formatDateTime(item.startTime) }} 至 {{ formatDateTime(item.endTime) }}</view>
|
||||
<view class="card-actions">
|
||||
<view class="card-action" @tap="goApply(item)">进入申报</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
formatDateTime,
|
||||
getLocalDeclareRecords,
|
||||
listAvailableDeclare
|
||||
} from './service'
|
||||
import { getFormConfig, getModuleMeta } from '../../utils/gxmu/config'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
errorText: '',
|
||||
localRecords: [],
|
||||
openDeclareList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
submittedCount() {
|
||||
return this.localRecords.filter((item) => item.status === '已提交').length
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.loadData()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loadData(true)
|
||||
},
|
||||
methods: {
|
||||
formatDateTime,
|
||||
getDeclareTitle(item) {
|
||||
return String(item.title || '').trim() || this.getDeclareGroup(item.module)
|
||||
},
|
||||
getDeclareGroup(module) {
|
||||
const meta = getModuleMeta(module)
|
||||
return (meta && meta.title) || module || '申报项目'
|
||||
},
|
||||
async loadData(fromPullDown = false) {
|
||||
this.localRecords = getLocalDeclareRecords()
|
||||
this.loading = true
|
||||
this.errorText = ''
|
||||
try {
|
||||
const result = await listAvailableDeclare({ usable: true })
|
||||
const list = Array.isArray(result) ? result : []
|
||||
this.openDeclareList = list.sort((left, right) => Number(right.year || 0) - Number(left.year || 0))
|
||||
} catch (error) {
|
||||
this.errorText = (error && error.message) || '开放项目加载失败'
|
||||
} finally {
|
||||
this.loading = false
|
||||
if (fromPullDown) {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
continueEdit(item) {
|
||||
uni.navigateTo({
|
||||
url: item.route
|
||||
})
|
||||
},
|
||||
copyText(value) {
|
||||
uni.setClipboardData({
|
||||
data: String(value || ''),
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goDeclareList() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gxmu/index'
|
||||
})
|
||||
},
|
||||
goApply(item) {
|
||||
if (!item.module || !getFormConfig(item.module)) {
|
||||
uni.showToast({
|
||||
title: '当前申报项目在小程序端暂未配置',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
const moduleMeta = getModuleMeta(item.module)
|
||||
const title = String(item.title || '').trim() || ((moduleMeta && moduleMeta.title) || '申报表')
|
||||
uni.navigateTo({
|
||||
url: `/pages/gxmu/form?code=${encodeURIComponent(item.module)}&year=${encodeURIComponent(item.year || '')}&declareTitle=${encodeURIComponent(title)}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(circle at top center, rgba(20, 150, 242, 0.1), transparent 30%),
|
||||
linear-gradient(180deg, #f5fbff 0%, #eef7ff 100%);
|
||||
}
|
||||
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
padding: 24rpx 24rpx 40rpx;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.section-card,
|
||||
.data-card {
|
||||
border-radius: 30rpx;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
border: 1rpx solid rgba(20, 150, 242, 0.08);
|
||||
box-shadow: 0 10rpx 28rpx rgba(34, 94, 142, 0.08);
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
padding: 32rpx 28rpx;
|
||||
background: linear-gradient(145deg, #0d6fba 0%, #1496f2 58%, #5bc2ff 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-desc {
|
||||
margin-top: 14rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
color: rgba(255, 255, 255, 0.86);
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 18rpx 16rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.section-card {
|
||||
margin-top: 24rpx;
|
||||
padding: 26rpx;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
.section-action {
|
||||
font-size: 22rpx;
|
||||
color: #1496f2;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.empty-block {
|
||||
margin-top: 18rpx;
|
||||
padding: 26rpx 22rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #faf5f2;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.75;
|
||||
color: #7b726d;
|
||||
}
|
||||
|
||||
.empty-block--error {
|
||||
color: #0f7dd1;
|
||||
}
|
||||
|
||||
.card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.data-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.card-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #22272f;
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.meta-row {
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #faf7f2;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.75;
|
||||
color: #5f564f;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 10rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-tag--success {
|
||||
background: #eef9f1;
|
||||
color: #1f8f49;
|
||||
}
|
||||
|
||||
.status-tag--warning {
|
||||
background: #fff8e6;
|
||||
color: #ad7b00;
|
||||
}
|
||||
|
||||
.status-tag--default {
|
||||
background: #f5f5f5;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(20, 150, 242, 0.08);
|
||||
color: #1496f2;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
</style>
|
||||
501
pages/mine/index.vue
Normal file
501
pages/mine/index.vue
Normal file
@@ -0,0 +1,501 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<common-hero title="我的">
|
||||
|
||||
<view class="hero-content">
|
||||
<view class="profile-card">
|
||||
<view class="profile-top">
|
||||
<image v-if="profile.avatar" class="avatar-image" :src="profile.avatar" mode="aspectFill" />
|
||||
<view v-else class="avatar">{{ avatarText }}</view>
|
||||
<view class="profile-main">
|
||||
<view class="profile-name">{{ displayName }}</view>
|
||||
<view class="profile-role">{{ profileRole }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="profile-stats">
|
||||
<view v-for="item in stats" :key="item.label" class="profile-stat">
|
||||
<view class="profile-stat-value">{{ item.value }}</view>
|
||||
<view class="profile-stat-label">{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-btn" @click="handleLogout">退出登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</common-hero>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">常用入口</view>
|
||||
<view class="entry-grid">
|
||||
<view
|
||||
v-for="item in visibleEntries"
|
||||
:key="item.title"
|
||||
class="entry-card"
|
||||
@click="openEntry(item)"
|
||||
>
|
||||
<view class="entry-icon">{{ item.icon }}</view>
|
||||
<view class="entry-title">{{ item.title }}</view>
|
||||
<view class="entry-desc">{{ item.desc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">最近状态</view>
|
||||
<view class="status-list">
|
||||
<view v-for="item in statusList" :key="item.title" class="status-card" @click="openStatus(item)">
|
||||
<view class="status-main">
|
||||
<view class="status-name">{{ item.title }}</view>
|
||||
<view class="status-desc">{{ item.desc }}</view>
|
||||
</view>
|
||||
<view class="status-tag">{{ item.tag }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CommonHero from '../../components/common-hero/common-hero.vue'
|
||||
import {
|
||||
ensureLoggedIn,
|
||||
getCurrentUser,
|
||||
getLocalProfileOverride,
|
||||
getLocalDeclareRecords,
|
||||
getManuscriptStatusMeta,
|
||||
getReviewStatusMeta,
|
||||
getUserProfile,
|
||||
listManuscript,
|
||||
logout,
|
||||
userPageQmgcForm
|
||||
} from './service'
|
||||
import { hasReviewListAuthority } from '../../utils/gxmu/review-list-service'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CommonHero
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
profile: {
|
||||
nickname: '',
|
||||
realName: '',
|
||||
username: '',
|
||||
avatar: '',
|
||||
organizationName: '',
|
||||
tenantName: '',
|
||||
merchantName: '',
|
||||
roles: []
|
||||
},
|
||||
manuscriptList: [],
|
||||
qingmaList: [],
|
||||
declareList: [],
|
||||
hasReviewListPermission: false,
|
||||
entries: [
|
||||
{
|
||||
title: '用户资料',
|
||||
desc: '查看账号信息、组织身份和联系方式。',
|
||||
icon: '资',
|
||||
route: '/packageMine/profile'
|
||||
},
|
||||
{
|
||||
title: '我的“青马”',
|
||||
desc: '管理学员培养计划、考核与成长档案。',
|
||||
icon: '青',
|
||||
route: '/packageMine/qingma'
|
||||
},
|
||||
{
|
||||
title: '我的稿件',
|
||||
desc: '汇总我创建或参与编辑的全部稿件。',
|
||||
icon: '稿',
|
||||
route: '/packageMine/manuscripts'
|
||||
},
|
||||
{
|
||||
title: '我的申报',
|
||||
desc: '查看项目进度、待补材料与审核状态。',
|
||||
icon: '报',
|
||||
route: '/packageMine/declare'
|
||||
},
|
||||
{
|
||||
title: '审核列表',
|
||||
desc: '聚合查看业务数据、审核流并处理待审事项。',
|
||||
icon: '审',
|
||||
route: '/pages/gxmu/review-list',
|
||||
authority: 'gxmu:reviewList:list'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayName() {
|
||||
return this.profile.nickname || this.profile.realName || this.profile.username || '未登录用户'
|
||||
},
|
||||
avatarText() {
|
||||
return (this.displayName || '我').slice(0, 2)
|
||||
},
|
||||
profileRole() {
|
||||
const roles = Array.isArray(this.profile.roles) ? this.profile.roles : []
|
||||
if (roles.length) {
|
||||
return roles.map((item) => item.roleName).filter(Boolean).join(' / ')
|
||||
}
|
||||
return '校级团委数字工作台'
|
||||
},
|
||||
profileOrg() {
|
||||
return this.profile.organizationName || this.profile.merchantName || this.profile.tenantName || '暂无组织信息'
|
||||
},
|
||||
stats() {
|
||||
return [
|
||||
{ value: `${this.manuscriptList.length}`, label: '我的稿件' },
|
||||
{ value: `${this.declareList.length}`, label: '我的申报' },
|
||||
{ value: `${this.qingmaList.length}`, label: '我的“青马”' }
|
||||
]
|
||||
},
|
||||
visibleEntries() {
|
||||
return this.entries.filter((item) => {
|
||||
if (item.authority === 'gxmu:reviewList:list') {
|
||||
return this.hasReviewListPermission
|
||||
}
|
||||
return true
|
||||
})
|
||||
},
|
||||
statusList() {
|
||||
const manuscript = this.manuscriptList[0]
|
||||
const qingma = this.qingmaList[0]
|
||||
const declare = this.declareList[0]
|
||||
return [
|
||||
{
|
||||
title: '我的申报',
|
||||
desc: declare ? `${declare.title}${declare.year ? ` · ${declare.year}` : ''},上次保存于 ${declare.savedAt || '刚刚'}` : '当前暂无本地申报记录,可前往五四评优页开始填写。',
|
||||
tag: declare ? declare.status : '待创建',
|
||||
route: '/packageMine/declare'
|
||||
},
|
||||
{
|
||||
title: '我的“青马”',
|
||||
desc: qingma ? `${qingma.name || '当前学员'} · ${qingma.schoolInfo || '暂无院系信息'}` : '当前暂无青马记录,可前往申报页查看开放项目。',
|
||||
tag: qingma ? getReviewStatusMeta(qingma.reviewList).text : '待处理',
|
||||
route: '/packageMine/qingma'
|
||||
},
|
||||
{
|
||||
title: '我的稿件',
|
||||
desc: manuscript ? `${manuscript.title || '未命名稿件'} · 最近更新时间 ${manuscript.updateTime || manuscript.createTime || '-'}` : '当前暂无稿件记录,可前往文稿工作台开始创作。',
|
||||
tag: manuscript ? getManuscriptStatusMeta(manuscript).text : '待更新',
|
||||
route: '/packageMine/manuscripts'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (!ensureLoggedIn({ redirectUrl: '/pages/mine/index' })) {
|
||||
return
|
||||
}
|
||||
this.loadOverview()
|
||||
},
|
||||
methods: {
|
||||
showToast(title) {
|
||||
uni.showToast({
|
||||
title,
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
async loadOverview() {
|
||||
const currentUser = getCurrentUser()
|
||||
this.hasReviewListPermission = false
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
...currentUser
|
||||
}
|
||||
const localOverride = getLocalProfileOverride(currentUser.userId)
|
||||
if (localOverride.nickname !== undefined) {
|
||||
this.profile.nickname = String(localOverride.nickname || '').trim()
|
||||
}
|
||||
if (localOverride.realName !== undefined) {
|
||||
this.profile.realName = String(localOverride.realName || '').trim()
|
||||
}
|
||||
if (localOverride.sex !== undefined || localOverride.sexName !== undefined) {
|
||||
const nextGender = String(localOverride.sexName || localOverride.sex || '').trim()
|
||||
this.profile.sex = nextGender
|
||||
this.profile.sexName = nextGender
|
||||
}
|
||||
this.declareList = getLocalDeclareRecords()
|
||||
try {
|
||||
const [profile, manuscripts, qingmaResult] = await Promise.all([
|
||||
getUserProfile().catch(() => null),
|
||||
listManuscript().catch(() => []),
|
||||
userPageQmgcForm({ page: 1, limit: 5 }).catch(() => ({ list: [] }))
|
||||
])
|
||||
if (profile) {
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
...profile
|
||||
}
|
||||
this.hasReviewListPermission = hasReviewListAuthority(profile)
|
||||
const latestOverride = getLocalProfileOverride(this.profile.userId || currentUser.userId)
|
||||
if (latestOverride.nickname !== undefined) {
|
||||
this.profile.nickname = String(latestOverride.nickname || '').trim()
|
||||
}
|
||||
if (latestOverride.realName !== undefined) {
|
||||
this.profile.realName = String(latestOverride.realName || '').trim()
|
||||
}
|
||||
if (latestOverride.sex !== undefined || latestOverride.sexName !== undefined) {
|
||||
const nextGender = String(latestOverride.sexName || latestOverride.sex || '').trim()
|
||||
this.profile.sex = nextGender
|
||||
this.profile.sexName = nextGender
|
||||
}
|
||||
}
|
||||
const userId = Number(currentUser.userId || this.profile.userId || 0)
|
||||
const list = Array.isArray(manuscripts) ? manuscripts : []
|
||||
this.manuscriptList = userId ? list.filter((item) => Number(item.userId) === userId) : list
|
||||
this.qingmaList = (qingmaResult && qingmaResult.list) || []
|
||||
} catch (error) {
|
||||
console.warn('mine overview load failed', error)
|
||||
}
|
||||
},
|
||||
handleLogout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出当前登录账号?',
|
||||
success: ({ confirm }) => {
|
||||
if (!confirm) {
|
||||
return
|
||||
}
|
||||
logout()
|
||||
this.showToast('已退出登录')
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/index?redirect=%2Fpages%2Fmine%2Findex'
|
||||
})
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
},
|
||||
openEntry(item) {
|
||||
if (item.route) {
|
||||
uni.navigateTo({
|
||||
url: item.route
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: `${item.title}待接入`,
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
openStatus(item) {
|
||||
if (item.route) {
|
||||
uni.navigateTo({
|
||||
url: item.route
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(180deg, #f8fbff 0%, #edf3f8 32%, #f7f7f8 100%);
|
||||
}
|
||||
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 20rpx 24rpx 0;
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
padding: 34rpx 30rpx;
|
||||
border-radius: 32rpx;
|
||||
background: linear-gradient(145deg, #0d6fba 0%, #1496f2 58%, #5bc2ff 100%);
|
||||
box-shadow: 0 18rpx 40rpx rgba(20, 118, 194, 0.18);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.profile-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar,
|
||||
.avatar-image {
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 32rpx;
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-main {
|
||||
margin-left: 22rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.profile-name {
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-role {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.84);
|
||||
}
|
||||
|
||||
.profile-org {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.profile-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
margin-top: 22rpx;
|
||||
height: 76rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(11, 34, 58, 0.18);
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
line-height: 76rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.profile-stat {
|
||||
padding: 20rpx 16rpx;
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.profile-stat-value {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-stat-label {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-top: 30rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
padding: 0 6rpx;
|
||||
margin-bottom: 18rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
.entry-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.entry-card,
|
||||
.status-card {
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
border: 1rpx solid rgba(20, 150, 242, 0.08);
|
||||
box-shadow: 0 10rpx 28rpx rgba(34, 94, 142, 0.08);
|
||||
}
|
||||
|
||||
.entry-card {
|
||||
padding: 24rpx;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
|
||||
.entry-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(20, 150, 242, 0.1);
|
||||
color: #1496f2;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.entry-title {
|
||||
margin-top: 18rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #262a31;
|
||||
}
|
||||
|
||||
.entry-desc {
|
||||
margin-top: 10rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #7a706b;
|
||||
}
|
||||
|
||||
.status-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.status-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
|
||||
.status-main {
|
||||
flex: 1;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.status-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #23272f;
|
||||
}
|
||||
|
||||
.status-desc {
|
||||
margin-top: 10rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #7c736e;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 12rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #eaf5ff;
|
||||
color: #1496f2;
|
||||
font-size: 22rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
422
pages/mine/manuscripts.vue
Normal file
422
pages/mine/manuscripts.vue
Normal file
@@ -0,0 +1,422 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view class="hero-card">
|
||||
<view class="hero-title">我的稿件</view>
|
||||
<view class="hero-desc">汇总当前账号创建或参与的稿件记录,可查看状态和内容摘要。</view>
|
||||
<view class="hero-stats">
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ manuscripts.length }}</view>
|
||||
<view class="stat-label">稿件总数</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ publishedCount }}</view>
|
||||
<view class="stat-label">已通过/发布</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ pendingCount }}</view>
|
||||
<view class="stat-label">待处理</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="toolbar-card">
|
||||
<uv-input
|
||||
v-model="keyword"
|
||||
class="search-input"
|
||||
placeholder="搜索稿件标题或内容"
|
||||
placeholder-style="color: #c0c4cc;"
|
||||
:maxlength="-1"
|
||||
/>
|
||||
<view class="toolbar-actions">
|
||||
<view class="toolbar-btn" @tap="loadData()">刷新</view>
|
||||
<view class="toolbar-btn toolbar-btn--primary" @tap="goCreate">去创作</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="loading" class="state-card">
|
||||
<view class="state-title">正在加载稿件...</view>
|
||||
<view class="state-desc">请稍候,正在同步当前账号的稿件记录。</view>
|
||||
</view>
|
||||
<view v-else-if="errorText" class="state-card state-card--error">
|
||||
<view class="state-title">加载失败</view>
|
||||
<view class="state-desc">{{ errorText }}</view>
|
||||
</view>
|
||||
<view v-else-if="!filteredList.length" class="state-card">
|
||||
<view class="state-title">暂无稿件</view>
|
||||
<view class="state-desc">当前账号还没有可展示的稿件,可前往文稿工作台开始生成。</view>
|
||||
</view>
|
||||
<view v-else class="card-list">
|
||||
<view v-for="item in filteredList" :key="item.id || item.title" class="data-card">
|
||||
<view class="card-top">
|
||||
<view class="card-main">
|
||||
<view class="card-title">{{ item.title || '未命名稿件' }}</view>
|
||||
<view class="card-subtitle">
|
||||
创建时间:{{ formatDateTime(item.createTime) }} · 更新时间:{{ formatDateTime(item.updateTime) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-tag" :class="`status-tag--${getStatusMeta(item).tone}`">
|
||||
{{ getStatusMeta(item).text }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.cover" class="cover-wrap">
|
||||
<image class="cover-image" :src="item.cover" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="content-preview">{{ getContentPreview(item.content) }}</view>
|
||||
<view class="card-actions">
|
||||
<view class="card-action" @tap="toggleExpand(item)">{{ expandedId === item.id ? '收起内容' : '查看内容' }}</view>
|
||||
<view class="card-action" @tap="copyTitle(item.title)">复制标题</view>
|
||||
</view>
|
||||
<view v-if="expandedId === item.id" class="content-detail">{{ item.content || '暂无正文内容' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
formatDateTime,
|
||||
getCurrentUser,
|
||||
getManuscriptStatusMeta,
|
||||
listManuscript
|
||||
} from './service'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
errorText: '',
|
||||
keyword: '',
|
||||
expandedId: null,
|
||||
manuscripts: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredList() {
|
||||
const keyword = String(this.keyword || '').trim().toLowerCase()
|
||||
if (!keyword) {
|
||||
return this.manuscripts
|
||||
}
|
||||
return this.manuscripts.filter((item) => {
|
||||
return (
|
||||
String(item.title || '').toLowerCase().includes(keyword) ||
|
||||
String(item.content || '').toLowerCase().includes(keyword)
|
||||
)
|
||||
})
|
||||
},
|
||||
publishedCount() {
|
||||
return this.manuscripts.filter((item) => {
|
||||
const text = this.getStatusMeta(item).text
|
||||
return text === '通过' || text === '已发布'
|
||||
}).length
|
||||
},
|
||||
pendingCount() {
|
||||
return this.manuscripts.length - this.publishedCount
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.loadData()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loadData(true)
|
||||
},
|
||||
methods: {
|
||||
formatDateTime,
|
||||
getStatusMeta(item) {
|
||||
return getManuscriptStatusMeta(item)
|
||||
},
|
||||
getContentPreview(content) {
|
||||
const text = String(content || '').replace(/\s+/g, ' ').trim()
|
||||
return text ? `${text.slice(0, 90)}${text.length > 90 ? '...' : ''}` : '暂无内容摘要'
|
||||
},
|
||||
async loadData(fromPullDown = false) {
|
||||
this.loading = true
|
||||
this.errorText = ''
|
||||
try {
|
||||
const user = getCurrentUser()
|
||||
const result = await listManuscript()
|
||||
const list = Array.isArray(result) ? result : []
|
||||
this.manuscripts = list
|
||||
.filter((item) => !user.userId || Number(item.userId) === Number(user.userId))
|
||||
.sort((left, right) => {
|
||||
const leftTime = new Date(String((left.updateTime || left.createTime || '')).replace(/-/g, '/')).getTime()
|
||||
const rightTime = new Date(String((right.updateTime || right.createTime || '')).replace(/-/g, '/')).getTime()
|
||||
return (Number.isNaN(rightTime) ? 0 : rightTime) - (Number.isNaN(leftTime) ? 0 : leftTime)
|
||||
})
|
||||
} catch (error) {
|
||||
this.errorText = (error && error.message) || '稿件加载失败'
|
||||
} finally {
|
||||
this.loading = false
|
||||
if (fromPullDown) {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
toggleExpand(item) {
|
||||
this.expandedId = this.expandedId === item.id ? null : item.id
|
||||
},
|
||||
copyTitle(title) {
|
||||
if (!title) {
|
||||
uni.showToast({
|
||||
title: '暂无标题可复制',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: title,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '标题已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goCreate() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/manuscript/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(circle at top center, rgba(240, 122, 61, 0.1), transparent 30%),
|
||||
linear-gradient(180deg, #fff8f2 0%, #f8f2ec 100%);
|
||||
}
|
||||
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
padding: 24rpx 24rpx 40rpx;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.toolbar-card,
|
||||
.state-card,
|
||||
.data-card {
|
||||
border-radius: 30rpx;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
border: 1rpx solid rgba(240, 122, 61, 0.08);
|
||||
box-shadow: 0 10rpx 28rpx rgba(76, 49, 35, 0.08);
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
padding: 32rpx 28rpx;
|
||||
background: linear-gradient(145deg, #7c2f04 0%, #c8641f 56%, #f29a4b 100%);
|
||||
color: #fffaf5;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-desc {
|
||||
margin-top: 14rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
color: rgba(255, 250, 245, 0.86);
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 18rpx 16rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 250, 245, 0.8);
|
||||
}
|
||||
|
||||
.toolbar-card {
|
||||
margin-top: 24rpx;
|
||||
padding: 22rpx;
|
||||
}
|
||||
|
||||
:deep(.search-input.uv-input) {
|
||||
width: 100%;
|
||||
min-height: 84rpx;
|
||||
padding: 0 22rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1px solid #dcdfe6;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:deep(.search-input.uv-input .uv-input__content__field-wrapper__field) {
|
||||
height: 84rpx;
|
||||
min-height: 84rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 84rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.toolbar-actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.toolbar-btn {
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #edf6ff;
|
||||
color: #0f7dd1;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.toolbar-btn--primary {
|
||||
background: linear-gradient(135deg, #0f7dd1 0%, #1496f2 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.state-card {
|
||||
margin-top: 24rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
}
|
||||
|
||||
.state-card--error {
|
||||
border-color: rgba(20, 150, 242, 0.16);
|
||||
}
|
||||
|
||||
.state-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #20252c;
|
||||
}
|
||||
|
||||
.state-desc {
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.75;
|
||||
color: #786e69;
|
||||
}
|
||||
|
||||
.card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.data-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.card-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #22272f;
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 10rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-tag--success {
|
||||
background: #eef9f1;
|
||||
color: #1f8f49;
|
||||
}
|
||||
|
||||
.status-tag--danger {
|
||||
background: #fff1f0;
|
||||
color: #d4380d;
|
||||
}
|
||||
|
||||
.status-tag--warning {
|
||||
background: #fff8e6;
|
||||
color: #ad7b00;
|
||||
}
|
||||
|
||||
.status-tag--default {
|
||||
background: #f5f5f5;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.cover-wrap {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.cover-image {
|
||||
width: 100%;
|
||||
height: 260rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.content-preview,
|
||||
.content-detail {
|
||||
margin-top: 18rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.8;
|
||||
color: #5d544f;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.content-detail {
|
||||
padding: 20rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #fbf7f3;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(240, 122, 61, 0.08);
|
||||
color: #c8641f;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
</style>
|
||||
566
pages/mine/profile.vue
Normal file
566
pages/mine/profile.vue
Normal file
@@ -0,0 +1,566 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view class="section-card">
|
||||
<view class="section-title">基础信息</view>
|
||||
<view class="info-list">
|
||||
<!-- <view class="info-item info-item--form">-->
|
||||
<!-- <view class="info-main">-->
|
||||
<!-- <view class="info-label">登录账号</view>-->
|
||||
<!-- <view class="info-value">{{ profile.username || '-' }}</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<view class="info-item info-item--form">
|
||||
<view class="info-main">
|
||||
<view class="info-label">姓名</view>
|
||||
<uv-input
|
||||
class="info-input"
|
||||
:value="editingRealName"
|
||||
maxlength="20"
|
||||
placeholder="请输入姓名"
|
||||
placeholder-style="color: #b2a7a1;"
|
||||
border="none"
|
||||
@input="handleRealNameInput"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item info-item--form">
|
||||
<view class="info-main">
|
||||
<view class="info-label">昵称</view>
|
||||
<uv-input
|
||||
class="info-input"
|
||||
:value="editingNickname"
|
||||
maxlength="20"
|
||||
placeholder="请输入昵称"
|
||||
placeholder-style="color: #b2a7a1;"
|
||||
border="none"
|
||||
@input="handleNicknameInput"
|
||||
/>
|
||||
</view>
|
||||
<view class="info-action" @tap="fillWechatNickname">读取微信昵称</view>
|
||||
</view>
|
||||
<view class="info-item info-item--form">
|
||||
<view class="info-main">
|
||||
<view class="info-label">性别</view>
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="genderOptions"
|
||||
:value="genderIndex"
|
||||
@change="handleGenderChange"
|
||||
>
|
||||
<view class="info-input info-input--picker">
|
||||
{{ editingGender || '请选择性别' }}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item info-item--form">
|
||||
<view class="info-main">
|
||||
<view class="info-label">手机号码</view>
|
||||
<view class="info-value">{{ profile.phone || '-' }}</view>
|
||||
</view>
|
||||
<view v-if="profile.phone" class="info-action" @tap="copyText(profile.phone)">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-actions">
|
||||
<view class="nickname-btn nickname-btn--primary" @tap="saveProfileBasic">保存基础信息</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCurrentUser,
|
||||
getLocalProfileOverride,
|
||||
getUserProfile,
|
||||
saveLocalProfileOverride,
|
||||
updateUserProfileData
|
||||
} from './service'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
editingNickname: '',
|
||||
editingRealName: '',
|
||||
editingGender: '',
|
||||
genderOptions: ['男', '女', '未知'],
|
||||
profile: {
|
||||
userId: '',
|
||||
nickname: '',
|
||||
realName: '',
|
||||
username: '',
|
||||
avatar: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
organizationName: '',
|
||||
tenantName: '',
|
||||
merchantName: '',
|
||||
sexName: '',
|
||||
sex: '',
|
||||
address: '',
|
||||
province: '',
|
||||
city: '',
|
||||
region: '',
|
||||
introduction: '',
|
||||
roles: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayName() {
|
||||
return this.profile.nickname || this.profile.realName || this.profile.username || '未命名用户'
|
||||
},
|
||||
roleText() {
|
||||
const roles = Array.isArray(this.profile.roles) ? this.profile.roles : []
|
||||
if (roles.length) {
|
||||
return roles.map((item) => item.roleName).filter(Boolean).join(' / ')
|
||||
}
|
||||
return '暂无角色信息'
|
||||
},
|
||||
organizationText() {
|
||||
return this.profile.organizationName || this.profile.merchantName || this.profile.tenantName || '暂无组织信息'
|
||||
},
|
||||
avatarText() {
|
||||
return (this.displayName || '我').slice(0, 2)
|
||||
},
|
||||
genderIndex() {
|
||||
const index = this.genderOptions.indexOf(this.editingGender)
|
||||
return index > -1 ? index : 0
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.loadProfile()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loadProfile(true)
|
||||
},
|
||||
methods: {
|
||||
getProfileUserId() {
|
||||
return Number(this.profile.userId || getCurrentUser().userId || 0) || ''
|
||||
},
|
||||
applyLocalProfileOverride() {
|
||||
const override = getLocalProfileOverride(this.getProfileUserId())
|
||||
if (override.nickname !== undefined) {
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
nickname: String(override.nickname || '').trim()
|
||||
}
|
||||
}
|
||||
if (override.realName !== undefined) {
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
realName: String(override.realName || '').trim()
|
||||
}
|
||||
}
|
||||
if (override.sex !== undefined || override.sexName !== undefined) {
|
||||
const nextGender = String(override.sexName || override.sex || '').trim()
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
sex: nextGender,
|
||||
sexName: nextGender
|
||||
}
|
||||
}
|
||||
this.editingNickname = this.profile.nickname || ''
|
||||
this.editingRealName = this.profile.realName || ''
|
||||
this.editingGender = this.profile.sexName || this.profile.sex || ''
|
||||
},
|
||||
async loadProfile(fromPullDown = false) {
|
||||
try {
|
||||
const tokenUser = getCurrentUser()
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
...tokenUser
|
||||
}
|
||||
const result = await getUserProfile()
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
...(result || {})
|
||||
}
|
||||
this.applyLocalProfileOverride()
|
||||
} catch (error) {
|
||||
this.applyLocalProfileOverride()
|
||||
if (fromPullDown) {
|
||||
uni.showToast({
|
||||
title: (error && error.message) || '用户资料加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
if (fromPullDown) {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
handleNicknameInput(event) {
|
||||
const value = typeof event === 'string' ? event : (event.detail && event.detail.value) || ''
|
||||
this.editingNickname = String(value || '')
|
||||
},
|
||||
handleRealNameInput(event) {
|
||||
const value = typeof event === 'string' ? event : (event.detail && event.detail.value) || ''
|
||||
this.editingRealName = String(value || '')
|
||||
},
|
||||
handleGenderChange(event) {
|
||||
const index = Number((event.detail && event.detail.value) || 0)
|
||||
this.editingGender = this.genderOptions[index] || ''
|
||||
},
|
||||
async saveProfileBasic() {
|
||||
const nickname = String(this.editingNickname || '').trim()
|
||||
const realName = String(this.editingRealName || '').trim()
|
||||
const gender = String(this.editingGender || '').trim()
|
||||
try {
|
||||
await updateUserProfileData({
|
||||
userId: this.getProfileUserId() || undefined,
|
||||
nickname,
|
||||
realName,
|
||||
sex: gender,
|
||||
sexName: gender
|
||||
})
|
||||
this.profile = {
|
||||
...this.profile,
|
||||
nickname,
|
||||
realName,
|
||||
sex: gender,
|
||||
sexName: gender
|
||||
}
|
||||
this.editingNickname = nickname
|
||||
this.editingRealName = realName
|
||||
this.editingGender = gender
|
||||
saveLocalProfileOverride(this.getProfileUserId(), {
|
||||
nickname,
|
||||
realName,
|
||||
sex: gender,
|
||||
sexName: gender
|
||||
})
|
||||
uni.showToast({
|
||||
title: '资料已保存',
|
||||
icon: 'none'
|
||||
})
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: (error && error.message) || '保存失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fillWechatNickname() {
|
||||
// #ifdef MP-WEIXIN
|
||||
const assignNickname = (userInfo) => {
|
||||
const nickname = String((userInfo && (userInfo.nickName || userInfo.nickname)) || '').trim()
|
||||
if (!nickname) {
|
||||
uni.showToast({
|
||||
title: '未读取到微信昵称',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.editingNickname = nickname
|
||||
uni.showToast({
|
||||
title: '已读取微信昵称',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
if (typeof uni.getUserProfile === 'function') {
|
||||
uni.getUserProfile({
|
||||
desc: '用于完善用户昵称',
|
||||
success: (res) => {
|
||||
assignNickname(res && res.userInfo)
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '未授权读取微信昵称',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof uni.getUserInfo === 'function') {
|
||||
uni.getUserInfo({
|
||||
success: (res) => {
|
||||
assignNickname(res && res.userInfo)
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '读取微信昵称失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: '当前环境不支持读取微信昵称',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.showToast({
|
||||
title: '仅微信小程序支持读取微信昵称',
|
||||
icon: 'none'
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
copyText(value) {
|
||||
uni.setClipboardData({
|
||||
data: String(value || ''),
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goPage(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(circle at top center, rgba(20, 150, 242, 0.1), transparent 28%),
|
||||
linear-gradient(180deg, #f5fbff 0%, #eef7ff 100%);
|
||||
}
|
||||
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
padding: 24rpx 24rpx 40rpx;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.section-card {
|
||||
border-radius: 32rpx;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
border: 1rpx solid rgba(20, 150, 242, 0.08);
|
||||
box-shadow: 0 10rpx 28rpx rgba(34, 94, 142, 0.08);
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
padding: 34rpx 30rpx;
|
||||
background: linear-gradient(145deg, #0d6fba 0%, #1496f2 58%, #5bc2ff 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.hero-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-image,
|
||||
.avatar-text {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 32rpx;
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 22rpx;
|
||||
}
|
||||
|
||||
.hero-name {
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-role,
|
||||
.hero-org {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
color: rgba(255, 255, 255, 0.84);
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 20rpx 16rpx;
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
.section-card {
|
||||
margin-top: 24rpx;
|
||||
padding: 26rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2329;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx 18rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #faf5f2;
|
||||
}
|
||||
|
||||
.info-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 22rpx;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
margin-top: 8rpx;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
color: #2b3037;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.info-action {
|
||||
flex-shrink: 0;
|
||||
font-size: 22rpx;
|
||||
color: #1496f2;
|
||||
}
|
||||
|
||||
.info-item--form {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
:deep(.info-input.uv-input) {
|
||||
width: 100%;
|
||||
height: 92rpx;
|
||||
margin-top: 12rpx;
|
||||
padding: 0 24rpx !important;
|
||||
border-radius: 24rpx;
|
||||
background: #ffffff !important;
|
||||
border: 1rpx solid #eadfd7 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:deep(.info-input.uv-input .uv-input__content__field-wrapper__field) {
|
||||
font-size: 26rpx;
|
||||
color: #2b3037;
|
||||
}
|
||||
|
||||
.info-input--picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.info-actions {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.nickname-btn {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 22rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nickname-btn--ghost {
|
||||
background: #eef6ff;
|
||||
color: #1496f2;
|
||||
}
|
||||
|
||||
.nickname-btn--primary {
|
||||
background: linear-gradient(135deg, #0d6fba 0%, #1496f2 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nickname-tip {
|
||||
margin-top: 14rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.bio-text {
|
||||
margin-top: 18rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.8;
|
||||
color: #746a65;
|
||||
}
|
||||
|
||||
.quick-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.quick-card {
|
||||
padding: 22rpx 18rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fbf6f1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.quick-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(20, 150, 242, 0.1);
|
||||
color: #1496f2;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.quick-title {
|
||||
margin-top: 14rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
color: #2b3037;
|
||||
}
|
||||
</style>
|
||||
344
pages/mine/qingma.vue
Normal file
344
pages/mine/qingma.vue
Normal file
@@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view class="hero-card">
|
||||
<view class="hero-title">我的“青马”</view>
|
||||
<view class="hero-desc">查看青马工程报名记录、培养信息与当前审核状态。</view>
|
||||
<view class="hero-stats">
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ records.length }}</view>
|
||||
<view class="stat-label">记录总数</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ approvedCount }}</view>
|
||||
<view class="stat-label">已通过</view>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-value">{{ pendingCount }}</view>
|
||||
<view class="stat-label">待跟进</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="loading" class="state-card">
|
||||
<view class="state-title">正在加载青马数据...</view>
|
||||
<view class="state-desc">请稍候,正在同步你的青马工程记录。</view>
|
||||
</view>
|
||||
<view v-else-if="errorText" class="state-card state-card--error">
|
||||
<view class="state-title">加载失败</view>
|
||||
<view class="state-desc">{{ errorText }}</view>
|
||||
</view>
|
||||
<view v-else-if="!records.length" class="state-card">
|
||||
<view class="state-title">暂未查询到青马记录</view>
|
||||
<view class="state-desc">当前账号还没有青马工程报名或培养数据,可前往申报页查看开放项目。</view>
|
||||
<view class="state-action" @tap="goApplyList">查看申报列表</view>
|
||||
</view>
|
||||
<view v-else class="card-list">
|
||||
<view v-for="item in records" :key="item.id || `${item.name}-${item.year}`" class="data-card">
|
||||
<view class="card-top">
|
||||
<view class="card-main">
|
||||
<view class="card-title">{{ item.name || '未命名学员' }}</view>
|
||||
<view class="card-subtitle">{{ item.year || '未设置年度' }} · 青马工程</view>
|
||||
</view>
|
||||
<view class="status-tag" :class="`status-tag--${getStatusMeta(item).tone}`">
|
||||
{{ getStatusMeta(item).text }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="meta-list">
|
||||
<view class="meta-item">
|
||||
<view class="meta-label">学校院系</view>
|
||||
<view class="meta-value">{{ item.schoolInfo || '-' }}</view>
|
||||
</view>
|
||||
<view class="meta-item">
|
||||
<view class="meta-label">手机号码</view>
|
||||
<view class="meta-value">{{ item.phone || '-' }}</view>
|
||||
</view>
|
||||
<view class="meta-item">
|
||||
<view class="meta-label">团学职务</view>
|
||||
<view class="meta-value">{{ item.leaguePosition || '-' }}</view>
|
||||
</view>
|
||||
<view class="meta-item">
|
||||
<view class="meta-label">综合成绩</view>
|
||||
<view class="meta-value">{{ item.academicPerformance || '-' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-actions">
|
||||
<view class="card-action" @tap="copyValue(item.phone)">复制电话</view>
|
||||
<view class="card-action" @tap="copyValue(item.schoolInfo)">复制院系</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getReviewStatusMeta, userPageQmgcForm } from './service'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
errorText: '',
|
||||
records: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
approvedCount() {
|
||||
return this.records.filter((item) => this.getStatusMeta(item).text === '通过').length
|
||||
},
|
||||
pendingCount() {
|
||||
return this.records.filter((item) => this.getStatusMeta(item).text !== '通过').length
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.loadData()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loadData(true)
|
||||
},
|
||||
methods: {
|
||||
getStatusMeta(item) {
|
||||
return getReviewStatusMeta(item && item.reviewList)
|
||||
},
|
||||
async loadData(fromPullDown = false) {
|
||||
this.loading = true
|
||||
this.errorText = ''
|
||||
try {
|
||||
const result = await userPageQmgcForm({
|
||||
page: 1,
|
||||
limit: 20
|
||||
})
|
||||
this.records = (result && result.list) || []
|
||||
} catch (error) {
|
||||
this.errorText = (error && error.message) || '青马数据加载失败'
|
||||
} finally {
|
||||
this.loading = false
|
||||
if (fromPullDown) {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
copyValue(value) {
|
||||
if (!value) {
|
||||
uni.showToast({
|
||||
title: '暂无可复制内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: String(value),
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goApplyList() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gxmu/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(circle at top center, rgba(184, 146, 33, 0.1), transparent 30%),
|
||||
linear-gradient(180deg, #f8f4eb 0%, #f4efe5 100%);
|
||||
}
|
||||
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
padding: 24rpx 24rpx 40rpx;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.state-card,
|
||||
.data-card {
|
||||
border-radius: 30rpx;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
border: 1rpx solid rgba(184, 146, 33, 0.08);
|
||||
box-shadow: 0 10rpx 28rpx rgba(76, 49, 35, 0.08);
|
||||
}
|
||||
|
||||
.hero-card {
|
||||
padding: 32rpx 28rpx;
|
||||
background: linear-gradient(145deg, #6f4f05 0%, #a37a11 56%, #d4b24a 100%);
|
||||
color: #fffdf4;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-desc {
|
||||
margin-top: 14rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
color: rgba(255, 253, 244, 0.86);
|
||||
}
|
||||
|
||||
.hero-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 18rpx 16rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 253, 244, 0.8);
|
||||
}
|
||||
|
||||
.state-card {
|
||||
margin-top: 24rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
}
|
||||
|
||||
.state-card--error {
|
||||
border-color: rgba(195, 49, 30, 0.16);
|
||||
}
|
||||
|
||||
.state-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #20252c;
|
||||
}
|
||||
|
||||
.state-desc {
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.75;
|
||||
color: #786e69;
|
||||
}
|
||||
|
||||
.state-action {
|
||||
margin-top: 18rpx;
|
||||
font-size: 24rpx;
|
||||
color: #a37a11;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.data-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.card-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #22272f;
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 10rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-tag--success {
|
||||
background: #eef9f1;
|
||||
color: #1f8f49;
|
||||
}
|
||||
|
||||
.status-tag--danger {
|
||||
background: #fff1f0;
|
||||
color: #d4380d;
|
||||
}
|
||||
|
||||
.status-tag--warning {
|
||||
background: #fff8e6;
|
||||
color: #ad7b00;
|
||||
}
|
||||
|
||||
.status-tag--default {
|
||||
background: #f5f5f5;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.meta-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
padding: 18rpx;
|
||||
border-radius: 22rpx;
|
||||
background: #faf7f0;
|
||||
}
|
||||
|
||||
.meta-label {
|
||||
font-size: 20rpx;
|
||||
color: #8b817c;
|
||||
}
|
||||
|
||||
.meta-value {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
color: #2d333b;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(163, 122, 17, 0.08);
|
||||
color: #a37a11;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
</style>
|
||||
187
pages/mine/service.js
Normal file
187
pages/mine/service.js
Normal file
@@ -0,0 +1,187 @@
|
||||
import {
|
||||
API_BASE_URL,
|
||||
apiRequest,
|
||||
getCurrentUser
|
||||
} from '../assistant/chat-service'
|
||||
import { clearAuthStorage, ensureLoggedIn, get, hasToken } from '../../utils/request'
|
||||
import { getModuleMeta } from '../../utils/gxmu/config'
|
||||
|
||||
const LOCAL_DECLARE_PREFIX = 'gxmu_form_draft_'
|
||||
const LOCAL_PROFILE_OVERRIDE_PREFIX = 'mine_profile_override_'
|
||||
|
||||
export { getCurrentUser }
|
||||
export { hasToken, ensureLoggedIn }
|
||||
|
||||
export function logout() {
|
||||
clearAuthStorage()
|
||||
}
|
||||
|
||||
function getProfileOverrideStorageKey(userId) {
|
||||
const normalizedUserId = String(userId || '').trim()
|
||||
return `${LOCAL_PROFILE_OVERRIDE_PREFIX}${normalizedUserId || 'default'}`
|
||||
}
|
||||
|
||||
export function getLocalProfileOverride(userId) {
|
||||
try {
|
||||
return uni.getStorageSync(getProfileOverrideStorageKey(userId)) || {}
|
||||
} catch (error) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
export function saveLocalProfileOverride(userId, payload) {
|
||||
const value = payload && typeof payload === 'object' ? payload : {}
|
||||
uni.setStorageSync(getProfileOverrideStorageKey(userId), value)
|
||||
return value
|
||||
}
|
||||
|
||||
export function getUserProfile() {
|
||||
return apiRequest({
|
||||
url: `${API_BASE_URL}/auth/user`,
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
||||
export function updateUserProfileData(data) {
|
||||
return apiRequest({
|
||||
url: `${API_BASE_URL}/system/user/update-data`,
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function listOrganizations(params) {
|
||||
return get('/system/organization', params)
|
||||
}
|
||||
|
||||
export function listManuscript(params) {
|
||||
return apiRequest({
|
||||
url: `${API_BASE_URL}/cms/manuscript`,
|
||||
method: 'GET',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export function userPageQmgcForm(params) {
|
||||
return apiRequest({
|
||||
url: `${API_BASE_URL}/gxmu/qmgc-form/userPage`,
|
||||
method: 'GET',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export function listAvailableDeclare(params) {
|
||||
return apiRequest({
|
||||
url: `${API_BASE_URL}/gxmu/declare`,
|
||||
method: 'GET',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export function formatDateTime(value) {
|
||||
if (!value) {
|
||||
return '-'
|
||||
}
|
||||
const date = new Date(String(value).replace(/-/g, '/'))
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return value
|
||||
}
|
||||
const pad = (item) => String(item).padStart(2, '0')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`
|
||||
}
|
||||
|
||||
export function getLatestReview(reviewList) {
|
||||
if (!Array.isArray(reviewList) || !reviewList.length) {
|
||||
return null
|
||||
}
|
||||
return reviewList[reviewList.length - 1] || null
|
||||
}
|
||||
|
||||
export function getReviewStatusMeta(reviewList) {
|
||||
const latest = getLatestReview(reviewList)
|
||||
if (!latest) {
|
||||
return {
|
||||
text: '未审核',
|
||||
tone: 'default'
|
||||
}
|
||||
}
|
||||
if (latest.status === 1) {
|
||||
return {
|
||||
text: '通过',
|
||||
tone: 'success'
|
||||
}
|
||||
}
|
||||
if (latest.status === 0 || latest.status === 2) {
|
||||
return {
|
||||
text: '不通过',
|
||||
tone: 'danger'
|
||||
}
|
||||
}
|
||||
return {
|
||||
text: '待审核',
|
||||
tone: 'warning'
|
||||
}
|
||||
}
|
||||
|
||||
export function getManuscriptStatusMeta(record) {
|
||||
const reviewMeta = getReviewStatusMeta(record && record.reviewList)
|
||||
if (reviewMeta.text !== '未审核') {
|
||||
return reviewMeta
|
||||
}
|
||||
if (record && Number(record.status) === 1) {
|
||||
return {
|
||||
text: '已发布',
|
||||
tone: 'success'
|
||||
}
|
||||
}
|
||||
if (record && Number(record.status) === 0) {
|
||||
return {
|
||||
text: '待审核',
|
||||
tone: 'warning'
|
||||
}
|
||||
}
|
||||
return {
|
||||
text: '未审核',
|
||||
tone: 'default'
|
||||
}
|
||||
}
|
||||
|
||||
export function getLocalDeclareRecords() {
|
||||
try {
|
||||
const storageInfo = uni.getStorageInfoSync()
|
||||
const keys = (storageInfo.keys || []).filter((key) => key.indexOf(LOCAL_DECLARE_PREFIX) === 0)
|
||||
return keys
|
||||
.map((key) => {
|
||||
const draft = uni.getStorageSync(key)
|
||||
if (!draft || !draft.formData) {
|
||||
return null
|
||||
}
|
||||
const moduleCode = draft.moduleCode || ''
|
||||
if (!moduleCode) {
|
||||
return null
|
||||
}
|
||||
const moduleMeta = getModuleMeta(moduleCode)
|
||||
const year = String((draft.formData && draft.formData.year) || '').trim()
|
||||
return {
|
||||
key,
|
||||
moduleCode,
|
||||
title: (moduleMeta && moduleMeta.title) || '未命名申报',
|
||||
group: (moduleMeta && moduleMeta.group) || '申报项目',
|
||||
icon: (moduleMeta && moduleMeta.icon) || '申',
|
||||
year,
|
||||
savedAt: draft.savedAt || '',
|
||||
status: draft.status === 'submitted' ? '已提交' : '草稿',
|
||||
formData: draft.formData,
|
||||
route: `/pages/gxmu/form?code=${encodeURIComponent(moduleCode)}&year=${encodeURIComponent(year)}&declareTitle=${encodeURIComponent((moduleMeta && moduleMeta.title) || '申报表')}`
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
.sort((left, right) => {
|
||||
const leftTime = new Date(String((left && left.savedAt) || '').replace(/-/g, '/')).getTime()
|
||||
const rightTime = new Date(String((right && right.savedAt) || '').replace(/-/g, '/')).getTime()
|
||||
return (Number.isNaN(rightTime) ? 0 : rightTime) - (Number.isNaN(leftTime) ? 0 : leftTime)
|
||||
})
|
||||
} catch (error) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user