index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. <template>
  2. <div id="chapterEdit">
  3. <div class="boxWidth">
  4. <el-form
  5. label-position="right"
  6. label-width="120px"
  7. :model="listData"
  8. :rules="rules"
  9. ref="listData"
  10. >
  11. <el-form-item label="适用业务层级">
  12. <el-select
  13. v-model="eduType"
  14. placeholder="请选择教育类型"
  15. @change="changeEduType"
  16. >
  17. <el-option
  18. v-for="(item, index) in eduTypeOptions"
  19. :key="index"
  20. :label="item.educationName"
  21. :value="item.id"
  22. >
  23. </el-option>
  24. </el-select>
  25. <el-select
  26. v-model="courType"
  27. placeholder="请选择业务层次"
  28. @change="changecourseType"
  29. >
  30. <el-option
  31. v-for="(item, index) in newCourTypeOptions"
  32. :key="index"
  33. :label="item.projectName + '-' + item.businessName"
  34. :value="item.id"
  35. >
  36. </el-option>
  37. </el-select>
  38. <el-popover
  39. ref="popovers"
  40. placement="bottom"
  41. trigger="click"
  42. @show="showHandle"
  43. @hide="hideHandle"
  44. :disabled="courType ? false : true"
  45. >
  46. <el-checkbox-group v-model="sujectArray" class="checkboxSty">
  47. <el-checkbox
  48. v-for="(item, index) in newSujectOption"
  49. :label="item.newId"
  50. :key="index"
  51. >{{ item.subjectName }}</el-checkbox
  52. >
  53. </el-checkbox-group>
  54. <div style="display: block; text-align: center; margin-top: 10px">
  55. <el-button size="mini" type="primary" @click="submitSujectArray"
  56. >确定</el-button
  57. >
  58. </div>
  59. <el-button
  60. slot="reference"
  61. style="margin-left: 12px"
  62. @click="getMessage"
  63. >请选择科目</el-button
  64. >
  65. </el-popover>
  66. <span style="margin-left: 10px">注:可多选</span>
  67. </el-form-item>
  68. <el-form-item label="">
  69. <div :class="changeHeight ? 'ach' : 'clh'">
  70. <div
  71. v-for="(item, index) in newSujectApis"
  72. :key="index"
  73. class="listBoxStys"
  74. >
  75. {{
  76. item.educationName +
  77. " - " +
  78. item.projectName +
  79. " - " +
  80. item.businessName +
  81. " - " +
  82. item.subjectName
  83. }}
  84. <i class="el-icon-error closeIcons" @click="closeType(index)"></i>
  85. </div>
  86. </div>
  87. <el-button
  88. size="mini"
  89. v-if="newSujectApis.length > 1"
  90. @click="changeType"
  91. >{{ changeHeight ? "展开" : "关闭" }}</el-button
  92. >
  93. </el-form-item>
  94. <el-form-item label="标题前缀" prop="prefixName">
  95. <el-input v-model="listData.prefixName"></el-input>
  96. </el-form-item>
  97. <el-form-item label="章标题" prop="name">
  98. <el-input v-model="listData.name"></el-input>
  99. </el-form-item>
  100. <el-form-item label="章封面">
  101. <div class="imgBoxins">
  102. <img :src="$methodsTools.splitImgHost(listData.coverUrl)" alt="" />
  103. <div
  104. class="posimg"
  105. v-if="
  106. listData.coverUrl === null ||
  107. listData.coverUrl === '' ||
  108. listData.coverUrl === undefined
  109. "
  110. >
  111. <label for="uplose">
  112. <i class="el-icon-circle-plus-outline iconStsz"></i
  113. ></label>
  114. <input
  115. ref="file"
  116. type="file"
  117. style="display: none"
  118. id="uplose"
  119. @change="getImgFile"
  120. />
  121. <p>
  122. 注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型
  123. </p>
  124. </div>
  125. </div>
  126. <el-button
  127. v-if="
  128. listData.coverUrl !== null &&
  129. listData.coverUrl !== '' &&
  130. listData.coverUrl !== undefined
  131. "
  132. type="danger"
  133. size="mini"
  134. class="margin-top: 20px;"
  135. @click="clearImgs"
  136. >删除</el-button
  137. >
  138. </el-form-item>
  139. <el-form-item label="是否发布" prop="publishStatus">
  140. <el-radio-group v-model="listData.publishStatus">
  141. <el-radio :label="1">是</el-radio>
  142. <el-radio :label="0">否</el-radio>
  143. </el-radio-group>
  144. </el-form-item>
  145. <el-form-item label="管理节">
  146. <div class="dis_plays">
  147. <div>
  148. <el-button size="small" @click="openBoxs">添加节</el-button>
  149. </div>
  150. <div style="color: #f56c6c">
  151. <span style="margin-right: 10px"
  152. >节总数:{{ tableData.length }}</span
  153. >
  154. <!-- <span>总时长:{{ minTimeAll }}分钟</span> -->
  155. </div>
  156. </div>
  157. <el-table
  158. :data="tableData"
  159. border
  160. :header-cell-style="{
  161. 'background-color': '#eee',
  162. padding: '8px',
  163. color: '#333',
  164. }"
  165. :default-sort="{ prop: 'sort', order: 'ascending' }"
  166. >
  167. <template v-for="(item, index) in tableSet">
  168. <el-table-column
  169. :width="item.width"
  170. :key="index"
  171. :label="item.label"
  172. align="center"
  173. :show-overflow-tooltip="true"
  174. header-align="center"
  175. :sortable="item.prop === 'sort'"
  176. sort-by="sort"
  177. :prop="item.prop"
  178. >
  179. <template slot-scope="scope">
  180. <span v-if="item.scope === 'types'">{{
  181. scope.row[item.prop] === 1
  182. ? "录播"
  183. : scope.row[item.prop] === 2
  184. ? "直播"
  185. : scope.row[item.prop] === 3
  186. ? "回放"
  187. : "未知"
  188. }}</span>
  189. <span v-else-if="item.scope === 'Status'">
  190. {{
  191. scope.row[item.prop] === 1
  192. ? "发布"
  193. : scope.row[item.prop] === 0
  194. ? "未发布"
  195. : "未知"
  196. }}
  197. </span>
  198. <div v-else-if="item.scope === 'inputs'">
  199. <el-input-number
  200. style="width: 50px"
  201. size="small"
  202. :controls="false"
  203. v-model="scope.row[item.prop]"
  204. controls-position="right"
  205. :min="0"
  206. ></el-input-number>
  207. </div>
  208. <span v-else>{{ scope.row[item.prop] }}</span></template
  209. >
  210. </el-table-column></template
  211. >
  212. <el-table-column
  213. label="操作"
  214. align="center"
  215. fixed="right"
  216. width="100px"
  217. >
  218. <template slot-scope="scope">
  219. <el-button type="text" @click="delList(scope.row)"
  220. >删除</el-button
  221. >
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. </el-form-item>
  226. <el-form-item>
  227. <el-button @click="backPage">取消</el-button>
  228. <el-button
  229. type="primary"
  230. @click="submit('listData')"
  231. :disabled="!noStudent"
  232. >确定</el-button
  233. >
  234. </el-form-item>
  235. </el-form>
  236. </div>
  237. <el-dialog
  238. :visible.sync="dialogVisible"
  239. width="800px"
  240. :show-close="false"
  241. :close-on-click-modal="false"
  242. >
  243. <div slot="title" class="hearders">
  244. <div class="leftTitle">添加节</div>
  245. <div class="rightBoxs">
  246. <img
  247. src="@/assets/images/Close@2x.png"
  248. alt=""
  249. @click="dialogVisible = false"
  250. />
  251. </div>
  252. </div>
  253. <search-box-new
  254. ref="searchBox"
  255. :formData="formData"
  256. :formList="formList"
  257. @search="getInfos"
  258. @init="init"
  259. />
  260. <el-table
  261. ref="multipleTable"
  262. :data="boxtableData"
  263. border
  264. @select-all="selectAll"
  265. @select="select"
  266. :row-key="getRowKeys"
  267. :header-cell-style="{
  268. 'background-color': '#eee',
  269. padding: '8px',
  270. color: '#333',
  271. }"
  272. >
  273. <el-table-column
  274. align="center"
  275. type="selection"
  276. width="55"
  277. header-align="center"
  278. :selectable="checkboxT"
  279. :reserve-selection="true"
  280. >
  281. </el-table-column>
  282. <template v-for="(item, index) in tableSet">
  283. <el-table-column
  284. v-if="item.scope !== 'inputs'"
  285. :width="item.width"
  286. :key="index"
  287. :label="item.label"
  288. align="center"
  289. :show-overflow-tooltip="true"
  290. header-align="center"
  291. >
  292. <template slot-scope="scope">
  293. <span v-if="item.scope === 'types'">{{
  294. scope.row[item.prop] === 1
  295. ? "录播"
  296. : scope.row[item.prop] === 2
  297. ? "直播"
  298. : scope.row[item.prop] === 3
  299. ? "回放"
  300. : ""
  301. }}</span>
  302. <span v-else-if="item.scope === 'Status'">
  303. {{
  304. scope.row[item.prop] === 1
  305. ? "发布"
  306. : scope.row[item.prop] === 0
  307. ? "未发布"
  308. : "未知"
  309. }}
  310. </span>
  311. <span v-else>{{ scope.row[item.prop] }}</span></template
  312. >
  313. </el-table-column></template
  314. >
  315. </el-table>
  316. <pagination
  317. :total="total"
  318. :pageSize="formData.pageSize"
  319. :currentPage="formData.pageNum"
  320. @handleSizeChange="handleSizeChange"
  321. @handleCurrentChange="handleCurrentChange"
  322. />
  323. <span slot="footer" class="dialog-footer">
  324. <el-button @click="dialogVisible = false">取 消</el-button>
  325. <el-button
  326. type="primary"
  327. :disabled="activeLists.length === 0"
  328. @click="submitForm"
  329. >确 定</el-button
  330. >
  331. </span>
  332. </el-dialog>
  333. </div>
  334. </template>
  335. <script>
  336. import searchBoxNew from "@/components/searchBoxNew";
  337. import pagination from "@/components/pagination";
  338. export default {
  339. components: { searchBoxNew, pagination },
  340. name: "ChapterEdit",
  341. data() {
  342. return {
  343. // 弹窗数据
  344. changeHeight: true,
  345. bfImg: "oss/images/avatar/20211013/1634097664410_1397766697",
  346. listData: {
  347. recordingUrl: "",
  348. liveUrl: "",
  349. coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
  350. },
  351. eduTypeOptions: [], //教育类型数据
  352. projectTypeOptions: [], //项目类型数据
  353. courTypeOptions: [], //业务层次数据
  354. newCourTypeOptions: [], //当前业务层次数据
  355. sujectOption: [], //科目数据
  356. newSujectOption: [], //当前科目数据数据
  357. eduType: "", //当前选中教育类型
  358. courType: "", //当前选中业务层次
  359. sujectApis: [], //当前存在的科目
  360. newSujectApis: [],
  361. sujectArray: [], //选中的科目
  362. //表单验证
  363. rules: {
  364. prefixName: [
  365. { required: true, message: "请输入标题前缀", trigger: "blur" },
  366. ],
  367. name: [{ required: true, message: "请输入章标题", trigger: "blur" }],
  368. // liveDuration: [
  369. // { required: true, message: "节时长不能为空" },
  370. // { type: "number", message: "节时长必须为数字值" },
  371. // ],
  372. publishStatus: [
  373. { required: true, message: "请选择是否发布", trigger: "change" },
  374. ],
  375. },
  376. numberAll: 0, //节总数
  377. minTimeAll: 0, //总时长
  378. tableSet: [
  379. { label: "排序", prop: "sort", scope: "inputs", width: "100" },
  380. { label: "节编码", prop: "code" },
  381. { label: "标题前缀", prop: "prefixName", width: "120" },
  382. { label: "节标题", prop: "name" },
  383. { label: "节类型", prop: "sectionType", scope: "types" },
  384. {
  385. label: "发布状态",
  386. prop: "publishStatus",
  387. scope: "Status",
  388. width: "120",
  389. },
  390. ],
  391. tableData: [],
  392. dialogVisible: false,
  393. boxtableData: [],
  394. formList: [
  395. {
  396. prop: "educationTypeId",
  397. placeholder: "教育类型",
  398. scope: "educationType",
  399. },
  400. {
  401. prop: "businessId",
  402. placeholder: "业务层次",
  403. scope: "businessLevel",
  404. edu: "educationTypeId",
  405. },
  406. {
  407. prop: "sectionType",
  408. placeholder: "节类型",
  409. scope: "select",
  410. options: [
  411. {
  412. label: "录播",
  413. value: 1,
  414. },
  415. {
  416. label: "直播",
  417. value: 2,
  418. },
  419. {
  420. label: "回放",
  421. value: 3,
  422. },
  423. ],
  424. },
  425. {
  426. prop: "key",
  427. placeholder: "请输入节标题/节编码/标题前缀",
  428. },
  429. ],
  430. total: 0, //一共多少条
  431. formData: {
  432. status: 1,
  433. pageSize: 10,
  434. pageNum: 1,
  435. },
  436. disCheckList: [], //已选转禁用复选列表
  437. activeLists: [],
  438. noStudent: true,
  439. };
  440. },
  441. watch: {
  442. sujectApis: {
  443. immediate: true,
  444. handler(newName, oldName) {
  445. this.changeTypes();
  446. },
  447. },
  448. },
  449. async mounted() {
  450. this.$modal.loading("正在导入数据,请稍后...");
  451. this.$api
  452. .gradecheckGoodsChange({ chapterId: this.$route.query.id })
  453. .then((res) => {
  454. console.log(res.data);
  455. if (res.data > 0) {
  456. this.noStudent = false;
  457. }
  458. });
  459. await this.getDict();
  460. this.search();
  461. },
  462. methods: {
  463. getMessage() {
  464. if (!this.courType) {
  465. this.$message.warning("请先选择业务层级");
  466. }
  467. },
  468. openBoxs() {
  469. var self = this;
  470. this.$api.inquireCourseSection(this.formData).then((res) => {
  471. var aList = [];
  472. this.tableData.map((item) => {
  473. aList.push(item.sectionId);
  474. });
  475. this.disCheckList = aList;
  476. this.boxtableData = res.rows;
  477. this.total = res.total;
  478. this.dialogVisible = true;
  479. this.$nextTick(function () {
  480. self.$refs.multipleTable.clearSelection();
  481. });
  482. });
  483. },
  484. getInfosList() {
  485. this.$api
  486. .inquireCoursechaptersectionlist(this.$route.query.id)
  487. .then((result) => {
  488. // this.numberAll = result.total;
  489. // this.minTimeAll = result.timeTotal;
  490. this.tableData = result.data;
  491. });
  492. },
  493. getInfos(int) {
  494. this.loading = true;
  495. if (int === 1) {
  496. this.formData.pageNum = 1;
  497. }
  498. if (int === 2) {
  499. this.formData = {
  500. status: 1,
  501. pageSize: 10,
  502. pageNum: 1,
  503. };
  504. }
  505. this.$api
  506. .inquireCourseSection(this.formData)
  507. .then((res) => {
  508. this.boxtableData = res.rows;
  509. this.total = res.total;
  510. })
  511. .finally(() => {
  512. this.loading = false;
  513. });
  514. },
  515. init() {
  516. this.getInfos(2);
  517. },
  518. search() {
  519. this.$api
  520. .obtainCoursechapter(this.$route.query.id)
  521. .then((res) => {
  522. this.bfImg = res.data.coverUrl;
  523. this.listData = res.data;
  524. this.$api
  525. .obtainCoursechapterbusiness(this.$route.query.id)
  526. .then((result) => {
  527. var arrays = [];
  528. result.data.map((item) => {
  529. arrays.push(item.businessId + "-" + item.subjectId);
  530. });
  531. this.sujectApis = arrays;
  532. this.getInfosList();
  533. });
  534. })
  535. .finally(() => {
  536. this.$modal.closeLoading();
  537. });
  538. },
  539. clearImgs() {
  540. this.listData.coverUrl = "";
  541. },
  542. changeTypes() {
  543. var self = this;
  544. var arrays = [];
  545. this.sujectApis.map((item, index) => {
  546. this.courTypeOptions.map((items) => {
  547. if (items.id === item.split("-").map(Number)[0]) {
  548. var obj = {
  549. educationTypeId: items.educationId,
  550. educationName: items.educationName,
  551. projectId: items.projectId,
  552. projectName: items.projectName,
  553. businessId: items.id,
  554. businessName: items.businessName,
  555. };
  556. self.sujectOption.map((i) => {
  557. if (
  558. i.id === item.split("-").map(Number)[1] &&
  559. i.courseArrays.indexOf(items.projectId) !== -1
  560. ) {
  561. obj.subjectName = i.subjectName;
  562. obj.subjectId = i.id;
  563. }
  564. });
  565. arrays.push(obj);
  566. }
  567. });
  568. });
  569. this.newSujectApis = arrays;
  570. },
  571. changeType() {
  572. this.changeHeight = !this.changeHeight;
  573. },
  574. submitSujectArray() {
  575. var self = this;
  576. this.sujectApis = this.sujectApis.filter((item, index) => {
  577. return item.split("-").map(Number)[0] !== Number(self.courType);
  578. });
  579. for (let i = 0; i < this.sujectArray.length; i++) {
  580. this.sujectApis.push(this.sujectArray[i]);
  581. }
  582. this.$refs.popovers.doClose();
  583. },
  584. showHandle() {
  585. var array = [];
  586. for (let i = 0; i < this.sujectApis.length; i++) {
  587. if (
  588. this.sujectApis[i].split("-").map(Number)[0] === Number(this.courType)
  589. ) {
  590. array.push(this.sujectApis[i]);
  591. }
  592. }
  593. this.sujectArray = array;
  594. this.newSujectOption.map((item) => {
  595. item.newId = this.courType + "-" + item.id;
  596. });
  597. },
  598. hideHandle() {},
  599. getDict() {
  600. return new Promise((resolve, reject) => {
  601. this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
  602. this.eduTypeOptions = res.rows;
  603. });
  604. this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
  605. this.projectTypeOptions = res.rows;
  606. });
  607. this.$api.inquirebusinessList({ status: 1 }).then((res) => {
  608. this.courTypeOptions = res.rows;
  609. this.newCourTypeOptions = res.rows;
  610. });
  611. this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
  612. res.rows.map((item, index) => {
  613. var array = [];
  614. item.courseProjectTypes.map((items, indexs) => {
  615. array.push(items.id);
  616. });
  617. item.courseArrays = array;
  618. });
  619. this.sujectOption = res.rows;
  620. resolve();
  621. });
  622. });
  623. },
  624. changeEduType() {
  625. if (!(this.courType === undefined || this.courType === "")) {
  626. this.courType = "";
  627. }
  628. var arrays = [];
  629. this.courTypeOptions.map((item) => {
  630. if (item.educationId === this.eduType) {
  631. arrays.push(item);
  632. }
  633. });
  634. this.newCourTypeOptions = arrays;
  635. },
  636. changecourseType() {
  637. this.newCourTypeOptions.map((item, index) => {
  638. if (item.id === this.courType) {
  639. this.eduType = item.educationId;
  640. var array = [];
  641. this.sujectOption.map((items, indexs) => {
  642. if (items.courseArrays.indexOf(item.projectId) !== -1) {
  643. array.push(items);
  644. }
  645. });
  646. this.newSujectOption = array;
  647. }
  648. });
  649. var arrays = [];
  650. this.courTypeOptions.map((item) => {
  651. if (item.educationId === this.eduType) {
  652. arrays.push(item);
  653. }
  654. });
  655. this.newCourTypeOptions = arrays;
  656. this.$refs.popovers.doClose();
  657. },
  658. submit(formName) {
  659. this.$refs[formName].validate((valid) => {
  660. if (valid) {
  661. // if (
  662. // this.listData.coverUrl === "" ||
  663. // this.listData.coverUrl === null ||
  664. // this.listData.coverUrl === undefined
  665. // ) {
  666. // this.$message.error("请上传章封面");
  667. // return false;
  668. // }
  669. for (let i = 0; i < this.tableData.length; i++) {
  670. if (!this.tableData[i].sort && this.tableData[i].sort !== 0) {
  671. this.$message.warning(`管理节第${i + 1}条请输入排序`);
  672. return;
  673. }
  674. }
  675. let arr = this.tableData.map((items) => {
  676. return items.sort;
  677. });
  678. if (new Set(arr).size != arr.length) {
  679. this.$message.warning("排序不允许有重复值");
  680. return;
  681. }
  682. this.rulesTableSumbit();
  683. } else {
  684. return false;
  685. }
  686. });
  687. },
  688. async rulesTableSumbit() {
  689. var sectionIdList = [];
  690. this.tableData.map((item) => {
  691. sectionIdList.push({
  692. sectionId: item.sectionId,
  693. sort: Number(item.sort),
  694. });
  695. });
  696. var dataInfos = {
  697. status: 1,
  698. chapterId: this.$route.query.id,
  699. businessList: this.newSujectApis,
  700. sectionIdList: sectionIdList,
  701. coverUrl: this.listData.coverUrl,
  702. name: this.listData.name,
  703. prefixName: this.listData.prefixName,
  704. publishStatus: this.listData.publishStatus,
  705. };
  706. this.$api.editCoursechapter(dataInfos).then((res) => {
  707. this.$message.success("修改成功");
  708. setTimeout(() => {
  709. this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
  710. this.$router.push({
  711. path: "chapter",
  712. });
  713. });
  714. }, 500);
  715. });
  716. },
  717. backPage() {
  718. this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
  719. this.$router.push({
  720. path: "chapter",
  721. });
  722. });
  723. },
  724. closeType(index) {
  725. this.sujectApis.splice(index, 1);
  726. },
  727. getImgFile() {
  728. var self = this;
  729. var file = self.$refs.file.files[0];
  730. if (file === undefined) {
  731. self.$set(self.listData, "coverUrl", "");
  732. return;
  733. }
  734. if (file.size > 0.3 * 1024 * 1024) {
  735. self.$message.error("图片不得大于300kb");
  736. return;
  737. }
  738. var type = self.$refs.file.value.toLowerCase().split(".").splice(-1);
  739. if (
  740. type[0] != "jpg" &&
  741. type[0] != "png" &&
  742. type[0] != "jpeg" &&
  743. type[0] != "gif"
  744. ) {
  745. self.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  746. self.$refs.file.value = "";
  747. return;
  748. }
  749. this.$upload.upload(file, 0).then((res) => {
  750. self.listData.coverUrl = res;
  751. });
  752. },
  753. handleSizeChange(v) {
  754. this.formData.pageSize = v;
  755. this.formData.pageNum = 1;
  756. this.getInfos();
  757. },
  758. handleCurrentChange(v) {
  759. this.formData.pageNum = v;
  760. this.getInfos();
  761. },
  762. selectAll(value) {
  763. this.activeLists = value;
  764. },
  765. select(value) {
  766. this.activeLists = value;
  767. },
  768. checkboxT(row, index) {
  769. if (this.disCheckList.indexOf(row.sectionId) !== -1) {
  770. return false;
  771. } else {
  772. return true;
  773. }
  774. },
  775. getRowKeys(row) {
  776. return row.sectionId;
  777. },
  778. submitForm() {
  779. if (this.activeLists.length === 0) {
  780. this.dialogVisible = false;
  781. return;
  782. }
  783. if (this.tableData.length) {
  784. let maxIndex = 0;
  785. this.tableData.forEach((item) => {
  786. if (item.sort > maxIndex) {
  787. maxIndex = item.sort;
  788. }
  789. });
  790. this.activeLists.forEach((item, index) => {
  791. item.sort = maxIndex + index + 1;
  792. });
  793. } else {
  794. this.activeLists.forEach((item, index) => {
  795. item.sort = index + 1;
  796. });
  797. }
  798. this.tableData = this.tableData.concat(this.activeLists);
  799. this.dialogVisible = false;
  800. this.$message.success("添加成功");
  801. this.activeLists = [];
  802. },
  803. delList(item) {
  804. this.tableData.map((items, indexs) => {
  805. if (items.sectionId === item.sectionId) {
  806. this.tableData.splice(indexs, 1);
  807. this.$message.success("删除成功");
  808. }
  809. });
  810. },
  811. },
  812. };
  813. </script>
  814. <style lang="less" scoped>
  815. .boxWidth {
  816. width: 800px;
  817. }
  818. .numInputs {
  819. width: 150px;
  820. }
  821. .checkboxSty {
  822. max-height: 210px;
  823. overflow: auto;
  824. display: flex;
  825. flex-direction: column;
  826. }
  827. .listBoxStys {
  828. flex-shrink: 0;
  829. padding: 0px 10px;
  830. border-radius: 8px;
  831. border: 1px solid #eee;
  832. margin-right: 10px;
  833. margin-bottom: 6px;
  834. }
  835. .closeIcons {
  836. color: red;
  837. cursor: pointer;
  838. margin-left: 6px;
  839. }
  840. .ach {
  841. display: flex;
  842. align-items: center;
  843. overflow: hidden;
  844. }
  845. .clh {
  846. display: flex;
  847. align-items: center;
  848. flex-wrap: wrap;
  849. }
  850. .imgBoxins {
  851. width: 375px;
  852. height: 220px;
  853. text-align: center;
  854. img {
  855. height: 100%;
  856. }
  857. }
  858. .iconStsz {
  859. font-size: 40px;
  860. color: #67c23a;
  861. cursor: pointer;
  862. }
  863. .dis_plays {
  864. display: flex;
  865. align-items: center;
  866. justify-content: space-between;
  867. margin-bottom: 10px;
  868. }
  869. .comInputsty {
  870. width: 50px;
  871. height: 24px;
  872. text-align: center;
  873. border: none;
  874. }
  875. /deep/.el-button {
  876. border-radius: 8px;
  877. }
  878. /deep/.el-dialog {
  879. border-radius: 8px;
  880. .el-dialog__header {
  881. padding: 0;
  882. .hearders {
  883. height: 40px;
  884. display: flex;
  885. align-items: center;
  886. justify-content: space-between;
  887. padding: 0px 18px 0px 20px;
  888. border-bottom: 1px solid #e2e2e2;
  889. .leftTitle {
  890. font-size: 14px;
  891. font-weight: bold;
  892. color: #2f4378;
  893. }
  894. .rightBoxs {
  895. display: flex;
  896. align-items: center;
  897. img {
  898. width: 14px;
  899. height: 14px;
  900. margin-left: 13px;
  901. cursor: pointer;
  902. }
  903. }
  904. }
  905. }
  906. .el-dialog__footer {
  907. padding: 0;
  908. .dialog-footer {
  909. padding: 0px 40px;
  910. height: 70px;
  911. border-top: 1px solid #e2e2e2;
  912. display: flex;
  913. align-items: center;
  914. justify-content: flex-end;
  915. }
  916. }
  917. }
  918. .imgBox {
  919. width: 100%;
  920. // height: 210px;
  921. border: 1px solid #e2e2e2;
  922. border-radius: 8px;
  923. padding: 8px 8px 3px;
  924. display: flex;
  925. flex-direction: column;
  926. align-items: center;
  927. .imgLabel {
  928. flex: 1;
  929. width: 100%;
  930. border: 1px dotted #e2e2e2;
  931. color: #999;
  932. font-size: 14px;
  933. cursor: pointer;
  934. border-radius: 8px;
  935. .msPhoto {
  936. display: flex;
  937. justify-content: center;
  938. align-items: center;
  939. max-width: 100%;
  940. max-height: 270px;
  941. img {
  942. max-width: 100%;
  943. max-height: 270px;
  944. }
  945. }
  946. .imgbbx {
  947. display: flex;
  948. flex-direction: column;
  949. align-items: center;
  950. justify-content: center;
  951. width: 100%;
  952. height: 100%;
  953. i {
  954. font-weight: bold;
  955. margin: 14px 0;
  956. font-size: 24px;
  957. }
  958. }
  959. }
  960. p {
  961. margin: 5px 0px;
  962. }
  963. }
  964. </style>