mark-score.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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="viewCourseList" :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. <view class="ui-p">
  36. <u-grid :col="6" :border="false" style="align-items: baseline;">
  37. <u-grid-item @click="toActive(index,item)" v-for="(item, index) in list" :key="index" class="ui-p"
  38. v-if="course_id ? item.course_id == course_id : (course_name ? item.course_name == course_name : true)"
  39. :bgColor="activeId == index ? '#ffffff42' : '#0000'"
  40. :class="{
  41. 'no-select' : activeId >= 0 && activeId != index,
  42. 'item-active' : activeId == index
  43. }">
  44. <u--image :src="item.img" width="46px" height="46px"></u--image>
  45. <view class="ui-pt10 text-center">
  46. <text class="grid-text txt-white f28">{{item.tab_name}}</text>
  47. </view>
  48. <!-- <u-badge v-if="activeId == index" absolute :offset="[0,10]" :value="score"></u-badge> -->
  49. </u-grid-item>
  50. </u-grid>
  51. </view>
  52. </scroll-view>
  53. <view class="ui-p ui-flex ui-flex-center" style="background-color: #1b63a870;">
  54. <view class="ui-flex" style="width: 250px;">
  55. <!-- <u-button size="small" plain :text="score ? '取消选择' : '关闭点评'" @click="cancelAct"
  56. style="background-color: #0d4980;" class="ui-mr10"></u-button> -->
  57. <u-button size="small" :disabled="!score" type="primary" @click="submit(1)" text="提交点评 +1"></u-button>
  58. <u-button class="ui-ml10" size="small" :disabled="!score" type="primary" @click="submit(3)" text="提交点评 +3"></u-button>
  59. </view>
  60. </view>
  61. </view>
  62. <markScoreList ref="markScoreList" :stuList="stuList"></markScoreList>
  63. </el-dialog>
  64. </template>
  65. <script>
  66. import markScoreList from './mark-score-list.vue'
  67. // 标签缓存
  68. let tabList = {};
  69. export default {
  70. props: {
  71. stuList: {
  72. type: Array,
  73. default: () => []
  74. },
  75. },
  76. components : {
  77. markScoreList
  78. },
  79. data() {
  80. return {
  81. title : '',
  82. show: false,
  83. list : [],
  84. curIndex: 0,
  85. type: 0,
  86. score: 0, //加扣分分数
  87. activeId: -1, //选中项
  88. course_id : 0,
  89. course_name : '',
  90. itemTab: '',
  91. courseList: [],
  92. }
  93. },
  94. watch: {
  95. show() {
  96. if (!this.show) {
  97. this.activeId = -1;
  98. this.score = 0;
  99. this.$emit('close')
  100. }
  101. }
  102. },
  103. computed : {
  104. viewCourseList(){
  105. let custom = [];
  106. this.list.forEach(item => {
  107. if(item.course_id == 0 && item.course_name){
  108. if(!custom.includes(item.course_name)){
  109. custom.push(item.course_name)
  110. }
  111. }
  112. });
  113. console.log(custom)
  114. return [
  115. {
  116. id : 0,
  117. name : '全部'
  118. },
  119. ...this.courseList,
  120. ...custom.map(item => {
  121. return {
  122. id : 0,
  123. name : item
  124. }
  125. })
  126. ]
  127. }
  128. },
  129. methods: {
  130. change(e){
  131. this.curIndex = e
  132. this.getTipList();
  133. },
  134. changeCourse(item){
  135. this.course_id = item.id;
  136. this.course_name = item.name == '全部' ? '' : item.name;
  137. },
  138. getTipList() {
  139. if(tabList[this.curIndex]){
  140. this.list = tabList[this.curIndex];
  141. return;
  142. }
  143. this.$api.sendRequest({
  144. url: `/mobile/studentTab/getStudentTabs`,
  145. method: "post",
  146. data: {
  147. teacher_id: this.$store.state.teacher_id,
  148. type: this.curIndex
  149. },
  150. success: res => {
  151. tabList[this.curIndex] = res.data;
  152. this.list = res.data
  153. }
  154. })
  155. },
  156. getAllCourse(){
  157. if(this.courseList.length){
  158. return;
  159. }
  160. this.$api.sendRequest({
  161. url: '/mobile/systemBaseData/getAllCourse',
  162. method: "post",
  163. success: res => {
  164. // console.log(res);
  165. this.courseList = res.data.map(item => {
  166. return {
  167. name : item.course_name,
  168. id : item.id
  169. }
  170. })
  171. }
  172. })
  173. },
  174. // 外部访问使用
  175. open(title) {
  176. this.title = title;
  177. this.show = true;
  178. this.getTipList();
  179. this.getAllCourse();
  180. },
  181. toActive(index, item) {
  182. // 是否旧的选中项
  183. let always = this.activeId >= 0 && this.activeId == index;
  184. this.activeId = index;
  185. if (always) {
  186. this.score++;
  187. } else {
  188. this.score = 1;
  189. }
  190. this.itemTab = item
  191. },
  192. cancelAct() {
  193. if (this.score) {
  194. this.activeId = -1;
  195. this.score = 0;
  196. } else {
  197. this.show = false;
  198. this.$emit('close', false)
  199. }
  200. },
  201. submit(scoreValue) { //修改成固定给分值
  202. this.score = scoreValue;
  203. let obj = {
  204. teacher_id: this.$store.state.teacher_id,
  205. stu_school_ids: this.stuList,
  206. tab_id: this.itemTab.tab_id,
  207. score: this.score
  208. }
  209. this.$api.sendRequest({
  210. url: '/mobile/studentTab/geiXueshengTianjiaBiaoqian',
  211. method: "post",
  212. data: obj,
  213. success: res => {
  214. if (res.code == 200) {
  215. uni.showToast({
  216. title: res.msg,
  217. 'icon': 'none',
  218. });
  219. this.show = false;
  220. this.activeId = -1;
  221. this.score = 0;
  222. this.$emit('close', res.data.batch_id)
  223. }
  224. }
  225. })
  226. },
  227. }
  228. }
  229. </script>
  230. <style>
  231. /deep/ .content {
  232. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  233. background-size: auto;
  234. border: 1px solid #0d5396;
  235. }
  236. /deep/ .el-dialog__header {
  237. background: #022c5a80;
  238. border-bottom: 2px solid #051d37;
  239. }
  240. /deep/ .el-dialog__title {
  241. color: #fff;
  242. }
  243. /deep/ .el-dialog__body {
  244. padding: 0;
  245. }
  246. .item-active{
  247. background-color: #ffffff42;
  248. border-radius: 10px;
  249. }
  250. .no-select {
  251. opacity: .5;
  252. }
  253. </style>