studentProjectWordDetail.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  1. <template>
  2. <div id="studentProjectWordDetail" v-loading="loading || downloadWordDig">
  3. <studentProjectWord
  4. v-if="isupload == 0"
  5. :wordData="wordData"
  6. :reversedMessage="reversedMessage"
  7. :signData="signData"
  8. :download="loading"
  9. @getFile="getFile"
  10. @fileOption="fileOption"
  11. @saveFile="saveFile"
  12. />
  13. <studentProjectWordShow
  14. ref="myChild"
  15. v-if="isupload != 0 || downloadWordDig"
  16. :downWordData="downWordData"
  17. :reversedMessage="reversedMessage"
  18. :signData="signData"
  19. :download="loading"
  20. @getFile="getFile"
  21. @fileOption="fileOption"
  22. @saveFile="saveFile"
  23. />
  24. <div style="position: fixed; bottom: 5%; right: 2%">
  25. <el-button
  26. style="width: 140px; margin: 10px"
  27. @click="downloadWordDig = true"
  28. type="primary"
  29. >下载文件</el-button
  30. >
  31. <!-- <el-button
  32. style="width: 140px; margin: 1cqh"
  33. @click="downloadDig = true"
  34. type="primary"
  35. >下载PDF</el-button
  36. > -->
  37. <el-button
  38. style="width: 120px; margin: 10px"
  39. @click="test"
  40. type="primary"
  41. v-if="isupload == 0"
  42. >立即修改</el-button
  43. >
  44. </div>
  45. <!-- <div
  46. style="
  47. width: 500px;
  48. margin: 20px auto;
  49. display: flex;
  50. justify-content: space-between;
  51. "
  52. >
  53. <el-button
  54. style="width: 140px; margin: 20px auto"
  55. @click="downloadWordDig = true"
  56. type="primary"
  57. >下载文档(Word)</el-button
  58. >
  59. <el-button
  60. style="width: 140px; margin: 20px auto"
  61. @click="downloadDig = true"
  62. type="primary"
  63. >下载文档(PDF)</el-button
  64. >
  65. <el-button
  66. style="width: 120px; margin: 20px auto"
  67. @click="test"
  68. type="primary"
  69. v-if="isupload == 0"
  70. >立即修改</el-button
  71. >
  72. </div> -->
  73. <!-- 立即修改开始 -->
  74. <el-dialog
  75. title="立即修改"
  76. :visible.sync="updatedWordDig"
  77. width="600px"
  78. class="pageSubmitData"
  79. >
  80. <div class="deleteContent">确定提交修改?</div>
  81. <span slot="footer" class="dialog-footer">
  82. <el-button type="primary" @click="updatedWord" class="AllDialogBtn"
  83. >确认</el-button
  84. >
  85. <el-button @click="updatedWordDig = false" class="AllDialogBtn"
  86. >取消</el-button
  87. >
  88. </span>
  89. </el-dialog>
  90. <!-- 立即修改结束-->
  91. <!-- 下载文档开始 -->
  92. <el-dialog
  93. title="下载PDF"
  94. :visible.sync="downloadDig"
  95. width="600px"
  96. class="pageSubmitData"
  97. >
  98. <div class="deleteContent">确定下载文档?</div>
  99. <span slot="footer" class="dialog-footer" v-loading="loading">
  100. <el-button type="primary" @click="downloadPDFFile" class="AllDialogBtn"
  101. >确认</el-button
  102. >
  103. <el-button @click="downloadDig = false" class="AllDialogBtn"
  104. >取消</el-button
  105. >
  106. </span>
  107. </el-dialog>
  108. <el-dialog
  109. title="下载Word"
  110. :visible.sync="downloadWordDig"
  111. width="600px"
  112. class="pageSubmitData"
  113. >
  114. <div class="deleteContent">确定下载文档?</div>
  115. <span slot="footer" class="dialog-footer">
  116. <el-button type="primary" @click="downloadWordFile" class="AllDialogBtn"
  117. >确认</el-button
  118. >
  119. <!-- <el-button type="primary" @click="downloadWord2" class="AllDialogBtn"
  120. >确认2</el-button
  121. > -->
  122. <el-button @click="()=>{downloadWordDig = false;loading = false}" class="AllDialogBtn"
  123. >取消</el-button
  124. >
  125. </span>
  126. </el-dialog>
  127. <!-- 下载文档结束-->
  128. <!-- 展示文件 -->
  129. <el-dialog
  130. title="展示文件"
  131. :visible.sync="showFile"
  132. top="1vh"
  133. width="80vw"
  134. append-to-body
  135. >
  136. <div class="showFileArea" style="height: 80vh">
  137. <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
  138. <div
  139. class="workd_media"
  140. style="width: 90%; height: 90%"
  141. v-if="videoDetail.sources"
  142. >
  143. <video-player
  144. class="video-player vjs-custom-skin"
  145. :playsinline="true"
  146. :options="videoDetail"
  147. @play="onPlayerPlay($event)"
  148. style="width: 90%; height: 90%; margin: 0 auto"
  149. ></video-player>
  150. </div>
  151. <vword
  152. style="width: 100%; height: 100%; overflow: auto"
  153. class="fullStyle"
  154. v-else-if="Wordss['type'] != 'pdf' && Wordss['name'] != '图片'"
  155. :pdfUrl="
  156. 'https://view.officeapps.live.com/op/view.aspx?src=' + showFileUrl
  157. "
  158. ></vword>
  159. <vpdf
  160. style="width: 100%; height: 100%; overflow: auto"
  161. class="fullStyle"
  162. :pdfUrl="showFileUrl"
  163. v-else-if="Wordss['type'] == 'pdf'"
  164. ></vpdf>
  165. <img
  166. :src="showFileUrl"
  167. alt="图片哦"
  168. v-else-if="Wordss['name'] == '图片'"
  169. style="width: auto; height: auto; max-width: 100%; max-height: 100%"
  170. />
  171. </div>
  172. <!-- <el-button type="primary" size="mini" @click="downFile(showFileUrl)">下载文件</el-button> -->
  173. </el-dialog>
  174. <!-- 修改文件名称 -->
  175. <el-dialog
  176. title="修改名称"
  177. :visible.sync="dialogVisibleUpdateFile"
  178. :append-to-body="true"
  179. width="500px"
  180. class="dialog_diy"
  181. >
  182. <div
  183. style="
  184. width: 100%;
  185. display: flex;
  186. flex-direction: row;
  187. flex-wrap: nowrap;
  188. align-items: center;
  189. justify-content: center;
  190. "
  191. >
  192. <div style="min-width: fit-content">文件名称:</div>
  193. <el-input
  194. v-model="updateFile.fileName"
  195. placeholder="请输入要修改的名称"
  196. ></el-input>
  197. </div>
  198. <span slot="footer" class="dialog-footer">
  199. <el-button @click="dialogVisibleUpdateFile = false">取 消</el-button>
  200. <el-button type="primary" @click="updateFileName">确 定</el-button>
  201. </span>
  202. </el-dialog>
  203. </div>
  204. </template>
  205. <script>
  206. import { getNowDate } from "@/components/tool/Date.js";
  207. import { getWord2 } from "@/components/tool/getWord2";
  208. import studentProjectWord from "./studentProjectWord.vue";
  209. import studentProjectWordShow from "./studentProjectWordShow.vue";
  210. import { downloadPDF } from "@/components/tool/pdf";
  211. import vpdf from "@/components/vpdf.vue";
  212. import vword from "@/components/vword.vue";
  213. export default {
  214. components: { studentProjectWord, studentProjectWordShow,vword,vpdf },
  215. data() {
  216. return {
  217. isupload: 1,
  218. DepartmentData: [], //部门学院
  219. loading:false,
  220. downloadDig: false, //下载文档对话框
  221. downloadWordDig:false,
  222. updatedWordDig: false, //立即修改对话框
  223. showFile:false,// 展示文件弹窗
  224. dialogVisibleUpdateFile:false,//修改文件弹窗
  225. downWordData: {
  226. applicationDate: getNowDate(1), //申请日期
  227. projectName: "",
  228. radio: "",
  229. checkList: [],
  230. schoolRadio: [],
  231. applyParsonRadio: [],
  232. applyParsonName: "",
  233. college: "",
  234. tel: "",
  235. beginTime: "",
  236. endTime: "",
  237. studentS: [
  238. { name: "", collage: "", work: "" },
  239. { name: "", collage: "", work: "" },
  240. { name: "", collage: "", work: "" },
  241. { name: "", collage: "", work: "" },
  242. { name: "", collage: "", work: "" },
  243. { name: "", collage: "", work: "" },
  244. ],
  245. teacherS: [
  246. { name: "", collage: "", work: "" },
  247. { name: "", collage: "", work: "" },
  248. ],
  249. brief: "",
  250. introduce: {
  251. back: "",
  252. innovate: "",
  253. path: "",
  254. scene: "",
  255. worth: "",
  256. team: "",
  257. cost: "",
  258. expectResults: "",
  259. expectResultsTeacher: "",
  260. expectConversion: "",
  261. plan: "",
  262. },
  263. total: 0,
  264. fund: {
  265. device: "",
  266. Material: "",
  267. processing: "",
  268. APPRAISAL: "",
  269. Collaboration: "",
  270. Transaction: "",
  271. activities: "",
  272. entery: "",
  273. },
  274. opinion:[],
  275. },
  276. wordData: {
  277. applicationDate: getNowDate(1), //申请日期
  278. projectName: "",
  279. radio: "",
  280. checkList: [],
  281. schoolRadio: [],
  282. applyParsonRadio: [],
  283. applyParsonName: "",
  284. college: "",
  285. tel: "",
  286. beginTime: "",
  287. endTime: "",
  288. studentS: [
  289. { name: "", collage: "", work: "" },
  290. { name: "", collage: "", work: "" },
  291. { name: "", collage: "", work: "" },
  292. { name: "", collage: "", work: "" },
  293. { name: "", collage: "", work: "" },
  294. { name: "", collage: "", work: "" },
  295. ],
  296. teacherS: [
  297. { name: "", collage: "", work: "" },
  298. { name: "", collage: "", work: "" },
  299. ],
  300. brief: "",
  301. introduce: {
  302. back: "",
  303. innovate: "",
  304. path: "",
  305. scene: "",
  306. worth: "",
  307. team: "",
  308. cost: "",
  309. expectResults: "",
  310. expectResultsTeacher: "",
  311. expectConversion: "",
  312. plan: "",
  313. },
  314. total: 0,
  315. fund: {
  316. device: "",
  317. Material: "",
  318. processing: "",
  319. APPRAISAL: "",
  320. Collaboration: "",
  321. Transaction: "",
  322. activities: "",
  323. entery: "",
  324. },
  325. opinion:[],
  326. },
  327. signData:[],
  328. word: [
  329. "DOC",
  330. "DOCX",
  331. "DOCM",
  332. "DOTM",
  333. "DOTX",
  334. "PPTX",
  335. "PPSX",
  336. "PPT",
  337. "PPS",
  338. "PPTM",
  339. "POTM",
  340. "PPAM",
  341. "POTX",
  342. "PPSM",
  343. "XLSX",
  344. "XLS",
  345. ],
  346. pdf: ["PDF"],
  347. image: [
  348. "BMP",
  349. "PJP",
  350. "APNG",
  351. "PNG",
  352. "JPG",
  353. "GIF",
  354. "SVG",
  355. "JPEG",
  356. "JPG",
  357. "ICO",
  358. "PGPEG",
  359. "AVIF",
  360. ],
  361. vedio: [
  362. "AVI",
  363. "NAVI",
  364. "MPEG",
  365. "ASF",
  366. "MOV",
  367. "WMV",
  368. "3GP",
  369. "RM",
  370. "RMVB",
  371. "FLV",
  372. "F4V",
  373. "H.264",
  374. "H.265",
  375. "REAL VIDEO",
  376. "MKV",
  377. "WebM",
  378. "HDDVD",
  379. "MP4",
  380. "MPG",
  381. "M4V",
  382. "MGV",
  383. "OGV",
  384. "QTM",
  385. "STR",
  386. "AMC",
  387. "DVX",
  388. "EVO",
  389. "DAT",
  390. "OGG",
  391. "OGM",
  392. ],
  393. playerOptions: {
  394. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  395. autoplay: false, //如果true,浏览器准备好时开始回放。
  396. muted: false, // 默认情况下将会消除任何音频。
  397. loop: false, // 导致视频一结束就重新开始。
  398. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  399. language: "zh-CN",
  400. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  401. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  402. sources: [
  403. {
  404. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  405. src: "", //url地址require("../../assets/media/aaa.mp4")
  406. },
  407. ],
  408. // poster: require("../../assets/tu31.png"), //你的封面地址
  409. // poster: dataRes.imgUrl, //你的封面地址
  410. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  411. controlBar: {
  412. timeDivider: true, //当前时间和持续时间的分隔符
  413. durationDisplay: true, //显示持续时间
  414. remainingTimeDisplay: false, //是否显示剩余时间功能
  415. fullscreenToggle: true, //全屏按钮
  416. },
  417. },
  418. playerO: {},
  419. videoDetail: {},
  420. Wordss:{},
  421. showFileUrl:"",
  422. canonical: {
  423. Image:
  424. /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
  425. File: /^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i,
  426. },
  427. updateFile:{
  428. url:"",
  429. fileName:""
  430. },
  431. };
  432. },
  433. methods: {
  434. getText(value) {
  435. //电话验证
  436. let verify =
  437. /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/; //获取正则表达式 存放到verify变量中
  438. let result = verify.test(value.trim()); //判断输入框内容是否符合 正则表达式
  439. if (!result) return this.$message.error("请输入正确联系号码格式");
  440. },
  441. addTeacher() {
  442. //添加老师
  443. // if (this.wordData.teacherS.length >= 3)
  444. // return this.$message.error("指导老师最多三人");
  445. this.wordData.teacherS.push({ name: "", collage: "", work: "" });
  446. },
  447. DelTeacher(index) {
  448. //删除老师
  449. this.wordData.teacherS.splice(index, 1);
  450. },
  451. addStudent() {
  452. //添加学生
  453. this.wordData.studentS.push({ name: "", collage: "", work: "" });
  454. },
  455. DelStudent(index) {
  456. //删除学生
  457. this.wordData.studentS.splice(index, 1);
  458. },
  459. getProjectDepartmentData() {
  460. //获取项目立项申请基础信息页面所在部门数据
  461. this.ajax
  462. .post(this.$store.state.api + "/SelectAllDepartment", {
  463. uid: this.$store.state.userInfo.userid,
  464. })
  465. .then(
  466. (res) => {
  467. this.DepartmentData = res.data[0];
  468. },
  469. (err) => {
  470. console.log(err);
  471. }
  472. );
  473. },
  474. getData() {
  475. if(this.loading)return;
  476. this.loading = true;
  477. let param = {
  478. uid: this.$store.state.userInfo.userid,
  479. cid: this.$route.query["pid"],
  480. };
  481. this.ajax.get(this.$store.state.api + "/studentProjectData", param).then(
  482. (res) => {
  483. let data = res.data[0][0];
  484. this.wordData.projectName = data.title;
  485. this.wordData.radio = data.typeName;
  486. this.wordData.checkList = JSON.parse(data.multiSelectProject);
  487. this.wordData.schoolRadio = JSON.parse(data.schoolRemould);
  488. this.wordData.applyParsonRadio = JSON.parse(data.projectApplyperson);
  489. this.wordData.applyParsonName = data.pro_leader;
  490. this.wordData.college = data.classid;
  491. this.wordData.tel = data.phone;
  492. this.wordData.beginTime = data.bTime;
  493. this.wordData.endTime = data.eTime;
  494. this.wordData.studentS = JSON.parse(data.course_student);
  495. this.wordData.teacherS = JSON.parse(data.course_teacher);
  496. this.wordData.brief = data.brief;
  497. this.wordData.introduce = JSON.parse(data.chapters);
  498. this.wordData.fund = JSON.parse(data.money);
  499. this.wordData.opinion = data.opinion?JSON.parse(data.opinion):[];
  500. this.downWordData = {
  501. ...this.wordData,
  502. ...{ etime: data.eTime, btime: data.bTime, dp: data.className },
  503. };
  504. this.isupload = data["isupload"];
  505. this.loading = false;
  506. },
  507. (err) => {
  508. console.log(err);
  509. }
  510. );
  511. },
  512. // 获取评审数据
  513. getSignData(){
  514. let params = {
  515. pid:this.$route.query['pid']
  516. }
  517. this.ajax.get(this.$store.state.api+'/selectSign',params).then(res=>{
  518. this.signData = res.data[0]
  519. })
  520. },
  521. test() {
  522. //验证
  523. const cEmpty = /^\s*$/g;
  524. for (let i in this.wordData) {
  525. // console.log(this.wordData[i],i);
  526. switch (i) {
  527. case "projectName":
  528. if (cEmpty.test(this.wordData[i])) {
  529. this.$message.error("请输入项目名称");
  530. // this.$refs.projectName.style.background='rgb(236, 141, 141)'
  531. // setTimeout(() => {
  532. // this.$refs.projectName.style.background='#ffffff'
  533. // }, 2000);
  534. document
  535. .querySelector("#projectName")
  536. .scrollIntoView({ behavior: "smooth" });
  537. return false;
  538. }
  539. break;
  540. case "radio":
  541. if (cEmpty.test(this.wordData[i])) {
  542. this.$message.error("请选择项目分组");
  543. document
  544. .querySelector("#radio")
  545. .scrollIntoView({ behavior: "smooth" });
  546. return false;
  547. }
  548. break;
  549. // case "checkList":
  550. // if (this.wordData[i].length == 0) {
  551. // this.$message.error("优先支持项目");
  552. // document
  553. // .querySelector("#checkList")
  554. // .scrollIntoView({ behavior: "smooth" });
  555. // return false;
  556. // }
  557. // break;
  558. // case "schoolRadio":
  559. // if (cEmpty.test(this.wordData[i])) {
  560. // this.$message.error("请选择美丽校园改造项目");
  561. // document
  562. // .querySelector("#schoolRadio")
  563. // .scrollIntoView({ behavior: "smooth" });
  564. // return false;
  565. // }
  566. // break;
  567. // case "applyParsonRadio":
  568. // if (cEmpty.test(this.wordData[i])) {
  569. // this.$message.error("请选择项目申请人");
  570. // document
  571. // .querySelector("#applyParsonRadio")
  572. // .scrollIntoView({ behavior: "smooth" });
  573. // return false;
  574. // }
  575. // break;
  576. case "applyParsonName":
  577. if (cEmpty.test(this.wordData[i])) {
  578. this.$message.error("请填写申请人姓名");
  579. document
  580. .querySelector("#applyParsonName")
  581. .scrollIntoView({ behavior: "smooth" });
  582. return false;
  583. }
  584. break;
  585. case "college":
  586. if (cEmpty.test(this.wordData[i])) {
  587. this.$message.error("请选择所在学院");
  588. document
  589. .querySelector("#applyParsonName")
  590. .scrollIntoView({ behavior: "smooth" });
  591. return false;
  592. }
  593. break;
  594. case "tel":
  595. if (cEmpty.test(this.wordData[i])) {
  596. this.$message.error("请填写联系方式");
  597. document
  598. .querySelector("#applyParsonName")
  599. .scrollIntoView({ behavior: "smooth" });
  600. return false;
  601. }
  602. break;
  603. case "beginTime":
  604. if (cEmpty.test(this.wordData[i])) {
  605. this.$message.error("请选择项目起始时间");
  606. document
  607. .querySelector("#beginTime")
  608. .scrollIntoView({ behavior: "smooth" });
  609. return false;
  610. }
  611. break;
  612. case "endTime":
  613. if (cEmpty.test(this.wordData[i])) {
  614. this.$message.error("请选择计划完成时间");
  615. document
  616. .querySelector("#beginTime")
  617. .scrollIntoView({ behavior: "smooth" });
  618. return false;
  619. }
  620. break;
  621. // case "studentS":
  622. // let snum = 0;
  623. // this.wordData[i].forEach((item) => {
  624. // if (cEmpty.test(item["name"])) snum++;
  625. // // for(let j in item){
  626. // // if(cEmpty.test(item[j])){
  627. // // snum++;
  628. // // }
  629. // // }
  630. // });
  631. // if (snum > 0) {
  632. // this.$message.error("学生姓名请不要留空");
  633. // document
  634. // .querySelector("#studentS")
  635. // .scrollIntoView({ behavior: "smooth" });
  636. // return false;
  637. // }
  638. // // }
  639. // break;
  640. // case "teacherS":
  641. // let num = 0;
  642. // this.wordData[i].forEach((item) => {
  643. // if (cEmpty.test(item["name"])) num++;
  644. // // for(let j in item){
  645. // // if(cEmpty.test(item[j])){
  646. // // num++;
  647. // // }
  648. // // }
  649. // });
  650. // if (num > 0) {
  651. // this.$message.error("老师姓名请不要留空");
  652. // document
  653. // .querySelector("#teacherS")
  654. // .scrollIntoView({ behavior: "smooth" });
  655. // return false;
  656. // }
  657. // break;
  658. // case 'brief':
  659. // if (cEmpty.test(this.wordData[i])) {
  660. // this.$message.error('请填写项目简介')
  661. // // this.$refs.brief.style.background='rgb(236, 141, 141)'
  662. // // setTimeout(() => {
  663. // // this.$refs.brief.style.background='#ffffff'
  664. // // }, 2000);
  665. // document.querySelector('#brief').scrollIntoView({ behavior: "smooth" });
  666. // return false
  667. // }
  668. // break;
  669. case "fund":
  670. let mon =
  671. this.wordData.fund.device * 1 +
  672. this.wordData.fund.Material * 1 +
  673. this.wordData.fund.processing * 1 +
  674. this.wordData.fund.APPRAISAL * 1 +
  675. this.wordData.fund.Collaboration * 1 +
  676. this.wordData.fund.Transaction * 1 +
  677. this.wordData.fund.activities * 1 +
  678. this.wordData.fund.entery * 1;
  679. if (mon == 0) {
  680. document
  681. .querySelector("#fund")
  682. .scrollIntoView({ behavior: "smooth" });
  683. return this.$message.error("请输入经费");
  684. }
  685. break;
  686. }
  687. }
  688. this.wordData["total"] =
  689. this.wordData.fund.device * 1 +
  690. this.wordData.fund.Material * 1 +
  691. this.wordData.fund.processing * 1 +
  692. this.wordData.fund.APPRAISAL * 1 +
  693. this.wordData.fund.Collaboration * 1 +
  694. this.wordData.fund.Transaction * 1 +
  695. this.wordData.fund.activities * 1 +
  696. this.wordData.fund.entery * 1;
  697. this.updatedWordDig = true;
  698. },
  699. updatedWord() {
  700. let param = {
  701. uid: this.$store.state.userInfo.userid, //用户ID
  702. cid: this.$route.query["pid"],
  703. tid: "5e21b204-c206-11ed-a4cd-509a4c5b67cf", //特色创客空间建设项目分类ID
  704. tit: encodeURIComponent(this.wordData["projectName"]), //项目名称
  705. radio: this.wordData["radio"], //项目分组
  706. checkList: encodeURIComponent(JSON.stringify(this.wordData["checkList"])), //优先支持项目
  707. schoolRadio: encodeURIComponent(JSON.stringify(this.wordData["schoolRadio"])), //美丽校园改造项目
  708. applyParsonRadio: encodeURIComponent(JSON.stringify(this.wordData["applyParsonRadio"])), //项 目 申 请 人
  709. applyParsonName: encodeURIComponent(this.wordData["applyParsonName"]), //申请人姓名
  710. coid: this.wordData["college"], //学院ID,
  711. tel: this.wordData["tel"], //联系电话
  712. beh: this.wordData["beginTime"], //项目开始时间,
  713. planEnd: this.wordData["endTime"], //计划完成时间,
  714. cs: encodeURIComponent(JSON.stringify(this.wordData["studentS"])), //学生组,
  715. ct: encodeURIComponent(JSON.stringify(this.wordData["teacherS"])), //教师组,
  716. bf: encodeURIComponent(this.wordData["brief"]), //项目简介
  717. introduce: encodeURIComponent(JSON.stringify(this.wordData["introduce"])), //项目详细
  718. mon: encodeURIComponent(JSON.stringify(this.wordData["fund"])), //预算经费
  719. f: this.wordData["total"], //总经费
  720. apply: this.wordData["applicationDate"], //申请日期
  721. mem:
  722. this.wordData["teacherS"].filter(i=>i.name!='').length + this.wordData["studentS"].filter(i=>i.name!='').length,
  723. };
  724. this.ajax
  725. .post(this.$store.state.api + "/updateStudentProjectData", param)
  726. .then(
  727. (res) => {
  728. // console.log(res.data);
  729. if (res.data) {
  730. this.updatedWordDig = false;
  731. return this.$message.success("修改成功");
  732. } else {
  733. this.$message.error("修改失败");
  734. }
  735. },
  736. (err) => {
  737. console.log(err);
  738. }
  739. );
  740. },
  741. downloadWordFile(){
  742. this.loading = true;
  743. this.$nextTick(()=>{
  744. this.$message.info("正在下载,请稍等...")
  745. let elementList = this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')
  746. let fontSize = [];
  747. let pFontSize = [];
  748. let fontType = {
  749. '1':"13pt",
  750. '2':"16.9pt",
  751. '3':"20.9pt",
  752. '4':"23.5pt",
  753. '5':"31.3pt",
  754. '6':"41.8pt",
  755. '7':"62.6pt"
  756. }
  757. elementList.forEach((el,elIndex) => {
  758. let img = el.getElementsByTagName('img');
  759. for(let i=0;i<img.length;i++){
  760. img[i].setAttribute("crossOrigin","*");
  761. }
  762. let font = el.getElementsByTagName('font');
  763. for(let i=0;i<font.length;i++){
  764. fontSize.push(font[i].getAttribute("size"))
  765. font[i].removeAttribute("size")
  766. font[i].setAttribute("style",`font-size:${fontType[fontSize[i]]}`)
  767. }
  768. // 替换p标签的font-size
  769. // let p = el.getElementsByTagName('p');
  770. let p = el.querySelectorAll("*")
  771. for(let i=0;i<p.length;i++){
  772. let pStyle = p[i].getAttribute("style")
  773. if(!pStyle)continue;
  774. let matchArr = pStyle.match(/font-size: (\d+)px/);
  775. if(!matchArr)continue;
  776. pFontSize.push({style:pStyle,index:`${elIndex}:${i}`})
  777. let originalSize = pStyle.match(/font-size: (\d+)px/)[1];
  778. let newSize = parseInt(originalSize)*1.3;
  779. let newStyle = pStyle.replace(/font-size: (\d+)px/,`font-size: ${newSize}pt`)
  780. p[i].setAttribute("style",newStyle)
  781. }
  782. })
  783. let newData = JSON.parse(JSON.stringify(this.downWordData))
  784. getWord2({...newData,signData:this.signData,elementList}).then(_=>{
  785. elementList.forEach((el,elIndex) => {
  786. let img = el.getElementsByTagName('img');
  787. for(let i=0;i<img.length;i++){
  788. img[i].removeAttribute('crossOrigin')
  789. }
  790. let font = el.getElementsByTagName('font');
  791. for(let i=0;i<font.length;i++){
  792. font[i].removeAttribute("style")
  793. font[i].setAttribute("size",fontSize[i])
  794. }
  795. // 替换p标签的font-size
  796. let p = el.querySelectorAll("*")
  797. for(let i=0;i<p.length;i++){
  798. let oldStyle = pFontSize.find(p=>p.index==`${elIndex}:${i}`)
  799. if(!oldStyle)continue;
  800. p[i].setAttribute("style",oldStyle.style)
  801. // let pStyle = p[i].getAttribute("style")
  802. // if(!pStyle)continue
  803. // let matchArr = pStyle.match(/font-size: (\d+)px/);
  804. // console.log(matchArr)
  805. // if(!matchArr)continue;
  806. // console.log(pFontSize[i])
  807. // p[i].setAttribute("style",pFontSize[i])
  808. }
  809. })
  810. this.downloadWordDig = false;
  811. this.loading = false;
  812. })
  813. })
  814. // getWord2({...this.downWordData,elementList:this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')})
  815. // getWord2({...this.downWordData,signData:this.signData});
  816. },
  817. downloadPDFFile() {
  818. // let elementList = this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')
  819. // elementList.forEach(el => {
  820. // let img = el.getElementsByTagName('img');
  821. // for(let i=0;i<img.length;i++){
  822. // img[i].crossOrigin = "*"
  823. // }
  824. // })
  825. downloadPDF(
  826. this.$refs.myChild.$refs.pdfShow,
  827. "附件2:2023年学生创客项目申报书"
  828. );
  829. // this.wordData['total']=this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1
  830. // return console.log(this.wordData);
  831. // let elementList = this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')
  832. // elementList.forEach(el => {
  833. // let img = el.getElementsByTagName('img');
  834. // for(let i=0;i<img.length;i++){
  835. // img[i].crossOrigin = "*"
  836. // }
  837. // })
  838. // return console.log(elementList)
  839. // getWord({...this.downWordData,elementList:this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')})
  840. // getWord(this.downWordData)
  841. this.downloadDig = false;
  842. },
  843. // 上传专家文件
  844. getFile(file){
  845. this.wordData.opinion.push(file);
  846. this.saveFile();
  847. },
  848. // 对文件的操作
  849. fileOption(file,index,opt){
  850. if(opt=='0'){
  851. this.checkFile(file.url)
  852. }else if(opt=='1'){
  853. if(index==0)return;
  854. this.wordData.opinion.splice(index-1,0,this.wordData.opinion.splice(index,1)[0]);
  855. this.saveFile();
  856. }else if(opt=='2'){
  857. if(index==this.wordData.opinion.length-1)return;
  858. this.wordData.opinion.splice(index+1,0,this.wordData.opinion.splice(index,1)[0]);
  859. this.saveFile();
  860. }else if(opt=='3'){
  861. this.updateFile = {...file,index:index}
  862. this.dialogVisibleUpdateFile = true;
  863. }else if(opt=='4'){
  864. this.$confirm("确定删除该文件?","提示",{
  865. type:"error",
  866. confirmButtonText:"确定删除",
  867. cancelButtonText:"取消",
  868. }).then(_=>{
  869. this.wordData.opinion.splice(index,1);
  870. this.saveFile();
  871. })
  872. }
  873. },
  874. // 上传文件函数
  875. saveFile(){
  876. let params = {
  877. uid:this.$store.state.userInfo.userid,
  878. pid:this.$route.query["pid"],
  879. file:encodeURIComponent(JSON.stringify(this.wordData.opinion))
  880. }
  881. this.ajax.post(this.$store.state.api+"/updateProjectOpinion",params).then(res=>{
  882. if(res.data==1){
  883. return this.getData();
  884. }
  885. })
  886. },
  887. //展示文件
  888. checkFile(url) {
  889. this.videoDetail = {};
  890. if (
  891. this.vedio.indexOf(
  892. url.split(".")[url.split(".").length - 1].toLocaleUpperCase()
  893. ) != -1
  894. ) {
  895. this.playerOptions.sources[0].src = url;
  896. this.videoDetail = this.playerOptions;
  897. this.showFile = true;
  898. } else {
  899. if (
  900. this.word.indexOf(
  901. url.split(".")[url.split(".").length - 1].toLocaleUpperCase()
  902. ) == -1 &&
  903. this.pdf.indexOf(
  904. url.split(".")[url.split(".").length - 1].toLocaleUpperCase()
  905. ) == -1 &&
  906. this.image.indexOf(
  907. url.split(".")[url.split(".").length - 1].toLocaleUpperCase()
  908. ) == -1
  909. ) {
  910. this.downFile(url);
  911. return;
  912. }
  913. this.showFileUrl = url;
  914. this.showFile = true;
  915. if (typeof url == "undefined") return { type: "", name: "" };
  916. let urlSplit = url.split(".");
  917. const type = urlSplit[urlSplit.length - 1];
  918. if (this.canonical.Image.test(url)) {
  919. this.Wordss = { type: type, name: "图片" };
  920. return console.log(this.Wordss);
  921. }
  922. if (this.canonical.File.test(url)) {
  923. this.Wordss = { type: type, name: "文档" };
  924. return console.log(this.Wordss);
  925. }
  926. if (this.canonical.vedio.test(url)) {
  927. this.Wordss = { type: type, name: "视频" };
  928. return console.log(this.Wordss);
  929. } else return (this.Wordss = { type: type, name: type });
  930. }
  931. },
  932. // 修改文件名称
  933. updateFileName(){
  934. if(!this.updateFile.fileName)return this.$message.error("请输入文件名称");
  935. this.wordData.opinion[this.updateFile.index].fileName = this.updateFile.fileName;
  936. this.dialogVisibleUpdateFile = false;
  937. this.saveFile();
  938. }
  939. // downloadWord2() {
  940. // // downloadPDF(
  941. // // this.$refs.myChild.$refs.pdfShow,
  942. // // "附件2:2023年学生创客项目申报书"
  943. // // );
  944. // // this.wordData['total']=this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1
  945. // // return console.log(this.wordData);
  946. // let elementList = this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')
  947. // elementList.forEach(el => {
  948. // let img = el.getElementsByTagName('img');
  949. // for(let i=0;i<img.length;i++){
  950. // img[i].crossOrigin = "*"
  951. // }
  952. // })
  953. // // return console.log(elementList)
  954. // getWord2({...this.downWordData,elementList:this.$refs.myChild.$refs.pdfShow.querySelectorAll('.downImage')})
  955. // // getWord(this.downWordData)
  956. // this.downloadDig = false;
  957. // },
  958. },
  959. //小型仪器设备费:device deviceRemarks
  960. //材料费:Material MaterialRemarks
  961. //测试化验加工费:processing processingRemarks
  962. //项目协作费:Collaboration CollaborationRemarks
  963. //项目成果鉴定费:APPRAISAL APPRAISALRemarks
  964. //参展参赛费:entery enteryRemarks
  965. //创客交流活动费:activities activitiesRemarks
  966. //知识产权事务费:Transaction TransactionRemarks
  967. computed: {
  968. //经费总合
  969. reversedMessage: function () {
  970. return (
  971. this.wordData.fund.device * 1 +
  972. this.wordData.fund.Material * 1 +
  973. this.wordData.fund.processing * 1 +
  974. this.wordData.fund.Collaboration * 1 +
  975. this.wordData.fund.APPRAISAL * 1 +
  976. this.wordData.fund.entery * 1 +
  977. this.wordData.fund.activities * 1 +
  978. this.wordData.fund.Transaction * 1
  979. );
  980. },
  981. },
  982. mounted() {
  983. this.getProjectDepartmentData();
  984. this.getData();
  985. this.getSignData();
  986. // console.log(this.$route.query['pid']);
  987. },
  988. };
  989. </script>
  990. <style lang="less" scoped>
  991. #studentProjectWordDetail {
  992. width: 100%;
  993. display: flex;
  994. flex-direction: column;
  995. align-items: center;
  996. position: relative;
  997. }
  998. </style>