123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view class="mind">
- <picker range-key="dictLabel" :disabled="daflag||studentlist.length<1" :range="studentlist" :value="nameidx" @change="bindDateChangea">
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">人员</view>
- <view class="f15 flex1 txr co16" v-if="name" >{{name}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择人员</view>
- <image :src="rimg" class="rimg"></image>
- </view>
- </picker>
- <picker range-key="dictLabel" :range="xlhealthrange" :value="mindidx" @change="bindDateChanged">
- <view class="flexc mibox mb20">
- <view class="tit" style="margin-bottom: 0;">心理健康状态</view>
- <view class="f15 flex1 txr co16" v-if="mind" >{{mind}}</view>
- <view class="f15 flex1 txr coa" v-else >请选择心理健康状态</view>
- <image :src="rimg" class="rimg"></image>
- </view>
- </picker>
- <view class='mibox'>
- <view class="tit">心理健康描述</view>
- <textarea placeholder="请输入心理健康描述详情…" v-model="psychologicalDescription" :auto-height="autoHeight"></textarea>
- </view>
- <view class="rebtn mt30" @click="getSubmit">确认</view>
- </view>
- </template>
- <script>
- // import tabSearch from "@/components/toptab/search.vue"
- import {getDictionaryFn} from '@/api/mine/register.js'
- import {getmindAddFn} from "@/api/mine/files.js"
- export default {
- data(){
- return{
- rimg:require("@/mine/static/score/rimg.png"),
- autoHeight:true,
- xlhealthrange:[],
- mindidx:0,
- mind:'',
- datainfo:{
-
- },
- roles:'',
- studentlist:[],
- name:'',
- nameidx:0,
- studentId:'',
- psychologicalDescription:'',
- daflag:false,
- }
- },
- onLoad: function(e) {
- this.init();
- if(e.type&&e.type=='daup'){
- this.name=e.name;
- this.studentId=e.id;
- this.daflag=true;
- }else{
- var roles=this.$store.state.user.choseroles;
- var newArr=this.$store.state.user.student;
- if(newArr&&newArr.length){
- if(newArr&&newArr.length>1){
- this.studentlist = newArr.map(v => {
- return {
- dictLabel:v.studentName,
- dictValue: v.id,
- }
- })
- }else{
- // 一个娃
- this.name=newArr[0].studentName
- this.studentId=newArr[0].id
- }
- }
-
- }
- },
- methods:{
- init(){
- //心理健康状态
- getDictionaryFn('psychology').then(res=>{
- if(res.code==200){
- this.xlhealthrange = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- bindDateChangea(e){
- var idx=e.detail.value
- this.name=this.studentlist[idx].dictLabel
- this.studentId=this.studentlist[idx].dictValue
- },
- bindDateChanged(e){
- var idx=e.detail.value
- this.mind=this.xlhealthrange[idx].dictLabel
- },
- getSubmit(){
- // 学生 id
- var roles=this.$store.state.user.choseroles;
-
- var that=this;
- if(!this.studentId){
- this.$toast('请选择人员')
- return
- }
- if(!this.mind){
- this.$toast('请选择心理健康状态')
- return
- }
- var params={
- studentId:this.studentId,
- mind:this.mind,
- psychologicalDescription:this.psychologicalDescription
- }
- if(roles=='teacher'){
- params.createType='2'
- }else if(roles=='parents'){
- params.createType='1'
- }
- getmindAddFn(params).then(res => {
- if (res.code == 200) {
- that.$toast('新增成功')
- setTimeout(function() {
- if(that.daflag){
- uni.$emit('refreshdalist');
- uni.redirectTo({
- url:'/mine/pages/files/mindlist?type=da&id='+that.studentId+'&name='+that.name
- })
- }else{
- uni.$emit('refreshmindlist');
- uni.navigateBack({
- delta:1
- })
- }
- }, 1500)
- } else {
- this.$toast(res.msg)
- }
- })
- },
- },
-
- }
- </script>
- <style lang="scss" scoped>
- .mind{
- min-height: 100vh;background: #ffffff;padding: 80rpx 60rpx;
- .mibox{
- .tit{font-size: 32rpx;font-weight: 500;color: #161616;margin-bottom: 40rpx;}
- textarea{border: 2rpx solid #FFB132;border-radius: 20rpx;width: 100%;min-height: 230rpx;padding:32rpx;box-sizing: border-box;}
- .rimg{width: 14rpx;height: 24rpx;flex: 0 0 auto;margin-left: 12rpx;}
- }
- }
- </style>
|