mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-16 06:16:46 +08:00
feat:创建投票创建题干 创建选项,评估编辑接口对接
This commit is contained in:
@@ -18,70 +18,79 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="contentMain">
|
<div class="contentMain">
|
||||||
<div class="box" @click="showDrawerCreVote">
|
<div class="box" @click="showDrawerCreVote">
|
||||||
<button class="cjtpbtn">创建标题</button>
|
<button class="cjtpbtn" @click="addQue()">创建题干</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_item">
|
<div class="queBox" v-for="(q, index) in questions" :key="index">
|
||||||
<div class="signbox">
|
<div class="main_item">
|
||||||
<div class="sign">
|
<div class="signbox">
|
||||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
<div class="sign">
|
||||||
|
<img
|
||||||
|
src="@/assets/images/coursewareManage/asterisk.png"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span style="margin-right: 3px">题干</span>
|
||||||
</div>
|
</div>
|
||||||
<span style="margin-right: 3px">题干:</span>
|
<div class="btnbox">
|
||||||
</div>
|
<a-input
|
||||||
<div class="btnbox">
|
v-model:value="q.inputV"
|
||||||
<a-input
|
style="width: 424px; height: 32px"
|
||||||
v-model:value="inputV1"
|
placeholder="请输入题干"
|
||||||
style="width: 424px; height: 32px"
|
/>
|
||||||
placeholder="请输入题干"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="main_item">
|
|
||||||
<div class="signbox">
|
|
||||||
<div class="sign">
|
|
||||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
|
||||||
</div>
|
</div>
|
||||||
<span style="margin-right: 3px">选项1:</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="option" v-for="(o, index) in q.options" :key="index">
|
||||||
<a-input
|
<div class="main_item">
|
||||||
v-model:value="inputV2"
|
<div class="signbox">
|
||||||
style="width: 424px; height: 32px"
|
<div class="sign">
|
||||||
/>
|
<img
|
||||||
<a-button type="link">+ 上传图片</a-button>
|
src="@/assets/images/coursewareManage/asterisk.png"
|
||||||
</div>
|
alt=""
|
||||||
</div>
|
/>
|
||||||
<div class="main_item">
|
</div>
|
||||||
<div class="signbox">
|
<span style="margin-right: 3px">{{ o.title }}</span>
|
||||||
<div class="sign">
|
</div>
|
||||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
<div class="btnbox">
|
||||||
|
<a-input
|
||||||
|
v-model:value="o.opvalue"
|
||||||
|
style="width: 424px; height: 32px"
|
||||||
|
/>
|
||||||
|
<a-button v-if="o.opvalue == ''" type="link"
|
||||||
|
>+ 上传图片</a-button
|
||||||
|
>
|
||||||
|
<a-button v-else type="link">删除</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span style="margin-right: 3px">选项2:</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="main_item">
|
||||||
<a-input
|
<div class="signbox"></div>
|
||||||
v-model:value="inputV3"
|
<div class="btnbox" @click="addOpt(q.options)">
|
||||||
style="width: 424px; height: 32px"
|
<div class="tjxxbtn"><div class="btntext">添加选项</div></div>
|
||||||
/>
|
</div>
|
||||||
<a-button type="link">+ 上传图片</a-button>
|
|
||||||
<a-button type="link">删除</a-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="main_item">
|
|
||||||
<div class="signbox"></div>
|
|
||||||
<div class="btnbox">
|
|
||||||
<div class="tjxxbtn"><div class="btntext">添加选项</div></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1">取消</button>
|
<button class="btn1">取消</button>
|
||||||
<button class="btn2">确定</button>
|
<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, ref } from "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 rowSelection = ref({
|
const rowSelection = ref({
|
||||||
checkStrictly: false,
|
checkStrictly: false,
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
onChange: (selectedRowKeys, selectedRows) => {
|
||||||
@@ -113,18 +122,109 @@ export default {
|
|||||||
inputV1: "",
|
inputV1: "",
|
||||||
inputV2: "",
|
inputV2: "",
|
||||||
inputV3: "",
|
inputV3: "",
|
||||||
|
time: undefined,
|
||||||
|
endTimes: "",
|
||||||
|
startTimes: "",
|
||||||
|
questions: [
|
||||||
|
{
|
||||||
|
inputV: "",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
title: "选项1",
|
||||||
|
opvalue: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "选项2",
|
||||||
|
opvalue: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const addQue = () => {
|
||||||
|
state.questions.push({
|
||||||
|
inputV: "",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
title: "选项1",
|
||||||
|
opvalue: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "选项2",
|
||||||
|
opvalue: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addOpt = (value) => {
|
||||||
|
console.log(value);
|
||||||
|
value.push({
|
||||||
|
title: "选项" + (value.length + 1 * 1),
|
||||||
|
opvalue: "",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
ctx.emit("update:crevoteVisible", false);
|
ctx.emit("update:crevoteVisible", false);
|
||||||
};
|
};
|
||||||
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 = {
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
|
createVoteText,
|
||||||
|
addQue,
|
||||||
|
addOpt,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user