<template>
  <view>
    <view>
      <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
        activeColor="#007aff"></uni-segmented-control>
      <view class="content">
        <view v-show="current === 0">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><uni-file-picker limit="3" @select="select(item)" @success="success" @fail="fail" v-model="fileLists" :listStyles="imageStyles" file-mediatype="all" file-extname="png,jpg,gif"><button type="default" size="mini" plain="true" @click="upload(item.attachmentList)">佐证资料:<br>(点击上传)</button></uni-file-picker></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view v-show="current === 1">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><button type="default" size="mini" plain="true">佐证资料:<br>(点击上传)</button></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view v-show="current === 2">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><button type="default" size="mini" plain="true">佐证资料:<br>(点击上传)</button></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view v-show="current === 3">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><button type="default" size="mini" plain="true">佐证资料:<br>(点击上传)</button></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view v-show="current === 4">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><button type="default" size="mini" plain="true">佐证资料:<br>(点击上传)</button></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view v-show="current === 5">
          <uni-group v-for="item in currentableData" mode="card" :title="item.pointName">
            <view class="row"><view class="itemleft">评分标准:</view><view class="itemright">{{item.pointMemo}}</view></view>
            <view class="row"><view class="itemleft"><button type="default" size="mini" plain="true" @click="upload">佐证资料:<br>(点击上传)</button></view><view class="itemright">{{item.attachmentList.fileName}}</view></view>
            <view class="row"><view class="itemleft">得分:</view><view class="itemright"><uni-number-box v-model="item.selfScore" :min="0" :max="100"></uni-number-box></view></view>
            <view class="row"><view class="itemleft">得分依据:</view><view class="itemright"><uni-easyinput type="textarea" autoHeight v-model="item.detail" placeholder="请输入内容"></uni-easyinput></view></view>
          </uni-group>
        </view>
        <view class="btns">
          <button type="primary" size="mini" @click="Savedate" :loading="isSaving">{{savetext}}</button>
          <button type="primary" size="mini" @click="Submitdate">提交</button>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
  import { getGradeYears, getDeatil, saveDate, upDate } from '@/utils/student.js'
  export default {
    data() {
      return {
        gradeyear: 0,
        options: [],
        studentXh: '',
        items: ['思想', '职业', '身心', '文化', '劳动'],
        current: 0,
        score: '',
        tableData: [],
        currentableData: [],
        vModelValue: 3,
        value: '',
        savetext: '保存',
        isSaving: false,
        imageValue: [],
        imageStyles: {
          width: 64,
          height: 64,
          border: {
            radius: '50%'
          }
        },
        fileLists: []
      }
    },
    mounted() {
      uni.getStorage({
        key: 'studentxh',
        success: function(res) {
          this.studentXh = res.data
        }
      })
      this.getYears()
      this.onClickItem({ currentIndex: 0 })
    },
    methods: {
      upload(al) {
      },
      // 获取上传状态
      select(e) {
        e.tempFiles[0] && (e.attachmentList = e.tempFiles[0]);
        console.log('选择文件:', e.tempFiles)
      },
      // 获取年级数据
      getYears() {
        getGradeYears().then(res => {
          this.options = res
          this.gradeyear = res[0].value
          this.getDeatil(res[0].value)
        })
      },
      // 获取评分数据
      getDeatil(gradeyear) {
        getDeatil(gradeyear, this.studentXh).then(res => {
          this.tableData = res
          this.currentableData = res[0].pointList
        })
      },
      // 点击切换评分项
      onClickItem(e) {
        this.current = e.currentIndex
        this.currentableData = this.tableData[e.currentIndex].pointList
      },
      // 保存数据
      Savedate() {
        this.isSaving = true
        saveDate(this.tableData, this.studentXh).then(res => {
          this.savetext = '保存成功'
          this.isSaving = false
          setTimeout(() => {
            this.savetext = '保存'
          }, 1000)
        })
      },
      // 提交数据
      Submitdate() {
        upDate(this.tableData, this.studentXh).then(res => {
          uni.showToast({
            title: '提交成功',
            icon: 'success',
            duration: 2000
          })
        })
      }
    }
  }
</scrip

原文地址: https://www.cveoy.top/t/topic/o3gQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录