videoCreate.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. <template>
  2. <div class="app-container">
  3. <div class="common-card basic-information-box">
  4. <div class="basic-information-title">基本信息</div>
  5. <div class="basic-information-form">
  6. <a-form
  7. :form="form"
  8. :label-col="{ span: 6 }"
  9. :wrapper-col="{ span: 18 }"
  10. style="width: 515px"
  11. @submit="handleSubmit"
  12. >
  13. <a-form-item label="文章标题">
  14. <a-input
  15. placeholder="请输入文章标题"
  16. :maxLength="100"
  17. v-decorator="[
  18. 'name',
  19. {
  20. rules: [{ required: true, message: '请输入文章标题' }],
  21. },
  22. ]"
  23. />
  24. </a-form-item>
  25. <a-form-item label="文章描述">
  26. <a-textarea
  27. placeholder="请输入文章描述"
  28. :auto-size="{ minRows: 3, maxRows: 5 }"
  29. :maxLength="100"
  30. v-decorator="[
  31. 'description',
  32. {
  33. rules: [{ message: '请输入文章描述' }],
  34. initialValue: description,
  35. },
  36. ]"
  37. />
  38. </a-form-item>
  39. <a-form-item label="文章分类">
  40. <!-- 文章分类父类 -->
  41. <a-select
  42. v-decorator="[
  43. 'articleParentClass',
  44. {
  45. rules: [
  46. {
  47. required: optionType == 'create',
  48. message: '请选择文章分类父类',
  49. },
  50. ],
  51. initialValue: articleParentClass.name,
  52. },
  53. ]"
  54. @change="articleClassParentChange"
  55. >
  56. <a-select-option
  57. v-for="(item, index) in articleParentClassArr"
  58. :key="index"
  59. >{{ articleParentClassArr[index].name }}</a-select-option
  60. >
  61. </a-select>
  62. </a-form-item>
  63. <a-form-item label="文章子类">
  64. <!-- 文章分类子类 -->
  65. <a-select
  66. v-decorator="[
  67. 'articleChildClass',
  68. {
  69. rules: [
  70. {
  71. required: optionType == 'create',
  72. message: '请选择文章分类子类',
  73. },
  74. ],
  75. initialValue: articleChildClass.name,
  76. },
  77. ]"
  78. :disabled="!articleChildClass || !articleChildClass.id"
  79. @change="articleClassChildChange"
  80. >
  81. <a-select-option
  82. v-for="(item, index) in articleChildClassArr"
  83. :key="index"
  84. >{{ articleChildClassArr[index].name }}</a-select-option
  85. >
  86. </a-select>
  87. </a-form-item>
  88. <a-form-item label="工种类别">
  89. <a-select
  90. v-decorator="[
  91. 'engineerType',
  92. {
  93. rules: [{ required: true, message: '请选择工种' }],
  94. initialValue: engineerType.name,
  95. },
  96. ]"
  97. @change="engineerTypeChange"
  98. >
  99. <a-select-option
  100. v-for="(item, index) in engineerTypeArray"
  101. :key="index"
  102. >{{ engineerTypeArray[index].name }}</a-select-option
  103. >
  104. </a-select>
  105. </a-form-item>
  106. <a-form-item label="必学日期:">
  107. <!-- <a-date-picker
  108. :defaultValue="learnDate"
  109. @change="learnDateChoose"
  110. style="width:100%;"
  111. />-->
  112. <a-date-picker
  113. placeholder="请选择日期"
  114. @change="learnDateChoose"
  115. v-decorator="[
  116. 'learnDate',
  117. {
  118. initialValue: learnDate,
  119. },
  120. ]"
  121. style="width: 100%"
  122. />
  123. </a-form-item>
  124. <a-form-item v-show="false" :wrapper-col="{ span: 20, offset: 10 }">
  125. <a-button id="articleCreateSubmit" type="primary" html-type="submit"
  126. >提交</a-button
  127. >
  128. </a-form-item>
  129. </a-form>
  130. </div>
  131. </div>
  132. <div class="common-card a-card-margin-top">
  133. <div class="information-title">视频内容</div>
  134. <div style="margin-bottom: 10px">上传视频</div>
  135. <!-- 截取视频第一帧用(太模糊了) -->
  136. <!-- <video
  137. v-if="defaultVideoFileList[0]"
  138. :src="defaultVideoFileList[0].url"
  139. width="400"
  140. height="300"
  141. crossOrigin="anonymous"
  142. controls="controls"
  143. id="videofile"
  144. ></video>
  145. <div id="output"></div>-->
  146. <div style="margin-bottom: 10px">
  147. <a-upload
  148. :customRequest="uploadOssVideoFile"
  149. list-type="picture"
  150. :default-file-list="defaultVideoFileList"
  151. :remove="removeOssVideoFile"
  152. class="upload-list-inline"
  153. >
  154. <a-button> <a-icon type="upload" />点击上传 </a-button>
  155. </a-upload>
  156. </div>
  157. <div style="margin-bottom: 10px">上传封面</div>
  158. <div>
  159. <a-upload
  160. :customRequest="uploadOssImageFile"
  161. list-type="picture"
  162. :default-file-list="defaultImageFileList"
  163. :remove="removeOssImageFile"
  164. class="upload-list-inline"
  165. >
  166. <a-button> <a-icon type="upload" />点击上传 </a-button>
  167. </a-upload>
  168. </div>
  169. <div class="submit-row">
  170. <a-button type="primary" @click="handleSubmitBtnFun">提交</a-button>
  171. <a-button :style="{ marginLeft: '160px' }" @click="preview"
  172. >预览</a-button
  173. >
  174. </div>
  175. </div>
  176. <!-- 预览弹出框 -->
  177. <a-drawer
  178. title
  179. placement="left"
  180. :closable="true"
  181. :visible="previewVisible"
  182. :bodyStyle="bodyStyle"
  183. @close="closepreview"
  184. width="30%"
  185. >
  186. <video
  187. v-if="videoUrl"
  188. :poster="faceUrl"
  189. :src="videoUrl"
  190. controls="controls"
  191. >
  192. 您的浏览器不支持 video 标签。
  193. </video>
  194. <div v-else>暂未上传视频</div>
  195. </a-drawer>
  196. </div>
  197. </template>
  198. <script>
  199. const OSS = require("ali-oss");
  200. import {
  201. formatePathParams,
  202. formateStringDate,
  203. formateDateToString
  204. } from "@/filters";
  205. export default {
  206. name: "videoCreate",
  207. props: {},
  208. components: {},
  209. data() {
  210. return {
  211. previewVisible: false,
  212. videoUrl: "",
  213. faceUrl: "",
  214. content: "",
  215. form: this.$form.createForm(this, { name: "articleCreate" }),
  216. articleParentClassArr: [],
  217. articleChildClassArr: [],
  218. engineerTypeArray: [],
  219. articleParentClass: {},
  220. articleChildClass: {},
  221. engineerType: "",
  222. learnDate: "",
  223. optionType: "",
  224. description: "",
  225. bodyStyle: {
  226. img: "{max-width:100%;width: auto;height: auto;}",
  227. video: "{max-width:100%;width: auto;height: auto;}",
  228. color: "red"
  229. },
  230. defaultVideoFileList: [],
  231. defaultImageFileList: []
  232. };
  233. },
  234. created() {
  235. this.initDataFun(); //初始化数据
  236. },
  237. mounted() {},
  238. beforeDestroy() {},
  239. watch: {},
  240. computed: {},
  241. methods: {
  242. //初始化数据
  243. async initDataFun() {
  244. await this.getArticleParentClass();
  245. await this.getEngineersWork();
  246. let type = this.$route.query.type;
  247. this.optionType = type ? type : "create";
  248. // 判断是新增文章还是编辑文章
  249. if ("edit" === type) {
  250. await this.getArticleContent();
  251. } else if ("create" === type) {
  252. console.log("---create---");
  253. }
  254. },
  255. // 查询文章分类父级
  256. getArticleParentClass() {
  257. this.$_http
  258. .get(this.$_API.INTERFACE_GET_CATEGORIES)
  259. .then(res => {
  260. this.articleParentClassArr = res.data;
  261. this.loading = false;
  262. })
  263. .catch(() => {
  264. this.loading = false;
  265. });
  266. },
  267. // 查询文章分类子集
  268. getArticleChildClass() {
  269. if (!this.articleParentClass.id) {
  270. return;
  271. }
  272. let pathParamsData = { categoryId: this.articleParentClass.id };
  273. this.$_http
  274. .get(
  275. formatePathParams(
  276. this.$_API.INTERFACE_GET_CATEGORIES_CATEGROYID,
  277. pathParamsData
  278. )
  279. )
  280. .then(res => {
  281. if (res && res.data.length !== 0) {
  282. this.articleChildClassArr = res.data;
  283. this.articleChildClass = this.articleChildClassArr[0];
  284. this.form.setFieldsValue({
  285. articleChildClass: this.articleChildClass.name
  286. });
  287. }
  288. this.loading = false;
  289. })
  290. .catch(() => {
  291. this.loading = false;
  292. });
  293. },
  294. // 查询工作类别
  295. async getEngineersWork() {
  296. await this.$_http
  297. .get(this.$_API.INTERFACE_GET_ENGINEERINGWORK_LIST)
  298. .then(res => {
  299. this.engineerTypeArray = [...res.data];
  300. this.engineerType = this.engineerTypeArray[0];
  301. });
  302. },
  303. // 文章分类父类变化
  304. articleClassParentChange(value) {
  305. this.articleParentClass = this.articleParentClassArr[value];
  306. // 子类选项清空
  307. this.articleChildClassArr = [];
  308. this.form.setFieldsValue({
  309. articleChildClass: ""
  310. });
  311. // 获取子类的值
  312. this.getArticleChildClass();
  313. },
  314. // 文章分类子类变化
  315. articleClassChildChange(value) {
  316. this.articleChildClass = this.articleChildClassArr[value];
  317. },
  318. // 工种变化
  319. engineerTypeChange(index) {
  320. this.engineerType = this.engineerTypeArray[index];
  321. },
  322. // 必学日期选择
  323. learnDateChoose(date, dateString) {
  324. this.learnDate = dateString;
  325. },
  326. handleSubmitBtnFun() {
  327. document.getElementById("articleCreateSubmit").click();
  328. },
  329. // 查询文章内容
  330. getArticleContent() {
  331. let pathParamsData = { materialId: this.$route.query.id };
  332. this.$_http
  333. .get(
  334. formatePathParams(this.$_API.INTERFACE_GET_MATERIALS, pathParamsData)
  335. )
  336. .then(res => {
  337. this.initEditArticleForm(res.data);
  338. this.loading = false;
  339. })
  340. .catch(() => {
  341. this.loading = false;
  342. });
  343. },
  344. initEditArticleForm(item) {
  345. // 文章标题
  346. this.form.setFieldsValue({
  347. name: item.name
  348. });
  349. // 文章描述
  350. this.description = item.description ? item.description : "";
  351. // 文章分类-父类:
  352. this.articleParentClass = item.rootMaterialCategory;
  353. this.getArticleChildClass(); // 获取子类列表的值
  354. // 文章分类-子类
  355. this.articleChildClass = item.materialCategory;
  356. // 选中工种
  357. if (item.engineerTypes.length !== 0) {
  358. let engineerId = item.engineerTypes[0];
  359. for (let i = 0; i < this.engineerTypeArray.length; i++) {
  360. let element = this.engineerTypeArray[i];
  361. if (element.id === engineerId) {
  362. this.engineerTypeChange(i);
  363. }
  364. }
  365. }
  366. let learnDate = item.tags.length > 0 ? item.tags[0] : null;
  367. // 必学日期
  368. this.learnDate = learnDate ? formateStringDate(learnDate) : null;
  369. console.log("编辑初始化时间为YYYY-MM-DD", this.learnDate, learnDate);
  370. // 文章内容
  371. this.content = item.contents;
  372. // 附件内容
  373. let contentObj = JSON.parse(this.content);
  374. console.log(contentObj);
  375. if (contentObj.videoUrl) {
  376. let videoFile = {
  377. uid: this.getUid(),
  378. name: this.getUrlName(contentObj.videoUrl),
  379. status: "done",
  380. url: contentObj.videoUrl
  381. };
  382. this.videoUrl = contentObj.videoUrl;
  383. this.defaultVideoFileList.push(videoFile);
  384. }
  385. if (contentObj.faceUrl) {
  386. let faceFile = {
  387. uid: this.getUid(),
  388. name: this.getUrlName(contentObj.faceUrl),
  389. status: "done",
  390. url: contentObj.faceUrl
  391. };
  392. this.faceUrl = contentObj.faceUrl;
  393. this.defaultImageFileList.push(faceFile);
  394. }
  395. },
  396. // 提交表单
  397. handleSubmit(e) {
  398. e.preventDefault();
  399. if ("create" === this.optionType) {
  400. console.log("创建文章");
  401. this.createArtical();
  402. } else if ("edit" === this.optionType) {
  403. console.log("更新文章");
  404. this.updateArtical();
  405. }
  406. },
  407. createArtical() {
  408. this.form.setFieldsValue({
  409. articleParentClass: this.articleParentClass.name
  410. });
  411. this.form.setFieldsValue({
  412. articleChildClass: this.articleChildClass.name
  413. });
  414. this.form.setFieldsValue({
  415. engineerType: this.engineerType.name
  416. });
  417. this.form.validateFields((err, values) => {
  418. if (!err) {
  419. // 新建文章
  420. let that = this;
  421. that.$confirm({
  422. title: "新建文章",
  423. content: `确认新建文章吗?`,
  424. okText: "确认",
  425. cancelText: "取消",
  426. onOk() {
  427. that.loading = true;
  428. let params = {
  429. categoryid: that.articleChildClass.id,
  430. engineertypeid: that.engineerType.id
  431. };
  432. let tag = formateDateToString(that.learnDate);
  433. let links = [];
  434. let contentObj = {
  435. faceUrl: that.faceUrl,
  436. videoUrl: that.videoUrl
  437. };
  438. let bodyParams = {
  439. name: values.name,
  440. description: values.description,
  441. type: "VIDEO",
  442. contents: JSON.stringify(contentObj),
  443. tags: tag ? [tag] : [],
  444. engineerTypes: [that.engineerType.id],
  445. links: links
  446. };
  447. that.$_http
  448. .post(that.$_API.INTERFACE_POST_ADMIN_MATERIALS, bodyParams, {
  449. params
  450. })
  451. .then(() => {
  452. that.$message.success("新建文章成功");
  453. });
  454. },
  455. onCancel() {}
  456. });
  457. }
  458. });
  459. },
  460. updateArtical() {
  461. let pathParamsData = { materialId: this.$route.query.id };
  462. this.form.validateFields((err, values) => {
  463. if (!err) {
  464. // 更新文章
  465. let that = this;
  466. that.$confirm({
  467. title: "更新文章",
  468. content: `确认更新文章吗?`,
  469. okText: "确认",
  470. cancelText: "取消",
  471. onOk() {
  472. that.loading = true;
  473. let params = {
  474. categoryid: that.articleChildClass.id,
  475. engineertypeid: that.engineerType.id
  476. };
  477. let tag = formateDateToString(that.learnDate);
  478. let links = [];
  479. let contentObj = {
  480. faceUrl: that.faceUrl,
  481. videoUrl: that.videoUrl
  482. };
  483. let bodyParams = {
  484. id: that.$route.query.id,
  485. name: values.name,
  486. description: values.description,
  487. type: "VIDEO",
  488. contents: JSON.stringify(contentObj),
  489. tags: tag ? [tag] : [],
  490. engineerTypes: [that.engineerType.id],
  491. links: links
  492. };
  493. console.log(
  494. "保存修改日期格式为YYYYMMDD",
  495. bodyParams.tags,
  496. that.learnDate
  497. );
  498. that.$_http
  499. .put(
  500. formatePathParams(
  501. that.$_API.INTERFACE_PUT_ADMIN_MATERIALS,
  502. pathParamsData
  503. ),
  504. bodyParams,
  505. {
  506. params
  507. }
  508. )
  509. .then(() => {
  510. that.$message.success("更新文章成功");
  511. });
  512. },
  513. onCancel() {}
  514. });
  515. }
  516. });
  517. },
  518. async uploadOssVideoFile(fileData) {
  519. console.log("-------fileData--------");
  520. console.log(fileData);
  521. let that = this;
  522. let file = fileData.file;
  523. // var index = file.name.indexOf("."); //(考虑严谨用lastIndexOf(".")得到)得到"."在第几位
  524. // var subfix = file.name.substring(index); //截断"."之前的,得到后缀
  525. // if (subfix != ".mp4") {
  526. // fileData.onError();
  527. // this.$message.error("只能上传mp4格式的文件");
  528. // return;
  529. // }
  530. let bucket = "jtxt-file-public";
  531. let ossPath = "file/";
  532. let res = await that.$_http.get(
  533. that.$_API.INTERFACE_GET_ASSUME_OSS_WRITER
  534. );
  535. console.log("--oss-writer--" + JSON.stringify(res));
  536. const client = new OSS({
  537. // yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
  538. region: "oss-cn-beijing",
  539. // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
  540. accessKeyId: res.data.accessKeyId,
  541. accessKeySecret: res.data.accessKeySecret,
  542. // 从STS服务获取的安全令牌(SecurityToken)。
  543. stsToken: res.data.securityToken,
  544. // 填写Bucket名称。
  545. bucket: bucket
  546. });
  547. let fileName = new Date().getTime() + "_" + file.name;
  548. // 普通上传
  549. // try {
  550. // client.put(ossPath + fileName, file).then(res => {
  551. // console.log(res);
  552. // let upFile = {
  553. // uid: this.getUid(),
  554. // name: fileName,
  555. // status: "done",
  556. // url: res.url
  557. // };
  558. // that.videoUrl = res.url;
  559. // that.defaultVideoFileList.push(upFile);
  560. // // this.findvideocover(file);
  561. // fileData.onSuccess();
  562. // });
  563. // } catch (e) {
  564. // fileData.onError();
  565. // console.error(e);
  566. // }
  567. // 分片上传
  568. console.log("---upload-start--" + new Date().getTime());
  569. let options = {
  570. progress: function(p) {
  571. // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
  572. console.log("-----" + JSON.stringify(p));
  573. // console.log("-----" + JSON.stringify(checkpoint));
  574. },
  575. patrtSize: 1000 * 1024, // 设置分片大小
  576. timeout: 1000 * 60 * 10 // 超时时间
  577. };
  578. try {
  579. client.multipartUpload(ossPath + fileName, file, options).then(res => {
  580. console.log("---upload-end--" + new Date().getTime());
  581. console.log(res);
  582. let upFile = {
  583. uid: this.getUid(),
  584. name: fileName,
  585. status: "done",
  586. url: res.url
  587. };
  588. that.videoUrl = res.url;
  589. that.defaultVideoFileList.push(upFile);
  590. // this.findvideocover(file);
  591. fileData.onSuccess();
  592. });
  593. } catch (e) {
  594. fileData.onError();
  595. console.error("-aaaaaaaaaa---");
  596. console.error(e);
  597. }
  598. },
  599. async uploadOssImageFile(fileData) {
  600. let that = this;
  601. let file = fileData.file;
  602. let bucket = "jtxt-file-public";
  603. let ossPath = "file/";
  604. let res = await that.$_http.get(
  605. that.$_API.INTERFACE_GET_ASSUME_OSS_WRITER
  606. );
  607. console.log("--oss-writer--" + JSON.stringify(res));
  608. const client = new OSS({
  609. // yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
  610. region: "oss-cn-beijing",
  611. // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
  612. accessKeyId: res.data.accessKeyId,
  613. accessKeySecret: res.data.accessKeySecret,
  614. // 从STS服务获取的安全令牌(SecurityToken)。
  615. stsToken: res.data.securityToken,
  616. // 填写Bucket名称。
  617. bucket: bucket
  618. });
  619. let fileName = new Date().getTime() + "_" + file.name;
  620. console.log("---upload-start--" + new Date().getTime());
  621. let options = {
  622. progress: function(p) {
  623. // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
  624. console.log("-----" + JSON.stringify(p));
  625. // console.log("-----" + JSON.stringify(checkpoint));
  626. },
  627. patrtSize: 1000 * 1024, // 设置分片大小
  628. timeout: 1000 * 60 * 10 // 超时时间
  629. };
  630. try {
  631. client.multipartUpload(ossPath + fileName, file, options).then(res => {
  632. console.log(res);
  633. let upFile = {
  634. uid: this.getUid(),
  635. name: fileName,
  636. status: "done",
  637. url: res.url
  638. };
  639. that.faceUrl = res.url;
  640. that.defaultImageFileList.push(upFile);
  641. fileData.onSuccess();
  642. });
  643. } catch (e) {
  644. fileData.onError();
  645. console.error(e);
  646. }
  647. },
  648. // 截取路径名字
  649. getUrlName(url) {
  650. let strArr = url.split("/");
  651. console.log(strArr);
  652. let fileName = strArr[strArr.length - 1];
  653. console.log(fileName);
  654. fileName = decodeURIComponent(fileName);
  655. console.log(fileName);
  656. return fileName;
  657. },
  658. getUid() {
  659. let uid = "";
  660. for (let i = 0; i < 5; i++) {
  661. uid += Math.floor(Math.random() * 10);
  662. }
  663. return uid;
  664. },
  665. removeOssVideoFile(file) {
  666. for (let i = 0; i < this.defaultVideoFileList.length; i++) {
  667. let tmpFile = this.defaultVideoFileList[i];
  668. if (tmpFile.uid === file.uid) {
  669. this.defaultVideoFileList.splice(i, 1);
  670. return;
  671. }
  672. }
  673. },
  674. removeOssImageFile(file) {
  675. for (let i = 0; i < this.defaultImageFileList.length; i++) {
  676. let tmpFile = this.defaultImageFileList[i];
  677. if (tmpFile.uid === file.uid) {
  678. this.defaultImageFileList.splice(i, 1);
  679. return;
  680. }
  681. }
  682. },
  683. // // 截取视频第一帧
  684. // findvideocover(file) {
  685. // var fileReader = new FileReader();
  686. // fileReader.readAsDataURL(file);
  687. // var that = this;
  688. // fileReader.onload = function(e) {
  689. // that.videoSrc = e.currentTarget.result;
  690. // console.log(that.videoSrc, 11111);
  691. // const width = 400;
  692. // const height = 300;
  693. // var video = document.getElementById("videofile");
  694. // console.log(video, 66666);
  695. // video.currentTime = 5; //必须设置视频当前时长,要不然会黑屏
  696. // var output = document.getElementById("output");
  697. // // 创建画布准备截图
  698. // var canvas = document.createElement("canvas");
  699. // // 创建图片标签
  700. // var img = document.createElement("img");
  701. // // 获取视频的标签
  702. // video = document.getElementById("videofile");
  703. // video.setAttribute("crossOrigin", "anonymous");
  704. // // 设置画布的宽高
  705. // canvas.width = video.clientWidth;
  706. // canvas.height = video.clientHeight;
  707. // // 图片绘制
  708. // video.onloadeddata = () => {
  709. // canvas
  710. // .getContext("2d")
  711. // .drawImage(video, 0, 0, canvas.width, canvas.height);
  712. // var dataURL = canvas.toDataURL("image/jpeg");
  713. // img.src = dataURL;
  714. // img.width = width;
  715. // img.height = height;
  716. // // 添加到output盒子里面
  717. // output.appendChild(img);
  718. // console.log("--画图--");
  719. // console.log(img);
  720. // };
  721. // };
  722. // },
  723. // 预览
  724. preview() {
  725. this.previewVisible = true;
  726. },
  727. // 关闭预览
  728. closepreview() {
  729. this.previewVisible = false;
  730. }
  731. }
  732. };
  733. </script>
  734. <style lang="less">
  735. .p-content {
  736. max-width: 100%;
  737. img {
  738. max-width: 100%;
  739. width: auto;
  740. height: auto;
  741. }
  742. }
  743. /* tile uploaded pictures */
  744. .upload-list-inline .ant-upload-list-item {
  745. float: left;
  746. width: 200px;
  747. margin-right: 8px;
  748. }
  749. .upload-list-inline .ant-upload-animate-enter {
  750. animation-name: uploadAnimateInlineIn;
  751. }
  752. .upload-list-inline .ant-upload-animate-leave {
  753. animation-name: uploadAnimateInlineOut;
  754. }
  755. </style>
  756. <style lang="less" scoped>
  757. @import "~@/styles/common/variable.less";
  758. .app-container {
  759. .information-title {
  760. font-size: 18px;
  761. font-weight: bold;
  762. color: @mainColorBlack65;
  763. margin-bottom: @paddingMarginVal;
  764. }
  765. .submit-row {
  766. width: 100%;
  767. margin-top: 2 * @paddingMarginVal;
  768. padding: @paddingMarginVal 0 @navTopHight;
  769. display: flex;
  770. justify-content: center;
  771. }
  772. }
  773. </style>