WelcomeContent.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <template>
  2. <div>
  3. <el-row :gutter="10" type="flex" style="margin-top: 10px">
  4. <el-col>
  5. <el-form label-width="110px" label-position="right">
  6. <div class="g-card">
  7. <el-form-item label="使用员工" required :error="userError" v-if="showMember">
  8. <el-tag sizi="mini" v-for="(unit, key) in users" :key="key">{{ unit.name }}</el-tag>
  9. <div>
  10. <el-button type="primary" size="mini" plain @click="onSelectUser">选择员工</el-button>
  11. </div>
  12. <div class="sub-des">
  13. 一个员工被设置多个欢迎语时,以最新设置或修改的为准,如果通过活码添加,则只推送活码欢迎语
  14. </div>
  15. </el-form-item>
  16. <!-- 欢迎语 -->
  17. <div class="my-cord">
  18. <div v-if="showTemplate" class="operation" @click="getWelList(), (dialogVisibleSelectWel = true)">
  19. <i class="el-icon-menu mr5"></i>
  20. 从模板库中选择
  21. </div>
  22. <div v-if="!showTemplate" class="operation" @click="onChooseMaterialWel()">
  23. <i class="el-icon-menu mr5"></i>
  24. 从素材中选择
  25. </div>
  26. <el-form-item
  27. :label="isgroup ? '消息内容' : '欢迎语'"
  28. required
  29. style="margin-right: 200px !important"
  30. :error="welcomeMsgError">
  31. <el-input
  32. ref="msgTextarea"
  33. type="textarea"
  34. v-model="form.welcomeMsg"
  35. maxlength="2000"
  36. show-word-limit
  37. placeholder="请输入"
  38. :autosize="{ minRows: 5, maxRows: 20 }"
  39. clearable />
  40. </el-form-item>
  41. <el-form-item style="" v-if="!isgroup">
  42. <el-checkbox v-model="isChecked" @change="onInsert">插入客户昵称</el-checkbox>
  43. </el-form-item>
  44. </div>
  45. </div>
  46. <!-- 附件 -->
  47. <div class="g-card" v-for="(item, index) in form.materialMsgList" :key="index">
  48. <!-- 文本 -->
  49. <div class="my-cord" v-if="item.msgType == '4'">
  50. <div class="operation">
  51. <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
  52. <i class="el-icon-menu mr5"></i>
  53. 从素材中选择
  54. </div>
  55. <div class="algin" @click="onRemoveMaterial(index)">
  56. <i class="el-icon-delete mr5"></i>
  57. 删除
  58. </div>
  59. </div>
  60. <el-form-item label="文本" required style="margin-right: 200px !important" :error="item.contentError">
  61. <el-input type="text" v-model="item.content" maxlength="200" placeholder="请输入" />
  62. </el-form-item>
  63. </div>
  64. <!-- 图片上传 -->
  65. <div class="my-cord" v-else-if="item.msgType == '0'">
  66. <div class="operation">
  67. <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
  68. <i class="el-icon-menu mr5"></i>
  69. 从素材中选择
  70. </div>
  71. <div class="algin" @click="onRemoveMaterial(index)">
  72. <i class="el-icon-delete mr5"></i>
  73. 删除
  74. </div>
  75. </div>
  76. <el-form-item label="图片上传" required :error="item.materialUrlError">
  77. <upload class="image-uploader" :fileUrl.sync="item.materialUrl" type="0"></upload>
  78. </el-form-item>
  79. </div>
  80. <!-- 图文 -->
  81. <div class="my-cord" v-else-if="item.msgType == '8'">
  82. <div class="operation">
  83. <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
  84. <i class="el-icon-menu mr5"></i>
  85. 从素材中选择
  86. </div>
  87. <div class="algin" @click="onRemoveMaterial(index)">
  88. <i class="el-icon-delete mr5"></i>
  89. 删除
  90. </div>
  91. </div>
  92. <el-form-item
  93. label="图文标题"
  94. style="margin-right: 200px !important"
  95. required
  96. :error="item.materialNameError">
  97. <el-input
  98. type="textarea"
  99. :autosize="{ minRows: 5 }"
  100. v-model="item.materialName"
  101. placeholder="请输入图文标题"
  102. maxlength="64"
  103. show-word-limit
  104. clearable></el-input>
  105. </el-form-item>
  106. <el-form-item
  107. label="图文链接"
  108. style="margin-right: 200px !important"
  109. required
  110. :error="item.materialUrlError">
  111. <el-input v-model="item.materialUrl" placeholder="请输入图文链接"></el-input>
  112. <div class="sub-des">仅支持公众号图文链接,且必须以 http://或 https://开头</div>
  113. </el-form-item>
  114. </div>
  115. <!-- 小程序 -->
  116. <div class="my-cord" v-else-if="item.msgType == '9'">
  117. <div class="operation">
  118. <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
  119. <i class="el-icon-menu mr5"></i>
  120. 从素材中选择
  121. </div>
  122. <div class="algin" @click="onRemoveMaterial(index)">
  123. <i class="el-icon-delete mr5"></i>
  124. 删除
  125. </div>
  126. </div>
  127. <el-form-item
  128. label="小程序标题"
  129. style="margin-right: 200px !important"
  130. required
  131. :error="item.materialNameError">
  132. <el-input
  133. type="textarea"
  134. :autosize="{ minRows: 5, maxRows: 20 }"
  135. v-model="item.materialName"
  136. placeholder="请输入小程序标题"
  137. maxlength="64"
  138. show-word-limit
  139. clearable></el-input>
  140. </el-form-item>
  141. <el-form-item
  142. label="小程序AppID"
  143. style="margin-right: 200px !important"
  144. required
  145. :error="item.digestError">
  146. <el-input v-model="item.digest" placeholder="请输入小程序AppID"></el-input>
  147. <div class="sub-des">必须是审核通过,正常发布,且关联到企业的小程序应用</div>
  148. </el-form-item>
  149. <el-form-item
  150. label="小程序路径"
  151. style="margin-right: 200px !important"
  152. required
  153. :error="item.materialUrlError">
  154. <el-input v-model="item.materialUrl" placeholder="请输入小程序路径"></el-input>
  155. <div class="sub-des">必须以 html 作为后缀</div>
  156. </el-form-item>
  157. <el-form-item label="小程序封面" required :error="item.coverUrlError">
  158. <upload class="image-uploader" :fileUrl.sync="item.coverUrl" type="0"></upload>
  159. </el-form-item>
  160. </div>
  161. </div>
  162. <!-- 添加附件 -->
  163. <div class="g-card add-continue" v-show="form.materialMsgList.length <= 8 && showMore()">
  164. <el-dropdown style="margin-left: 10px" @command="onInsertMaterial">
  165. <div style="display: flex; align-items: center">
  166. <img style="margin-right: 5px" :src="require('@/assets/drainageCode/plus-circle.png')" alt="" />
  167. 继续添加附件
  168. </div>
  169. <el-dropdown-menu slot="dropdown" trigger="click">
  170. <!-- <el-dropdown-item :command="4">
  171. <el-button type="text">文字</el-button>
  172. </el-dropdown-item> -->
  173. <el-dropdown-item :command="'0'" v-if="showType('0')">
  174. <el-button type="text">图片</el-button>
  175. </el-dropdown-item>
  176. <el-dropdown-item :command="'8'" v-if="showType('8')">
  177. <el-button type="text">图文</el-button>
  178. </el-dropdown-item>
  179. <el-dropdown-item :command="'9'" v-if="showType('9')">
  180. <el-button type="text">小程序</el-button>
  181. </el-dropdown-item>
  182. </el-dropdown-menu>
  183. </el-dropdown>
  184. </div>
  185. <el-form-item v-if="showStepBtn" label-width="0" style="margin-top: 20px">
  186. <el-button @click="onBackStep" v-if="showBack">上一步</el-button>
  187. <el-button type="primary" @click="submit">保存</el-button>
  188. </el-form-item>
  189. </el-form>
  190. </el-col>
  191. <el-col style="width: 350px">
  192. <div class="g-card" style="height: 100%">
  193. <preview-client :list="form"></preview-client>
  194. </div>
  195. </el-col>
  196. </el-row>
  197. <SelectMaterial
  198. :visible.sync="dialogVisibleSelectMaterial"
  199. :type="materialType"
  200. @success="submitSelectMaterial"></SelectMaterial>
  201. <SelectMaterial
  202. :visible.sync="dialogVisibleSelectMaterialWel"
  203. type="4"
  204. @success="submitSelectMaterialWel"></SelectMaterial>
  205. <el-dialog key="a" title="选择欢迎语" :visible.sync="dialogVisibleSelectWel" width="500">
  206. <div>
  207. <el-input class="welcome-input" placeholder="请输入关键字" v-model="welQuery.welcomeMsg">
  208. <el-button slot="append" @click="getWelList">查询</el-button>
  209. </el-input>
  210. <el-table
  211. ref="table"
  212. v-loading="welLoading"
  213. :data="welList"
  214. :max-height="300"
  215. :show-header="false"
  216. highlight-current-row
  217. @current-change="(val) => (welSelected = val)">
  218. <el-table-column property="welcomeMsg" show-overflow-tooltip>
  219. <template slot-scope="{ row }">
  220. {{ row.attachments[0].content }}
  221. </template>
  222. </el-table-column>
  223. <el-table-column width="60">
  224. <template slot-scope="{ row }">
  225. <i
  226. v-if="welSelected.id === row.id"
  227. class="el-icon-check"
  228. style="color: rgb(65, 133, 244); font-size: 25px"></i>
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. </div>
  233. <div slot="footer">
  234. <el-button @click="dialogVisibleSelectWel = false">取 消</el-button>
  235. <el-button type="primary" @click="selectWelcome">确 定</el-button>
  236. </div>
  237. </el-dialog>
  238. <SelectWeUser
  239. :defaultValues="selectedUserList"
  240. :visible.sync="dialogVisibleSelectUser"
  241. title="选择使用员工"
  242. @success="selectedUser"></SelectWeUser>
  243. </div>
  244. </template>
  245. <script>
  246. import SelectMaterial from '@/components/SelectMaterial'
  247. import { getList } from '@/api/drainageCode/welcome'
  248. import PreviewClient from '@/components/previewInMobileClient.vue'
  249. const materialField = {
  250. audioTime: '', // 音频时长
  251. content: '', // 内容 小程序路径
  252. coverUrl: '', // 封面图
  253. digest: '', // 摘要
  254. materialName: '', // 图片名称、7图文标题、8小程序标题
  255. materialUrl: '', // 本地资源文件地址、小程序AppID
  256. contentError: '', // 表单校验
  257. materialUrlError: '',
  258. materialNameError: '',
  259. coverUrlError: '',
  260. }
  261. export default {
  262. name: 'welcome-detail',
  263. components: {
  264. SelectMaterial,
  265. PreviewClient,
  266. },
  267. props: {
  268. baseData: {
  269. type: Object,
  270. default: () => {
  271. return {
  272. welcomeMsg: '',
  273. materialMsgList: [],
  274. }
  275. },
  276. },
  277. isgroup: {
  278. type: Boolean,
  279. default: false,
  280. },
  281. showTemplate: {
  282. type: Boolean,
  283. default: true,
  284. },
  285. showMember: {
  286. type: Boolean,
  287. default: false,
  288. },
  289. showBack: {
  290. type: Boolean,
  291. default: false,
  292. },
  293. showMorMaterial: {
  294. type: Boolean,
  295. default: false,
  296. },
  297. showStepBtn: {
  298. type: Boolean,
  299. default: true,
  300. },
  301. currentActive: {
  302. type: Number,
  303. },
  304. isSingle: {
  305. type: Boolean,
  306. default: false,
  307. },
  308. strType: {
  309. type: Boolean,
  310. default: false,
  311. },
  312. },
  313. watch: {
  314. baseData(val) {
  315. if (val.welcomeMsg) {
  316. this.form.welcomeMsg = val.welcomeMsg
  317. this.form.materialMsgList = val.materialMsgList
  318. this.form.userIds = val.userIds
  319. this.form.userNames = val.userNames
  320. this.setData()
  321. this.$forceUpdate()
  322. }
  323. },
  324. },
  325. data() {
  326. return {
  327. userError: '',
  328. isChecked: false,
  329. form: {
  330. welcomeMsg: '',
  331. materialMsgList: [],
  332. userIds: '',
  333. userNames: '',
  334. },
  335. users: [],
  336. welcomeMsgError: '',
  337. dialogVisibleSelectMaterial: false,
  338. materialType: '',
  339. dialogVisibleSelectWel: false,
  340. dialogVisibleSelectMaterialWel: false,
  341. // 遮罩层
  342. loading: false,
  343. welQuery: {
  344. welcomeMsg: '',
  345. },
  346. welLoading: false,
  347. welList: [],
  348. welSelected: {
  349. id: '',
  350. },
  351. selectedUserList: [],
  352. dialogVisibleSelectUser: false,
  353. strTemplate1: '%NICKNAME%',
  354. strTemplate2: '#客户昵称#',
  355. }
  356. },
  357. mounted() {
  358. if (this.baseData.welcomeMsg) {
  359. this.form.welcomeMsg = this.baseData.welcomeMsg
  360. this.form.materialMsgList = this.baseData.materialMsgList
  361. this.form.userIds = this.baseData.userIds
  362. this.form.userNames = this.baseData.userNames
  363. this.setData()
  364. }
  365. },
  366. methods: {
  367. setData() {
  368. this.selectedUserList = []
  369. let arr = []
  370. if (this.form.userIds) {
  371. arr = this.form.userIds.split(',').map((dd, index) => {
  372. return {
  373. userId: dd,
  374. name: this.form.userNames.split(',')[index],
  375. }
  376. })
  377. }
  378. this.users = arr
  379. },
  380. showType(type) {
  381. let exit = true
  382. if (this.isSingle) {
  383. this.form.materialMsgList.forEach((dd) => {
  384. if (dd.msgType === type) {
  385. exit = false
  386. }
  387. })
  388. }
  389. return exit
  390. },
  391. showMore() {
  392. let exit = true
  393. if (this.isSingle) {
  394. if (this.form.materialMsgList.length === 1) {
  395. exit = false
  396. }
  397. }
  398. return exit
  399. },
  400. onSelectUser() {
  401. this.userError = ''
  402. this.selectedUserList = []
  403. let arr = []
  404. if (this.form.userIds) {
  405. arr = this.form.userIds.split(',').map((dd, index) => {
  406. return {
  407. userId: dd,
  408. name: this.form.userNames.split(',')[index],
  409. }
  410. })
  411. }
  412. this.selectedUserList = arr
  413. this.dialogVisibleSelectUser = true
  414. },
  415. selectedUser(users) {
  416. let ids = []
  417. let names = []
  418. const selectedUserList = users.map((d) => {
  419. ids.push(d.userId)
  420. names.push(d.name)
  421. return {
  422. userId: d.userId,
  423. name: d.name,
  424. }
  425. })
  426. this.users = selectedUserList
  427. this.form.userIds = ids.join(',')
  428. this.form.userNames = names.join(',')
  429. },
  430. // 插入客户昵称
  431. onInsert(val) {
  432. this.isChecked = val
  433. const $textarea = this.$refs.msgTextarea.$el.children[0]
  434. const msg = this.form.welcomeMsg
  435. if (val) {
  436. const textIndex = $textarea.selectionStart
  437. if (textIndex == 0 && document.activeElement != $textarea) {
  438. this.form.welcomeMsg += this.strType ? this.strTemplate1 : this.strTemplate2
  439. } else {
  440. let str = this.strType ? this.strTemplate1 : this.strTemplate2
  441. this.form.welcomeMsg = msg.slice(0, textIndex) + str + msg.slice(textIndex)
  442. }
  443. } else {
  444. this.form.welcomeMsg = this.strType ? msg.replace(/\%NICKNAME\%/, '') : msg.replace(/\#客户昵称\#/, '')
  445. }
  446. },
  447. onChooseMaterial(materialType, rowIndex) {
  448. this.materialType = materialType
  449. this.rowIndex = rowIndex
  450. this.dialogVisibleSelectMaterial = true
  451. },
  452. submitSelectMaterial(data) {
  453. this.form.materialMsgList.splice(
  454. this.rowIndex,
  455. 1,
  456. Object.assign({}, this.form.materialMsgList[this.rowIndex], data),
  457. )
  458. },
  459. onChooseMaterialWel() {
  460. this.dialogVisibleSelectMaterialWel = true
  461. },
  462. submitSelectMaterialWel(data) {
  463. this.isChecked = false
  464. this.form.welcomeMsg = data.content
  465. },
  466. onInsertMaterial(e) {
  467. this.form.materialMsgList.push({
  468. msgType: e,
  469. ...materialField,
  470. })
  471. },
  472. onRemoveMaterial(index) {
  473. this.form.materialMsgList.splice(index, 1)
  474. },
  475. // 上一步
  476. onBackStep() {
  477. this.$emit('update')
  478. },
  479. validateMaterial() {
  480. let materialList = this.form.materialMsgList
  481. const validateFields = {
  482. 4: [
  483. {
  484. checkField: 'content',
  485. errorField: 'contentError',
  486. errorMsg: '请输入文本',
  487. },
  488. ],
  489. 0: [
  490. {
  491. checkField: 'materialUrl',
  492. errorField: 'materialUrlError',
  493. errorMsg: '请上传图片',
  494. },
  495. ],
  496. 8: [
  497. {
  498. checkField: 'materialName',
  499. errorField: 'materialNameError',
  500. errorMsg: '请输入图文标题',
  501. },
  502. {
  503. checkField: 'materialUrl',
  504. errorField: 'materialUrlError',
  505. errorMsg: '请输入图文链接',
  506. },
  507. ],
  508. 9: [
  509. {
  510. checkField: 'materialName',
  511. errorField: 'materialNameError',
  512. errorMsg: '请输入小程序标题',
  513. },
  514. {
  515. checkField: 'digest',
  516. errorField: 'digestError',
  517. errorMsg: '请输入小程序AppID',
  518. },
  519. {
  520. checkField: 'materialUrl',
  521. errorField: 'materialUrlError',
  522. errorMsg: '请输入小程序路径',
  523. },
  524. {
  525. checkField: 'coverUrl',
  526. errorField: 'coverUrlError',
  527. errorMsg: '请上传小程序封面',
  528. },
  529. ],
  530. }
  531. return materialList.every((i) => {
  532. let validateList = validateFields[i.msgType]
  533. let goto = true
  534. validateList.forEach((validate) => {
  535. if (!i[validate.checkField]) {
  536. i[validate.errorField] = validate.errorMsg
  537. goto = false
  538. } else {
  539. i[validate.errorField] = ''
  540. }
  541. })
  542. return goto
  543. })
  544. },
  545. /** 获取欢迎语列表 */
  546. getWelList() {
  547. this.welLoading = true
  548. getList(this.welQuery).then(({ rows }) => {
  549. this.welList = rows
  550. this.$refs.table.$forceUpdate()
  551. this.welLoading = false
  552. })
  553. },
  554. // 欢迎语确认按钮
  555. selectWelcome() {
  556. this.form.welcomeMsg = this.welSelected.attachments ? this.welSelected.attachments[0].content : ''
  557. this.form.materialMsgList = this.welSelected.attachments ? this.getData(this.welSelected.attachments) : []
  558. this.welSelected = {
  559. id: '',
  560. }
  561. this.$forceUpdate()
  562. this.dialogVisibleSelectWel = false
  563. },
  564. getData(list) {
  565. let arr = []
  566. if (list && list.length) {
  567. list.forEach((dd) => {
  568. if (dd.msgType === 'image') {
  569. let obj = {
  570. msgType: '0',
  571. materialUrl: dd.picUrl,
  572. }
  573. arr.push(obj)
  574. } else if (dd.msgType === 'link') {
  575. let ob = {
  576. msgType: '8',
  577. materialName: dd.title,
  578. materialUrl: dd.linkUrl,
  579. }
  580. arr.push(ob)
  581. } else if (dd.msgType === 'miniprogram') {
  582. let ff = {
  583. msgType: '9',
  584. digest: dd.appId,
  585. materialName: dd.title,
  586. coverUrl: dd.picUrl,
  587. materialUrl: dd.linkUrl,
  588. }
  589. arr.push(ff)
  590. }
  591. })
  592. }
  593. return arr
  594. // })
  595. },
  596. resetData(list) {
  597. let arr = []
  598. if (list && list.length) {
  599. list.forEach((dd) => {
  600. if (dd.msgType === '0') {
  601. let obj = {
  602. msgType: 'image',
  603. picUrl: dd.materialUrl,
  604. }
  605. arr.push(obj)
  606. } else if (dd.msgType === '8') {
  607. let ob = {
  608. msgType: 'link',
  609. title: dd.materialName,
  610. linkUrl: dd.materialUrl,
  611. }
  612. arr.push(ob)
  613. } else if (dd.msgType === '9') {
  614. let ff = {
  615. msgType: 'miniprogram',
  616. appId: dd.digest,
  617. title: dd.materialName,
  618. picUrl: dd.coverUrl,
  619. linkUrl: dd.materialUrl,
  620. }
  621. arr.push(ff)
  622. }
  623. })
  624. }
  625. return arr
  626. },
  627. setEditList(list) {
  628. let arr = []
  629. if (list && list.length) {
  630. list.forEach((dd) => {
  631. if (dd.msgType === 'image') {
  632. let obj = {
  633. msgType: '0',
  634. materialUrl: dd.picUrl,
  635. }
  636. arr.push(obj)
  637. } else if (dd.msgType === 'link') {
  638. let ob = {
  639. msgType: '8',
  640. materialName: dd.title,
  641. materialUrl: dd.linkUrl,
  642. }
  643. arr.push(ob)
  644. } else if (dd.msgType === 'miniprogram') {
  645. let ff = {
  646. msgType: '9',
  647. digest: dd.appId,
  648. materialName: dd.title,
  649. coverUrl: dd.picUrl,
  650. materialUrl: dd.linkUrl,
  651. }
  652. arr.push(ff)
  653. }
  654. })
  655. }
  656. return arr
  657. },
  658. submit() {
  659. if (this.showMember && !this.form.userIds) {
  660. this.userError = '请选择员工!'
  661. return
  662. }
  663. if (!this.form.welcomeMsg) {
  664. this.welcomeMsgError = '请输入欢迎语'
  665. return
  666. } else {
  667. this.welcomeMsgError = ''
  668. }
  669. const checkMaterialResult = this.validateMaterial()
  670. if (checkMaterialResult) {
  671. let goto = true
  672. this.form.materialMsgList.forEach((dd) => {
  673. if (dd.msgType === '8') {
  674. let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/
  675. if (!reUrl.test(dd.materialUrl)) {
  676. goto = false
  677. dd.materialUrlError = '必须以 http://或 https://开头'
  678. }
  679. }
  680. if (dd.msgType === '9') {
  681. let htm = /^.*html$/
  682. if (!htm.test(dd.materialUrl)) {
  683. goto = false
  684. dd.materialUrlError = '必须以 html 作为后缀'
  685. }
  686. }
  687. })
  688. this.$forceUpdate()
  689. if (goto) {
  690. if (this.form.userIds) {
  691. this.form.userIds = this.form.userIds.split(',')
  692. this.form.userNames = this.form.userNames.split(',')
  693. delete this.form.users
  694. }
  695. // this.msgInfo('校验通过')
  696. this.$emit('submit', this.form)
  697. return true
  698. } else {
  699. return false
  700. }
  701. }
  702. },
  703. },
  704. }
  705. </script>
  706. <style lang="scss" scoped>
  707. ::v-deep .image-uploader {
  708. .uploader-icon {
  709. width: 120px;
  710. height: 114px;
  711. line-height: 114px;
  712. }
  713. .upload-img {
  714. width: 100px;
  715. height: 94px;
  716. }
  717. }
  718. .sub-des {
  719. font-size: 12px;
  720. font-weight: 400;
  721. color: #999999;
  722. }
  723. .add-continue {
  724. cursor: pointer;
  725. font-size: 14px;
  726. font-weight: 400;
  727. color: var(--color);
  728. display: flex;
  729. align-items: center;
  730. justify-content: center;
  731. &:hover {
  732. opacity: 0.8;
  733. }
  734. }
  735. .my-cord {
  736. position: relative;
  737. .operation {
  738. z-index: 100;
  739. cursor: pointer;
  740. position: absolute;
  741. top: 0;
  742. right: 0;
  743. font-size: 12px;
  744. font-weight: 400;
  745. color: #1785ff;
  746. display: flex;
  747. align-items: center;
  748. .algin {
  749. margin-left: 20px;
  750. display: flex;
  751. align-items: center;
  752. }
  753. &:hover {
  754. opacity: 0.8;
  755. }
  756. }
  757. }
  758. </style>