mark-score.vue 8.5 KB

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