create.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. <template>
  2. <view class="container">
  3. <view class="form-card">
  4. <!-- 活动标题 -->
  5. <view class="form-item">
  6. <text class="form-label">活动标题 *</text>
  7. <input class="form-input" v-model="form.title" placeholder="请输入活动标题" maxlength="50" />
  8. </view>
  9. <!-- 活动类型 -->
  10. <view class="form-item">
  11. <text class="form-label">活动类型 *</text>
  12. <picker class="form-picker" :value="typeIdx" :range="typeOptions" range-key="label" @change="onTypeChange">
  13. <text class="picker-text">{{ form.activityType ? typeLabel(form.activityType) : '请选择类型' }}</text>
  14. </picker>
  15. </view>
  16. <!-- 开始时间 -->
  17. <view class="form-item">
  18. <text class="form-label">开始时间 *</text>
  19. <picker class="form-picker" mode="date" :value="datePart" @change="onStartDateChange">
  20. <text class="picker-text">{{ datePart || '选择日期' }}</text>
  21. </picker>
  22. <picker class="form-picker" mode="time" :value="timePart" @change="onStartTimeChange" style="margin-top: 16rpx;">
  23. <text class="picker-text">{{ timePart || '选择时间' }}</text>
  24. </picker>
  25. </view>
  26. <!-- 结束时间 -->
  27. <view class="form-item">
  28. <text class="form-label">结束时间</text>
  29. <picker class="form-picker" mode="date" :value="endDatePart" @change="onEndDateChange">
  30. <text class="picker-text">{{ endDatePart || '选择日期(可选)' }}</text>
  31. </picker>
  32. <picker class="form-picker" mode="time" :value="endTimePart" @change="onEndTimeChange" style="margin-top: 16rpx;">
  33. <text class="picker-text">{{ endTimePart || '选择时间(可选)' }}</text>
  34. </picker>
  35. </view>
  36. <!-- 报名截止时间 -->
  37. <view class="form-item">
  38. <text class="form-label">报名截止时间</text>
  39. <picker class="form-picker" mode="date" :value="regDatePart" @change="onRegDateChange">
  40. <text class="picker-text">{{ regDatePart || '选择日期(不填=活动开始前)' }}</text>
  41. </picker>
  42. <picker class="form-picker" mode="time" :value="regTimePart" @change="onRegTimeChange" style="margin-top: 16rpx;">
  43. <text class="picker-text">{{ regTimePart || '选择时间' }}</text>
  44. </picker>
  45. </view>
  46. <!-- 活动地点 -->
  47. <view class="form-item">
  48. <text class="form-label">活动地点</text>
  49. <input class="form-input" v-model="form.location" placeholder="请输入活动地点" maxlength="100" />
  50. </view>
  51. <!-- 人数 + 价格 -->
  52. <view class="form-item-row">
  53. <view class="form-item half">
  54. <text class="form-label">最大人数</text>
  55. <input class="form-input" type="number" v-model="maxParticipantsStr" placeholder="0=不限" />
  56. </view>
  57. <view class="form-item half">
  58. <text class="form-label">孩子费用(元)</text>
  59. <input class="form-input" type="digit" v-model="childFeeYuan" placeholder="0=免费" />
  60. </view>
  61. </view>
  62. <view class="form-item-row">
  63. <view class="form-item half">
  64. <text class="form-label">孩子会员费(元)</text>
  65. <input class="form-input" type="digit" v-model="childMemberFeeYuan" placeholder="0=免费" />
  66. </view>
  67. <view class="form-item half">
  68. <text class="form-label">家长费用(元)</text>
  69. <input class="form-input" type="digit" v-model="parentFeeYuan" placeholder="0=免费" />
  70. </view>
  71. </view>
  72. <view class="form-item">
  73. <text class="form-label">家长会员费(元)</text>
  74. <input class="form-input" type="digit" v-model="parentMemberFeeYuan" placeholder="0=免费" />
  75. </view>
  76. <!-- 主办方 -->
  77. <view class="form-item">
  78. <text class="form-label">主办方</text>
  79. <input class="form-input" v-model="form.vendorName" placeholder="请输入主办方名称(可选)" maxlength="50" />
  80. </view>
  81. <!-- 封面图片 -->
  82. <view class="form-item">
  83. <text class="form-label">封面图片</text>
  84. <view class="cover-upload" @click="chooseImage">
  85. <image v-if="form.coverImage" class="preview-img" :src="getCoverUrl(form.coverImage)" mode="aspectFill" @click.stop lazy-load />
  86. <view v-else class="upload-placeholder">
  87. <text class="upload-icon">📷</text>
  88. <text class="upload-text">点击上传封面图</text>
  89. </view>
  90. </view>
  91. <view class="cover-actions" v-if="form.coverImage">
  92. <text class="cover-action" @click="chooseImage">重新选择</text>
  93. <text class="cover-action-danger" @click="removeCover">移除</text>
  94. </view>
  95. </view>
  96. <!-- 活动描述 -->
  97. <view class="form-item">
  98. <text class="form-label">活动描述</text>
  99. <textarea class="form-textarea" v-model="form.description" placeholder="请输入活动详细介绍" maxlength="500"
  100. auto-height />
  101. </view>
  102. <!-- 操作按钮 -->
  103. <view class="form-actions">
  104. <view class="btn-save" @click="handleSave">
  105. <text>保存为草稿</text>
  106. </view>
  107. <view class="btn-publish" @click="handlePublish">
  108. <text>{{ isAdmin ? '保存并发布' : '保存并提交审核' }}</text>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 海报模板选择 + 预览 -->
  113. <view class="form-card" v-if="posterTemplates.length > 0">
  114. <view class="form-title">活动海报模板(可选)</view>
  115. <view class="poster-tpl-list">
  116. <view
  117. v-for="tpl in posterTemplates"
  118. :key="tpl.id"
  119. class="poster-tpl-card"
  120. :class="{ 'poster-tpl-active': form.posterTemplateId === tpl.id }"
  121. @click="selectPosterTemplate(tpl)"
  122. >
  123. <view class="tpl-colors">
  124. <view class="tpl-dot tpl-main" :style="{ background: tpl.mainColor || '#F97316' }"></view>
  125. <view class="tpl-dot tpl-dark" :style="{ background: tpl.darkColor || '#EA580C' }"></view>
  126. <view class="tpl-dot tpl-light" :style="{ background: tpl.lightColor || '#FFF7ED' }"></view>
  127. </view>
  128. <text class="tpl-name">{{ tpl.name }}</text>
  129. </view>
  130. </view>
  131. <view class="poster-preview-row" v-if="form.posterTemplateId">
  132. <text class="poster-preview-hint">已选择海报模板,点击「预览」查看效果</text>
  133. <view class="btn-preview" @click="openPosterPreview">预览</view>
  134. </view>
  135. </view>
  136. <!-- 海报预览弹层 -->
  137. <content-share-poster
  138. v-if="showPosterPreview"
  139. :show="showPosterPreview"
  140. :title="form.title || '活动海报'"
  141. :cover-image="form.coverImage"
  142. :dimension-code="form.dimensionCode"
  143. :template="previewTemplateKey"
  144. :templates="posterTemplates"
  145. :poster-qr-code="''"
  146. @close="showPosterPreview = false"
  147. @update:template="previewTemplateKey = $event"
  148. @update:bgColor="previewBgColor = $event"
  149. ></content-share-poster>
  150. <view class="loading" v-if="loading">
  151. <view class="loading-spinner"></view>
  152. <text>加载中...</text>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. import { adminCreateActivity, adminUpdateActivity, adminPublishActivity, submitActivityForReview, getActivityDetail, getPosterTemplates } from '../../utils/api.js'
  158. import config from '../../config.js'
  159. import { parseDate } from '../../utils/format.js'
  160. import { hasActivityManageRole } from '../../utils/activity-role.js'
  161. import { pickImage } from '../../utils/image-picker.js'
  162. import ContentSharePoster from '../../components/ContentSharePoster.vue'
  163. var BASE_URL = config.api('')
  164. export default {
  165. components: { ContentSharePoster },
  166. computed: {
  167. // 后台活动管理员可直接发布;服务商账号只能保存后提交审核
  168. isAdmin: function() {
  169. return hasActivityManageRole()
  170. }
  171. },
  172. data() {
  173. return {
  174. isNew: true,
  175. activityId: null,
  176. loading: false,
  177. memberId: '',
  178. form: {
  179. title: '',
  180. description: '',
  181. coverImage: '',
  182. dimensionCode: '',
  183. activityType: '',
  184. status: 'draft',
  185. startTime: null,
  186. endTime: null,
  187. registrationDeadline: null,
  188. location: '',
  189. maxParticipants: 0,
  190. childFee: 0,
  191. childMemberFee: 0,
  192. parentFee: 0,
  193. parentMemberFee: 0,
  194. visibility: 'public',
  195. requireRegistration: 1,
  196. requireCheckinReview: 0,
  197. checkinPoints: 0
  198. },
  199. childFeeYuan: '0',
  200. childMemberFeeYuan: '0',
  201. parentFeeYuan: '0',
  202. parentMemberFeeYuan: '0',
  203. maxParticipantsStr: '0',
  204. datePart: '',
  205. timePart: '',
  206. endDatePart: '',
  207. endTimePart: '',
  208. regDatePart: '',
  209. regTimePart: '',
  210. typeIdx: 0,
  211. typeOptions: [
  212. { key: 'offline', label: '线下活动' },
  213. { key: 'online', label: '线上活动' },
  214. { key: 'campaign', label: '营销活动' }
  215. ],
  216. // 海报模板
  217. posterTemplates: [],
  218. selectedPosterTemplate: null,
  219. showPosterPreview: false,
  220. previewTemplateKey: 'gradient',
  221. previewBgColor: ''
  222. }
  223. },
  224. onLoad(options) {
  225. if (options.id) {
  226. this.activityId = parseInt(options.id)
  227. this.isNew = false
  228. uni.setNavigationBarTitle({ title: '编辑活动' })
  229. this.loadDetail()
  230. } else {
  231. uni.setNavigationBarTitle({ title: '创建活动' })
  232. }
  233. // 加载海报模板列表(未登录也会返回空列表,不阻塞创建)
  234. this.loadPosterTemplates()
  235. },
  236. methods: {
  237. loadDetail() {
  238. var self = this
  239. self.loading = true
  240. getActivityDetail(self.activityId).then(function(res) {
  241. self.loading = false
  242. if (res && res.code === 200 && res.data) {
  243. var d = res.data
  244. self.form.title = d.title || ''
  245. self.form.description = d.description || ''
  246. self.form.coverImage = d.coverImage || ''
  247. self.form.vendorName = d.vendorName || ''
  248. self.form.posterTemplateId = d.posterTemplateId || null
  249. self.form.dimensionCode = d.dimensionCode || ''
  250. self.form.activityType = d.activityType || ''
  251. self.form.location = d.location || ''
  252. self.form.maxParticipants = d.maxParticipants || 0
  253. self.form.childFee = d.childFee || 0
  254. self.form.childMemberFee = d.childMemberFee || 0
  255. self.form.parentFee = d.parentFee || 0
  256. self.form.parentMemberFee = d.parentMemberFee || 0
  257. self.form.status = d.status || 'draft'
  258. self.form.visibility = d.visibility || 'public'
  259. self.maxParticipantsStr = String(self.form.maxParticipants)
  260. self.childFeeYuan = self.form.childFee ? (self.form.childFee / 100).toString() : '0'
  261. self.childMemberFeeYuan = self.form.childMemberFee ? (self.form.childMemberFee / 100).toString() : '0'
  262. self.parentFeeYuan = self.form.parentFee ? (self.form.parentFee / 100).toString() : '0'
  263. self.parentMemberFeeYuan = self.form.parentMemberFee ? (self.form.parentMemberFee / 100).toString() : '0'
  264. if (d.startTime) {
  265. var sd = parseDate(d.startTime)
  266. if (sd) {
  267. self.datePart = self.fmtDate(sd)
  268. self.timePart = self.fmtTime(sd)
  269. self.form.startTime = sd.toISOString()
  270. }
  271. }
  272. if (d.endTime) {
  273. var ed = parseDate(d.endTime)
  274. if (ed) {
  275. self.endDatePart = self.fmtDate(ed)
  276. self.endTimePart = self.fmtTime(ed)
  277. self.form.endTime = ed.toISOString()
  278. }
  279. }
  280. if (d.registrationDeadline) {
  281. var rd = parseDate(d.registrationDeadline)
  282. if (rd) {
  283. self.regDatePart = self.fmtDate(rd)
  284. self.regTimePart = self.fmtTime(rd)
  285. self.form.registrationDeadline = rd.toISOString()
  286. }
  287. }
  288. // sync type picker
  289. for (var j = 0; j < self.typeOptions.length; j++) {
  290. if (self.typeOptions[j].key === self.form.activityType) self.typeIdx = j
  291. }
  292. }
  293. }).catch(function() { self.loading = false })
  294. },
  295. onTypeChange(e) {
  296. this.typeIdx = e.detail.value
  297. this.form.activityType = this.typeOptions[this.typeIdx].key
  298. },
  299. onStartDateChange(e) {
  300. this.datePart = e.detail.value
  301. this.syncStartTime()
  302. },
  303. onStartTimeChange(e) {
  304. this.timePart = e.detail.value
  305. this.syncStartTime()
  306. },
  307. onEndDateChange(e) {
  308. this.endDatePart = e.detail.value
  309. this.syncEndTime()
  310. },
  311. onEndTimeChange(e) {
  312. this.endTimePart = e.detail.value
  313. this.syncEndTime()
  314. },
  315. onRegDateChange(e) {
  316. this.regDatePart = e.detail.value
  317. this.syncRegDeadline()
  318. },
  319. onRegTimeChange(e) {
  320. this.regTimePart = e.detail.value
  321. this.syncRegDeadline()
  322. },
  323. syncStartTime() {
  324. if (this.datePart && this.timePart) {
  325. this.form.startTime = this.datePart + 'T' + this.timePart + ':00'
  326. }
  327. },
  328. syncEndTime() {
  329. if (this.endDatePart && this.endTimePart) {
  330. this.form.endTime = this.endDatePart + 'T' + this.endTimePart + ':00'
  331. } else {
  332. this.form.endTime = null
  333. }
  334. },
  335. syncRegDeadline() {
  336. if (this.regDatePart && this.regTimePart) {
  337. this.form.registrationDeadline = this.regDatePart + 'T' + this.regTimePart + ':00'
  338. } else {
  339. this.form.registrationDeadline = null
  340. }
  341. },
  342. chooseImage() {
  343. var self = this
  344. pickImage({
  345. count: 1,
  346. sizeType: ['compressed'],
  347. success: function(res) {
  348. self.uploadCover(res.tempFilePaths[0])
  349. }
  350. })
  351. },
  352. uploadCover(filePath) {
  353. var self = this
  354. uni.uploadFile({
  355. url: BASE_URL + '/api/admin/articles/upload/image',
  356. filePath: filePath,
  357. name: 'file',
  358. header: { 'Authorization': 'Bearer ' + (uni.getStorageSync('token') || '') },
  359. success: function(res) {
  360. try {
  361. var data = JSON.parse(res.data)
  362. if (data.code === 200 && data.data) {
  363. self.form.coverImage = data.data
  364. } else {
  365. uni.showToast({ title: '上传失败', icon: 'none' })
  366. }
  367. } catch (e) {
  368. uni.showToast({ title: '上传失败', icon: 'none' })
  369. }
  370. },
  371. fail: function() {
  372. uni.showToast({ title: '上传失败', icon: 'none' })
  373. }
  374. })
  375. },
  376. onImgError() {
  377. this.form.coverImage = ''
  378. },
  379. getCoverUrl(path) {
  380. if (!path) return ''
  381. var s = String(path).trim()
  382. if (!s || s === 'null' || s === '/null') return ''
  383. if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) return s
  384. return BASE_URL + (s.charAt(0) === '/' ? s : '/' + s)
  385. },
  386. removeCover() {
  387. this.form.coverImage = ''
  388. },
  389. async loadPosterTemplates() {
  390. try {
  391. var res = await getPosterTemplates()
  392. if (res && res.code === 200) {
  393. this.posterTemplates = res.data || []
  394. }
  395. } catch (e) { /* 模板拉取失败不影响创建 */ }
  396. },
  397. selectPosterTemplate(tpl) {
  398. this.form.posterTemplateId = tpl.id
  399. this.selectedPosterTemplate = tpl
  400. this.previewTemplateKey = tpl.templateKey || 'gradient'
  401. // 默认背景色取模板主色
  402. this.previewBgColor = tpl.mainColor || ''
  403. uni.showToast({ title: '已选择:' + tpl.name, icon: 'none' })
  404. },
  405. openPosterPreview() {
  406. if (!this.form.posterTemplateId) {
  407. uni.showToast({ title: '请先选择海报模板', icon: 'none' })
  408. return
  409. }
  410. this.showPosterPreview = true
  411. },
  412. validate() {
  413. if (!this.form.title) {
  414. uni.showToast({ title: '请输入活动标题', icon: 'none' })
  415. return false
  416. }
  417. if (!this.form.activityType) {
  418. uni.showToast({ title: '请选择活动类型', icon: 'none' })
  419. return false
  420. }
  421. if (!this.datePart || !this.timePart) {
  422. uni.showToast({ title: '请选择开始时间', icon: 'none' })
  423. return false
  424. }
  425. return true
  426. },
  427. buildPayload() {
  428. var payload = Object.assign({}, this.form)
  429. payload.maxParticipants = parseInt(this.maxParticipantsStr) || 0
  430. payload.childFee = Math.round((parseFloat(this.childFeeYuan) || 0) * 100)
  431. payload.childMemberFee = Math.round((parseFloat(this.childMemberFeeYuan) || 0) * 100)
  432. payload.parentFee = Math.round((parseFloat(this.parentFeeYuan) || 0) * 100)
  433. payload.parentMemberFee = Math.round((parseFloat(this.parentMemberFeeYuan) || 0) * 100)
  434. if (this.activityId) payload.id = this.activityId
  435. // 维度由审核时设置,创建/编辑不提交空维度,避免误清空已有维度
  436. if (!payload.dimensionCode) delete payload.dimensionCode
  437. // 主办方和海报模板仅非空时提交
  438. if (!payload.vendorName) delete payload.vendorName
  439. if (!payload.posterTemplateId) delete payload.posterTemplateId
  440. return payload
  441. },
  442. handleSave() {
  443. if (!this.validate()) return
  444. this.submit(false)
  445. },
  446. handlePublish() {
  447. if (!this.validate()) return
  448. this.submit(true)
  449. },
  450. submit(publishAfter) {
  451. var self = this
  452. self.loading = true
  453. var payload = self.buildPayload()
  454. var isAdmin = self.isAdmin
  455. var doPublish = function(id) {
  456. if (isAdmin) {
  457. adminPublishActivity(id).then(function(r) {
  458. self.loading = false
  459. if (r && r.code === 200) {
  460. uni.showToast({ title: '已发布', icon: 'success' })
  461. setTimeout(function() {
  462. uni.navigateBack()
  463. }, 1200)
  464. } else {
  465. uni.showToast({ title: (r && r.message) || '发布失败', icon: 'none' })
  466. }
  467. }).catch(function() {
  468. self.loading = false
  469. uni.showToast({ title: '发布失败', icon: 'none' })
  470. })
  471. } else {
  472. submitActivityForReview(id).then(function(r) {
  473. self.loading = false
  474. if (r && r.code === 200) {
  475. uni.showToast({ title: '已提交审核', icon: 'success' })
  476. setTimeout(function() {
  477. uni.navigateBack()
  478. }, 1200)
  479. } else {
  480. uni.showToast({ title: (r && r.message) || '提交审核失败', icon: 'none' })
  481. }
  482. }).catch(function() {
  483. self.loading = false
  484. uni.showToast({ title: '提交审核失败', icon: 'none' })
  485. })
  486. }
  487. }
  488. if (self.isNew) {
  489. adminCreateActivity(payload).then(function(res) {
  490. if (res && res.code === 200) {
  491. var newId = res.data.id || res.data
  492. if (publishAfter) {
  493. doPublish(newId)
  494. } else {
  495. self.loading = false
  496. uni.showToast({ title: '已保存草稿', icon: 'success' })
  497. setTimeout(function() { uni.navigateBack() }, 1200)
  498. }
  499. } else {
  500. self.loading = false
  501. uni.showToast({ title: (res && res.message) || '保存失败', icon: 'none' })
  502. }
  503. }).catch(function() {
  504. self.loading = false
  505. uni.showToast({ title: '网络异常', icon: 'none' })
  506. })
  507. } else {
  508. adminUpdateActivity(payload).then(function(res) {
  509. if (res && res.code === 200) {
  510. if (publishAfter && (self.form.status === 'draft' || self.form.status === 'rejected')) {
  511. doPublish(self.activityId)
  512. } else {
  513. self.loading = false
  514. uni.showToast({ title: '已保存', icon: 'success' })
  515. setTimeout(function() { uni.navigateBack() }, 1200)
  516. }
  517. } else {
  518. self.loading = false
  519. uni.showToast({ title: (res && res.message) || '保存失败', icon: 'none' })
  520. }
  521. }).catch(function() {
  522. self.loading = false
  523. uni.showToast({ title: '网络异常', icon: 'none' })
  524. })
  525. }
  526. },
  527. typeLabel(key) {
  528. for (var i = 0; i < this.typeOptions.length; i++) {
  529. if (this.typeOptions[i].key === key) return this.typeOptions[i].label
  530. }
  531. return '请选择类型'
  532. },
  533. fmtDate(d) {
  534. var y = d.getFullYear()
  535. var m = ('0' + (d.getMonth() + 1)).slice(-2)
  536. var day = ('0' + d.getDate()).slice(-2)
  537. return y + '-' + m + '-' + day
  538. },
  539. fmtTime(d) {
  540. var h = ('0' + d.getHours()).slice(-2)
  541. var mi = ('0' + d.getMinutes()).slice(-2)
  542. return h + ':' + mi
  543. }
  544. }
  545. }
  546. </script>
  547. <stylescoped lang="scss">
  548. .container {
  549. min-height: 100vh;
  550. background: $app-bg;
  551. padding: 24rpx;
  552. }
  553. .form-card {
  554. background: $app-surface;
  555. border-radius: 20rpx;
  556. padding: 32rpx 28rpx;
  557. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
  558. }
  559. .form-title {
  560. font-size: 36rpx;
  561. font-weight: bold;
  562. color: $uni-text-color;
  563. margin-bottom: 24rpx;
  564. }
  565. .form-item {
  566. margin-bottom: 28rpx;
  567. }
  568. .form-item-row {
  569. display: flex;
  570. flex-direction: row;
  571. gap: 20rpx;
  572. margin-bottom: 28rpx;
  573. }
  574. .form-item.half {
  575. flex: 1;
  576. }
  577. .form-label {
  578. font-size: 26rpx;
  579. color: $facade-text-slate-deep;
  580. font-weight: 600;
  581. margin-bottom: 12rpx;
  582. display: block;
  583. }
  584. .form-input {
  585. width: 100%;
  586. height: 80rpx;
  587. border: 1rpx solid $uni-border-color-light;
  588. border-radius: 12rpx;
  589. padding: 0 20rpx;
  590. font-size: 28rpx;
  591. color: $uni-text-color;
  592. box-sizing: border-box;
  593. }
  594. .form-picker {
  595. width: 100%;
  596. height: 80rpx;
  597. border: 1rpx solid $uni-border-color-light;
  598. border-radius: 12rpx;
  599. padding: 0 20rpx;
  600. font-size: 28rpx;
  601. color: $uni-text-color;
  602. box-sizing: border-box;
  603. display: flex;
  604. align-items: center;
  605. }
  606. .picker-text {
  607. font-size: 28rpx;
  608. color: $uni-text-color;
  609. }
  610. .form-textarea {
  611. width: 100%;
  612. min-height: 160rpx;
  613. border: 1rpx solid $uni-border-color-light;
  614. border-radius: 12rpx;
  615. padding: 16rpx 20rpx;
  616. font-size: 28rpx;
  617. color: $uni-text-color;
  618. box-sizing: border-box;
  619. }
  620. .cover-upload {
  621. width: 100%;
  622. height: 320rpx;
  623. border: 2rpx dashed $uni-border-color;
  624. border-radius: 12rpx;
  625. display: flex;
  626. align-items: center;
  627. justify-content: center;
  628. overflow: hidden;
  629. }
  630. .preview-img {
  631. width: 100%;
  632. height: 100%;
  633. }
  634. .upload-placeholder {
  635. display: flex;
  636. flex-direction: column;
  637. align-items: center;
  638. }
  639. .upload-icon {
  640. font-size: 64rpx;
  641. color: $app-text-subtle;
  642. }
  643. .upload-text {
  644. font-size: 24rpx;
  645. color: $app-text-subtle;
  646. margin-top: 8rpx;
  647. }
  648. .cover-actions {
  649. display: flex;
  650. flex-direction: row;
  651. gap: 24rpx;
  652. margin-top: 12rpx;
  653. }
  654. .cover-action {
  655. font-size: 24rpx;
  656. color: $facade-text-slate-deep;
  657. text-decoration: underline;
  658. }
  659. .cover-action-danger {
  660. font-size: 24rpx;
  661. color: $status-danger;
  662. text-decoration: underline;
  663. }
  664. /* 海报模板选择 */
  665. .poster-tpl-list {
  666. display: flex;
  667. flex-direction: row;
  668. flex-wrap: wrap;
  669. gap: 16rpx;
  670. margin-top: 20rpx;
  671. }
  672. .poster-tpl-card {
  673. width: 200rpx;
  674. border: 2rpx solid $uni-border-color-light;
  675. border-radius: 12rpx;
  676. padding: 20rpx 16rpx;
  677. display: flex;
  678. flex-direction: column;
  679. align-items: center;
  680. background: $app-surface;
  681. }
  682. .poster-tpl-active {
  683. border-color: $brand-primary;
  684. background: $uni-primary-pale;
  685. }
  686. .tpl-colors {
  687. display: flex;
  688. flex-direction: row;
  689. gap: 8rpx;
  690. margin-bottom: 12rpx;
  691. }
  692. .tpl-dot {
  693. width: 32rpx;
  694. height: 32rpx;
  695. border-radius: 50%;
  696. }
  697. .tpl-name {
  698. font-size: 24rpx;
  699. color: $uni-text-color;
  700. text-align: center;
  701. }
  702. .poster-preview-row {
  703. display: flex;
  704. flex-direction: row;
  705. align-items: center;
  706. justify-content: space-between;
  707. margin-top: 20rpx;
  708. }
  709. .poster-preview-hint {
  710. font-size: 24rpx;
  711. color: $uni-text-color-secondary;
  712. }
  713. .btn-preview {
  714. padding: 12rpx 32rpx;
  715. border-radius: 32rpx;
  716. background: $brand-primary;
  717. color: $app-surface;
  718. font-size: 26rpx;
  719. }
  720. .form-actions {
  721. display: flex;
  722. flex-direction: row;
  723. gap: 20rpx;
  724. margin-top: 40rpx;
  725. }
  726. .btn-save,
  727. .btn-publish {
  728. flex: 1;
  729. height: 88rpx;
  730. border-radius: 44rpx;
  731. display: flex;
  732. align-items: center;
  733. justify-content: center;
  734. font-size: 30rpx;
  735. font-weight: 600;
  736. }
  737. .btn-save {
  738. background: $app-surface;
  739. color: $brand-primary;
  740. border: 2rpx solid $brand-primary;
  741. }
  742. .btn-publish {
  743. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  744. color: $app-surface;
  745. }
  746. .loading {
  747. position: fixed;
  748. top: 0;
  749. left: 0;
  750. right: 0;
  751. bottom: 0;
  752. background: rgba(255, 255, 255, 0.6);
  753. display: flex;
  754. flex-direction: column;
  755. align-items: center;
  756. justify-content: center;
  757. z-index: 999;
  758. }
  759. .loading-spinner {
  760. width: 60rpx;
  761. height: 60rpx;
  762. border: 4rpx solid $brand-primary-light-2;
  763. border-top: 4rpx solid $brand-primary;
  764. border-radius: 50%;
  765. animation: spin 0.8s linear infinite;
  766. margin-bottom: 16rpx;
  767. }
  768. @keyframes spin {
  769. to { transform: rotate(360deg); }
  770. }
  771. </style>