index.vue 44 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 fontScaleMixin from '@/mixins/font-scale.js'
  303. export default {
  304. mixins: [fontScaleMixin],
  305. computed: {
  306. // 管理 tab 只对有活动管理权限的账号展示(普通家长/孩子不显示,避免点进去是空白)
  307. visibleTabs: function() {
  308. var list = [
  309. { key: 'mine', label: '我的活动' },
  310. { key: 'discover', label: '发现活动' },
  311. { key: 'history', label: '历史记录' }
  312. ]
  313. if (this.canManageActivity) {
  314. list.push({ key: 'manage', label: '管理' })
  315. }
  316. return list
  317. }
  318. },
  319. data() {
  320. return {
  321. // 活动管理权限:后台角色(admin/activity_admin/activity_manager)或已通过审核的活动提供商
  322. canManageActivity: false,
  323. // 是否有权直接发布(后台活动管理员);服务商只能提交审核
  324. canDirectPublish: false,
  325. currentTab: 'mine',
  326. mineFilters: [
  327. { label: '全部', value: '' },
  328. { label: '待开始', value: 'upcoming' },
  329. { label: '待审核', value: 'pending' },
  330. { label: '已签到', value: 'checked_in' }
  331. ],
  332. dimensionFilters: [
  333. { label: '全部', value: '' },
  334. { label: '身', value: 'body' },
  335. { label: '心', value: 'mind' },
  336. { label: '智', value: 'wisdom' },
  337. { label: '行', value: 'action' },
  338. { label: '富', value: 'wealth' }
  339. ],
  340. currentMineFilter: '',
  341. currentDimension: '',
  342. myActivities: [],
  343. discoverActivities: [],
  344. historyActivities: [],
  345. mineLoading: false,
  346. discoverLoading: false,
  347. historyLoading: false,
  348. minePage: 1,
  349. discoverPage: 1,
  350. historyPage: 1,
  351. pageSize: 10,
  352. hasMore: true,
  353. isRefreshing: false,
  354. // Manage tab data
  355. manageLoading: false,
  356. manageStats: { total: 0, published: 0, draft: 0, ended: 0 },
  357. manageActivities: []
  358. }
  359. },
  360. onLoad: function(options) {
  361. reportAppEnter('activity');
  362. if (options && options.tab) {
  363. this.currentTab = options.tab
  364. }
  365. this.resolveManagePermission()
  366. this.loadData()
  367. this._onLoadFired = true
  368. },
  369. onShow: function() {
  370. if (this._onLoadFired) {
  371. this._onLoadFired = false // 首次进入:onLoad 已加载,跳过避免双发
  372. } else {
  373. // 从子页面(如活动详情)返回:刷新当前 tab(loadData 统一重置第一页,避免旧数据被追加导致翻倍)
  374. this.resolveManagePermission()
  375. this.loadData()
  376. }
  377. },
  378. methods: {
  379. tagList: function(tags) {
  380. return String(tags || '').split(/[,,、]/).map(function(t) { return t.trim() }).filter(function(t) { return !!t })
  381. },
  382. // 富文本(HTML)→ 纯文本摘要:去掉 style/script 标签与 HTML 标签、解码 HTML 实体(&nbsp; &#x27; 等)、压缩空白
  383. plainText: function(html) {
  384. if (!html) return ''
  385. var s = String(html)
  386. .replace(/<style[\s\S]*?<\/style>/gi, ' ')
  387. .replace(/<script[\s\S]*?<\/script>/gi, ' ')
  388. .replace(/<[^>]+>/g, ' ')
  389. .replace(/&nbsp;/gi, ' ')
  390. .replace(/&lt;/gi, '<')
  391. .replace(/&gt;/gi, '>')
  392. .replace(/&amp;/gi, '&')
  393. .replace(/&quot;/gi, '"')
  394. s = s
  395. .replace(/&#x([0-9a-fA-F]+);/g, function(all, hex) { return String.fromCharCode(parseInt(hex, 16)) })
  396. .replace(/&#(\d+);/g, function(all, dec) { return String.fromCharCode(parseInt(dec, 10)) })
  397. .replace(/\s+/g, ' ')
  398. .trim()
  399. return s
  400. },
  401. // 活动管理权限判定:与后端 ActivityController.hasActivityManageRole 对齐。
  402. // 后台角色(admin / activity_admin / activity_manager)→ 可直接发布;
  403. // 其余账号查服务商入驻状态,vendorType=activity_provider 且审核通过 → 可管理(只能提交审核)。
  404. resolveManagePermission: function() {
  405. var self = this
  406. if (hasActivityManageRole()) {
  407. self.canDirectPublish = true
  408. self.canManageActivity = true
  409. self.onPermissionResolved()
  410. return
  411. }
  412. // 未登录不发 vendorStatus:请求层会因 401 触发静默续期/跳登录,影响游客浏览活动
  413. if (!uni.getStorageSync('token')) {
  414. return
  415. }
  416. vendorStatus().then(function(res) {
  417. var approvedProvider = isApprovedActivityProvider((res && res.data) || {})
  418. // 非后台角色才由服务商审核状态决定(后台角色已在上面提前返回,不会被覆盖)
  419. if (!self.canDirectPublish) {
  420. self.canManageActivity = approvedProvider
  421. }
  422. self.onPermissionResolved()
  423. }).catch(function() {
  424. if (!self.canDirectPublish) {
  425. self.canManageActivity = false
  426. }
  427. self.onPermissionResolved()
  428. })
  429. },
  430. // 权限解析完成后的兜底:以 ?tab=manage 进来但无权限时回落到「我的活动」,避免空白页
  431. onPermissionResolved: function() {
  432. if (this.currentTab === 'manage' && !this.canManageActivity) {
  433. this.currentTab = 'mine'
  434. this.loadData()
  435. }
  436. },
  437. getImageUrl: function(path) {
  438. if (!path || path === 'null' || path === 'undefined' || path === '/null') return ''
  439. var s = String(path).trim()
  440. if (!s || s === 'null' || s === '/null') return ''
  441. if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) return s
  442. return config.API_BASE_URL + (s.charAt(0) === '/' ? s : '/' + s)
  443. },
  444. onTabChange: function(key) {
  445. this.currentTab = key
  446. this.hasMore = true
  447. if (key === 'mine') {
  448. this.minePage = 1
  449. this.myActivities = []
  450. } else if (key === 'discover') {
  451. this.discoverPage = 1
  452. this.discoverActivities = []
  453. } else if (key === 'history') {
  454. this.historyPage = 1
  455. this.historyActivities = []
  456. }
  457. this.loadData()
  458. },
  459. // 统一入口:onLoad / Tab 切换 / 筛选变更 / 从详情页返回(onShow) 都走这里。
  460. // 语义固定为「重置为第一页后重新加载」——先清空数组并回到 page=1,
  461. // 避免走 loadXxxActivities() 的非 refresh 分支导致列表被 concat 叠加(详情页返回时列表翻倍)。
  462. // 加载更多不走这里,由 onLoadMore 自行递增页码追加。
  463. loadData: function() {
  464. if (this.currentTab === 'mine') {
  465. this.minePage = 1
  466. this.myActivities = []
  467. this.hasMore = true
  468. this.loadMyActivities()
  469. } else if (this.currentTab === 'discover') {
  470. this.discoverPage = 1
  471. this.discoverActivities = []
  472. this.hasMore = true
  473. this.loadDiscoverActivities()
  474. } else if (this.currentTab === 'history') {
  475. this.historyPage = 1
  476. this.historyActivities = []
  477. this.hasMore = true
  478. this.loadHistoryActivities()
  479. } else if (this.currentTab === 'manage') {
  480. // 权限未解析/无权限时不发管理列表请求(onPermissionResolved 会回落 mine)
  481. if (this.canManageActivity) {
  482. this.loadManageData()
  483. }
  484. }
  485. },
  486. loadManageData: function() {
  487. var self = this
  488. this.manageLoading = true
  489. // 活动服务商(非后台角色)只看自己创建/负责的活动,后台活动管理员由后端按角色隔离
  490. var params = { page: 1, size: 100 }
  491. if (!self.canDirectPublish) {
  492. params.mineOnly = true
  493. }
  494. adminListMyActivities(params).then(function(res) {
  495. self.manageLoading = false
  496. if (res && res.code === 200 && res.data) {
  497. var records = res.data.records || []
  498. self.manageActivities = records.slice(0, 20)
  499. var total = records.length
  500. var published = 0
  501. var draft = 0
  502. var ended = 0
  503. for (var i = 0; i < records.length; i++) {
  504. var s = records[i].status
  505. if (s === 'published') published++
  506. else if (s === 'draft') draft++
  507. else if (s === 'ended' || s === 'cancelled' || s === 'withdrawn') ended++
  508. }
  509. self.manageStats = { total: total, published: published, draft: draft, ended: ended }
  510. } else {
  511. self.manageActivities = []
  512. self.manageStats = { total: 0, published: 0, draft: 0, ended: 0 }
  513. }
  514. }).catch(function() {
  515. self.manageLoading = false
  516. self.manageActivities = []
  517. self.manageStats = { total: 0, published: 0, draft: 0, ended: 0 }
  518. })
  519. },
  520. goCreate: function() {
  521. uni.navigateTo({ url: '/pages/activity/create' })
  522. },
  523. goEdit: function(act) {
  524. uni.navigateTo({ url: '/pages/activity/create?id=' + act.id })
  525. },
  526. statusLabel: function(status) {
  527. var map = {
  528. draft: '草稿',
  529. pending: '待审核',
  530. rejected: '已驳回',
  531. published: '进行中',
  532. ended: '已结束',
  533. withdrawn: '已撤回',
  534. cancelled: '已取消'
  535. }
  536. return map[status] || status
  537. },
  538. doPublish: function(id) {
  539. var self = this
  540. uni.showModal({
  541. title: '提示',
  542. content: '确认发布此活动吗?发布后将对外可见。',
  543. success: function(res) {
  544. if (res.confirm) {
  545. uni.showLoading({ title: '发布中...' })
  546. if (self.canDirectPublish) {
  547. adminPublishActivity(id).then(function(r) {
  548. uni.hideLoading()
  549. if (r && r.code === 200) {
  550. uni.showToast({ title: '发布成功', icon: 'success' })
  551. self.loadManageData()
  552. } else {
  553. uni.showToast({ title: (r && r.message) || '发布失败', icon: 'none' })
  554. }
  555. }).catch(function() {
  556. uni.hideLoading()
  557. uni.showToast({ title: '发布失败', icon: 'none' })
  558. })
  559. } else {
  560. submitActivityForReview(id).then(function(r) {
  561. uni.hideLoading()
  562. if (r && r.code === 200) {
  563. uni.showToast({ title: '已提交审核', icon: 'success' })
  564. self.loadManageData()
  565. } else {
  566. uni.showToast({ title: (r && r.message) || '提交审核失败', icon: 'none' })
  567. }
  568. }).catch(function() {
  569. uni.hideLoading()
  570. uni.showToast({ title: '提交审核失败', icon: 'none' })
  571. })
  572. }
  573. }
  574. }
  575. })
  576. },
  577. doEnd: function(id) {
  578. var self = this
  579. uni.showModal({
  580. title: '提示',
  581. content: '确认结束此活动吗?结束后不再接受新参与者。',
  582. success: function(res) {
  583. if (res.confirm) {
  584. uni.showLoading({ title: '操作中...' })
  585. adminEndActivity(id).then(function(r) {
  586. uni.hideLoading()
  587. if (r && r.code === 200) {
  588. uni.showToast({ title: '已结束', icon: 'success' })
  589. self.loadManageData()
  590. } else {
  591. uni.showToast({ title: (r && r.message) || '操作失败', icon: 'none' })
  592. }
  593. }).catch(function() {
  594. uni.hideLoading()
  595. uni.showToast({ title: '网络异常', icon: 'none' })
  596. })
  597. }
  598. }
  599. })
  600. },
  601. doWithdraw: function(id) {
  602. var self = this
  603. uni.showModal({
  604. title: '提示',
  605. content: '确认撤回此活动吗?撤回后不再对外展示,可重新编辑。',
  606. success: function(res) {
  607. if (res.confirm) {
  608. uni.showLoading({ title: '操作中...' })
  609. adminWithdrawActivity(id).then(function(r) {
  610. uni.hideLoading()
  611. if (r && r.code === 200) {
  612. uni.showToast({ title: '已撤回', icon: 'success' })
  613. self.loadManageData()
  614. } else {
  615. uni.showToast({ title: (r && r.message) || '操作失败', icon: 'none' })
  616. }
  617. }).catch(function() {
  618. uni.hideLoading()
  619. uni.showToast({ title: '网络异常', icon: 'none' })
  620. })
  621. }
  622. }
  623. })
  624. },
  625. onMineFilterChange: function(value) {
  626. this.currentMineFilter = value
  627. this.minePage = 1
  628. this.myActivities = []
  629. this.hasMore = true
  630. if (this.currentTab === 'mine') {
  631. this.loadMyActivities()
  632. } else if (this.currentTab === 'history') {
  633. this.loadHistoryActivities()
  634. }
  635. },
  636. onDimensionChange: function(value) {
  637. this.currentDimension = value
  638. this.discoverPage = 1
  639. this.discoverActivities = []
  640. this.hasMore = true
  641. this.loadDiscoverActivities()
  642. },
  643. onLoadMore: function() {
  644. if (!this.hasMore) return
  645. if (this.currentTab === 'mine' && !this.mineLoading) {
  646. this.minePage++
  647. this.loadMyActivities()
  648. } else if (this.currentTab === 'discover' && !this.discoverLoading) {
  649. this.discoverPage++
  650. this.loadDiscoverActivities()
  651. } else if (this.currentTab === 'history' && !this.historyLoading) {
  652. this.historyPage++
  653. this.loadHistoryActivities()
  654. }
  655. },
  656. onRefresh: function() {
  657. var self = this
  658. this.isRefreshing = true
  659. if (this.currentTab === 'mine') {
  660. this.loadMyActivities(true).finally(function() {
  661. self.isRefreshing = false
  662. })
  663. } else if (this.currentTab === 'discover') {
  664. this.loadDiscoverActivities(true).finally(function() {
  665. self.isRefreshing = false
  666. })
  667. } else if (this.currentTab === 'history') {
  668. this.loadHistoryActivities(true).finally(function() {
  669. self.isRefreshing = false
  670. })
  671. } else {
  672. this.isRefreshing = false
  673. }
  674. },
  675. loadMyActivities: function(refresh) {
  676. var self = this
  677. if (refresh) {
  678. this.minePage = 1
  679. this.myActivities = []
  680. }
  681. // 请求序号:返回期间若已发起新请求(onShow/下拉刷新重置),旧响应直接丢弃,防止旧分页追加导致列表翻倍
  682. var seq = (this._mineReqSeq || 0) + 1
  683. this._mineReqSeq = seq
  684. this.mineLoading = true
  685. var memberId = uni.getStorageSync('currentChildId')
  686. if (!memberId) {
  687. this.mineLoading = false
  688. return Promise.resolve()
  689. }
  690. var params = {
  691. memberId: memberId,
  692. page: this.minePage,
  693. size: this.pageSize
  694. }
  695. if (this.currentMineFilter && this.currentMineFilter !== 'upcoming') {
  696. params.status = this.currentMineFilter
  697. }
  698. // 返回 Promise:onRefresh 的 .finally 依赖它来复位 isRefreshing(不返回会导致 undefined.finally 抛错,下拉刷新卡死)
  699. return getMyActivityRegistrations(params).then(function(res) {
  700. if (seq !== self._mineReqSeq) return
  701. self.mineLoading = false
  702. if (res && res.code === 200 && res.data) {
  703. var records = res.data.records || []
  704. for (var ni = 0; ni < records.length; ni++) {
  705. self.normalizeRegistration(records[ni])
  706. }
  707. if (self.currentMineFilter === 'upcoming') {
  708. var now = new Date()
  709. var filtered = []
  710. for (var i = 0; i < records.length; i++) {
  711. var act = records[i]
  712. if (act.startTime) {
  713. var startTime = parseDate(act.startTime)
  714. if (!startTime) continue
  715. if (startTime > now && act.status === 'approved') {
  716. filtered.push(act)
  717. }
  718. }
  719. }
  720. records = filtered
  721. }
  722. for (var di = 0; di < records.length; di++) {
  723. self.decorateActivity(records[di])
  724. }
  725. if (refresh) {
  726. self.myActivities = records
  727. } else {
  728. self.myActivities = self.myActivities.concat(records)
  729. }
  730. self.hasMore = records.length >= self.pageSize
  731. }
  732. }).catch(function() {
  733. if (seq === self._mineReqSeq) self.mineLoading = false
  734. })
  735. },
  736. loadDiscoverActivities: function(refresh) {
  737. var self = this
  738. if (refresh) {
  739. this.discoverPage = 1
  740. this.discoverActivities = []
  741. }
  742. // 请求序号:过期响应直接丢弃,防止旧分页在刷新后追加导致列表翻倍
  743. var seq = (this._discoverReqSeq || 0) + 1
  744. this._discoverReqSeq = seq
  745. this.discoverLoading = true
  746. var params = {
  747. page: this.discoverPage,
  748. size: this.pageSize
  749. }
  750. if (this.currentDimension) {
  751. params.dimensionCode = this.currentDimension
  752. }
  753. // 返回 Promise:onRefresh 的 .finally 依赖它复位 isRefreshing
  754. return getActivityList(params).then(function(res) {
  755. if (seq !== self._discoverReqSeq) return
  756. self.discoverLoading = false
  757. if (res && res.code === 200 && res.data) {
  758. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  759. if (refresh) {
  760. self.discoverActivities = list
  761. } else {
  762. self.discoverActivities = self.discoverActivities.concat(list)
  763. }
  764. self.hasMore = list.length >= self.pageSize
  765. }
  766. }).catch(function() {
  767. if (seq === self._discoverReqSeq) self.discoverLoading = false
  768. })
  769. },
  770. loadHistoryActivities: function(refresh) {
  771. var self = this
  772. if (refresh) {
  773. this.historyPage = 1
  774. this.historyActivities = []
  775. }
  776. // 请求序号:过期响应直接丢弃,防止旧分页在刷新后追加导致列表翻倍
  777. var seq = (this._historyReqSeq || 0) + 1
  778. this._historyReqSeq = seq
  779. this.historyLoading = true
  780. var memberId = uni.getStorageSync('currentChildId')
  781. if (!memberId) {
  782. this.historyLoading = false
  783. return Promise.resolve()
  784. }
  785. var params = {
  786. memberId: memberId,
  787. page: this.historyPage,
  788. size: this.pageSize
  789. }
  790. // 返回 Promise:onRefresh 的 .finally 依赖它复位 isRefreshing
  791. return getMyActivityRegistrations(params).then(function(res) {
  792. if (seq !== self._historyReqSeq) return
  793. self.historyLoading = false
  794. if (res && res.code === 200 && res.data) {
  795. var records = res.data.records || []
  796. var now = new Date()
  797. var ended = []
  798. for (var i = 0; i < records.length; i++) {
  799. var act = records[i]
  800. self.normalizeRegistration(act)
  801. var endTime = parseDate(act.endTime)
  802. var startTime = parseDate(act.startTime)
  803. // 有结束时间按结束时间判断;无结束时间(如线上活动)按开始时间已过判断
  804. var isPast = (endTime && endTime < now) || (!endTime && startTime && startTime < now)
  805. if (isPast || act.status === 'cancelled' || act.status === 'rejected') {
  806. ended.push(act)
  807. }
  808. }
  809. if (refresh) {
  810. self.historyActivities = ended
  811. } else {
  812. self.historyActivities = self.historyActivities.concat(ended)
  813. }
  814. self.hasMore = records.length >= self.pageSize
  815. }
  816. }).catch(function() {
  817. if (seq === self._historyReqSeq) self.historyLoading = false
  818. })
  819. },
  820. // 报名记录 → 卡片所需字段:/api/activity/my-registrations 返回的是
  821. // activityTitle/activityStartTime/... ,直接渲染会标题/时间/封面/费用全空
  822. normalizeRegistration: function(act) {
  823. if (!act) return act
  824. if (!act.title && act.activityTitle) act.title = act.activityTitle
  825. if (act.activityStartTime) act.startTime = formatDateTime(act.activityStartTime)
  826. if (act.activityEndTime) act.endTime = formatDateTime(act.activityEndTime)
  827. if (!act.coverImage && act.activityCoverImage) act.coverImage = act.activityCoverImage
  828. if (!act.location && act.activityLocation) act.location = act.activityLocation
  829. var fees = [act.activityChildFee, act.activityChildMemberFee, act.activityParentFee, act.activityParentMemberFee]
  830. var price = 0
  831. for (var i = 0; i < fees.length; i++) {
  832. var f = Number(fees[i]) || 0
  833. if (f > 0 && (price === 0 || f < price)) price = f
  834. }
  835. act.price = price
  836. return act
  837. },
  838. goDetail: function(act) {
  839. // 报名记录的 id 是报名 id,必须取 activityId;发现列表的 id 即活动 id
  840. var id = act.activityId || act.id
  841. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + id })
  842. },
  843. switchToDiscover: function() {
  844. this.currentTab = 'discover'
  845. this.hasMore = true
  846. this.discoverPage = 1
  847. this.discoverActivities = []
  848. this.loadDiscoverActivities()
  849. },
  850. formatPrice: function(price) {
  851. return (price / 100).toFixed(2)
  852. },
  853. formatDateTime: formatDateTime,
  854. // 活动时间展示:复用统一 formatDateTime 后裁剪秒,输出 yyyy-MM-dd HH:mm(活动到分钟即可)
  855. formatActivityTime: function(t) {
  856. var s = formatDateTime(t)
  857. return s ? s.substring(0, 16) : ''
  858. },
  859. hasFee: function(act) {
  860. return (act.childFee > 0) || (act.childMemberFee > 0) || (act.parentFee > 0) || (act.parentMemberFee > 0)
  861. },
  862. minFee: function(act) {
  863. var fees = [act.childFee, act.childMemberFee, act.parentFee, act.parentMemberFee]
  864. var min = 0
  865. for (var i = 0; i < fees.length; i++) {
  866. if (fees[i] > 0 && (min === 0 || fees[i] < min)) min = fees[i]
  867. }
  868. return this.formatPrice(min)
  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: 28rpx;
  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: 24rpx;
  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: 12rpx;
  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: 22rpx;
  1031. color: $brand-primary;
  1032. background: $uni-primary-pale;
  1033. padding: 2rpx 12rpx;
  1034. border-radius: 6rpx;
  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: 24rpx;
  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: 22rpx;
  1062. padding: 4rpx 12rpx;
  1063. border-radius: 6rpx;
  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: 28rpx;
  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: 22rpx;
  1118. color: $facade-text-muted;
  1119. background: $app-surface;
  1120. border: 1rpx solid $facade-border-soft;
  1121. border-radius: 20rpx;
  1122. line-height: 1.5;
  1123. }
  1124. .btn-checkin {
  1125. padding: 8rpx 20rpx;
  1126. font-size: 22rpx;
  1127. color: $app-surface;
  1128. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1129. border: none;
  1130. border-radius: 20rpx;
  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: 80rpx;
  1142. margin-bottom: 20rpx;
  1143. }
  1144. .empty-title {
  1145. font-size: 32rpx;
  1146. font-weight: 600;
  1147. color: $facade-text-strong;
  1148. margin-bottom: 12rpx;
  1149. }
  1150. .empty-desc {
  1151. font-size: 26rpx;
  1152. color: $facade-text-muted;
  1153. margin-bottom: 40rpx;
  1154. }
  1155. .empty-btn {
  1156. padding: 16rpx 48rpx;
  1157. font-size: 28rpx;
  1158. color: $app-surface;
  1159. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1160. border: none;
  1161. border-radius: 40rpx;
  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: 26rpx;
  1184. color: $facade-text-muted;
  1185. }
  1186. .load-more-tip {
  1187. text-align: center;
  1188. padding: 30rpx;
  1189. }
  1190. .load-more-text {
  1191. font-size: 24rpx;
  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: 36rpx;
  1211. font-weight: 300;
  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: 12rpx;
  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: 40rpx;
  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: 22rpx;
  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: 12rpx;
  1265. margin: 0 24rpx;
  1266. }
  1267. .manage-action-icon {
  1268. color: $app-surface;
  1269. font-size: 36rpx;
  1270. font-weight: 300;
  1271. }
  1272. .manage-action-text {
  1273. color: $app-surface;
  1274. font-size: 28rpx;
  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: 28rpx;
  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: 22rpx;
  1295. padding: 4rpx 16rpx;
  1296. border-radius: 20rpx;
  1297. background: $brand-primary;
  1298. color: $app-surface;
  1299. font-weight: 500;
  1300. }
  1301. </style>