index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
  1. <template>
  2. <div id="activeConfiguration">
  3. <search-box :formList="formList" @search="search" @init="init" />
  4. <table-list
  5. :tableSets="tableSet"
  6. :tableData="tableData"
  7. :navText="navText"
  8. @addClick="addClick"
  9. :loading="loading"
  10. >
  11. <template slot="btn" slot-scope="props">
  12. <el-button
  13. type="text"
  14. @click="changeStatus(props.scope.row, 3)"
  15. v-if="props.scope.row.status === 2 || props.scope.row.status === 4"
  16. >开始</el-button
  17. >
  18. <el-button
  19. type="text"
  20. @click="changeStatus(props.scope.row, 1)"
  21. v-if="props.scope.row.status === 3"
  22. >结束</el-button
  23. >
  24. <el-button type="text" @click="addClick(props.scope.row, 2)"
  25. >详情</el-button
  26. >
  27. <el-button
  28. type="text"
  29. @click="changeStatus(props.scope.row, 2)"
  30. v-if="props.scope.row.status === 3"
  31. >撤回</el-button
  32. >
  33. <el-button
  34. type="text"
  35. @click="addClick(props.scope.row, 0)"
  36. v-if="props.scope.row.status === 2 || props.scope.row.status === 4"
  37. >修改</el-button
  38. >
  39. <el-button
  40. type="text"
  41. @click="changeStatus(props.scope.row, 0)"
  42. v-if="props.scope.row.status === 4"
  43. >删除</el-button
  44. >
  45. </template>
  46. </table-list>
  47. <pagination
  48. :total="total"
  49. :pageSize="pageSize"
  50. :currentPage="currentPage"
  51. @handleSizeChange="handleSizeChange"
  52. @handleCurrentChange="handleCurrentChange"
  53. />
  54. <el-dialog
  55. :visible.sync="dialogBox"
  56. width="920px"
  57. :show-close="false"
  58. :destroy-on-close="true"
  59. :before-close="closeBefore"
  60. :fullscreen="fullscreen"
  61. >
  62. <div slot="title" class="hearders">
  63. <div class="leftTitle">
  64. {{ statusPop === 1 ? "添加" : statusPop === 0 ? "修改" : "详情" }}
  65. </div>
  66. <div class="rightBoxs">
  67. <img
  68. src="@/assets/images/Max@2x.png"
  69. alt=""
  70. @click="fullscreen = !fullscreen"
  71. />
  72. <img src="@/assets/images/Close@2x.png" alt="" @click="closeBefore" />
  73. </div>
  74. </div>
  75. <el-row class="contentBox" :span="24">
  76. <el-col :span="12">
  77. <el-col :span="24">
  78. <header>活动名称:</header>
  79. <el-input
  80. :disabled="statusPop === 2"
  81. placeholder="请输入活动名称"
  82. v-model="formLabelAlign.activityName"
  83. /></el-col>
  84. <el-col :span="24">
  85. <header>活动链接:</header>
  86. <el-input
  87. :disabled="statusPop === 2"
  88. placeholder="请输入活动链接"
  89. v-model="formLabelAlign.activityUrl"
  90. />
  91. </el-col>
  92. <el-col :span="24">
  93. <header>活动类型:</header>
  94. <el-select
  95. style="width: 100%"
  96. v-model="formLabelAlign.activityType"
  97. placeholder="请选择活动类型"
  98. :disabled="statusPop === 2"
  99. >
  100. <el-option
  101. v-for="item in activityList"
  102. :key="item.value"
  103. :label="item.label"
  104. :value="item.value"
  105. >
  106. </el-option>
  107. </el-select>
  108. </el-col>
  109. <el-col :span="24" v-if="formLabelAlign.activityType !== 2">
  110. <header>活动范围:</header>
  111. <el-select
  112. style="width: 100%"
  113. multiple
  114. v-model="formLabelAlign.courses"
  115. placeholder="请选择活动类型"
  116. :disabled="statusPop === 2"
  117. >
  118. <el-option
  119. v-for="(item, index) in courseList"
  120. :key="index"
  121. :label="item.courseName"
  122. :value="item.courseId"
  123. >
  124. </el-option>
  125. </el-select>
  126. </el-col>
  127. <el-col :span="24" v-if="formLabelAlign.activityType !== 2">
  128. <header>
  129. {{
  130. formLabelAlign.activityType === 0
  131. ? "金额"
  132. : formLabelAlign.activityType === 1
  133. ? "折扣"
  134. : formLabelAlign.activityType === 3
  135. ? "商品金额"
  136. : formLabelAlign.activityType === 4
  137. ? "优惠金额"
  138. : formLabelAlign.activityType === 5
  139. ? "商品折扣"
  140. : "未定义"
  141. }}:
  142. </header>
  143. <el-input
  144. placeholder="请输入"
  145. v-model="formLabelAlign.price"
  146. :disabled="statusPop === 2"
  147. >
  148. <template slot="append">{{
  149. formLabelAlign.activityType === 0 ||
  150. formLabelAlign.activityType === 3 ||
  151. formLabelAlign.activityType === 4 ||
  152. formLabelAlign.activityType === 5
  153. ? "¥"
  154. : "折"
  155. }}</template>
  156. </el-input>
  157. </el-col>
  158. <el-col
  159. :span="24"
  160. v-if="
  161. formLabelAlign.activityType === 0 ||
  162. formLabelAlign.activityType === 1
  163. "
  164. >
  165. <header>
  166. {{
  167. formLabelAlign.activityType === 0
  168. ? "优惠券"
  169. : formLabelAlign.activityType === 1
  170. ? "折扣券"
  171. : "未定义"
  172. }}有效期:
  173. </header>
  174. <el-input
  175. placeholder="请输入有效期"
  176. v-model="formLabelAlign.couponEnd"
  177. :disabled="statusPop === 2"
  178. >
  179. <template slot="append">月</template>
  180. </el-input>
  181. </el-col>
  182. <el-col :span="24">
  183. <header>活动时间:</header>
  184. <el-date-picker
  185. :disabled="statusPop === 2"
  186. v-model="releaseTime"
  187. type="datetimerange"
  188. range-separator="~"
  189. start-placeholder="开始日期"
  190. end-placeholder="结束日期"
  191. value-format="timestamp"
  192. >
  193. </el-date-picker>
  194. </el-col>
  195. <el-col :span="24">
  196. <header>备注:</header>
  197. <el-input
  198. :disabled="statusPop === 2"
  199. placeholder="请输入备注"
  200. v-model="formLabelAlign.description"
  201. />
  202. </el-col>
  203. </el-col>
  204. <el-col :span="12">
  205. <el-col :span="24">
  206. <header>活动封面:</header>
  207. <div class="imgBox">
  208. <label class="imgLabel" for="inputs">
  209. <div class="msPhoto" v-if="formLabelAlign.activityLogo">
  210. <img
  211. :src="
  212. $methodsTools.splitImgHost(formLabelAlign.activityLogo)
  213. "
  214. alt="图片加载失败"
  215. />
  216. </div>
  217. <div class="imgbbx" v-else>
  218. <p style="margin-top: 49px">点击添加或将文件拖拽到这里上传</p>
  219. <i class="el-icon-plus"></i>
  220. <p style="margin-bottom: 37px">
  221. 图片格式:.jpg/.png/jpeg/bmp
  222. </p>
  223. </div>
  224. <input
  225. id="inputs"
  226. type="file"
  227. ref="file"
  228. :disabled="statusPop === 2"
  229. style="display: none"
  230. @change="getImgFile"
  231. />
  232. </label>
  233. <p>请上传分辨率为100x100且大小小于2m的图片</p>
  234. </div>
  235. </el-col>
  236. <el-col :span="24">
  237. <header>活动详情图:</header>
  238. <div class="imgBox">
  239. <label class="imgLabel" for="inputsimg">
  240. <div class="msPhoto" v-if="formLabelAlign.activityContentUrl">
  241. <img
  242. :src="
  243. $methodsTools.splitImgHost(formLabelAlign.activityContentUrl)
  244. "
  245. alt="图片加载失败"
  246. />
  247. </div>
  248. <div class="imgbbx" v-else>
  249. <p style="margin-top: 49px">点击添加或将文件拖拽到这里上传</p>
  250. <i class="el-icon-plus"></i>
  251. <p style="margin-bottom: 37px">
  252. 图片格式:.jpg/.png/jpeg/bmp
  253. </p>
  254. </div>
  255. <input
  256. id="inputsimg"
  257. type="file"
  258. ref="fileimg"
  259. :disabled="statusPop === 2"
  260. style="display: none"
  261. @change="getImgFileImg"
  262. />
  263. </label>
  264. <p>请上传活动详情图</p>
  265. </div>
  266. </el-col>
  267. <el-col :span="24" v-if="formLabelAlign.activityType === 2">
  268. <header>直播内容:</header>
  269. <el-input
  270. :disabled="statusPop === 2"
  271. placeholder="请输入直播内容"
  272. v-model="formLabelAlign.liveContent"
  273. />
  274. </el-col>
  275. <el-col :span="24" v-if="formLabelAlign.activityType !== 2">
  276. <header>发放数量:</header>
  277. <el-input-number
  278. :disabled="statusPop === 2"
  279. v-model="formLabelAlign.quantity"
  280. controls-position="right"
  281. :min="0"
  282. style="width: 100%"
  283. ></el-input-number>
  284. </el-col>
  285. </el-col>
  286. </el-row>
  287. <div slot="footer" class="dialog-footer">
  288. <el-button @click="closeBefore">取 消</el-button>
  289. <el-button
  290. type="primary"
  291. @click="rulesTableSumbit"
  292. v-if="statusPop !== 2"
  293. >确 定</el-button
  294. >
  295. </div>
  296. </el-dialog>
  297. </div>
  298. </template>
  299. <script>
  300. import searchBox from "@/components/searchBox";
  301. import tableList from "@/components/tableList";
  302. import pagination from "@/components/pagination";
  303. export default {
  304. components: { searchBox, tableList, pagination },
  305. data() {
  306. return {
  307. loading: false, //当前表单加载是否加载动画
  308. navText: {
  309. title: "活动配置",
  310. index: 0,
  311. ch: "条",
  312. num: true,
  313. choice: true,
  314. addHide: false,
  315. backFatherBtn: {
  316. status: false,
  317. title: "未定义",
  318. },
  319. },
  320. statusPop: 0,
  321. fullscreen: false,
  322. dialogBox: false,
  323. activityList: [
  324. {
  325. label: "优惠券",
  326. value: 0,
  327. },
  328. {
  329. label: "折扣券",
  330. value: 1,
  331. },
  332. {
  333. label: "线上直播",
  334. value: 2,
  335. },
  336. {
  337. label: "定价",
  338. value: 3,
  339. },
  340. {
  341. label: "优惠",
  342. value: 4,
  343. },
  344. {
  345. label: "折扣",
  346. value: 5,
  347. },
  348. ],
  349. //搜索
  350. formList: [
  351. {
  352. label: "活动类型",
  353. prop: "activityType",
  354. placeholder: "请选择活动类型",
  355. scope: "select",
  356. options: [
  357. {
  358. label: "优惠券",
  359. value: 0,
  360. },
  361. {
  362. label: "折扣券",
  363. value: 1,
  364. },
  365. {
  366. label: "线上直播",
  367. value: 2,
  368. },
  369. {
  370. label: "定价",
  371. value: 3,
  372. },
  373. {
  374. label: "优惠",
  375. value: 4,
  376. },
  377. {
  378. label: "折扣",
  379. value: 5,
  380. },
  381. ],
  382. },
  383. {
  384. label: "活动状态",
  385. prop: "status",
  386. placeholder: "请选择活动状态",
  387. scope: "select",
  388. options: [
  389. {
  390. label: "已删除",
  391. value: 0,
  392. },
  393. {
  394. label: "已结束",
  395. value: 1,
  396. },
  397. {
  398. label: "已撤回",
  399. value: 2,
  400. },
  401. {
  402. label: "已开始",
  403. value: 3,
  404. },
  405. {
  406. label: "未开始",
  407. value: 4,
  408. },
  409. ],
  410. },
  411. {
  412. label: "活动时间",
  413. prop: "startTimeList",
  414. scope: "datePicker",
  415. },
  416. {
  417. label: "活动名称",
  418. prop: "activityName",
  419. placeholder: "请输入活动名称",
  420. },
  421. ],
  422. // 表单
  423. tableSet: [
  424. {
  425. label: "活动名称",
  426. prop: "activityName",
  427. hidden: true,
  428. },
  429. {
  430. label: "活动类型",
  431. prop: "activityType",
  432. hidden: true,
  433. scope: "activityType",
  434. },
  435. {
  436. label: "活动说明",
  437. prop: "activityType",
  438. hidden: true,
  439. scope: "activityRemarks",
  440. },
  441. {
  442. label: "活动时间",
  443. prop1: "startTime",
  444. prop2: "endTime",
  445. hidden: true,
  446. scope: "TimeLists",
  447. },
  448. {
  449. label: "活动状态",
  450. prop: "status",
  451. hidden: true,
  452. scope: "statusActivity",
  453. },
  454. {
  455. label: "发放数量",
  456. prop: "quantity",
  457. hidden: true,
  458. },
  459. {
  460. label: "参与人数",
  461. prop: "userNumber",
  462. hidden: true,
  463. },
  464. {
  465. label: "备注",
  466. prop: "description",
  467. hidden: true,
  468. },
  469. ],
  470. formLabelAlign: {},
  471. releaseTime: [],
  472. tableData: [], //表单数据
  473. total: 0, //一共多少条
  474. pageSize: 10, //每页多少条数据
  475. currentPage: 1, //当前页码
  476. beif: {},
  477. courseList: [],
  478. };
  479. },
  480. mounted() {
  481. this.search();
  482. this.getCourse();
  483. },
  484. methods: {
  485. getCourse() {
  486. this.$api
  487. .inquireCourseList({
  488. status: 1,
  489. })
  490. .then((res) => {
  491. if (res.code === 200) {
  492. this.courseList = res.rows;
  493. }
  494. });
  495. },
  496. getImgFile() {
  497. var self = this;
  498. var file = this.$refs.file.files[0];
  499. if (file === undefined) {
  500. self.$set(self.formLabelAlign, "activityLogo", "");
  501. return;
  502. }
  503. if (file.size > 2 * 1024 * 1024) {
  504. this.$message.error("图片不得大于2MB");
  505. return;
  506. }
  507. var type = this.$refs.file.value.toLowerCase().split(".").splice(-1);
  508. if (
  509. type[0] != "jpg" &&
  510. type[0] != "png" &&
  511. type[0] != "jpeg" &&
  512. type[0] != "bmp"
  513. ) {
  514. this.$message.error("上传格式需为:.jpg/.png/.jpeg/bmp");
  515. this.$refs.file.value = "";
  516. return;
  517. }
  518. var reader = new FileReader();
  519. reader.readAsDataURL(file);
  520. reader.onload = function (ev) {
  521. self.$set(self.formLabelAlign, "activityLogo", ev.target.result);
  522. };
  523. },
  524. getImgFileImg(){
  525. var self = this;
  526. var file = this.$refs.fileimg.files[0];
  527. if (file === undefined) {
  528. self.$set(self.formLabelAlign, "activityContentUrl", "");
  529. return;
  530. }
  531. if (file.size > 5 * 1024 * 1024) {
  532. this.$message.error("图片不得大于5MB");
  533. return;
  534. }
  535. var type = this.$refs.fileimg.value.toLowerCase().split(".").splice(-1);
  536. if (
  537. type[0] != "jpg" &&
  538. type[0] != "png" &&
  539. type[0] != "jpeg" &&
  540. type[0] != "bmp"
  541. ) {
  542. this.$message.error("上传格式需为:.jpg/.png/.jpeg/bmp");
  543. this.$refs.fileimg.value = "";
  544. return;
  545. }
  546. var reader = new FileReader();
  547. reader.readAsDataURL(file);
  548. reader.onload = function (ev) {
  549. self.$set(self.formLabelAlign, "activityContentUrl", ev.target.result);
  550. };
  551. },
  552. search(v) {
  553. this.loading = true;
  554. if (v === undefined) {
  555. v = {
  556. pageSize: this.pageSize,
  557. pageNum: this.currentPage,
  558. };
  559. }
  560. var data = {
  561. activityName: v.activityName,
  562. status: v.status,
  563. activityType: v.activityType,
  564. startTime: v.startTimeList ? (v.startTimeList[0] / 1000).toFixed(0) : "",
  565. endTime: v.startTimeList ? (v.startTimeList[1] / 1000).toFixed(0) : "",
  566. pageSize: this.pageSize,
  567. pageNum: this.currentPage,
  568. };
  569. this.$api.inquireActiveConfiguration(data).then((res) => {
  570. this.tableData = res.rows;
  571. this.total = res.total;
  572. this.navText.index = res.total;
  573. });
  574. this.loading = false;
  575. },
  576. init() {
  577. this.search();
  578. },
  579. addClick(v, int) {
  580. if (int === undefined) {
  581. this.statusPop = 1;
  582. this.formLabelAlign = {};
  583. } else {
  584. this.beif = JSON.stringify(v);
  585. this.formLabelAlign = JSON.parse(this.beif);
  586. this.releaseTime = [
  587. this.formLabelAlign.startTime * 1000,
  588. this.formLabelAlign.endTime * 1000,
  589. ];
  590. this.statusPop = int;
  591. }
  592. this.dialogBox = true;
  593. },
  594. closeBefore() {
  595. if (this.statusPop === 2) {
  596. this.dialogBox = false;
  597. this.fullscreen = false;
  598. } else {
  599. this.$confirm("此操作将关闭窗口, 是否继续?", "提示", {
  600. confirmButtonText: "确定",
  601. cancelButtonText: "取消",
  602. type: "warning",
  603. })
  604. .then(() => {
  605. this.dialogBox = false;
  606. this.fullscreen = false;
  607. this.formLabelAlign = {};
  608. })
  609. .catch(() => {});
  610. }
  611. },
  612. async rulesTableSumbit() {
  613. if (!this.formLabelAlign.activityName) {
  614. this.$message.error("请输入活动名称");
  615. return;
  616. }
  617. if (
  618. this.formLabelAlign.activityLogo === "" ||
  619. this.formLabelAlign.activityLogo === undefined
  620. ) {
  621. this.$message.error("请上传活动图标");
  622. return;
  623. }
  624. if (
  625. this.formLabelAlign.activityContentUrl === "" ||
  626. this.formLabelAlign.activityContentUrl === undefined
  627. ) {
  628. this.$message.error("请上传活动详情图");
  629. return;
  630. }
  631. if (!this.formLabelAlign.activityUrl) {
  632. this.$message.error("请输入跳转链接");
  633. return;
  634. }
  635. if (!this.releaseTime) {
  636. this.$message.error("请选择活动时间");
  637. return;
  638. }
  639. if (this.formLabelAlign.activityType !== 2) {
  640. if (this.formLabelAlign.courses.length === 0) {
  641. this.$message.error("请选择活动范围");
  642. return;
  643. }
  644. if (
  645. this.formLabelAlign.price === "" ||
  646. this.formLabelAlign.price == undefined ||
  647. this.formLabelAlign.price === null
  648. ) {
  649. this.$message.error("请选择金额/折扣/优惠金额");
  650. return;
  651. }
  652. if (
  653. this.formLabelAlign.quantity === "" ||
  654. this.formLabelAlign.quantity == undefined ||
  655. this.formLabelAlign.quantity === null
  656. ) {
  657. this.$message.error("请输入发放数量");
  658. return;
  659. }
  660. } else {
  661. if (!this.formLabelAlign.liveContent) {
  662. this.$message.error("请输入直播内容");
  663. return;
  664. }
  665. }
  666. if (this.statusPop === 0) {
  667. var objNew = JSON.parse(this.beif);
  668. if (this.formLabelAlign.activityLogo !== objNew.activityLogo) {
  669. const awtimg01 = await this.imgUpload(0);
  670. }
  671. if (this.formLabelAlign.activityContentUrl !== objNew.activityContentUrl) {
  672. const awtimg02 = await this.imgUploadimg(0);
  673. }
  674. } else {
  675. const awtimg1 = await this.imgUpload(0);
  676. const awtimg2 = await this.imgUploadimg(0);
  677. }
  678. var data = {
  679. activityName: this.formLabelAlign.activityName,
  680. activityUrl: this.formLabelAlign.activityUrl,
  681. activityType: this.formLabelAlign.activityType,
  682. startTime: Number(this.releaseTime[0]) / 1000,
  683. endTime: Number(this.releaseTime[1]) / 1000,
  684. description: this.formLabelAlign.description,
  685. activityLogo: this.formLabelAlign.activityLogo,
  686. activityContentUrl:this.formLabelAlign.activityContentUrl
  687. };
  688. if (this.formLabelAlign.activityType !== 2) {
  689. if (
  690. this.formLabelAlign.activityType === 0 ||
  691. this.formLabelAlign.activityType === 1
  692. ) {
  693. data.couponEnd = this.formLabelAlign.couponEnd;
  694. }
  695. data.coursesId = this.formLabelAlign.courses;
  696. data.price = this.formLabelAlign.price;
  697. data.quantity = this.formLabelAlign.quantity;
  698. } else {
  699. data.liveContent = this.formLabelAlign.liveContent;
  700. }
  701. if (this.statusPop === 1) {
  702. data.status = 4;
  703. this.$api.addActiveConfiguration(data).then((sult) => {
  704. this.$message.success("添加成功!");
  705. this.dialogBox = false;
  706. this.search();
  707. });
  708. } else {
  709. data.id = this.formLabelAlign.id;
  710. data.status = this.formLabelAlign.status;
  711. this.$api.editActiveConfiguration(data).then((sult) => {
  712. this.$message.success("修改成功!");
  713. this.dialogBox = false;
  714. this.search();
  715. });
  716. }
  717. },
  718. changeStatus(v, int) {
  719. var self = this;
  720. var data = {
  721. id: v.id,
  722. status: int,
  723. };
  724. this.$api.editActiveConfiguration(data).then((res) => {
  725. if (res.code === 200) {
  726. if (int === 0) {
  727. self.$message.success("删除成功");
  728. } else if (int === 1) {
  729. self.$message.success("结束成功");
  730. } else if (int === 2) {
  731. self.$message.success("撤回成功");
  732. } else if (int === 3) {
  733. self.$message.success("开始成功");
  734. }
  735. this.search();
  736. }
  737. });
  738. },
  739. imgUpload(int) {
  740. return new Promise((resolve, reject) => {
  741. this.$upload
  742. .upload(this.$refs.file.files[0], int)
  743. .then((res) => {
  744. console.log(res);
  745. this.$set(this.formLabelAlign, "activityLogo", res);
  746. resolve();
  747. })
  748. .catch((err) => {
  749. this.$message.error("活动封面图上传错误");
  750. });
  751. });
  752. },
  753. imgUploadimg(int) {
  754. return new Promise((resolve, reject) => {
  755. this.$upload
  756. .upload(this.$refs.fileimg.files[0], int)
  757. .then((res) => {
  758. console.log(res);
  759. this.$set(this.formLabelAlign, "activityContentUrl", res);
  760. resolve();
  761. })
  762. .catch((err) => {
  763. this.$message.error("活动详情图上传错误");
  764. });
  765. });
  766. },
  767. handleSizeChange(v) {
  768. this.pageSize = v;
  769. this.currentPage = 1;
  770. this.search();
  771. },
  772. handleCurrentChange(v) {
  773. this.currentPage = v;
  774. this.search();
  775. },
  776. },
  777. };
  778. </script>
  779. <style lang="less" scoped>
  780. /deep/.el-button {
  781. border-radius: 8px;
  782. }
  783. /deep/.el-dialog {
  784. border-radius: 8px;
  785. .el-dialog__header {
  786. padding: 0;
  787. .hearders {
  788. height: 40px;
  789. display: flex;
  790. align-items: center;
  791. justify-content: space-between;
  792. padding: 0px 18px 0px 20px;
  793. border-bottom: 1px solid #e2e2e2;
  794. .leftTitle {
  795. font-size: 14px;
  796. font-weight: bold;
  797. color: #2f4378;
  798. }
  799. .rightBoxs {
  800. display: flex;
  801. align-items: center;
  802. img {
  803. width: 14px;
  804. height: 14px;
  805. margin-left: 13px;
  806. cursor: pointer;
  807. }
  808. }
  809. }
  810. }
  811. .el-dialog__body {
  812. padding: 0;
  813. .contentBox {
  814. padding: 20px 20px 5px;
  815. .el-col {
  816. padding: 0px 20px;
  817. margin-bottom: 30px;
  818. header {
  819. margin-bottom: 6px;
  820. color: #2f4378;
  821. font-size: 14px;
  822. }
  823. }
  824. }
  825. }
  826. .el-dialog__footer {
  827. padding: 0;
  828. .dialog-footer {
  829. padding: 0px 40px;
  830. height: 70px;
  831. border-top: 1px solid #e2e2e2;
  832. display: flex;
  833. align-items: center;
  834. justify-content: flex-end;
  835. }
  836. }
  837. }
  838. .imgBox {
  839. width: 100%;
  840. // height: 210px;
  841. border: 1px solid #e2e2e2;
  842. border-radius: 8px;
  843. padding: 8px 8px 3px;
  844. display: flex;
  845. flex-direction: column;
  846. align-items: center;
  847. .imgLabel {
  848. flex: 1;
  849. width: 100%;
  850. border: 1px dotted #e2e2e2;
  851. color: #999;
  852. font-size: 14px;
  853. cursor: pointer;
  854. border-radius: 8px;
  855. .msPhoto {
  856. display: flex;
  857. justify-content: center;
  858. align-items: center;
  859. max-width: 100%;
  860. max-height: 270px;
  861. img {
  862. max-width: 100%;
  863. max-height: 270px;
  864. }
  865. }
  866. .imgbbx {
  867. display: flex;
  868. flex-direction: column;
  869. align-items: center;
  870. justify-content: center;
  871. width: 100%;
  872. height: 100%;
  873. i {
  874. font-weight: bold;
  875. margin: 14px 0;
  876. font-size: 24px;
  877. }
  878. }
  879. }
  880. p {
  881. margin: 5px 0px;
  882. }
  883. }
  884. .avatar-uploader .el-upload {
  885. border: 1px dashed #d9d9d9;
  886. border-radius: 6px;
  887. cursor: pointer;
  888. position: relative;
  889. overflow: hidden;
  890. }
  891. .avatar-uploader .el-upload:hover {
  892. border-color: #409eff;
  893. }
  894. .avatar-uploader-icon {
  895. font-size: 28px;
  896. color: #8c939d;
  897. width: 178px;
  898. height: 178px;
  899. line-height: 178px;
  900. text-align: center;
  901. }
  902. .avatar {
  903. width: 178px;
  904. height: 178px;
  905. display: block;
  906. }
  907. </style>