evaluate.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="center">
  3. <view class="zhil">
  4. <view class="pf">评分</view>
  5. <view><uniRate text="1" size="20" margin="10" :value="evaluate_fraction" @change="rateChange1"></uniRate></view>
  6. </view>
  7. <view class="pjnr">
  8. <text>评价内容</text><input type="text" v-model="evaluate" />
  9. </view>
  10. <view class="item-left">评价图片:</view>
  11. <view class="item-right">
  12. <image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg"></image>
  13. <image src="https://zhibo.liuniu946.com/img/phone.png" class="upload-img" mode="" v-if="!cardimg" @click.stop="imgsub"></image>
  14. </view>
  15. <view class="button" @click="submit('/pages/course/success')">
  16. 提交评价
  17. </view>
  18. <view class="button" @click="nav('/pages/course/myEvaluate')">
  19. 我的评价
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { setEvaluate,uploads } from '@/api/course.js';
  25. import uniRate from '@/components/uni-rate/uni-rate.vue';
  26. export default {
  27. components: {
  28. uniRate
  29. },
  30. data(){
  31. return{
  32. cardimg: '',
  33. id: '',
  34. evaluate_fraction: '',//评分
  35. evaluate: '',//评价内容
  36. evaluate_imgs: '',//图片
  37. }
  38. },
  39. onLoad(option) {
  40. this.id = option.id;
  41. },
  42. methods: {
  43. imgsub() {
  44. console.log('上传照片')
  45. uploads({
  46. filename: ''
  47. }).then(data => {
  48. console.log("data",data);
  49. this.evaluate_imgs = data[0].url;
  50. })
  51. },
  52. submit(url){
  53. console.log(this.evaluate_fraction)
  54. setEvaluate({
  55. timetable_id: this.id,
  56. evaluate_fraction: this.evaluate_fraction,
  57. evaluate: this.evaluate,
  58. evaluate_imgs: this.evaluate_imgs
  59. }).then(() =>{
  60. uni.navigateTo({
  61. url: url
  62. })
  63. }).catch(err =>{
  64. console.log(err)
  65. })
  66. },
  67. nav(url) {
  68. uni.navigateTo({
  69. url: url
  70. })
  71. },
  72. rateChange1(val) {
  73. this.evaluate_fraction = val.value;
  74. },
  75. }
  76. }
  77. </script>
  78. <style>
  79. .pf{
  80. margin-bottom: 20rpx;
  81. }
  82. .button{
  83. height: 200rpx;
  84. }
  85. .zhil {
  86. font-size: 28rpx !important;
  87. padding: 15rpx 15rpx;
  88. height: 100rpx;
  89. }
  90. </style>