123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- <template>
- <!-- 双师一生 -->
- <div class="ssysContent">
- <el-card>
- <div style="padding: 0 75px">
- <span class="title">同步教研</span>
- <span class="subTitle">我的课程 - 我创建的 - <span style="color: #000">同步教研</span></span>
- </div>
- </el-card>
- <div class="searchDiv" style="display: flex; justify-content: flex-end">
- <el-button type="primary" @click="addData()">创建</el-button>
- <div class="searchValue">
- <input type="text" placeholder="搜索关键字" v-model="keyword" />
- <div class="searchBtn" @click="initData">
- <img src="/kczy/searchIcon.png" alt="" />
- </div>
- </div>
- </div>
- <div class="line"></div>
- <div class="nav">
- <div>
- <span>年级</span>
- <el-tabs v-model="firstForm.grade" @click="initData">
- <el-tab-pane v-for="(item, index) in gradeList" :key="index" :label="item.grade_name" :name="item.grade_id"></el-tab-pane>
- </el-tabs>
- </div>
- <div>
- <span>科目</span>
- <el-tabs v-model="firstForm.subject" @click="initData">
- <el-tab-pane v-for="(item, index) in subjectList" :key="index" :label="item.subject_name" :name="item.subject_id"></el-tab-pane>
- </el-tabs>
- </div>
- </div>
- <div class="list-right">
- <div v-for="(item, index) in wholeData" :key="index">
- <div class="img-show"><img :src="https + item.zt_img" alt="" /></div>
- <div class="main">
- <p class="main-title">{{ item.zt_name }}</p>
- <img @click="editData(item.zt_id)" class="edit" src="@/assets/img/edit.png" alt="" />
- <img @click="deleteData(item.zt_id)" class="delete" src="@/assets/img/delete.png" alt="" />
- <p class="main-content">{{ item.zt_content }}</p>
- <div>
- <el-avatar style="width: 24px;height: 24px;" :size=" 16" :src="getAvatarUrl(item.user_id)" />
- <span style="margin-left: 8px;color: #050026;vertical-align:top">{{ item.zt_zrjs }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { grade_list, tbjy_list, subject_list, tbjy_delete } from "./api";
- import { getFullUrl, getAvatarUrl } from '@/utils/helper';
- export default {
- data() {
- return {
- activeName: "1",
- wholeData: [],
- resultData: [],
- keyword: "",
- https: window.GLOBAL_CONFIG.api,
- gradeList: [],
- subjectList: [],
- grade_id: "",
- subject_id: "",
- firstForm: {
- grade: "",
- subject: "",
- },
- isRead: false,
- };
- },
- methods: {
- //年级
- gradeListData() {
- let data = {
- page: 1,
- limit: 9999,
- };
- grade_list(data).then((res) => {
- if (res.code == 1) {
- this.gradeList = res.data.page_data;
- let obj = {
- grade_id: "",
- grade_name: "全部",
- };
- this.gradeList.unshift(obj);
- }
- });
- },
- //科目列表
- subjectListData() {
- let data = {
- page: 1,
- limit: 9999,
- };
- subject_list(data).then((res) => {
- if (res.code == 1) {
- this.subjectList = res.data.page_data;
- let obj = {
- subject_id: "",
- subject_name: "全部",
- };
- this.subjectList.unshift(obj);
- }
- });
- },
- initData() {
- let data = {
- page: this.page,
- limit: this.limit,
- keyword: this.keyword,
- grade_id: this.firstForm.grade,
- subject_id: this.firstForm.subject,
- };
- tbjy_list(data).then((res) => {
- if (res.code == 1) {
- this.wholeData = res.data.page_data;
- }
- });
- },
- addData() {
- this.$router.push({ name: "tbjy-create" });
- },
- editData(id) {
- this.$router.push({ name: "tbjy-create", query: { id: id } });
- },
- deleteData(id) {
- let data = {
- zt_id: id,
- };
- this.$confirm("确认删除该课程?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- tbjy_delete(data).then((res) => {
- if (res.code == 1) {
- this.$message({
- message: "课程删除成功!",
- type: "success",
- });
- this.initData();
- } else {
- this.$message({
- message: res.msg,
- type: "error",
- });
- }
- });
- })
- .catch(() => { });
- },
- },
- // async created() {
- // await this.gradeListData();
- // await this.subjectListData();
- // },
- mounted() {
- this.initData();
- this.gradeListData();
- this.subjectListData();
- // const _this = this;
- // document.onkeydown = function (e) {
- // e = window.event || e;
- // if (
- // _this.$route.name == "course-ssys" &&
- // (e.code === "Enter" || e.code === "enter")
- // ) {
- // // 登录事件
- // _this.initData();
- // }
- // };
- },
- };
- </script>
- <style lang="scss" scoped>
- .ssysContent {
- .el-card {
- margin-bottom: 15px;
- background: #fff;
- }
- .pointer {
- cursor: pointer;
- }
- .title {
- font-size: 18px;
- color: #050026;
- }
- .subTitle {
- font-size: 14px;
- color: #949494;
- margin-left: 45px;
- }
- .searchDiv {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 80px;
- .menuDiv {
- display: flex;
- margin-bottom: -10px;
- .list {
- margin: 0 20px;
- padding: 0 10px;
- color: #949494;
- position: relative;
- line-height: 40px;
- font-size: 14px;
- &::after {
- content: "";
- width: 0;
- height: 2px;
- background: rgba(0, 131, 197, 0.8);
- position: absolute;
- bottom: -10px;
- left: 50%;
- transform: translateX(-50%);
- transition: width linear 0.1s;
- }
- &:hover {
- color: rgba(0, 131, 197, 0.8);
- }
- &.active {
- color: rgba(0, 131, 197, 0.8);
- font-size: 16px;
- &::after {
- width: 100%;
- }
- }
- }
- }
- .el-button {
- width: 100px;
- height: 40px;
- margin-right: 40px;
- }
- .searchValue {
- width: 350px;
- height: 50px;
- background: #ffffff;
- border-radius: 8px;
- overflow: hidden;
- position: relative;
- input {
- width: 100%;
- height: 100%;
- outline: 0;
- box-sizing: border-box;
- padding-left: 10px;
- background: #f6f8fa;
- }
- .searchBtn {
- width: 26px;
- height: 26px;
- background: #00a3ff;
- border-radius: 6px;
- position: absolute;
- right: 5px;
- top: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- vertical-align: middle;
- cursor: pointer;
- img {
- display: block;
- text-align: center;
- margin: 6px auto 0;
- }
- }
- }
- }
- .line {
- height: 1px;
- background: #eaeaea;
- width: calc(100% + 40px);
- margin-left: -20px;
- margin-top: 10px;
- }
- .nav {
- width: 1400px;
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- margin-bottom: 20px;
- div {
- display: flex;
- span {
- padding-top: 10px;
- display: inline-block;
- width: 50px;
- height: 50px;
- font-size: 16px;
- font-family: PingFangSC, PingFangSC-Semibold;
- font-weight: 600;
- text-align: center;
- color: #000000;
- line-height: 21px;
- }
- }
- }
- .list-right {
- width: 1400px;
- display: flex;
- flex-wrap: wrap;
- margin: 0 auto;
- & > div {
- box-sizing: border-box;
- width: 680px;
- height: 150px;
- display: flex;
- margin-bottom: 20px;
- box-shadow: 0px 15px 24px 0px rgba(161, 153, 168, 0.18);
- &:nth-of-type(odd) {
- margin-right: 40px;
- }
- .img-show {
- width: 263px;
- height: 150px;
- border-radius: 12px;
- overflow: hidden;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .main {
- display: flex;
- flex-direction: column;
- margin-left: 12px;
- width: 450px;
- position: relative;
- .main-title {
- width: 60%;
- vertical-align: top;
- font-size: 16px;
- font-family: PingFangSC, PingFangSC-Medium;
- font-weight: 500;
- text-align: left;
- color: #050026;
- line-height: 22px;
- margin-bottom: 5px;
- word-wrap: break-word;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- }
- .edit,
- .delete {
- width: 18px;
- height: 17px;
- position: absolute;
- top: 10px;
- right: 10px;
- }
- .edit {
- position: absolute;
- top: 10px;
- right: 50px;
- }
- .main-content {
- margin-top: 5px;
- width: 80%;
- font-size: 14px;
- height: 35px;
- word-wrap: break-word;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- color: #949494;
- line-height: 17px;
- }
- div {
- width: 186px;
- height: 20px;
- display: inline-block;
- font-size: 14px;
- font-family: PingFangSC, PingFangSC-Medium;
- font-weight: 500;
- text-align: left;
- color: #050026;
- line-height: 20px;
- position: absolute;
- bottom: 10px;
- left: 0px;
- img {
- display: inline-block;
- width: 24px;
- height: 24px;
- border-radius: 50%;
- margin-right: 8px;
- }
- }
- }
- }
- }
- }
- </style>
- <style lang="scss" >
- .ssysContent {
- .resultCard .el-card__body {
- padding: 0 !important;
- }
- }
- </style>
|