辅导员管理-添加学生测评和通知任务佐证功能

- 新增职业测评佐证相关页面配置,包括列表、添加、详情页面
- 新增通知任务佐证相关页面配置,包括列表、添加、详情页面
- 实现学生管理组件中上传材料功能,支持职业测评和通知任务材料上传
- 优化专业工作组件,支持毕业生和非毕业生不同评分字段逻辑
- 调整个人报告页面标签配置,区分毕业生和非毕业生不同业务流程
- 完善表单验证逻辑,针对不同班级类型和标签页进行差异化处理
```
This commit is contained in:
2026-03-16 16:56:01 +08:00
parent 705efc5dde
commit 5cccc6aa45
12 changed files with 2210 additions and 52 deletions

View File

@@ -0,0 +1,45 @@
import request from '@/utils/request';
// 查询通知任务材料
export function listStuNoticeMaterials(query) {
return request({
url: '/teacher/stuNoticeMaterials/getByFdyNameAndYearAndMonth',
method: 'get',
params: query,
headers: {
Authorization: "Bearer " + uni.getStorageSync("App-Token"),
}
})
}
// 查询通知任务材料详细
export function getStuNoticeMaterials(id) {
return request({
url: '/teacher/stuNoticeMaterials/' + id,
method: 'get'
})
}
// 新增通知任务材料
export function addStuNoticeMaterials(data) {
return request({
url: '/teacher/stuNoticeMaterials/add',
method: 'post',
data: data
})
}
// 修改通知任务材料
export function updateStuNoticeMaterials(data) {
return request({
url: '/teacher/stuNoticeMaterials/update',
method: 'post',
data: data
})
}
// 删除通知任务材料
export function delStuNoticeMaterials(id) {
return request({
url: '/teacher/stuNoticeMaterials/'+id,
method: 'post',
})
}

View File

@@ -0,0 +1,45 @@
import request from '@/utils/request';
// 查询职业测评材料
export function listStuTestMaterials(query) {
return request({
url: '/teacher/stuTestMaterials/getByFdyNameAndYearAndMonth',
method: 'get',
params: query,
headers: {
Authorization: "Bearer " + uni.getStorageSync("App-Token"),
}
})
}
// 查询职业测评材料详细
export function getStuTestMaterials(id) {
return request({
url: '/teacher/stuTestMaterials/' + id,
method: 'get'
})
}
// 新增职业测评材料
export function addStuTestMaterials(data) {
return request({
url: '/teacher/stuTestMaterials/add',
method: 'post',
data: data
})
}
// 修改职业测评材料
export function updateStuTestMaterials(data) {
return request({
url: '/teacher/stuTestMaterials/update',
method: 'post',
data: data
})
}
// 删除职业测评材料
export function delStuTestMaterials(id) {
return request({
url: '/teacher/stuTestMaterials/'+id,
method: 'post',
})
}

View File

@@ -554,6 +554,54 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-test/list",
"style": {
"navigationBarTitleText": "职业测评佐证",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-test/add",
"style": {
"navigationBarTitleText": "添加佐证",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-test/detail",
"style": {
"navigationBarTitleText": "佐证详情",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-notice/list",
"style": {
"navigationBarTitleText": "通知任务佐证",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-notice/add",
"style": {
"navigationBarTitleText": "添加佐证",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/student-notice/detail",
"style": {
"navigationBarTitleText": "佐证详情",
"navigationBarBackgroundColor": "#1890FF",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/instructor/performance-appraisal/performance-evaluation/overwork-materials/add",
"style": {

View File

@@ -3,45 +3,48 @@
<view class="form-item">
<label>{{label01}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'stuLeaveMaterialsScoring',5)"
v-model="formData.stuLeaveMaterialsScoring" type="number" placeholder="请输入分值"
<input @blur="onLimitInput($event, isGraduate ? 'stuLeaveMaterialsScoring' : 'stuLeaveRequestScoring', 5)"
v-model="formData[isGraduate ? 'stuLeaveMaterialsScoring' : 'stuLeaveRequestScoring']" type="number" placeholder="请输入分值"
placeholder-class="input-placeholder" />
</view>
</view>
<view class="form-item">
<label>{{label02}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'stuFillingMaterialsScoring',maxStuDisciplinaryViolation)"
v-model="formData.stuFillingMaterialsScoring" type="number" placeholder="请输入分值"
<input @blur="onLimitInput($event, isGraduate ? 'stuFillingMaterialsScoring' : 'stuLeaveMaterialsScoring', isGraduate ? maxStuFillingMaterials : maxStuLeaveMaterials)"
v-model="formData[isGraduate ? 'stuFillingMaterialsScoring' : 'stuLeaveMaterialsScoring']" type="number" placeholder="请输入分值"
placeholder-class="input-placeholder" />
</view>
</view>
<view class="form-item">
<label>{{label03}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'stuBasicDataScoring',maxHandleEvents)" v-model="formData.stuBasicDataScoring"
<input @blur="onLimitInput($event, isGraduate ? 'stuBasicDataScoring' : 'stuFillingMaterialsScoring', isGraduate ? maxStuDisciplinaryViolation : maxStuFillingMaterials)"
v-model="formData[isGraduate ? 'stuBasicDataScoring' : 'stuFillingMaterialsScoring']"
type="number" placeholder="请输入分值" placeholder-class="input-placeholder" />
</view>
</view>
<view class="form-item">
<label>{{label04}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'stuDisciplinaryViolationScoring',5)"
v-model="formData.stuDisciplinaryViolationScoring" type="number" placeholder="请输入分值"
placeholder-class="input-placeholder" />
<input @blur="onLimitInput($event, isGraduate ? 'stuDisciplinaryViolationScoring' : 'stuBasicDataScoring', 5)"
v-model="formData[isGraduate ? 'stuDisciplinaryViolationScoring' : 'stuBasicDataScoring']"
type="number" placeholder="请输入分值" placeholder-class="input-placeholder" />
</view>
</view>
<view class="form-item">
<label>{{label05}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'handleEventsScoring',maxStuDisciplinaryViolation)" v-model="formData.handleEventsScoring"
<input @blur="onLimitInput($event, isGraduate ? 'handleEventsScoring' : 'stuDisciplinaryViolationScoring', isGraduate ? maxHandleEvents : 5)"
v-model="formData[isGraduate ? 'handleEventsScoring' : 'stuDisciplinaryViolationScoring']"
type="number" placeholder="请输入分值" placeholder-class="input-placeholder" />
</view>
</view>
<view class="form-item">
<label>{{label06}}</label>
<view class="bottom">
<input @blur="onLimitInput($event,'otherTaskScoring',5)" v-model="formData.otherTaskScoring"
<input @blur="onLimitInput($event, isGraduate ? 'otherTaskScoring' : 'handleEventsScoring', isGraduate ? 5 : 10)"
v-model="formData[isGraduate ? 'otherTaskScoring' : 'handleEventsScoring']"
type="number" placeholder="请输入分值" placeholder-class="input-placeholder" />
</view>
</view>
@@ -96,17 +99,24 @@
label06() {
return this.isGraduate
? "06 按时按质完成学工、学院发布的各项学生工作通知、任务 5分"
: "06 按程序要求处理突发事件(5分)";
: "06 按程序要求处理突发事件(10分)";
},
maxStuLeaveMaterials() {
return this.isGraduate ? 5 : 5;
},
maxStuFillingMaterials() {
return this.isGraduate ? 10 : 10;
},
maxStuDisciplinaryViolation() {
return this.isGraduate ? 10 : 5;
return this.isGraduate ? 5 : 5;
},
maxHandleEvents() {
return this.isGraduate ? 5 : 10;
return this.isGraduate ? 10 : 10;
}
},data() {
}, data() {
return {
formData: {
stuLeaveRequestScoring: "",
stuLeaveMaterialsScoring: "",
stuFillingMaterialsScoring: "",
stuBasicDataScoring: "",
@@ -125,6 +135,7 @@
kpiFillingBusinessWorkDetail(params).then(res => {
if (res.rows.length > 0) {
const {
stuLeaveRequestScoring,
stuLeaveMaterialsScoring,
stuFillingMaterialsScoring,
stuBasicDataScoring,
@@ -134,7 +145,8 @@
id
} = res.rows[0];
this.formData = {
...this.formData, // 保留 this.formData 中已有的其他属性
...this.formData,
stuLeaveRequestScoring,
stuLeaveMaterialsScoring,
stuFillingMaterialsScoring,
stuBasicDataScoring,

View File

@@ -54,6 +54,9 @@
<view class="bottom">
<input @blur="onLimitInput($event,'edgScoring',5)" v-model="edgScoring" type="number" placeholder="请输入分值"
placeholder-class="input-placeholder" />
<text @tap="uploadStuTest">
{{commitStatus==1?"查看材料":"上传材料"}}
</text>
</view>
</view>
<view class="form-item" v-if="!isGraduate">
@@ -61,6 +64,9 @@
<view class="bottom">
<input @blur="onLimitInput($event,'noticeScoring',5)" v-model="noticeScoring" type="number" placeholder="请输入分值"
placeholder-class="input-placeholder" />
<text @tap="uploadStuNotie">
{{commitStatus==1?"查看材料":"上传材料"}}
</text>
</view>
</view>
</view>
@@ -185,18 +191,7 @@
let result = limitInput(event.detail.value,max);
this[name] = result;
},
initQueryParams() {
this.queryParams = new URLSearchParams({
year: this.queryDetailParams.fillingYear,
month: this.queryDetailParams.fillingMonth,
commitStatus:this.commitStatus
});
},
onLimitInput(event,name,max) {
let result = limitInput(event.detail.value,max);
this[name] = result;
},
uploadClassMeetingMaterial() {
uploadClassMeetingMaterial() {
uni.navigateTo({
url: `/pages/instructor/performance-appraisal/performance-evaluation/class-meeting-evidence/list?${this.queryParams.toString()}`
@@ -222,6 +217,16 @@
url: `/pages/instructor/performance-appraisal/performance-evaluation/student-activity/list?${this.queryParams.toString()}`
})
},
uploadStuTest() {
uni.navigateTo({
url: `/pages/instructor/performance-appraisal/performance-evaluation/student-test/list?${this.queryParams.toString()}`
})
},
uploadStuNotie() {
uni.navigateTo({
url: `/pages/instructor/performance-appraisal/performance-evaluation/student-notice/list?${this.queryParams.toString()}`
})
},
getFormData() {
const data = {
classScoring: this.classScoring,

View File

@@ -81,47 +81,84 @@
commitStatus: "",
completionStatus: "", //完成状态
roleAudit:"",//角色
tabConfigs: {
}
},
computed: {
tabConfigs() {
if (this.classType === 'graduate') {
return {
0: {
ref: 'studentManagement',
addFunc: teacherKpiFillingMgtAdd,
updateFunc: teacherKpiFillingMgtUpdate,
},
1: {
ref: 'GraduationGuidance',
addFunc: kpiFillingGraduationGuidanceAdd,
updateFunc: kpiFillingGraduationGuidanceUpdate,
},
2: {
ref: 'ProfessionalWork',
addFunc: kpiFillingBusinessWorkAdd,
updateFunc: kpiFillingBusinessWorkUpdate,
},
3: {
ref: 'AttendanceManagement',
addFunc: kpiFillingAMgtAdd,
updateFunc: kpiFillingAMgtUpdate,
},
4: {
ref: 'BonusPoints',
addFunc: kpiFillingBonusPointsAdd,
updateFunc: kpiFillingBonusPointsUpdate,
},
5: {
ref: 'NegativeList',
addFunc: kpiFillingNegativeListAdd,
updateFunc: kpiFillingNegativeListUpdate,
},
6: {
ref: 'OverWork',
},
7: {
ref: 'StudentEmergencies',
}
};
}
return {
0: {
ref: 'studentManagement',
addFunc: teacherKpiFillingMgtAdd,
updateFunc: teacherKpiFillingMgtUpdate,
},
1: {
ref: 'GraduationGuidance',
addFunc: kpiFillingGraduationGuidanceAdd,
updateFunc: kpiFillingGraduationGuidanceUpdate,
},
2: {
ref: 'ProfessionalWork',
addFunc: kpiFillingBusinessWorkAdd,
updateFunc: kpiFillingBusinessWorkUpdate,
},
3: {
2: {
ref: 'AttendanceManagement',
addFunc: kpiFillingAMgtAdd,
updateFunc: kpiFillingAMgtUpdate,
},
4: {
3: {
ref: 'BonusPoints',
addFunc: kpiFillingBonusPointsAdd,
updateFunc: kpiFillingBonusPointsUpdate,
},
5: {
4: {
ref: 'NegativeList',
addFunc: kpiFillingNegativeListAdd,
updateFunc: kpiFillingNegativeListUpdate,
},
6: {
5: {
ref: 'OverWork',
},
7: {
6: {
ref: 'StudentEmergencies',
}
}
}
},
computed: {
};
},
tabs() {
if (this.classType === 'graduate') {
return ["学生管理", "就业指导工作", "业务管理", "考勤管理", "加分项", "负面清单", "超工作量奖励绩效", "处理学生突发事件"];
@@ -208,16 +245,22 @@
// 根据班级类型排除不需要填写的字段
let excludeKeys = ['id', 'departmentName', 'fdyName', 'fillingYear', 'fillingMonth', 'classType'];
// 学生管理(tabIndex 0) - 毕业班需要排除部分字段
if (this.tabIndex === 0 && this.classType === 'graduate') {
excludeKeys = [...excludeKeys, 'visitDormitoryScoring', 'cadreScoring', 'stuActivityScoring', 'edgScoring', 'noticeScoring'];
// 业务管理(毕业班tabIndex 2, 非毕业班tabIndex 1) - 需要排除业务管理不需要验证的字段
if ((this.tabIndex === 2 && this.classType === 'graduate') || (this.tabIndex === 1 && this.classType === 'ungraduate')) {
excludeKeys = [...excludeKeys,
'stuLeaveRequestScoring', 'stuLeaveMaterialsScoring', 'stuFillingMaterialsScoring',
'stuBasicDataScoring', 'stuDisciplinaryViolationScoring', 'handleEventsScoring', 'otherTaskScoring'];
}
// 负面清单(tabIndex 4/5)、考勤管理(tabIndex 2/3)、加分项(tabIndex 3/4)、就业指导(tabIndex 1)不需要验证空值
if (this.tabIndex === 1 || this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 4 || this.tabIndex === 5) {
// 就业指导(毕业班tabIndex 1)不需要验证空值
if (this.classType === 'graduate' && this.tabIndex === 1) {
excludeKeys = [...excludeKeys,
'gradFormAuditScoring', 'stuCareerConsultScoring', 'gradFormGuidanceScoring'];
}
// 考勤管理(tabIndex 2/3)、加分项(tabIndex 3/4)、负面清单(tabIndex 4/5)不需要验证空值
if (this.tabIndex === 2 || this.tabIndex === 3 || this.tabIndex === 4 || this.tabIndex === 5) {
excludeKeys = [...excludeKeys,
'moralityAndBehavior', 'speech', 'complaint', 'offense', 'emergency', 'punishment', 'practiceFraud',
'dutyWorkScoring', 'conferenceScoring', 'bonusType', 'bonusScoring',
'gradFormAuditScoring', 'stuCareerConsultScoring', 'gradFormGuidanceScoring'];
'dutyWorkScoring', 'conferenceScoring', 'bonusType', 'bonusScoring'];
}
console.log('formData:', formData);
console.log('excludeKeys:', excludeKeys);
@@ -232,8 +275,10 @@
return; // 停止执行后续操作
}
console.log('准备保存tabIndex:', this.tabIndex, 'formData:', formData);
// 只跳过超工作量(tabIndex 6)和处理学生突发事件(tabIndex 7)
if (this.tabIndex !== 6 && this.tabIndex !== 7) {
// 判断是否需要保存:超工作量(毕业班6/非毕业班5)和处理学生突发事件(毕业班7/非毕业班6)不需要保存
const skipSave = (this.classType === 'graduate' && (this.tabIndex === 6 || this.tabIndex === 7)) ||
(this.classType === 'ungraduate' && (this.tabIndex === 5 || this.tabIndex === 6));
if (!skipSave) {
if (formData.id || formData.id === 0) {
let res = await updateFunc(formData);
if (res.code == 200) {
@@ -241,7 +286,7 @@
title: "修改成功",
});
}
} else {
} else if (addFunc) {
let res = await addFunc(formData);
if (res.code == 200) {
uni.showToast({

View File

@@ -0,0 +1,397 @@
<template>
<view class="evidence-add">
<form>
<view class="form-item">
<label>主要内容</label>
<input type="text" v-model="formData.mainContent" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item form-item--class">
<label>班级</label>
<picker v-if="classArray.length>0" range-key="class_name" :value="classIndex" :range="classArray"
@change="multiClassChange">
<view class="uni-input">
<view class="val-container">
<text class="val" v-if="selectedIndices.length <= 1 && classIndex > 0">{{ classArray[classIndex].class_name }}</text>
<textarea
v-else
:value="selectedClassNames"
disabled
style="background-color: #f9f9f9; border: none; font-size: 30rpx;"
auto-height />
</view>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>参与人数</label>
<input v-model="formData.numberOfStudents" type="number" placeholder="请输入" />
</view>
<view class="form-item">
<label>开展时间</label>
<picker @change="onChangeTime" mode="date" :value="formData.developmentTime">
<view class="uni-input">
<text class="val">{{formData.developmentTime}}</text>
<uni-icons type="calendar" size="25" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>地点</label>
<input v-model="formData.place" type="text" placeholder="请输入" />
</view>
<view class="form-item">
<label>照片</label>
<view class="upload-img" v-if="tempImgs.length==0" @tap="uploadImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempImgs">
<image :src="img.path" @tap="previewImg(tempImgs)" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempImgs.length<3" class="btn" @tap="uploadImg">
+ 添加照片
</view>
</view>
</view>
<button :disabled="isSubmitting" type="primary" class="submit-btn" @tap="onSubmit">提交</button>
</form>
</view>
</template>
<script>
import {
previewImg
} from "@/utils/uploadImg.js"
import {
getCurrentDateTime
} from "@/utils/getCurrentDateTime.js";
import {
checkPic
} from "@/utils/checkPic.js";
import {
OwnClass
} from '@/api/instructor/superintendent.js';
import {
addStuNoticeMaterials
} from '@/api/instructor/studentNotice.js';
import uploadFile from "@/plugins/upload.js";
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
isSubmitting:false,
classArray: [],
selectedIndices: [],
classIndex: 0,
tempImgs: [],
formData: {
mainContent: "",
className: "",
numberOfStudents: "",
developmentTime: getCurrentDateTime(),
place: "",
photo: "",
fdyName: uni.getStorageSync("stuName"),
fillingMonth: "",
fillingYear: "",
}
}
},
onLoad(option) {
this.formData.fillingYear = option.year;
this.formData.fillingMonth = option.month;
this.getOwnClass();
},
computed: {
selectedClassNames() {
if (this.selectedIndices.length === 0) {
return '请选择班级';
}
return this.selectedIndices.map(index => this.classArray[index].class_name).join('\n');
}
},
methods: {
uploadImg() {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
if (this.formData.photo !== "") {
this.formData.photo = this.formData.photo + "," + JSON.parse(res)
.fileName;
} else {
this.formData.photo = JSON.parse(res).fileName;
}
this.tempImgs.push({
path: baseUrl + JSON.parse(res).fileName
});
})
}
}
})
},
onRemoveImg(index, path) {
this.tempImgs.splice(index, 1);
let newImgs = this.tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
this.formData.photo = newImgs;
},
classChange(e) {
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
},
onChangeTime(e) {
this.formData.developmentTime = e.detail.value;
},
async onSubmit() {
const requiredFields = [
'mainContent',
'className',
'numberOfStudents',
'place'
];
const emptyField = requiredFields.find(field => this.formData[field] === "");
if (emptyField) {
uni.showToast({
title: `请填写完整内容`,
icon: "none"
})
return;
}
this.isSubmitting=true;
let res = await addStuNoticeMaterials(this.formData);
if (res.code == 200) {
uni.showToast({
title: "添加成功"
})
setTimeout(() => {
this.isSubmitting=false;
uni.navigateBack({
success: () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const prevPage = pages[pages.length - 2]
if (prevPage && typeof prevPage.getStuNoticeMaterials ===
'function') {
prevPage.queryParams.pageNum = 1;
prevPage.getStuNoticeMaterials();
}
}
}
})
}, 1000)
} else {
uni.showToast({
title: res.msg
})
}
},
async getOwnClass() {
let res = await OwnClass(this.formData);
this.classArray = res.data;
console.log(this.classArray);
this.formData.className = this.classArray[0].class_name;
},
previewImg(imgs) {
previewImg(imgs)
},
multiClassChange(e) {
const index = e.detail.value;
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
if (!this.selectedIndices.includes(index)) {
this.selectedIndices.push(index);
} else {
this.selectedIndices = this.selectedIndices.filter(i => i !== index);
}
const selectedClasses = this.selectedIndices.map(i => this.classArray[i].class_name);
this.formData.className = selectedClasses.join(',');
},
}
}
</script>
<style scoped lang="scss">
.evidence-add {
min-height: 95vh;
background-color: #F5F5F7;
padding: 40rpx;
.form-item {
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.uni-icons {
opacity: .5;
font-weight: bold
}
label {
margin-bottom: 20rpx;
display: inline-block;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
.input-placeholder {
color: #b6b6b6;
}
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.form-item--class {
display: flex;
flex-direction: column;
justify-content: space-between;
picker {
height: auto;
line-height: 50rpx;
.uni-input {
width: 100%;
min-height: 65rpx;
height: auto;
padding: 16rpx 15rpx;
box-sizing: border-box;
align-items: flex-start;
.val-container {
flex: 1;
overflow: hidden;
white-space: pre-wrap;
word-break: break-all;
textarea {
width: 100%;
padding: 0;
margin: 0;
background-color: transparent;
font-size: 25rpx;
line-height: 40rpx;
height: auto;
white-space: pre-wrap;
word-break: break-all;
}
}
}
}
}
.submit-btn {
margin-top: 60rpx;
}
}
</style>

View File

@@ -0,0 +1,344 @@
<template>
<view class="evidence-add">
<form>
<view class="form-item">
<label>主要内容</label>
<input type="text" v-model="formData.mainContent" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>班级</label>
<picker v-if="classArray.length>0" range-key="class_name" :value="classIndex" :range="classArray"
@change="classChange">
<view class="uni-input">
<text class="val">{{classArray[classIndex].class_name}}</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>参与人数</label>
<input v-model="formData.numberOfStudents" type="number" placeholder="请输入" />
</view>
<view class="form-item">
<label>开展时间</label>
<picker @change="onChangeTime" mode="date" :value="formData.developmentTime">
<view class="uni-input">
<text class="val">{{formData.developmentTime}}</text>
<uni-icons type="calendar" size="25" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>地点</label>
<input v-model="formData.place" type="text" placeholder="请输入" />
</view>
<view class="form-item">
<label>照片</label>
<view class="upload-img" v-if="tempImgs.length==0" @tap="uploadImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempImgs">
<image :src="img.path" @tap="previewImg(tempImgs)" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempImgs.length<3" class="btn" @tap="uploadImg">
+ 添加照片
</view>
</view>
</view>
<button :disabled="isSubmitting" v-if="commitStatus!=1" type="primary" class="submit-btn"
@tap="onEdit">保存修改</button>
</form>
</view>
</template>
<script>
import {
previewImg
} from "@/utils/uploadImg.js"
import {
getCurrentDateTime
} from "@/utils/getCurrentDateTime.js"
import {
checkPic
} from "@/utils/checkPic.js"
import {
OwnClass
} from '@/api/instructor/superintendent.js';
import {
updateStuNoticeMaterials,
getStuNoticeMaterials
} from '@/api/instructor/studentNotice.js';
import uploadFile from "@/plugins/upload.js";
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
isSubmitting: false,
classArray: [],
classIndex: 0,
tempImgs: [],
commitStatus: "",
formData: {
mainContent: "",
className: "",
numberOfStudents: "",
developmentTime: getCurrentDateTime(),
place: "",
photo: "",
fdyName: uni.getStorageSync("stuName"),
fillingMonth: getCurrentDateTime('MM'),
fillingYear: getCurrentDateTime('yyyy'),
}
}
},
onLoad(option) {
this.formData.id = option.id;
this.commitStatus = option.commitStatus;
this.getOwnClass();
},
methods: {
uploadImg() {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
if (this.formData.photo !== "") {
this.formData.photo = this.formData.photo + "," + JSON.parse(res)
.fileName;
} else {
this.formData.photo = JSON.parse(res).fileName;
}
this.tempImgs.push({
path: baseUrl + JSON.parse(res).fileName
});
})
}
}
})
},
onRemoveImg(index, path) {
this.tempImgs.splice(index, 1);
let newImgs = this.tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
this.formData.photo = newImgs;
},
classChange(e) {
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
},
onChangeTime(e) {
this.formData.developmentTime = e.detail.value;
},
async getDetail() {
let res = await getStuNoticeMaterials(this.formData.id);
if (res.data.photo != null) {
let imgs = res.data.photo.split(',');
this.tempImgs = imgs.map(img => {
return {
path: baseUrl + img
};
})
}
this.formData = res.data;
let index = this.classArray.findIndex(item => {
return item.class_name === this.formData.className;
});
this.classIndex = index;
},
async onEdit() {
const requiredFields = [
'mainContent',
'className',
'numberOfStudents',
'place'
];
const emptyField = requiredFields.find(field => this.formData[field] === "");
if (emptyField) {
uni.showToast({
title: `请填写完整内容`,
icon: "none"
})
return;
}
this.isSubmitting = true;
let res = await updateStuNoticeMaterials(this.formData);
if (res.code == 200) {
uni.showToast({
title: "修改成功"
})
setTimeout(() => {
this.isSubmitting = false;
uni.navigateBack({
success: () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const prevPage = pages[pages.length - 2]
if (prevPage && typeof prevPage.getStuNoticeMaterials ===
'function') {
prevPage.queryParams.pageNum = 1;
prevPage.getStuNoticeMaterials();
}
}
}
})
}, 1000)
} else {
uni.showToast({
title: res.msg
})
}
},
async getOwnClass() {
let res = await OwnClass(this.formData);
this.classArray = res.data;
this.formData.className = this.classArray[0].class_name;
if (res.code == 200) {
this.getDetail();
}
},
previewImg(imgs) {
previewImg(imgs)
}
}
}
</script>
<style scoped lang="scss">
.evidence-add {
min-height: 95vh;
background-color: #F5F5F7;
padding: 40rpx;
.form-item {
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.uni-icons {
opacity: .5;
font-weight: bold
}
label {
margin-bottom: 20rpx;
display: inline-block;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
.input-placeholder {
color: #b6b6b6;
}
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.submit-btn {
margin-top: 60rpx;
}
}
</style>

View File

@@ -0,0 +1,238 @@
<template>
<view class="evidence-list">
<scroll-view scroll-y="true" @scrolltolower="scrolltolower">
<uni-swipe-action>
<view class="list">
<view class="item" @tap="toDetail(item.id)" v-for="item in list" :key="item.id">
<uni-swipe-action-item :right-options="actionOptions" @tap="onDel(item.id)">
<view class="top">
<view class="title">
主要内容
<text v-html="item.mainContent"></text>
</view>
<uni-icons type="right" size="16" color="#202020"></uni-icons>
</view>
<view class="content">
<view>班级{{item.className}}</view>
<view class="time">开展时间:{{item.developmentTime}}</view>
</view>
</uni-swipe-action-item>
</view>
</view>
</uni-swipe-action>
<view class="empty" v-if="list.length==0">
<image src="@/static/empty.png" mode="widthFix"></image>
暂时没有数据
</view>
<view class="loading-more" v-if="loading">
<uni-load-more status="loading" />
</view>
<view class="no-more" v-if="!loading&&list.length!=0">
到底啦~~
</view>
</scroll-view>
<view class="add" @tap="addEvidence" v-if="commitStatus!=1">
+
</view>
</view>
</template>
<script>
import {
listStuNoticeMaterials,
delStuNoticeMaterials
} from '@/api/instructor/studentNotice.js';
export default {
data() {
return {
actionOptions: [{
text: '删除',
style: {
width: "200px",
backgroundColor: '#df0000'
}
}],
list: [],
totalPages: 0,
loading: false,
commitStatus: "",
queryParams: {
pageNum: 1,
pageSize: 10,
fdyName: uni.getStorageSync("stuName"),
fillingMonth: "",
fillingYear: "",
},
}
},
onLoad(option) {
this.queryParams.fillingYear = option.year;
this.queryParams.fillingMonth = option.month;
this.commitStatus = option.commitStatus;
this.getStuNoticeMaterials();
},
methods: {
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
this.getStuNoticeMaterialsList()
}, 1000)
} else {
}
},
addEvidence() {
uni.navigateTo({
url: `add?year=${this.queryParams.fillingYear}&month=${this.queryParams.fillingMonth}`
})
},
toDetail(id) {
uni.navigateTo({
url: `detail?id=${id}&commitStatus=${this.commitStatus}`
})
},
getStuNoticeMaterials() {
listStuNoticeMaterials(this.queryParams).then(res => {
this.loading = false;
if (!res.rows) {
this.list = [];
return;
}
if (this.queryParams.pageNum == 1) {
this.list = res.rows;
} else {
this.list = this.list.concat(res.rows);
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
}).catch(err => {
this.loading = false;
this.list = [];
});
},
onDel(id) {
console.log(id);
uni.showModal({
title: "确定删除吗?",
success: (res) => {
if (res.confirm) {
delStuNoticeMaterials(id).then(res => {
if (res.code == 200) {
uni.showToast({
title: "删除成功"
})
this.getStuNoticeMaterials();
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
scroll-view {
height: 100vh;
.load-more {
text-align: center;
}
.no-more {
text-align: center;
color: gray;
padding-bottom: 10px;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 200rpx;
color: #9E9E9E;
font-size: 36rpx;
image {
width: 250rpx;
margin-bottom: 50rpx;
}
}
}
.evidence-list {
background-color: #F5F5F7;
min-height: 100vh;
.list {
padding: 40rpx;
.item {
padding: 40rpx;
background-color: white;
border-radius: 16rpx;
margin-bottom: 20rpx;
.top {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #F5F5F7;
padding-bottom: 22rpx;
.title {
display: flex;
align-items: center;
font-weight: bold;
text {
margin-left: 8rpx;
}
}
.uni-icons {
opacity: 0.5;
}
text {
color: #3D3D3D;
font-weight: 600;
}
}
.content {
padding-top: 22rpx;
&>view:first-child {
display: flex;
align-items: center;
}
.time {
color: #9C9C9C;
margin-top: 14rpx;
font-size: 26rpx;
}
}
}
}
.add {
background-color: #1890FF;
width: 90rpx;
height: 90rpx;
border-radius: 50%;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-size: 60rpx;
position: fixed;
bottom: 50px;
right: 25px;
}
}
</style>

View File

@@ -0,0 +1,397 @@
<template>
<view class="evidence-add">
<form>
<view class="form-item">
<label>主要内容</label>
<input type="text" v-model="formData.mainContent" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item form-item--class">
<label>班级</label>
<picker v-if="classArray.length>0" range-key="class_name" :value="classIndex" :range="classArray"
@change="multiClassChange">
<view class="uni-input">
<view class="val-container">
<text class="val" v-if="selectedIndices.length <= 1 && classIndex > 0">{{ classArray[classIndex].class_name }}</text>
<textarea
v-else
:value="selectedClassNames"
disabled
style="background-color: #f9f9f9; border: none; font-size: 30rpx;"
auto-height />
</view>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>参与人数</label>
<input v-model="formData.numberOfStudents" type="number" placeholder="请输入" />
</view>
<view class="form-item">
<label>开展时间</label>
<picker @change="onChangeTime" mode="date" :value="formData.developmentTime">
<view class="uni-input">
<text class="val">{{formData.developmentTime}}</text>
<uni-icons type="calendar" size="25" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>地点</label>
<input v-model="formData.place" type="text" placeholder="请输入" />
</view>
<view class="form-item">
<label>照片</label>
<view class="upload-img" v-if="tempImgs.length==0" @tap="uploadImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempImgs">
<image :src="img.path" @tap="previewImg(tempImgs)" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempImgs.length<3" class="btn" @tap="uploadImg">
+ 添加照片
</view>
</view>
</view>
<button :disabled="isSubmitting" type="primary" class="submit-btn" @tap="onSubmit">提交</button>
</form>
</view>
</template>
<script>
import {
previewImg
} from "@/utils/uploadImg.js"
import {
getCurrentDateTime
} from "@/utils/getCurrentDateTime.js";
import {
checkPic
} from "@/utils/checkPic.js";
import {
OwnClass
} from '@/api/instructor/superintendent.js';
import {
addStuTestMaterials
} from '@/api/instructor/studentTest.js';
import uploadFile from "@/plugins/upload.js";
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
isSubmitting:false,
classArray: [],
selectedIndices: [],
classIndex: 0,
tempImgs: [],
formData: {
mainContent: "",
className: "",
numberOfStudents: "",
developmentTime: getCurrentDateTime(),
place: "",
photo: "",
fdyName: uni.getStorageSync("stuName"),
fillingMonth: "",
fillingYear: "",
}
}
},
onLoad(option) {
this.formData.fillingYear = option.year;
this.formData.fillingMonth = option.month;
this.getOwnClass();
},
computed: {
selectedClassNames() {
if (this.selectedIndices.length === 0) {
return '请选择班级';
}
return this.selectedIndices.map(index => this.classArray[index].class_name).join('\n');
}
},
methods: {
uploadImg() {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
if (this.formData.photo !== "") {
this.formData.photo = this.formData.photo + "," + JSON.parse(res)
.fileName;
} else {
this.formData.photo = JSON.parse(res).fileName;
}
this.tempImgs.push({
path: baseUrl + JSON.parse(res).fileName
});
})
}
}
})
},
onRemoveImg(index, path) {
this.tempImgs.splice(index, 1);
let newImgs = this.tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
this.formData.photo = newImgs;
},
classChange(e) {
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
},
onChangeTime(e) {
this.formData.developmentTime = e.detail.value;
},
async onSubmit() {
const requiredFields = [
'mainContent',
'className',
'numberOfStudents',
'place'
];
const emptyField = requiredFields.find(field => this.formData[field] === "");
if (emptyField) {
uni.showToast({
title: `请填写完整内容`,
icon: "none"
})
return;
}
this.isSubmitting=true;
let res = await addStuTestMaterials(this.formData);
if (res.code == 200) {
uni.showToast({
title: "添加成功"
})
setTimeout(() => {
this.isSubmitting=false;
uni.navigateBack({
success: () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const prevPage = pages[pages.length - 2]
if (prevPage && typeof prevPage.getStuTestMaterials ===
'function') {
prevPage.queryParams.pageNum = 1;
prevPage.getStuTestMaterials();
}
}
}
})
}, 1000)
} else {
uni.showToast({
title: res.msg
})
}
},
async getOwnClass() {
let res = await OwnClass(this.formData);
this.classArray = res.data;
console.log(this.classArray);
this.formData.className = this.classArray[0].class_name;
},
previewImg(imgs) {
previewImg(imgs)
},
multiClassChange(e) {
const index = e.detail.value;
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
if (!this.selectedIndices.includes(index)) {
this.selectedIndices.push(index);
} else {
this.selectedIndices = this.selectedIndices.filter(i => i !== index);
}
const selectedClasses = this.selectedIndices.map(i => this.classArray[i].class_name);
this.formData.className = selectedClasses.join(',');
},
}
}
</script>
<style scoped lang="scss">
.evidence-add {
min-height: 95vh;
background-color: #F5F5F7;
padding: 40rpx;
.form-item {
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.uni-icons {
opacity: .5;
font-weight: bold
}
label {
margin-bottom: 20rpx;
display: inline-block;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
.input-placeholder {
color: #b6b6b6;
}
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.form-item--class {
display: flex;
flex-direction: column;
justify-content: space-between;
picker {
height: auto;
line-height: 50rpx;
.uni-input {
width: 100%;
min-height: 65rpx;
height: auto;
padding: 16rpx 15rpx;
box-sizing: border-box;
align-items: flex-start;
.val-container {
flex: 1;
overflow: hidden;
white-space: pre-wrap;
word-break: break-all;
textarea {
width: 100%;
padding: 0;
margin: 0;
background-color: transparent;
font-size: 25rpx;
line-height: 40rpx;
height: auto;
white-space: pre-wrap;
word-break: break-all;
}
}
}
}
}
.submit-btn {
margin-top: 60rpx;
}
}
</style>

View File

@@ -0,0 +1,344 @@
<template>
<view class="evidence-add">
<form>
<view class="form-item">
<label>主要内容</label>
<input type="text" v-model="formData.mainContent" placeholder="请输入"
placeholder-class="input-placeholder" />
</view>
<view class="form-item">
<label>班级</label>
<picker v-if="classArray.length>0" range-key="class_name" :value="classIndex" :range="classArray"
@change="classChange">
<view class="uni-input">
<text class="val">{{classArray[classIndex].class_name}}</text>
<uni-icons type="down" size="16" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>参与人数</label>
<input v-model="formData.numberOfStudents" type="number" placeholder="请输入" />
</view>
<view class="form-item">
<label>开展时间</label>
<picker @change="onChangeTime" mode="date" :value="formData.developmentTime">
<view class="uni-input">
<text class="val">{{formData.developmentTime}}</text>
<uni-icons type="calendar" size="25" color="#202020"></uni-icons>
</view>
</picker>
</view>
<view class="form-item">
<label>地点</label>
<input v-model="formData.place" type="text" placeholder="请输入" />
</view>
<view class="form-item">
<label>照片</label>
<view class="upload-img" v-if="tempImgs.length==0" @tap="uploadImg">
<view class="add">
+ 添加照片
</view>
<view class="tip">
图片要求最多3张上限5MB
</view>
<view class="img-list">
</view>
</view>
<view class="img-list" v-else>
<view class="imgs">
<view class="img" v-for="(img,index) in tempImgs">
<image :src="img.path" @tap="previewImg(tempImgs)" mode="aspectFill"></image>
<text class="remove" @tap="onRemoveImg(index,img.path)">X</text>
</view>
</view>
<view v-if="tempImgs.length<3" class="btn" @tap="uploadImg">
+ 添加照片
</view>
</view>
</view>
<button :disabled="isSubmitting" v-if="commitStatus!=1" type="primary" class="submit-btn"
@tap="onEdit">保存修改</button>
</form>
</view>
</template>
<script>
import {
previewImg
} from "@/utils/uploadImg.js"
import {
getCurrentDateTime
} from "@/utils/getCurrentDateTime.js"
import {
checkPic
} from "@/utils/checkPic.js"
import {
OwnClass
} from '@/api/instructor/superintendent.js';
import {
updateStuTestMaterials,
getStuTestMaterials
} from '@/api/instructor/studentTest.js';
import uploadFile from "@/plugins/upload.js";
import {
baseUrl
} from "@/config.js";
export default {
data() {
return {
isSubmitting: false,
classArray: [],
classIndex: 0,
tempImgs: [],
commitStatus: "",
formData: {
mainContent: "",
className: "",
numberOfStudents: "",
developmentTime: getCurrentDateTime(),
place: "",
photo: "",
fdyName: uni.getStorageSync("stuName"),
fillingMonth: getCurrentDateTime('MM'),
fillingYear: getCurrentDateTime('yyyy'),
}
}
},
onLoad(option) {
this.formData.id = option.id;
this.commitStatus = option.commitStatus;
this.getOwnClass();
},
methods: {
uploadImg() {
uni.chooseImage({
count: 3,
success: async (img) => {
let bool = await checkPic(img.tempFiles[0]);
if (bool) {
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
if (this.formData.photo !== "") {
this.formData.photo = this.formData.photo + "," + JSON.parse(res)
.fileName;
} else {
this.formData.photo = JSON.parse(res).fileName;
}
this.tempImgs.push({
path: baseUrl + JSON.parse(res).fileName
});
})
}
}
})
},
onRemoveImg(index, path) {
this.tempImgs.splice(index, 1);
let newImgs = this.tempImgs.filter(fileName => fileName.path !== path);
newImgs = newImgs.map(img => img.path.replace(baseUrl, ''))
newImgs = newImgs.join(",");
this.formData.photo = newImgs;
},
classChange(e) {
this.classIndex = e.detail.value;
this.formData.className = this.classArray[e.detail.value].class_name;
},
onChangeTime(e) {
this.formData.developmentTime = e.detail.value;
},
async getDetail() {
let res = await getStuTestMaterials(this.formData.id);
if (res.data.photo != null) {
let imgs = res.data.photo.split(',');
this.tempImgs = imgs.map(img => {
return {
path: baseUrl + img
};
})
}
this.formData = res.data;
let index = this.classArray.findIndex(item => {
return item.class_name === this.formData.className;
});
this.classIndex = index;
},
async onEdit() {
const requiredFields = [
'mainContent',
'className',
'numberOfStudents',
'place'
];
const emptyField = requiredFields.find(field => this.formData[field] === "");
if (emptyField) {
uni.showToast({
title: `请填写完整内容`,
icon: "none"
})
return;
}
this.isSubmitting = true;
let res = await updateStuTestMaterials(this.formData);
if (res.code == 200) {
uni.showToast({
title: "修改成功"
})
setTimeout(() => {
this.isSubmitting = false;
uni.navigateBack({
success: () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const prevPage = pages[pages.length - 2]
if (prevPage && typeof prevPage.getStuTestMaterials ===
'function') {
prevPage.queryParams.pageNum = 1;
prevPage.getStuTestMaterials();
}
}
}
})
}, 1000)
} else {
uni.showToast({
title: res.msg
})
}
},
async getOwnClass() {
let res = await OwnClass(this.formData);
this.classArray = res.data;
this.formData.className = this.classArray[0].class_name;
if (res.code == 200) {
this.getDetail();
}
},
previewImg(imgs) {
previewImg(imgs)
}
}
}
</script>
<style scoped lang="scss">
.evidence-add {
min-height: 95vh;
background-color: #F5F5F7;
padding: 40rpx;
.form-item {
padding: 22rpx 40rpx;
background-color: white;
margin-bottom: 20rpx;
border-radius: 16rpx;
.uni-icons {
opacity: .5;
font-weight: bold
}
label {
margin-bottom: 20rpx;
display: inline-block;
}
input {
border: 1px solid #E1E1E1;
border-radius: 10rpx;
height: 70rpx;
padding-left: 30rpx;
.input-placeholder {
color: #b6b6b6;
}
}
picker {
border: 1px solid #E1E1E1;
height: 70rpx;
line-height: 70rpx;
padding: 0 30rpx;
.uni-input {
display: flex;
color: #797979;
.val {
flex: 1;
}
}
}
.upload-img {
border: 1px solid #E1E1E1;
padding: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.tip {
margin-top: 15rpx;
color: #7a7a7a;
font-size: 24rpx;
}
}
.img-list {
border: 1px solid #D8D8D8;
border-radius: 20rpx;
.imgs {
padding: 22rpx;
display: flex;
flex-wrap: wrap;
.img {
position: relative;
width: 160rpx;
height: 170rpx;
margin-bottom: 15rpx;
margin-right: 15rpx;
image {
width: 100%;
height: 100%;
}
.remove {
position: absolute;
right: 0;
top: 0;
color: white;
background-color: rgba(0, 0, 0, 0.4);
width: 52rpx;
height: 52rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
}
}
.btn {
border-top: 1px solid #D8D8D8;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
}
}
}
.submit-btn {
margin-top: 60rpx;
}
}
</style>

View File

@@ -0,0 +1,238 @@
<template>
<view class="evidence-list">
<scroll-view scroll-y="true" @scrolltolower="scrolltolower">
<uni-swipe-action>
<view class="list">
<view class="item" @tap="toDetail(item.id)" v-for="item in list" :key="item.id">
<uni-swipe-action-item :right-options="actionOptions" @tap="onDel(item.id)">
<view class="top">
<view class="title">
主要内容
<text v-html="item.mainContent"></text>
</view>
<uni-icons type="right" size="16" color="#202020"></uni-icons>
</view>
<view class="content">
<view>班级{{item.className}}</view>
<view class="time">开展时间:{{item.developmentTime}}</view>
</view>
</uni-swipe-action-item>
</view>
</view>
</uni-swipe-action>
<view class="empty" v-if="list.length==0">
<image src="@/static/empty.png" mode="widthFix"></image>
暂时没有数据
</view>
<view class="loading-more" v-if="loading">
<uni-load-more status="loading" />
</view>
<view class="no-more" v-if="!loading&&list.length!=0">
到底啦~~
</view>
</scroll-view>
<view class="add" @tap="addEvidence" v-if="commitStatus!=1">
+
</view>
</view>
</template>
<script>
import {
listStuTestMaterials,
delStuTestMaterials
} from '@/api/instructor/studentTest.js';
export default {
data() {
return {
actionOptions: [{
text: '删除',
style: {
width: "200px",
backgroundColor: '#df0000'
}
}],
list: [],
totalPages: 0,
loading: false,
commitStatus: "",
queryParams: {
pageNum: 1,
pageSize: 10,
fdyName: uni.getStorageSync("stuName"),
fillingMonth: "",
fillingYear: "",
},
}
},
onLoad(option) {
this.queryParams.fillingYear = option.year;
this.queryParams.fillingMonth = option.month;
this.commitStatus = option.commitStatus;
this.getStuTestMaterials();
},
methods: {
scrolltolower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
this.getStuTestMaterialsList()
}, 1000)
} else {
}
},
addEvidence() {
uni.navigateTo({
url: `add?year=${this.queryParams.fillingYear}&month=${this.queryParams.fillingMonth}`
})
},
toDetail(id) {
uni.navigateTo({
url: `detail?id=${id}&commitStatus=${this.commitStatus}`
})
},
getStuTestMaterials() {
listStuTestMaterials(this.queryParams).then(res => {
this.loading = false;
if (!res.rows) {
this.list = [];
return;
}
if (this.queryParams.pageNum == 1) {
this.list = res.rows;
} else {
this.list = this.list.concat(res.rows);
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
}).catch(err => {
this.loading = false;
this.list = [];
});
},
onDel(id) {
console.log(id);
uni.showModal({
title: "确定删除吗?",
success: (res) => {
if (res.confirm) {
delStuTestMaterials(id).then(res => {
if (res.code == 200) {
uni.showToast({
title: "删除成功"
})
this.getStuTestMaterials();
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
scroll-view {
height: 100vh;
.load-more {
text-align: center;
}
.no-more {
text-align: center;
color: gray;
padding-bottom: 10px;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 200rpx;
color: #9E9E9E;
font-size: 36rpx;
image {
width: 250rpx;
margin-bottom: 50rpx;
}
}
}
.evidence-list {
background-color: #F5F5F7;
min-height: 100vh;
.list {
padding: 40rpx;
.item {
padding: 40rpx;
background-color: white;
border-radius: 16rpx;
margin-bottom: 20rpx;
.top {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #F5F5F7;
padding-bottom: 22rpx;
.title {
display: flex;
align-items: center;
font-weight: bold;
text {
margin-left: 8rpx;
}
}
.uni-icons {
opacity: 0.5;
}
text {
color: #3D3D3D;
font-weight: 600;
}
}
.content {
padding-top: 22rpx;
&>view:first-child {
display: flex;
align-items: center;
}
.time {
color: #9C9C9C;
margin-top: 14rpx;
font-size: 26rpx;
}
}
}
}
.add {
background-color: #1890FF;
width: 90rpx;
height: 90rpx;
border-radius: 50%;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-size: 60rpx;
position: fixed;
bottom: 50px;
right: 25px;
}
}
</style>