洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
5.4 KiB

  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="评价"></topNavbar>
  4. <evaluateItem :info="schoolInfo" key="1" v-show="showSchool" @updatedForm="updatedSchoolInfo"/>
  5. <evaluateItem :info="coachInfo" key="2" @updatedForm="updatedCoachInfo"/>
  6. <view class="btnBox">
  7. <view class="btnBg" @click="submintFn" :class="{active: btnActive}">提交</view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import evaluateItem from './comp/evaluateItem'
  13. import { getStudentinfo, addSchoolComment,addCoachComment } from '@/config/api.js'
  14. import school from '../../../store/modules/school'
  15. export default {
  16. components: {
  17. evaluateItem
  18. },
  19. data() {
  20. return {
  21. checked: false,
  22. info: {},
  23. schoolInfo: {},
  24. coachInfo: {},
  25. subject: '',
  26. showSchool: true,
  27. coachType: '', //1.教练 2.模拟教练 3.模拟器老师
  28. }
  29. },
  30. onLoad(options) {
  31. if(options.tit) {
  32. this.tit = options.tit
  33. this.showSchool = false
  34. }
  35. if(options.coachType) this.coachType = options.coachType
  36. this.subject = options.subject
  37. this.getStudentinfoFn()
  38. },
  39. computed: {
  40. btnActive() {
  41. let {schoolInfo, coachInfo} = this
  42. let num1 = schoolInfo.schoolLevel + schoolInfo.qualityLevel + schoolInfo.teachLevel + schoolInfo.serviceLevel
  43. let num2 = coachInfo.qualityLevel + coachInfo.teachLevel + coachInfo.serviceLevel
  44. if(this.subject==2&&num1&&num2) {
  45. return true
  46. }else if(this.subject!=2&&num2){
  47. return true
  48. }else {
  49. return false
  50. }
  51. }
  52. },
  53. methods: {
  54. updatedCoachInfo(val) {
  55. this.coachInfo = val
  56. },
  57. updatedSchoolInfo(val) {
  58. this.schoolInfo = val
  59. },
  60. initFrom() {
  61. this.schoolInfo = {
  62. tit: '您对驾校满意吗?',
  63. school: 1,
  64. "schoolId": 8750,
  65. "schoolName": "",
  66. "stars": 0,
  67. "studentId": '',
  68. "studentIdcard": "",
  69. "studentPhone": "",
  70. "serviceLevel": 0,
  71. "schoolLevel": 0,
  72. "qualityLevel": 0,
  73. "teachLevel": 0,
  74. "subject": 0,
  75. "description": "",
  76. "images": "",
  77. "videoUrl": "",
  78. "anonymity": 2,
  79. "userId": 0,
  80. imgArr: [],
  81. coachType: this.coachType
  82. }
  83. this.coachInfo = {
  84. tit: '您对教练满意吗?',
  85. "schoolId": 8750,
  86. "stars": 0,
  87. "studentId": '',
  88. "studentIdcard": "",
  89. "studentPhone": "",
  90. "schoolInfo": 0,
  91. "schoolLevel": 0,
  92. "qualityLevel": 0,
  93. "serviceLevel": 0,
  94. "teachLevel": 0,
  95. "subject": 0,
  96. "description": "",
  97. "images": "",
  98. "videoUrl": "",
  99. "anonymity": 2,
  100. "userId": 0,
  101. coachName: '',
  102. imgArr: [],
  103. coachType: this.coachType
  104. }
  105. if(this.tit=='模拟器老师') {
  106. this.coachInfo.tit = '您对模拟器老师满意吗?'
  107. }
  108. if(this.tit=='考场模拟老师') {
  109. this.coachInfo.tit = '您对考场模拟老师满意吗?'
  110. }
  111. this.coachInfo.subject = this.schoolInfo.subject = this.subject
  112. this.coachInfo.userId = this.schoolInfo.userId = this.$store.state.user.vuex_loginInfo.userId
  113. this.coachInfo.studentPhone = this.vuex_userInfo.studentPhone
  114. this.coachInfo.schoolId = this.schoolInfo.schoolId = this.info.schoolId
  115. this.coachInfo.schoolName = this.schoolInfo.schoolName = this.info.schoolName
  116. this.coachInfo.coachName = this.info.coachName
  117. this.coachInfo.coachId = this.info.coachId
  118. },
  119. // 获取用户驾校信息
  120. async getStudentinfoFn() {
  121. const {data: res} = await getStudentinfo({id: this.$store.state.user.vuex_loginInfo.userId})
  122. this.info = res
  123. this.initFrom()
  124. },
  125. async submintFn() {
  126. if(this.coachInfo.imgArr.length) {
  127. this.coachInfo.images = this.coachInfo.imgArr.join(',')
  128. }
  129. if(this.schoolInfo.imgArr.length) {
  130. this.schoolInfo.images = this.schoolInfo.imgArr.join(',')
  131. }
  132. let schoolScore = [this.schoolInfo.serviceLevel,this.schoolInfo.schoolLevel,this.schoolInfo.teachLevel,this.schoolInfo.qualityLevel].some(item=>item*1>0)
  133. let coachInfoScore = [this.coachInfo.serviceLevel,this.coachInfo.teachLevel,this.coachInfo.qualityLevel].some(item=>item*1>0)
  134. if(this.subject==2&&!schoolScore) return this.$u.toast('请对驾校评分')
  135. if(!coachInfoScore) return this.$u.toast('请对教练评分')
  136. const res = await addSchoolComment(this.schoolInfo)
  137. const res2 = await addCoachComment(this.coachInfo)
  138. this.initFrom()
  139. this.$u.toast('评价成功')
  140. setTimeout(()=>{
  141. this.$goPage('/pages/mineEntry/myEvaluate/myEvaluate')
  142. },1500)
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. @import '../../../common/css/textareaBg.scss';
  149. .btnBox {
  150. padding-bottom: 76rpx;
  151. }
  152. .btnBg {
  153. margin: 90rpx auto 0 auto;
  154. width: 396rpx;
  155. opacity: 0.5;
  156. &.active {
  157. opacity: 1;
  158. }
  159. }
  160. .textareaBg {
  161. margin-top: 22rpx;
  162. }
  163. .card {
  164. padding: 28rpx;
  165. .top_row {
  166. display: flex;
  167. align-items: center;
  168. padding-bottom: 24rpx;
  169. border-bottom: 2rpx solid #E8E9EC;
  170. justify-content: space-between;
  171. .tit {
  172. font-weight: 600;
  173. color: #333333;
  174. font-size: 32rpx;
  175. }
  176. }
  177. .user_row {
  178. width: 100%;
  179. height: 100rpx;
  180. display: flex;
  181. align-items: center;
  182. .avatar {
  183. width: 60rpx;
  184. height: 60rpx;
  185. border-radius: 50%;
  186. overflow: hidden;
  187. }
  188. .name {
  189. font-size: 28rpx;
  190. font-weight: 500;
  191. padding-left: 26rpx;
  192. }
  193. }
  194. .star_row {
  195. padding: 14rpx 0;
  196. display: flex;
  197. align-items: center;
  198. .lab {
  199. font-size: 28rpx;
  200. font-weight: 500;
  201. padding-right: 32rpx;
  202. }
  203. .star {}
  204. }
  205. }
  206. </style>