部分修改

This commit is contained in:
kclf
2022-12-05 10:21:33 +08:00
parent 4c995bcbdf
commit 6d4421adfb
6 changed files with 149 additions and 156 deletions

View File

@@ -55,10 +55,10 @@ http.interceptors.response.use(
if (code === 0 || code === 200) {
return response;
} else {
if (code === 1000) {
window.open("https://u-pre.boe.com/web/", '_self');
// window.open("http://111.231.196.214:12013/manage/login", '_self');
}
// if (code === 1000) {
// window.open("https://u-pre.boe.com/web/", "_self");
// // window.open("http://111.231.196.214:12013/manage/login", '_self');
// }
console.log("api %o", msg);
}
return response;

View File

@@ -156,6 +156,8 @@ export default {
let renderArr = [...res.voteStemVoList];
sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(renderArr);
console.log(67676767);
console.log(state.allFormsData);
}
};
@@ -179,7 +181,7 @@ export default {
obj = {
valueSingle: item.voteStemName,
singleList: restList,
optionDetailList: restList,
orderNumber: item.orderNumber,
};
resultArr.push(obj);
@@ -197,7 +199,7 @@ export default {
arr.forEach((item) => {
let obj = {};
console.log("item=======", item);
let restList = traverseArr(item.singleList, {
let restList = traverseArr(item.optionDetailList, {
optionName: "inputVal",
optionPictureAddress: "imgVal",
optionId: "optionId",
@@ -213,7 +215,7 @@ export default {
obj = {
voteStemName: item.valueSingle,
singleList: restList,
optionDetailList: restList,
orderNumber: item.orderNumber,
};
resultArr.push(obj);
@@ -226,29 +228,11 @@ export default {
return resultArr;
};
// 解散传值
const parseItem = (arrSingle) => {
console.log("arrSingle");
console.log(arrSingle);
let resultObj = {};
let arr = [];
arrSingle.forEach((item) => {
arr.push({
voteStemName: item.voteStemName,
orderNumber: item.orderNumber,
optionDetailList: item.singleList,
});
});
resultObj.voteStemDtoList = arr;
console.log("resultObj======", resultObj);
return resultObj;
};
const handleTypes = () => {
let obj = {
id: state.allFormsData.length + 1,
valueSingle: "",
singleList: [
optionDetailList: [
{
id: 1,
inputVal: "",
@@ -268,7 +252,7 @@ export default {
console.log(888888888);
console.log(id);
console.log(curItem);
// 前端删除
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
state.allFormsData.splice(index, 1);
@@ -280,17 +264,18 @@ export default {
item.id = index + 1;
return item;
});
// 接口删除
if (curItem.voteStemId) {
api.deleteVoteStem(curItem.voteStemId).then((res) => {
console.log(56444);
console.log(res);
});
}
};
const handleSave = () => {
let resultPost = {};
let filterData = parseItem(restData(state.allFormsData));
let filterData = restData(state.allFormsData);
console.log("filterData==111", filterData);
// 校验
@@ -301,21 +286,13 @@ export default {
if (!checkVal(filterData)) {
return false;
}
console.log(12121212);
console.log(filterData);
console.log("111111222223333----0000", state.ballotId);
if (state.ballotId) {
resultPost = {
ballotId: state.ballotId,
ballotName: state.ballotName,
...filterData,
voteStemDtoList: filterData,
};
/*
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);*/
console.log(1212334);
console.log(resultPost);
api.updateStemMessage(resultPost).then((res) => {
@@ -330,13 +307,8 @@ export default {
} else {
resultPost = {
ballotName: state.ballotName,
...filterData,
voteStemDtoList: filterData,
};
/*
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);*/
console.log("=========", resultPost);
api.createStemMessage(resultPost).then((res) => {
if (res.data.code === 200) {
@@ -355,14 +327,8 @@ export default {
const checkVal = (filterData) => {
console.log("filterData.====", filterData);
console.log("filterData.voteStemVoList====", filterData.voteStemDtoList);
if (!filterData.voteStemDtoList) {
message.error("请添加题干");
return false;
}
let arr = filterData.voteStemDtoList;
arr.forEach((item) => {
filterData.forEach((item) => {
console.log("item===", item);
console.log("!item.voteStemName===", !item.voteStemName);
if (!item.voteStemName) {

View File

@@ -25,7 +25,7 @@
</div>
<VoteQuestionItem
v-model:info="info"
v-for="(item, index) in curItem.singleList"
v-for="(item, index) in curItem.optionDetailList"
:key="index"
:item="item"
@input="input"
@@ -77,40 +77,40 @@ export default {
};
const handleSingleAdd = () => {
curItem.value.singleList.push({
id: curItem.value.singleList.length + 1,
curItem.value.optionDetailList.push({
id: curItem.value.optionDetailList.length + 1,
inputVal: "",
imgVal: "",
});
};
const input = ({ id, val }) => {
curItem.value.singleList.forEach((item) => {
curItem.value.optionDetailList.forEach((item) => {
if (item.id === id) {
item.inputVal = val;
}
});
};
const imgSrc = ({ id, src }) => {
curItem.value.singleList.forEach((item) => {
curItem.value.optionDetailList.forEach((item) => {
if (item.id === id) {
item.imgVal = src;
}
});
};
const delImg = ({ id }) => {
curItem.value.singleList.forEach((item) => {
curItem.value.optionDetailList.forEach((item) => {
if (item.id === id) {
item.imgVal = "";
}
});
};
const del = ({ id, optionId }) => {
curItem.value.singleList.forEach((item, index) => {
curItem.value.optionDetailList.forEach((item, index) => {
if (item.id === id) {
curItem.value.singleList.splice(index, 1);
curItem.value.optionDetailList.splice(index, 1);
}
});
curItem.value.singleList.map((item, index) => {
curItem.value.optionDetailList.map((item, index) => {
item.id = index + 1;
});

View File

@@ -1,19 +1,39 @@
<template>
<div :style="{
<div
:style="{
margin: 'auto',
background: 'url(http://img.gz2c.com/FoTcLY8ww-ISCFlwyCoYuLim1BMt) no-repeat',
background:
'url(http://img.gz2c.com/FoTcLY8ww-ISCFlwyCoYuLim1BMt) no-repeat',
backgroundSize: '100% 100%',
width: '100%',
height: '100vh',
display:'flex'
}">
display: 'flex',
}"
>
<div
:style="{width:'300px', height: '300px', margin:'10% auto',padding:'20px 30px',textAlign:'center', borderRadius:'10px', background:'#e0e0e0',boxShadow:'20px 20px 60px #bebebe,-20px -20px 60px #ffffff'}">
:style="{
width: '300px',
height: '300px',
margin: '10% auto',
padding: '20px 30px',
textAlign: 'center',
borderRadius: '10px',
background: '#e0e0e0',
boxShadow: '20px 20px 60px #bebebe,-20px -20px 60px #ffffff',
}"
>
<div :style="{ fontSize: '24px', paddingBottom: '30px' }">用户登录</div>
<div>
<a-input placeholder='用户名' v-model:value="form.account"/>
<a-input placeholder='密码' v-model:value="form.password" :style="{marginTop: '30px'}" type='password'/>
<a-button :style="{marginTop:'30px'}" @click="loginUser">登录</a-button>
<a-input placeholder="用户名" v-model:value="form.account" />
<a-input
placeholder="密码"
v-model:value="form.password"
:style="{ marginTop: '30px' }"
type="password"
/>
<a-button :style="{ marginTop: '30px' }" @click="loginUser">
登录
</a-button>
</div>
</div>
</div>
@@ -27,25 +47,27 @@ import {useRouter} from "vue-router";
export default {
name: "loginPage",
setup() {
const router = useRouter()
const router = useRouter();
const state = reactive({
form: {
account: '10181457',
password: '1234567890Aa'
}
})
account: "10181457",
password: "1234567890Aa",
},
});
async function loginUser() {
const {data: {data: token}} = await api.login(state.form)
setCookie("token", token, 10)
await router.push({path: '/learningpath'})
location.reload()
const {
data: { data: token },
} = await api.login(state.form);
setCookie("token", token, 10);
await router.push({ path: "/learningpath" });
location.reload();
}
return {
...toRefs(state),
loginUser
}
}
}
loginUser,
};
},
};
</script>

View File

@@ -420,7 +420,7 @@ export default {
console.log(888888888);
console.log(id);
console.log(curItem);
// 前端删除
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
state.allFormsData.splice(index, 1);
@@ -433,7 +433,8 @@ export default {
return item;
});
reload();
// 接口删除
if (state.assessmentId && curItem.orderNumber) {
if (type === 1) {
console.log(11111);
console.log(curItem);
@@ -486,6 +487,7 @@ export default {
reload();
});
}
}
};
const handleSave = () => {

View File

@@ -126,6 +126,7 @@ export default {
});
};
const del = ({ id, optionId }) => {
// 前端删除
curItem.value.singleList.forEach((item, index) => {
if (item.id === id) {
curItem.value.singleList.splice(index, 1);
@@ -134,7 +135,8 @@ export default {
curItem.value.singleList.map((item, index) => {
item.id = index + 1;
});
// 接口删除
if (assessmentId.value && optionId) {
deleteChoiceQuestion({
assessmentId: assessmentId.value,
questionType: "1",
@@ -143,6 +145,7 @@ export default {
console.log(56444);
console.log(res);
});
}
};
return {