头像上传组件调整

This commit is contained in:
wangxuemei
2024-08-07 17:06:23 +08:00
parent 4e963fc9cf
commit 5adb182c1f
5 changed files with 164 additions and 16 deletions

View File

@@ -14,7 +14,7 @@
<div class="qr_header"></div> <div class="qr_header"></div>
<div class="qr_main"> <div class="qr_main">
<div class="qrm_header"> <div class="qrm_header">
<span style="title">选择教师专长</span> <span style="title">{{Addtitle}}</span>
<div class="close_exit" @click="closeCodeModal"></div> <div class="close_exit" @click="closeCodeModal"></div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@@ -77,6 +77,14 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
Addtitle:{
type:String,
default: true,
},
AddContentList:{
type:Object,
default: true,
}
}, },
setup(props, ctx) { setup(props, ctx) {
const state = reactive({ const state = reactive({

View File

@@ -232,7 +232,20 @@
<a-radio :value="0">未认证</a-radio> <a-radio :value="0">未认证</a-radio>
<a-radio :value="1">已认证</a-radio> <a-radio :value="1">已认证</a-radio>
<span> <a-button type="text" class="moreidbtn" v-if="formParam.certStatus==1">上传凭证</a-button></span> <span>
<a-upload
multiple
:headers="headers"
:show-upload-list="false"
:before-upload="beforeUpload2"
>
<a-button type="text" class="moreidbtn" v-if="formParam.certStatus==1">上传凭证</a-button>
</a-upload>
<!-- <span>
支持.pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif,.zip
</span> -->
</span>
</a-radio-group> </a-radio-group>
<!-- <FJUpload v-if="formParam.certStatus==1" v-model:value="formParam.workEnclosureAddress"/> --> <!-- <FJUpload v-if="formParam.certStatus==1" v-model:value="formParam.workEnclosureAddress"/> -->
</a-form-item> </a-form-item>
@@ -349,7 +362,7 @@
</div> </div>
</a-modal> </a-modal>
</div> </div>
<AddContent v-model:showContent="showContent" @AddContentList="AddContentList" /> <AddContent v-model:showContent="showContent" @AddContentList="AddContentList" :Addtitle="Addtitle" />
<!-- <div> <Upload/> </div> --> <!-- <div> <Upload/> </div> -->
</div> </div>
</template> </template>
@@ -365,7 +378,8 @@ import Editor from "@/components/project/Editor";
import ProjectManager from "@/components/project/ProjectManagerNew"; import ProjectManager from "@/components/project/ProjectManagerNew";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { getTeacherSystemList, getTeacherList, getPayRollPlace, getLevel, insertTeacher, deleteInTeacher, updateInTeacher, getTeacherById, updateTeacherState, getTeacherExpertise, getTeacherExpertiseByPid, infoteacher, fileUp } from "../../api/Lecturer"; import { getTeacherSystemList, getTeacherList, getPayRollPlace, getLevel, insertTeacher, deleteInTeacher, updateInTeacher, getTeacherById, updateTeacherState } from "../../api/Lecturer";
import { fileUp } from "../../api/indexEval";
import {getCookieForName} from "@/api/method"; import {getCookieForName} from "@/api/method";
// import {getProjSt} from "../../api/indexProjStu"; // import {getProjSt} from "../../api/indexProjStu";
import AddContent from "../../components/project/AddContent.vue" import AddContent from "../../components/project/AddContent.vue"
@@ -384,6 +398,7 @@ export default {
setup() { setup() {
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
Addtitle:'选择教师专长',
showContent: false, showContent: false,
moreid: 1, moreid: 1,
byPid: null, byPid: null,
@@ -435,6 +450,8 @@ export default {
activeName: 'first' activeName: 'first'
}) })
const headers = { token: getCookieForName("token") }; const headers = { token: getCookieForName("token") };
//图片上传
const imageUrl = ref('')
const beforeUpload = (file) => { const beforeUpload = (file) => {
const isJpgOrPng = const isJpgOrPng =
file.type === "image/jpg" || file.type === "image/jpg" ||
@@ -457,6 +474,7 @@ export default {
const formDatas = new FormData(); const formDatas = new FormData();
formDatas.append("file", file); formDatas.append("file", file);
console.log("file", file)
fileUp(formDatas).then((res) => { fileUp(formDatas).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
console.log(res.data.data, 45); console.log(res.data.data, 45);
@@ -468,6 +486,47 @@ export default {
}); });
return false; return false;
}; };
//附件上传
const beforeUpload2 = (file) => {
console.log(6765555);
console.log(file);
const fileType = [
"jpg",
"jpeg",
"png",
"gif",
"pdf",
"ppt",
"pptx",
"doc",
"docx",
"xls",
"xlsx",
"zip",
];
if (!fileType.includes(file.name.split(".")[1])) {
message.error(
"仅支持.pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif,.zip格式!"
);
return false;
}
const formData = new FormData();
formData.append("file", file);
console.log(file);
fileUp(formData).then((res) => {
if (res.data.code === 200) {
state.imgList.push({
img: res.data.data,
name: file.name,
size: file.size,
});
console.log(state.imgList);
// state.hasImgName = res.data.data;
}
});
return false;
};
const LecturerSystemList = ref([ const LecturerSystemList = ref([
// { value: 0, systemName: "讲师体系" }, // { value: 0, systemName: "讲师体系" },
]); ]);
@@ -1039,6 +1098,7 @@ console.log( "讲师体系id" +val);
managerChange, managerChange,
headers, headers,
beforeUpload, beforeUpload,
imageUrl,
handlemoreid, handlemoreid,
// changeSelect, // changeSelect,
handleExport, handleExport,
@@ -1078,6 +1138,7 @@ console.log( "讲师体系id" +val);
getinfoteacher, getinfoteacher,
addContentData, addContentData,
AddContentList, AddContentList,
beforeUpload2,
} }
}, },
}; };

View File

@@ -94,9 +94,16 @@
<UploadOutlined /> 一键生成讲师费 <UploadOutlined /> 一键生成讲师费
</a-button> </a-button>
</div> --> </div> -->
<a-button @click="handleExport()" class="resetbtn"> <a-upload
multiple
:headers="headers"
:show-upload-list="false"
:before-upload="beforeUpload2"
>
<a-button class="resetbtn">
<DownloadOutlined /> 导入 <DownloadOutlined /> 导入
</a-button> </a-button>
</a-upload>
<a-button @click="handleExport()" class="resetbtn"> <a-button @click="handleExport()" class="resetbtn">
<UploadOutlined /> 导出 <UploadOutlined /> 导出
</a-button> </a-button>
@@ -295,7 +302,7 @@
<template #bodyCell="{ record, column }"> <template #bodyCell="{ record, column }">
<template v-if="column.key === 'operation'"> <template v-if="column.key === 'operation'">
<a-space > <a-space >
<a-button type="link" @click="() => handleLooka(record, String(record.courseform))">查看</a-button> <!-- <a-button type="link" @click="() => handleLooka(record, String(record.courseform))">查看</a-button> -->
</a-space> </a-space>
</template> </template>
</template> </template>
@@ -365,6 +372,7 @@ import { getTeacherSystemList, infoteacher, getTeacherExpertise, deleteInTeacher
import { getNewInTeacherCourseList, getOrganization, getTeacherCourseList, insertInTeacherCourse, updateInTeacherCourse ,getCharges} from "../../api/Teaching"; import { getNewInTeacherCourseList, getOrganization, getTeacherCourseList, insertInTeacherCourse, updateInTeacherCourse ,getCharges} from "../../api/Teaching";
// import AddTeacher from "../../components/drawers/project/AddTeacher" // import AddTeacher from "../../components/drawers/project/AddTeacher"
import ImportWork from "../../components/project/ImportWork.vue"; import ImportWork from "../../components/project/ImportWork.vue";
import { fileUp } from "../../api/Lecturer";
export default { export default {
name: "InsideTeaching", name: "InsideTeaching",
components: { components: {
@@ -981,9 +989,41 @@ export default {
const handleImport = () => { const handleImport = () => {
state.showWork = true state.showWork = true
} }
const beforeUpload2 = (file) => {
console.log(6765555);
console.log(file);
const fileType = [
"xls",
"xlsx",
"zip",
];
if (!fileType.includes(file.name.split(".")[1])) {
message.error(
"仅支持.xls,.xlsx,.zip格式!"
);
return false;
}
const formData = new FormData();
formData.append("file", file);
console.log(file);
fileUp(formData).then((res) => {
if (res.data.code === 200) {
state.imgList.push({
img: res.data.data,
name: file.name,
size: file.size,
});
console.log(state.imgList);
// state.hasImgName = res.data.data;
}
});
return false;
};
return { return {
...toRefs(state), ...toRefs(state),
managerChange, managerChange,
beforeUpload2,
rules, rules,
column, column,
tableDatas, tableDatas,

View File

@@ -80,9 +80,16 @@
<UploadOutlined /> 一键生成讲师费 <UploadOutlined /> 一键生成讲师费
</a-button> </a-button>
</div> --> </div> -->
<a-button @click="handleExport()" class="resetbtn"> <a-upload
multiple
:headers="headers"
:show-upload-list="false"
:before-upload="beforeUpload2"
>
<a-button class="resetbtn">
<DownloadOutlined /> 导入 <DownloadOutlined /> 导入
</a-button> </a-button>
</a-upload>
<a-button @click="handleExport()" class="resetbtn"> <a-button @click="handleExport()" class="resetbtn">
<UploadOutlined /> 导出 <UploadOutlined /> 导出
</a-button> </a-button>
@@ -392,7 +399,7 @@
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import ProjectManager from "@/components/project/ProjectManagerNew" import ProjectManager from "@/components/project/ProjectManagerNew"
import {getTeacherFeeList,getTeacherFeeDetail,addTeacherFee ,updateTeacherFee,updateStatusSubmit,approveTeacherFee,getTrainOrg,getTeacherLevel} from "../../api/lecturerFeeManagement";4 import {getTeacherFeeList,getTeacherFeeDetail,addTeacherFee ,updateTeacherFee,updateStatusSubmit,approveTeacherFee,getTrainOrg,getTeacherLevel} from "../../api/lecturerFeeManagement";4
import { getTeacherExpertise,getTeacherSystemList,getLevel,getPayRollPlace } from "../../api/Lecturer"; import { getTeacherExpertise,getTeacherSystemList,getLevel,getPayRollPlace,fileUp } from "../../api/Lecturer";
// lecturerFeeManagement // lecturerFeeManagement
// import {getProjSt} from "../../api/indexProjStu"; // import {getProjSt} from "../../api/indexProjStu";
// import AddTeacher from "../../components/drawers/project/AddTeacher" // import AddTeacher from "../../components/drawers/project/AddTeacher"
@@ -1040,9 +1047,41 @@ console.log( "讲师体系id" +val);
// ...state.searchParam // ...state.searchParam
// }, `project_${new Date().getTime()}.xlsx` ) // }, `project_${new Date().getTime()}.xlsx` )
} }
const beforeUpload2 = (file) => {
console.log(6765555);
console.log(file);
const fileType = [
"xls",
"xlsx",
"zip",
];
if (!fileType.includes(file.name.split(".")[1])) {
message.error(
"仅支持.xls,.xlsx,.zip格式!"
);
return false;
}
const formData = new FormData();
formData.append("file", file);
console.log(file);
fileUp(formData).then((res) => {
if (res.data.code === 200) {
state.imgList.push({
img: res.data.data,
name: file.name,
size: file.size,
});
console.log(state.imgList);
// state.hasImgName = res.data.data;
}
});
return false;
};
return { return {
...toRefs(state), ...toRefs(state),
rules, rules,
beforeUpload2,
closeDeleteTeacher, closeDeleteTeacher,
cancelTeachingDialog, cancelTeachingDialog,
managerChange, managerChange,

View File

@@ -126,29 +126,29 @@
</a-row> </a-row>
<div v-for="(item,index) in formParam.levelList " :key="index" > <div v-for="(item,index) in formParam.levelList " :key="index" >
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="4"> <a-col :span="4" >
<a-input v-model:value="item.levelName" class="draitem" placeholder="" allowClear showSearch> <a-input v-model:value="item.levelName" class="draitem" placeholder="0" allowClear showSearch>
</a-input> </a-input>
</a-col> </a-col>
<a-col :span="4" style="height: 5px;"> <a-col :span="4" style="height: 5px;">
<a-input v-model:value="item.levelTime " class="draitem" <a-input v-model:value="item.levelTime " class="draitem"
placeholder="" allowClear showSearch> placeholder="0" allowClear showSearch>
</a-input> </a-input>
</a-col> </a-col>
<a-col :span="4"> <a-col :span="4">
<a-input-number id="inputNumber" v-model:value="item.sort" :min="1" :max="999" class="draitem" /> <a-input-number id="inputNumber" v-model:value="item.sort" :min="1" :max="999" class="draitem" />
</a-col> </a-col>
<a-col :span="4"> <a-col :span="4" style="margin-top: 5px;">
<a-input v-model:value="item.levelPay" class="draitem" <a-input v-model:value="item.levelPay" class="draitem"
placeholder="" allowClear showSearch> placeholder="0" allowClear showSearch>
</a-input> </a-input>
</a-col> </a-col>
<a-col :span="4"> <a-col :span="4" style="margin-top: 5px;">
<a-input v-model:value="item.upperLimit" class="draitem" <a-input v-model:value="item.upperLimit" class="draitem"
placeholder="" allowClear showSearch> placeholder="0" allowClear showSearch>
</a-input> </a-input>
</a-col> </a-col>
<a-col :span="4"> <a-col :span="4" style="margin-top: -10px; margin-bottom: 10px;">
<div style="display: flex;"> <div style="display: flex;">
<!-- <a-button v-if="index===0" shape="circle" class="btn-circle btn-add" @click="inputAdd">+</a-button> --> <!-- <a-button v-if="index===0" shape="circle" class="btn-circle btn-add" @click="inputAdd">+</a-button> -->
<a-button shape="circle" class="btn-circle" @click="inputRemove(index)" :disabled="formParam.levelList.length == 1">-</a-button> <a-button shape="circle" class="btn-circle" @click="inputRemove(index)" :disabled="formParam.levelList.length == 1">-</a-button>