@@ -2,7 +2,7 @@
< view class = "page" >
< z-nav-bar :title = "pageName+pageType" > < / z-nav-bar >
<!-- 公共组件 - 每个页面必须引入 -- >
< public-module > < / public-module >
< public-module > < / public-module >
<!-- < view class = "title" > { { pageName + pageType } } < / view > -- >
< uni-forms :modelValue = "form" :rules = "rules" ref = "form" >
<!-- < view class = "input_box" v-if = "!form.id && form.type != 2" >
@@ -30,44 +30,44 @@
< / view >
< / uni-forms-item >
< / view >
< view class = "input_box" >
< text class = "input_tit" > 上传图片 : < / text >
< view class = "in" style = "border: none;" @click ="checkPermision" >
< u -upload :fileList = "fileList1" @afterRead ="addPic" @delete ="deletePic" multiple :maxCount = "4"
width = "40" height = "40" :previewFullImage = "true" >
< / u-upload >
<!-- < text style = "font-size: 24rpx; color: #999;" > 可上传4张问题截图 < / text > -- >
< / view >
<!-- < input type = "password" maxlength = "8" v-model = "confirmPassword" placeholder="请确认密码" / > -- >
< / view >
< view class = "input_box" >
< text class = "input_tit" > 上传图片 : < / text >
< view class = "in" style = "border: none;" @click ="checkPermision" >
< u -upload :fileList = "fileList1" @afterRead ="addPic" @delete ="deletePic" multiple :maxCount = "4"
width = "40" height = "40" :previewFullImage = "true" >
< / u-upload >
<!-- < text style = "font-size: 24rpx; color: #999;" > 可上传4张问题截图 < / text > -- >
< / view >
<!-- < input type = "password" maxlength = "8" v-model = "confirmPassword" placeholder="请确认密码" / > -- >
< / view >
< view class = "input_box" >
< uni-forms-item label = "" name = "content" label -width = " 0 " >
< text class = "input_tit" > < i > * < / i > 主要内容 : < span style = "font-weight: normal; color: #999; font-size: 26rpx;" > ( 600 字以内 ) < / span > < / text >
< text class = "input_tit" > < i > * < / i > 主要内容 : < span
style = "font-weight: normal; color: #999; font-size: 26rpx;" > ( 600 字以内 ) < / span > < / text >
< view class = "in" >
< view class = "uni-textarea" >
<!-- < textarea placeholder -style= " font -size: 26rpx " v-model= "form.content" maxlength="600" auto -height
placeholder = "请输入内容" / > -- >
< view class = "editor-wrapper" >
< editor id = "editor" class = "ql-container" placeholder = "请输入内容..."
show -img -size show -img -toolbar show -img -resize
@statuschange ="onStatusChange" :read-only= "readOnly"
@ready ="onEditorReady" >
< / editor >
< textarea v-show = "false" placeholder-style=" font-size:26rpx" v-model= "form.content"
maxlength = "600" auto -height placeholder= "请输入内容" / >
< view class = "editor-wrapper" >
< editor id = "editor" class = "ql-container" placeholder = "请输入内容..." show -img -size
show -img -toolbar show -img -resize @statuschange ="onStatusChange"
:read-only = "readOnly" @ready ="onEditorReady" >
< / editor >
< / view >
< / view >
< / view >
< / uni -forms -item >
< / view >
< view class = "input_box" v-if = "false" >
< radio -group @change ="radioChange" class = "flex_box" >
< view class = "" style = "margin-right:20rpx ;" >
< radio value = "0" : checked = "0 == form.display" / > 他人不可见 < / label >
< / view >
< view class = "" >
< radio value = "1" : checked = "1 == form.display" / > 他人可见 < / label >
< / view >
< / radio-group >
< span style = "color: #999; font-size: 28rpx;" > ( 不勾选时 , 班级管理员以外的人看不见提交的数据 ) < / span >
< radio -group @change ="radioChange" class = "flex_box" >
< view class = "" style = "margin-right:20rpx ;" >
< radio value = "0" : checked = "0 == form.display" / > 他人不可见 < / label >
< / view >
< view class = "" >
< radio value = "1" : checked = "1 == form.display" / > 他人可见 < / label >
< / view >
< / radio-group >
< span style = "color: #999; font-size: 28rpx;" > ( 不勾选时 , 班级管理员以外的人看不见提交的数据 ) < / span >
< / view >
< / uni-forms >
@@ -75,8 +75,10 @@
< / view >
< / template >
< script >
import { parse } from 'qs' ;
import $http from '@/config/requestConfig.js' ;
import {
parse
} from 'qs' ;
import $http from '@/config/requestConfig.js' ;
import permission from "@/js_sdk/wa-permission/permission.js"
import {
mapState ,
@@ -85,26 +87,34 @@ import $http from '@/config/requestConfig.js';
export default {
data ( ) {
return {
flag : false ,
fileList1 : [ ] ,
playData : { } ,
//手机号账号
form : {
id : undefined , // 作业或者医案id
classId : undefined ,
display : '1' ,
display : '1' ,
content : '' , // 描述
img : '' , //图片
type : undefined , // 反馈类型
sort : undefined
sort : undefined
} ,
range : [
{ value : '0' , text : "班内作业" , name : "班内作业" } ,
{ value : '1' , text : "班内医案" , name : "班内医案" } ,
range : [ {
value : '0' ,
text : "班内作业" ,
name : "班内作业"
} ,
{
value : '1' ,
text : "班内医案" ,
name : "班内医案"
} ,
] ,
readOnly : false ,
telError : false ,
relationError : false ,
relationErrorPattern : false ,
relationErrorPattern : false ,
rules : {
type : {
rules : [ {
@@ -122,53 +132,53 @@ import $http from '@/config/requestConfig.js';
]
} ,
content: {
rules : [ {
required: true ,
errorMessage: '请输入问题描述',
}
// content: {
// // rules: [{
// // required: true,
// // errorMessage: '请输入问题描述',
// // }
]
} ,
// // ]
// },
} ,
pageType : '' ,
pageName : ''
pageName : ''
} ;
} ,
//第一次加载
onLoad ( e ) {
console . log ( '收到的值' , e ) ;
if ( e . sort != 'undefined' && e . sort ) {
if ( e . sort != 'undefined' && e . sort ) {
this . form . sort = e . sort
}
if ( e . type == 2 ) {
if ( e . type == 2 ) {
this . form . display = '0'
}
// this.pageType = e.type
this . form . classId = e . classId
this . form . type = e . type
if ( e . type ) {
if ( e . type ) {
this . form . type = e . type
} else {
} else {
this . form . type = '0'
}
if ( e . id ) {
if ( e . id ) {
// this.form.renwuId = e.renwuId
this . form . id = e . id
this . pageName = '编辑'
this . getTaskInfo ( )
} else {
} else {
this . pageName = '添加'
}
if ( e . type == 0 ) {
if ( e . type == 0 ) {
// this.form.renwuId = e.renwuId
this . pageType = '作业'
} else if ( e . type == 1 ) {
} else if ( e . type == 1 ) {
this . pageType = '医案'
} else if ( e . type == 2 ) {
} else if ( e . type == 2 ) {
this . pageType = '心得222'
} else {
} else {
this . pageType = '作业'
}
console . log ( '收到的值' , e ) ;
@@ -210,16 +220,16 @@ import $http from '@/config/requestConfig.js';
const formats = e . detail
this . formats = formats
} ,
chageType ( e ) {
chageType ( e ) {
// console.log('e',e);
if ( e == 0 ) {
if ( e == 0 ) {
this . pageType = '作业'
} else if ( e == 1 ) {
} else if ( e == 1 ) {
this . pageType = '医案'
}
} ,
// 获取医案任务详情
getTaskInfo ( ) {
getTaskInfo ( ) {
$http . request ( {
url : "common/class/getClassTaskInfoStudent" ,
method : "POST" ,
@@ -237,10 +247,12 @@ import $http from '@/config/requestConfig.js';
this . form = res . classTask
this . onEditorReady ( )
this . fileList1 = [ ]
if ( this . form . img != '' ) {
if ( this . form . img != '' ) {
var List = this . form . img . split ( ',' )
List . forEach ( item => {
this . fileList1 . push ( { url : item } )
this . fileList1 . push ( {
url : item
} )
} )
}
}
@@ -253,11 +265,11 @@ import $http from '@/config/requestConfig.js';
} )
} ) ;
} ,
radioChange ( e ) {
radioChange ( e ) {
// console.log('点了', e);
this . form . display = e . detail . value
console . log ( '点了' , this . form . show , e ) ;
console . log ( '点了' , this . form . show , e ) ;
} ,
relationInput ( e ) {
@@ -268,14 +280,14 @@ import $http from '@/config/requestConfig.js';
// console.log('键盘输入',e);
this . telError = false
} ,
async checkPermision ( ) {
var result = await permission . premissionCheck ( "CAMERA_EXTERNAL_STORAGE" )
if ( result != 1 ) {
return false
}
async checkPermision ( ) {
var result = await permission . premissionCheck ( "CAMERA_EXTERNAL_STORAGE" )
if ( result != 1 ) {
return false
}
} ,
async addPic ( e ) {
console . log ( "添加图片" ) ;
console . log ( "添加图片" ) ;
let that = this ;
for ( var i = 0 ; i < e . file . length ; i ++ ) {
//console.log(i,e.file[i].url)
@@ -313,6 +325,16 @@ import $http from '@/config/requestConfig.js';
} ) ;
} ,
async onSubmit ( ) {
let that = this
if ( this . flag ) {
console . log ( '拦截了吗' ) ;
return
} else {
this . flag = true
console . log ( '没拦截?' , this . flag ) ;
}
// this.flag = true
let data = await this . getHtml ( ) ;
var _data = data . html . replace ( /<.*?>/g , "" )
if ( ! _data || _data == '' ) {
@@ -320,10 +342,6 @@ import $http from '@/config/requestConfig.js';
title : '请输入主要内容' ,
icon : 'none'
} )
return
}
this . form . content = data . html
this . $refs . form . validate ( ) . then ( async res => {
let data = await this . getHtml ( ) ;
var _data = data . html . replace ( /<.*?>/g , "" )
if ( ! _data || _data == '' ) {
@@ -331,69 +349,68 @@ import $http from '@/config/requestConfig.js';
title : '请输入主要内容' ,
icon : 'none'
} )
// this.flag = false
return
}
this . form . content = data . html
return
}
this . form . content = data . html
console . log ( 'this.form.content' , this . form ) ;
this . $refs . form . validate ( ) . then ( async res => {
if ( this . fileList1 . length > 0 ) {
let _list = this . fileList1
_list = _list . map ( item => item . url )
// console.log('this.fileList1',_list);
this . form . img = _list . join ( ',' )
} else {
} else {
this . form . img = ''
}
// var newSort = undefined
// if(this.form.sort) {
// console.log('this.sort',this.form.sort);
// // var oldsort = this.form.sort.split('')
// if(oldsort[oldsort.length-1] == '9'){
// oldsort.push('0')
// }else{
// console.log('符合');
// oldsort[oldsort.length-1] = ( parseInt(oldsort[oldsort.length-1]) + 1) + ''
// }
// newSort = oldsort.join('')
// }
console . log ( 'this.form' , this . form ) ;
console . log ( 'this.form' , this . form ) ;
var _url = ""
this . form . id ? _url = "common/class/editClassTask" : _url = "common/class/addClassTask"
$http . request ( {
url : _url ,
method : "POST" ,
data : {
"id" : this . form . id ,
"classId" : this . form . id ? undefined : this . form . classId ,
"type" : this . form . type , //类型 0班内任务1医案2心得
"display" : this . form . display , //0不展示1展示
"title" : this . form . title ,
"content" : this . form . content ,
"img" : this . form . img ,
"sort" : this . form . sort && ! this . form . id ? parseInt ( this . form . sort ) +1 : undefined
} ,
header : { //默认 无 说明:请求头
'Content-Type' : 'application/json'
} ,
} )
this . form . id ? _url = "common/class/editClassTask" : _url = "common/class/addClassTask"
$http . request ( {
url : _url ,
method : "POST" ,
data : {
"id" : this . form . id ,
"classId" : this . form . id ? undefined : this . form . classId ,
"type" : this . form . type , //类型 0班内任务1医案2心得
"display" : this . form . display , //0不展示1展示
"title" : this . form . title ,
"content" : this . form . content ,
"img" : this . form . img ,
"sort" : this . form . sort && ! this . form . id ? parseInt ( this . form . sort ) +
1 : undefined
} ,
header : { //默认 无 说明:请求头
'Content-Type' : 'application/json'
} ,
} )
. then ( res => {
// this.flag = false
uni . showToast ( {
title : '操作成功!' ,
icon : 'success'
title : '操作成功!' ,
icon : 'success'
} )
setTimeout ( ( ) => {
uni . $emit ( 'refreshData' ) ;
setTimeout ( ( ) => {
uni . $emit ( 'refreshData' ) ;
uni . navigateBack ( {
delta : 1
} )
} , 1000 )
} , 1000 )
} ) . catch ( e => {
// console.log('表单错误信息:', err);
uni . showToast ( {
title : '操作失败' ,
icon : 'error'
} )
} ) ;
this . flag = false
// console.log('表单错误信息:', err);
uni . showToast ( {
title : '操作失败' ,
icon : 'error'
} )
} ) ;
} ) . catch ( err => {
console . log ( '表单错误信息:' , err ) ;
this . flag = false
uni . showToast ( {
title : '页面有未填写的内容哦' ,
icon : 'none'
@@ -417,12 +434,15 @@ import $http from '@/config/requestConfig.js';
< / script >
< style lang = "scss" scoped >
@ import '@/style/mixin.scss' ;
: : v - deep . uni - forms - item {
: : v - deep . uni - forms - item {
margin - bottom : 26 rpx ! important ;
}
. input _tit {
. input _tit {
font - weight : bold ;
}
. page {
background - color : # ffffff ;
padding : 0 65 rpx ;