123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template>
- <view class="content">
- <u-form :model="form" ref="form" label-width="140">
- <u-form-item label="评价星级" prop="star">
- <u-rate :count="10" v-model="form.star" :size="40" :gutter="10" :active-color="mainColor"></u-rate>
- </u-form-item>
- <u-form-item label="评价内容" prop="remark" required>
- <u-input v-model="form.remark" placeholder="请输入评价内容" />
- </u-form-item>
- <!-- <u-form-item label="上传附件" label-position="top">
- <u-upload max-count="5" :multiple="false" :action="uploadUrl" :header="uploadHeader" @on-success="uploadSuccess"
- @on-error="uploadError" @on-remove="uploadRemove"></u-upload>
- </u-form-item> -->
- </u-form>
- <view class="handle-fix-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="submitForm()">提交</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- ])
- },
- data() {
- return {
- form: {
- signId: '',
- classId:'',
- star: 10,
- remark: '',
- isCoach: false
- },
- // uploadUrl: API.uploadFile,
- // uploadHeader: {
- // Authorization: uni.getStorageSync('token')
- // },
- rules: {
- content: [{
- required: true,
- message: '请输入评价内容',
- trigger: 'change'
- }],
- },
- }
- },
- onLoad(options) {
- this.form.signId = parseInt(options.id)
- this.form.classId = parseInt(options.classId)
-
- },
- onReady() {
- this.$refs.form.setRules(this.rules);
- },
- methods: {
- // 提交表单
- submitForm() {
- this.$refs.form.validate(valid => {
- if (valid) {
- NET.request(API.setSignRemark, {
- ...this.form
- }, 'POST').then(res => {
- this.$refs.uTips.show({
- title: '填写成功',
- type: 'success',
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1000)
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- }
- });
- }
- // // 文件上传成功回调
- // uploadSuccess(res, index, lists, name) {
- // this.form.fileId.push(res.data.id)
- // this.$refs.uTips.show({
- // title: '文件上传成功',
- // type: 'success',
- // })
- // return true
- // },
- // // 文件上传失败回调
- // uploadError(res, index, lists, name) {
- // this.$refs.uTips.show({
- // title: '文件上传失败',
- // type: 'warning',
- // })
- // },
- // // 移除文件回调
- // uploadRemove(index, lists, name) {
- // this.form.fileId.splice(index, 1)
- // },
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding: 0 15px 60px 15px;
- box-sizing: border-box;
- }
- </style>
|