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

11

parent 2b4c7f6d
.flex{
display: flex;
}
.referHome {
padding: 20px ;
.lf {
float: left;
}
.rt {
float: right;
}
::v-deep .readForm {
flex: 1;
.cont_title {
position: relative;
height: 38px;
line-height: 38px;
font-size: 16px;
font-family: PingFang SC;
font-weight: 500;
color: #12141c;
padding-left: 10px;
margin-top: 10px;
span {
margin-right: 15px;
}
.line {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 14px;
background-color: #12141c;
opacity: 0.4;
}
}
.cont_title_2 {
height: 28px;
line-height: 28px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 500;
color: #12141c;
padding: 0 10px;
}
.cont_info {
line-height: 20px;
font-size: 12px;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
padding: 0 10px 10px 10px;
}
.fj_info {
line-height: 24px;
font-size: 12px;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
}
.el-form-item {
margin-bottom: 15px;
padding: 0 10px;
.el-form-item__label {
height: 32px;
line-height: 32px;
font-size: 12px;
font-family: PingFang SC;
font-weight: 500;
color: #12141c;
}
.el-form-item__content {
.el-input,
.el-input-number {
width: 100%;
height: 36px;
.el-input__inner {
text-align: left;
height: 36px;
border-radius: 4px;
border: 1px solid #e1e3e6;
background-color: #ffffff;
color: #656872;
&:hover {
border-color: #4d75f3;
}
&:focus {
border-color: #4d75f3;
}
}
}
.el-textarea__inner {
min-height: 100px !important;
}
}
&.btn {
margin-top: 50px;
.el-form-item__content {
text-align: center;
}
}
}
.upload_box {
.img_list {
position: relative;
float: left;
width: 160px;
height: 120px;
text-align: center;
background: transparent;
border-radius: 4px;
border: 2px dashed #e1e3e6;
margin: 0 8px 8px 0;
padding: 5px;
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
> div {
width: 100%;
.el-image {
width: 30px;
height: 30px;
display: block;
margin: 0 auto;
img {
width: auto;
height: auto;
max-width: 100% !important;
max-height: 100% !important;
}
}
.item_name {
font-size: 12px;
color: #999999;
line-height: 16px;
word-wrap: break-word;
margin: 5px 0 10px;
}
.item_remove {
width: 40px;
font-size: 12px;
color: #999999;
font-weight: bold;
line-height: 16px;
margin: 0 auto;
&:hover {
cursor: pointer;
color: red;
}
}
}
}
.el-upload {
width: 160px !important;
height: 120px !important;
line-height: 120px !important;
background: transparent;
border-radius: 4px;
border: 2px dashed #e1e3e6;
text-align: center !important;
}
}
}
}
\ No newline at end of file
......@@ -552,16 +552,9 @@ export default {
bdDay: "", //选择的生日日期
//入学年份(初中高中)
gradeArrs: [
"初一",
"初二",
"初三",
"高一",
"高二",
"高三",
"大一",
"大二",
"大三",
"大四",
"初中",
"高中",
"大学",
],
//选择年级
start_grade: "",
......
//bus.js
import Vue from 'vue'
export default new Vue()
......@@ -158,8 +158,8 @@ function checkCam(code, cb) {
}
router.beforeEach((to, from, next) => {
console.log(to, 'to')
console.log(from, 'from')
// console.log(to, 'to')
// console.log(from, 'from')
let
toLogin = "/login",
toRegister = "/register",
......
......@@ -14,8 +14,9 @@ let state = {
data: [],
token: '',
indexIdentity:"",
// showDialog: false,
// dialogType: 0,
work_context:"",
enclosure_url:"",
info:{},
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
};
......
......@@ -82,7 +82,7 @@ export default {
url: svg2,
},
],
campindex_type: "",
campindex_type: 0,
index_status: "",
};
},
......
<template>
<div class="camp-index">
weweaaaa
</div>
<div class="camp-index">aaaa</div>
</template>
\ No newline at end of file
<template>
<div class="camp-index">
wewe
<div class="referInfo">
<el-form
ref="referRef"
:model="referForm"
label-position="top"
class="checkForm"
:rules="referInfoRules"
>
<div class="cont_title">个人信息</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<el-input
ref="name"
v-model="referForm.name"
placeholder="填写真实姓名"
size="small"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="gender">
<el-radio-group
v-model="referForm.gender"
ref="gender"
size="small"
>
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号" prop="id_card">
<el-input
ref="id_card"
v-model="referForm.id_card"
placeholder="填写真实身份证号"
size="small"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出生日期" prop="birthday">
<el-row :gutter="20">
<el-col :span="8">
<el-select v-model="bdYear" placeholder="年">
<el-option
v-for="(item, index) in yearArrs"
:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-select v-model="bdMonth" placeholder="月">
<el-option
v-for="(item, index) in monthArrs"
:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-select
ref="birthday"
v-model="bdDay"
placeholder="日"
@change="getTime"
>
<el-option
v-for="(item, index) in dayArrs"
:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="籍贯" prop="jiguan_code">
<el-row :gutter="20">
<el-col :span="12">
<!-- @keyup.enter.native="selsectProvince" -->
<el-select
v-model="jgProvinceCode"
placeholder="省"
@change="changeProvince(1, $event)"
>
<el-option
v-for="item in selectProvince"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-select
ref="jiguan_code"
v-model="jiguan_city"
placeholder="市"
@change="getJiguan()"
>
<el-option
v-for="item in selectCityJiguan"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="民族" prop="nation">
<el-input
ref="nation"
v-model="referForm.nation"
placeholder="填写民族"
size="small"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入学年份" prop="start_school_date">
<el-row :gutter="20">
<el-col :span="12">
<el-select v-model="start_grade" placeholder="年级" clearable>
<el-option
v-for="(item, index) in gradeArrs"
:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-select
ref="start_school_date"
v-model="start_year"
placeholder="年份"
clearable
@change="getyear()"
>
<el-option
v-for="(item, index) in yearArrs"
:key="index"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="政治面貌" prop="political_status">
<el-select
ref="political_status"
v-model="referForm.political_status"
placeholder="填写政治面貌"
clearable
>
<el-option
v-for="item in political_status"
:key="item.id"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号">
<el-input
v-model="referForm.phone"
placeholder="请输入手机号"
size="small"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电子邮箱" prop="email">
<el-input
v-model="referForm.email"
placeholder="填写电子邮箱"
size="small"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
<div class="cont_title">学校信息</div>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="就读中学" prop="school_province">
<el-select
ref="school_province"
v-model="referForm.school_province"
clearable
placeholder="省"
@change="changeProvince(2, $event)"
>
<el-option
v-for="item in selectProvince"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="no_label" label=" " prop="school_city">
<el-select
ref="school_city"
v-model="referForm.school_city"
clearable
placeholder="市"
@change="changeCity($event)"
>
<el-option
v-for="item in selectCitySchool"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="no_label" label=" " prop="school">
<el-select
ref="school"
v-model="referForm.school"
clearable
placeholder="中学"
>
<el-option
v-for="item in selectSchoolList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<div class="tipsMsg">
如果没有您所在学校,请联系邮箱:ydhdservice@163.com
</div>
<el-col :span="12">
<el-form-item label="中学联系人" prop="school_contacts">
<el-input
ref="school_contacts"
v-model="referForm.school_contacts"
placeholder="填写中学联系人"
size="small"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="中学联系人电话(手机)" prop="school_phone">
<el-input
ref="school_phone"
v-model="referForm.school_phone"
placeholder="填写中学联系人电话(手机)"
size="small"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item class="btn">
<el-button @click="confirm">提交资料</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
/* eslint-disable */
import {
getAccount,
setAccount,
getProAndCity,
getSchool,
} from "r/index/signUp";
import validator from "common/validator";
export default {
name: "info-personalInfo",
name: "CheckForm",
data() {
const validateContent = (rule, value, callback) => {
if (!this.referForm.birthday) {
callback(new Error("出生日期不能为空!"));
} else {
callback();
}
};
const validateContents = (rule, value, callback) => {
if (!this.referForm.jiguan_code) {
callback(new Error("籍贯不能为空!"));
} else {
callback();
}
};
return {
isUploading: false, // 图片上传蒙层
referForm: {
name: null,
gender: null,
id_card: null,
birthday: null,
jiguan_code: null,
nation: null,
start_school_date: null,
political_status: null,
phone: null,
email: null,
school_province: null,
school_city: null,
school: null,
school_contacts: null,
school_phone: null,
},
schoolName: {},
referInfoRules: {
name: [{ required: true, message: "姓名不能为空!", trigger: "blur" }],
gender: [
{ required: true, message: "性别不能为空!", trigger: "change" },
],
id_card: [
{ required: true, message: "身份证号不能为空!", trigger: "blur" },
{ validator: validator.validateid_card, trigger: "blur" },
],
birthday: [
{
required: true,
validator: validateContent,
trigger: "change",
},
],
jiguan_code: [
{ required: true, validator: validateContents, trigger: "change" },
],
nation: [
{ required: true, message: "民族不能为空!", trigger: "change" },
],
start_school_date: [
{
required: true,
message: "入学年份不能为空!",
trigger: "change",
},
],
political_status: [
{ required: true, message: "政治面貌不能为空!", trigger: "blur" },
],
// email: [
// { required: true, message: "电子邮箱不能为空!", trigger: "blur" },
// { validator: validator.validateEmail, 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: "请上传图片" }],
},
selectProvince: [], //省份
CityName: {}, //根据省份筛选出所有城市的对象
selectCityJiguan: [], //籍贯城市列表
selectCitySchool: [], //就读中学-城市列表
selectSchoolList: [], //就读中学-中学列表
jgProvinceCode: "", //省份id
jiguan_city: "", //城市id(和省份id拼接)
yearArrs: [], //生日涉及的近10年的年份
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: [
{
id: 1,
name: "党员",
},
{
id: 2,
name: "团员",
},
{
id: 3,
name: "群众",
},
],
// 上传的图片
dialogImageUrl: "",
dialogVisible: false,
fileList: [],
resultPicture: "",
dialogVisible: false,
disabled: false, //限制输入框
};
},
mounted() {},
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(); // 页面信息个人获取
},
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) {
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);
//学校
if (
val.school_province !== null &&
val.school_city !== null &&
val.school !== null
) {
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);
}
},
},
methods: {
//获取近10年的年份
getTenYear() {
let nowDate = new Date();
let currentYear = nowDate.getFullYear();
// console.log(nowDate, currentYear);
let yearArr = [];
let rxYearArr = [];
for (let i = 0; i < 42; i++) {
let year = currentYear - i;
yearArr.push(year);
}
// console.log(yearArr, "yearArr");
for (let i = 0; i < 10; i++) {
let year = currentYear - i;
rxYearArr.push(year);
}
this.yearArrs = yearArr;
this.rxYearArrs = rxYearArr;
},
// 页面信息个人获取
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;
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); //本地取用户邮箱
}
});
},
//组装出生日期
getTime() {
this.referForm.birthday =
this.bdYear.toString() +
this.bdMonth.toString() +
this.bdDay.toString();
// console.log(this.referForm.birthday);
},
//组装入学年份
getyear() {
this.referForm.start_school_date =
this.start_year.toString() + "-" + this.start_grade.toString();
},
// 获取省份城市
getProAndCity() {
getProAndCity({}).then((res) => {
// console.log(res, "getProAndCity");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.selectProvince = res.data.province_list;
// this.CityName = res.data.city_list;
// console.log(this.selectProvince, this.CityName);
});
},
//选择籍贯省份change事件
changeProvince(type, val, status) {
// console.log(type, val);
if (type == 1) {
this.selectCityJiguan = [];
this.selectCityJiguan = this.getCurrentCityLists(val);
if (!status) {
this.jiguan_city = "";
this.referForm.jiguan_code = "";
}
} else {
this.selectCitySchool = [];
this.selectCitySchool = this.getCurrentCityLists(val); //在此调用城市筛选列表
if (!status) {
this.referForm.school_city = "";
this.referForm.school = "";
this.selectSchoolList = []; //重新选择省份时候,学校list清空
}
}
},
//返回当前省份下的城市列表
getCurrentCityLists(val) {
let currentCity = [];
if (
this.CityName == null ||
!this.CityName ||
Object.values(this.CityName).length == 0
) {
getProAndCity({})
.then((res) => {
// console.log(res, "getProAndCity");
if (res.data.code === 200) {
// this.selectProvince = res.data.province_list;
this.CityName = res.data.city_list;
for (let key in this.CityName) {
if (this.CityName[key].parent_id == val) {
currentCity.push(this.CityName[key]);
}
}
return currentCity;
} else {
this.$message.error(res.data.message);
}
})
.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;
},
// 籍贯城市change事件
getJiguan() {
this.referForm.jiguan_code =
this.jgProvinceCode.toString() + this.jiguan_city.toString();
},
getSchool() {
getSchool({}).then((res) => {
// console.log(res, "getSchool");
if (res.data.code != 200) {
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);
if (!status) {
this.referForm.school = "";
}
},
// 返回当前城市下的学校列表
getCurrentSchoolLists(val) {
let currentSchool = [];
// console.log(this.schoolName);
if (
this.schoolName == null ||
!this.schoolName ||
Object.values(this.schoolName).length == 0
) {
getSchool({})
.then((res) => {
// console.log(res)
if (res.data.code === 200) {
this.schoolName = res.data.school_list;
let code = this.$store.state.indexIdentity;
window.localStorage.setItem(
"schoolName" + code,
JSON.stringify(res.data.list)
);
for (let key in this.schoolName) {
if (this.schoolName[key].city_id == val) {
currentSchool.push(this.schoolName[key]);
}
}
return currentSchool;
} else {
this.$message.error(res.data.message);
}
})
.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;
}
return currentSchool;
},
// 滚动到固定地方
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;
}
setAccount(this.referForm).then((res) => {
// 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);
}
// console.log(3333);
this.$emit("getstatus", res.data.status);
this.$message.success(res.data.message);
// let code = this.$store.state.indexIdentity;
// this.$router.push("/signUp/check?code=" + code);
this.referForm = res.data.data;
});
});
},
},
};
</script>
<style scoped lang="scss">
@import "a/scss/btn";
@import "a/scss/SignUp/referInfo";
</style>
......@@ -12,26 +12,23 @@
<p>请于2021年XX年XX月XX日 前往网站查看作业</p>
</div> -->
<div class="home_content">
<div class="each_content">
<div class="each_content" v-for="item in homeworkList" :key="item.id">
<div class="top flex">
<div class="homework_name flex">
<div>作业名称:第一次课程论文</div>
<div>作业名称:{{ item.work_name }}</div>
<span>未完成</span>
</div>
<el-button size="mini" round @click="toRefer()">查看作业</el-button>
<el-button size="mini" round @click="toRefer(item)"
>查看作业</el-button
>
</div>
<div class="line"></div>
<div class="bottom">
<p>
简介:Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus
accumsan et viverra justo commodo. Proin sodales pulvinar sic
tempor. Sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Nam fermentum。
</p>
<div v-html="item.work_context">></div>
<div class="time flex">
<div>发布时间:2021-8-21 19:00</div>
<div>截止日期:2021-8-21 19:00</div>
<div>发布时间:{{ item.create_time }}</div>
<div>截止日期:{{ item.end_time }}</div>
</div>
</div>
</div>
......@@ -44,22 +41,29 @@
<script>
/* eslint-disable */
import { getTeacherWork } from "r/index/homework";
import Bus from "config/bus.js";
export default {
name: "homework",
data() {
return {};
return {
homeworkList: {},
};
},
created() {
this.getTeacherWork();
},
watch: {},
methods: {
toRefer() {
toRefer(item) {
// console.log(val,'val')
let code = this.$store.state.indexIdentity;
this.$router.push("/homework/refer?code=" + code);
this.$emit("torefer", 3);
window.localStorage.setItem("work_context" + code, item.work_context);
window.localStorage.setItem("enclosure_url" + code, item.enclosure_url);
// Bus.$emit("work_context", item.work_context);
// Bus.$emit("enclosure_url", item.enclosure_url);
},
getTeacherWork() {
getTeacherWork({ page: 1 }).then((res) => {
......@@ -67,6 +71,7 @@ export default {
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.homeworkList = res.data.data;
this.$message.success(res.data.message);
});
},
......
......@@ -101,12 +101,7 @@ export default {
homework_val: "",
};
},
watch: {
// type(val) {
// console.log(val,'val')
// window.localStorage.setItem("campindex_type", val);
// },
},
watch: {},
created() {
this.getStatus();
this.torefer();
......@@ -137,10 +132,10 @@ export default {
this.$router.push("/signUp/" + this.index_status + "?code=" + code);
this.homework_val == "";
} else if (this.campindex_type == 1) {
console.log(this.$route)
this.$router.push("/homework?code=" + code);
} else if (this.campindex_type == 2) {
this.$router.push("/certificate?code=" + code);
}
},
onResize() {
......
<template>
<div>
1111111
</div>
<div class="referHome">
<div class="rh_top flex">
<i class="el-icon-arrow-left"></i>
<div>第三次课程论文</div>
</div>
<el-form
v-loading="loading"
ref="formRef"
:model="formData"
:rules="rules"
label-position="top"
class="readForm"
>
<div class="cont_title">
<div class="line"></div>
<div class="lf">
<span>
{{ stuWork.jiguanProvince
}}{{
stuWork.jiguanProvince == stuWork.jiguanCity
? ""
: stuWork.jiguanCity
}}{{ stuWork.school }}</span
>
<span>{{ stuWork.name }}</span>
<span>提交的作业</span>
</div>
<div class="rt" v-if="type == 1">编号: {{ stuInfo.workNum }}</div>
</div>
<div class="cont_title_2">文字描述</div>
<div class="cont_info">{{ $store.state.work_context }}</div>
<div class="cont_title_2">相关附件</div>
<div class="upload_box">
<div
v-if="stuFileList.length > 0"
class="img_list"
v-for="(item, index) in stuFileList"
:key="index"
>
<div>
<el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div>
<div class="item_remove" @click="downloadStuFile(item.url)">
下载
</div>
</div>
</div>
<div v-if="stuFileList.length <= 0" class="img_list">
<div>
<div class="item_name">暂无相关附件</div>
</div>
</div>
<div style="clear: both"></div>
</div>
<div class="cont_title">
<div class="line"></div>
评阅结果
</div>
<el-form-item label="导师评分" prop="score">
<el-input
v-model="formData.score"
size="small"
placeholder="请评分(输入0-100之内的整数)"
@input="inputValue"
/>
</el-form-item>
<el-form-item label="导师评语" prop="teaCommment">
<el-input
type="textarea"
v-model="formData.teaCommment"
placeholder="请输入300字以内的评语"
size="small"
:maxlength="300"
show-word-limit
/>
</el-form-item>
<el-form-item label="相关附件" prop="teacherUrl">
<div class="fj_info">1、请上传1-10份相关附件;</div>
<div class="fj_info">
2、单个附件大小不超过100M,支持JPG、JPEG、PNG、docx、doc、pdf、mp4等格式;
</div>
<div class="upload_box">
<div
class="img_list"
v-for="(item, index) in teaFileList"
:key="index"
>
<div>
<el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div>
<div class="item_remove" @click="handleRemove(item)">删除</div>
</div>
</div>
<el-upload
v-if="teaFileList.length < 10"
ref="systemLogo"
name="multipartFile"
:action="imgAction"
:file-list="teaFileList"
:disabled="upLoading"
list-type="picture-card"
:show-file-list="false"
:before-upload="beforeUpload"
:on-progress="handleProgress"
:on-success="handleSuccess"
>
<i v-if="!upLoading" class="el-icon-plus avatar-uploader-icon"></i>
<i
v-if="upLoading"
class="el-icon-loading avatar-uploader-icon"
></i>
</el-upload>
</div>
</el-form-item>
<el-form-item class="btn">
<el-button type="primary" @click="confirm">保存</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
// import {getToken} from "@/utils/auth";
import Bus from "config/bus.js";
import {
GetStuWork,
SaveTheRead,
GetAllReadInfo,
SaveYiRead,
} from "r/index/homework";
import fileImg from "@/assets/img/homework/file_img.png";
export default {
name: "ReadForm",
props: {
// dialogVisibleFu: Boolean,
campIdFu: [Number, String],
stuInfoFu: [Object, String],
typeFu: [Number, String],
},
data() {
return {
work_context: "", //简介
fileImg: fileImg,
loading: false,
dialogVisible: this.dialogVisibleFu,
type: this.typeFu, // 来源(1-未评阅 2-已评阅)
campId: this.campIdFu,
stuInfo: this.stuInfoFu, // 学生-信息
stuWork: {}, // 学生-作业
stuFileList: [], // 学生-相关附件
teaFileList: [], // 老师-相关附件
formData: {
campId: null,
stuWorkNum: null,
uuid: null,
score: null,
teaCommment: null,
teacherUrl: null,
}, // 老师-评阅结果
rules: {
score: [
{
required: true,
message: "请评分(输入0-100之内的整数)",
trigger: "blur",
},
],
},
upLoading: false, // 老师-上传loading
// 上传图片请求头
// headers: {
// Authorization: "Bearer " + getToken()
// },
imgAction:
process.env.VUE_APP_BASE_API +
"/modules-campsite/ld/UploadWorkForStudent",
};
},
created() {
console.log( this.$store.state.work_context)
// this.work_context = this.$store.state.work_context;
},
methods: {
open() {
if (this.type == 1) {
this.getStuWork();
} else if (this.type == 2) {
this.getYiStuWork();
}
},
// 保存按钮
confirm() {
this.$refs["formRef"].validate((valid) => {
if (!valid) return;
if (this.type == 1) {
this.notReadHandle();
} else if (this.type == 2) {
this.yiReadHandle();
}
});
},
// 下载学生附件
downloadStuFile(url) {
window.location.href = url;
},
// 导师评分0-100限制
inputValue(value) {
if (value.length > 1 && value.slice(0, 1) == 0) {
return (this.formData.score = 0);
} else if (value.length >= 3 && value > 100) {
return (this.formData.score = 100);
}
this.formData.score = value.replace(/[^\d]/g, "");
},
// 已评阅-获取学生答案
getYiStuWork() {
GetAllReadInfo({
campId: this.campId,
stuWorkNum: this.stuInfo.stuWorkNum,
uuid: this.stuInfo.uuid,
})
.then((response) => {
console.log(response);
if (response.code != 200) {
return this.msgError(response.msg);
}
this.stuWork = response.data;
this.formData.score = this.stuWork["score"];
this.formData.teaCommment = this.stuWork["teacherCommment"];
this.formData.teacherUrl = this.stuWork["teacherUrl"];
let url = this.stuWork.stuEnclosureUrl;
if (this.stuWork.stuEnclosureUrl) {
let arr = url.split(",");
arr.forEach((item) => {
this.stuFileList.push({
url: item,
name: item.split("/work/")[1],
status: "success",
});
});
} else {
this.stuFileList = [];
}
let urlT = this.stuWork.teacherUrl;
if (this.stuWork.teacherUrl) {
let arr = urlT.split(",");
arr.forEach((item) => {
this.teaFileList.push({
url: item,
name: item.split("/workforstudent/")[1],
status: "success",
});
});
} else {
this.teaFileList = [];
}
})
.catch((error) => {
console.log(error);
});
},
// 已评阅-评阅
// yiReadHandle(){
// this.formData.campId = this.campId;
// this.formData.stuWorkNum = this.stuInfo.stuWorkNum;
// this.formData.uuid = this.stuInfo.uuid;
// SaveYiRead(this.formData)
// .then(response => {
// console.log(response);
// if (response.code != 200) {
// return this.msgError(response.msg);
// }
// this.msgSuccess(response.msg);
// this.cancelBtnTrue();
// })
// .catch(error => {
// console.log(error);
// });
// },
// 未评阅-获取学生答案
getStuWork() {
GetStuWork({
campId: this.campId,
stuWorkNum: this.stuInfo.stuWorkNum,
uuid: this.stuInfo.uuid,
})
.then((response) => {
console.log(response);
if (response.code != 200) {
return this.msgError(response.msg);
}
this.stuWork = response.data;
let url = this.stuWork.stuEnclosureUrl;
if (this.stuWork.stuEnclosureUrl) {
let arr = url.split(",");
arr.forEach((item) => {
this.stuFileList.push({
url: item,
name: item.split("/work/")[1],
status: "success",
});
});
} else {
this.stuFileList = [];
}
})
.catch((error) => {
console.log(error);
});
},
// 未评阅-评阅
notReadHandle() {
this.formData.campId = this.campId;
this.formData.stuWorkNum = this.stuInfo.stuWorkNum;
this.formData.uuid = this.stuInfo.uuid;
SaveTheRead(this.formData)
.then((response) => {
console.log(response);
if (response.code != 200) {
return this.msgError(response.msg);
}
this.msgSuccess(response.msg);
this.cancelBtnTrue();
})
.catch((error) => {
console.log(error);
});
},
// 成功确认取消,关闭弹框,修改父组件的值
cancelBtnTrue() {
this.stuWork = {};
this.stuFileList = [];
this.teaFileList = [];
this.$refs["formRef"].resetFields();
this.dialogVisible = false;
this.$emit("closeDialog", this.dialogVisible, true);
},
// 取消,关闭弹框,修改父组件的值
cancelBtn() {
this.stuWork = {};
this.stuFileList = [];
this.teaFileList = [];
this.dialogVisible = false;
this.$emit("closeDialog", this.dialogVisible, false);
},
// 删除文件
handleRemove(data) {
this.teaFileList = this.teaFileList.filter((item) => {
return item != data;
});
this.formData.teacherUrl = this.teaFileList
.map((item) => {
return item.url;
})
.join(",");
console.log(this.teaFileList);
console.log(this.formData.teacherUrl);
},
// 文件上传成功时的钩子
handleSuccess(res, file, fileList) {
if (res.code != 200) {
this.upLoading = false;
return this.msgError(res.msg);
}
let length = this.teaFileList.length;
this.teaFileList[length] = {
status: "success",
name: res.msg.split("/workforstudent/")[1],
url: res.msg,
};
this.formData.teacherUrl = this.teaFileList
.map((item) => {
return item.url;
})
.join(",");
this.upLoading = false;
this.msgSuccess("上传成功");
},
handleProgress(event, file, fileList) {
this.upLoading = true;
},
// 上传文件之前的钩子
beforeUpload(file) {
const isLt10M = file.size / 1024 / 1024 <= 100;
if (!isLt10M) {
this.$message.error("上传的附件大小不能超过 100M!");
return false;
}
return isLt10M;
},
},
watch: {
dialogVisibleFu() {
this.dialogVisible = this.dialogVisibleFu;
},
campIdFu() {
this.campId = this.campIdFu;
},
stuInfoFu() {
this.stuInfo = this.stuInfoFu;
},
typeFu() {
this.type = this.typeFuFu;
},
},
};
</script>
<style scoped lang="scss">
@import "a/scss/btn";
@import "a/scss/homework/refer";
</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