index.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  1. <template>
  2. <view class="activity-container" :style="{ '--font-scale': fontScale }">
  3. <!-- Nav bar with title "活动中心" and admin "+" button -->
  4. <!-- Tab bar(管理 tab 仅对有活动管理权限的账号可见:活动管理员 / 已通过审核的活动提供商) -->
  5. <view class="tab-bar">
  6. <view
  7. class="tab-item"
  8. :class="{ active: currentTab === tab.key }"
  9. v-for="tab in visibleTabs"
  10. :key="tab.key"
  11. @click="onTabChange(tab.key)"
  12. >
  13. <text class="tab-label">{{ tab.label }}</text>
  14. </view>
  15. </view>
  16. <!-- ScrollView content area -->
  17. <scroll-view
  18. class="content-scroll"
  19. scroll-y
  20. :refresher-enabled="true"
  21. :refresher-triggered="isRefreshing"
  22. @refresherrefresh="onRefresh"
  23. @scrolltolower="onLoadMore"
  24. >
  25. <!-- Tab 1: mine -->
  26. <view v-if="currentTab === 'mine'">
  27. <!-- Filter chips -->
  28. <scroll-view class="filter-scroll" scroll-x enable-flex>
  29. <view class="filter-chips">
  30. <view
  31. class="filter-chip"
  32. :class="{ active: currentMineFilter === filter.value }"
  33. v-for="filter in mineFilters"
  34. :key="filter.value"
  35. @click="onMineFilterChange(filter.value)"
  36. >
  37. <text class="filter-label">{{ filter.label }}</text>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. <!-- Activity cards -->
  42. <view class="card-list" v-if="myActivities.length > 0">
  43. <view
  44. class="activity-card"
  45. v-for="act in myActivities"
  46. :key="act.id"
  47. @click="goDetail(act)"
  48. >
  49. <image
  50. class="card-cover"
  51. :src="getImageUrl(act.coverImage) || '/static/default-activity.png'"
  52. mode="aspectFill"
  53. lazy-load />
  54. <view class="card-info">
  55. <text class="card-title">{{ act.title }}</text>
  56. <view class="card-tags" v-if="tagList(act.tags).length">
  57. <text class="tag-chip" v-for="(t, ti) in tagList(act.tags)" :key="ti">{{ t }}</text>
  58. </view>
  59. <text class="card-meta" v-if="act.registrantName">报名人:{{ act.registrantName }}</text>
  60. <text class="card-meta">开始 {{ formatActivityTime(act.startTime) }}{{ act.endTime ? ' 结束 ' + formatActivityTime(act.endTime) : '' }}</text>
  61. <text class="card-meta" v-if="act.location">📍 {{ act.location }}</text>
  62. <view class="card-bottom">
  63. <text class="card-status" :class="'status-' + (act._cls || 'upcoming')">
  64. {{ act._txt || '待开始' }}
  65. </text>
  66. <text class="card-price" v-if="act.price > 0">¥{{ formatPrice(act.price) }}</text>
  67. <text class="card-price free" v-else>免费</text>
  68. </view>
  69. <!-- Action buttons for approved status -->
  70. <view
  71. v-if="act.status === 'approved'"
  72. class="card-actions"
  73. >
  74. <button class="btn-cancel" @click.stop="onCancel(act)">取消报名</button>
  75. <button class="btn-checkin" @click.stop="onCheckin(act)">签到</button>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- Empty state for mine -->
  81. <view class="empty-state" v-else-if="!mineLoading">
  82. <text class="empty-icon">📋</text>
  83. <text class="empty-title">暂无报名的活动</text>
  84. <text class="empty-desc">去发现页探索精彩活动吧</text>
  85. <button class="empty-btn" @click="switchToDiscover">去发现活动</button>
  86. </view>
  87. <!-- Loading state -->
  88. <view class="loading-state" v-if="mineLoading">
  89. <view class="loading-spinner"></view>
  90. <text class="loading-text">加载中...</text>
  91. </view>
  92. <!-- Load more tip -->
  93. <view class="load-more-tip" v-if="myActivities.length > 0 && !hasMore && currentTab === 'mine'">
  94. <text class="load-more-text">没有更多了</text>
  95. </view>
  96. </view>
  97. <!-- Tab 2: discover -->
  98. <view v-if="currentTab === 'discover'">
  99. <!-- Filter chips (dimension) -->
  100. <scroll-view class="filter-scroll" scroll-x enable-flex>
  101. <view class="filter-chips">
  102. <view
  103. class="filter-chip"
  104. :class="{ active: currentDimension === filter.value }"
  105. v-for="filter in dimensionFilters"
  106. :key="filter.value"
  107. @click="onDimensionChange(filter.value)"
  108. >
  109. <text class="filter-label">{{ filter.label }}</text>
  110. </view>
  111. </view>
  112. </scroll-view>
  113. <!-- Activity cards -->
  114. <view class="card-list" v-if="discoverActivities.length > 0">
  115. <view
  116. class="activity-card"
  117. v-for="act in discoverActivities"
  118. :key="act.id"
  119. @click="goDetail(act)"
  120. >
  121. <image
  122. class="card-cover"
  123. :src="getImageUrl(act.coverImage) || '/static/default-activity.png'"
  124. mode="aspectFill"
  125. lazy-load />
  126. <view class="card-info">
  127. <text class="card-title">{{ act.title }}</text>
  128. <view class="card-tags" v-if="tagList(act.tags).length">
  129. <text class="tag-chip" v-for="(t, ti) in tagList(act.tags)" :key="ti">{{ t }}</text>
  130. </view>
  131. <text class="card-meta">开始 {{ formatActivityTime(act.startTime) }}{{ act.endTime ? ' 结束 ' + formatActivityTime(act.endTime) : '' }}</text>
  132. <text class="card-desc" v-if="act.intro || act.description">{{ plainText(act.intro || act.description) }}</text>
  133. <text class="card-meta" v-if="act.location">📍 {{ act.location }}</text>
  134. <view class="card-bottom">
  135. <text class="card-status" :class="'status-' + (act.displayStatus || 'open')">
  136. {{ act.displayLabel || '报名中' }}
  137. </text>
  138. <text class="card-price" v-if="hasFee(act)">¥{{ minFee(act) }}</text>
  139. <text class="card-price free" v-else>免费</text>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <!-- Empty state for discover -->
  145. <view class="empty-state" v-else-if="!discoverLoading">
  146. <text class="empty-icon">🔍</text>
  147. <text class="empty-title">暂无活动</text>
  148. <text class="empty-desc">稍后再来看看吧</text>
  149. </view>
  150. <!-- Loading state -->
  151. <view class="loading-state" v-if="discoverLoading">
  152. <view class="loading-spinner"></view>
  153. <text class="loading-text">加载中...</text>
  154. </view>
  155. <!-- Load more tip -->
  156. <view class="load-more-tip" v-if="discoverActivities.length > 0 && !hasMore && currentTab === 'discover'">
  157. <text class="load-more-text">没有更多了</text>
  158. </view>
  159. </view>
  160. <!-- Tab 3: history -->
  161. <view v-if="currentTab === 'history'">
  162. <!-- Filter chips (same as mine) -->
  163. <scroll-view class="filter-scroll" scroll-x enable-flex>
  164. <view class="filter-chips">
  165. <view
  166. class="filter-chip"
  167. :class="{ active: currentMineFilter === filter.value }"
  168. v-for="filter in mineFilters"
  169. :key="filter.value"
  170. @click="onMineFilterChange(filter.value)"
  171. >
  172. <text class="filter-label">{{ filter.label }}</text>
  173. </view>
  174. </view>
  175. </scroll-view>
  176. <!-- Activity cards -->
  177. <view class="card-list" v-if="historyActivities.length > 0">
  178. <view
  179. class="activity-card"
  180. v-for="act in historyActivities"
  181. :key="act.id"
  182. @click="goDetail(act)"
  183. >
  184. <image
  185. class="card-cover"
  186. :src="getImageUrl(act.coverImage) || '/static/default-activity.png'"
  187. mode="aspectFill"
  188. lazy-load />
  189. <view class="card-info">
  190. <text class="card-title">{{ act.title }}</text>
  191. <view class="card-tags" v-if="tagList(act.tags).length">
  192. <text class="tag-chip" v-for="(t, ti) in tagList(act.tags)" :key="ti">{{ t }}</text>
  193. </view>
  194. <text class="card-meta">开始 {{ formatActivityTime(act.startTime) }}{{ act.endTime ? ' 结束 ' + formatActivityTime(act.endTime) : '' }}</text>
  195. <text class="card-meta" v-if="act.location">📍 {{ act.location }}</text>
  196. <view class="card-bottom">
  197. <text class="card-status status-ended">已结束</text>
  198. <text class="card-price" v-if="act.price > 0">¥{{ formatPrice(act.price) }}</text>
  199. <text class="card-price free" v-else>免费</text>
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. <!-- Empty state for history -->
  205. <view class="empty-state" v-else-if="!historyLoading">
  206. <text class="empty-icon">📜</text>
  207. <text class="empty-title">暂无历史活动</text>
  208. <text class="empty-desc">参加过的活动会显示在这里</text>
  209. </view>
  210. <!-- Loading state -->
  211. <view class="loading-state" v-if="historyLoading">
  212. <view class="loading-spinner"></view>
  213. <text class="loading-text">加载中...</text>
  214. </view>
  215. <!-- Load more tip -->
  216. <view class="load-more-tip" v-if="historyActivities.length > 0 && !hasMore && currentTab === 'history'">
  217. <text class="load-more-text">没有更多了</text>
  218. </view>
  219. </view>
  220. <!-- Tab 4: manage(visibleTabs 已按权限过滤,此处再兜底一次,避免无权限时白屏) -->
  221. <view v-if="currentTab === 'manage' && canManageActivity">
  222. <!-- Manage overview stats -->
  223. <view class="manage-overview">
  224. <view class="manage-stat-card">
  225. <text class="manage-stat-num">{{ manageStats.total }}</text>
  226. <text class="manage-stat-label">全部活动</text>
  227. </view>
  228. <view class="manage-stat-card">
  229. <text class="manage-stat-num manage-published">{{ manageStats.published }}</text>
  230. <text class="manage-stat-label">已发布</text>
  231. </view>
  232. <view class="manage-stat-card">
  233. <text class="manage-stat-num manage-draft">{{ manageStats.draft }}</text>
  234. <text class="manage-stat-label">草稿</text>
  235. </view>
  236. <view class="manage-stat-card">
  237. <text class="manage-stat-num manage-ended">{{ manageStats.ended }}</text>
  238. <text class="manage-stat-label">已结束</text>
  239. </view>
  240. </view>
  241. <!-- Quick actions -->
  242. <view class="manage-actions">
  243. <view class="manage-action-btn" @click="goCreate">
  244. <text class="manage-action-icon">+</text>
  245. <text class="manage-action-text">创建活动</text>
  246. </view>
  247. </view>
  248. <!-- My managed activities list -->
  249. <view class="manage-section-title">
  250. <text>我的活动管理</text>
  251. </view>
  252. <view class="card-list" v-if="manageActivities.length > 0">
  253. <view
  254. class="activity-card"
  255. v-for="act in manageActivities"
  256. :key="act.id"
  257. @click="goEdit(act)"
  258. >
  259. <image
  260. class="card-cover"
  261. :src="getImageUrl(act.coverImage) || '/static/default-activity.png'"
  262. mode="aspectFill"
  263. lazy-load />
  264. <view class="card-info">
  265. <text class="card-title">{{ act.title }}</text>
  266. <view class="card-tags" v-if="tagList(act.tags).length">
  267. <text class="tag-chip" v-for="(t, ti) in tagList(act.tags)" :key="ti">{{ t }}</text>
  268. </view>
  269. <text class="card-meta">{{ formatActivityTime(act.startTime) }}</text>
  270. <view class="card-bottom">
  271. <text class="card-status" :class="'status-' + (act.status || 'draft')">
  272. {{ statusLabel(act.status) }}
  273. </text>
  274. <view class="manage-action-group">
  275. <text class="manage-action-small" v-if="act.status === 'draft'" @click.stop="doPublish(act.id)">{{ canDirectPublish ? '发布' : '提交审核' }}</text>
  276. <text class="manage-action-small" v-if="act.status === 'rejected'" @click.stop="doPublish(act.id)">重新提交</text>
  277. <text class="manage-action-small" v-if="act.status === 'published'" @click.stop="doEnd(act.id)">结束</text>
  278. <text class="manage-action-small" v-if="act.status === 'published'" @click.stop="doWithdraw(act.id)">撤回</text>
  279. </view>
  280. </view>
  281. </view>
  282. </view>
  283. </view>
  284. <view class="empty-state" v-else-if="!manageLoading">
  285. <text class="empty-icon">📊</text>
  286. <text class="empty-title">暂无管理的活动</text>
  287. <text class="empty-desc">点击上方「创建活动」开始</text>
  288. </view>
  289. <view class="loading-state" v-if="manageLoading">
  290. <view class="loading-spinner"></view>
  291. <text class="loading-text">加载中...</text>
  292. </view>
  293. </view>
  294. </scroll-view>
  295. </view>
  296. </template>
  297. <script>
  298. import { getActivityList, getMyActivityRegistrations, activityCheckin, cancelActivityRegistration, adminListMyActivities, adminPublishActivity, adminEndActivity, adminWithdrawActivity, submitActivityForReview, vendorStatus, reportAppEnter} from '@/utils/api.js'
  299. import config from '@/config.js'
  300. import { parseDate, formatDateTime } from '../../utils/format.js'
  301. import { hasActivityManageRole, isApprovedActivityProvider } from '@/utils/activity-role.js'
  302. import { adultFees, childFees, minAvailablePrice } from '@/utils/activity-fee.js'
  303. import fontScaleMixin from '@/mixins/font-scale.js'
  304. export default {
  305. mixins: [fontScaleMixin],
  306. computed: {
  307. // 管理 tab 只对有活动管理权限的账号展示(普通成员不显示,避免点进去是空白)
  308. visibleTabs: function() {
  309. var list = [
  310. { key: 'mine', label: '我的活动' },
  311. { key: 'discover', label: '发现活动' },
  312. { key: 'history', label: '历史记录' }
  313. ]
  314. if (this.canManageActivity) {
  315. list.push({ key: 'manage', label: '管理' })
  316. }
  317. return list
  318. }
  319. },
  320. data() {
  321. return {
  322. // 活动管理权限:后台角色(admin/activity_admin/activity_manager)或已通过审核的活动提供商
  323. canManageActivity: false,
  324. // 是否有权直接发布(后台活动管理员);服务商只能提交审核
  325. canDirectPublish: false,
  326. currentTab: 'mine',
  327. mineFilters: [
  328. { label: '全部', value: '' },
  329. { label: '待开始', value: 'upcoming' },
  330. { label: '待审核', value: 'pending' },
  331. { label: '已签到', value: 'checked_in' }
  332. ],
  333. dimensionFilters: [
  334. { label: '全部', value: '' },
  335. { label: '身', value: 'body' },
  336. { label: '心', value: 'mind' },
  337. { label: '智', value: 'wisdom' },
  338. { label: '行', value: 'action' },
  339. { label: '富', value: 'wealth' }
  340. ],
  341. currentMineFilter: '',
  342. currentDimension: '',
  343. myActivities: [],
  344. discoverActivities: [],
  345. historyActivities: [],
  346. mineLoading: false,
  347. discoverLoading: false,
  348. historyLoading: false,
  349. minePage: 1,
  350. discoverPage: 1,
  351. historyPage: 1,
  352. pageSize: 10,
  353. hasMore: true,
  354. isRefreshing: false,
  355. // Manage tab data
  356. manageLoading: false,
  357. manageStats: { total: 0, published: 0, draft: 0, ended: 0 },
  358. manageActivities: []
  359. }
  360. },
  361. onLoad: function(options) {
  362. reportAppEnter('activity');
  363. if (options && options.tab) {
  364. this.currentTab = options.tab
  365. }
  366. this.resolveManagePermission()
  367. this.loadData()
  368. this._onLoadFired = true
  369. },
  370. onShow: function() {
  371. if (this._onLoadFired) {
  372. this._onLoadFired = false // 首次进入:onLoad 已加载,跳过避免双发
  373. } else {
  374. // 从子页面(如活动详情)返回:刷新当前 tab(loadData 统一重置第一页,避免旧数据被追加导致翻倍)
  375. this.resolveManagePermission()
  376. this.loadData()
  377. }
  378. },
  379. methods: {
  380. tagList: function(tags) {
  381. return String(tags || '').split(/[,,、]/).map(function(t) { return t.trim() }).filter(function(t) { return !!t })
  382. },
  383. // 富文本(HTML)→ 纯文本摘要:去掉 style/script 标签与 HTML 标签、解码 HTML 实体(&nbsp; &#x27; 等)、压缩空白
  384. plainText: function(html) {
  385. if (!html) return ''
  386. var s = String(html)
  387. .replace(/<style[\s\S]*?<\/style>/gi, ' ')
  388. .replace(/<script[\s\S]*?<\/script>/gi, ' ')
  389. .replace(/<[^>]+>/g, ' ')
  390. .replace(/&nbsp;/gi, ' ')
  391. .replace(/&lt;/gi, '<')
  392. .replace(/&gt;/gi, '>')
  393. .replace(/&amp;/gi, '&')
  394. .replace(/&quot;/gi, '"')
  395. s = s
  396. .replace(/&#x([0-9a-fA-F]+);/g, function(all, hex) { return String.fromCharCode(parseInt(hex, 16)) })
  397. .replace(/&#(\d+);/g, function(all, dec) { return String.fromCharCode(parseInt(dec, 10)) })
  398. .replace(/\s+/g, ' ')
  399. .trim()
  400. return s
  401. },
  402. // 活动管理权限判定:与后端 ActivityController.hasActivityManageRole 对齐。
  403. // 后台角色(admin / activity_admin / activity_manager)→ 可直接发布;
  404. // 其余账号查服务商入驻状态,vendorType=activity_provider 且审核通过 → 可管理(只能提交审核)。
  405. resolveManagePermission: function() {
  406. var self = this
  407. if (hasActivityManageRole()) {
  408. self.canDirectPublish = true
  409. self.canManageActivity = true
  410. self.onPermissionResolved()
  411. return
  412. }
  413. // 未登录不发 vendorStatus:请求层会因 401 触发静默续期/跳登录,影响游客浏览活动
  414. if (!uni.getStorageSync('token')) {
  415. return
  416. }
  417. vendorStatus().then(function(res) {
  418. var approvedProvider = isApprovedActivityProvider((res && res.data) || {})
  419. // 非后台角色才由服务商审核状态决定(后台角色已在上面提前返回,不会被覆盖)
  420. if (!self.canDirectPublish) {
  421. self.canManageActivity = approvedProvider
  422. }
  423. self.onPermissionResolved()
  424. }).catch(function() {
  425. if (!self.canDirectPublish) {
  426. self.canManageActivity = false
  427. }
  428. self.onPermissionResolved()
  429. })
  430. },
  431. // 权限解析完成后的兜底:以 ?tab=manage 进来但无权限时回落到「我的活动」,避免空白页
  432. onPermissionResolved: function() {
  433. if (this.currentTab === 'manage' && !this.canManageActivity) {
  434. this.currentTab = 'mine'
  435. this.loadData()
  436. }
  437. },
  438. getImageUrl: function(path) {
  439. if (!path || path === 'null' || path === 'undefined' || path === '/null') return ''
  440. var s = String(path).trim()
  441. if (!s || s === 'null' || s === '/null') return ''
  442. if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) return s
  443. return config.API_BASE_URL + (s.charAt(0) === '/' ? s : '/' + s)
  444. },
  445. onTabChange: function(key) {
  446. this.currentTab = key
  447. this.hasMore = true
  448. if (key === 'mine') {
  449. this.minePage = 1
  450. this.myActivities = []
  451. } else if (key === 'discover') {
  452. this.discoverPage = 1
  453. this.discoverActivities = []
  454. } else if (key === 'history') {
  455. this.historyPage = 1
  456. this.historyActivities = []
  457. }
  458. this.loadData()
  459. },
  460. // 统一入口:onLoad / Tab 切换 / 筛选变更 / 从详情页返回(onShow) 都走这里。
  461. // 语义固定为「重置为第一页后重新加载」——先清空数组并回到 page=1,
  462. // 避免走 loadXxxActivities() 的非 refresh 分支导致列表被 concat 叠加(详情页返回时列表翻倍)。
  463. // 加载更多不走这里,由 onLoadMore 自行递增页码追加。
  464. loadData: function() {
  465. if (this.currentTab === 'mine') {
  466. this.minePage = 1
  467. this.myActivities = []
  468. this.hasMore = true
  469. this.loadMyActivities()
  470. } else if (this.currentTab === 'discover') {
  471. this.discoverPage = 1
  472. this.discoverActivities = []
  473. this.hasMore = true
  474. this.loadDiscoverActivities()
  475. } else if (this.currentTab === 'history') {
  476. this.historyPage = 1
  477. this.historyActivities = []
  478. this.hasMore = true
  479. this.loadHistoryActivities()
  480. } else if (this.currentTab === 'manage') {
  481. // 权限未解析/无权限时不发管理列表请求(onPermissionResolved 会回落 mine)
  482. if (this.canManageActivity) {
  483. this.loadManageData()
  484. }
  485. }
  486. },
  487. loadManageData: function() {
  488. var self = this
  489. this.manageLoading = true
  490. // 活动服务商(非后台角色)只看自己创建/负责的活动,后台活动管理员由后端按角色隔离
  491. var params = { page: 1, size: 100 }
  492. if (!self.canDirectPublish) {
  493. params.mineOnly = true
  494. }
  495. adminListMyActivities(params).then(function(res) {
  496. self.manageLoading = false
  497. if (res && res.code === 200 && res.data) {
  498. var records = res.data.records || []
  499. self.manageActivities = records.slice(0, 20)
  500. var total = records.length
  501. var published = 0
  502. var draft = 0
  503. var ended = 0
  504. for (var i = 0; i < records.length; i++) {
  505. var s = records[i].status
  506. if (s === 'published') published++
  507. else if (s === 'draft') draft++
  508. else if (s === 'ended' || s === 'cancelled' || s === 'withdrawn') ended++
  509. }
  510. self.manageStats = { total: total, published: published, draft: draft, ended: ended }
  511. } else {
  512. self.manageActivities = []
  513. self.manageStats = { total: 0, published: 0, draft: 0, ended: 0 }
  514. }
  515. }).catch(function() {
  516. self.manageLoading = false
  517. self.manageActivities = []
  518. self.manageStats = { total: 0, published: 0, draft: 0, ended: 0 }
  519. })
  520. },
  521. goCreate: function() {
  522. uni.navigateTo({ url: '/pages/activity/create' })
  523. },
  524. goEdit: function(act) {
  525. uni.navigateTo({ url: '/pages/activity/create?id=' + act.id })
  526. },
  527. statusLabel: function(status) {
  528. var map = {
  529. draft: '草稿',
  530. pending: '待审核',
  531. rejected: '已驳回',
  532. published: '进行中',
  533. ended: '已结束',
  534. withdrawn: '已撤回',
  535. cancelled: '已取消'
  536. }
  537. return map[status] || status
  538. },
  539. doPublish: function(id) {
  540. var self = this
  541. uni.showModal({
  542. title: '提示',
  543. content: '确认发布此活动吗?发布后将对外可见。',
  544. success: function(res) {
  545. if (res.confirm) {
  546. uni.showLoading({ title: '发布中...' })
  547. if (self.canDirectPublish) {
  548. adminPublishActivity(id).then(function(r) {
  549. uni.hideLoading()
  550. if (r && r.code === 200) {
  551. uni.showToast({ title: '发布成功', icon: 'success' })
  552. self.loadManageData()
  553. } else {
  554. uni.showToast({ title: (r && r.message) || '发布失败', icon: 'none' })
  555. }
  556. }).catch(function() {
  557. uni.hideLoading()
  558. uni.showToast({ title: '发布失败', icon: 'none' })
  559. })
  560. } else {
  561. submitActivityForReview(id).then(function(r) {
  562. uni.hideLoading()
  563. if (r && r.code === 200) {
  564. uni.showToast({ title: '已提交审核', icon: 'success' })
  565. self.loadManageData()
  566. } else {
  567. uni.showToast({ title: (r && r.message) || '提交审核失败', icon: 'none' })
  568. }
  569. }).catch(function() {
  570. uni.hideLoading()
  571. uni.showToast({ title: '提交审核失败', icon: 'none' })
  572. })
  573. }
  574. }
  575. }
  576. })
  577. },
  578. doEnd: function(id) {
  579. var self = this
  580. uni.showModal({
  581. title: '提示',
  582. content: '确认结束此活动吗?结束后不再接受新参与者。',
  583. success: function(res) {
  584. if (res.confirm) {
  585. uni.showLoading({ title: '操作中...' })
  586. adminEndActivity(id).then(function(r) {
  587. uni.hideLoading()
  588. if (r && r.code === 200) {
  589. uni.showToast({ title: '已结束', icon: 'success' })
  590. self.loadManageData()
  591. } else {
  592. uni.showToast({ title: (r && r.message) || '操作失败', icon: 'none' })
  593. }
  594. }).catch(function() {
  595. uni.hideLoading()
  596. uni.showToast({ title: '网络异常', icon: 'none' })
  597. })
  598. }
  599. }
  600. })
  601. },
  602. doWithdraw: function(id) {
  603. var self = this
  604. uni.showModal({
  605. title: '提示',
  606. content: '确认撤回此活动吗?撤回后不再对外展示,可重新编辑。',
  607. success: function(res) {
  608. if (res.confirm) {
  609. uni.showLoading({ title: '操作中...' })
  610. adminWithdrawActivity(id).then(function(r) {
  611. uni.hideLoading()
  612. if (r && r.code === 200) {
  613. uni.showToast({ title: '已撤回', icon: 'success' })
  614. self.loadManageData()
  615. } else {
  616. uni.showToast({ title: (r && r.message) || '操作失败', icon: 'none' })
  617. }
  618. }).catch(function() {
  619. uni.hideLoading()
  620. uni.showToast({ title: '网络异常', icon: 'none' })
  621. })
  622. }
  623. }
  624. })
  625. },
  626. onMineFilterChange: function(value) {
  627. this.currentMineFilter = value
  628. this.minePage = 1
  629. this.myActivities = []
  630. this.hasMore = true
  631. if (this.currentTab === 'mine') {
  632. this.loadMyActivities()
  633. } else if (this.currentTab === 'history') {
  634. this.loadHistoryActivities()
  635. }
  636. },
  637. onDimensionChange: function(value) {
  638. this.currentDimension = value
  639. this.discoverPage = 1
  640. this.discoverActivities = []
  641. this.hasMore = true
  642. this.loadDiscoverActivities()
  643. },
  644. onLoadMore: function() {
  645. if (!this.hasMore) return
  646. if (this.currentTab === 'mine' && !this.mineLoading) {
  647. this.minePage++
  648. this.loadMyActivities()
  649. } else if (this.currentTab === 'discover' && !this.discoverLoading) {
  650. this.discoverPage++
  651. this.loadDiscoverActivities()
  652. } else if (this.currentTab === 'history' && !this.historyLoading) {
  653. this.historyPage++
  654. this.loadHistoryActivities()
  655. }
  656. },
  657. onRefresh: function() {
  658. var self = this
  659. this.isRefreshing = true
  660. if (this.currentTab === 'mine') {
  661. this.loadMyActivities(true).finally(function() {
  662. self.isRefreshing = false
  663. })
  664. } else if (this.currentTab === 'discover') {
  665. this.loadDiscoverActivities(true).finally(function() {
  666. self.isRefreshing = false
  667. })
  668. } else if (this.currentTab === 'history') {
  669. this.loadHistoryActivities(true).finally(function() {
  670. self.isRefreshing = false
  671. })
  672. } else {
  673. this.isRefreshing = false
  674. }
  675. },
  676. loadMyActivities: function(refresh) {
  677. var self = this
  678. if (refresh) {
  679. this.minePage = 1
  680. this.myActivities = []
  681. }
  682. // 请求序号:返回期间若已发起新请求(onShow/下拉刷新重置),旧响应直接丢弃,防止旧分页追加导致列表翻倍
  683. var seq = (this._mineReqSeq || 0) + 1
  684. this._mineReqSeq = seq
  685. this.mineLoading = true
  686. var memberId = uni.getStorageSync('currentChildId')
  687. if (!memberId) {
  688. this.mineLoading = false
  689. return Promise.resolve()
  690. }
  691. var params = {
  692. memberId: memberId,
  693. page: this.minePage,
  694. size: this.pageSize
  695. }
  696. if (this.currentMineFilter && this.currentMineFilter !== 'upcoming') {
  697. params.status = this.currentMineFilter
  698. }
  699. // 返回 Promise:onRefresh 的 .finally 依赖它来复位 isRefreshing(不返回会导致 undefined.finally 抛错,下拉刷新卡死)
  700. return getMyActivityRegistrations(params).then(function(res) {
  701. if (seq !== self._mineReqSeq) return
  702. self.mineLoading = false
  703. if (res && res.code === 200 && res.data) {
  704. var records = res.data.records || []
  705. for (var ni = 0; ni < records.length; ni++) {
  706. self.normalizeRegistration(records[ni])
  707. }
  708. if (self.currentMineFilter === 'upcoming') {
  709. var now = new Date()
  710. var filtered = []
  711. for (var i = 0; i < records.length; i++) {
  712. var act = records[i]
  713. if (act.startTime) {
  714. var startTime = parseDate(act.startTime)
  715. if (!startTime) continue
  716. if (startTime > now && act.status === 'approved') {
  717. filtered.push(act)
  718. }
  719. }
  720. }
  721. records = filtered
  722. }
  723. for (var di = 0; di < records.length; di++) {
  724. self.decorateActivity(records[di])
  725. }
  726. if (refresh) {
  727. self.myActivities = records
  728. } else {
  729. self.myActivities = self.myActivities.concat(records)
  730. }
  731. self.hasMore = records.length >= self.pageSize
  732. }
  733. }).catch(function() {
  734. if (seq === self._mineReqSeq) self.mineLoading = false
  735. })
  736. },
  737. loadDiscoverActivities: function(refresh) {
  738. var self = this
  739. if (refresh) {
  740. this.discoverPage = 1
  741. this.discoverActivities = []
  742. }
  743. // 请求序号:过期响应直接丢弃,防止旧分页在刷新后追加导致列表翻倍
  744. var seq = (this._discoverReqSeq || 0) + 1
  745. this._discoverReqSeq = seq
  746. this.discoverLoading = true
  747. var params = {
  748. page: this.discoverPage,
  749. size: this.pageSize
  750. }
  751. if (this.currentDimension) {
  752. params.dimensionCode = this.currentDimension
  753. }
  754. // 返回 Promise:onRefresh 的 .finally 依赖它复位 isRefreshing
  755. return getActivityList(params).then(function(res) {
  756. if (seq !== self._discoverReqSeq) return
  757. self.discoverLoading = false
  758. if (res && res.code === 200 && res.data) {
  759. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  760. if (refresh) {
  761. self.discoverActivities = list
  762. } else {
  763. self.discoverActivities = self.discoverActivities.concat(list)
  764. }
  765. self.hasMore = list.length >= self.pageSize
  766. }
  767. }).catch(function() {
  768. if (seq === self._discoverReqSeq) self.discoverLoading = false
  769. })
  770. },
  771. loadHistoryActivities: function(refresh) {
  772. var self = this
  773. if (refresh) {
  774. this.historyPage = 1
  775. this.historyActivities = []
  776. }
  777. // 请求序号:过期响应直接丢弃,防止旧分页在刷新后追加导致列表翻倍
  778. var seq = (this._historyReqSeq || 0) + 1
  779. this._historyReqSeq = seq
  780. this.historyLoading = true
  781. var memberId = uni.getStorageSync('currentChildId')
  782. if (!memberId) {
  783. this.historyLoading = false
  784. return Promise.resolve()
  785. }
  786. var params = {
  787. memberId: memberId,
  788. page: this.historyPage,
  789. size: this.pageSize
  790. }
  791. // 返回 Promise:onRefresh 的 .finally 依赖它复位 isRefreshing
  792. return getMyActivityRegistrations(params).then(function(res) {
  793. if (seq !== self._historyReqSeq) return
  794. self.historyLoading = false
  795. if (res && res.code === 200 && res.data) {
  796. var records = res.data.records || []
  797. var now = new Date()
  798. var ended = []
  799. for (var i = 0; i < records.length; i++) {
  800. var act = records[i]
  801. self.normalizeRegistration(act)
  802. var endTime = parseDate(act.endTime)
  803. var startTime = parseDate(act.startTime)
  804. // 有结束时间按结束时间判断;无结束时间(如线上活动)按开始时间已过判断
  805. var isPast = (endTime && endTime < now) || (!endTime && startTime && startTime < now)
  806. if (isPast || act.status === 'cancelled' || act.status === 'rejected') {
  807. ended.push(act)
  808. }
  809. }
  810. if (refresh) {
  811. self.historyActivities = ended
  812. } else {
  813. self.historyActivities = self.historyActivities.concat(ended)
  814. }
  815. self.hasMore = records.length >= self.pageSize
  816. }
  817. }).catch(function() {
  818. if (seq === self._historyReqSeq) self.historyLoading = false
  819. })
  820. },
  821. // 报名记录 → 卡片所需字段:/api/activity/my-registrations 返回的是
  822. // activityTitle/activityStartTime/... ,直接渲染会标题/时间/封面/费用全空
  823. normalizeRegistration: function(act) {
  824. if (!act) return act
  825. if (!act.title && act.activityTitle) act.title = act.activityTitle
  826. if (act.activityStartTime) act.startTime = formatDateTime(act.activityStartTime)
  827. if (act.activityEndTime) act.endTime = formatDateTime(act.activityEndTime)
  828. if (!act.coverImage && act.activityCoverImage) act.coverImage = act.activityCoverImage
  829. if (!act.location && act.activityLocation) act.location = act.activityLocation
  830. // A3:不再用 4 个 child/parent 费用的最小值覆盖 price(会把只填成人价的活动压成最低档);
  831. // 仅在 price 为空/为 0 时回落 parentFee(老活动「成人非会员价」历史别名,A2 §2.4)
  832. var price = Number(act.activityPrice) || Number(act.price) || 0
  833. if (price <= 0) {
  834. price = Number(act.activityParentFee) || 0
  835. }
  836. act.price = price
  837. return act
  838. },
  839. goDetail: function(act) {
  840. // 报名记录的 id 是报名 id,必须取 activityId;发现列表的 id 即活动 id
  841. var id = act.activityId || act.id
  842. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + id })
  843. },
  844. switchToDiscover: function() {
  845. this.currentTab = 'discover'
  846. this.hasMore = true
  847. this.discoverPage = 1
  848. this.discoverActivities = []
  849. this.loadDiscoverActivities()
  850. },
  851. formatPrice: function(price) {
  852. return (price / 100).toFixed(2)
  853. },
  854. formatDateTime: formatDateTime,
  855. // 活动时间展示:复用统一 formatDateTime 后裁剪秒,输出 yyyy-MM-dd HH:mm(活动到分钟即可)
  856. formatActivityTime: function(t) {
  857. var s = formatDateTime(t)
  858. return s ? s.substring(0, 16) : ''
  859. },
  860. // A3:活动是否收费 —— 纳入 price/memberPrice(成人档),兼容老活动 parentFee 回落
  861. hasFee: function(act) {
  862. var adult = adultFees(act)
  863. var child = childFees(act)
  864. return adult.regular > 0 || adult.member > 0 || child.regular > 0 || child.member > 0
  865. },
  866. // A3:当前用户可用档位的最小值(卡片展示非会员起步价)
  867. minFee: function(act) {
  868. return (minAvailablePrice(act, false) / 100).toFixed(2)
  869. },
  870. decorateActivity: function(act) {
  871. if (act.status) {
  872. act._cls = act.status
  873. var map = { pending: '待审核', approved: '报名成功', rejected: '已拒绝', cancelled: '已取消', checked_in: '已签到' }
  874. act._txt = map[act.status] || act.status
  875. } else {
  876. if (act.endTime) {
  877. var endTime = parseDate(act.endTime)
  878. if (endTime && endTime < new Date()) {
  879. act._cls = 'ended'
  880. act._txt = '已结束'
  881. return act
  882. }
  883. }
  884. act._cls = 'upcoming'
  885. act._txt = '待开始'
  886. }
  887. return act
  888. },
  889. onCheckin: function(act) {
  890. var self = this
  891. var memberId = uni.getStorageSync('currentChildId')
  892. if (!memberId) {
  893. uni.showToast({ title: '请先选择家庭成员身份', icon: 'none' })
  894. return
  895. }
  896. activityCheckin({ id: act.activityId || act.id, memberId: memberId }).then(function(res) {
  897. if (res && res.code === 200) {
  898. uni.showToast({ title: '签到成功', icon: 'success' })
  899. self.loadMyActivities(true)
  900. } else {
  901. uni.showToast({ title: (res && res.message) || '签到失败', icon: 'none' })
  902. }
  903. }).catch(function() {
  904. uni.showToast({ title: '网络异常', icon: 'none' })
  905. })
  906. },
  907. onCancel: function(act) {
  908. var self = this
  909. uni.showModal({
  910. title: '提示',
  911. content: '确定要取消报名吗?',
  912. success: function(res) {
  913. if (res.confirm) {
  914. var memberId = uni.getStorageSync('currentChildId')
  915. if (!memberId) {
  916. uni.showToast({ title: '请先选择家庭成员身份', icon: 'none' })
  917. return
  918. }
  919. cancelActivityRegistration({ id: act.activityId || act.id, memberId: memberId }).then(function(res) {
  920. if (res && res.code === 200) {
  921. uni.showToast({ title: '已取消报名', icon: 'success' })
  922. self.loadMyActivities(true)
  923. } else {
  924. uni.showToast({ title: (res && res.message) || '取消失败', icon: 'none' })
  925. }
  926. }).catch(function() {
  927. uni.showToast({ title: '网络异常', icon: 'none' })
  928. })
  929. }
  930. }
  931. })
  932. }
  933. }
  934. }
  935. </script>
  936. <style scoped lang="scss">
  937. .activity-container {
  938. min-height: 100vh;
  939. background: $facade-fill-2;
  940. display: flex;
  941. flex-direction: column;
  942. }
  943. .tab-bar {
  944. background: $app-surface;
  945. display: flex;
  946. flex-direction: row;
  947. border-bottom: 1rpx solid $facade-hairline-2;
  948. }
  949. .tab-item {
  950. flex: 1;
  951. padding: 24rpx 0;
  952. text-align: center;
  953. border-bottom: 4rpx solid transparent;
  954. }
  955. .tab-item.active {
  956. border-bottom-color: $brand-primary;
  957. }
  958. .tab-label {
  959. font-size: calc(28rpx * var(--font-scale, 1));
  960. color: $facade-text-body;
  961. }
  962. .tab-item.active .tab-label {
  963. color: $brand-primary;
  964. font-weight: 600;
  965. }
  966. .content-scroll {
  967. flex: 1;
  968. height: calc(100vh - 200rpx);
  969. }
  970. .filter-scroll {
  971. padding: 20rpx 24rpx;
  972. background: $app-surface;
  973. }
  974. .filter-chips {
  975. display: flex;
  976. flex-direction: row;
  977. gap: 16rpx;
  978. }
  979. .filter-chip {
  980. padding: 12rpx 24rpx;
  981. border-radius: 16px;
  982. background: $app-surface;
  983. border: 1rpx solid $facade-border-soft;
  984. flex-shrink: 0;
  985. }
  986. .filter-chip.active {
  987. background: $uni-primary-pale;
  988. border-color: $brand-primary;
  989. }
  990. .filter-label {
  991. font-size: calc(24rpx * var(--font-scale, 1));
  992. color: $facade-text-body;
  993. }
  994. .filter-chip.active .filter-label {
  995. color: $brand-primary;
  996. font-weight: 500;
  997. }
  998. .card-list {
  999. padding: 0 24rpx 24rpx;
  1000. display: flex;
  1001. flex-direction: column;
  1002. gap: 20rpx;
  1003. }
  1004. .activity-card {
  1005. background: $app-surface;
  1006. border-radius: 16rpx;
  1007. padding: 20rpx;
  1008. display: flex;
  1009. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
  1010. }
  1011. .card-cover {
  1012. width: 144rpx;
  1013. height: 144rpx;
  1014. border-radius: 8rpx;
  1015. flex-shrink: 0;
  1016. background: $facade-fill;
  1017. }
  1018. .card-info {
  1019. flex: 1;
  1020. margin-left: 20rpx;
  1021. display: flex;
  1022. flex-direction: column;
  1023. }
  1024. .card-tags {
  1025. display: flex;
  1026. flex-wrap: wrap;
  1027. margin-top: 10rpx;
  1028. }
  1029. .tag-chip {
  1030. font-size: calc(22rpx * var(--font-scale, 1));
  1031. color: $brand-primary;
  1032. background: $uni-primary-pale;
  1033. padding: 2rpx 12rpx;
  1034. border-radius: 8rpx;
  1035. margin-right: 8rpx;
  1036. margin-bottom: 4rpx;
  1037. }
  1038. .card-title {
  1039. font-size: calc(28rpx * var(--font-scale, 1));
  1040. font-weight: 600;
  1041. color: $facade-text-strong;
  1042. line-height: 1.4;
  1043. overflow: hidden;
  1044. text-overflow: ellipsis;
  1045. white-space: nowrap;
  1046. }
  1047. .card-meta {
  1048. font-size: calc(24rpx * var(--font-scale, 1));
  1049. color: $facade-text-muted;
  1050. margin-top: 8rpx;
  1051. }
  1052. .card-bottom {
  1053. display: flex;
  1054. flex-direction: row;
  1055. align-items: center;
  1056. justify-content: space-between;
  1057. margin-top: auto;
  1058. padding-top: 12rpx;
  1059. }
  1060. .card-status {
  1061. font-size: calc(22rpx * var(--font-scale, 1));
  1062. padding: 4rpx 12rpx;
  1063. border-radius: 8rpx;
  1064. }
  1065. .status-pending {
  1066. background: $uni-primary-pale;
  1067. color: $brand-primary;
  1068. }
  1069. .status-approved {
  1070. background: $status-success-tint-2;
  1071. color: $status-success-2;
  1072. }
  1073. .status-rejected {
  1074. background: $status-danger-tint-2;
  1075. color: $status-danger;
  1076. }
  1077. .status-cancelled {
  1078. background: $facade-fill-2;
  1079. color: $facade-text-muted;
  1080. }
  1081. .status-checked_in {
  1082. background: $status-info-soft;
  1083. color: $status-info;
  1084. }
  1085. .status-upcoming {
  1086. background: $uni-primary-pale;
  1087. color: $brand-primary;
  1088. }
  1089. .status-ended {
  1090. background: $facade-fill-2;
  1091. color: $facade-text-muted;
  1092. }
  1093. .status-published {
  1094. background: $status-success-tint-2;
  1095. color: $status-success-2;
  1096. }
  1097. .status-draft {
  1098. background: $uni-primary-pale;
  1099. color: $brand-primary;
  1100. }
  1101. .card-price {
  1102. font-size: calc(28rpx * var(--font-scale, 1));
  1103. color: $brand-primary;
  1104. font-weight: 600;
  1105. }
  1106. .card-price.free {
  1107. color: $status-success-2;
  1108. }
  1109. .card-actions {
  1110. display: flex;
  1111. flex-direction: row;
  1112. gap: 12rpx;
  1113. margin-top: 12rpx;
  1114. }
  1115. .btn-cancel {
  1116. padding: 8rpx 20rpx;
  1117. font-size: calc(22rpx * var(--font-scale, 1));
  1118. color: $facade-text-muted;
  1119. background: $app-surface;
  1120. border: 1rpx solid $facade-border-soft;
  1121. border-radius: 24rpx;
  1122. line-height: 1.5;
  1123. }
  1124. .btn-checkin {
  1125. padding: 8rpx 20rpx;
  1126. font-size: calc(22rpx * var(--font-scale, 1));
  1127. color: $app-surface;
  1128. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1129. border: none;
  1130. border-radius: 24rpx;
  1131. line-height: 1.5;
  1132. }
  1133. .empty-state {
  1134. display: flex;
  1135. flex-direction: column;
  1136. align-items: center;
  1137. justify-content: center;
  1138. padding: 120rpx 40rpx;
  1139. }
  1140. .empty-icon {
  1141. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  1142. margin-bottom: 20rpx;
  1143. }
  1144. .empty-title {
  1145. font-size: calc(32rpx * var(--font-scale, 1));
  1146. font-weight: 600;
  1147. color: $facade-text-strong;
  1148. margin-bottom: 12rpx;
  1149. }
  1150. .empty-desc {
  1151. font-size: calc(26rpx * var(--font-scale, 1));
  1152. color: $facade-text-muted;
  1153. margin-bottom: 40rpx;
  1154. }
  1155. .empty-btn {
  1156. padding: 16rpx 48rpx;
  1157. font-size: calc(28rpx * var(--font-scale, 1));
  1158. color: $app-surface;
  1159. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1160. border: none;
  1161. border-radius: 24rpx;
  1162. }
  1163. .loading-state {
  1164. display: flex;
  1165. flex-direction: column;
  1166. align-items: center;
  1167. justify-content: center;
  1168. padding: 80rpx 40rpx;
  1169. }
  1170. .loading-spinner {
  1171. width: 60rpx;
  1172. height: 60rpx;
  1173. border: 4rpx solid $status-warning-light;
  1174. border-top-color: $brand-primary;
  1175. border-radius: 50%;
  1176. animation: spin 0.8s linear infinite;
  1177. margin-bottom: 20rpx;
  1178. }
  1179. @keyframes spin {
  1180. to { transform: rotate(360deg); }
  1181. }
  1182. .loading-text {
  1183. font-size: calc(26rpx * var(--font-scale, 1));
  1184. color: $facade-text-muted;
  1185. }
  1186. .load-more-tip {
  1187. text-align: center;
  1188. padding: $uni-space-page;
  1189. }
  1190. .load-more-text {
  1191. font-size: calc(24rpx * var(--font-scale, 1));
  1192. color: $facade-text-muted;
  1193. }
  1194. /* Nav add button */
  1195. .nav-add-btn {
  1196. position: absolute;
  1197. right: 24rpx;
  1198. top: 50%;
  1199. transform: translateY(-50%);
  1200. width: 56rpx;
  1201. height: 56rpx;
  1202. background: rgba(255, 255, 255, 0.15);
  1203. border-radius: 50%;
  1204. display: flex;
  1205. align-items: center;
  1206. justify-content: center;
  1207. }
  1208. .nav-add-icon {
  1209. color: $app-surface;
  1210. font-size: calc(36rpx * var(--font-scale, 1));
  1211. font-weight: 400;
  1212. line-height: 1;
  1213. }
  1214. /* Manage overview stats */
  1215. .manage-overview {
  1216. display: flex;
  1217. flex-direction: row;
  1218. padding: 24rpx;
  1219. gap: 16rpx;
  1220. background: $app-surface;
  1221. margin: 24rpx 24rpx 0;
  1222. border-radius: 16rpx;
  1223. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
  1224. }
  1225. .manage-stat-card {
  1226. flex: 1;
  1227. display: flex;
  1228. flex-direction: column;
  1229. align-items: center;
  1230. padding: 16rpx 0;
  1231. }
  1232. .manage-stat-num {
  1233. font-size: calc(40rpx * var(--font-scale, 1));
  1234. font-weight: 700;
  1235. color: $facade-text-strong;
  1236. line-height: 1.2;
  1237. }
  1238. .manage-published {
  1239. color: $status-success-2;
  1240. }
  1241. .manage-draft {
  1242. color: $brand-primary;
  1243. }
  1244. .manage-ended {
  1245. color: $facade-text-muted;
  1246. }
  1247. .manage-stat-label {
  1248. font-size: calc(22rpx * var(--font-scale, 1));
  1249. color: $facade-text-muted;
  1250. margin-top: 8rpx;
  1251. }
  1252. /* Quick action button */
  1253. .manage-actions {
  1254. padding: 24rpx 24rpx 0;
  1255. }
  1256. .manage-action-btn {
  1257. display: flex;
  1258. flex-direction: row;
  1259. align-items: center;
  1260. justify-content: center;
  1261. gap: 12rpx;
  1262. padding: 24rpx 0;
  1263. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1264. border-radius: 16rpx;
  1265. margin: 0 24rpx;
  1266. }
  1267. .manage-action-icon {
  1268. color: $app-surface;
  1269. font-size: calc(36rpx * var(--font-scale, 1));
  1270. font-weight: 400;
  1271. }
  1272. .manage-action-text {
  1273. color: $app-surface;
  1274. font-size: calc(28rpx * var(--font-scale, 1));
  1275. font-weight: 600;
  1276. }
  1277. /* Section title */
  1278. .manage-section-title {
  1279. padding: 24rpx 24rpx 12rpx;
  1280. }
  1281. .manage-section-title text {
  1282. font-size: calc(28rpx * var(--font-scale, 1));
  1283. font-weight: 600;
  1284. color: $facade-text-strong;
  1285. }
  1286. /* Manage action group in card */
  1287. .manage-action-group {
  1288. display: flex;
  1289. flex-direction: row;
  1290. gap: 16rpx;
  1291. align-items: center;
  1292. }
  1293. .manage-action-small {
  1294. font-size: calc(22rpx * var(--font-scale, 1));
  1295. padding: 4rpx 16rpx;
  1296. border-radius: 24rpx;
  1297. background: $brand-primary;
  1298. color: $app-surface;
  1299. font-weight: 500;
  1300. }
  1301. </style>