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) RouterEditTask(editObj1)
.then((res) => { .then((res) => {
console.log("调用学历路径添加接口后", res.data); console.log("调用学历路径添加接口后", res.data);
ctx.emit("changeData", false);
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);

View File

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

View File

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