projectActpro.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <!-- 项目活动过程 -->
  3. <div class="pb_content">
  4. <div class="race_content_body">
  5. <div class="raceBox">
  6. <div class="stepBg">
  7. <div
  8. class="steps"
  9. v-for="(sta, staIndex) in raceAct.stageBox"
  10. :key="staIndex"
  11. >
  12. <div>
  13. <img src="../../../../assets/icon/race/progress.png" alt="" />
  14. </div>
  15. <div class="stepRightNav" @click="jump('jd' + staIndex + 1)">
  16. <div>阶段{{ staIndex + 1 }}</div>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="right">
  21. <div v-for="(sa, saIndex) in raceAct.stageBox" :key="saIndex" :id="'jd' + saIndex + 1">
  22. <div class="right_title">阶段{{ saIndex + 1 }}</div>
  23. <div class="saBox">
  24. <div class="saLittleBox">
  25. <div>
  26. <editor-bar
  27. v-model="sa.brief"
  28. @change="upRaceAct"
  29. ></editor-bar>
  30. </div>
  31. <div>
  32. <div class="basic_box">
  33. <div>
  34. <div
  35. class="add_chapters_box"
  36. v-if="sa.data && sa.data.length == 0"
  37. ></div>
  38. <div
  39. v-else
  40. class="add_chapters_box"
  41. style="display: flex; flex-direction: column"
  42. >
  43. <div
  44. class="chapter_upload"
  45. v-for="(item, index) in sa.data"
  46. :key="item.id"
  47. >
  48. <div class="chapter_upload_t"></div>
  49. <div class="chapter_upload_o">
  50. <div class="chapter_upload_l">
  51. <div
  52. v-if="item.type == 2"
  53. class="chapter_upload_l_i1"
  54. ></div>
  55. <div
  56. v-if="item.type == 1 || item.type == 3"
  57. class="chapter_upload_l_i5"
  58. ></div>
  59. </div>
  60. <div class="chapter_upload_ic">
  61. <div class="chapter_upload_ic_l"></div>
  62. <div
  63. class="chapter_upload_ic_r"
  64. @click.stop="
  65. deleteChapterData($event, saIndex, index)
  66. "
  67. >
  68. <div></div>
  69. </div>
  70. </div>
  71. <div class="chapter_upload_n">
  72. <input
  73. class="first"
  74. v-if="item.type == 1 || item.type == 3"
  75. :placeholder="item.name"
  76. />
  77. <input
  78. class="first"
  79. v-if="item.type == 2"
  80. :placeholder="item.name"
  81. />
  82. <div class="chapter_upload_ud">
  83. <div class="chapter_upload_up"></div>
  84. <div class="chapter_upload_down"></div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="add_info_box">
  92. <button class="info_btn" @click="addImg($event)">
  93. 上传附件
  94. <input
  95. type="file"
  96. accept="application/pdf, application/.ppt, .ppt, .pptx, .xlsx, .xls, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document,video/mp4, video/quicktime, video/x-msvideo,image/*"
  97. style="display: none"
  98. @change="beforeUpload($event, null, saIndex)"
  99. />
  100. </button>
  101. </div>
  102. <div v-if="sa.data.proVisible" class="mask">
  103. <div class="progressBox">
  104. <div class="lbox">
  105. <img
  106. src="../../../../assets/loading.gif"
  107. />上传中,请稍后
  108. </div>
  109. <el-progress
  110. :text-inside="true"
  111. :stroke-width="20"
  112. :percentage="sa.data.progress ? sa.data.progress : 0"
  113. style="width: 80%"
  114. ></el-progress>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. import EditorBar from "../../../tools/wangEnduit";
  129. export default {
  130. components: { EditorBar },
  131. props: ["raceProcess"],
  132. data() {
  133. return {
  134. raceAct: {
  135. stageBox: [
  136. {
  137. staTitle: "",
  138. allTime: "",
  139. brief: "",
  140. data: [],
  141. actBox: [
  142. {
  143. actName: "",
  144. actTime: "",
  145. driQuestion: { brief: "", data: [] },
  146. tarDesign: { brief: "", data: [] },
  147. actiDesign: { brief: "", data: [] },
  148. evaDesign: { brief: "", data: [] },
  149. },
  150. ],
  151. },
  152. ],
  153. },
  154. stage: 0,
  155. };
  156. },
  157. methods: {
  158. upRaceAct() {
  159. this.$emit("upRaceAct", this.raceAct);
  160. },
  161. addImg(e) {
  162. var el = e.currentTarget;
  163. el.getElementsByTagName("input")[0].click();
  164. },
  165. jump(t) {
  166. var a = document.getElementById(t);
  167. var b = document.getElementsByClassName("right")[0];
  168. b.scrollTop = a.offsetTop;
  169. },
  170. imgChange(file, fileList, type, sindex) {
  171. var _tmp = this.raceAct.stageBox[sindex].data;
  172. this.noneBtnImg = _tmp.length >= 1;
  173. },
  174. deleteChapterData(e, si, i) {
  175. e.stopPropagation();
  176. this.raceAct.stageBox[si].data.splice(i, 1);
  177. this.upRaceAct();
  178. },
  179. beforeUpload(event, type, sindex) {
  180. var file = event.target.files[0];
  181. var credentials = {
  182. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  183. secretAccessKey: "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",
  184. }; //秘钥形式的登录上传
  185. window.AWS.config.update(credentials);
  186. window.AWS.config.region = "cn-northwest-1"; //设置区域
  187. var type1 = type;
  188. var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  189. var _this = this;
  190. var b = [
  191. "DOC",
  192. "DOCX",
  193. "DOCM",
  194. "DOTM",
  195. "DOTX",
  196. "PPTX",
  197. "PPSX",
  198. "PPT",
  199. "PPS",
  200. "PPTM",
  201. "POTM",
  202. "PPAM",
  203. "POTX",
  204. "PPSM",
  205. ];
  206. var c = ["PDF", "DOT", "DOC", "DOCX", "PPT", "PPTX", "XLSX", "XLS"];
  207. var d = [
  208. "BMP",
  209. "PJP",
  210. "APNG",
  211. "PNG",
  212. "JPG",
  213. "GIF",
  214. "SVG",
  215. "JPEG",
  216. "JPG",
  217. "ICO",
  218. "PGPEG",
  219. "AVIF",
  220. ];
  221. if (
  222. b.indexOf(
  223. file.name
  224. .split(".")
  225. [file.name.split(".").length - 1].toLocaleUpperCase()
  226. ) != -1
  227. ) {
  228. if (file.size / 1024 / 1024 > 10) {
  229. this.$message.error("上传文件大于10M,请重新选择文件!");
  230. return;
  231. }
  232. } else if (
  233. c.indexOf(
  234. file.name
  235. .split(".")
  236. [file.name.split(".").length - 1].toLocaleUpperCase()
  237. ) != -1
  238. ) {
  239. if (file.size / 1024 / 1024 > 5) {
  240. this.$message.error("添加的上传文件大于5M,请重新选择文件!");
  241. return;
  242. }
  243. }
  244. if (
  245. c.indexOf(
  246. file.name
  247. .split(".")
  248. [file.name.split(".").length - 1].toLocaleUpperCase()
  249. ) != -1
  250. ) {
  251. type1 = 1;
  252. } else if (
  253. d.indexOf(
  254. file.name
  255. .split(".")
  256. [file.name.split(".").length - 1].toLocaleUpperCase()
  257. ) != -1
  258. ) {
  259. type1 = 3;
  260. } else {
  261. type1 = 2;
  262. }
  263. _this.raceAct.stageBox[sindex].data.progress = 0;
  264. _this.raceAct.stageBox[sindex].data.proVisible = true;
  265. _this.$forceUpdate();
  266. if (file) {
  267. var params = {
  268. Key:
  269. file.name.split(".")[0] +
  270. new Date().getTime() +
  271. "." +
  272. file.name.split(".")[file.name.split(".").length - 1],
  273. ContentType: file.type,
  274. Body: file,
  275. "Access-Control-Allow-Credentials": "*",
  276. ACL: "public-read",
  277. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  278. var options = {
  279. partSize: 2048 * 1024 * 1024,
  280. queueSize: 2,
  281. leavePartsOnError: true,
  282. };
  283. bucket
  284. .upload(params, options)
  285. .on("httpUploadProgress", function (evt) {
  286. //这里可以写进度条
  287. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  288. _this.raceAct.stageBox[sindex].data.progress = parseInt(
  289. (evt.loaded * 80) / evt.total
  290. );
  291. })
  292. .send(function (err, data) {
  293. _this.raceAct.stageBox[sindex].data.progress = 100;
  294. setTimeout(() => {
  295. _this.raceAct.stageBox[sindex].data.proVisible = false;
  296. _this.$forceUpdate();
  297. }, 1000);
  298. if (err) {
  299. _this.$message.error("上传失败");
  300. } else {
  301. _this.raceAct.stageBox[sindex].data.push({
  302. name: file.name,
  303. url: data.Location,
  304. type: type1,
  305. });
  306. _this.imgChange(null, null, type1, sindex);
  307. _this.upRaceAct();
  308. console.log(data.Location);
  309. }
  310. });
  311. }
  312. },
  313. },
  314. created() {
  315. this.raceAct = this.raceProcess;
  316. },
  317. };
  318. </script>
  319. <style scoped>
  320. @media screen and (max-width: 1280px) {
  321. .right_title{
  322. padding: 20px 0 20px 10px !important;
  323. }
  324. .saLittleBox {
  325. padding: 20px 0 10px 10px !important;
  326. }
  327. }
  328. .pb_content {
  329. width: 100%;
  330. height: 100%;
  331. }
  332. .race_content_body {
  333. width: 100%;
  334. position: relative;
  335. margin: 0;
  336. height: 100%;
  337. }
  338. .raceBox {
  339. width: 100%;
  340. height: 100%;
  341. display: flex;
  342. flex-direction: row;
  343. flex-wrap: nowrap;
  344. align-items: flex-start;
  345. }
  346. .stepBg {
  347. padding: 80px 0 0 0;
  348. margin: 0 25px 0 0;
  349. width: 20%;
  350. display: flex;
  351. justify-content: flex-start;
  352. align-items: center;
  353. flex-wrap: nowrap;
  354. background: #fff;
  355. /* min-height: 800px; */
  356. height: calc(100% - 80px);
  357. border-radius: 15px;
  358. overflow: auto;
  359. min-width: 260px;
  360. flex-direction: column;
  361. }
  362. .steps {
  363. display: flex;
  364. flex-direction: row;
  365. flex-wrap: nowrap;
  366. position: relative;
  367. width: 145px;
  368. height: 130px;
  369. }
  370. .steps > div:nth-child(1) > img {
  371. z-index: 9;
  372. position: relative;
  373. }
  374. .stepRightNav {
  375. display: flex;
  376. flex-direction: column;
  377. flex-wrap: nowrap;
  378. justify-content: space-between;
  379. align-items: flex-start;
  380. margin: 5px 0 0 10px;
  381. height: 50px;
  382. cursor: pointer;
  383. }
  384. .stepRightNav:hover{
  385. color: #999;
  386. }
  387. .stepBg .steps::after {
  388. content: "";
  389. height: 100%;
  390. background: #eee;
  391. width: 4px;
  392. position: absolute;
  393. left: 15px;
  394. top: calc(50% + (35px / 2));
  395. transform: translateY(-50%);
  396. z-index: 1;
  397. }
  398. .right {
  399. width: calc(100% - 20%);
  400. background: rgb(255, 255, 255);
  401. border-radius: 10px;
  402. overflow: auto;
  403. height: 100%;
  404. border-radius: 15px;
  405. overflow-x: hidden;
  406. /* max-height: 800px; */
  407. }
  408. .basic_box {
  409. position: relative;
  410. margin: 0;
  411. min-height: 0;
  412. width: 90%;
  413. }
  414. .add_info_box {
  415. margin: 20px 0;
  416. }
  417. .add_info_box button {
  418. margin: 0 10px 10px 0;
  419. }
  420. .add_chapters_box {
  421. text-align: left;
  422. background-color: rgb(232 234 237);
  423. width: 100%;
  424. padding: 0px 15px;
  425. border-radius: 15px;
  426. font-size: 16px;
  427. box-sizing: border-box;
  428. position: relative;
  429. padding: 0 10px 5px 10px;
  430. height: 140px;
  431. overflow-y: auto;
  432. overflow-x: hidden;
  433. }
  434. .chapter_upload {
  435. height: 50px;
  436. margin-top: 12px;
  437. position: relative;
  438. display: flex;
  439. align-items: center;
  440. width: 100%;
  441. min-height: 50px;
  442. }
  443. .chapter_upload_t {
  444. background-color: #fff;
  445. position: absolute;
  446. height: 100%;
  447. top: 0px;
  448. left: 0px;
  449. border-radius: 40px;
  450. box-sizing: border-box;
  451. box-shadow: 0 0 3px 3px #dfdfdf;
  452. width: 100%;
  453. }
  454. .chapter_upload_o {
  455. width: 100%;
  456. height: 100%;
  457. position: relative;
  458. z-index: 1;
  459. display: flex;
  460. align-items: center;
  461. }
  462. .chapter_upload_ic {
  463. height: 30px;
  464. float: right;
  465. cursor: pointer;
  466. position: absolute;
  467. width: 45px;
  468. right: 0;
  469. top: 0;
  470. }
  471. .chapter_upload_ic_l {
  472. width: 50px;
  473. height: 50px;
  474. float: left;
  475. }
  476. .chapter_upload_ic_l div {
  477. width: 30px;
  478. height: 35px;
  479. background: url("../../../../assets/icon/icon.png");
  480. }
  481. .chapter_upload_ic_r {
  482. width: 50px;
  483. height: 50px;
  484. float: left;
  485. margin-left: 0px;
  486. display: flex;
  487. align-items: center;
  488. position: absolute;
  489. }
  490. .chapter_upload_ic_r div {
  491. width: 25px;
  492. height: 25px;
  493. background-image: url("../../../../assets/delete.png");
  494. background-size: 100% 100%;
  495. }
  496. .chapter_upload_n {
  497. display: flex;
  498. text-indent: 10px;
  499. text-decoration: none;
  500. text-overflow: ellipsis;
  501. white-space: nowrap;
  502. overflow: hidden;
  503. width: 55%;
  504. margin-left: 10px;
  505. cursor: pointer;
  506. margin-top: 2px;
  507. }
  508. .chapter_upload_l_i1 {
  509. background-image: url("../../../../assets/icon/video.png");
  510. width: 28px;
  511. height: 28px;
  512. background-size: 100% 100%;
  513. }
  514. .chapter_upload_l_i5 {
  515. background-image: url("../../../../assets/icon/word.png");
  516. width: 24px;
  517. height: 24px;
  518. background-size: 100% 100%;
  519. margin-left: 1px;
  520. }
  521. .chapter_upload_l_i8 {
  522. background-image: url("../../../../assets/icon/line.png");
  523. width: 24px;
  524. height: 24px;
  525. background-size: 100% 100%;
  526. margin-left: 1px;
  527. }
  528. .chapter_upload_ud {
  529. display: flex;
  530. flex-direction: column;
  531. margin-left: 5px;
  532. justify-content: center;
  533. z-index: 99;
  534. }
  535. .chapter_upload_up {
  536. background-image: url("../../../../assets/icon/up.png");
  537. width: 17px;
  538. height: 15px;
  539. background-size: 100% 100%;
  540. cursor: pointer;
  541. }
  542. .chapter_upload_down {
  543. background-image: url("../../../../assets/icon/down.png");
  544. width: 17px;
  545. height: 15px;
  546. margin: 2px auto 0 auto;
  547. background-size: 100% 100%;
  548. cursor: pointer;
  549. }
  550. .chapter_upload_l {
  551. padding: 1px 0 0 10px;
  552. }
  553. .first {
  554. border: none;
  555. outline: none;
  556. width: 80%;
  557. min-width: 215px;
  558. z-index: 99;
  559. font-size: 14px;
  560. white-space: nowrap;
  561. overflow: hidden;
  562. text-overflow: ellipsis;
  563. }
  564. .info_btn {
  565. color: #fff;
  566. background-color: #0f7eff;
  567. padding: 8px 24px;
  568. font-size: 0.9375rem;
  569. box-shadow: 0px 1px 3px 0px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%),
  570. 0px 3px 1px -2px rgb(0 0 0 / 12%);
  571. min-width: 64px;
  572. font-weight: 500;
  573. border-radius: 4px;
  574. box-sizing: border-box;
  575. border: none;
  576. cursor: pointer;
  577. }
  578. .info_btn:hover {
  579. background-color: #4f7cd5 !important;
  580. }
  581. .mask {
  582. background-color: rgb(0 0 0 / 30%);
  583. /* position: fixed; */
  584. position: absolute;
  585. top: 0;
  586. left: 0;
  587. width: 100%;
  588. height: 100%;
  589. z-index: 20000;
  590. display: flex;
  591. align-items: center;
  592. justify-content: center;
  593. }
  594. .progressBox {
  595. width: 300px;
  596. height: 150px;
  597. background: #fff;
  598. border-radius: 10px;
  599. box-shadow: 0 0 6px 1px #bfbfbf;
  600. display: flex;
  601. align-items: center;
  602. justify-content: center;
  603. flex-direction: column;
  604. }
  605. .progressBox .lbox {
  606. height: 100px;
  607. font-size: 16px;
  608. display: flex;
  609. align-items: center;
  610. }
  611. .progressBox .lbox img {
  612. width: 40px;
  613. margin-right: 20px;
  614. }
  615. .progressBox >>> .el-progress-bar__outer {
  616. background-color: #d1dfff !important;
  617. }
  618. .progressBox .lbox {
  619. height: 100px;
  620. font-size: 19px;
  621. display: flex;
  622. align-items: center;
  623. }
  624. .progressBox .lbox img {
  625. width: 40px;
  626. margin-right: 20px;
  627. }
  628. .saBox {
  629. width: 96%;
  630. margin: 0 auto;
  631. background: #fbfbfb;
  632. border-radius: 10px;
  633. }
  634. .saLittleBox {
  635. width: 100%;
  636. padding: 25px 0 10px 25px;
  637. }
  638. .saLittleBox > div:nth-child(1) {
  639. width: 85%;
  640. }
  641. .saLittleBox > div:nth-child(2) {
  642. width: 90%;
  643. margin-top: 25px;
  644. }
  645. .right_title {
  646. height: 30px;
  647. font-size: 1.5em;
  648. font-weight: bold;
  649. color: #0f7eff;
  650. width: 80px;
  651. padding: 20px 0 20px 30px;
  652. }
  653. </style>