mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-19 15:56:47 +08:00
评估接口+课程部分
This commit is contained in:
439
src/views/research/components/ResearchAddItem.vue
Normal file
439
src/views/research/components/ResearchAddItem.vue
Normal file
@@ -0,0 +1,439 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<div class="itemRow">
|
||||
<div class="options">
|
||||
<div class="name">
|
||||
<div class="namebox">
|
||||
<div class="inname">选项{{ item.id }}</div>
|
||||
</div>
|
||||
<div class="in">
|
||||
<a-input
|
||||
v-model:value="curItem.inputVal"
|
||||
show-count
|
||||
:maxlength="30"
|
||||
style="border-radius: 8px"
|
||||
@change="handleInput"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="delete" @click="handleDel">删除</div>
|
||||
</div>
|
||||
<div class="name uploadContent">
|
||||
<a-upload
|
||||
v-show="!item.imgVal"
|
||||
class="in uploadBtn"
|
||||
:show-upload-list="false"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div class="addimg">+添加图片</div>
|
||||
</a-upload>
|
||||
<div v-show="item.imgVal" class="picture" style="position: relative">
|
||||
<img class="pictureimg" :src="item.imgVal" />
|
||||
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
||||
<img
|
||||
style="
|
||||
cursor: pointer;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
"
|
||||
src="../../../assets/images/basicinfo/close.png"
|
||||
@click="handleCancel"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { fileUp } from "../../../api/indexEval";
|
||||
|
||||
export default {
|
||||
name: "ResearchAddItem",
|
||||
props: {
|
||||
item: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const curItem = ref(props.item);
|
||||
const state = reactive({
|
||||
hasImgName: "",
|
||||
});
|
||||
|
||||
const handleInput = () => {
|
||||
emit("input", { id: curItem.value.id, val: curItem.value.inputVal });
|
||||
};
|
||||
const handleDel = () => {
|
||||
handleCancel();
|
||||
emit("del", { id: curItem.value.id, optionId: curItem.value.optionId });
|
||||
};
|
||||
const handleCancel = () => {
|
||||
state.hasImgName = "";
|
||||
emit("delImg", { id: curItem.value.id });
|
||||
};
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpg" ||
|
||||
file.type === "image/jpeg" ||
|
||||
file.type === "image/png" ||
|
||||
file.type === "image/svg" ||
|
||||
file.type === "image/bmp" ||
|
||||
file.type === "image/gif";
|
||||
if (!isJpgOrPng) {
|
||||
message.error("仅支持jpg、gif、png、jpeg、svg、bmp格式!");
|
||||
return false;
|
||||
}
|
||||
|
||||
let isLt1M = file.size / 10240 / 10240 <= 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error("图片大小超过10MB!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
console.log(file);
|
||||
fileUp(formData).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
state.hasImgName = file.name;
|
||||
emit("src", { id: curItem.value.id, src: res.data.data });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
curItem,
|
||||
handleInput,
|
||||
handleDel,
|
||||
handleCancel,
|
||||
beforeUpload,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.researchadd {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.title {
|
||||
color: #000000;
|
||||
font-size: 18px;
|
||||
//line-height: 36px;
|
||||
padding-top: 30px;
|
||||
padding-left: 37px;
|
||||
//font-weight: 500;
|
||||
}
|
||||
.goback {
|
||||
padding-right: 70px;
|
||||
//padding-top: 37px;
|
||||
position: relative;
|
||||
.return {
|
||||
display: inline-block;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
margin-top: 17px;
|
||||
margin-right: 10px;
|
||||
background-image: url("../../../assets/images/projectadd/return.png");
|
||||
}
|
||||
.returntext {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.addtype {
|
||||
display: flex;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
margin-right: 20px;
|
||||
align-items: center;
|
||||
margin-left: 41px;
|
||||
.addtypen {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
.types {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
height: 40px;
|
||||
color: #409eff;
|
||||
border: 1px solid #409eff;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
.typesCur {
|
||||
color: #fff;
|
||||
background: #409eff;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
width: 70%;
|
||||
min-width: 690px;
|
||||
margin-left: 38px;
|
||||
margin-top: 20px;
|
||||
.tagbox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.tagname {
|
||||
width: 90px;
|
||||
height: 32px;
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 134px;
|
||||
background: rgba(78, 166, 255, 0.1);
|
||||
border-radius: 4px;
|
||||
color: rgba(64, 158, 255, 1);
|
||||
font-size: 16px;
|
||||
}
|
||||
.deleteop {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
margin-top: 20px;
|
||||
margin-right: 30px;
|
||||
border: 1px solid #409eff;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
.del_text {
|
||||
color: #409eff;
|
||||
font-size: 14px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.scorebox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
margin-left: 70px;
|
||||
.scoretext {
|
||||
font-size: 14px;
|
||||
color: #56a3f9;
|
||||
}
|
||||
.number {
|
||||
display: flex;
|
||||
border: 1px solid #d7e5fd;
|
||||
border-radius: 5px;
|
||||
margin: 0 10px;
|
||||
padding: 5px;
|
||||
.btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 1px solid #56a3f9;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 5px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #56a3f9;
|
||||
line-height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
.picture {
|
||||
width: 100px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20px;
|
||||
margin-left: 133px;
|
||||
.pictureimg {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
.picturename {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.options {
|
||||
display: flex;
|
||||
}
|
||||
.delete {
|
||||
cursor: pointer;
|
||||
margin-top: 32px;
|
||||
margin-left: 20px;
|
||||
// float: right;
|
||||
color: #4ea6ff;
|
||||
font-size: 14px;
|
||||
}
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.name {
|
||||
width: 60%;
|
||||
// background-color: lightcoral;
|
||||
display: flex;
|
||||
margin-top: 20px;
|
||||
//align-items: center;
|
||||
//height: 40px;
|
||||
// border: 1px solid black;
|
||||
.namebox {
|
||||
width: 120px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
.nameimg {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
.inname {
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
margin-left: 7px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
flex: 1;
|
||||
.assess {
|
||||
display: flex;
|
||||
width: 226px;
|
||||
height: 40px;
|
||||
border: 1px solid #56a3f9;
|
||||
//margin-bottom: 20px;
|
||||
.assesstype {
|
||||
width: 50%;
|
||||
background: #56a3f9;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.assesswhole {
|
||||
width: 50%;
|
||||
background: rgba(86, 163, 249, 0.1);
|
||||
font-size: 14px;
|
||||
color: #6f6f6f;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.ratio {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 8px;
|
||||
color: #6f6f6f;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.addimg {
|
||||
cursor: pointer;
|
||||
color: rgba(78, 166, 255, 1);
|
||||
font-size: 14px;
|
||||
}
|
||||
.text {
|
||||
color: rgba(109, 117, 132, 1);
|
||||
font-size: 14px;
|
||||
//line-height: 24px;
|
||||
}
|
||||
.ant-radio-wrapper {
|
||||
}
|
||||
.ant-input {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
}
|
||||
.ant-select-selector {
|
||||
border-radius: 5px;
|
||||
// height: 120%;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.numberInp {
|
||||
width: 200px;
|
||||
.ant-input-number {
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
// .ant-input-number-input-wrap {
|
||||
// width: 200px;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
.name2 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.opinion {
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
.namebox {
|
||||
width: 120px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.in {
|
||||
margin-left: 14px;
|
||||
width: 500px;
|
||||
.ant-input-textarea-show-count {
|
||||
position: relative;
|
||||
height: 110px;
|
||||
}
|
||||
.ant-input-textarea-show-count::after {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 0px;
|
||||
}
|
||||
.ant-input {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.footer {
|
||||
width: 100%;
|
||||
margin-top: 31px;
|
||||
margin-bottom: 14px;
|
||||
.btn {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.uploadContent {
|
||||
display: block !important;
|
||||
.uploadBtn {
|
||||
margin-left: 120px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user