fear:修改测评投票

This commit is contained in:
dongwug
2022-11-03 10:10:34 +08:00
parent 059458ee2d
commit 560747af60
3 changed files with 76 additions and 2 deletions

View File

@@ -98,7 +98,7 @@
</div>
<div class="main_btns">
<button class="btn1">取消</button>
<button class="btn2">确定</button>
<button class="btn2" @click="createVoteText()">确定</button>
</div>
</div>
</a-drawer>
@@ -106,6 +106,11 @@
<script>
import { reactive, toRefs, ref } from "vue";
import CreVote from "../../components/drawers/CreVote.vue";
import { useRouter } from "vue-router";
import * as api from "../../api/indexVote";
import { message } from "ant-design-vue";
import { toDate } from "../../api/method";
const router = useRouter();
const options1 = ref([
{
value: "value1",
@@ -144,6 +149,10 @@ export default {
inputV1: "",
textV1: "",
crevotevisible: false,
time: undefined,
basevote:'',
endTimes: "",
startTimes: "",
});
const closeDrawer = () => {
ctx.emit("update:addvoteVisible", false);
@@ -153,6 +162,60 @@ export default {
};
const showDrawerCreVote = () => {
state.crevotevisible = true;
};
//创建投票信息
const createVoteText = () => {
if (!state.inputV1) {
message.destroy();
return message.info("请输入投票名称");
}
if (state.basevote == '') {
state.basevote = 1;
}
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: state.basevote,
createTime: "",
createUser: 0,
stem: "",
stemId: 0,
updateTime: "",
updateUser: 0,
voteEndTime: state.endTimes,
voteExplain: state.textV1,
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;
});
};
return {
...toRefs(state),
@@ -161,6 +224,7 @@ export default {
closeDrawer,
rowSelection,
options1,
createVoteText,
};
},
};