mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-22 09:16:46 +08:00
291 lines
6.0 KiB
Vue
291 lines
6.0 KiB
Vue
<!-- 评估管理-创建评估页面 -->
|
||
<template>
|
||
<div @click="openDrawer">
|
||
<slot></slot>
|
||
</div>
|
||
<a-drawer
|
||
:visible="visible"
|
||
class="drawerStyle createvoteDrawer"
|
||
width="800"
|
||
placement="right"
|
||
>
|
||
<div class="researchadd">
|
||
<div class="header">
|
||
<div class="headerTitle">
|
||
{{ options.length ? "编辑投票题干" : "创建投票题干" }}
|
||
</div>
|
||
<img
|
||
style="width: 29px; height: 29px; cursor: pointer"
|
||
src="../../assets/images/basicinfo/close.png"
|
||
@click="closeDrawer"
|
||
/>
|
||
</div>
|
||
<div class="main_left">
|
||
<div class="main_item">
|
||
<div class="signbox">
|
||
<div class="sign">
|
||
<img
|
||
src="@/assets/images/coursewareManage/asterisk.png"
|
||
alt="asterisk"
|
||
/>
|
||
</div>
|
||
<span>创建题干:</span>
|
||
</div>
|
||
<div class="btnbox">
|
||
<button class="xkbtn" @click="handleAdd">添加题干</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-for="(item, index) in formData" :key="index + Math.random()">
|
||
<VoteQuestion
|
||
v-if="!item.deleted"
|
||
:item="item"
|
||
:index="index"
|
||
@del="itemDel"
|
||
/>
|
||
</div>
|
||
|
||
<div class="footer">
|
||
<div class="btn">
|
||
<a-button
|
||
type="primary"
|
||
ghost
|
||
style="width: 100px; height: 40px; border-radius: 8px"
|
||
@click="closeDrawer"
|
||
>
|
||
取消
|
||
</a-button>
|
||
<a-button
|
||
type="primary"
|
||
style="
|
||
margin-left: 14px;
|
||
width: 100px;
|
||
height: 40px;
|
||
border-radius: 8px;
|
||
background-color: #4ea6ff;
|
||
"
|
||
@click="confirm"
|
||
>
|
||
保存
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-drawer>
|
||
</template>
|
||
<script setup>
|
||
import { defineEmits, defineProps, ref, watch } from "vue";
|
||
import VoteQuestion from "./VoteQuestion.vue";
|
||
import { message } from "ant-design-vue";
|
||
|
||
const props = defineProps({
|
||
options: [],
|
||
});
|
||
|
||
const emit = defineEmits({});
|
||
const formData = ref(
|
||
props.options && props.options.length
|
||
? [...props.options]
|
||
: [
|
||
{
|
||
voteStemName: "",
|
||
optionDetailList: [],
|
||
},
|
||
]
|
||
);
|
||
|
||
const visible = ref(false);
|
||
|
||
watch(
|
||
() => props.options.length,
|
||
() => {
|
||
formData.value =
|
||
props.options && props.options.length
|
||
? [...props.options]
|
||
: [
|
||
{
|
||
voteStemName: "",
|
||
optionDetailList: [],
|
||
},
|
||
];
|
||
}
|
||
);
|
||
|
||
function openDrawer() {
|
||
visible.value = true;
|
||
}
|
||
|
||
const closeDrawer = () => {
|
||
visible.value = false;
|
||
formData.value =
|
||
props.options && props.options.length
|
||
? [...props.options]
|
||
: [
|
||
{
|
||
voteStemName: "",
|
||
optionDetailList: [],
|
||
},
|
||
];
|
||
};
|
||
|
||
async function confirm() {
|
||
console.log(formData.value);
|
||
if (formData.value.some((t) => !t.voteStemName && !t.deleted)) {
|
||
message.warning("请输入题干名称");
|
||
return;
|
||
}
|
||
visible.value = false;
|
||
emit("update:options", formData.value);
|
||
}
|
||
|
||
function handleAdd() {
|
||
formData.value.push({
|
||
voteStemName: "",
|
||
optionDetailList: [],
|
||
});
|
||
}
|
||
|
||
function itemDel(i) {
|
||
formData.value[i].deleted = true;
|
||
}
|
||
</script>
|
||
<style lang="scss">
|
||
.researchadd {
|
||
.header {
|
||
height: 73px;
|
||
border-bottom: 1px solid #e8e8e8;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
margin-bottom: 25px;
|
||
|
||
.headerTitle {
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
color: #333333;
|
||
line-height: 25px;
|
||
margin-left: 24px;
|
||
}
|
||
}
|
||
|
||
.main_left {
|
||
margin-left: 50px;
|
||
padding-right: 30px;
|
||
flex: 1;
|
||
border-right: 1px solid #e8e8e8;
|
||
|
||
.main_item {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 32px;
|
||
|
||
.signbox {
|
||
width: 120px;
|
||
display: flex;
|
||
justify-content: end;
|
||
align-items: center;
|
||
|
||
.sign {
|
||
margin-right: 5px;
|
||
}
|
||
}
|
||
|
||
.btnbox {
|
||
display: flex;
|
||
flex: 1;
|
||
align-items: center;
|
||
|
||
.xkbtn {
|
||
cursor: pointer;
|
||
width: 130px;
|
||
height: 40px;
|
||
background: #4ea6ff;
|
||
border-radius: 8px;
|
||
border: 0;
|
||
margin-right: 8px;
|
||
color: #fff;
|
||
margin-right: 10px;
|
||
}
|
||
|
||
.fileTigan {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 3px 5px;
|
||
background-color: rgba(42, 103, 209, 0.4);
|
||
|
||
span {
|
||
margin-right: 5px;
|
||
}
|
||
|
||
.delBox {
|
||
width: 13px;
|
||
height: 13px;
|
||
background-image: url(@/assets/images/basicinfo/ch.png);
|
||
background-size: 100% 100%;
|
||
border-radius: 50%;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.main_item2 {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
margin-bottom: 32px;
|
||
|
||
.signbox {
|
||
width: 120px;
|
||
display: flex;
|
||
justify-content: end;
|
||
align-items: center;
|
||
|
||
.sign {
|
||
margin-right: 5px;
|
||
}
|
||
}
|
||
|
||
.kqszbox {
|
||
.qdqtbox {
|
||
margin-left: 56px;
|
||
}
|
||
|
||
.setbox {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-top: 10px;
|
||
margin-bottom: 24px;
|
||
|
||
.timerbox {
|
||
margin-top: 6px;
|
||
margin-right: 32px;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: nowrap;
|
||
}
|
||
}
|
||
}
|
||
|
||
.btnbox2 {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-start;
|
||
|
||
.xkbtn {
|
||
cursor: pointer;
|
||
width: 130px;
|
||
height: 40px;
|
||
background: #4ea6ff;
|
||
border-radius: 8px;
|
||
border: 0;
|
||
margin-right: 16px 8px 32px 0;
|
||
color: #fff;
|
||
margin-top: 16px;
|
||
margin-bottom: 60px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|