洛阳学员端
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.

228 lines
5.5 KiB

10 months ago
10 months ago
10 months ago
  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. photoPath: this.vuex_userInfo.schoolPhoto,
  82. coachType: 1
  83. }
  84. this.coachInfo = {
  85. tit: '您对教练满意吗?',
  86. "schoolId": 8750,
  87. "stars": 0,
  88. "studentId": '',
  89. "studentIdcard": "",
  90. "studentPhone": "",
  91. "schoolInfo": 0,
  92. "schoolLevel": 0,
  93. "qualityLevel": 0,
  94. "serviceLevel": 0,
  95. "teachLevel": 0,
  96. "subject": 0,
  97. "description": "",
  98. "images": "",
  99. "videoUrl": "",
  100. "anonymity": 2,
  101. "userId": 0,
  102. coachName: '',
  103. imgArr: [],
  104. photoPath: this.vuex_userInfo.coachPhoto,
  105. coachType: 1
  106. }
  107. if(this.tit=='模拟器老师') {
  108. this.coachInfo.tit = '您对模拟器老师满意吗?'
  109. }
  110. if(this.tit=='考场模拟老师') {
  111. this.coachInfo.tit = '您对考场模拟老师满意吗?'
  112. }
  113. this.coachInfo.subject = this.schoolInfo.subject = this.subject
  114. this.coachInfo.userId = this.schoolInfo.userId = this.$store.state.user.vuex_loginInfo.userId
  115. this.coachInfo.studentPhone = this.vuex_userInfo.studentPhone
  116. this.coachInfo.schoolId = this.schoolInfo.schoolId = this.info.schoolId
  117. this.coachInfo.schoolName = this.schoolInfo.schoolName = this.info.schoolName
  118. this.coachInfo.coachName = this.info.coachName
  119. this.coachInfo.coachId = this.info.coachId
  120. },
  121. // 获取用户驾校信息
  122. async getStudentinfoFn() {
  123. const {data: res} = await getStudentinfo({id: this.$store.state.user.vuex_loginInfo.userId})
  124. this.info = res
  125. this.initFrom()
  126. },
  127. async submintFn() {
  128. if(this.coachInfo.imgArr.length) {
  129. this.coachInfo.images = this.coachInfo.imgArr.join(',')
  130. }
  131. if(this.schoolInfo.imgArr.length) {
  132. this.schoolInfo.images = this.schoolInfo.imgArr.join(',')
  133. }
  134. let schoolScore = [this.schoolInfo.serviceLevel,this.schoolInfo.schoolLevel,this.schoolInfo.teachLevel,this.schoolInfo.qualityLevel].some(item=>item*1>0)
  135. let coachInfoScore = [this.coachInfo.serviceLevel,this.coachInfo.teachLevel,this.coachInfo.qualityLevel].some(item=>item*1>0)
  136. if(this.subject==2&&!schoolScore) return this.$u.toast('请对驾校评分')
  137. if(!coachInfoScore) return this.$u.toast('请对教练评分')
  138. const res = await addSchoolComment(this.schoolInfo)
  139. const res2 = await addCoachComment(this.coachInfo)
  140. this.initFrom()
  141. this.$u.toast('评价成功')
  142. setTimeout(()=>{
  143. this.$goPage('/pages/mineEntry/myEvaluate/myEvaluate')
  144. },1500)
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. @import '../../../common/css/textareaBg.scss';
  151. .btnBox {
  152. padding-bottom: 76rpx;
  153. }
  154. .btnBg {
  155. margin: 90rpx auto 0 auto;
  156. width: 396rpx;
  157. opacity: 0.5;
  158. &.active {
  159. opacity: 1;
  160. }
  161. }
  162. .textareaBg {
  163. margin-top: 22rpx;
  164. }
  165. .card {
  166. padding: 28rpx;
  167. .top_row {
  168. display: flex;
  169. align-items: center;
  170. padding-bottom: 24rpx;
  171. border-bottom: 2rpx solid #E8E9EC;
  172. justify-content: space-between;
  173. .tit {
  174. font-weight: 600;
  175. color: #333333;
  176. font-size: 32rpx;
  177. }
  178. }
  179. .user_row {
  180. width: 100%;
  181. height: 100rpx;
  182. display: flex;
  183. align-items: center;
  184. .avatar {
  185. width: 60rpx;
  186. height: 60rpx;
  187. border-radius: 50%;
  188. overflow: hidden;
  189. }
  190. .name {
  191. font-size: 28rpx;
  192. font-weight: 500;
  193. padding-left: 26rpx;
  194. }
  195. }
  196. .star_row {
  197. padding: 14rpx 0;
  198. display: flex;
  199. align-items: center;
  200. .lab {
  201. font-size: 28rpx;
  202. font-weight: 500;
  203. padding-right: 32rpx;
  204. }
  205. .star {}
  206. }
  207. }
  208. </style>