evaluate.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="center">
  3. <view class="bg"></view>
  4. <view class="main">
  5. <view class="toux"><image :src="userInfo.avatar"></image></view>
  6. <view class="name">{{ userInfo.nickname }}</view>
  7. <view class="pj">您的评价让我们做的更好</view>
  8. <view class="fanqu">你的反馈将有助于提高我们的教师授课体验</view>
  9. <view class="dafen">为课程体验打分</view>
  10. <uniRate class="fenshu" text="1" size="44" margin="15" :value="evaluate_fraction" @change="rateChange1"></uniRate>
  11. <textarea v-model="evaluate" maxlength="300" focus placeholder="添加评价..."></textarea>
  12. <view class="button" @click="submit('/pages/course/success')">提交评价</view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { mapState, mapMutations } from 'vuex';
  18. import { setEvaluate,uploads } from '@/api/course.js';
  19. import uniRate from '@/components/uni-rate/uni-rate.vue';
  20. export default {
  21. computed: {
  22. ...mapState(['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  23. },
  24. components: {
  25. uniRate
  26. },
  27. data(){
  28. return{
  29. cardimg: '',
  30. id: '',
  31. evaluate_fraction: '',//评分
  32. evaluate: '',//评价内容
  33. evaluate_imgs: '',//图片
  34. }
  35. },
  36. onLoad(option) {
  37. this.id = option.id;
  38. },
  39. methods: {
  40. imgsub() {
  41. console.log('上传照片')
  42. uploads({
  43. filename: ''
  44. }).then(data => {
  45. console.log("data",data);
  46. this.evaluate_imgs = data[0].url;
  47. })
  48. },
  49. submit(url){
  50. console.log(this.evaluate_fraction)
  51. setEvaluate({
  52. timetable_id: this.id,
  53. evaluate_fraction: this.evaluate_fraction,
  54. evaluate: this.evaluate,
  55. evaluate_imgs: this.evaluate_imgs
  56. }).then(() =>{
  57. uni.navigateTo({
  58. url: url
  59. })
  60. }).catch(err =>{
  61. console.log(err)
  62. })
  63. },
  64. nav(url) {
  65. uni.navigateTo({
  66. url: url
  67. })
  68. },
  69. rateChange1(val) {
  70. this.evaluate_fraction = val.value;
  71. },
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. .bg {
  77. position: relative;
  78. background: #DDFBFB;
  79. height: 300rpx;
  80. }
  81. .main{
  82. width: 90%;
  83. text-align: center;
  84. margin: 0 auto;
  85. margin-top: -190rpx;
  86. position: relative;
  87. background: #FFFFFF;
  88. padding-top: 94rpx;
  89. padding-bottom: 42rpx;
  90. box-shadow: 0px 23rpx 29rpx 0px rgba(24, 32, 93, 0.07);
  91. border-radius: 16rpx;
  92. .toux {
  93. position: absolute;
  94. top: -70rpx;
  95. left: 50%;
  96. margin-left: -71rpx;
  97. height: 142rpx;
  98. width: 142rpx;
  99. border-radius: 50%;
  100. box-shadow: 0rpx 16rpx 29rpx 0rpx rgba(24, 32, 93, 0.11);
  101. background-color: #ffff7f;
  102. image {
  103. width: 100%;
  104. height: 100%;
  105. border-radius: 50%;
  106. }
  107. }
  108. .name {
  109. font-size: 37rpx;
  110. font-weight: bold;
  111. color: #303338;
  112. }
  113. .pj {
  114. margin-top: 114rpx;
  115. font-size: 45rpx;
  116. font-weight: bold;
  117. color: #FA7268;
  118. }
  119. .fanqu {
  120. margin-top: 32rpx;
  121. font-size: 21rpx;
  122. font-weight: 500;
  123. color: #8A8A8F;
  124. }
  125. .dafen {
  126. margin-top: 76rpx;
  127. font-size: 21rpx;
  128. font-weight: 500;
  129. color: #242E42;
  130. opacity: 0.5;
  131. }
  132. .fenshu {
  133. width: 560rpx;
  134. margin-left: 45rpx;
  135. margin-top: 82rpx;
  136. }
  137. textarea{
  138. padding: 20rpx;
  139. width: 80%;
  140. margin: 0 auto;
  141. margin-top: 86rpx;
  142. height: 232rpx;
  143. background: rgba(239, 239, 244, 0.5);
  144. border: 2rpx solid #EFEFF2;
  145. border-radius: 16rpx;
  146. font-size: 34rpx;
  147. font-weight: 500;
  148. text-align: left;
  149. }
  150. .button {
  151. margin: 0 auto;
  152. margin-top: 58rpx;
  153. width: 90%;
  154. height: 90rpx;
  155. background: #1CC7C7;
  156. border-radius: 16rpx;
  157. text-align: center;
  158. font-size: 34rpx;
  159. font-weight: 400;
  160. color: #FFFFFF;
  161. line-height: 90rpx;
  162. }
  163. }
  164. </style>