feta:创建题干信息接口

This commit is contained in:
dongwug
2022-11-04 15:40:09 +08:00
parent 00dad1d5af
commit 704e98cd5c
3 changed files with 52 additions and 84 deletions

View File

@@ -276,7 +276,6 @@ export default {
RouterEditTask(editObj1)
.then((res) => {
console.log("调用学历路径添加接口后", res.data);
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err);

View File

@@ -52,7 +52,8 @@
</div>
<!-- 创建投票侧弹窗 -->
<div>
<cre-vote v-model:crevoteVisible="crevotevisible" />
<cre-vote v-model:crevoteVisible="crevotevisible"
@setStemId="changeStemId"/>
</div>
<!-- 创建投票侧弹窗 -->
</div>
@@ -132,6 +133,7 @@ const rowSelection = ref({
console.log(selected, selectedRows, changeRows);
},
});
export default {
name: "AddVote",
components: {
@@ -204,8 +206,9 @@ export default {
.createVote(obj)
.then((res) => {
console.log("创建成功", res);
message.success("创建成功");
closeDrawer();
message.success("创建成功");
// changeStemId();
closeDrawer();
apitaskadd
.addTask({
courseId: 0,
@@ -223,6 +226,9 @@ export default {
// state.createLoading = false;
});
};
const changeStemId = (stemId) => {
console.log(stemId);
}
return {
...toRefs(state),
showDrawerCreVote,
@@ -231,6 +237,7 @@ export default {
rowSelection,
options1,
createVoteText,
changeStemId,
};
},
};

View File

@@ -72,41 +72,15 @@
</div>
<div class="main_btns">
<button class="btn1">取消</button>
<button
class="btn2"
onclick="{()=> {
createVoteText()
}}"
>
确定
</button>
<button class="btn2" @click="createQueTit">确定</button>
</div>
</div>
</a-drawer>
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router";
import { reactive, toRefs } from "vue";
import * as api from "../../api/indexVote";
import { message } from "ant-design-vue";
import { toDate } from "../../api/method";
const router = useRouter();
const rowSelection = ref({
checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => {
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
"selectedRows: ",
selectedRows
);
},
onSelect: (record, selected, selectedRows) => {
console.log(record, selected, selectedRows);
},
onSelectAll: (selected, selectedRows, changeRows) => {
console.log(selected, selectedRows, changeRows);
},
});
export default {
name: "CreVote",
// components: {
@@ -119,12 +93,6 @@ export default {
},
setup(props, ctx) {
const state = reactive({
inputV1: "",
inputV2: "",
inputV3: "",
time: undefined,
endTimes: "",
startTimes: "",
questions: [
{
inputV: "",
@@ -171,60 +139,54 @@ export default {
const afterVisibleChange = (bool) => {
console.log("state", bool);
};
//创建投票信息
const createVoteText = () => {
if (!state.inputV1) return message.info("请输入投票名称");
if (state.time != undefined) {
state.endTimes = toDate(
new Date(state.time[0].$d).getTime() / 1000,
"Y-M-D"
);
state.startTimes = toDate(
new Date(state.time[1].$d).getTime() / 1000,
"Y-M-D"
);
}
let obj = {
baseVote: "",
createTime: "",
createUser: 0,
stem: "",
stemId: 0,
updateTime: "",
updateUser: 0,
voteEndTime: state.endTimes,
voteExplain: "",
voteFlag: "",
voteId: 0,
voteName: state.inputV1,
voteStartTime: state.startTimes,
voteTag: "",
};
api
.createVote(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
// state.createLoading = false;
router.push("/leveladd");
// getLearnPath();
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
// state.createLoading = false;
});
const createQueTit = () => {
if (!state.questions[0].inputV) {
message.destroy();
return message.info("请输入题干");
}
// if (!state.questions.optins.opvalue) {
// message.destroy();
// return message.info("请输入选项");
// }
console.log(state.questions[0].inputV);
let obj = {
createTime: "",
createUser: 0,
optionDto: [
{
optionId: 0,
optionName: "",
optionPictureAddress: "",
},
],
optionId: 0,
optionName: "",
optionPictureAddress: "",
stem: state.questions[0].inputV,
stemId: 0,
updateTime: "",
updateUser: 0,
};
api
.createOptionMessage(obj)
.then((res) => {
console.log("创建成功", res);
message.success("创建成功");
// ctx.emit("setStemId",obj.stem);
closeDrawer();
})
.catch((err) => {
console.log(err);
});
};
return {
...toRefs(state),
afterVisibleChange,
closeDrawer,
rowSelection,
createVoteText,
addQue,
addOpt,
createQueTit,
};
},
};