create.vue 25 KB

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