coachReply.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="content">
  3. <u-form :model="form" ref="form" label-width="140">
  4. <u-form-item label="回复" prop="remark" required>
  5. <u-input v-model="form.remark" type="text" placeholder="请输入回复" />
  6. </u-form-item>
  7. </u-form>
  8. <view class="handle-fix-box">
  9. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="submitForm()">提交</u-button>
  10. </view>
  11. <u-top-tips ref="uTips"></u-top-tips>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. mapGetters
  17. } from 'vuex'
  18. const NET = require('@/utils/request')
  19. const API = require('@/config/api')
  20. export default {
  21. computed: {
  22. ...mapGetters([
  23. 'customStyle',
  24. ])
  25. },
  26. data() {
  27. return {
  28. id: '',
  29. type: '',
  30. form: {
  31. signId: 0,
  32. classId: 0,
  33. isCoach: true,
  34. remark: ''
  35. },
  36. rules: {
  37. remark: [{
  38. required: true,
  39. message: '请输入回复',
  40. trigger: 'change'
  41. }],
  42. },
  43. }
  44. },
  45. onLoad(options) {
  46. this.form.signId = options.id
  47. this.form.classId = options.classId
  48. },
  49. onReady() {
  50. this.$refs.form.setRules(this.rules);
  51. },
  52. methods: {
  53. // 提交表单
  54. submitForm() {
  55. this.$refs.form.validate(valid => {
  56. if (valid) {
  57. NET.request(API.setSignRemark, {
  58. ...this.form
  59. }, 'POST').then(res => {
  60. this.$refs.uTips.show({
  61. title: '提交成功',
  62. type: 'success',
  63. })
  64. setTimeout(() => {
  65. uni.navigateBack()
  66. }, 1000)
  67. }).catch(error => {
  68. this.$refs.uTips.show({
  69. title: error.message,
  70. type: 'warning',
  71. })
  72. })
  73. }
  74. });
  75. },
  76. },
  77. }
  78. </script>
  79. <style>
  80. page {
  81. width: 100%;
  82. height: 100%;
  83. position: relative;
  84. }
  85. </style>
  86. <style lang="scss" scoped>
  87. @import "@/static/css/themes.scss";
  88. .content {
  89. width: 100%;
  90. float: left;
  91. padding: 0 15px 60px 15px;
  92. box-sizing: border-box;
  93. }
  94. </style>