293 lines
6.5 KiB
Vue
293 lines
6.5 KiB
Vue
|
<template>
|
||
|
<view class="add">
|
||
|
<view class="form-item">
|
||
|
<label>学年</label>
|
||
|
<picker v-if="yearOptions.length>0" range-key="stuYearName" :value="yearOptionsIndex" :range="yearOptions"
|
||
|
@change="onYearChange">
|
||
|
<view class="uni-input">
|
||
|
<text class="val">{{ yearOptions[yearOptionsIndex].stuYearName || '请选择学年' }}</text>
|
||
|
<uni-icons type="down" size="16" color="#202020"></uni-icons>
|
||
|
</view>
|
||
|
</picker>
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label> <text class="tip">*</text> 第二课堂学分总分值</label>
|
||
|
<input type="number" placeholder="请输入" v-model="valiFormData.classTwo" />
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label><text class="tip">*</text>青年大学习学习率</label>
|
||
|
<input type="text" v-model="valiFormData.youthStudy" placeholder="请输入" />
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label><text class="tip">*</text>政治面貌</label>
|
||
|
<picker :range="politicsOptions" @change="onPoliticsChange">
|
||
|
<view class="uni-input">
|
||
|
<text class="val">{{ politicsOptions[selectedPoliticsOptionIndex] || '请选择政治面貌' }}</text>
|
||
|
<uni-icons type="down" size="16" color="#202020"></uni-icons>
|
||
|
</view>
|
||
|
</picker>
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label><text class="tip">*</text>职务</label>
|
||
|
<input type="text" v-model="valiFormData.classPost" placeholder="请输入" />
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label><text class="tip">*</text>获奖情况</label>
|
||
|
<textarea placeholder="请输入" v-model="valiFormData.goodHis"></textarea>
|
||
|
</view>
|
||
|
<view class="form-item">
|
||
|
<label><text class="tip">*</text>主要事迹</label>
|
||
|
<textarea class="main-his" placeholder="字数100字以上" v-model="valiFormData.mainHis"></textarea>
|
||
|
</view>
|
||
|
<view class="btns">
|
||
|
<!-- <button @click="onSave" :disabled="isSubmitting">保存</button> -->
|
||
|
<button @click="onSubmit" :disabled="isSubmitting">提交</button>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import {
|
||
|
validateFormFields
|
||
|
} from "@/utils/validateForm.js"
|
||
|
import {
|
||
|
listEnableYear,
|
||
|
doApply
|
||
|
} from "@/api/outstanding-graduate/outstanding-graduate.js";
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
isSubmitting: false, //表单提交标志位
|
||
|
// 校验表单数据
|
||
|
valiFormData: {
|
||
|
classTwo: '',
|
||
|
youthStudy: '',
|
||
|
zzmm: '',
|
||
|
classPost: '',
|
||
|
goodHis: '',
|
||
|
mainHis: '',
|
||
|
stuYearId: ''
|
||
|
},
|
||
|
politicsOptions: ['群众', '团员', '党员'], // 政治面貌
|
||
|
selectedPoliticsOptionIndex: -1, // 当前选中的政治面貌索引
|
||
|
yearOptions: [], // 学年
|
||
|
yearOptionsIndex: 0, // 当前选中的学年索引
|
||
|
}
|
||
|
},
|
||
|
onLoad() {
|
||
|
this.listEnableYear();
|
||
|
},
|
||
|
methods: {
|
||
|
//选择学年
|
||
|
onYearChange(e) {
|
||
|
this.yearOptionsIndex = e.detail.value;
|
||
|
this.valiFormData.stuYearId = this.yearOptions[this.yearOptionsIndex].id;
|
||
|
},
|
||
|
//选择政治面貌
|
||
|
onPoliticsChange(e) {
|
||
|
this.selectedPoliticsOptionIndex = e.detail.value;
|
||
|
this.valiFormData.zzmm = this.politicsOptions[this.selectedPoliticsOptionIndex];
|
||
|
},
|
||
|
//获取学年
|
||
|
async listEnableYear() {
|
||
|
let res = await listEnableYear();
|
||
|
if (res.code == 200) {
|
||
|
this.yearOptions = res.rows;
|
||
|
this.valiFormData.stuYearId = this.yearOptions[this.yearOptionsIndex].id;
|
||
|
}
|
||
|
},
|
||
|
onSave(ref) {},
|
||
|
onSubmit() {
|
||
|
const requiredFields = [
|
||
|
'classTwo',
|
||
|
'youthStudy',
|
||
|
'zzmm',
|
||
|
'classPost',
|
||
|
'goodHis',
|
||
|
'mainHis',
|
||
|
];
|
||
|
if (!validateFormFields(requiredFields, this.valiFormData)) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.valiFormData.mainHis.length < 100) {
|
||
|
uni.showToast({
|
||
|
title: "主要事迹字数需要100字以上",
|
||
|
icon: "none"
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
this.isSubmitting = true; // 设置为正在提交
|
||
|
uni.showLoading({
|
||
|
title: "正在提交",
|
||
|
success: () => {
|
||
|
doApply(this.valiFormData).then(res => {
|
||
|
if (res.code == 200) {
|
||
|
uni.showToast({
|
||
|
title: "申请成功"
|
||
|
})
|
||
|
this.isSubmitting = false;
|
||
|
toBackPage(500, (page) => {
|
||
|
page.getListOwnApply();
|
||
|
this.isSubmitting = false;
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.add {
|
||
|
background-color: #F5F5F7;
|
||
|
padding: 10px;
|
||
|
padding-bottom: 80px;
|
||
|
|
||
|
.form-item {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
padding: 22rpx 40rpx;
|
||
|
background-color: white;
|
||
|
margin-bottom: 20rpx;
|
||
|
border-radius: 16rpx;
|
||
|
|
||
|
.tip {
|
||
|
color: red;
|
||
|
font-size: 24rpx;
|
||
|
}
|
||
|
|
||
|
label {
|
||
|
margin-bottom: 20rpx;
|
||
|
display: inline-block;
|
||
|
}
|
||
|
|
||
|
input {
|
||
|
border: 1px solid #E1E1E1;
|
||
|
border-radius: 10rpx;
|
||
|
height: 70rpx;
|
||
|
padding-left: 30rpx;
|
||
|
|
||
|
.input-placeholder {
|
||
|
color: #b6b6b6;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
textarea {
|
||
|
border: 1px solid #E1E1E1;
|
||
|
border-radius: 10rpx;
|
||
|
width: 100%;
|
||
|
height:250rpx;
|
||
|
padding: 30rpx;
|
||
|
&.main-his{
|
||
|
height:500rpx;
|
||
|
}
|
||
|
.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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.btns {
|
||
|
padding: 10px;
|
||
|
display: flex;
|
||
|
background: white;
|
||
|
position: fixed;
|
||
|
bottom: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
z-index: 999;
|
||
|
|
||
|
button {
|
||
|
flex: 1;
|
||
|
background-color: #1890FF;
|
||
|
color: white;
|
||
|
&[disabled] {
|
||
|
opacity: 0.5;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</style>
|