Course.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <template>
  2. <section
  3. v-loading.body="fileLoading"
  4. v-loading.fullscreen="loading"
  5. element-loading-text="请稍后..."
  6. class="content"
  7. >
  8. <div class="part-box">
  9. <h2 class="part-box-title">课程列表</h2>
  10. <el-form
  11. ref="primaryForm"
  12. class="part-filter-form"
  13. inline
  14. :model="formSearch"
  15. >
  16. <el-form-item label="课程名称">
  17. <el-input v-model="formSearch.name" placeholder="请输入课程名称" />
  18. </el-form-item>
  19. <el-form-item label="课程代码">
  20. <el-input v-model="formSearch.code" placeholder="请输入课程代码" />
  21. </el-form-item>
  22. <el-form-item label="课程状态">
  23. <el-select v-model="formSearch.enable" placeholder="请选择" clearable>
  24. <el-option
  25. v-for="item in statusList"
  26. :key="item.value"
  27. :label="item.label"
  28. :value="item.value"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="层次">
  33. <el-select v-model="formSearch.level" placeholder="请选择" clearable>
  34. <el-option
  35. v-for="item in levelList"
  36. :key="item.value"
  37. :label="item.label"
  38. :value="item.value"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="danger" @click="handleSearchBtn">查询</el-button>
  44. <el-button type="danger" plain @click="resetPrimaryForm">
  45. 重置
  46. </el-button>
  47. </el-form-item>
  48. </el-form>
  49. <div class="part-box-action">
  50. <div>
  51. <el-button
  52. type="success"
  53. plain
  54. :disabled="noBatchSelected"
  55. icon="icon icon-play"
  56. @click="enableByIds"
  57. >启用
  58. </el-button>
  59. <el-button
  60. type="danger"
  61. plain
  62. :disabled="noBatchSelected"
  63. icon="icon icon-delete"
  64. @click="disableByIds"
  65. >禁用</el-button
  66. >
  67. <el-button
  68. type="primary"
  69. plain
  70. icon="icon icon-import"
  71. @click="impCourse"
  72. >导入</el-button
  73. >
  74. <el-button
  75. type="primary"
  76. plain
  77. icon="icon icon-export"
  78. @click="exportCourse"
  79. >导出</el-button
  80. >
  81. </div>
  82. <el-button
  83. type="primary"
  84. icon="icon icon-plus-white"
  85. @click="insertCourse"
  86. >新增</el-button
  87. >
  88. </div>
  89. </div>
  90. <div class="part-box">
  91. <!-- 页面列表 -->
  92. <!-- FIXME: element-ui style bug https://github.com/ElemeFE/element/issues/16167 -->
  93. <el-table :data="tableData" resizable @selection-change="selectChange">
  94. <el-table-column type="selection" width="50" align="center" />
  95. <el-table-column prop="id" label="课程ID" width="80" />
  96. <el-table-column prop="name" label="课程名称" width="180" />
  97. <el-table-column prop="code" label="课程代码" />
  98. <el-table-column label="层次">
  99. <span slot-scope="scope">{{ getLevel(scope.row.level) }}</span>
  100. </el-table-column>
  101. <el-table-column width="50" label="状态">
  102. <span slot-scope="scope">
  103. <span v-if="scope.row.enable">
  104. <el-tooltip
  105. class="item"
  106. effect="dark"
  107. content="启用"
  108. placement="left"
  109. >
  110. <i class="icon icon-right"></i>
  111. </el-tooltip>
  112. </span>
  113. <span v-else>
  114. <el-tooltip
  115. class="item"
  116. effect="dark"
  117. content="禁用"
  118. placement="left"
  119. >
  120. <i class="icon icon-error"></i>
  121. </el-tooltip>
  122. </span>
  123. </span>
  124. </el-table-column>
  125. <el-table-column
  126. sortable
  127. prop="updateTime"
  128. label="更新时间"
  129. width="170"
  130. />
  131. <el-table-column label="操作" width="160">
  132. <div slot-scope="scope">
  133. <!-- <el-button
  134. size="mini"
  135. type="primary"
  136. plain
  137. icon="el-icon-share"
  138. @click="relation(scope.row)"
  139. >
  140. 关联专业
  141. </el-button> -->
  142. <el-button
  143. size="mini"
  144. type="primary"
  145. plain
  146. @click="editCourse(scope.row)"
  147. >
  148. 编辑
  149. </el-button>
  150. <el-button
  151. v-if="!scope.row.enable"
  152. size="mini"
  153. plain
  154. type="primary"
  155. @click="enableById(scope.row)"
  156. >
  157. 启用
  158. </el-button>
  159. <el-button
  160. v-if="scope.row.enable"
  161. size="mini"
  162. plain
  163. type="danger"
  164. @click="disableById(scope.row)"
  165. >
  166. 禁用
  167. </el-button>
  168. </div>
  169. </el-table-column>
  170. </el-table>
  171. <div class="part-page">
  172. <el-pagination
  173. :current-page="currentPage"
  174. :page-size="10"
  175. :page-sizes="[10, 20, 50, 100, 200, 300]"
  176. layout="total, sizes, prev, pager, next, jumper"
  177. :total="total"
  178. @current-change="handleCurrentChange"
  179. @size-change="handleSizeChange"
  180. >
  181. </el-pagination>
  182. </div>
  183. </div>
  184. <!-- 添加或新增课程弹出框 -->
  185. <el-dialog
  186. title="课程"
  187. width="520px"
  188. :visible.sync="courseDialog"
  189. :modal="false"
  190. append-to-body
  191. custom-class="side-dialog"
  192. @close="dialogBeforeClose"
  193. >
  194. <el-form
  195. ref="courseForm"
  196. :inline="true"
  197. inline-message
  198. class="form-tight"
  199. :model="courseForm"
  200. :rules="rules"
  201. label-width="90px"
  202. >
  203. <el-form-item label="课程代码" prop="code">
  204. <el-input
  205. v-model="courseForm.code"
  206. :disabled="null != courseForm.id"
  207. class="dialog-input-width"
  208. auto-complete="off"
  209. placeholder="请输入课程代码"
  210. />
  211. </el-form-item>
  212. <el-form-item label="课程名称" prop="name">
  213. <el-input
  214. v-model="courseForm.name"
  215. class="dialog-input-width"
  216. auto-complete="off"
  217. placeholder="请输入课程名称"
  218. />
  219. </el-form-item>
  220. <el-form-item label="层次" prop="level">
  221. <el-select
  222. v-model="courseForm.level"
  223. class="dialog-input-width"
  224. placeholder="请选择"
  225. >
  226. <el-option
  227. v-for="item in levelList"
  228. :key="item.value"
  229. :label="item.label"
  230. :value="item.value"
  231. />
  232. </el-select>
  233. </el-form-item>
  234. <el-form-item label="课程状态" prop="enable">
  235. <el-radio-group
  236. v-model="courseForm.enable"
  237. class="dialog-input-width"
  238. >
  239. <el-radio label="true">启用</el-radio>
  240. <el-radio label="false">禁用</el-radio>
  241. </el-radio-group>
  242. </el-form-item>
  243. </el-form>
  244. <div slot="footer">
  245. <el-button type="primary" @click="submitForm">保存</el-button>
  246. <el-button type="danger" plain @click="courseDialog = false"
  247. >取消</el-button
  248. >
  249. </div>
  250. </el-dialog>
  251. <!-- 导入弹窗 -->
  252. <el-dialog
  253. title="导入课程"
  254. width="520px"
  255. :visible.sync="impDialog"
  256. :modal="false"
  257. append-to-body
  258. custom-class="side-dialog"
  259. >
  260. <el-form>
  261. <el-form-item style="margin-left: 20px">
  262. <el-upload
  263. ref="upload"
  264. class="form_left"
  265. accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  266. :action="uploadAction"
  267. :headers="uploadHeaders"
  268. :data="uploadData"
  269. :before-upload="beforeUpload"
  270. :on-progress="uploadProgress"
  271. :on-success="uploadSuccess"
  272. :on-error="uploadError"
  273. :file-list="fileList"
  274. :auto-upload="false"
  275. :multiple="false"
  276. >
  277. <el-button
  278. slot="trigger"
  279. size="small"
  280. type="primary"
  281. icon="icon icon-search-white"
  282. >
  283. 选择文件
  284. </el-button>
  285. <el-button
  286. size="small"
  287. type="primary"
  288. icon="icon icon-save-white"
  289. @click="submitUpload"
  290. >
  291. 确认上传
  292. </el-button>
  293. <el-button
  294. size="small"
  295. type="primary"
  296. icon="icon icon-delete-white"
  297. @click="removeFile"
  298. >
  299. 清空文件
  300. </el-button>
  301. <el-button
  302. size="small"
  303. type="primary"
  304. icon="icon icon-export-white"
  305. @click="exportFile"
  306. >
  307. 下载模板
  308. </el-button>
  309. <div slot="tip" class="el-upload__tip">只能上传xlsx文件</div>
  310. </el-upload>
  311. </el-form-item>
  312. </el-form>
  313. </el-dialog>
  314. <!-- 导入错误信息列表 -->
  315. <el-dialog title="错误提示" :visible.sync="errDialog" append-to-body>
  316. <div
  317. v-for="errMessage in errMessages"
  318. :key="errMessage.lineNum"
  319. class="text-danger"
  320. >
  321. 第{{ errMessage.lineNum }}行:{{ errMessage.msg }}
  322. </div>
  323. <span slot="footer" class="dialog-footer">
  324. <el-button @click="errDialog = false">确定</el-button>
  325. </span>
  326. </el-dialog>
  327. </section>
  328. </template>
  329. <script>
  330. import { QUESTION_API } from "@/constants/constants.js";
  331. import { ENABLE_TYPE, LEVEL_TYPE } from "../constants/constants.js";
  332. import { mapState } from "vuex";
  333. export default {
  334. name: "Course",
  335. data() {
  336. return {
  337. formSearch: {
  338. name: "",
  339. code: "",
  340. enable: "",
  341. level: "",
  342. },
  343. courseForm: {
  344. id: null,
  345. name: "",
  346. code: "",
  347. level: "ALL",
  348. enable: "true",
  349. },
  350. statusList: ENABLE_TYPE,
  351. levelList: LEVEL_TYPE,
  352. selectedCourseIds: [],
  353. tableData: [],
  354. currentPage: 1,
  355. pageSize: 10,
  356. total: 10,
  357. impDialog: false,
  358. uploadAction: QUESTION_API + "/course/import",
  359. uploadHeaders: {},
  360. uploadData: {},
  361. errMessages: [],
  362. errDialog: false,
  363. fileLoading: false,
  364. loading: false,
  365. fileList: [],
  366. courseDialog: false,
  367. relationDialog: false,
  368. rules: {
  369. name: [
  370. {
  371. required: true,
  372. message: "请输入课程名称",
  373. trigger: "blur",
  374. },
  375. {
  376. max: 30,
  377. message: "课程名称最多30个字符",
  378. trigger: "blur",
  379. },
  380. ],
  381. code: [
  382. {
  383. required: true,
  384. message: "请输入课程代码",
  385. trigger: "blur",
  386. },
  387. {
  388. max: 30,
  389. message: "课程代码最多30个字符",
  390. trigger: "blur",
  391. },
  392. ],
  393. level: [
  394. {
  395. required: true,
  396. message: "请选择层次",
  397. trigger: "change",
  398. },
  399. ],
  400. status: [
  401. {
  402. required: true,
  403. message: "请选择状态",
  404. trigger: "change",
  405. },
  406. ],
  407. },
  408. };
  409. },
  410. computed: {
  411. ...mapState({
  412. user: (state) => state.user,
  413. }),
  414. noBatchSelected() {
  415. return this.selectedCourseIds.length === 0;
  416. },
  417. courseIds() {
  418. var courseIds = "";
  419. for (let courseId of this.selectedCourseIds) {
  420. if (!courseIds) {
  421. courseIds += courseId;
  422. } else {
  423. courseIds += "," + courseId;
  424. }
  425. }
  426. return courseIds;
  427. },
  428. },
  429. //初始化查询
  430. created() {
  431. this.searchForm();
  432. this.uploadHeaders = {
  433. key: this.user.key,
  434. token: this.user.token,
  435. };
  436. },
  437. methods: {
  438. handleSizeChange(val) {
  439. this.pageSize = val;
  440. this.currentPage = 1;
  441. this.searchForm();
  442. },
  443. dialogBeforeClose() {
  444. this.$refs.courseForm.clearValidate();
  445. },
  446. submitAddRelationForm() {
  447. this.$refs.addRelationForm.validate((valid) => {
  448. if (valid) {
  449. var param = new URLSearchParams(this.addRelationForm);
  450. var url = QUESTION_API + "/courseSpeciatlyRelation/add?" + param;
  451. this.$httpWithMsg.post(url, this.speciallyForm).then(() => {
  452. this.$notify({
  453. type: "success",
  454. message: "添加成功!",
  455. });
  456. this.addRelationDialog = false;
  457. });
  458. } else {
  459. console.log("error submit!");
  460. return false;
  461. }
  462. });
  463. },
  464. getTag(status) {
  465. if (status == true) {
  466. return "success";
  467. } else if (status == false) {
  468. return "danger";
  469. }
  470. return status;
  471. },
  472. getLevel(level) {
  473. if (level == "ZSB") {
  474. return "专升本";
  475. } else if (level == "GQZ") {
  476. return "高起专";
  477. } else if (level == "GQB") {
  478. return "高起本";
  479. } else {
  480. return "不限";
  481. }
  482. },
  483. handleSearchBtn() {
  484. this.currentPage = 1;
  485. this.searchForm();
  486. },
  487. searchForm() {
  488. let searchLock = true;
  489. setTimeout(() => {
  490. if (searchLock) {
  491. this.loading = true;
  492. }
  493. }, 500);
  494. var param = new URLSearchParams(this.formSearch);
  495. var url =
  496. QUESTION_API +
  497. "/course/coursePage/" +
  498. this.currentPage +
  499. "/" +
  500. this.pageSize +
  501. "?" +
  502. param;
  503. this.$httpWithMsg
  504. .get(url)
  505. .then((response) => {
  506. this.tableData = response.data.content;
  507. this.total = response.data.totalElements;
  508. })
  509. .finally(() => {
  510. searchLock = false;
  511. this.loading = false;
  512. });
  513. },
  514. handleCurrentChange(val) {
  515. this.currentPage = val;
  516. this.searchForm();
  517. },
  518. selectChange(row) {
  519. this.selectedCourseIds = [];
  520. row.forEach((element) => {
  521. this.selectedCourseIds.push(element.id);
  522. });
  523. console.log(this.selectedCourseIds);
  524. },
  525. //新增
  526. insertCourse() {
  527. this.courseForm.id = null;
  528. this.courseForm.name = null;
  529. this.courseForm.code = null;
  530. this.courseForm.level = "ALL";
  531. this.courseForm.enable = "true";
  532. this.courseDialog = true;
  533. },
  534. //修改
  535. editCourse(row) {
  536. this.courseForm = Object.assign({}, row);
  537. this.courseForm.enable = row.enable ? "true" : "false";
  538. this.courseId = row.id;
  539. this.courseDialog = true;
  540. },
  541. exportCourse() {
  542. var param = new URLSearchParams(this.formSearch);
  543. window.open(
  544. QUESTION_API +
  545. "/course/export?$key=" +
  546. this.user.key +
  547. "&$token=" +
  548. this.user.token +
  549. "&" +
  550. param
  551. );
  552. },
  553. closeCourse() {
  554. this.courseDialog = false;
  555. },
  556. saveRelation() {},
  557. //保存(新增/修改)
  558. submitForm() {
  559. var url = QUESTION_API + "/course";
  560. if (null != this.courseForm.id) {
  561. //修改
  562. this.$refs.courseForm.validate((valid) => {
  563. if (valid) {
  564. this.$httpWithMsg.put(url, this.courseForm).then(() => {
  565. this.$notify({
  566. type: "success",
  567. message: "修改成功!",
  568. });
  569. this.searchForm();
  570. this.resetForm();
  571. this.courseDialog = false;
  572. });
  573. } else {
  574. console.log("error submit!");
  575. return false;
  576. }
  577. });
  578. } else {
  579. this.$refs.courseForm.validate((valid) => {
  580. if (valid) {
  581. this.$httpWithMsg.post(url, this.courseForm).then(() => {
  582. this.$notify({
  583. type: "success",
  584. message: "添加成功",
  585. });
  586. this.searchForm();
  587. this.resetForm();
  588. this.courseDialog = false;
  589. });
  590. } else {
  591. console.log("error submit!");
  592. return false;
  593. }
  594. });
  595. }
  596. },
  597. //重置
  598. resetForm() {
  599. this.$refs.courseForm.resetFields();
  600. },
  601. resetPrimaryForm() {
  602. this.formSearch = {
  603. name: "",
  604. code: "",
  605. enable: "",
  606. level: "",
  607. };
  608. this.$refs.primaryForm.resetFields();
  609. },
  610. //删除单个数据
  611. deleteById(row) {
  612. this.$confirm("是否删除该课程?", "提示", {
  613. confirmButtonText: "确定",
  614. cancelButtonText: "取消",
  615. type: "warning",
  616. }).then(() => {
  617. var url = QUESTION_API + "/course/" + row.id;
  618. this.$httpWithMsg.delete(url).then(() => {
  619. this.$notify({
  620. type: "success",
  621. message: "删除成功!",
  622. });
  623. this.searchForm();
  624. });
  625. });
  626. },
  627. //删除多条数据
  628. deleteByIds() {
  629. if (this.selectedCourseIds.length === 0) {
  630. this.$notify({
  631. type: "warning",
  632. message: "请选择要删除的课程",
  633. });
  634. } else {
  635. this.$confirm("是否删除这些课程?", "提示", {
  636. confirmButtonText: "确定",
  637. cancelButtonText: "取消",
  638. type: "error",
  639. }).then(() => {
  640. var url = QUESTION_API + "/course/" + this.courseIds;
  641. this.$httpWithMsg.delete(url).then(() => {
  642. this.$notify({
  643. type: "success",
  644. message: "删除成功!",
  645. });
  646. this.searchForm();
  647. });
  648. });
  649. }
  650. },
  651. //启用
  652. enableByIds() {
  653. if (this.selectedCourseIds.length === 0) {
  654. this.$notify({
  655. type: "warning",
  656. message: "请选择要启用的课程",
  657. });
  658. } else {
  659. this.$confirm("是否启用这些课程?", "提示", {
  660. confirmButtonText: "确定",
  661. cancelButtonText: "取消",
  662. type: "warning",
  663. }).then(() => {
  664. var url = QUESTION_API + "/course/enable/" + this.courseIds;
  665. this.$httpWithMsg.put(url, {}).then(() => {
  666. this.$notify({
  667. type: "success",
  668. message: "启用成功!",
  669. });
  670. this.searchForm();
  671. });
  672. });
  673. }
  674. },
  675. enableById(row) {
  676. this.$confirm("是否启用该课程?", "提示", {
  677. confirmButtonText: "确定",
  678. cancelButtonText: "取消",
  679. type: "warning",
  680. }).then(() => {
  681. var url = QUESTION_API + "/course/enable/" + row.id;
  682. this.$httpWithMsg.put(url, {}).then(() => {
  683. this.$notify({
  684. type: "success",
  685. message: "启用成功!",
  686. });
  687. this.searchForm();
  688. });
  689. });
  690. },
  691. //禁用
  692. disableByIds() {
  693. if (this.selectedCourseIds.length === 0) {
  694. this.$notify({
  695. type: "warning",
  696. message: "请选择要禁用的课程",
  697. });
  698. } else {
  699. this.$confirm("是否禁用这些课程?", "提示", {
  700. confirmButtonText: "确定",
  701. cancelButtonText: "取消",
  702. type: "error",
  703. }).then(() => {
  704. var url = QUESTION_API + "/course/disable/" + this.courseIds;
  705. this.$httpWithMsg.put(url, {}).then(() => {
  706. this.$notify({
  707. type: "success",
  708. message: "禁用成功!",
  709. });
  710. this.searchForm();
  711. });
  712. });
  713. }
  714. },
  715. //禁用
  716. disableById(row) {
  717. this.$confirm("是否禁用该课程?", "提示", {
  718. confirmButtonText: "确定",
  719. cancelButtonText: "取消",
  720. type: "error",
  721. }).then(() => {
  722. var url = QUESTION_API + "/course/disable/" + row.id;
  723. return this.$httpWithMsg.put(url, {}).then(() => {
  724. this.$notify({
  725. type: "success",
  726. message: "禁用成功!",
  727. });
  728. return this.searchForm();
  729. });
  730. });
  731. },
  732. //导入
  733. impCourse() {
  734. this.impDialog = true;
  735. this.initUpload();
  736. },
  737. initUpload() {
  738. this.fileList = [];
  739. },
  740. beforeUpload(file) {
  741. console.log(file);
  742. },
  743. uploadProgress() {
  744. console.log("uploadProgress");
  745. },
  746. uploadSuccess(response) {
  747. if (!response.hasError) {
  748. this.$notify({
  749. message: "上传成功",
  750. type: "success",
  751. });
  752. this.fileLoading = false;
  753. this.impDialog = false;
  754. this.searchForm();
  755. } else {
  756. this.fileLoading = false;
  757. this.impDialog = false;
  758. this.errMessages = response.failRecords;
  759. this.errDialog = true;
  760. }
  761. },
  762. uploadError(response) {
  763. var json = JSON.parse(response.message);
  764. if (response.status == 500) {
  765. this.$notify({
  766. message: json.desc,
  767. type: "error",
  768. });
  769. }
  770. this.fileLoading = false;
  771. },
  772. //确定上传
  773. submitUpload() {
  774. if (!this.checkUpload()) {
  775. return false;
  776. }
  777. this.$refs.upload.submit();
  778. this.fileLoading = true;
  779. },
  780. checkUpload() {
  781. var fileList = this.$refs.upload.uploadFiles;
  782. if (fileList.length == 0) {
  783. this.$notify({
  784. message: "上传文件不能为空",
  785. type: "error",
  786. });
  787. return false;
  788. }
  789. if (fileList.length > 1) {
  790. this.$notify({
  791. message: "每次只能上传一个文件",
  792. type: "error",
  793. });
  794. return false;
  795. }
  796. for (let file of fileList) {
  797. if (!file.name.endsWith(".xlsx")) {
  798. this.$notify({
  799. message: "上传文件必须为xlsx格式",
  800. type: "error",
  801. });
  802. this.initUpload();
  803. return false;
  804. }
  805. }
  806. return true;
  807. },
  808. //清空文件
  809. removeFile() {
  810. // this.fileList = [];
  811. this.$refs.upload.clearFiles();
  812. },
  813. //下载模板
  814. exportFile() {
  815. window.location.href =
  816. QUESTION_API +
  817. "/course/importTemplate?$key=" +
  818. this.user.key +
  819. "&$token=" +
  820. this.user.token;
  821. },
  822. },
  823. };
  824. </script>