teaMark.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="mark">
  3. <view class="mark-item">
  4. <view class="mark-item-left">
  5. 评分
  6. </view>
  7. <view class="mark-item-right">
  8. <uni-data-select v-model="value" :localdata="range"></uni-data-select>
  9. </view>
  10. </view>
  11. <view class="mark-item">
  12. <view style="width: 100%;" class="">
  13. <view style="margin-bottom: 32rpx;" class="">
  14. 评价
  15. </view>
  16. <view class="tag">
  17. <view @click="tagClick(item)" :class="item.show? 'active':''" v-for="(item,index) in tagList"
  18. :key="index" class="tag-item">
  19. {{item.tab_name}}
  20. </view>
  21. </view>
  22. <view style="width: 100%;margin-top: 32rpx;" class="">
  23. <uni-easyinput :maxlength="100" type="textarea" autoHeight v-model="remark"
  24. placeholder="备注"></uni-easyinput>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="mark-btn">
  29. <view @click="ok" class="mark-left">
  30. 确定
  31. </view>
  32. <view @click="close" class="mark-right">
  33. 关闭
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name: "teaMark",
  41. props: ['id'],
  42. data() {
  43. return {
  44. value: 0,
  45. range: [{
  46. value: 100,
  47. text: "A+",
  48. },
  49. {
  50. value: 95,
  51. text: "A",
  52. },
  53. {
  54. value: 90,
  55. text: "A-",
  56. },
  57. {
  58. value: 85,
  59. text: "B",
  60. },
  61. {
  62. value: 80,
  63. text: "C",
  64. },
  65. ],
  66. tagList: [],
  67. remark: ''
  68. };
  69. },
  70. methods: {
  71. tagClick(item) {
  72. item.show = !item.show
  73. },
  74. getTag() {
  75. this.$api.sendRequest({
  76. url: `/mobile/teacher/tabs?teacher_id=${this.id}`,
  77. success: res => {
  78. res.data.forEach(item => {
  79. item.show = false
  80. })
  81. this.tagList = res.data
  82. },
  83. })
  84. },
  85. ok() {
  86. if (this.value == '') {
  87. uni.showToast({
  88. title: '请选择评分',
  89. 'icon': 'none',
  90. });
  91. return
  92. }
  93. let arr = []
  94. this.tagList.forEach(item => {
  95. if (item.show) {
  96. arr.push(item.tab_id)
  97. }
  98. })
  99. if (arr.length == 0) {
  100. uni.showToast({
  101. title: '请选择评价',
  102. 'icon': 'none',
  103. });
  104. return
  105. }
  106. let obj = {
  107. tab_ids:arr,
  108. remark:this.remark,
  109. score:this.value,
  110. }
  111. this.$emit('okClick',obj)
  112. },
  113. close(){
  114. this.$emit('close')
  115. }
  116. },
  117. mounted() {
  118. this.getTag()
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .mark-btn {
  124. width: 100%;
  125. margin-top: 32rpx;
  126. display: flex;
  127. height: 60rpx;
  128. font-size: 36rpx;
  129. line-height: 56rpx;
  130. .mark-left {
  131. border: 1px solid #05CCA1;
  132. flex: 1;
  133. color: #05CCA1;
  134. text-align: center;
  135. border-radius: 30rpx;
  136. margin-right: 16rpx;
  137. }
  138. .mark-right {
  139. flex: 1;
  140. text-align: center;
  141. border-radius: 30rpx;
  142. border: 1px solid #999;
  143. color: #999;
  144. margin-left: 16rpx;
  145. }
  146. }
  147. .mark {
  148. width: 100%;
  149. box-sizing: border-box;
  150. padding: 0 32rpx 32rpx 32rpx;
  151. }
  152. .mark-item {
  153. padding: 32rpx 0;
  154. border-bottom: 1px solid #f2f2f2;
  155. display: flex;
  156. align-items: center;
  157. }
  158. .mark-item-left {
  159. margin-right: 32rpx;
  160. }
  161. .mark-item-right {
  162. flex: 1;
  163. }
  164. .tag {
  165. display: flex;
  166. flex-wrap: wrap;
  167. .tag-item {
  168. border: 1px solid #999;
  169. color: #999;
  170. border-radius: 5px;
  171. padding: 10rpx 16rpx;
  172. margin-right: 10rpx;
  173. margin-bottom: 16rpx;
  174. }
  175. .active {
  176. background: rgba(5, 204, 161, 0.20);
  177. border: 1px solid #05cca1;
  178. color: #05CCA1;
  179. }
  180. }
  181. </style>