教师节主页修改

This commit is contained in:
nisen
2023-08-29 13:51:11 +08:00
parent 274896ec1f
commit 0d16d45685
3 changed files with 22 additions and 1660 deletions

View File

@@ -128,17 +128,11 @@
</div>
<!-- 意见 -->
<el-dialog :close-on-click-modal="false" :visible.sync="gratefulVisible" :append-to-body="true" @closed="closeDlg"
:width="dlgWidth" title="感谢您百忙之中给我们提交您宝贵的意见~">
<div class="dialogContent" :style="{ 'min-height': dlgHeight }">
title="感谢您百忙之中给我们提交您宝贵的意见~">
<div class="dialogContent">
<el-form :model="form">
<el-form-item label="类型">
<el-checkbox-group v-model="form.type">
<el-checkbox v-for="(item, index) in roleList" :label="item" :key="index"
@change="handleChecked(form.type)"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="内容">
<el-input type="textarea" placeholder="请输入内容......" v-model="form.desc" class="textarea"></el-input>
<el-form-item>
<el-input type="textarea" placeholder="请输入内容......" v-model="form.textarea" class="textarea"></el-input>
</el-form-item>
<el-form-item>
<div style="display: flex; justify-content: center">
@@ -157,17 +151,10 @@ import { mapGetters } from "vuex";
import apiCourseStudy from "@/api/modules/courseStudy.js";
import portalFloatTools from "@/components/PortalFloatTools.vue";
import apiCourse from "@/api/modules/coursePortal.js";
import apiCase from "@/api/modules/cases.js";
import apiQa from "@/api/modules/qa.js";
import apiGuide from "@/api/phase2/guide.js";
import apiUser from "@/api/system/user.js";
import interactBar from "@/components/Portal/interactBar.vue";
import courseImage from "@/components/Course/courseImage.vue";
import { toScore, formatUserNumber, cutOrgNamePath } from "@/utils/tools.js";
import apiPlace from "@/api/phase2/place.js";
import apiStat from "@/api/phase2/stat.js";
import { toScore, formatUserNumber } from "@/utils/tools.js";
import apiIndex from "@/api/phase2/index.js";
import apiUserhobby from "@/api/phase2/userhobby.js";
export default {
name: "Grateful",
components: {
@@ -175,168 +162,25 @@ export default {
interactBar,
courseImage,
},
created() {
this.$store.dispatch("refrashStudyTaskCount");
let $this = this;
//判断是否弹出登录勋章,设置截止日期
var nowDate = new Date();
var endDate = new Date("2022-11-18"); //先设置时间是11月18日
if (nowDate < endDate) {
apiStat.getUserLoginMedal().then((rs) => {
if (rs.status == 200) {
if (rs.result.show) {
//设置是否需要显示纪念勋章
$this.needLoginMedal = true;
}
}
});
}
//提取需要提示勋章
// apiStat.getUserMedalTips().then(res=>{
// if(res.status==200){
// $this.medalTips=res.result;
// }
// })
},
data() {
return {
roleList: ["功能", "界面设计", "其他"],
form: {
type: [],
desc: "",
textarea: "",
},
dlgHeight: "400px",
dlgWidth: "688px",
gratefulVisible: false,
showUClass: false,
showLoginMedal: false, //是否显示登录勋章
needLoginMedal: false, //是否需要显示纪念勋章
medalTips: [
{ medalId: 1, medalLevel: 5, isShow: false },
{ medalId: 3, medalLevel: 4, isShow: false },
],
lastStudy: {},
overlayShow: false,
userData: { level: 1, uvalue: 0, totalStudyHour: 0 },
userHobby: {
needShow: false,
localKeyPre: "user-hobby-", //本地存储的key
},
needHobbyShow: false, //是否显示兴趣爱好
formatNum: formatUserNumber,
cutOrgNamePath: cutOrgNamePath,
// userInfo: {},
ankingList: [],
answersList: [],
Popularity: [],
scorelist: [],
resonimg: [],
swiperOptiontwo: {
autoplay: false,
// noSwiping: true,
},
swiperOption: {
autoplay: {
delay: 2000,
disableOnInteraction: false, //解决滑动后不能轮播的问题
},
speed: 3000, //切换速度即slider自动滑动开始到结束的时间单位ms
loop: true, //循环切换
peed: 300, //循环速度
scrollbar: ".swiper-scrollbar",
pagination: {
el: ".swiper-pagination",
// type : 'progressbar', //分页器形状
clickable: true, //点击分页器的指示点分页器会控制Swiper切换
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
},
couname: "",
isNext: true,
pageIndex: 1,
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
toScore,
// 列表
courseList: {
num: 12,
orderType: 2,
list: [],
},
caseList: {
num: 3,
orderType: 2,
list: [],
},
articleList: {
num: 4,
orderType: 2,
first: {
id: "",
authorInfo: {},
},
list: [],
},
qaList: {
num: 4,
orderType: "views",
list: [],
},
}
};
},
mounted() {
this.getCourseData(1);
this.getCaseData();
this.getArticleData();
this.getQaData();
this.couresreso();
this.getScoreList();
this.getPopularity();
this.getAnkingData();
this.getLevel();
this.getQaAnswers();
this.getLastStudy();
//检查兴趣爱好是否已填报,
//先检查本地session和 local 15天, 这两个值是在组件中设置的
let sessionHobby = sessionStorage.getItem(
"user-hobby-" + this.userInfo.aid
);
let localHobbyTime = localStorage.getItem("notYet" + this.userInfo.aid);
if (!sessionHobby) {
//只有session中不存在才会验证
//本地15天验证,localHobby,后续完善
let flag = true; //请求检查
if (localHobbyTime) {
let day =
(new Date() - new Date(localHobbyTime)) / (1000 * 60 * 60 * 24);
if (day < 15) {
flag = false;
}
}
if (flag) {
apiUserhobby.has().then((res) => {
if (res.status == 200) {
if (!res.result) {
//设置需要显示兴趣爱好收集窗口
this.userHobby.needShow = true;
}
} else {
console.log("兴趣爱好检查失败" + res.message);
}
//检查引导页
this.checkAndShowGuide();
});
} else {
this.checkAndShowGuide();
}
} else {
//检查引导页
this.checkAndShowGuide();
}
//this.$refs.userCollection.show();
},
computed: {
...mapGetters(["userInfo", "studyTaskCount"]),
@@ -348,180 +192,9 @@ export default {
getPic(index) {
return this.webBaseUrl + "/images/listblue0" + (index + 1) + ".png";
},
handleChecked(list) {
if (list.length > 1) {
let one = list.splice(1);
this.form.type = one;
}
},
closeDlg() {
this.gratefulVisible = false
},
tylClick() {
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
},
cylClick() {
window.open("https://u.boe.com/pc/course?keyword=创新力专区");
},
showClass(flag) {
if (flag) {
this.showUClass = flag;
}
},
uOnClick() {
this.showUClass = true;
},
setCurIdentity(iden) {
this.$store.dispatch("SetCurIdentity", iden);
},
closeJinian() {
this.showLoginMedal = false;
},
banJump(item) {
if (item.JumpUrl) {
window.open(item.JumpUrl);
}
},
//上次学习记录
getLastStudy() {
apiCourseStudy.lastStudy().then((res) => {
if (res.status === 200) {
this.lastStudy = res.result;
if (res.result != "" && res.result.courseId) {
this.overlayShow = true;
}
} else {
this.$message.error(res.message);
}
});
},
//检查并弹出引导页
checkAndShowGuide() {
//引导页弹框是否显示
//检查本地,减少服务器请求的次数
let localGuide = localStorage.getItem("user-guide-" + this.userInfo.aid);
if (!localGuide) {
apiGuide.hasUser().then((res) => {
if (res.status == 200) {
if (!res.result) {
this.$refs.guide.show();
} else {
if (this.userHobby.needShow) {
this.$refs.userCollection.show();
} else {
if (this.needLoginMedal) {
this.showLoginMedal = true;
}
}
}
localStorage.setItem("user-guide-" + this.userInfo.aid, 1);
} else {
console.log("获取引导页检查失败" + res.message);
//this.$message.error('')
if (this.userHobby.needShow) {
this.$refs.userCollection.show();
}
}
});
} else {
if (this.userHobby.needShow) {
this.$refs.userCollection.show();
} else {
if (this.needLoginMedal) {
this.showLoginMedal = true;
}
}
}
//测试情况下
// this.$refs.guide.show();
},
closeGuide() {
//关闭引导页
if (this.userHobby.needShow) {
//需要弹出兴趣收集页,弹出兴趣收集页
this.$refs.userCollection.show();
}
},
closeCollection() {
if (this.needLoginMedal) {
this.showLoginMedal = true;
}
},
jumstudy() {
this.$router.push({ path: "../views/study/TaskList.vue" });
},
jumcasedet(item) {
this.$router.push({ path: "/case/detail", query: { id: item.id } });
},
getPic(index) {
return this.webBaseUrl + "/images/listblue0" + (index + 1) + ".png";
},
getLevel() {
//获取经验值和等级
apiStat.getUserStatTotalInfo(this.userInfo.aid).then((res) => {
if (res.status == 200) {
this.userData = res.result;
//console.log(this.userData,'this.userData')
}
});
},
getQaAnswers() {
apiIndex.qaAnswers(10).then((res) => {
if (res.status == 200) {
this.answersList = res.result;
}
});
},
getAnkingData() {
// 文章排行榜
apiIndex.articleViews(10).then((res) => {
if (res.status == 200) {
this.ankingList = res.result;
}
});
},
getPopularity() {
//案例排行榜
apiCase.queryPraises(10).then((res) => {
if (res.status == 200) {
this.Popularity = res.result;
// console.log(this.Popularity)
}
});
},
getScoreList() {
//课程排行榜
apiCourse.scorelist(10, 1).then((res) => {
if (res.status == 200) {
res.result.forEach((item) => {
if (item.publishTime != "") {
item.coverImg = item.images;
let time = item.publishTime.split("-");
item.publishTime = `${time[0]}${time[1]}${time[2]}`;
}
});
this.scorelist = res.result;
//console.log(this.scorelist,'this.scorelist');
}
});
},
// bgfun(){
// console.log(this.$refs.bannimg[0]);
// this.$nextTick(() => {
// console.log(this.$refs.bannimg[0])
// })
// },
couresreso() {
let key = "index";
apiPlace.detail(key).then((res) => {
let lmj = JSON.parse(res.result.content);
this.resonimg = lmj;
});
},
jumUX() {
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130", "_blank");
},
toCourseDetail(item) {
//二期调整,直接改成一个地址
//return this.webBaseUrl + '/course/detail?id=' + item.id;
@@ -543,17 +216,6 @@ export default {
//return $this.webBaseUrl + "/course/detail?id=" + item.id;
}
},
orderTypeFilter(val) {
this.courseList.orderType = val;
this.pageIndex = 1;
this.getCourseData();
},
nextPage() {
this.pageIndex += 1;
if (this.isNext) {
this.getCourseData(this.pageIndex);
}
},
getCourseData(pageIndex) {
this.isNext = false;
let { orderType, num } = this.courseList;
@@ -582,169 +244,12 @@ export default {
});
this.loadCouserTeacher(res.result, courseIds);
this.courseList.list = res.result;
//this.couname = res.result.list.name;
// if (res.result.count - pageIndex * num < 8) {
// this.pageIndex = 0;
// }
// this.isNext = true;
// }
} else {
console.log("加载课程信息失败:" + res.error);
}
});
// apiCourse.list({orderType,num,device:1}).then(res => {
// if(res.status==200){
// if(res.result.length>0){
// let courseIds=[];
// res.result.forEach(item=>{
// item.authorInfo={aid:'',name:'',orgInfo:'',avatar:'',code:''};
// courseIds.push(item.id);
// })
// this.loadCouserTeacher(res.result,courseIds);
// this.courseList.list=res.result;
// }
// }else{
// console.log('加载课程信息失败:'+res.error);
// }
// })
},
// 去掉案例的推荐课程
// changeCaseOrder(val) {
// this.caseList.orderType = val;
// this.getCaseData();
// },
//案例的参数等着需要改
getCaseData() {
apiIndex.newCases().then((res) => {
if (res.status == 200) {
if (res.result.length > 0) {
let userIds = [];
res.result.forEach((item) => {
item.authorInfo = {
aid: "",
name: "",
orgInfo: "",
avatar: "",
code: "",
sex: null,
};
if (item.authorId && item.authorId != "") {
userIds.push(item.authorId);
}
});
this.caseList.list = res.result;
this.loadCaseAuthorInfo(res.result, userIds);
}
// this.caseList.list = res.result;
} else {
console.log("加载案例错误:" + res.error);
}
});
},
loadCaseAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then((res) => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some((author) => {
if (author.aid == item.authorId) {
author.orgInfo = cutOrgNamePath(author.orgInfo, 1);
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log("加载用户信息失败:" + res.error);
//this.$message.error(res.message);
}
});
},
getArticleData() {
let $this = this;
this.articleList.list = [];
apiIndex.articlelist(this.articleList.orderType).then((res) => {
if (res.status == 200) {
if (res.result.length > 0) {
let userIds = [];
res.result.forEach((item, idx) => {
item.authorInfo = {
aid: "",
name: "",
orgInfo: "",
avatar: "",
code: "",
sex: null,
};
userIds.push(item.sysCreateAid);
if (idx == 0) {
$this.articleList.first = item;
} else {
$this.articleList.list.push(item);
}
});
// console.log(res.result, 'res.result');
this.loadAuthorInfo(res.result, userIds);
}
} else {
console.log("加载文章错误:" + res.error);
}
});
},
changeArticleOrder(val) {
this.articleList.orderType = val;
this.getArticleData();
},
getQaData() {
let params = {
pageSize: this.qaList.num,
orderAsc: false,
orderField: this.qaList.orderType,
};
// if (this.qaList.orderType == 2) {
// params.orderField = 'praises';
// }
apiQa.indexList(params).then((res) => {
if (res.status == 200) {
if (res.result.length > 0) {
let userIds = [];
res.result.forEach((item) => {
item.authorInfo = {
aid: "",
name: "",
orgInfo: "",
avatar: "",
code: "",
sex: null,
};
userIds.push(item.sysCreateAid);
});
this.qaList.list = res.result;
this.loadAuthorInfo(res.result, userIds);
}
} else {
console.log("加载问答错误:" + res.error);
}
//console.log(res)
});
},
changeQaOrder(val) {
this.qaList.orderType = val;
this.getQaData();
},
loadCouserTeacher(list, ids) {
let that = this;
// 先查课程关联教师iD
apiCourse.getTeacherByCourseIDs(ids).then((cres) => {
if (cres.status == 200) {
@@ -769,62 +274,7 @@ export default {
//that.loadCourseAuthorInfo(list, userIds);
}
});
},
loadCourseAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then((res) => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some((author) => {
if (author.aid == item.authorInfo.aid) {
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log("加载用户信息失败:" + res.error);
}
});
},
loadAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then((res) => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some((author) => {
if (author.aid == item.sysCreateAid) {
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log("加载用户信息失败:" + res.error);
}
});
},
jumpRouter(item) {
this.$router.push({
path: "/qa/answer",
query: {
id: item.id,
},
});
},
}
},
};
</script>
@@ -854,7 +304,7 @@ export default {
}
.textarea {
width: 600px;
width: 100%;
::v-deep .el-textarea__inner {
min-height: 300px !important;