PageAssembly.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. <template>
  2. <div class="page-assembly">
  3. <!-- ==================== 列表视图 ==================== -->
  4. <template v-if="viewState === 'list'">
  5. <el-card>
  6. <template #header>
  7. <div class="search-section">
  8. <div class="search-row">
  9. <el-form :model="searchForm" label-width="80px" inline>
  10. <el-form-item label="页面ID:">
  11. <el-input v-model="searchForm.id" placeholder="请输入" clearable style="width:160px" />
  12. </el-form-item>
  13. <el-form-item label="页面名称:">
  14. <el-input v-model="searchForm.name" placeholder="请输入" clearable style="width:160px" />
  15. </el-form-item>
  16. <div class="button-group">
  17. <el-button type="primary" @click="handleSearch">查询</el-button>
  18. <el-button @click="handleReset">重置</el-button>
  19. </div>
  20. </el-form>
  21. </div>
  22. <div class="action-row">
  23. <el-button type="primary" @click="handleCreate">
  24. <el-icon><Plus /></el-icon>新建组装页
  25. </el-button>
  26. </div>
  27. </div>
  28. </template>
  29. <el-table :data="tableData" stripe border style="width:100%">
  30. <el-table-column label="操作" width="120" fixed="left" align="center">
  31. <template #default="scope">
  32. <div class="list-actions">
  33. <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
  34. <el-button type="text" size="small" @click="showLinkDialog(scope.row.id)">链接</el-button>
  35. </div>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="id" label="页面ID" width="120" align="center" />
  39. <el-table-column prop="name" label="组装页名称" min-width="200" show-overflow-tooltip />
  40. <el-table-column label="发布状态" width="100" align="center">
  41. <template #default="scope">
  42. <el-tag :type="scope.row.status === 'published' ? 'success' : 'info'" size="small">
  43. {{ scope.row.status === 'published' ? '已上架' : '草稿' }}
  44. </el-tag>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="createTime" label="创建时间" width="180" align="center" />
  48. <el-table-column prop="updateTime" label="更新时间" width="180" align="center" />
  49. </el-table>
  50. </el-card>
  51. </template>
  52. <!-- ==================== 编辑视图 ==================== -->
  53. <template v-else>
  54. <!-- 操作栏 -->
  55. <div class="toolbar">
  56. <div class="toolbar-left">
  57. <el-button size="small" @click="backToList">
  58. <el-icon><ArrowLeft /></el-icon>返回
  59. </el-button>
  60. <h2 class="toolbar-title">{{ isNew ? '新建组装页' : '编辑组装页' }}</h2>
  61. <el-tag v-if="editData.status === 'published' && !isModified" type="success" size="small" effect="plain">正式线上环境</el-tag>
  62. <el-tag v-else-if="showModifiedStatus" type="warning" size="small" effect="plain">有未发布的修改</el-tag>
  63. <el-tag v-else size="info" effect="plain">草稿 (未发布)</el-tag>
  64. </div>
  65. <div class="toolbar-right">
  66. <el-button size="small" @click="showLinkDialog(editData.id)">
  67. <el-icon><Link /></el-icon>获取链接
  68. </el-button>
  69. <el-button size="small" type="primary" plain @click="handleSaveAssembly('draft')">保存草稿</el-button>
  70. <el-button v-if="canPublish" size="small" type="primary" @click="handleSaveAssembly('publish')">发布上线</el-button>
  71. </div>
  72. </div>
  73. <!-- 基本信息 -->
  74. <el-card class="section-card" shadow="hover">
  75. <div class="basic-info">
  76. <div class="info-item">
  77. <span class="info-label">页面 ID:</span>
  78. <el-tag size="small" effect="plain">{{ editData.id || '保存后生成' }}</el-tag>
  79. </div>
  80. <div class="info-item" style="flex:1">
  81. <span class="info-label">组装页名称 <span style="color:#F56C6C">*</span></span>
  82. <el-input v-model="editData.name" placeholder="请为该页面设置一个名称 (必填)" size="small" @input="isModified = true" />
  83. </div>
  84. </div>
  85. </el-card>
  86. <!-- 微信分享卡片配置 -->
  87. <div class="block-card">
  88. <div class="block-header">
  89. <span><el-icon><ChatDotRound /></el-icon> 微信分享卡片配置</span>
  90. <el-checkbox v-model="editData.shareConfig.enabled" @change="isModified = true" class="share-toggle-checkbox">自定义微信分享</el-checkbox>
  91. </div>
  92. <div class="block-body" v-if="editData.shareConfig.enabled">
  93. <div class="share-card-body">
  94. <div class="share-thumb-section">
  95. <div class="share-field-label">分享缩略图 <span class="required-star">*</span></div>
  96. <div class="share-thumb-upload" @click="triggerShareUpload">
  97. <img v-if="editData.shareConfig.thumbnail" :src="editData.shareConfig.thumbnail" class="share-thumb-img" />
  98. <div v-else class="upload-placeholder">
  99. <el-icon><Picture /></el-icon>
  100. </div>
  101. <div class="upload-overlay">
  102. <el-icon><Upload /></el-icon>
  103. <span>点击上传</span>
  104. </div>
  105. </div>
  106. <div class="share-thumb-tip">建议 100x100</div>
  107. <input ref="shareUpload" type="file" accept="image/*" style="display:none" @change="onShareImageUpload" />
  108. </div>
  109. <div class="share-fields">
  110. <el-form label-position="top">
  111. <el-form-item>
  112. <template #label>
  113. 分享标题 <span class="required-star">*</span>
  114. </template>
  115. <el-input
  116. v-model="editData.shareConfig.title"
  117. placeholder="请输入分享标题"
  118. @input="isModified = true"
  119. />
  120. </el-form-item>
  121. </el-form>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <!-- 模块列表 -->
  127. <div v-for="(block, bIdx) in editData.blocks" :key="block.id" class="block-card">
  128. <!-- 模块操作栏 -->
  129. <div class="block-actions">
  130. <el-popover placement="bottom" trigger="click" width="180">
  131. <div>
  132. <div style="margin-bottom:8px;font-size:13px;color:#666">移动到序号:</div>
  133. <div style="display:flex;gap:8px">
  134. <el-input-number v-model="sortTarget" :min="1" :max="editData.blocks.length" size="small" controls-position="right" style="width:100px" />
  135. <el-button size="small" type="primary" @click="moveBlock(bIdx, sortTarget - 1)">确定</el-button>
  136. </div>
  137. </div>
  138. <template #reference>
  139. <el-button size="small" @click="sortTarget = bIdx + 1">
  140. <el-icon><Sort /></el-icon>排序
  141. </el-button>
  142. </template>
  143. </el-popover>
  144. <el-button v-if="block.type !== 'privilege'" size="small" @click="duplicateBlock(bIdx)">
  145. <el-icon><CopyDocument /></el-icon>复制
  146. </el-button>
  147. <el-button size="small" type="danger" @click="removeBlock(bIdx)">
  148. <el-icon><Delete /></el-icon>删除
  149. </el-button>
  150. </div>
  151. <!-- 图片模块 -->
  152. <template v-if="block.type === 'image'">
  153. <div class="block-header"><el-icon><PictureRounded /></el-icon> 图片模块</div>
  154. <div class="block-body">
  155. <div class="image-upload-area">
  156. <div class="upload-box upload-box-wide" @click="triggerBlockUpload(bIdx)">
  157. <img v-if="block.data.imageUrl" :src="block.data.imageUrl" class="preview-img" />
  158. <div v-else class="upload-placeholder">
  159. <el-icon><Picture /></el-icon><span>未上传图片</span>
  160. </div>
  161. <div class="upload-overlay"><el-icon><Upload /></el-icon><span>点击上传图片</span></div>
  162. </div>
  163. <div class="upload-tip">建议宽度:<b>750px</b><br/>高度不限,系统将按比例自适应展示</div>
  164. <input :ref="'blockUpload' + bIdx" type="file" accept="image/*" style="display:none" @change="onBlockImageUpload($event, bIdx)" />
  165. </div>
  166. </div>
  167. </template>
  168. <!-- 权益商品模块 -->
  169. <template v-else-if="block.type === 'privilege'">
  170. <div class="block-header"><el-icon><Grid /></el-icon> 权益商品模块 <span class="block-hint">(当前页面仅限添加一个)</span></div>
  171. <div class="block-body">
  172. <el-form label-width="100px" style="margin-bottom:16px;border-bottom:1px solid #ebeef5;padding-bottom:16px">
  173. <el-form-item label="可配置大标题">
  174. <el-input v-model="block.data.title" style="width:50%" @input="isModified = true" />
  175. </el-form-item>
  176. </el-form>
  177. <div v-for="(pItem, pIdx) in block.data.items" :key="pIdx" class="privilege-row">
  178. <el-tag size="small" effect="plain" class="privilege-no">NO. {{ pIdx + 1 }}</el-tag>
  179. <div class="privilege-icon"><el-icon><Document /></el-icon></div>
  180. <div class="privilege-info">
  181. <div class="privilege-title">{{ pItem.title }}</div>
  182. <div class="privilege-desc">{{ pItem.desc }}</div>
  183. </div>
  184. <el-popover placement="bottom" trigger="click" width="180">
  185. <div>
  186. <div style="margin-bottom:8px;font-size:13px;color:#666">移动到序号:</div>
  187. <div style="display:flex;gap:8px">
  188. <el-input-number v-model="sortTarget" :min="1" :max="block.data.items.length" size="small" controls-position="right" style="width:100px" />
  189. <el-button size="small" type="primary" @click="movePrivilegeItem(bIdx, pIdx, sortTarget - 1)">确定</el-button>
  190. </div>
  191. </div>
  192. <template #reference>
  193. <el-button size="small" circle @click="sortTarget = pIdx + 1">
  194. <el-icon><Sort /></el-icon>
  195. </el-button>
  196. </template>
  197. </el-popover>
  198. </div>
  199. </div>
  200. </template>
  201. <!-- 图文模块 (富文本) -->
  202. <template v-else-if="block.type === 'richtext'">
  203. <div class="block-header"><el-icon><Notebook /></el-icon> 图文模块</div>
  204. <div class="block-body">
  205. <quill-editor
  206. v-model:content="block.data.content"
  207. content-type="html"
  208. :options="quillOptions"
  209. @change="onQuillChange"
  210. />
  211. </div>
  212. </template>
  213. <!-- 按钮模块 -->
  214. <template v-else-if="block.type === 'buttonGroup'">
  215. <div class="block-header button-module-header">
  216. <span class="button-module-title"><el-icon><Pointer /></el-icon> 按钮模块</span>
  217. <el-button class="add-button-btn" type="primary" plain size="small" @click="addButton(bIdx)">
  218. <el-icon><CirclePlus /></el-icon>添加按钮
  219. </el-button>
  220. </div>
  221. <div class="block-body">
  222. <div v-if="!block.data.buttons || block.data.buttons.length === 0" class="empty-tip">暂无按钮</div>
  223. <div v-for="(btn, btnIdx) in (block.data.buttons || [])" :key="btnIdx" class="button-config-item">
  224. <div class="btn-index">BTN {{ btnIdx + 1 }}</div>
  225. <div class="btn-config-body">
  226. <el-form class="button-form" label-position="top">
  227. <el-row :gutter="16">
  228. <el-col :span="8">
  229. <el-form-item label="按钮文案">
  230. <el-input v-model="btn.text" size="small" @input="isModified = true" />
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="8">
  234. <el-form-item label="点击动作">
  235. <el-select v-model="btn.actionType" size="small" @change="handleButtonActionChange(btn)">
  236. <el-option label="跳转链接" value="link" />
  237. <el-option label="弹窗提示" value="dialog" />
  238. </el-select>
  239. </el-form-item>
  240. </el-col>
  241. <el-col :span="8">
  242. <el-form-item label="按钮样式">
  243. <el-select v-model="btn.style" size="small" @change="isModified = true">
  244. <el-option label="突出显示(红色)" value="primary" />
  245. <el-option label="次要操作(白色)" value="secondary" />
  246. </el-select>
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. <!-- 跳转链接 -->
  251. <div v-if="btn.actionType === 'link'" class="jump-config-panel">
  252. <div class="jump-config-title"><el-icon><Link /></el-icon> 跳转链接配置</div>
  253. <el-form-item class="jump-type-item" label-width="0">
  254. <el-radio-group v-model="btn.linkType" @change="handleButtonJumpTypeChange(btn)">
  255. <el-radio label="h5">H5链接跳转</el-radio>
  256. <el-radio label="miniProgram">小程序跳转</el-radio>
  257. <el-radio label="taikoo">太古地产</el-radio>
  258. <el-radio label="dragon">龙腾</el-radio>
  259. </el-radio-group>
  260. </el-form-item>
  261. <el-form-item v-if="btn.linkType === 'h5'" label="配置链接">
  262. <el-input v-model="btn.linkH5" size="small" placeholder="例如:https://hsbc.com" @input="handleButtonJumpFieldChange(btn)" />
  263. </el-form-item>
  264. <el-row v-if="btn.linkType === 'miniProgram'" :gutter="16">
  265. <el-col :span="12">
  266. <el-form-item label="AppID">
  267. <el-input v-model="btn.miniAppId" size="small" placeholder="例如:wx1234567890abcdef" @input="handleButtonJumpFieldChange(btn)" />
  268. </el-form-item>
  269. </el-col>
  270. <el-col :span="12">
  271. <el-form-item label="页面路径">
  272. <el-input v-model="btn.miniAppPath" size="small" placeholder="例如:pages/index/index" @input="handleButtonJumpFieldChange(btn)" />
  273. </el-form-item>
  274. </el-col>
  275. </el-row>
  276. </div>
  277. <!-- 弹窗配置 -->
  278. <div v-if="btn.actionType === 'dialog' && btn.dialog" class="dialog-config">
  279. <div class="dialog-config-title"><el-icon><Document /></el-icon> 弹窗内容配置</div>
  280. <el-form-item label="弹窗标题">
  281. <el-input v-model="btn.dialog.title" size="small" placeholder="弹窗标题" @input="isModified = true" />
  282. </el-form-item>
  283. <el-form-item label="弹窗描述">
  284. <div class="dialog-desc-editor">
  285. <quill-editor
  286. v-model:content="btn.dialog.desc"
  287. content-type="html"
  288. :options="quillOptions"
  289. @change="isModified = true"
  290. />
  291. </div>
  292. </el-form-item>
  293. <div class="dialog-button-config">
  294. <div class="confirm-config-header">
  295. <span>左侧取消按钮配置</span>
  296. </div>
  297. <el-input v-model="btn.dialog.cancelText" size="small" placeholder="取消" @input="isModified = true" />
  298. </div>
  299. <div class="dialog-button-config confirm-button-config">
  300. <div class="confirm-config-header">
  301. <span>右侧确认按钮配置</span>
  302. <el-checkbox v-model="btn.dialog.showConfirm" @change="isModified = true">展示</el-checkbox>
  303. </div>
  304. <el-input v-if="btn.dialog.showConfirm" v-model="btn.dialog.confirmText" size="small" placeholder="确认" @input="isModified = true" />
  305. </div>
  306. <div v-if="btn.dialog.showConfirm" class="jump-config-panel dialog-jump-config">
  307. <div class="jump-config-title"><el-icon><Link /></el-icon> 确认按钮跳转链接配置</div>
  308. <el-form-item class="jump-type-item" label-width="0">
  309. <el-radio-group v-model="btn.dialog.confirmLinkType" @change="handleDialogJumpTypeChange(btn.dialog)">
  310. <el-radio label="h5">H5链接跳转</el-radio>
  311. <el-radio label="miniProgram">小程序跳转</el-radio>
  312. <el-radio label="taikoo">太古地产</el-radio>
  313. <el-radio label="dragon">龙腾</el-radio>
  314. </el-radio-group>
  315. </el-form-item>
  316. <el-form-item v-if="btn.dialog.confirmLinkType === 'h5'" label="配置链接">
  317. <el-input v-model="btn.dialog.confirmLinkH5" size="small" placeholder="例如:https://hsbc.com" @input="handleDialogJumpFieldChange(btn.dialog)" />
  318. </el-form-item>
  319. <el-row v-if="btn.dialog.confirmLinkType === 'miniProgram'" :gutter="16">
  320. <el-col :span="12">
  321. <el-form-item label="AppID">
  322. <el-input v-model="btn.dialog.confirmMiniAppId" size="small" placeholder="例如:wx1234567890abcdef" @input="handleDialogJumpFieldChange(btn.dialog)" />
  323. </el-form-item>
  324. </el-col>
  325. <el-col :span="12">
  326. <el-form-item label="页面路径">
  327. <el-input v-model="btn.dialog.confirmMiniAppPath" size="small" placeholder="例如:pages/index/index" @input="handleDialogJumpFieldChange(btn.dialog)" />
  328. </el-form-item>
  329. </el-col>
  330. </el-row>
  331. </div>
  332. </div>
  333. </el-form>
  334. </div>
  335. <div class="btn-config-actions">
  336. <el-popover placement="bottom" trigger="click" width="180">
  337. <div>
  338. <div style="margin-bottom:8px;font-size:13px;color:#666">移动到序号:</div>
  339. <div style="display:flex;gap:8px">
  340. <el-input-number v-model="sortTarget" :min="1" :max="block.data.buttons.length" size="small" controls-position="right" style="width:100px" />
  341. <el-button size="small" type="primary" @click="moveButton(bIdx, btnIdx, sortTarget - 1)">确定</el-button>
  342. </div>
  343. </div>
  344. <template #reference>
  345. <el-button size="small" circle @click="sortTarget = btnIdx + 1">
  346. <el-icon><Sort /></el-icon>
  347. </el-button>
  348. </template>
  349. </el-popover>
  350. <el-button size="small" type="danger" circle @click="removeButton(bIdx, btnIdx)">
  351. <el-icon><Delete /></el-icon>
  352. </el-button>
  353. </div>
  354. </div>
  355. </div>
  356. </template>
  357. </div>
  358. <!-- 添加模块按钮 -->
  359. <div class="add-block-bar">
  360. <el-button type="text" @click="addBlock('image')">
  361. <el-icon><PictureRounded /></el-icon>图片模块
  362. </el-button>
  363. <el-button v-if="!hasPrivilegeBlock" type="text" @click="addBlock('privilege')">
  364. <el-icon><Grid /></el-icon>权益商品模块
  365. </el-button>
  366. <el-button type="text" @click="addBlock('richtext')">
  367. <el-icon><Notebook /></el-icon>图文模块
  368. </el-button>
  369. <el-button type="text" @click="addBlock('buttonGroup')">
  370. <el-icon><Pointer /></el-icon>按钮模块
  371. </el-button>
  372. </div>
  373. </template>
  374. <!-- 获取链接弹窗 -->
  375. <el-dialog title="获取页面链接" v-model="linkDialogVisible" width="680px">
  376. <el-form label-width="100px" inline>
  377. <el-form-item label="Campaign ID">
  378. <el-select v-model="linkForm.campaignId" clearable filterable placeholder="请选择 (无)" style="width:240px">
  379. <el-option v-for="opt in campaignOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
  380. </el-select>
  381. </el-form-item>
  382. <el-form-item label="Channel ID">
  383. <el-select v-model="linkForm.channelId" clearable filterable placeholder="请选择 (无)" style="width:240px">
  384. <el-option v-for="opt in channelOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
  385. </el-select>
  386. </el-form-item>
  387. </el-form>
  388. <div v-if="linkTargetPublished" class="link-section">
  389. <div class="link-label"><span class="dot dot-green"></span> 正式环境链接</div>
  390. <div class="link-row">
  391. <span class="link-type">H5链接</span>
  392. <el-input :value="assemblyProdH5" readonly size="small" />
  393. <el-button size="small" type="primary" plain @click="copyLink(assemblyProdH5)">复制</el-button>
  394. </div>
  395. <div class="link-row">
  396. <span class="link-type">小程序链接</span>
  397. <el-input :value="assemblyProdApp" readonly size="small" />
  398. <el-button size="small" type="primary" plain @click="copyLink(assemblyProdApp)">复制</el-button>
  399. </div>
  400. </div>
  401. <div class="link-section">
  402. <div class="link-label"><span class="dot dot-blue"></span> 草稿预览链接 (测试)</div>
  403. <div class="link-row">
  404. <el-input :value="assemblyTestUrl" readonly size="small" />
  405. <el-button size="small" type="primary" plain @click="copyLink(assemblyTestUrl)">复制</el-button>
  406. </div>
  407. </div>
  408. </el-dialog>
  409. </div>
  410. </template>
  411. <script>
  412. import { ElMessage, ElMessageBox } from 'element-plus'
  413. import request from '@/utils/request'
  414. import { fetchLinkOptions } from '@/utils/linkOptions'
  415. let blockIdCounter = 0
  416. function genBlockId() {
  417. return 'b_' + (++blockIdCounter) + '_' + Math.random().toString(36).substr(2, 6)
  418. }
  419. export default {
  420. name: 'PageAssembly',
  421. data() {
  422. return {
  423. viewState: 'list',
  424. tableData: [],
  425. searchForm: { id: '', name: '' },
  426. editData: this.createEmptyAssembly(),
  427. isNew: true,
  428. isModified: false,
  429. quillReady: false,
  430. sortTarget: 1,
  431. linkDialogVisible: false,
  432. linkForm: { campaignId: '', channelId: '' },
  433. campaignOptions: [],
  434. channelOptions: [],
  435. linkTargetId: '',
  436. linkTargetPublished: false,
  437. quillOptions: {
  438. placeholder: '请输入图文内容...',
  439. modules: {
  440. toolbar: [
  441. ['bold', 'italic', 'underline'],
  442. [{ list: 'ordered' }, { list: 'bullet' }],
  443. [{ header: [1, 2, 3, false] }],
  444. ['link', 'image'],
  445. ['clean']
  446. ]
  447. }
  448. }
  449. }
  450. },
  451. computed: {
  452. hasPrivilegeBlock() {
  453. return this.editData.blocks.some(b => b.type === 'privilege')
  454. },
  455. showModifiedStatus() {
  456. return this.editData.status === 'modified' || (this.editData.status === 'published' && this.isModified)
  457. },
  458. canPublish() {
  459. return !this.isModified && !!this.editData.id && ['draft', 'modified'].includes(this.editData.status)
  460. },
  461. linkQueryStr() {
  462. const params = []
  463. if (this.linkForm.campaignId) params.push(`CampaignId=${this.linkForm.campaignId}`)
  464. if (this.linkForm.channelId) params.push(`Channelid=${this.linkForm.channelId}`)
  465. return params.length ? '&' + params.join('&') : ''
  466. },
  467. assemblyProdH5() {
  468. return `https://hsbc.com/assembly?id=${this.linkTargetId}${this.linkQueryStr}`
  469. },
  470. assemblyProdApp() {
  471. return `hsbc-app://assembly?id=${this.linkTargetId}${this.linkQueryStr}`
  472. },
  473. assemblyTestUrl() {
  474. return `https://test.hsbc.com/assembly?id=${this.linkTargetId}&draft=1${this.linkQueryStr}`
  475. }
  476. },
  477. created() {
  478. this.fetchList()
  479. },
  480. methods: {
  481. createDefaultJumpConfig(overrides = {}) {
  482. return {
  483. linkType: 'h5',
  484. fixedLink: '',
  485. linkH5: '',
  486. miniAppId: '',
  487. miniAppPath: '',
  488. ...overrides
  489. }
  490. },
  491. createDefaultDialogJumpConfig(overrides = {}) {
  492. return {
  493. confirmLinkType: 'h5',
  494. confirmFixedLink: '',
  495. confirmLinkH5: '',
  496. confirmMiniAppId: '',
  497. confirmMiniAppPath: '',
  498. ...overrides
  499. }
  500. },
  501. createDefaultButtonDialog() {
  502. return {
  503. title: '',
  504. desc: '',
  505. cancelText: '取消',
  506. showConfirm: true,
  507. confirmText: '确认',
  508. confirmLink: '',
  509. ...this.createDefaultDialogJumpConfig()
  510. }
  511. },
  512. createDefaultButton(overrides = {}) {
  513. return {
  514. text: '新按钮',
  515. link: '',
  516. style: 'secondary',
  517. actionType: 'link',
  518. ...this.createDefaultJumpConfig(),
  519. ...overrides,
  520. dialog: {
  521. ...this.createDefaultButtonDialog(),
  522. ...(overrides.dialog || {})
  523. }
  524. }
  525. },
  526. createDefaultShareConfig(overrides = {}) {
  527. const config = {
  528. enabled: false,
  529. thumbnail: '',
  530. title: '',
  531. ...overrides
  532. }
  533. delete config.desc
  534. return config
  535. },
  536. ensureReactiveField(target, key, value) {
  537. if (Object.prototype.hasOwnProperty.call(target, key)) {
  538. target[key] = value
  539. } else {
  540. target[key] = value
  541. }
  542. },
  543. getPartnerFixedLink(type) {
  544. if (type === 'taikoo') return '太古地产'
  545. if (type === 'dragon') return '龙腾'
  546. return ''
  547. },
  548. isFixedJumpValue(value) {
  549. return value === '太古地产' || value === '龙腾'
  550. },
  551. normalizePartnerJumpType(type, fixedLink = '') {
  552. if (type === 'taikoo' || type === 'dragon') return type
  553. if (type === 'fixed') return fixedLink === '龙腾' ? 'dragon' : 'taikoo'
  554. return type
  555. },
  556. inferButtonJumpType(btn = {}) {
  557. if (btn.linkType) return this.normalizePartnerJumpType(btn.linkType, btn.fixedLink || btn.link)
  558. if (btn.miniAppId || btn.miniAppPath) return 'miniProgram'
  559. if (btn.link === '太古地产') return 'taikoo'
  560. if (btn.link === '龙腾') return 'dragon'
  561. return 'h5'
  562. },
  563. inferDialogJumpType(dialog = {}) {
  564. if (dialog.confirmLinkType) return this.normalizePartnerJumpType(dialog.confirmLinkType, dialog.confirmFixedLink || dialog.confirmLink)
  565. if (dialog.confirmMiniAppId || dialog.confirmMiniAppPath) return 'miniProgram'
  566. if (dialog.confirmLink === '太古地产') return 'taikoo'
  567. if (dialog.confirmLink === '龙腾') return 'dragon'
  568. if (dialog.confirmLinkH5 || dialog.confirmLink) return 'h5'
  569. return 'h5'
  570. },
  571. syncButtonLegacyLink(btn) {
  572. const partnerLink = this.getPartnerFixedLink(btn.linkType)
  573. if (partnerLink) btn.link = partnerLink
  574. if (btn.linkType === 'h5') btn.link = btn.linkH5 || ''
  575. if (btn.linkType === 'miniProgram') btn.link = ''
  576. },
  577. syncDialogLegacyLink(dialog) {
  578. const partnerLink = this.getPartnerFixedLink(dialog.confirmLinkType)
  579. if (partnerLink) dialog.confirmLink = partnerLink
  580. if (dialog.confirmLinkType === 'h5') dialog.confirmLink = dialog.confirmLinkH5 || ''
  581. if (dialog.confirmLinkType === 'miniProgram') dialog.confirmLink = ''
  582. },
  583. clearInactiveButtonJumpFields(btn) {
  584. btn.fixedLink = this.getPartnerFixedLink(btn.linkType)
  585. if (btn.linkType !== 'h5') btn.linkH5 = ''
  586. if (btn.linkType !== 'miniProgram') {
  587. btn.miniAppId = ''
  588. btn.miniAppPath = ''
  589. }
  590. this.syncButtonLegacyLink(btn)
  591. },
  592. clearInactiveDialogJumpFields(dialog) {
  593. dialog.confirmFixedLink = this.getPartnerFixedLink(dialog.confirmLinkType)
  594. if (dialog.confirmLinkType !== 'h5') dialog.confirmLinkH5 = ''
  595. if (dialog.confirmLinkType !== 'miniProgram') {
  596. dialog.confirmMiniAppId = ''
  597. dialog.confirmMiniAppPath = ''
  598. }
  599. this.syncDialogLegacyLink(dialog)
  600. },
  601. normalizeButtonJumpConfig(btn) {
  602. const linkType = this.inferButtonJumpType(btn)
  603. const legacyLink = btn.link || ''
  604. const normalized = this.createDefaultJumpConfig({
  605. ...btn,
  606. linkType,
  607. fixedLink: btn.fixedLink || (this.isFixedJumpValue(legacyLink) ? legacyLink : ''),
  608. linkH5: btn.linkH5 || (!this.isFixedJumpValue(legacyLink) ? legacyLink : ''),
  609. miniAppId: btn.miniAppId || '',
  610. miniAppPath: btn.miniAppPath || ''
  611. })
  612. Object.keys(normalized).forEach(key => {
  613. btn[key] = normalized[key]
  614. })
  615. this.clearInactiveButtonJumpFields(btn)
  616. },
  617. normalizeDialogJumpConfig(dialog) {
  618. const confirmLinkType = this.inferDialogJumpType(dialog)
  619. const legacyLink = dialog.confirmLink || ''
  620. const normalized = this.createDefaultDialogJumpConfig({
  621. ...dialog,
  622. confirmLinkType,
  623. confirmFixedLink: dialog.confirmFixedLink || (this.isFixedJumpValue(legacyLink) ? legacyLink : ''),
  624. confirmLinkH5: dialog.confirmLinkH5 || (!this.isFixedJumpValue(legacyLink) ? legacyLink : ''),
  625. confirmMiniAppId: dialog.confirmMiniAppId || '',
  626. confirmMiniAppPath: dialog.confirmMiniAppPath || ''
  627. })
  628. Object.keys(normalized).forEach(key => {
  629. dialog[key] = normalized[key]
  630. })
  631. this.clearInactiveDialogJumpFields(dialog)
  632. },
  633. normalizeButton(btn) {
  634. if (!btn) return
  635. if (!btn.text) this.ensureReactiveField(btn, 'text', '')
  636. if (!btn.style) this.ensureReactiveField(btn, 'style', 'secondary')
  637. if (!btn.actionType) this.ensureReactiveField(btn, 'actionType', 'link')
  638. if (!Object.prototype.hasOwnProperty.call(btn, 'link')) this.ensureReactiveField(btn, 'link', '')
  639. this.normalizeButtonJumpConfig(btn)
  640. if (!btn.dialog) {
  641. this.ensureReactiveField(btn, 'dialog', this.createDefaultButtonDialog())
  642. } else {
  643. const defaults = this.createDefaultButtonDialog()
  644. Object.keys(defaults).forEach(key => {
  645. if (!Object.prototype.hasOwnProperty.call(btn.dialog, key)) {
  646. btn.dialog[key] = defaults[key]
  647. }
  648. })
  649. }
  650. this.normalizeDialogJumpConfig(btn.dialog)
  651. },
  652. normalizeAssemblyData(data) {
  653. data.shareConfig = this.createDefaultShareConfig(data.shareConfig || {})
  654. const blocks = data.blocks || []
  655. blocks.forEach(block => {
  656. if (block.type !== 'buttonGroup') return
  657. if (!block.data) block.data = { buttons: [] }
  658. if (!block.data.buttons) block.data.buttons = []
  659. block.data.buttons.forEach(btn => this.normalizeButton(btn))
  660. })
  661. return data
  662. },
  663. createEmptyAssembly() {
  664. return {
  665. id: '', name: '', status: 'draft',
  666. shareConfig: this.createDefaultShareConfig(),
  667. blocks: []
  668. }
  669. },
  670. async fetchList() {
  671. const res = await request.get('/api/assembly/list', { params: this.searchForm })
  672. this.tableData = res.data.sort((a, b) => b.id.localeCompare(a.id))
  673. },
  674. async loadLinkOptions() {
  675. const { campaignOptions, channelOptions } = await fetchLinkOptions()
  676. this.campaignOptions = campaignOptions
  677. this.channelOptions = channelOptions
  678. },
  679. handleSearch() {
  680. this.fetchList()
  681. },
  682. handleReset() {
  683. this.searchForm = { id: '', name: '' }
  684. this.fetchList()
  685. },
  686. handleCreate() {
  687. this.editData = this.createEmptyAssembly()
  688. this.isNew = true
  689. this.isModified = true
  690. this.quillReady = false
  691. this.viewState = 'edit'
  692. this.$nextTick(() => { this.quillReady = true })
  693. },
  694. handleEdit(row) {
  695. this.editData = this.normalizeAssemblyData(JSON.parse(JSON.stringify(row)))
  696. this.isNew = false
  697. this.isModified = false
  698. this.quillReady = false
  699. this.viewState = 'edit'
  700. this.$nextTick(() => { this.quillReady = true })
  701. },
  702. async handleDelete(row) {
  703. await ElMessageBox.confirm('确认要删除该组装页吗?此操作不可恢复。', '提示', { type: 'warning' })
  704. await request.post('/api/assembly/delete', { id: row.id })
  705. ElMessage.success('删除成功')
  706. this.fetchList()
  707. },
  708. backToList() {
  709. this.viewState = 'list'
  710. this.fetchList()
  711. },
  712. async handleSaveAssembly(type) {
  713. const data = this.editData
  714. this.normalizeAssemblyData(data)
  715. let hasError = false
  716. data.blocks.forEach(block => {
  717. if (block.type === 'buttonGroup') {
  718. block.data.buttons.forEach(btn => {
  719. if (btn.actionType === 'link' && !this.validateButtonJumpConfig(btn)) hasError = true
  720. if (btn.actionType === 'dialog' && btn.dialog && btn.dialog.showConfirm !== false && !this.validateDialogJumpConfig(btn.dialog)) hasError = true
  721. })
  722. }
  723. })
  724. if (hasError) {
  725. ElMessage.error('保存失败:按钮模块中存在未填写完整的跳转链接配置!')
  726. return
  727. }
  728. if (data.shareConfig.enabled) {
  729. if (!data.shareConfig.thumbnail) {
  730. ElMessage.error('保存失败:分享缩略图为必填项!')
  731. return
  732. }
  733. if (!data.shareConfig.title.trim()) {
  734. ElMessage.error('保存失败:分享标题为必填项!')
  735. return
  736. }
  737. }
  738. if (!data.name.trim()) data.name = '未命名组装页'
  739. if (type === 'publish' && this.isModified) {
  740. ElMessage.warning('请先保存草稿后再发布上线')
  741. return
  742. }
  743. const currentStatus = data.status
  744. data.status = type === 'publish' ? 'published' : (currentStatus === 'published' || currentStatus === 'modified' ? 'modified' : 'draft')
  745. const res = await request.post('/api/assembly/save', data)
  746. if (!data.id) data.id = res.data.id
  747. if (type === 'draft') this.isNew = false
  748. this.isModified = false
  749. ElMessage.success(type === 'publish' ? '已发布组装页配置!' : '已保存组装页配置草稿!')
  750. if (type === 'publish') this.backToList()
  751. },
  752. onQuillChange() {
  753. if (this.quillReady) this.isModified = true
  754. },
  755. triggerShareUpload() {
  756. const ref = this.$refs.shareUpload
  757. if (ref) ref.click()
  758. },
  759. onShareImageUpload(event) {
  760. const file = event.target.files[0]
  761. if (!file) return
  762. const reader = new FileReader()
  763. reader.onload = (e) => {
  764. this.editData.shareConfig.thumbnail = e.target.result
  765. this.isModified = true
  766. }
  767. reader.readAsDataURL(file)
  768. event.target.value = ''
  769. },
  770. // 模块操作
  771. addBlock(type) {
  772. const block = { type, id: genBlockId(), data: {} }
  773. if (type === 'image') block.data = { imageUrl: '' }
  774. if (type === 'privilege') block.data = { title: '新权益标题', items: [{ id: '1', title: '模拟权益', desc: '描述' }] }
  775. if (type === 'richtext') block.data = { content: '<p>输入富文本内容...</p>' }
  776. if (type === 'buttonGroup') block.data = { buttons: [this.createDefaultButton({ text: '点击跳转', style: 'primary' })] }
  777. this.editData.blocks.push(block)
  778. this.isModified = true
  779. },
  780. duplicateBlock(index) {
  781. const block = this.editData.blocks[index]
  782. if (block.type === 'privilege') {
  783. ElMessage.warning('权益商品模块每页仅限配置一个,无法复制!')
  784. return
  785. }
  786. const copy = JSON.parse(JSON.stringify(block))
  787. copy.id = genBlockId()
  788. this.editData.blocks.splice(index + 1, 0, copy)
  789. this.isModified = true
  790. },
  791. removeBlock(index) {
  792. ElMessageBox.confirm('确定删除该模块吗?', '提示', { type: 'warning' }).then(() => {
  793. this.editData.blocks.splice(index, 1)
  794. this.isModified = true
  795. }).catch(() => {})
  796. },
  797. moveBlock(from, to) {
  798. if (to < 0 || to >= this.editData.blocks.length || from === to) return
  799. const item = this.editData.blocks.splice(from, 1)[0]
  800. this.editData.blocks.splice(to, 0, item)
  801. this.isModified = true
  802. },
  803. movePrivilegeItem(bIdx, from, to) {
  804. const items = this.editData.blocks[bIdx].data.items
  805. if (to < 0 || to >= items.length || from === to) return
  806. const item = items.splice(from, 1)[0]
  807. items.splice(to, 0, item)
  808. this.isModified = true
  809. },
  810. // 按钮操作
  811. addButton(bIdx) {
  812. const block = this.editData.blocks[bIdx]
  813. if (!block.data.buttons) block.data.buttons = []
  814. block.data.buttons.push(this.createDefaultButton())
  815. this.isModified = true
  816. },
  817. handleButtonActionChange(btn) {
  818. this.normalizeButton(btn)
  819. this.isModified = true
  820. },
  821. handleButtonJumpTypeChange(btn) {
  822. this.clearInactiveButtonJumpFields(btn)
  823. this.isModified = true
  824. },
  825. handleButtonJumpFieldChange(btn) {
  826. this.syncButtonLegacyLink(btn)
  827. this.isModified = true
  828. },
  829. handleDialogJumpTypeChange(dialog) {
  830. this.clearInactiveDialogJumpFields(dialog)
  831. this.isModified = true
  832. },
  833. handleDialogJumpFieldChange(dialog) {
  834. this.syncDialogLegacyLink(dialog)
  835. this.isModified = true
  836. },
  837. validateButtonJumpConfig(btn) {
  838. if (this.getPartnerFixedLink(btn.linkType)) return true
  839. if (btn.linkType === 'h5') return !!(btn.linkH5 || '').trim()
  840. if (btn.linkType === 'miniProgram') {
  841. return !!(btn.miniAppId || '').trim() && !!(btn.miniAppPath || '').trim()
  842. }
  843. return false
  844. },
  845. validateDialogJumpConfig(dialog) {
  846. if (this.getPartnerFixedLink(dialog.confirmLinkType)) return true
  847. if (dialog.confirmLinkType === 'h5') return !!(dialog.confirmLinkH5 || '').trim()
  848. if (dialog.confirmLinkType === 'miniProgram') {
  849. return !!(dialog.confirmMiniAppId || '').trim() && !!(dialog.confirmMiniAppPath || '').trim()
  850. }
  851. return false
  852. },
  853. removeButton(bIdx, btnIdx) {
  854. this.editData.blocks[bIdx].data.buttons.splice(btnIdx, 1)
  855. this.isModified = true
  856. },
  857. moveButton(bIdx, from, to) {
  858. const buttons = this.editData.blocks[bIdx].data.buttons
  859. if (to < 0 || to >= buttons.length || from === to) return
  860. const item = buttons.splice(from, 1)[0]
  861. buttons.splice(to, 0, item)
  862. this.isModified = true
  863. },
  864. // 图片上传
  865. triggerBlockUpload(bIdx) {
  866. const ref = this.$refs['blockUpload' + bIdx]
  867. if (ref) (Array.isArray(ref) ? ref[0] : ref).click()
  868. },
  869. onBlockImageUpload(event, bIdx) {
  870. const file = event.target.files[0]
  871. if (!file) return
  872. const reader = new FileReader()
  873. reader.onload = (e) => {
  874. this.editData.blocks[bIdx].data.imageUrl = e.target.result
  875. this.isModified = true
  876. }
  877. reader.readAsDataURL(file)
  878. event.target.value = ''
  879. },
  880. // 链接弹窗
  881. async showLinkDialog(id) {
  882. if (!id) {
  883. ElMessage.warning('请先保存组装页再获取链接!')
  884. return
  885. }
  886. await this.loadLinkOptions()
  887. this.linkTargetId = id
  888. const item = this.tableData.find(a => a.id === id) || this.editData
  889. this.linkTargetPublished = item && item.status === 'published'
  890. this.linkForm = { campaignId: '', channelId: '' }
  891. this.linkDialogVisible = true
  892. },
  893. copyLink(text) {
  894. navigator.clipboard.writeText(text).then(() => {
  895. ElMessage.success('链接已复制到剪贴板')
  896. })
  897. }
  898. }
  899. }
  900. </script>
  901. <style scoped>
  902. .search-section .search-row { margin-bottom: 0; }
  903. .search-section .action-row { margin-top: 15px; }
  904. .button-group { display: inline-block; margin-left: 20px; }
  905. .toolbar {
  906. display: flex; justify-content: space-between; align-items: center;
  907. margin-bottom: 16px; padding: 12px 16px;
  908. background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
  909. }
  910. .toolbar-left { display: flex; align-items: center; gap: 12px; }
  911. .toolbar-title { margin: 0; font-size: 18px; font-weight: 600; }
  912. .toolbar-right { display: flex; gap: 8px; }
  913. .section-card { margin-bottom: 16px; }
  914. .basic-info { display: flex; align-items: center; gap: 24px; }
  915. .info-item { display: flex; align-items: center; gap: 8px; }
  916. .info-label { font-size: 13px; color: #909399; white-space: nowrap; }
  917. .page-assembly :deep(.el-input:not(.el-textarea)) {
  918. --el-input-height: 32px;
  919. }
  920. .page-assembly :deep(.el-input:not(.el-textarea) .el-input__wrapper),
  921. .page-assembly :deep(.el-select__wrapper) {
  922. height: 32px;
  923. min-height: 32px;
  924. }
  925. .page-assembly :deep(.el-input:not(.el-textarea) .el-input__inner) {
  926. height: 30px;
  927. line-height: 30px;
  928. }
  929. .page-assembly :deep(.el-select .el-select__placeholder),
  930. .page-assembly :deep(.el-select .el-select__selected-item) {
  931. line-height: 30px;
  932. }
  933. .required-star { color: #F56C6C; }
  934. .dialog-desc-editor {
  935. width: 100%;
  936. background: #fafafa;
  937. border: 1px solid #dcdfe6;
  938. border-radius: 4px;
  939. overflow: hidden;
  940. }
  941. .dialog-desc-editor .ql-container { height: 100px; font-size: 13px; }
  942. .dialog-desc-editor .ql-toolbar { background: #fff; border: none; border-bottom: 1px solid #ebeef5; }
  943. .share-toggle-checkbox {
  944. position: absolute;
  945. right: 0;
  946. top: 0;
  947. z-index: 10;
  948. padding: 6px 8px;
  949. background: #f5f7fa;
  950. border-bottom: 1px solid #ebeef5;
  951. border-left: 1px solid #ebeef5;
  952. border-radius: 0 0 0 8px;
  953. margin: 0;
  954. color: #409EFF;
  955. font-weight: normal;
  956. font-size: 13px;
  957. }
  958. .share-card-body {
  959. display: flex;
  960. gap: 24px;
  961. align-items: flex-start;
  962. padding: 4px;
  963. }
  964. .share-thumb-section {
  965. width: 108px;
  966. flex-shrink: 0;
  967. }
  968. .share-field-label {
  969. font-size: 13px;
  970. color: #303133;
  971. margin-bottom: 8px;
  972. }
  973. .share-thumb-upload {
  974. width: 108px;
  975. height: 108px;
  976. background: #eef6fc;
  977. border: 1px solid #dcdfe6;
  978. border-radius: 4px;
  979. position: relative;
  980. overflow: hidden;
  981. cursor: pointer;
  982. display: flex;
  983. align-items: center;
  984. justify-content: center;
  985. }
  986. .share-thumb-upload:hover .upload-overlay { display: flex; }
  987. .share-thumb-img {
  988. width: 100%;
  989. height: 100%;
  990. object-fit: cover;
  991. }
  992. .share-thumb-tip {
  993. margin-top: 8px;
  994. text-align: center;
  995. font-size: 12px;
  996. color: #909399;
  997. }
  998. .share-fields {
  999. flex: 0 1 420px;
  1000. min-width: 0;
  1001. }
  1002. .share-fields :deep(.el-form-item__label) {
  1003. line-height: 18px;
  1004. padding-bottom: 8px;
  1005. }
  1006. .share-fields :deep(.el-form-item) {
  1007. margin-bottom: 0;
  1008. }
  1009. .block-card {
  1010. background: #fff; border-radius: 8px; border: 1px solid #ebeef5;
  1011. margin-bottom: 16px; overflow: hidden; position: relative;
  1012. box-shadow: 0 1px 4px rgba(0,0,0,.04);
  1013. }
  1014. .block-header {
  1015. background: #f5f7fa; padding: 10px 160px 10px 16px; min-height: 44px;
  1016. border-bottom: 1px solid #ebeef5; font-weight: 600; font-size: 14px;
  1017. display: flex; align-items: center;
  1018. }
  1019. .block-header i { margin-right: 6px; color: #909399; }
  1020. .button-module-header { gap: 14px; }
  1021. .button-module-title { display: inline-flex; align-items: center; }
  1022. .add-button-btn {
  1023. padding: 7px 10px;
  1024. background: #ecf5ff;
  1025. border-color: #d9ecff;
  1026. }
  1027. .block-hint { font-size: 12px; color: #c0c4cc; font-weight: normal; margin-left: 8px; }
  1028. .block-body { padding: 16px; }
  1029. .block-actions {
  1030. position: absolute; right: 0; top: 0; z-index: 10;
  1031. display: flex; gap: 4px; background: #f5f7fa;
  1032. border-bottom: 1px solid #ebeef5; border-left: 1px solid #ebeef5;
  1033. padding: 6px 8px; border-radius: 0 0 0 8px;
  1034. }
  1035. .image-upload-area { display: flex; align-items: center; gap: 16px; }
  1036. .upload-box {
  1037. width: 256px; height: 144px;
  1038. background: #eef6fc; border: 1px solid #dcdfe6; border-radius: 4px;
  1039. position: relative; overflow: hidden; cursor: pointer;
  1040. display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  1041. }
  1042. .upload-box-wide { width: 360px; height: 160px; }
  1043. .upload-box:hover .upload-overlay { display: flex; }
  1044. .preview-img { width: 100%; height: 100%; object-fit: cover; }
  1045. .upload-placeholder {
  1046. display: flex; flex-direction: column; align-items: center;
  1047. color: #c0c4cc; font-size: 12px;
  1048. }
  1049. .upload-placeholder i { font-size: 28px; margin-bottom: 4px; }
  1050. .upload-overlay {
  1051. display: none; position: absolute; inset: 0;
  1052. background: rgba(0,0,0,.5); color: #fff;
  1053. flex-direction: column; align-items: center; justify-content: center; font-size: 14px;
  1054. }
  1055. .upload-overlay i { font-size: 24px; margin-bottom: 4px; }
  1056. .upload-tip {
  1057. font-size: 12px; color: #909399; line-height: 1.6;
  1058. background: #f5f7fa; padding: 8px 12px; border-radius: 4px; border: 1px solid #ebeef5;
  1059. }
  1060. .privilege-row {
  1061. display: flex; align-items: center; gap: 12px;
  1062. padding: 10px 12px; border: 1px solid #ebeef5; border-radius: 6px;
  1063. background: #fafafa; margin-bottom: 8px;
  1064. }
  1065. .privilege-no { flex-shrink: 0; }
  1066. .privilege-icon {
  1067. width: 40px; height: 40px; border-radius: 50%;
  1068. border: 1px solid #dcdfe6; background: #fff;
  1069. display: flex; align-items: center; justify-content: center;
  1070. color: #909399; font-size: 18px; flex-shrink: 0;
  1071. }
  1072. .privilege-info { flex: 1; opacity: .8; }
  1073. .privilege-title { font-size: 13px; font-weight: 600; }
  1074. .privilege-desc { font-size: 12px; color: #909399; margin-top: 2px; }
  1075. .button-config-item {
  1076. position: relative; border: 1px solid #ebeef5; border-radius: 6px;
  1077. padding: 24px 20px 20px; margin-bottom: 12px; background: #fafafa;
  1078. }
  1079. .btn-index {
  1080. position: absolute; left: 0; top: 0;
  1081. background: #606266; color: #fff; font-size: 10px; font-weight: 700;
  1082. padding: 2px 8px; border-radius: 6px 0 6px 0;
  1083. }
  1084. .btn-config-body { flex: 1; }
  1085. .button-form .el-form-item { margin-bottom: 16px; }
  1086. .button-form .el-form-item__label {
  1087. line-height: 20px;
  1088. padding: 0 0 6px;
  1089. color: #303133;
  1090. font-weight: 400;
  1091. }
  1092. .button-form .el-select { width: 100%; }
  1093. .button-form > .el-row { padding-right: 102px; }
  1094. .btn-config-actions {
  1095. position: absolute; right: 20px; top: 32px;
  1096. display: flex; gap: 6px;
  1097. }
  1098. .dialog-config {
  1099. background: #fff; padding: 18px 20px 4px; border: 1px solid #ebeef5; border-radius: 4px;
  1100. margin-top: 4px;
  1101. }
  1102. .dialog-config-title {
  1103. font-size: 14px; font-weight: 500; color: #303133;
  1104. border-bottom: 1px solid #ebeef5; padding-bottom: 12px; margin-bottom: 14px;
  1105. }
  1106. .dialog-button-config {
  1107. width: 33.333%;
  1108. min-width: 280px;
  1109. margin-bottom: 16px;
  1110. }
  1111. .confirm-config-header {
  1112. display: flex;
  1113. align-items: center;
  1114. justify-content: space-between;
  1115. height: 22px;
  1116. margin-bottom: 6px;
  1117. color: #303133;
  1118. font-size: 14px;
  1119. line-height: 20px;
  1120. }
  1121. .confirm-config-header :deep(.el-checkbox) {
  1122. height: 20px;
  1123. margin-right: 0;
  1124. }
  1125. .jump-config-panel {
  1126. background: #fff;
  1127. padding: 16px 18px 4px;
  1128. border: 1px solid #ebeef5;
  1129. border-radius: 4px;
  1130. margin-top: 4px;
  1131. }
  1132. .dialog-jump-config {
  1133. margin-top: 2px;
  1134. }
  1135. .jump-config-title {
  1136. font-size: 13px;
  1137. font-weight: 600;
  1138. color: #303133;
  1139. border-bottom: 1px solid #ebeef5;
  1140. padding-bottom: 10px;
  1141. margin-bottom: 12px;
  1142. }
  1143. .jump-type-item {
  1144. margin-bottom: 18px;
  1145. }
  1146. .jump-config-panel :deep(.el-radio) {
  1147. margin-right: 22px;
  1148. }
  1149. .add-block-bar {
  1150. display: flex; gap: 16px; justify-content: center;
  1151. padding: 20px; border: 2px dashed #dcdfe6; border-radius: 8px;
  1152. background: #fff; margin-bottom: 16px;
  1153. }
  1154. .empty-tip {
  1155. text-align: center; color: #c0c4cc; padding: 16px;
  1156. border: 1px dashed #dcdfe6; border-radius: 4px;
  1157. }
  1158. .list-actions {
  1159. display: inline-flex;
  1160. align-items: center;
  1161. justify-content: center;
  1162. gap: 10px;
  1163. width: 100%;
  1164. white-space: nowrap;
  1165. }
  1166. .list-actions :deep(.el-button) {
  1167. margin-left: 0;
  1168. padding: 0;
  1169. }
  1170. .link-section { margin-top: 16px; padding: 12px; background: #fafafa; border-radius: 6px; border: 1px solid #ebeef5; }
  1171. .link-section + .link-section { margin-top: 12px; }
  1172. .link-label { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
  1173. .link-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  1174. .link-type { font-size: 12px; color: #909399; width: 70px; flex-shrink: 0; }
  1175. .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  1176. .dot-green { background: #67C23A; }
  1177. .dot-blue { background: #409EFF; }
  1178. </style>