提交部分

This commit is contained in:
kclf
2022-11-23 15:39:22 +08:00
parent 6b210e8a1a
commit ff8213ccbf
5 changed files with 1219 additions and 1469 deletions

29
package-lock.json generated
View File

@@ -15,8 +15,10 @@
"element-plus": "^2.2.17",
"jquery": "^3.6.1",
"qs": "^6.11.0",
"sortablejs": "^1.15.0",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vuedraggable": "^4.1.0",
"vuex": "^4.0.0"
},
"devDependencies": {
@@ -9522,6 +9524,11 @@
"websocket-driver": "^0.7.4"
}
},
"node_modules/sortablejs": {
"version": "1.15.0",
"resolved": "https://registry.npmmirror.com/sortablejs/-/sortablejs-1.15.0.tgz",
"integrity": "sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w=="
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
@@ -10447,6 +10454,22 @@
"node": ">=0.10.0"
}
},
"node_modules/vuedraggable": {
"version": "4.1.0",
"resolved": "https://registry.npmmirror.com/vuedraggable/-/vuedraggable-4.1.0.tgz",
"integrity": "sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==",
"dependencies": {
"sortablejs": "1.14.0"
},
"peerDependencies": {
"vue": "^3.0.1"
}
},
"node_modules/vuedraggable/node_modules/sortablejs": {
"version": "1.14.0",
"resolved": "https://registry.npmmirror.com/sortablejs/-/sortablejs-1.14.0.tgz",
"integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w=="
},
"node_modules/vuex": {
"version": "4.0.2",
"resolved": "https://registry.npmmirror.com/vuex/-/vuex-4.0.2.tgz",
@@ -14906,9 +14929,9 @@
}
},
"dayjs": {
"version": "1.11.6",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.6.tgz",
"integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ=="
"version": "1.11.5",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.5.tgz",
"integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA=="
},
"debug": {
"version": "4.3.4",

View File

@@ -3,19 +3,52 @@ import http from "./config";
/**
* 1
*/
//添加课程学员
export const addStudent = (obj) =>
http.post("/admin/offcourse/addStudent", obj);
//删除开课
export const deletePlan = (obj) =>
http.delete("/admin/offcourse/deletePlan", obj);
http.delete(
"/admin/offcourse/deletePlan",
{ params: obj },
{
headers: { "Content-Type": "application/x-www-form-urlencoded" },
}
);
//获取面授课详情
export const detail = (obj) =>
http.post("/admin/offcourse/detail", obj, {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
});
//获取面授课开课详情
export const detailPlan = (obj) =>
http.post("/admin/offcourse/detailPlan", obj, {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
});
//新建或编辑面授课
export const edit = (obj) => http.post("/admin/offcourse/edit", obj);
//新建或编辑面授课开课
export const editPlan = (obj) => http.post("/admin/offcourse/editPlan", obj);
//操作面授课(发布,撤回,删除)
//课程导出
export const exportP = (obj) => http.post("/admin/offcourse/export", obj);
//操作面授课(发布,撤回,删除,审核,停用)
export const handle = (obj) => http.post("/admin/offcourse/handle", obj);
//学员操作-支持批量
export const handleStudent = (obj) =>
http.post("/admin/offcourse/handleStudent", obj);
//获取面授课列表
export const list = (obj) => http.post("/admin/offcourse/list", obj);
//获取面授课已审核列表
export const listReview = (obj) =>
http.post("/admin/offcourse/listReview", obj);
//面授课开课列表
export const planList = (obj) => http.post("/admin/offcourse/planList", obj);
//学员导出
export const studentExport = (obj) =>
http.post("/admin/offcourse/studentExport", obj);
//获取学员列表
export const studentList = (obj) =>
http.post("/admin/offcourse/studentList", obj);
//学习记录列表
export const studyRecordList = (obj) =>
http.post("/admin/offcourse/studyRecordList", obj);

View File

@@ -84,3 +84,36 @@ export function filterCommon(arr, key) {
});
return newData;
}
export function getdateToTime(date) {
let now = new Date(parseInt(date)),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate(),
hh = now.getHours(),
mm = now.getMinutes();
return `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d} ${hh}:${mm}`;
}
//计算两个时间之间的时间差 多少天时分秒
export function intervalTime(startTime) {
const curTime = new Date().getTime(); //计算当前时间戳
const date3 = curTime - startTime; //时间差的毫秒数
//计算出相差天数
const days = Math.floor(date3 / (24 * 3600 * 1000));
//计算出小时数
const leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
const hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
const leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
const minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
const leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
const seconds = Math.round(leave3 / 1000);
return {
days,
hours,
minutes,
seconds,
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,760 +0,0 @@
<!-- 评估管理-创建评估页面 -->
<template>
<div class="researchadd">
<div class="header">
<span class="title">创建评估</span>
<router-link to="/researchmanage" class="goback">
<span class="return"></span>
<router-link class="returntext" to="/researchmanage">
返回
</router-link>
</router-link>
</div>
<div class="addtype">
<div class="addtypen">创建评估类型</div>
<div class="types" @click="handleTypes(1)">单选题</div>
<div class="types" @click="handleTypes(2)">多选题</div>
<div class="types" @click="handleTypes(3)">问答题</div>
<div class="types" @click="handleTypes(4)">评分题</div>
</div>
<div v-for="(item, index) in allFormsData" :key="index">
<ResearchAddSingle v-if="item.type === 1" :item="item" @del="handleDel" />
<ResearchAddMulti v-if="item.type === 2" :item="item" @del="handleDel" />
<ResearchAddAsk v-if="item.type === 3" :item="item" @del="handleDel" />
<ResearchAddPin v-if="item.type === 4" :item="item" @del="handleDel" />
</div>
<div class="opinion name2">
<div class="namebox">
<div class="inname" style="margin-top: 13px">您的其他意见</div>
</div>
<div class="in">
<a-textarea
v-model:value="valueMore"
style="height: 110px"
show-count
:maxlength="200"
/>
</div>
</div>
<div class="footer">
<div class="btn">
<a-button
type="primary"
style="
width: 100px;
height: 40px;
border-radius: 8px;
background-color: #409eff;
"
@click="handleSave"
>
保存
</a-button>
<a-button
type="primary"
ghost
style="
width: 100px;
height: 40px;
margin-left: 14px;
border-radius: 8px;
"
@click="handleAllCancel"
>
取消
</a-button>
</div>
</div>
</div>
</template>
<script>
import { reactive, toRefs, computed } from "vue";
// import { message } from "ant-design-vue";
// import { createResearch } from "../../api/indexResearch";
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
import ResearchAddMulti from "./components/ResearchAddMulti.vue";
import ResearchAddAsk from "./components/ResearchAddAsk.vue";
import ResearchAddPin from "./components/ResearchAddPin.vue";
import { sortBy, traverseArr, filterCommon } from "../../utils/utils";
import {
queryResearchDetailById,
editResearchMessage,
createResearch,
} from "@/api/indexResearch";
import { useRouter } from "vue-router";
import store from "@/store";
export default {
name: "ResearchAdd",
components: {
ResearchAddSingle,
ResearchAddMulti,
ResearchAddAsk,
ResearchAddPin,
},
setup() {
const router = useRouter();
const state = reactive({
assessmentId: "", //编辑时候传
assessmentName: "",
assessmentNameNew: computed(() => store.state.assessmentName),
allFormsData: [],
valueMore: "",
});
const getInfoDate = async () => {
let id = router.currentRoute.value.params.id;
if (id) {
state.assessmentId = id;
let renderArr = [];
let res = await queryResearchDetailById({
assessmentId: state.assessmentId,
});
console.log("res1111111111");
console.log(res);
state.assessmentName = res.assessmentName;
state.valueMore = res.assessmentMark;
renderArr.concat(
res.singleStemVoList,
res.multipleStemVoList,
res.essayQuestionVoList,
res.scoringQuestionVoList
);
sortBy(renderArr, "orderNumber"); //序号
console.log("renderArr");
console.log(renderArr);
this.allFormsData = parseData(renderArr, "questionType"); //类型
console.log("this.allFormsData");
console.log(this.allFormsData);
}
};
getInfoDate();
// 转换成前端格式
const parseData = (arr, typeKey) => {
console.log(arr);
console.log(typeKey);
const resultArr = [];
arr.forEach((item) => {
let obj = {};
if (item[typeKey] === 1) {
let restList = traverseArr(item.assessmentSingleChoiceVoList, {
inputVal: "singleOptionName",
imgVal: "singleOptionPictureAddress",
}).map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
obj = {
type: item[typeKey],
valueSingle: item.singleStemName,
singleList: restList,
};
resultArr.push(obj);
}
if (item[typeKey] === 2) {
let restList = traverseArr(item.multipleChoiceVoList, {
inputVal: "multipleOptionName",
imgVal: "multipleOptionPictureAddress",
}).map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
obj = {
type: item[typeKey],
valueMutil: item.multipleStemName,
mutilList: restList,
};
resultArr.push(obj);
}
if (item[typeKey] === 3) {
obj = {
type: item[typeKey],
valueAsk: item.assessmentQaTitle,
valueAskDesc: item.assessmentQaDescribe,
};
resultArr.push(obj);
}
if (item[typeKey] === 4) {
obj = {
type: item[typeKey],
valuePin: item.assessmentScTitle,
minScore: item.assessmentScore, //?
maxScore: item.assessmentScore, //?
pinQuan: item.weightScale,
};
resultArr.push(obj);
}
});
resultArr.map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
console.log(resultArr);
return resultArr;
};
// 转换成后端格式
const restData = (arr, typeKey) => {
console.log("转换成后端格式");
console.log(arr);
console.log(typeKey);
const resultArr = [];
arr.forEach((item) => {
let obj = {};
if (item[typeKey] === 1) {
console.log(11111111111);
let restList = traverseArr(item.singleList, {
singleOptionName: "inputVal",
singleOptionPictureAddress: "imgVal",
}).map((itm, idx) => {
itm.optionOrderNum = idx + 1;
return itm;
});
console.log(restList);
obj = {
questionType: item[typeKey],
singleStemName: item.valueSingle,
singleList: restList,
};
resultArr.push(obj);
}
if (item[typeKey] === 2) {
let restList = traverseArr(item.mutilList, {
multipleOptionName: "inputVal",
multipleOptionPictureAddress: "imgVal",
}).map((itm, idx) => {
itm.optionOrderNum = idx + 1;
return itm;
});
obj = {
questionType: item[typeKey],
multipleStemName: item.valueMutil,
mutilList: restList,
};
resultArr.push(obj);
}
if (item[typeKey] === 3) {
obj = {
questionType: item[typeKey],
assessmentQaTitle: item.valueAsk,
assessmentQaDescribe: item.valueAskDesc,
};
resultArr.push(obj);
}
if (item[typeKey] === 4) {
obj = {
questionType: item[typeKey],
assessmentScTitle: item.valuePin,
assessmentScore: item.minScore, //?
assessmentScore1: item.maxScore, //?
weightScale: item.pinQuan,
};
resultArr.push(obj);
}
});
resultArr.map((itm, idx) => {
itm.orderNumber = idx + 1;
return itm;
});
console.log(resultArr);
return resultArr;
};
// 解散传值
const parseItem = (arr) => {
console.log(676767);
console.log(arr);
const filterComObj = filterCommon(arr, "questionType");
console.log("filterComObj");
console.log(filterComObj);
let resultObj = {};
for (let key in filterComObj) {
console.log("key");
console.log(key);
if (key === "1") {
let arrSingle = filterComObj[key];
console.log(arrSingle);
let arr = [];
arrSingle.forEach((item) => {
if (item.singleList.length) {
item.singleList.forEach((itm) => {
arr.push({
...itm,
singleStemName: item.singleStemName,
orderNumber: item.orderNumber,
questionType: item.questionType,
});
});
}
});
resultObj.assessmentSingleChoiceDtoList = arr;
}
if (key === "2") {
let arrMulti = filterComObj[key];
let arr = [];
arrMulti.forEach((item) => {
if (item.mutilList.length) {
item.mutilList.forEach((itm) => {
arr.push({
...itm,
multipleStemName: item.multipleStemName,
orderNumber: item.orderNumber,
questionType: item.questionType,
});
});
}
});
resultObj.assessmentMultipleChoiceDtoList = arr;
}
if (key === "3") {
resultObj.assessmentEssayQuestionDtoList = filterComObj[key];
}
if (key === "4") {
resultObj.assessmentScoringQuestionDtoList = filterComObj[key];
}
}
console.log("resultObj");
console.log(resultObj);
return resultObj;
};
const creatFromData = (type) => {
let obj = {};
switch (type) {
case 1:
obj = {
type,
id: state.allFormsData.length,
valueSingle: "",
singleList: [
{
id: 1,
inputVal: "",
imgVal: "",
},
],
};
break;
case 2:
obj = {
type,
id: state.allFormsData.length,
valueMutil: "",
mutilList: [
{
id: 1,
inputVal: "",
imgVal: "",
},
],
};
break;
case 3:
obj = {
type,
id: state.allFormsData.length,
valueAsk: "",
valueAskDesc: "",
};
break;
case 4:
obj = {
type,
id: state.allFormsData.length,
valuePin: "",
minScore: 1,
maxScore: 10,
pinQuan: 100,
};
break;
}
return obj;
};
const handleTypes = (type) => {
state.allFormsData.push(creatFromData(type));
};
const handleDel = ({ id }) => {
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
state.allFormsData.splice(index, 1);
}
});
state.allFormsData.map((item, index) => {
item.id = index + 1;
return item;
});
};
const handleSave = () => {
let resultPost = {};
let filterData = parseItem(restData(state.allFormsData, "type"));
console.log(777);
console.log(filterData);
console.log(state.allFormsData);
console.log("当前权重设置是百分制 请重新配置");
if (state.assessmentId) {
resultPost = {
assessmentId: state.assessmentId,
assessmentName: state.assessmentName ? state.assessmentName : "编辑测试",
assessmentMark: state.assessmentMark,
...filterData,
};
console.log("resultPost2222222222");
console.log(resultPost);
editResearchMessage(resultPost).then((res) => {
console.log(res);
});
} else {
resultPost = {
assessmentName: state.assessmentNameNew,
assessmentMark: state.assessmentMark,
...filterData,
};
console.log("resultPost111111");
console.log(resultPost);
createResearch(resultPost).then((res) => {
console.log(res);
});
}
};
const handleAllCancel = () => {
state.allFormsData = [];
};
return {
...toRefs(state),
handleTypes,
handleSave,
handleAllCancel,
handleDel,
};
},
};
</script>
<style lang="scss">
.researchadd {
width: 100%;
display: flex;
flex-direction: column;
.header {
width: 100%;
display: flex;
justify-content: space-between;
.title {
color: #000000;
font-size: 18px;
//line-height: 36px;
padding-top: 30px;
padding-left: 37px;
//font-weight: 500;
}
.goback {
padding-right: 70px;
//padding-top: 37px;
position: relative;
.return {
display: inline-block;
width: 42px;
height: 42px;
margin-top: 17px;
margin-right: 10px;
background-image: url("../../assets/images/projectadd/return.png");
}
.returntext {
display: inline-block;
position: absolute;
top: 27px;
color: #4ea6ff;
font-size: 14px;
}
}
}
.addtype {
display: flex;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin-right: 20px;
align-items: center;
margin-left: 41px;
.addtypen {
color: #6f6f6f;
font-size: 14px;
}
.types {
cursor: pointer;
width: 80px;
height: 40px;
color: #409eff;
border: 1px solid #409eff;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
margin: 20px 10px;
}
.typesCur {
color: #fff;
background: #409eff;
}
}
.content {
display: flex;
flex-direction: column;
border: 1px solid rgba(0, 0, 0, 0.1);
width: 70%;
min-width: 690px;
margin-left: 38px;
margin-top: 20px;
.tagbox {
display: flex;
justify-content: space-between;
.tagname {
width: 90px;
height: 32px;
margin-top: 24px;
display: flex;
justify-content: center;
align-items: center;
margin-left: 134px;
background: rgba(78, 166, 255, 0.1);
border-radius: 4px;
color: rgba(64, 158, 255, 1);
font-size: 16px;
}
.deleteop {
display: flex;
justify-content: center;
align-items: center;
width: 100px;
height: 40px;
margin-top: 20px;
margin-right: 30px;
border: 1px solid #409eff;
border-radius: 8px;
cursor: pointer;
.del_text {
color: #409eff;
font-size: 14px;
margin-left: 5px;
}
}
}
.scorebox {
display: flex;
align-items: center;
margin-top: 20px;
margin-left: 70px;
.scoretext {
font-size: 14px;
color: #56a3f9;
}
.number {
display: flex;
border: 1px solid #d7e5fd;
border-radius: 5px;
margin: 0 10px;
padding: 5px;
.btn {
width: 40px;
height: 40px;
border: 1px solid #56a3f9;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
margin: 5px;
font-size: 14px;
font-weight: 400;
color: #56a3f9;
line-height: 24px;
cursor: pointer;
}
.curBtn {
background: #56a3f9;
color: #fff;
}
}
}
.picture {
width: 100px;
display: flex;
flex-direction: column;
margin-top: 20px;
margin-left: 133px;
.pictureimg {
width: 100px;
height: 100px;
}
.picturename {
color: #6f6f6f;
font-size: 14px;
}
}
.options {
display: flex;
}
.delete {
cursor: pointer;
margin-top: 32px;
margin-left: 20px;
// float: right;
color: #4ea6ff;
font-size: 14px;
}
.name2 {
display: flex;
align-items: flex-start;
}
.name {
width: 60%;
// background-color: lightcoral;
display: flex;
margin-top: 20px;
//align-items: center;
//height: 40px;
// border: 1px solid black;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
.nameimg {
width: 10px;
height: 10px;
}
}
.inname {
color: #6f6f6f;
font-size: 14px;
margin-left: 7px;
font-weight: 700;
}
.in {
margin-left: 14px;
flex: 1;
.assess {
display: flex;
width: 226px;
height: 40px;
border: 1px solid #56a3f9;
//margin-bottom: 20px;
.assesstype {
width: 50%;
background: #56a3f9;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.assesswhole {
width: 50%;
background: rgba(86, 163, 249, 0.1);
font-size: 14px;
color: #6f6f6f;
display: flex;
justify-content: center;
align-items: center;
}
.ratio {
position: absolute;
right: 10px;
top: 8px;
color: #6f6f6f;
font-size: 14px;
}
}
.addimg {
cursor: pointer;
color: rgba(78, 166, 255, 1);
font-size: 14px;
}
.text {
color: rgba(109, 117, 132, 1);
font-size: 14px;
//line-height: 24px;
}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 35px;
}
.ant-select-selector {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 40px;
}
}
.numberInp {
width: 200px;
.ant-input-number {
width: 200px;
height: 40px;
border-radius: 8px;
}
// .ant-input-number-input-wrap {
// width: 200px;
// }
}
}
}
.name2 {
display: flex;
align-items: flex-start;
}
.opinion {
display: flex;
margin-top: 30px;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
}
.in {
margin-left: 14px;
width: 500px;
.ant-input-textarea-show-count {
position: relative;
height: 110px;
}
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
}
.ant-input {
border-radius: 8px;
}
}
}
.footer {
width: 100%;
margin-top: 31px;
margin-bottom: 14px;
.btn {
display: flex;
margin-bottom: 20px;
justify-content: center;
cursor: pointer;
}
}
.uploadContent {
display: block !important;
.uploadBtn {
margin-left: 120px !important;
}
}
}
</style>