Commit ee95fb75 authored by 杨梦雪's avatar 杨梦雪

填加在读学校

parent c0dcd083
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
v-model="referForm.id_card" v-model="referForm.id_card"
placeholder="填写真实身份证号" placeholder="填写真实身份证号"
size="small" size="small"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -471,6 +471,27 @@ ...@@ -471,6 +471,27 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 在读年级 -->
<el-col :span="12" v-show="configJson.grade == 1">
<el-form-item
label="在读年级"
prop="nation"
style="height: 73px"
:rules="
configJson.grade == 1
? referInfoRules.grade
: [{ required: false }]
"
>
<el-input
ref="nation"
v-model="referForm.grade"
placeholder="在读年级"
size="small"
clearable
/>
</el-form-item>
</el-col>
</el-row> </el-row>
<!-- 学校信息 --> <!-- 学校信息 -->
<div <div
...@@ -686,7 +707,7 @@ ...@@ -686,7 +707,7 @@
</div> </div>
<el-dialog :visible.sync="dialogVisible"> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="resultPicture" alt="" /> <img width="100%" :src="resultPicture" alt=""/>
</el-dialog> </el-dialog>
</div> </div>
</el-form-item> </el-form-item>
...@@ -700,832 +721,840 @@ ...@@ -700,832 +721,840 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import Cookie from "js-cookie"; import Cookie from "js-cookie";
import { import {
getAccount, getAccount,
getAchievementOss, getAchievementOss,
delPic, delPic,
setAccount, setAccount,
getProAndCity, getProAndCity,
getSchool, getSchool,
} from "r/index/signUp"; } from "r/index/signUp";
import { upload } from "r/index/network"; import {upload} from "r/index/network";
import validator from "common/validator"; import validator from "common/validator";
import area from "config/area"; import area from "config/area";
export default { export default {
name: "referInfo", name: "referInfo",
data() { data() {
const validateContent = (rule, value, callback) => { const validateContent = (rule, value, callback) => {
if (!this.referForm.birthday) { if (!this.referForm.birthday) {
callback(new Error("出生日期不能为空!")); callback(new Error("出生日期不能为空!"));
} else { } else {
callback(); callback();
} }
}; };
const validateContents = (rule, value, callback) => { const validateContents = (rule, value, callback) => {
if (!this.referForm.jiguan_code) { if (!this.referForm.jiguan_code) {
callback(new Error("籍贯不能为空!")); callback(new Error("籍贯不能为空!"));
} else { } else {
callback(); callback();
} }
}; };
return { return {
configJson: {}, configJson: {},
isUploading: false, // 图片上传蒙层 isUploading: false, // 图片上传蒙层
referForm: { referForm: {
name: null, name: null,
gender: null, gender: null,
age: null, age: null,
id_card: null, id_card: null,
education: null, education: null,
birthday: null, birthday: null,
jiguan_code: null, jiguan_code: null,
address: null, address: null,
country: null, country: null,
nation: null, nation: null,
start_school_date: null, start_school_date: null,
political_status: null, political_status: null,
phone: null, phone: null,
unit_and_identity: null, grade: null,
email: null, unit_and_identity: null,
recommend: null, email: null,
school_province: null, recommend: null,
school_city: null, school_province: null,
school: null, school_city: null,
school_contacts: null, school: null,
school_phone: null, school_contacts: null,
}, school_phone: null,
},
schoolName: {}, schoolName: {},
referInfoRules: { referInfoRules: {
name: [{ required: true, message: "姓名不能为空!", trigger: "blur" }], name: [{required: true, message: "姓名不能为空!", trigger: "blur"}],
gender: [ gender: [
{ required: true, message: "性别不能为空!", trigger: "change" }, {required: true, message: "性别不能为空!", trigger: "change"},
], ],
id_card: [ id_card: [
// { required: true, message: "身份证号不能为空!", trigger: "blur" }, // { required: true, message: "身份证号不能为空!", trigger: "blur" },
{ validator: validator.validateid_card, trigger: "blur" }, {validator: validator.validateid_card, trigger: "blur"},
], ],
birthday: [ birthday: [
{ {
required: true, required: true,
validator: validateContent, validator: validateContent,
trigger: "change", trigger: "change",
}, },
], ],
jiguan_code: [ jiguan_code: [
{ required: true, validator: validateContents, trigger: "change" }, {required: true, validator: validateContents, trigger: "change"},
], ],
nation: [ nation: [
{ required: true, message: "民族不能为空!", trigger: "change" }, {required: true, message: "民族不能为空!", trigger: "change"},
], ],
country: [ country: [
{ {
required: true, required: true,
message: "国籍不能为空!", message: "国籍不能为空!",
trigger: "change", trigger: "change",
}, },
], ],
start_school_date: [ start_school_date: [
{ {
required: true, required: true,
message: "入学年份不能为空!", message: "入学年份不能为空!",
trigger: "change", trigger: "change",
}, },
], ],
political_status: [ political_status: [
{ required: true, message: "政治面貌不能为空!", trigger: "blur" }, {required: true, message: "政治面貌不能为空!", trigger: "blur"},
], ],
email: [ email: [
{ required: true, message: "电子邮箱不能为空!", trigger: "blur" }, {required: true, message: "电子邮箱不能为空!", trigger: "blur"},
{ validator: validator.validateEmail, trigger: "blur" }, {validator: validator.validateEmail, trigger: "blur"},
], ],
age: [ grade: [
{ required: true, message: "年龄不能为空!", trigger: "blur" }, {required: true, message: "在读年级不能为空!", trigger: "blur"},
{ validator: validator.validateNumber, trigger: "blur" }, ],
], age: [
education: [ {required: true, message: "年龄不能为空!", trigger: "blur"},
{ required: true, message: "学历不能为空!", trigger: "change" }, {validator: validator.validateNumber, trigger: "blur"},
], ],
education: [
{required: true, message: "学历不能为空!", trigger: "change"},
],
// address: [ // address: [
// { required: true, message: "详细地址不能为空!", trigger: "blur" }, // { required: true, message: "详细地址不能为空!", trigger: "blur" },
// ], // ],
unit_and_identity: [ unit_and_identity: [
{ {
required: true, required: true,
message: "单位名称及身份不能为空!", message: "单位名称及身份不能为空!",
trigger: "blur", trigger: "blur",
}, },
], ],
school_province: [
{
required: true,
message: "请选择所在学校省份!",
trigger: "change",
},
],
school_city: [
{
required: true,
message: "请选择所在学校城市!",
trigger: "change",
},
],
school: [
{required: true, message: "请选择所在学校!", trigger: "change"},
],
school_contacts: [
{required: true, message: "请填写中学联系人!", trigger: "blur"},
],
school_phone: [
{
required: true,
message: "中学联系人电话(手机)不能为空!",
trigger: "blur",
},
{validator: validator.validatePhone, trigger: "blur"},
],
// backgroundPicture: [{ required: true, message: "请上传图片" }],
},
EducationArrs: ["初中", "高中", "大学", "硕士", "博士"],
countryList: area.country, //国籍
selectProvince: [], //省份
CityName: {}, //根据省份筛选出所有城市的对象
selectCityJiguan: [], //籍贯城市列表
selectCitySchool: [], //就读中学-城市列表
selectSchoolList: [], //就读中学-中学列表
jgProvinceCode: "", //省份id
jiguan_city: "", //城市id(和省份id拼接)
yearArrs: [], //生日涉及的近10年的年份
school_province: [ monthArrs: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
],
dayArrs: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
],
bdYear: "", //选择的生日年份
bdMonth: "", //选择的生日月份
bdDay: "", //选择的生日日期
//入学年份(初中高中)
gradeArrs: ["初中", "高中", "大学"],
//选择年级
start_grade: "",
start_year: "",
// 政治面貌
political_status: [
{ {
required: true, id: 1,
message: "请选择所在学校省份!", name: "党员",
trigger: "change",
}, },
],
school_city: [
{ {
required: true, id: 2,
message: "请选择所在学校城市!", name: "团员",
trigger: "change",
}, },
],
school: [
{ required: true, message: "请选择所在学校!", trigger: "change" },
],
school_contacts: [
{ required: true, message: "请填写中学联系人!", trigger: "blur" },
],
school_phone: [
{ {
required: true, id: 3,
message: "中学联系人电话(手机)不能为空!", name: "群众",
trigger: "blur",
}, },
{ validator: validator.validatePhone, trigger: "blur" },
], ],
// 中学(模糊搜索)
// backgroundPicture: [{ required: true, message: "请上传图片" }], // timeout: null,
}, // school: "",
// 上传的图片
EducationArrs: ["初中", "高中", "大学", "硕士", "博士"], dialogImageUrl: "",
countryList: area.country, //国籍 dialogVisible: false,
selectProvince: [], //省份 fileList: [],
CityName: {}, //根据省份筛选出所有城市的对象 resultPicture: "",
selectCityJiguan: [], //籍贯城市列表 dialogVisible: false,
selectCitySchool: [], //就读中学-城市列表 disabled: false, //限制输入框
selectSchoolList: [], //就读中学-中学列表 };
jgProvinceCode: "", //省份id },
jiguan_city: "", //城市id(和省份id拼接) created() {
yearArrs: [], //生日涉及的近10年的年份 const code = this.$store.state.indexIdentity;
this.referForm.phone = window.localStorage.getItem("phone" + code); //本地取用户手机号
monthArrs: [ this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱
"01", // console.log(this.referForm.email, " this.referForm.email");
"02", let signUpFile = window.localStorage.getItem(
"03", "sign_up_file_" + window.localStorage.getItem("phone" + code) + code
"04", );
"05", // console.log(signUpFile);
"06", if (signUpFile && JSON.parse(signUpFile).length > 0) {
"07", this.fileList = JSON.parse(signUpFile);
"08",
"09",
"10",
"11",
"12",
],
dayArrs: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
],
bdYear: "", //选择的生日年份
bdMonth: "", //选择的生日月份
bdDay: "", //选择的生日日期
//入学年份(初中高中)
gradeArrs: ["初中", "高中", "大学"],
//选择年级
start_grade: "",
start_year: "",
// 政治面貌
political_status: [
{
id: 1,
name: "党员",
},
{
id: 2,
name: "团员",
},
{
id: 3,
name: "群众",
},
],
// 中学(模糊搜索)
// timeout: null,
// school: "",
// 上传的图片
dialogImageUrl: "",
dialogVisible: false,
fileList: [],
resultPicture: "",
dialogVisible: false,
disabled: false, //限制输入框
};
},
created() {
const code = this.$store.state.indexIdentity;
this.referForm.phone = window.localStorage.getItem("phone" + code); //本地取用户手机号
this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱
// console.log(this.referForm.email, " this.referForm.email");
let signUpFile = window.localStorage.getItem(
"sign_up_file_" + window.localStorage.getItem("phone" + code) + code
);
// console.log(signUpFile);
if (signUpFile && JSON.parse(signUpFile).length > 0) {
this.fileList = JSON.parse(signUpFile);
}
this.getSchool();
// this.getProAndCity();
this.getTenYear();
this.getAccount(); // 页面信息个人获取
this.configJson = this.$store.state.configJson;
if (this.configJson.jiguanCity == 1 || this.configJson.school == 1) {
this.getProAndCity();
}
},
watch: {
referForm(val) {
console.log(val, "val");
for (var k in val) {
if (val[k] == null || !val[k]) {
val[k] = this.referForm[k];
}
}
this.selfInfo = val;
if (val.gender && val.gender !== "") {
// console.log(val.gender)
this.referForm.gender = val.gender;
}
//出生日期
if (val.birthday && val.birthday !== "") {
this.bdYear = val.birthday.slice(0, 4); //前4位取年
this.bdMonth = val.birthday.slice(4, 6); //中2位取月
this.bdDay = val.birthday.slice(6, 8); //后2位取日
}
//入学年份
if (val.start_school_date && val.start_school_date !== "") {
this.start_year = val.start_school_date.slice(0, 4); //年份
this.start_grade = val.start_school_date.slice(5, 8); //年级
}
//籍贯
if (
val.jiguan_city !== null &&
val.jiguan_province !== null &&
this.configJson.jiguanCity == 1
) {
if (this.referForm.jiguan_city) {
}
this.jgProvinceCode = Number(val.jiguan_province);
this.changeProvince(1, this.jgProvinceCode, true);
this.jiguan_city = Number(val.jiguan_city);
} }
// console.log(val.school_province, val.school_city, val.school); this.getSchool();
//学校 // this.getProAndCity();
if ( this.getTenYear();
val.school_province !== null && this.getAccount(); // 页面信息个人获取
val.school_city !== null && // console.log(this.$store.state.configJson)
val.school !== null && this.configJson = this.$store.state.configJson;
this.configJson.school == 1 if (this.configJson.jiguanCity == 1 || this.configJson.school == 1) {
) { this.getProAndCity();
this.referForm.school_province = Number(val.school_province);
this.referForm.school_city = Number(val.school_city);
this.referForm.school = Number(val.school);
// console.log(
// this.referForm.school_province,
// this.referForm.school_city,
// this.referForm.school
// );
this.changeProvince(2, this.referForm.school_province, true);
// console.log(this.referForm.school_city, 12322);
this.changeCity(this.referForm.school_city, true);
// console.log(this.referForm.school_city, 12322);
} }
}, },
}, watch: {
mounted() {}, referForm(val) {
methods: { console.log(val, "val");
// 页面信息个人获取 for (var k in val) {
getAccount() { if (val[k] == null || !val[k]) {
getAccount({}).then((res) => { val[k] = this.referForm[k];
// console.log(res, "getAccount"); }
if (res.data.code != 200) {
return this.$message.error(res.data.message);
} }
this.referForm = res.data.info; this.selfInfo = val;
if (res.data.info.jiguan_province && res.data.info.jiguan_city) { if (val.gender && val.gender !== "") {
this.referForm.jiguan_code = // console.log(val.gender)
res.data.info.jiguan_province.toString() + this.referForm.gender = val.gender;
res.data.info.jiguan_city.toString(); }
//出生日期
if (val.birthday && val.birthday !== "") {
this.bdYear = val.birthday.slice(0, 4); //前4位取年
this.bdMonth = val.birthday.slice(4, 6); //中2位取月
this.bdDay = val.birthday.slice(6, 8); //后2位取日
}
//入学年份
if (val.start_school_date && val.start_school_date !== "") {
this.start_year = val.start_school_date.slice(0, 4); //年份
this.start_grade = val.start_school_date.slice(5, 8); //年级
}
//籍贯
if (
val.jiguan_city !== null &&
val.jiguan_province !== null &&
this.configJson.jiguanCity == 1
) {
if (this.referForm.jiguan_city) {
}
this.jgProvinceCode = Number(val.jiguan_province);
this.changeProvince(1, this.jgProvinceCode, true);
this.jiguan_city = Number(val.jiguan_city);
} }
if (res.data.info.email == null) { // console.log(val.school_province, val.school_city, val.school);
const code = this.$store.state.indexIdentity; //学校
this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱 if (
val.school_province !== null &&
val.school_city !== null &&
val.school !== null &&
this.configJson.school == 1
) {
this.referForm.school_province = Number(val.school_province);
this.referForm.school_city = Number(val.school_city);
this.referForm.school = Number(val.school);
// console.log(
// this.referForm.school_province,
// this.referForm.school_city,
// this.referForm.school
// );
this.changeProvince(2, this.referForm.school_province, true);
// console.log(this.referForm.school_city, 12322);
this.changeCity(this.referForm.school_city, true);
// console.log(this.referForm.school_city, 12322);
} }
}); },
}, },
//获取近10年的年份 mounted() {
getTenYear() {
let nowDate = new Date();
let currentYear = nowDate.getFullYear();
// console.log(nowDate, currentYear);
let yearArr = [];
let rxYearArr = [];
for (let i = 0; i < 73; i++) {
let year = currentYear - i;
yearArr.push(year);
}
console.log(yearArr, "yearArr");
this.yearArrs = yearArr;
}, },
methods: {
// 页面信息个人获取
getAccount() {
getAccount({}).then((res) => {
// console.log(res, "getAccount");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.referForm = res.data.info;
console.log(this.referForm)
if (res.data.info.jiguan_province && res.data.info.jiguan_city) {
this.referForm.jiguan_code =
res.data.info.jiguan_province.toString() +
res.data.info.jiguan_city.toString();
}
if (res.data.info.email == null) {
const code = this.$store.state.indexIdentity;
this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱
}
});
},
//获取近10年的年份
getTenYear() {
let nowDate = new Date();
let currentYear = nowDate.getFullYear();
// console.log(nowDate, currentYear);
let yearArr = [];
let rxYearArr = [];
for (let i = 0; i < 73; i++) {
let year = currentYear - i;
yearArr.push(year);
}
console.log(yearArr, "yearArr");
this.yearArrs = yearArr;
},
//组装出生日期 //组装出生日期
getTime() { getTime() {
this.referForm.birthday = this.referForm.birthday =
this.bdYear.toString() + this.bdYear.toString() +
this.bdMonth.toString() + this.bdMonth.toString() +
this.bdDay.toString(); this.bdDay.toString();
// console.log(this.referForm.birthday); // console.log(this.referForm.birthday);
}, },
// 国籍 // 国籍
//组装入学年份 //组装入学年份
getyear() { getyear() {
this.referForm.start_school_date = this.start_year.toString(); this.referForm.start_school_date = this.start_year.toString();
// + "-" + // + "-" +
// this.start_grade.toString(); // this.start_grade.toString();
}, },
// 获取省份城市 // 获取省份城市
getProAndCity() { getProAndCity() {
getProAndCity({}).then((res) => { getProAndCity({}).then((res) => {
// console.log(res, "getProAndCity"); // console.log(res, "getProAndCity");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
this.selectProvince = res.data.province_list; this.selectProvince = res.data.province_list;
// this.CityName = res.data.city_list; // this.CityName = res.data.city_list;
// console.log(this.selectProvince, this.CityName); // console.log(this.selectProvince, this.CityName);
}); });
}, },
//选择籍贯省份change事件 //选择籍贯省份change事件
changeProvince(type, val, status) { changeProvince(type, val, status) {
// console.log(type, val); // console.log(type, val);
if (type == 1) { if (type == 1) {
this.selectCityJiguan = []; this.selectCityJiguan = [];
this.selectCityJiguan = this.getCurrentCityLists(val); this.selectCityJiguan = this.getCurrentCityLists(val);
if (!status) { if (!status) {
this.jiguan_city = ""; this.jiguan_city = "";
this.referForm.jiguan_code = ""; this.referForm.jiguan_code = "";
} }
} else { } else {
this.selectCitySchool = []; this.selectCitySchool = [];
this.selectCitySchool = this.getCurrentCityLists(val); //在此调用城市筛选列表 this.selectCitySchool = this.getCurrentCityLists(val); //在此调用城市筛选列表
if (!status) { if (!status) {
this.referForm.school_city = ""; this.referForm.school_city = "";
this.referForm.school = ""; this.referForm.school = "";
this.selectSchoolList = []; //重新选择省份时候,学校list清空 this.selectSchoolList = []; //重新选择省份时候,学校list清空
}
} }
} },
},
//返回当前省份下的城市列表 //返回当前省份下的城市列表
getCurrentCityLists(val) { getCurrentCityLists(val) {
let currentCity = []; let currentCity = [];
if ( if (
this.CityName == null || this.CityName == null ||
!this.CityName || !this.CityName ||
Object.values(this.CityName).length == 0 Object.values(this.CityName).length == 0
) { ) {
getProAndCity({}) getProAndCity({})
.then((res) => { .then((res) => {
// console.log(res, "getProAndCity"); // console.log(res, "getProAndCity");
if (res.data.code === 200) { if (res.data.code === 200) {
// this.selectProvince = res.data.province_list; // this.selectProvince = res.data.province_list;
this.CityName = res.data.city_list; this.CityName = res.data.city_list;
for (let key in this.CityName) { for (let key in this.CityName) {
if (this.CityName[key].parent_id == val) { if (this.CityName[key].parent_id == val) {
currentCity.push(this.CityName[key]); currentCity.push(this.CityName[key]);
}
} }
return currentCity;
} else {
this.$message.error(res.data.message);
} }
return currentCity; })
} else { .catch((err) => {
this.$message.error(res.data.message); this.$message.error(err);
});
} else {
for (let key in this.CityName) {
if (this.CityName[key].parent_id == val) {
currentCity.push(this.CityName[key]);
} }
})
.catch((err) => {
this.$message.error(err);
});
} else {
for (let key in this.CityName) {
if (this.CityName[key].parent_id == val) {
currentCity.push(this.CityName[key]);
} }
return currentCity;
} }
return currentCity; return currentCity;
} },
return currentCity;
},
// 籍贯城市change事件 // 籍贯城市change事件
getJiguan() { getJiguan() {
this.referForm.jiguan_code = this.referForm.jiguan_code =
this.jgProvinceCode.toString() + this.jiguan_city.toString(); this.jgProvinceCode.toString() + this.jiguan_city.toString();
}, },
getSchool() { getSchool() {
getSchool({}).then((res) => { getSchool({}).then((res) => {
// console.log(res, "getSchool"); // console.log(res, "getSchool");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
}
this.schoolName = res.data.school_list;
});
},
// 学校城市change事件
changeCity(val, status) {
// console.log(12345333,val,status)
this.selectSchoolList = [];
this.selectSchoolList = this.getCurrentSchoolLists(val);
console.log(this.selectSchoolList, "selectSchoolList");
if (!status) {
this.referForm.school = "";
} }
this.schoolName = res.data.school_list; // let data = this.selectSchoolList.map((item) => {
}); // return {
}, // name: item.id,
// 学校城市change事件 // value: item.name,
changeCity(val, status) { // };
// console.log(12345333,val,status) // });
this.selectSchoolList = []; // this.restaurants = data; //中学(模糊搜索)
this.selectSchoolList = this.getCurrentSchoolLists(val); },
console.log(this.selectSchoolList, "selectSchoolList");
if (!status) {
this.referForm.school = "";
}
// let data = this.selectSchoolList.map((item) => {
// return {
// name: item.id,
// value: item.name,
// };
// });
// this.restaurants = data; //中学(模糊搜索)
},
// 返回当前城市下的学校列表 // 返回当前城市下的学校列表
getCurrentSchoolLists(val) { getCurrentSchoolLists(val) {
let currentSchool = []; let currentSchool = [];
let baseSchool = this.$store.state.baseSchool; let baseSchool = this.$store.state.baseSchool;
if (baseSchool && baseSchool == 1) { if (baseSchool && baseSchool == 1) {
currentSchool.unshift({ currentSchool.unshift({
id: 0, id: 0,
name: "其他", name: "其他",
}); });
} }
// console.log(this.schoolName); // console.log(this.schoolName);
if ( if (
this.schoolName == null || this.schoolName == null ||
!this.schoolName || !this.schoolName ||
Object.values(this.schoolName).length == 0 Object.values(this.schoolName).length == 0
) { ) {
getSchool({}) getSchool({})
.then((res) => { .then((res) => {
// console.log(res) // console.log(res)
if (res.data.code === 200) { if (res.data.code === 200) {
this.schoolName = res.data.school_list; this.schoolName = res.data.school_list;
// console.log( this.schoolName) // console.log( this.schoolName)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem(
"schoolName" + code, "schoolName" + code,
JSON.stringify(res.data.list) JSON.stringify(res.data.list)
); );
for (let key in this.schoolName) { for (let key in this.schoolName) {
if (this.schoolName[key].city_id == val) { if (this.schoolName[key].city_id == val) {
currentSchool.push(this.schoolName[key]); currentSchool.push(this.schoolName[key]);
console.log(currentSchool, "currentSchool"); console.log(currentSchool, "currentSchool");
}
} }
return currentSchool;
} else {
this.$message.error(res.data.message);
} }
return currentSchool; })
} else { .catch((err) => {
this.$message.error(res.data.message); this.$message.error(err);
});
} else {
// console.log(this.schoolName, 111);
for (let key in this.schoolName) {
// console.log(key, this.schoolName[key]);
if (this.schoolName[key].city_id == val) {
currentSchool.push(this.schoolName[key]);
} }
})
.catch((err) => {
this.$message.error(err);
});
} else {
// console.log(this.schoolName, 111);
for (let key in this.schoolName) {
// console.log(key, this.schoolName[key]);
if (this.schoolName[key].city_id == val) {
currentSchool.push(this.schoolName[key]);
} }
// console.log(currentSchool, 222);
return currentSchool;
} }
// console.log(currentSchool, 222);
return currentSchool; return currentSchool;
} },
return currentSchool;
},
// 图片上传成功前钩子 // 图片上传成功前钩子
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
// console.log(file, "beforeImage"); // console.log(file, "beforeImage");
const isJPG = file.type === "image/jpg"; const isJPG = file.type === "image/jpg";
const isPng = file.type === "image/png"; const isPng = file.type === "image/png";
const isJPEG = file.type === "image/jpeg"; const isJPEG = file.type === "image/jpeg";
const isLt10M = file.size / 1024 / 1024 < 10; const isLt10M = file.size / 1024 / 1024 < 10;
// console.log(isLt10M) // console.log(isLt10M)
if (!isJPG && !isPng && !isJPEG) { if (!isJPG && !isPng && !isJPEG) {
this.$message.info("上传图片只能是 JPG,JPEG或png 格式!"); this.$message.info("上传图片只能是 JPG,JPEG或png 格式!");
} }
if (!isLt10M) { if (!isLt10M) {
this.$message.info("上传图片大小不能超过 10MB!"); this.$message.info("上传图片大小不能超过 10MB!");
} }
return (isJPG || isPng || isJPEG) && isLt10M; return (isJPG || isPng || isJPEG) && isLt10M;
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
console.log(file, "11111111"); console.log(file, "11111111");
this.resultPicture = file.url; this.resultPicture = file.url;
this.dialogVisible = true; this.dialogVisible = true;
}, },
// 文件上传中处理 // 文件上传中处理
handleUploadProgress(event, file, fileList) { handleUploadProgress(event, file, fileList) {
// console.log(fileList); // console.log(fileList);
this.isUploading = true; this.isUploading = true;
if (this.fileList.lenge < 10) { if (this.fileList.lenge < 10) {
return this.$message.info("chaochushuliamng"); return this.$message.info("chaochushuliamng");
} }
}, },
uploadSuccess(res, file, fileList) { uploadSuccess(res, file, fileList) {
// console.log(res, "res"); // console.log(res, "res");
// console.log(file, "file"); // console.log(file, "file");
// console.log(fileList, "fileList"); // console.log(fileList, "fileList");
this.referForm.achievementPath = res; this.referForm.achievementPath = res;
this.fileList = { this.fileList = {
name: file.name, name: file.name,
url: res, url: res,
}; };
this.$refs["imgUrl"].clearFiles(); //上传成功之后清除历史记录 this.$refs["imgUrl"].clearFiles(); //上传成功之后清除历史记录
}, },
uploadPicture(params) { uploadPicture(params) {
// console.log("已经准备好上传图片", params); // console.log("已经准备好上传图片", params);
this.file = params.file; this.file = params.file;
let raw = params.file; let raw = params.file;
let image = { let image = {
name: raw.name, name: raw.name,
size: raw.size, size: raw.size,
type: raw.type, type: raw.type,
}; };
this.getOssConfigs(image, params.file); this.getOssConfigs(image, params.file);
}, },
async getOssConfigs(image, file) { async getOssConfigs(image, file) {
let obj = { let obj = {
url: "", url: "",
savefile: "", savefile: "",
}; };
await getAchievementOss({ image: image }) await getAchievementOss({image: image})
.then((res) => { .then((res) => {
// console.log(res, "开始上传图片"); // console.log(res, "开始上传图片");
if (res.data.code === 200) { if (res.data.code === 200) {
let oss_url = res.data.config.host; let oss_url = res.data.config.host;
let filename = res.data.config.file; let filename = res.data.config.file;
let formData = new FormData(); let formData = new FormData();
formData.append("OSSAccessKeyId", res.data.config.accessid); formData.append("OSSAccessKeyId", res.data.config.accessid);
formData.append("policy", res.data.config.policy); formData.append("policy", res.data.config.policy);
formData.append("signature", res.data.config.signature); formData.append("signature", res.data.config.signature);
formData.append("filename", res.data.config.file); formData.append("filename", res.data.config.file);
formData.append("key", res.data.config.savefile); formData.append("key", res.data.config.savefile);
formData.append("callback", res.data.config.callback); formData.append("callback", res.data.config.callback);
formData.append("success_action_status", 200); formData.append("success_action_status", 200);
formData.append("file", file); formData.append("file", file);
// console.log(formData); // console.log(formData);
upload(oss_url, formData) upload(oss_url, formData)
.then((ress) => { .then((ress) => {
// console.log(ress, "ress"); // console.log(ress, "ress");
if (ress.data.code != 200) { if (ress.data.code != 200) {
console.log(ress, "ress"); console.log(ress, "ress");
return this.$message.error(ress.data.message); return this.$message.error(ress.data.message);
} }
this.resultPicture = filename + "?t=" + Date.parse(new Date()); this.resultPicture = filename + "?t=" + Date.parse(new Date());
this.$forceUpdate(); this.$forceUpdate();
this.$message.success("上传成功"); this.$message.success("上传成功");
obj = { obj = {
url: ress.data.picture_path, url: ress.data.picture_path,
savefile: res.data.config.savefile, savefile: res.data.config.savefile,
}; };
this.fileList.push(obj); this.fileList.push(obj);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem(
"sign_up_file_" + "sign_up_file_" +
+window.localStorage.getItem("phone" + code) + +window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(this.fileList) JSON.stringify(this.fileList)
); );
}) })
.catch((err) => { .catch((err) => {
this.$message.error(err); this.$message.error(err);
}); });
} else { } else {
this.$message.error(res.data.message); this.$message.error(res.data.message);
}
})
.catch((err) => {
// console.log(err);
});
},
// 下载证明资料图片
handleDownload(file) {
// console.log(file,'file22');
window.location.href = file.url;
},
//删除图片
handleRemove(file) {
// console.log(file, "file");
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let getfile = file.url;
// console.log(savefile.match(/^(?:[^\/]|\/\/)*/),'222222');//获取域名
let str = getfile.split(
"https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/"
); //https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/进行分割,
// console.log(str, "str");
let savefile = str[1];
// console.log(savefile, "savefile");
delPic({ object: savefile }).then((res) => {
// console.log(res, "delpic");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
} }
this.fileList.forEach((item, idx) => { })
// console.log(item.url == file.url); .catch((err) => {
if (item.url == file.url) { // console.log(err);
this.fileList.splice(idx, 1); });
let code = this.$store.state.indexIdentity; },
window.localStorage.setItem( // 下载证明资料图片
"sign_up_file_" + handleDownload(file) {
// console.log(file,'file22');
window.location.href = file.url;
},
//删除图片
handleRemove(file) {
// console.log(file, "file");
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let getfile = file.url;
// console.log(savefile.match(/^(?:[^\/]|\/\/)*/),'222222');//获取域名
let str = getfile.split(
"https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/"
); //https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/进行分割,
// console.log(str, "str");
let savefile = str[1];
// console.log(savefile, "savefile");
delPic({object: savefile}).then((res) => {
// console.log(res, "delpic");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.fileList.forEach((item, idx) => {
// console.log(item.url == file.url);
if (item.url == file.url) {
this.fileList.splice(idx, 1);
let code = this.$store.state.indexIdentity;
window.localStorage.setItem(
"sign_up_file_" +
window.localStorage.getItem("phone" + code) + window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(this.fileList) JSON.stringify(this.fileList)
); );
} }
});
// console.log(this.fileList);
this.$message.success(res.data.message);
});
})
.catch((err) => {
this.$message({
type: "info",
message: "取消删除",
}); });
// console.log(this.fileList);
this.$message.success(res.data.message);
}); });
}) },
.catch((err) => { // 滚动到固定地方
this.$message({ scrollView(object) {
type: "info", // console.log(object, "object");
message: "取消删除", for (let i in object) {
if (!i) {
continue;
}
let dom = this.$refs[i];
// console.log(i, dom);
if (!dom) {
continue;
}
// 这里是针对遍历的情况(多个输入框),取值为数组
if (Object.prototype.toString.call(dom) !== "[object Object]") {
dom = dom[0];
}
// 第一种方法(包含动画效果)
dom.$el.scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: "center",
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: "smooth",
}); });
}); break; // 因为我们只需要检测一项,所以就可以跳出循环了
},
// 滚动到固定地方
scrollView(object) {
// console.log(object, "object");
for (let i in object) {
if (!i) {
continue;
}
let dom = this.$refs[i];
// console.log(i, dom);
if (!dom) {
continue;
}
// 这里是针对遍历的情况(多个输入框),取值为数组
if (Object.prototype.toString.call(dom) !== "[object Object]") {
dom = dom[0];
}
// 第一种方法(包含动画效果)
dom.$el.scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: "center",
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: "smooth",
});
break; // 因为我们只需要检测一项,所以就可以跳出循环了
}
},
confirm() {
// console.log(111);
// console.log(this.referForm.birthday);
this.$refs["referRef"].validate((valid, object) => {
// console.log(valid, "valid");
if (!valid) {
this.scrollView(object);
return false;
} }
},
confirm() {
// console.log(111);
// console.log(this.referForm.birthday);
this.$refs["referRef"].validate((valid, object) => {
// console.log(valid, "valid");
if (!valid) {
this.scrollView(object);
return false;
}
let _this = this; let _this = this;
let obj = {}; let obj = {};
if (this.configJson.name == 1) { if (this.configJson.name == 1) {
obj.name = _this.ref obj.name = _this.referForm.name;
}
erForm.name; if (this.configJson.gender == 1) {
} obj.gender = _this.referForm.gender;
if (this.configJson.gender == 1) { }
obj.gender = _this.referForm.gender; if (this.configJson.idCard == 1) {
} obj.id_card = _this.referForm.id_card;
if (this.configJson.idCard == 1) { }
obj.id_card = _this.referForm.id_card; if (this.configJson.age == 1) {
} obj.age = _this.referForm.age;
if (this.configJson.age == 1) { }
obj.age = _this.referForm.age; if (this.configJson.education == 1) {
} obj.education = _this.referForm.education;
if (this.configJson.education == 1) { }
obj.education = _this.referForm.education;
}
if (this.configJson.postAddress == 1) { if (this.configJson.postAddress == 1) {
obj.address = _this.referForm.address; obj.address = _this.referForm.address;
} }
if (this.configJson.country == 1) { if (this.configJson.country == 1) {
obj.country = _this.referForm.country; obj.country = _this.referForm.country;
} }
if (this.configJson.nation == 1) { if (this.configJson.nation == 1) {
obj.nation = _this.referForm.nation; obj.nation = _this.referForm.nation;
} }
if (this.configJson.startSchoolDate == 1) { if (this.configJson.startSchoolDate == 1) {
obj.start_school_date = _this.start_year; obj.start_school_date = _this.start_year;
} }
if (this.configJson.phone == 1) { if (this.configJson.phone == 1) {
obj.phone = _this.referForm.phone; obj.phone = _this.referForm.phone;
} }
if (this.configJson.unitandIdentity == 1) { if (this.configJson.grade == 1) {
obj.unit_and_identity = _this.referForm.companyName; obj.grade = _this.referForm.grade;
} }
if (this.configJson.email == 1) { if (this.configJson.unitandIdentity == 1) {
obj.email = _this.referForm.email; obj.unit_and_identity = _this.referForm.companyName;
} }
if (this.configJson.jiguanCity == 1) { if (this.configJson.email == 1) {
obj.jiguan_code = _this.referForm.jiguan_code; obj.email = _this.referForm.email;
} }
if (this.configJson.recommend == 1) { if (this.configJson.jiguanCity == 1) {
obj.recommend = _this.referForm.recommend; obj.jiguan_code = _this.referForm.jiguan_code;
} }
if (this.configJson.recommend == 1) { if (this.configJson.recommend == 1) {
obj.start_school_date = _this.referForm.start_school_date; obj.recommend = _this.referForm.recommend;
} }
if (this.configJson.birthday == 1) { if (this.configJson.recommend == 1) {
obj.birthday = _this.referForm.birthday; obj.start_school_date = _this.referForm.start_school_date;
} }
if (this.configJson.school == 1) { if (this.configJson.birthday == 1) {
obj.school_province = _this.referForm.school_province; obj.birthday = _this.referForm.birthday;
obj.school_city = _this.referForm.school_city; }
obj.school = _this.referForm.school; if (this.configJson.school == 1) {
} obj.school_province = _this.referForm.school_province;
if (this.configJson.schoolContacts == 1) { obj.school_city = _this.referForm.school_city;
obj.school_contacts = _this.referForm.school_contacts; obj.school = _this.referForm.school;
} }
if (this.configJson.schoolPhone == 1) { if (this.configJson.schoolContacts == 1) {
obj.school_phone = _this.referForm.school_phone; obj.school_contacts = _this.referForm.school_contacts;
} }
setAccount(obj).then((res) => { if (this.configJson.schoolPhone == 1) {
// console.log(res, "setAccount"); obj.school_phone = _this.referForm.school_phone;
if (res.data.code != 200) { }
if (res.data.code == 400068) { setAccount(obj).then((res) => {
this.$parent.statuss(); // console.log(res, "setAccount");
if (res.data.code != 200) {
if (res.data.code == 400068) {
this.$parent.statuss();
return this.$message.error(res.data.message);
}
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
return this.$message.error(res.data.message); // console.log(3333);
} this.$emit("getstatus", res.data.status);
// console.log(3333); this.$message.success(res.data.message);
this.$emit("getstatus", res.data.status); // let code = this.$store.state.indexIdentity;
this.$message.success(res.data.message); // this.$router.push("/signUp/check?code=" + code);
// let code = this.$store.state.indexIdentity; this.referForm = res.data.data;
// this.$router.push("/signUp/check?code=" + code); });
this.referForm = res.data.data;
}); });
}); },
}, },
}, };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "a/scss/btn"; @import "a/scss/btn";
@import "a/scss/SignUp/referInfo"; @import "a/scss/SignUp/referInfo";
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment