mark-score.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. <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 : 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">
  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. import {
  70. getStudentTabs
  71. } from "@/common/api/studentTab.js"
  72. export default {
  73. props: {
  74. stuList: {
  75. type: Array,
  76. default: () => []
  77. },
  78. },
  79. components : {
  80. markScoreList
  81. },
  82. data() {
  83. return {
  84. title : '',
  85. show: false,
  86. list : [],
  87. curIndex: 0,
  88. type: 0,
  89. score: 0, //加扣分分数
  90. activeId: -1, //选中项
  91. course_id : 0,
  92. itemTab: '',
  93. courseList: [],
  94. }
  95. },
  96. watch: {
  97. show() {
  98. if (!this.show) {
  99. this.activeId = -1;
  100. this.score = 0;
  101. this.$emit('close')
  102. }
  103. }
  104. },
  105. methods: {
  106. change(e){
  107. this.curIndex = e
  108. this.getTipList();
  109. },
  110. changeCourse(item){
  111. this.course_id = item.id;
  112. // this.getTipList();
  113. },
  114. getTipList() {
  115. if(tabList[this.curIndex]){
  116. this.list = tabList[this.curIndex];
  117. return;
  118. }
  119. this.$api.sendRequest({
  120. url: `/mobile/studentTab/getStudentTabs`,
  121. method: "post",
  122. data: {
  123. teacher_id: this.$store.state.teacher_id,
  124. type: this.curIndex
  125. },
  126. success: res => {
  127. tabList[this.curIndex] = res.data;
  128. this.list = res.data
  129. }
  130. })
  131. },
  132. getStudentTabs() {
  133. this.$api.sendRequest({
  134. url: getStudentTabs,
  135. method: "post",
  136. data: {
  137. type: this.type
  138. },
  139. success: res => {
  140. console.log(res, "res");
  141. }
  142. })
  143. },
  144. // 外部访问使用
  145. open(title) {
  146. this.title = title;
  147. this.show = true;
  148. this.getTipList();
  149. if(this.courseList.length == 0){
  150. this.$api.sendRequest({
  151. url: '/mobile/systemBaseData/getAllCourse',
  152. method: "post",
  153. success: res => {
  154. console.log(res);
  155. this.courseList = [
  156. {
  157. id : 0,
  158. name : '全部'
  159. },
  160. ...res.data.map(item => {
  161. return {
  162. name : item.course_name,
  163. id : item.id
  164. }
  165. })
  166. ]
  167. }
  168. })
  169. }
  170. },
  171. toActive(index, item) {
  172. // 是否旧的选中项
  173. let always = this.activeId >= 0 && this.activeId == index;
  174. this.activeId = index;
  175. if (always) {
  176. this.score++;
  177. } else {
  178. this.score = 1;
  179. }
  180. this.itemTab = item
  181. },
  182. cancelAct() {
  183. if (this.score) {
  184. this.activeId = -1;
  185. this.score = 0;
  186. } else {
  187. this.show = false;
  188. this.$emit('close', false)
  189. }
  190. },
  191. submit(scoreValue) { //修改成固定给分值
  192. this.score = scoreValue;
  193. let obj = {
  194. teacher_id: this.$store.state.teacher_id,
  195. stu_school_ids: this.stuList,
  196. tab_id: this.itemTab.tab_id,
  197. score: this.score
  198. }
  199. this.$api.sendRequest({
  200. url: '/mobile/studentTab/geiXueshengTianjiaBiaoqian',
  201. method: "post",
  202. data: obj,
  203. success: res => {
  204. if (res.code == 200) {
  205. uni.showToast({
  206. title: res.msg,
  207. 'icon': 'none',
  208. });
  209. this.show = false;
  210. this.activeId = -1;
  211. this.score = 0;
  212. this.$emit('close', res.data.batch_id)
  213. }
  214. }
  215. })
  216. },
  217. }
  218. }
  219. </script>
  220. <style>
  221. /deep/ .content {
  222. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  223. background-size: auto;
  224. border: 1px solid #0d5396;
  225. }
  226. /deep/ .el-dialog__header {
  227. background: #022c5a80;
  228. border-bottom: 2px solid #051d37;
  229. }
  230. /deep/ .el-dialog__title {
  231. color: #fff;
  232. }
  233. /deep/ .el-dialog__body {
  234. padding: 0;
  235. }
  236. .item-active{
  237. background-color: #ffffff42;
  238. border-radius: 10px;
  239. }
  240. .no-select {
  241. opacity: .5;
  242. }
  243. </style>