templateDialog.vue 13 KB

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