mark-score.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <el-dialog :visible.sync="show" :title="`标记点评给 ${title}`" custom-class="content"
  3. style="background-color: #00142f63;backdrop-filter: blur(4px);" width="600px">
  4. <view class="ui-flex-column">
  5. <!-- <view class="ui-p" style="background: #022c5a80;border-bottom: 2px solid #051d37;">
  6. <text class="txt-white"> </text>
  7. </view> -->
  8. <view class="ui-flex-row">
  9. <view class="ui-flex-1 ui-flex-align-center ui-flex-row">
  10. <view class="ui-pl20">
  11. <view class="ui-flex-row ui-border-radius-20" @click="$refs.markScoreList.open()"
  12. style="background-color: #1C63A8;padding: 4px 8px;">
  13. <text class="txt-white f26 ui-mr10">点评记录</text>
  14. <u-icon color="#fff" name="list-dot"></u-icon>
  15. </view>
  16. </view>
  17. </view>
  18. <view style="width: 220px;" class="ui-p">
  19. <u-subsection :list="['表扬', '需改进']" mode="button" bgColor="#1b63a8" inactiveColor="#aec3ee"
  20. :current="curIndex" @change="change"></u-subsection>
  21. </view>
  22. <view class="ui-flex-1"></view>
  23. </view>
  24. <view style="background: #0000003b;">
  25. <u-tabs :list="courseList" :activeStyle="{
  26. color: '#fff',
  27. fontWeight: 'bold',
  28. transform: 'scale(1.2)'
  29. }" :inactiveStyle="{
  30. color: '#959595',
  31. transform: 'scale(1)'
  32. }" @change="changeCourse"></u-tabs>
  33. </view>
  34. <scroll-view scroll-y style="height: 400px;" show-scrollbar>
  35. <u-grid :col="6" :border="false">
  36. <u-grid-item @click="toActive(index,item)" v-for="(item, index) in list" :key="index" class="ui-p"
  37. v-if="course_id ? item.course_id == course_id : true"
  38. :class="{'no-select' : activeId >= 0 && activeId != index}">
  39. <u--image :src="item.img" width="46px" height="46px"></u--image>
  40. <view class="ui-pt10">
  41. <text class="grid-text txt-white f28">{{item.tab_name}}</text>
  42. </view>
  43. <u-badge v-if="activeId == index" absolute :offset="[0,10]" :value="score"></u-badge>
  44. </u-grid-item>
  45. </u-grid>
  46. </scroll-view>
  47. <view class="ui-p ui-flex" style="background-color: #1b63a870;justify-content: end;">
  48. <view class="ui-flex" style="width: 250px;">
  49. <u-button size="small" plain :text="score ? '取消选择' : '关闭点评'" @click="cancelAct"
  50. style="background-color: #0d4980;" class="ui-mr10"></u-button>
  51. <u-button size="small" :disabled="!score" type="primary" @click="submit" text="提交点评"></u-button>
  52. </view>
  53. </view>
  54. </view>
  55. <markScoreList ref="markScoreList" :stuList="stuList"></markScoreList>
  56. </el-dialog>
  57. </template>
  58. <script>
  59. import markScoreList from './mark-score-list.vue'
  60. // 标签缓存
  61. let tabList = {};
  62. import {
  63. getStudentTabs
  64. } from "@/common/api/studentTab.js"
  65. export default {
  66. props: {
  67. stuList: {
  68. type: Array,
  69. default: () => []
  70. },
  71. },
  72. components : {
  73. markScoreList
  74. },
  75. data() {
  76. return {
  77. title : '',
  78. show: false,
  79. list : [],
  80. curIndex: 0,
  81. type: 0,
  82. score: 0, //加扣分分数
  83. activeId: -1, //选中项
  84. course_id : 0,
  85. itemTab: '',
  86. courseList: [],
  87. }
  88. },
  89. watch: {
  90. show() {
  91. if (!this.show) {
  92. this.activeId = -1;
  93. this.score = 0;
  94. this.$emit('close')
  95. }
  96. }
  97. },
  98. methods: {
  99. change(e){
  100. this.curIndex = e
  101. this.getTipList();
  102. },
  103. changeCourse(item){
  104. this.course_id = item.id;
  105. // this.getTipList();
  106. },
  107. getTipList() {
  108. if(tabList[this.curIndex]){
  109. this.list = tabList[this.curIndex];
  110. return;
  111. }
  112. this.$api.sendRequest({
  113. url: `/mobile/studentTab/getStudentTabs`,
  114. method: "post",
  115. data: {
  116. teacher_id: this.$store.state.teacher_id,
  117. type: this.curIndex
  118. },
  119. success: res => {
  120. tabList[this.curIndex] = res.data;
  121. this.list = res.data
  122. }
  123. })
  124. },
  125. getStudentTabs() {
  126. this.$api.sendRequest({
  127. url: getStudentTabs,
  128. method: "post",
  129. data: {
  130. type: this.type
  131. },
  132. success: res => {
  133. console.log(res, "res");
  134. }
  135. })
  136. },
  137. // 外部访问使用
  138. open(title) {
  139. this.title = title;
  140. this.show = true;
  141. this.getTipList();
  142. if(this.courseList.length == 0){
  143. this.$api.sendRequest({
  144. url: '/mobile/systemBaseData/getAllCourse',
  145. method: "post",
  146. success: res => {
  147. console.log(res);
  148. this.courseList = [
  149. {
  150. id : 0,
  151. name : '全部'
  152. },
  153. ...res.data.map(item => {
  154. return {
  155. name : item.course_name,
  156. id : item.id
  157. }
  158. })
  159. ]
  160. }
  161. })
  162. }
  163. },
  164. toActive(index, item) {
  165. // 是否旧的选中项
  166. let always = this.activeId >= 0 && this.activeId == index;
  167. this.activeId = index;
  168. if (always) {
  169. this.score++;
  170. } else {
  171. this.score = 1;
  172. }
  173. this.itemTab = item
  174. },
  175. cancelAct() {
  176. if (this.score) {
  177. this.activeId = -1;
  178. this.score = 0;
  179. } else {
  180. this.show = false;
  181. this.$emit('close', false)
  182. }
  183. },
  184. submit() {
  185. let obj = {
  186. teacher_id: this.$store.state.teacher_id,
  187. stu_school_ids: this.stuList,
  188. tab_id: this.itemTab.tab_id,
  189. score: this.score
  190. }
  191. this.$api.sendRequest({
  192. url: '/mobile/studentTab/geiXueshengTianjiaBiaoqian',
  193. method: "post",
  194. data: obj,
  195. success: res => {
  196. if (res.code == 200) {
  197. uni.showToast({
  198. title: res.msg,
  199. 'icon': 'none',
  200. });
  201. this.show = false;
  202. this.activeId = -1;
  203. this.score = 0;
  204. this.$emit('close', res.data.batch_id)
  205. }
  206. }
  207. })
  208. },
  209. }
  210. }
  211. </script>
  212. <style>
  213. /deep/ .content {
  214. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  215. background-size: auto;
  216. border: 1px solid #0d5396;
  217. }
  218. /deep/ .el-dialog__header {
  219. background: #022c5a80;
  220. border-bottom: 2px solid #051d37;
  221. }
  222. /deep/ .el-dialog__title {
  223. color: #fff;
  224. }
  225. /deep/ .el-dialog__body {
  226. padding: 0;
  227. }
  228. .no-select {
  229. opacity: .5;
  230. }
  231. </style>