templateDialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <el-dialog :center="true" :visible.sync="dialogVisibleTemplate" width="1200px" class="addTemplateDialog">
  3. <!-- <div v-if="showDialog == true" class="a-dialog" v-el-drag-dialog> -->
  4. <div class="a-d-top">
  5. <div class="a-d-topTit">
  6. <div style="width: 136px">模板库</div>
  7. </div>
  8. <div>
  9. <el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="input2" clearable>
  10. </el-input>
  11. </div>
  12. <div class="a-d-t-right">
  13. <el-button @click="open2()" type="primary" size="small" style="margin-right: 10px;">设置模板</el-button>
  14. <span @click.stop="close">×</span>
  15. </div>
  16. </div>
  17. <div style="display: flex; height: calc(100% - 10px)">
  18. <div class="a-d-t-left">
  19. <div :style="tagIndex == item.id
  20. ? 'background: rgba(226, 238, 255, 1);color: rgba(54, 129, 252, 1)'
  21. : ''
  22. " class="a-d-t-l-item" v-for="(item) in dialogTagList" :key="item.id"
  23. @click.stop="setTagIndex(item.id)">
  24. {{ item.name }}
  25. </div>
  26. </div>
  27. <div class="a-d-box">
  28. <div style="
  29. font-family: PingFang SC;
  30. font-size: 16px;
  31. font-weight: 600;
  32. line-height: 22px;
  33. text-align: left;
  34. margin: 20px 0;
  35. margin-bottom: 10px;
  36. ">
  37. {{ tagname }}
  38. </div>
  39. <div style="display: flex; flex-wrap: wrap;height:100%" v-loading="loading">
  40. <div class="a-d-b-item" v-for="(item, index) in searchDataList" :key="index">
  41. <div class="a-d-b-i-top">
  42. <img style="height: 22px; width: 22px" :src="require('../../../assets/icon/classroomObservation/digImg.svg')
  43. " />
  44. <el-tooltip :content="item.name" placement="top" effect="dark">
  45. <!-- content to trigger tooltip here -->
  46. <div class="a-d-b-i-t-title">{{ item.name }}</div>
  47. </el-tooltip>
  48. </div>
  49. <!-- <div class="a-d-b-i-top" v-if="item.uname">创建人:{{ item.uname }}</div> -->
  50. <div class="a-d-b-i-top" v-show="false">创建人:{{ item.uname }}</div>
  51. <!-- <el-tooltip :content="item.detail" placement="top" effect="dark"> -->
  52. <div class="a-d-b-i-bottom">{{ item.detail }}</div>
  53. <!-- </el-tooltip> -->
  54. <div class="a-d-b-i-bottomBtn">
  55. <div style="
  56. display: flex;
  57. width: 100%;
  58. justify-content: space-around;
  59. ">
  60. <div class="a-d-b-i-t-btn" v-if="item.userid == userid" style="margin-right: 10px;"
  61. @click="deleteA(item.id)">删除</div>
  62. <div class="a-d-b-i-t-btn1" v-if="item.userid == userid" style="margin-right: 10px;"
  63. @click="open2(item.id)">修改</div>
  64. <div class="a-d-b-i-t-btn1" @click="open(item.id)">
  65. 使用
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div v-if="!searchDataList.length" style="text-align: center;">暂无内容</div>
  71. </div>
  72. </div>
  73. </div>
  74. <!-- </div> -->
  75. </el-dialog>
  76. </template>
  77. <script>
  78. export default {
  79. props: {
  80. dialogVisibleTemplate: {
  81. type: Boolean,
  82. default: false
  83. },
  84. userid: {
  85. type: String
  86. },
  87. org: {
  88. type: String
  89. },
  90. oid: {
  91. type: String
  92. }
  93. },
  94. data() {
  95. return {
  96. dialogTagList: [
  97. { id: '2', name: "社区模板" },
  98. { id: '1', name: "我的模板" },
  99. ],
  100. tagIndex: '2',
  101. searchDataList: [],
  102. input2: '',
  103. loading: false
  104. }
  105. },
  106. computed: {
  107. tagname() {
  108. return this.dialogTagList.filter((item) => {
  109. return item.id == this.tagIndex
  110. })[0].name
  111. }
  112. },
  113. watch: {
  114. dialogVisibleTemplate(newValue, oldValue) {
  115. if (newValue) {
  116. this.getList();
  117. }
  118. },
  119. input2(newValue) {
  120. this.getList();
  121. }
  122. },
  123. methods: {
  124. handleClose(done) {
  125. this.close()
  126. done();
  127. },
  128. close() {
  129. this.$emit('update:dialogVisibleTemplate', false)
  130. },
  131. confirm() {
  132. this.$emit('update:dialogVisibleTemplate', false)
  133. },
  134. setTagIndex(index) {
  135. this.tagIndex = index
  136. this.getList();
  137. },
  138. open(id) {
  139. this.$emit('goToCourseTemplate', id)
  140. },
  141. open2(id) {
  142. this.$emit('goToCourseTemplate2', id)
  143. },
  144. deleteA(id) {
  145. let _this = this
  146. _this.$confirm(
  147. "确定删除此模板吗?",
  148. "提示",
  149. {
  150. confirmButtonText: "确定",
  151. cancelButtonText: "取消",
  152. type: "warning",
  153. }
  154. )
  155. .then(() => {
  156. let params = [{
  157. id: id
  158. }]
  159. _this.ajax
  160. .post(_this.$store.state.api + "deleteTipsTemplateHK", params)
  161. .then((res) => {
  162. _this.$message.success("删除成功");
  163. _this.getList()
  164. })
  165. .catch((err) => {
  166. _this.$message.error("网络不佳");
  167. console.error(err);
  168. });
  169. })
  170. .catch(() => {
  171. return;
  172. });
  173. },
  174. getList() {
  175. this.loading = true
  176. let params = {
  177. userid: this.userid,
  178. oid: this.oid,
  179. org: this.org,
  180. type: this.tagIndex,
  181. name: this.input2
  182. }
  183. this.ajax
  184. .get(this.$store.state.api + "selectTipsTemplateHK", params)
  185. .then((res) => {
  186. this.loading = false
  187. this.searchDataList = res.data[0]
  188. if (!this.input2) {
  189. // this.searchDataList.unshift(
  190. // {
  191. // name: "项目式学习 (Project-Based Learning, PBL)",
  192. // detail: "项目式学习是一种以学生为中心的教学方法,通过实际项目和问题解决,培养学生的深度学习和应用能力。",
  193. // id:''
  194. // });
  195. }
  196. })
  197. .catch((err) => {
  198. this.$message.error("网络不佳");
  199. console.error(err);
  200. });
  201. }
  202. },
  203. }
  204. </script>
  205. <style scoped>
  206. .addTemplateDialog>>>.el-dialog {
  207. /* min-width: 1200px; */
  208. max-width: 100%;
  209. margin-top: 8vh !important;
  210. height: 700px;
  211. box-shadow: 0px 0 8px 0px #555555;
  212. border-radius: 8px;
  213. background-color: #fff;
  214. /* top: 0px; */
  215. /* margin: 0 auto; */
  216. overflow: hidden;
  217. }
  218. .addTemplateDialog>>>.el-dialog__body {
  219. height: 100%;
  220. /* min-width: 1200px; */
  221. max-width: 100%;
  222. flex-shrink: 0;
  223. box-sizing: border-box;
  224. padding-bottom: 50px;
  225. padding-top: 10px;
  226. }
  227. .addTemplateDialog>>>.el-dialog__header {
  228. display: none;
  229. }
  230. .a-d-top {
  231. /* background: #adadad; */
  232. display: flex;
  233. flex-direction: row;
  234. flex-wrap: nowrap;
  235. align-items: center;
  236. justify-content: space-between;
  237. height: 54px;
  238. border-radius: 8px 8px 0 0;
  239. user-select: none;
  240. border-bottom: 1px #ccc solid;
  241. }
  242. .a-d-top>>>.el-input__inner {
  243. width: 320px;
  244. height: 32px;
  245. }
  246. .a-d-top>>>.el-input__icon {
  247. line-height: 32px;
  248. }
  249. .a-d-topTit {
  250. width: 171px;
  251. height: 32px;
  252. display: flex;
  253. align-items: center;
  254. font-family: PingFang SC;
  255. box-sizing: border-box;
  256. padding: 5px;
  257. line-height: 22px;
  258. justify-content: center;
  259. /* text-align: left; */
  260. }
  261. .a-d-t-left {
  262. width: 200px;
  263. height: 100%;
  264. display: flex;
  265. align-items: center;
  266. flex-direction: column;
  267. justify-content: flex-start;
  268. box-sizing: border-box;
  269. padding: 15px 0 0 0;
  270. }
  271. .a-d-t-l-item {
  272. /* width: auto;
  273. height: 90%;
  274. display: flex;
  275. justify-content: center;
  276. align-items: center;
  277. padding: 0 10px;
  278. border-radius: 10px;
  279. background-color: #d4d9da;
  280. margin-right: 3px;
  281. cursor: pointer; */
  282. cursor: pointer;
  283. width: 136px;
  284. height: 32px;
  285. display: flex;
  286. align-items: center;
  287. border-radius: 5px;
  288. font-family: PingFang SC;
  289. box-sizing: border-box;
  290. padding: 5px;
  291. font-size: 14px;
  292. font-weight: 600;
  293. line-height: 22px;
  294. text-align: left;
  295. margin-bottom: 20px;
  296. }
  297. .a-d-t-l-item:hover {
  298. background-color: white;
  299. }
  300. .a-d-t-right {
  301. /* width: 40px; */
  302. height: 40px;
  303. margin-right: 10px;
  304. display: flex;
  305. justify-content: center;
  306. align-items: center;
  307. color: black !important;
  308. }
  309. .a-d-t-right>span {
  310. width: 25px;
  311. height: 25px;
  312. border-radius: 25px;
  313. display: flex;
  314. align-items: center;
  315. justify-content: center;
  316. /* align-items: center; */
  317. font-size: 22px;
  318. color: #fff;
  319. /* background-color: #adadad; */
  320. cursor: pointer;
  321. /* background-color: #e6e6e6; */
  322. color: #adadad;
  323. }
  324. .a-d-box {
  325. width: 100%;
  326. height: 100%;
  327. background-color: #f0f2f5;
  328. overflow: scroll;
  329. overflow-x: hidden;
  330. box-sizing: border-box;
  331. padding: 15px;
  332. padding-bottom: 50px;
  333. }
  334. .a-d-b-item {
  335. width: 30%;
  336. height: 240px;
  337. display: flex;
  338. flex-direction: column;
  339. background-color: #fff;
  340. border-radius: 10px;
  341. padding: 15px;
  342. float: left;
  343. box-sizing: border-box;
  344. margin-bottom: 10px;
  345. margin-right: 20px;
  346. /* position: relative; */
  347. }
  348. /* .a-d-b-item:hover .a-d-b-i-bottomBtn {
  349. display: block !important;
  350. }
  351. .a-d-b-item:hover .a-d-b-i-bottomPer {
  352. display: none !important;
  353. } */
  354. .a-d-b-i-top {
  355. width: 100%;
  356. /* height: 50%; */
  357. height: 20px;
  358. margin-bottom: 5px;
  359. display: flex;
  360. align-items: center;
  361. /* justify-content: space-between; */
  362. }
  363. .a-d-b-i-top>img {
  364. width: 35px;
  365. height: 35px;
  366. }
  367. /* .a-d-b-i-top>div{ */
  368. /* width: auto;
  369. height: 35px;
  370. display: flex;
  371. justify-content: center;
  372. align-items: center;
  373. margin-left: 10px; */
  374. /* } */
  375. .a-d-b-i-t-title {
  376. width: 100%;
  377. height: 35px;
  378. display: block;
  379. align-items: center;
  380. box-sizing: border-box;
  381. padding: 0 10px;
  382. text-overflow: ellipsis;
  383. overflow: hidden;
  384. word-break: break-all;
  385. white-space: nowrap;
  386. line-height: 35px;
  387. /* display: -webkit-box;
  388. -webkit-box-orient: vertical;
  389. -webkit-line-clamp: 1;
  390. overflow: hidden; */
  391. }
  392. .a-d-b-i-bottom {
  393. width: 100%;
  394. flex: 1;
  395. overflow: hidden;
  396. /* max-height: 186px; */
  397. max-height: 100px;
  398. height: 140px;
  399. min-height: 140px;
  400. font-size: 14px;
  401. -webkit-line-clamp: 7;
  402. line-height: 20px;
  403. display: -webkit-box;
  404. -webkit-box-orient: vertical;
  405. overflow: hidden;
  406. text-overflow: ellipsis;
  407. }
  408. .a-d-b-i-t-btn {
  409. font-size: 14px;
  410. width: 98%;
  411. box-sizing: border-box;
  412. padding: 8px 0;
  413. border: 1px solid rgb(247, 30, 30);
  414. border-radius: 5px;
  415. color: rgb(247, 30, 30);
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. cursor: pointer;
  420. }
  421. .a-d-b-i-t-btn1 {
  422. font-size: 14px;
  423. width: 98%;
  424. box-sizing: border-box;
  425. padding: 8px 0;
  426. border: 1px solid rgba(54, 129, 252, 1);
  427. border-radius: 5px;
  428. background-color: rgba(54, 129, 252, 1);
  429. display: flex;
  430. color: #fff;
  431. justify-content: center;
  432. align-items: center;
  433. cursor: pointer;
  434. }
  435. .itemTit {
  436. width: 136px;
  437. height: 32px;
  438. padding: 5px 8px 5px 8px;
  439. gap: 8px;
  440. opacity: 0px;
  441. margin: 20px 0;
  442. margin-bottom: 10px;
  443. border-bottom: 1px #ccc solid;
  444. }
  445. .a-d-b-subject {
  446. margin: 20px 0 20px 0;
  447. }
  448. .a_d_b_s_btn {
  449. /* box-sizing: border-box; */
  450. padding: 5px 10px;
  451. border-radius: 4px;
  452. border: solid 1px #3681FC;
  453. color: #3681FC;
  454. background-color: white;
  455. margin-right: 10px;
  456. cursor: pointer;
  457. transition: .3s;
  458. }
  459. .a_d_b_s_ActiveBtn {
  460. background-color: #3681FC;
  461. color: white;
  462. }
  463. </style>