tbjy.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <!-- 双师一生 -->
  3. <div class="ssysContent">
  4. <el-card>
  5. <div style="padding: 0 75px">
  6. <span class="title">同步教研</span>
  7. <span class="subTitle">我的课程 - 我创建的 - <span style="color: #000">同步教研</span></span>
  8. </div>
  9. </el-card>
  10. <div class="searchDiv" style="display: flex; justify-content: flex-end">
  11. <el-button type="primary" @click="addData()">创建</el-button>
  12. <div class="searchValue">
  13. <input type="text" placeholder="搜索关键字" v-model="keyword" />
  14. <div class="searchBtn" @click="initData">
  15. <img src="/kczy/searchIcon.png" alt="" />
  16. </div>
  17. </div>
  18. </div>
  19. <div class="line"></div>
  20. <div class="nav">
  21. <div>
  22. <span>年级</span>
  23. <el-tabs v-model="firstForm.grade" @click="initData">
  24. <el-tab-pane v-for="(item, index) in gradeList" :key="index" :label="item.grade_name" :name="item.grade_id"></el-tab-pane>
  25. </el-tabs>
  26. </div>
  27. <div>
  28. <span>科目</span>
  29. <el-tabs v-model="firstForm.subject" @click="initData">
  30. <el-tab-pane v-for="(item, index) in subjectList" :key="index" :label="item.subject_name" :name="item.subject_id"></el-tab-pane>
  31. </el-tabs>
  32. </div>
  33. </div>
  34. <div class="list-right">
  35. <div v-for="(item, index) in wholeData" :key="index">
  36. <div class="img-show"><img :src="https + item.zt_img" alt="" /></div>
  37. <div class="main">
  38. <p class="main-title">{{ item.zt_name }}</p>
  39. <img @click="editData(item.zt_id)" class="edit" src="@/assets/img/edit.png" alt="" />
  40. <img @click="deleteData(item.zt_id)" class="delete" src="@/assets/img/delete.png" alt="" />
  41. <p class="main-content">{{ item.zt_content }}</p>
  42. <div>
  43. <el-avatar style="width: 24px;height: 24px;" :size=" 16" :src="getAvatarUrl(item.user_id)" />
  44. <span style="margin-left: 8px;color: #050026;vertical-align:top">{{ item.zt_zrjs }}</span>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { grade_list, tbjy_list, subject_list, tbjy_delete } from "./api";
  53. import { getFullUrl, getAvatarUrl } from '@/utils/helper';
  54. export default {
  55. data() {
  56. return {
  57. activeName: "1",
  58. wholeData: [],
  59. resultData: [],
  60. keyword: "",
  61. https: window.GLOBAL_CONFIG.api,
  62. gradeList: [],
  63. subjectList: [],
  64. grade_id: "",
  65. subject_id: "",
  66. firstForm: {
  67. grade: "",
  68. subject: "",
  69. },
  70. isRead: false,
  71. };
  72. },
  73. methods: {
  74. //年级
  75. gradeListData() {
  76. let data = {
  77. page: 1,
  78. limit: 9999,
  79. };
  80. grade_list(data).then((res) => {
  81. if (res.code == 1) {
  82. this.gradeList = res.data.page_data;
  83. let obj = {
  84. grade_id: "",
  85. grade_name: "全部",
  86. };
  87. this.gradeList.unshift(obj);
  88. }
  89. });
  90. },
  91. //科目列表
  92. subjectListData() {
  93. let data = {
  94. page: 1,
  95. limit: 9999,
  96. };
  97. subject_list(data).then((res) => {
  98. if (res.code == 1) {
  99. this.subjectList = res.data.page_data;
  100. let obj = {
  101. subject_id: "",
  102. subject_name: "全部",
  103. };
  104. this.subjectList.unshift(obj);
  105. }
  106. });
  107. },
  108. initData() {
  109. let data = {
  110. page: this.page,
  111. limit: this.limit,
  112. keyword: this.keyword,
  113. grade_id: this.firstForm.grade,
  114. subject_id: this.firstForm.subject,
  115. };
  116. tbjy_list(data).then((res) => {
  117. if (res.code == 1) {
  118. this.wholeData = res.data.page_data;
  119. }
  120. });
  121. },
  122. addData() {
  123. this.$router.push({ name: "tbjy-create" });
  124. },
  125. editData(id) {
  126. this.$router.push({ name: "tbjy-create", query: { id: id } });
  127. },
  128. deleteData(id) {
  129. let data = {
  130. zt_id: id,
  131. };
  132. this.$confirm("确认删除该课程?", "提示", {
  133. confirmButtonText: "确定",
  134. cancelButtonText: "取消",
  135. type: "warning",
  136. })
  137. .then(() => {
  138. tbjy_delete(data).then((res) => {
  139. if (res.code == 1) {
  140. this.$message({
  141. message: "课程删除成功!",
  142. type: "success",
  143. });
  144. this.initData();
  145. } else {
  146. this.$message({
  147. message: res.msg,
  148. type: "error",
  149. });
  150. }
  151. });
  152. })
  153. .catch(() => { });
  154. },
  155. },
  156. // async created() {
  157. // await this.gradeListData();
  158. // await this.subjectListData();
  159. // },
  160. mounted() {
  161. this.initData();
  162. this.gradeListData();
  163. this.subjectListData();
  164. // const _this = this;
  165. // document.onkeydown = function (e) {
  166. // e = window.event || e;
  167. // if (
  168. // _this.$route.name == "course-ssys" &&
  169. // (e.code === "Enter" || e.code === "enter")
  170. // ) {
  171. // // 登录事件
  172. // _this.initData();
  173. // }
  174. // };
  175. },
  176. };
  177. </script>
  178. <style lang="scss" scoped>
  179. .ssysContent {
  180. .el-card {
  181. margin-bottom: 15px;
  182. background: #fff;
  183. }
  184. .pointer {
  185. cursor: pointer;
  186. }
  187. .title {
  188. font-size: 18px;
  189. color: #050026;
  190. }
  191. .subTitle {
  192. font-size: 14px;
  193. color: #949494;
  194. margin-left: 45px;
  195. }
  196. .searchDiv {
  197. display: flex;
  198. justify-content: space-between;
  199. align-items: center;
  200. padding: 0 80px;
  201. .menuDiv {
  202. display: flex;
  203. margin-bottom: -10px;
  204. .list {
  205. margin: 0 20px;
  206. padding: 0 10px;
  207. color: #949494;
  208. position: relative;
  209. line-height: 40px;
  210. font-size: 14px;
  211. &::after {
  212. content: "";
  213. width: 0;
  214. height: 2px;
  215. background: rgba(0, 131, 197, 0.8);
  216. position: absolute;
  217. bottom: -10px;
  218. left: 50%;
  219. transform: translateX(-50%);
  220. transition: width linear 0.1s;
  221. }
  222. &:hover {
  223. color: rgba(0, 131, 197, 0.8);
  224. }
  225. &.active {
  226. color: rgba(0, 131, 197, 0.8);
  227. font-size: 16px;
  228. &::after {
  229. width: 100%;
  230. }
  231. }
  232. }
  233. }
  234. .el-button {
  235. width: 100px;
  236. height: 40px;
  237. margin-right: 40px;
  238. }
  239. .searchValue {
  240. width: 350px;
  241. height: 50px;
  242. background: #ffffff;
  243. border-radius: 8px;
  244. overflow: hidden;
  245. position: relative;
  246. input {
  247. width: 100%;
  248. height: 100%;
  249. outline: 0;
  250. box-sizing: border-box;
  251. padding-left: 10px;
  252. background: #f6f8fa;
  253. }
  254. .searchBtn {
  255. width: 26px;
  256. height: 26px;
  257. background: #00a3ff;
  258. border-radius: 6px;
  259. position: absolute;
  260. right: 5px;
  261. top: 50%;
  262. transform: translate(-50%, -50%);
  263. text-align: center;
  264. vertical-align: middle;
  265. cursor: pointer;
  266. img {
  267. display: block;
  268. text-align: center;
  269. margin: 6px auto 0;
  270. }
  271. }
  272. }
  273. }
  274. .line {
  275. height: 1px;
  276. background: #eaeaea;
  277. width: calc(100% + 40px);
  278. margin-left: -20px;
  279. margin-top: 10px;
  280. }
  281. .nav {
  282. width: 1400px;
  283. margin: 0 auto;
  284. display: flex;
  285. flex-direction: column;
  286. margin-bottom: 20px;
  287. div {
  288. display: flex;
  289. span {
  290. padding-top: 10px;
  291. display: inline-block;
  292. width: 50px;
  293. height: 50px;
  294. font-size: 16px;
  295. font-family: PingFangSC, PingFangSC-Semibold;
  296. font-weight: 600;
  297. text-align: center;
  298. color: #000000;
  299. line-height: 21px;
  300. }
  301. }
  302. }
  303. .list-right {
  304. width: 1400px;
  305. display: flex;
  306. flex-wrap: wrap;
  307. margin: 0 auto;
  308. & > div {
  309. box-sizing: border-box;
  310. width: 680px;
  311. height: 150px;
  312. display: flex;
  313. margin-bottom: 20px;
  314. box-shadow: 0px 15px 24px 0px rgba(161, 153, 168, 0.18);
  315. &:nth-of-type(odd) {
  316. margin-right: 40px;
  317. }
  318. .img-show {
  319. width: 263px;
  320. height: 150px;
  321. border-radius: 12px;
  322. overflow: hidden;
  323. img {
  324. width: 100%;
  325. height: 100%;
  326. }
  327. }
  328. .main {
  329. display: flex;
  330. flex-direction: column;
  331. margin-left: 12px;
  332. width: 450px;
  333. position: relative;
  334. .main-title {
  335. width: 60%;
  336. vertical-align: top;
  337. font-size: 16px;
  338. font-family: PingFangSC, PingFangSC-Medium;
  339. font-weight: 500;
  340. text-align: left;
  341. color: #050026;
  342. line-height: 22px;
  343. margin-bottom: 5px;
  344. word-wrap: break-word;
  345. text-overflow: ellipsis;
  346. display: -webkit-box;
  347. -webkit-box-orient: vertical;
  348. -webkit-line-clamp: 1;
  349. overflow: hidden;
  350. }
  351. .edit,
  352. .delete {
  353. width: 18px;
  354. height: 17px;
  355. position: absolute;
  356. top: 10px;
  357. right: 10px;
  358. }
  359. .edit {
  360. position: absolute;
  361. top: 10px;
  362. right: 50px;
  363. }
  364. .main-content {
  365. margin-top: 5px;
  366. width: 80%;
  367. font-size: 14px;
  368. height: 35px;
  369. word-wrap: break-word;
  370. text-overflow: ellipsis;
  371. display: -webkit-box;
  372. -webkit-box-orient: vertical;
  373. -webkit-line-clamp: 2;
  374. overflow: hidden;
  375. color: #949494;
  376. line-height: 17px;
  377. }
  378. div {
  379. width: 186px;
  380. height: 20px;
  381. display: inline-block;
  382. font-size: 14px;
  383. font-family: PingFangSC, PingFangSC-Medium;
  384. font-weight: 500;
  385. text-align: left;
  386. color: #050026;
  387. line-height: 20px;
  388. position: absolute;
  389. bottom: 10px;
  390. left: 0px;
  391. img {
  392. display: inline-block;
  393. width: 24px;
  394. height: 24px;
  395. border-radius: 50%;
  396. margin-right: 8px;
  397. }
  398. }
  399. }
  400. }
  401. }
  402. }
  403. </style>
  404. <style lang="scss" >
  405. .ssysContent {
  406. .resultCard .el-card__body {
  407. padding: 0 !important;
  408. }
  409. }
  410. </style>