This commit is contained in:
@fawn-nine
2024-08-06 17:17:31 +08:00
parent 4426b044bd
commit 3ae89fd86b
8 changed files with 2607 additions and 239 deletions

View File

@@ -1,11 +1,27 @@
<template>
<view class="page">
<z-nav-bar :title="`${pageType}班级`"></z-nav-bar>
<!-- 公共组件-每个页面必须引入 -->
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<uni-forms :modelValue="form" :rules="rules" ref="form">
<view class="input_box " style="">
<view class="input_box " style="" v-if="!form.id">
<uni-forms-item label="" name="modelId" label-width="0">
<view class="">
<text class="input_tit"><i>*</i>班级类型</text>
</view>
<view class="in" style="flex: 1; border: none;">
<!-- {{modelLIst}} -->
<uni-data-select placeholder="请选择班级类型"
class="addType"
v-model="form.type"
:localdata="range"
@change="selectChange"
placement="top"
></uni-data-select>
</view>
</uni-forms-item>
</view>
<view class="input_box " style="" v-if="!form.id">
<uni-forms-item label="" name="modelId" label-width="0">
<view class="">
<text class="input_tit"><i>*</i>班级模型</text>
@@ -42,10 +58,7 @@
<view class="in">
<input type="number" @input="relationInput" placeholder-style="font-size:26rpx"
v-model="form.number" placeholder="请输入学员目标人数" />
</view>
<!-- <text v-show="relationError" style="font-size: 24rpx; color: red; margin-top: 10rpx;">请填写订单编号</text> -->
<!-- <text v-show="relationErrorPattern"
style="font-size: 24rpx; color: red; margin-top: 10rpx;">订单编号格式错误</text> -->
</view>
</uni-forms-item>
</view>
<view class="input_box">
@@ -89,8 +102,11 @@
number: '', // 联系电话
},
telError: false,
// relationError: false,
// relationErrorPattern: false,
range:[
{ value: '0', text: "普通小班",name:"普通小班"},
{ value: '1', text: "联合班" ,name:"普通小班"},
{ value: '2', text: "精英班" ,name:"普通小班"},
],
rules: {
title: {
rules: [{
@@ -119,12 +135,10 @@
onLoad(e) {
console.log('收到的值', e);
// this.pageType = e.type
this.form.type = e.type
this.modeType = e.type
this.getUserModel()
// this.form.type = e.type
// this.modeType = e.type
if(e.id){
if(e.id){
this.pageType = '编辑'
this.form.id = e.id
this.getClassInfo()
@@ -136,19 +150,24 @@
//页面显示
onShow() {
},
onPullDownRefresh(){
uni.stopPullDownRefresh()
},
computed: {
...mapState(['userInfo']),
// getPageTitle(){
// if(this.form.id){
// return "修改班级"
// }else{
// return "添加班级"
// }
// }
...mapState(['userInfo']),
},
//方法
methods: {
selectChange(e){
console.log("e:", e);
if(e != this.modeType){
this.modeType = e
console.log('formType',this.form.type)
this.getUserModel()
}
},
// 获取班级详情
getClassInfo(){
// console.log('获取课程详情');
@@ -169,9 +188,12 @@
this.refresh = false
if (res.code == 0) {
this.form = res.result.class
if(this.form.icon != ''){
this.fileList1.push({url:this.form.icon})
}
this.form.modelId = res.result.classModel.id
}
console.log('this.form',this.form);
console.log('this.form',res.result);
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
@@ -307,10 +329,13 @@
icon:'success'});
setTimeout(()=> {
this.fileList1 = []
uni.navigateTo({
url:'/pages/miniClass/miniClassMan'
})
// this.$nextTick(() => {
uni.navigateBack({
delta: 1
});
// uni.navigateBack({
// delta: 1
// });
},300)
}).catch(e => {
// console.log('表单错误信息:', err);