mark-score.vue 9.4 KB

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