reviewArea.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <template>
  2. <div class="reviewArea" v-loading="loading">
  3. <div class="pzTop2">
  4. <div class="checkbox">
  5. <div class="cb-tabList">
  6. <div :class="[commentTagShow==0?'cb-tabItem':'']" @click="commentTagShow=0">评论</div>
  7. <div :class="[commentTagShow==2?'cb-tabItem':'']" @click="commentTagShow=2">总评</div>
  8. </div>
  9. <el-select v-model="pzStype" @change="selectPz" class="selectBox" v-show="commentTagShow == 0">
  10. <el-option label="时间降序" :value="1"></el-option>
  11. <el-option label="时间升序" :value="2"></el-option>
  12. <el-option label="我的评课" :value="3"></el-option>
  13. </el-select>
  14. </div>
  15. </div>
  16. <div :class="pzList && pzList.length ? 'pzBox' : 'noPzBox'" v-if="commentTagShow==0">
  17. <div class="pzListBox" v-if="pzList && pzList.length">
  18. <div class="pzList" v-for="(pz, pzIndex) in pzList" :key="pzIndex">
  19. <div class="pzNavTop">
  20. <div>评</div>
  21. <div>
  22. {{
  23. pz.username && pz.username.length > 5
  24. ? pz.username.substring(0, 5) + "..."
  25. : pz.username
  26. }}的评论
  27. </div>
  28. <div
  29. class="pzDelete"
  30. v-if="pz.userid == userid"
  31. @click="deletePz(pz.id)"
  32. >
  33. 删除
  34. </div>
  35. </div>
  36. <div
  37. @click="checkImg(getImgList(pz.content))"
  38. class="pzContent cont"
  39. v-html="pz.content"
  40. v-if="pz.type == '1'"
  41. ></div>
  42. <div class="pzContent" v-if="pz.type == '2'">
  43. <audio :src="pz.content" controls="controls" ref="audio">
  44. Your browser does not support the audio element.
  45. </audio>
  46. </div>
  47. <div class="pzContent" v-if="pz.type == '3'">
  48. <img
  49. :src="pz.content"
  50. style="width: 90%; margin: 0 auto; display: block"
  51. @click="previewImg(pz.content)"
  52. />
  53. </div>
  54. <div class="timeAndReply">
  55. <div class="time">
  56. {{ pz.time }}
  57. </div>
  58. <div @click="setReplyIndex(pz.id, pzIndex)">回复</div>
  59. </div>
  60. <div v-if="pz.hfList && pz.hfList.length > 0" class="hfBox">
  61. <div
  62. v-for="(h, hIndex) in pz.hfList"
  63. :key="hIndex"
  64. class="hfItem"
  65. >
  66. <div class="whoReplyWho">
  67. <div class="hfName">{{ h.username }}</div>
  68. <div class="hfImg">
  69. <img src="../../../assets/icon/newIcons/right.png" alt="" />
  70. </div>
  71. <div class="hfName">{{ pz.username }}</div>
  72. </div>
  73. <div class="hfContent" v-html="h.content"></div>
  74. <div class="hfBottom">
  75. <div class="hfTime">{{ h.time }}</div>
  76. <div
  77. class="deleteHfItem"
  78. @click="deleteReply(h.id)"
  79. v-if="userid == h.userid"
  80. >
  81. <img src="../../../assets/icon/newIcons/delete.png" alt="" />
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- <div class="replyBox" v-if="replyIndex[pzIndex] && replyIndex[pzIndex] == true">
  87. <div class="replyInput">
  88. <el-input v-model="reply[pzIndex]"></el-input>
  89. </div>
  90. <el-button @click="addHf(pz.id, pzIndex)">回复</el-button>
  91. </div> -->
  92. </div>
  93. </div>
  94. <div class="noPz" v-else>
  95. <img src="../../../assets/icon/noPz.png" alt="" />
  96. </div>
  97. <div class="addPzButton">
  98. <div class="addPz" @click="(addPzDialog = true), (pzType = 1)">
  99. 添加评论
  100. </div>
  101. <!-- <div class="img1">
  102. <div @click="(addPzDialog = true), (pzType = 2)">
  103. <img src="../assets/audio.png" /><span>音频</span>
  104. </div>
  105. </div> -->
  106. </div>
  107. </div>
  108. <div class="scoreList" v-if="commentTagShow==1">
  109. <scoreItem v-for="item in scoreList.datalist" @refresh="getScoreList" :data="item" :isScore="scoreList.isScoreList.filter(i=>(i.userid==item.userid && i.courseid == item.courseId))" :key="item.courseId"/>
  110. </div>
  111. <div class="scoreList" v-if="commentTagShow==2" style="position: relative">
  112. <scoreZong :courseid="id" :userid="userid" @insertMemorandum="insertMemorandum"></scoreZong>
  113. </div>
  114. <div v-if="addPzDialog == true" class="addDialogCss" v-el-drag-dialog>
  115. <div class="pzTop">
  116. <div class="teacherPz">
  117. <div class="teacherPzImg">
  118. <img src="../../../assets/icon/teacherPz.png" alt="" />
  119. </div>
  120. <div style="margin-left: 10px; height: 25px">教师评论</div>
  121. </div>
  122. <div @click="addPzDialog = false">
  123. <img src="../../../assets/close1.png" class="pzClose" alt="" />
  124. </div>
  125. </div>
  126. <div class="addPzBox">
  127. <div class="addPzCheck">
  128. <span :class="{ isChooseActive: pzType == 1 }" @click="pzType = 1"
  129. >文本</span
  130. >
  131. <!-- <span :class="{isChooseActive:pzType==3}" @click="pzType = 3">图片</span> -->
  132. <span :class="{ isChooseActive: pzType == 2 }" @click="pzType = 2"
  133. >音频</span
  134. >
  135. </div>
  136. <div style="height: calc(100% - 95px)">
  137. <!-- <textarea class="binfo_input pzConText" cols placeholder="请填写项目课程关键问题...." v-model="pzConText"
  138. v-if="pzType == 1"></textarea> -->
  139. <editor-bar
  140. class="binfo_input pzConText"
  141. style="width: 100% !important"
  142. placeholder="请输入任务描述"
  143. v-model="pzConText"
  144. @change="change"
  145. v-if="pzType == 1"
  146. ></editor-bar>
  147. <Audio @addPz="addPz" class="pzAudioClass" v-if="pzType == 2"></Audio>
  148. <!-- <div class="pzAudioClass" v-if="pzType == 3">
  149. <div @click="addImg($event)">
  150. <el-button type="primary">上传图片</el-button>
  151. <input type="file" accept="image/png, image/gif, image/jpeg" style="display: none"
  152. @change="beforeUpload1($event, 4)" />
  153. </div>
  154. </div> -->
  155. </div>
  156. <div class="addTextCss" @click="addPz('1')" v-if="pzType == 1">
  157. 确定
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import scoreItem from '../../scoreList/scoreItem.vue'
  165. import scoreZong from '../../scoreZong/index.vue'
  166. import EditorBar from "../../tools/wangEnduit.vue";
  167. import Audio from "../../components/audio.vue";
  168. export default {
  169. components:{
  170. scoreItem,
  171. scoreZong,
  172. EditorBar,
  173. Audio
  174. },
  175. props:{
  176. taskCount:{
  177. type:Number,
  178. default:0
  179. },
  180. courseType:{
  181. type:Number,
  182. default:0
  183. },
  184. },
  185. watch:{
  186. taskCount(){
  187. this.selectPz();
  188. },
  189. courseType(){
  190. this.selectPz();
  191. }
  192. },
  193. data() {
  194. return {
  195. commentTagShow: 0,
  196. pzStype: 1,
  197. pzList: [],
  198. loading:false,
  199. pzDialog:false,
  200. id: this.$route.query.courseId,
  201. userid: this.$route.query.userid,
  202. addPzDialog:false,
  203. pzType:0,
  204. pzConText:"",
  205. scoreList:{
  206. datalist:[],
  207. isScoreList:[]
  208. },
  209. };
  210. },
  211. methods: {
  212. insertMemorandum(_html) {
  213. //保存行为操作
  214. //variable
  215. //btn
  216. let params = [
  217. {
  218. uid: this.userid,
  219. courseId: this.courseId+(this.tcid2?this.tcid2:""),
  220. content: _html
  221. }
  222. ];
  223. this.ajax
  224. .post(
  225. this.$store.state.api + "insert_systemOperation_countdownBehavior",
  226. params
  227. )
  228. .then(res => {
  229. if (res.data == 1) {
  230. console.log("保存操作成功");
  231. } else {
  232. console.log("保存操作失败");
  233. }
  234. })
  235. .catch(e => {
  236. console.log("保存操作失败");
  237. console.log(e);
  238. });
  239. },
  240. selectPz() {
  241. let params = {
  242. cid: this.id,
  243. s: this.courseType,
  244. t: this.taskCount,
  245. type: this.pzStype,
  246. uid: this.userid
  247. };
  248. this.ajax
  249. .get(this.$store.state.api + "selectPzListType", params)
  250. .then(res => {
  251. this.pzList = res.data[0];
  252. var a = res.data[1];
  253. for (var i = 0; i < a.length; i++) {
  254. for (var j = 0; j < this.pzList.length; j++) {
  255. if (!this.pzList[j].hfList) {
  256. this.pzList[j].hfList = [];
  257. }
  258. if (a[i].pid == this.pzList[j].id) {
  259. this.pzList[j].hfList.push(a[i]);
  260. }
  261. }
  262. }
  263. })
  264. .catch(err => {
  265. console.error(err);
  266. });
  267. },
  268. getScoreList(){
  269. let params = {
  270. cid: this.id,
  271. };
  272. this.ajax
  273. .get(this.$store.state.api + "selectTestCourseByCid", params)
  274. .then((res) => {
  275. let result = res.data;
  276. this.scoreList.datalist = result[0];
  277. this.scoreList.isScoreList = result[1];
  278. })
  279. .catch((err) => {
  280. console.error(err);
  281. });
  282. },
  283. addPz(type, content) {
  284. if (type == "1" && this.pzConText == "") {
  285. this.$message.error("评论不能为空!");
  286. return;
  287. }
  288. let params = [
  289. {
  290. cid: this.id,
  291. uid: this.userid,
  292. s: this.courseType,
  293. t: this.taskCount,
  294. c: type == "1" ? this.pzConText : content,
  295. type: type,
  296. },
  297. ];
  298. this.ajax
  299. .post(this.$store.state.api + "addPz2", params)
  300. .then((res) => {
  301. this.$message({
  302. message: "添加成功",
  303. type: "success",
  304. });
  305. this.pzConText = "";
  306. this.addPzDialog = false;
  307. this.selectPz();
  308. this.insertMemorandum(`使用<span class="btn">评论</span>功能,添加评论`)
  309. })
  310. .catch((err) => {
  311. this.$message.error("添加失败");
  312. console.error(err);
  313. });
  314. },
  315. change(val){
  316. console.log(val);
  317. }
  318. },
  319. mounted() {
  320. this.selectPz();
  321. this.getScoreList();
  322. },
  323. };
  324. </script>
  325. <style scoped>
  326. .reviewArea {
  327. width: 100%;
  328. height: 100%;
  329. }
  330. .pzTop2 .check {
  331. text-align: center;
  332. cursor: pointer;
  333. box-sizing: border-box;
  334. display: flex;
  335. }
  336. .pzTop2 img {
  337. width: 25px;
  338. cursor: pointer;
  339. }
  340. .pzTop2 .checkbox {
  341. display: flex;
  342. align-items: center;
  343. padding: 5px 10px;
  344. flex: 0 0 auto;
  345. font-weight: bold;
  346. border-bottom: 1px solid #eee;
  347. justify-content: space-between;
  348. }
  349. .checkbox>.cb-tabList{
  350. height:40px;
  351. display:flex;
  352. align-items:center;
  353. }
  354. .cb-tabList>div{
  355. margin-right:20px;
  356. font-weight:400;
  357. cursor:pointer;
  358. }
  359. .cb-tabList>.cb-tabItem{
  360. color:#1684FC;
  361. position:relative;
  362. }
  363. .cb-tabItem::after{
  364. content:"";
  365. width:100%;
  366. height:2px;
  367. background:#1684FC;
  368. position:absolute;
  369. bottom:-5px;
  370. left:0
  371. }
  372. .pzBox,
  373. .noPzBox {
  374. height: calc(100% - 60px);
  375. /* background: #ededed; */
  376. background: #fff;
  377. /* border-radius: 0 0 15px 15px; */
  378. }
  379. .noPzBox {
  380. display: flex;
  381. flex-direction: column;
  382. flex-wrap: nowrap;
  383. justify-content: center;
  384. align-items: center;
  385. }
  386. .pzList {
  387. background: #f7f7f7;
  388. width: 90%;
  389. margin: 0 auto 15px;
  390. border-radius: 5px;
  391. }
  392. .pzNavTop {
  393. display: flex;
  394. flex-direction: row;
  395. flex-wrap: nowrap;
  396. padding: 10px 10px 0 10px;
  397. align-items: center;
  398. }
  399. .pzDelete {
  400. cursor: pointer;
  401. margin-left: auto;
  402. font-size: 14px;
  403. color: #afafaf;
  404. }
  405. .pzNavTop > div:nth-child(1) {
  406. background: #3760af;
  407. width: 35px;
  408. height: 35px;
  409. color: #fff;
  410. text-align: center;
  411. line-height: 35px;
  412. border-radius: 50%;
  413. font-size: 14px;
  414. }
  415. .pzNavTop > div:nth-child(2) {
  416. font-size: 18px;
  417. color: #959595;
  418. margin-left: 5px;
  419. }
  420. .pzContent {
  421. padding: 10px;
  422. word-break: break-word;
  423. }
  424. .pzContent audio {
  425. width: 100%;
  426. }
  427. .pzContent audio::-webkit-media-controls-panel {
  428. background: #fff;
  429. }
  430. .pzContent >>> img {
  431. max-width: 100%;
  432. }
  433. .pzListBox {
  434. padding-top: 15px;
  435. height: calc(100% - 110px);
  436. overflow: auto;
  437. }
  438. .addPzButton {
  439. position: relative;
  440. margin-top: 3px;
  441. width: 100%;
  442. }
  443. .addPzButton .img1 {
  444. position: absolute;
  445. top: 50%;
  446. right: 25px;
  447. transform: translateY(-50%);
  448. height: 100%;
  449. display: flex;
  450. align-items: center;
  451. }
  452. .addPzButton .img1 div {
  453. display: flex;
  454. }
  455. .addPzButton .img1 div img {
  456. width: 28px;
  457. margin-left: 10px;
  458. cursor: pointer;
  459. }
  460. .addPzButton .img1 div span {
  461. font-size: 14px;
  462. margin: 4px 0 0 3px;
  463. color: #afafaf;
  464. }
  465. .addPz {
  466. background: #4b79ce;
  467. width: 100px;
  468. color: #fff;
  469. font-size: 12px;
  470. height: 30px;
  471. margin: 0 auto;
  472. text-align: center;
  473. line-height: 30px;
  474. border-radius: 10px;
  475. cursor: pointer;
  476. }
  477. .addDialogCss {
  478. position: fixed;
  479. width: 600px;
  480. height: 70%;
  481. min-height: 450px;
  482. box-shadow: 0px 0 8px 0px #555555;
  483. border-radius: 15px;
  484. z-index: 999;
  485. left: 50%;
  486. top: 50%;
  487. margin: -18% 0 0 -300px;
  488. }
  489. .teacherPz {
  490. display: flex;
  491. flex-direction: row;
  492. align-items: center;
  493. flex-wrap: nowrap;
  494. }
  495. .teacherPzImg {
  496. width: 30px;
  497. height: 30px;
  498. }
  499. .teacherPzImg > img {
  500. width: 100%;
  501. height: 100%;
  502. }
  503. .addPzBox {
  504. height: calc(100% - 40px);
  505. background: #ededed;
  506. border-bottom-left-radius: 15px;
  507. border-bottom-right-radius: 15px;
  508. }
  509. .pzAudioClass {
  510. margin: 15px 14px;
  511. background: #fff;
  512. height: 100%;
  513. display: flex;
  514. justify-content: center;
  515. align-items: center;
  516. }
  517. .pzConText {
  518. width: 95%;
  519. height: 100%;
  520. margin: 10px auto 0;
  521. border: none;
  522. background: #fff;
  523. border-radius: 0px;
  524. }
  525. .pzConText >>> .text {
  526. height: calc(100% - 82px);
  527. }
  528. .whoReplyWho > .hfImg {
  529. width: 12px;
  530. height: 12px;
  531. margin: 0 5px;
  532. }
  533. .whoReplyWho > .hfImg > img {
  534. width: 100%;
  535. height: 100%;
  536. }
  537. .hfContent {
  538. padding-top: 10px;
  539. box-sizing: border-box;
  540. display: -webkit-box;
  541. overflow: hidden;
  542. white-space: normal !important;
  543. text-overflow: ellipsis;
  544. word-wrap: break-word;
  545. -webkit-box-orient: vertical;
  546. }
  547. .hfTime {
  548. text-align: left;
  549. box-sizing: border-box;
  550. padding: 10px 0 10px 0px;
  551. color: #bfbfbf;
  552. font-size: 14px;
  553. }
  554. .timeAndReply {
  555. display: flex;
  556. flex-direction: row;
  557. flex-wrap: nowrap;
  558. justify-content: space-between;
  559. align-items: center;
  560. font-size: 14px;
  561. box-sizing: border-box;
  562. padding: 0 10px 10px 0px;
  563. }
  564. .timeAndReply .time {
  565. color: #bfbfbf;
  566. padding: 0 0 0 10px;
  567. box-sizing: border-box;
  568. }
  569. .timeAndReply > div:last-child {
  570. cursor: pointer;
  571. color: #777;
  572. }
  573. .hfBox {
  574. padding: 10px;
  575. box-sizing: border-box;
  576. }
  577. .whoReplyWho {
  578. display: flex;
  579. flex-direction: row;
  580. flex-wrap: nowrap;
  581. align-items: baseline;
  582. justify-content: flex-start;
  583. }
  584. .hfBottom {
  585. display: flex;
  586. flex-direction: row;
  587. flex-wrap: nowrap;
  588. align-items: center;
  589. justify-content: space-between;
  590. font-size: 14px;
  591. }
  592. .deleteHfItem {
  593. cursor: pointer;
  594. width: 20px;
  595. height: 20px;
  596. }
  597. .deleteHfItem > img {
  598. width: 100%;
  599. height: 100%;
  600. }
  601. .addPzCheck {
  602. display: flex;
  603. flex-direction: row;
  604. flex-wrap: nowrap;
  605. padding: 10px 15px 0;
  606. }
  607. .addPzCheck span {
  608. cursor: pointer;
  609. padding-bottom: 5px;
  610. font-weight: bold;
  611. }
  612. .addPzCheck span + span {
  613. margin-left: 10px;
  614. }
  615. .addPzCheck .isChooseActive {
  616. color: #3e88f4;
  617. border-bottom: 2px solid #2f80f3;
  618. }
  619. .pzTop {
  620. color: #fff;
  621. background: #000;
  622. display: flex;
  623. flex-direction: row;
  624. flex-wrap: nowrap;
  625. align-items: center;
  626. justify-content: space-between;
  627. height: 40px;
  628. border-radius: 15px 15px 0 0;
  629. user-select: none;
  630. }
  631. .pzTop > div:nth-child(1) {
  632. padding-left: 10px;
  633. }
  634. .pzTop > div:nth-child(2) {
  635. width: 15px;
  636. height: 15px;
  637. padding-right: 10px;
  638. cursor: pointer;
  639. }
  640. .pzTop > div:nth-child(2) > img {
  641. width: 100%;
  642. height: 100%;
  643. }
  644. .addTextCss {
  645. background: #4b79ce;
  646. width: 80px;
  647. height: 30px;
  648. text-align: center;
  649. color: #fff;
  650. line-height: 30px;
  651. border-radius: 10px;
  652. margin: 10px auto 0;
  653. cursor: pointer;
  654. }
  655. .scoreList{
  656. width:100%;
  657. height:100%;
  658. box-sizing:border-box;
  659. padding:10px 15px;
  660. overflow:auto;
  661. padding-bottom:80px;
  662. }
  663. </style>