studentRanked.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view class="page">
  3. <view class="txt-white ui-flex-row ui-flex-align-center" style="border-bottom: 4px solid #4472C4;padding-left: 40rpx;height: 54px;position: fixed;top:0;width: 750rpx;z-index: 10;backdrop-filter: blur(4px);"
  4. :style="{'background-color': multiSelect ? '#4472c4' : ''}">
  5. <view class="ui-p ui-flex-row">
  6. <text class="f40">{{chooseClassName}}</text>
  7. <view class="ui-flex-row">
  8. <text class="f40 ui-ml30 ui-mr10">李老师</text>
  9. <!-- <u-icon name="arrow-down-fill" color="#fff"></u-icon> -->
  10. </view>
  11. </view>
  12. <view class="ui-p ui-flex ui-flex-1 ui-flex-align-center" style="justify-content: end;" v-if="multiSelect">
  13. <view class="ui-mr30">
  14. <text class="f32" style="#9ccbff">请点击选则学生批量点评</text>
  15. </view>
  16. <view class="ui-flex" style="width: 250px;">
  17. <el-button @click="setMulti" plain text="取消选择" style="background-color: #0d4980;"
  18. class="ui-mr10">取消选择</el-button>
  19. <el-badge :value="activeList.length">
  20. <el-button type="primary" @click="commentMulti()">
  21. 批量点评
  22. </el-button>
  23. </el-badge>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- <view class="platform" v-if="chooseClassName">
  28. <view class="platform-text txt-white">讲台</view>
  29. <view class="ranked-radio"></view>
  30. </view> -->
  31. <view class="ui-flex-row ui-flex-space-around" style="padding:140rpx 0 200rpx 0;">
  32. <view v-for="(column, index) in list" :key="index" v-if="index%2 == 0" class="ui-flex-row">
  33. <view v-for="index2 in 2" class="ui-flex-column" :class="{
  34. 'ui-mr10' : index2 == 1,
  35. 'ui-ml10' : index2 == 2
  36. }">
  37. <view @click="Comment(stuItem)" v-for="stuItem in list[index2+index-1].nodes" :key="stuItem.id"
  38. class="ui-flex-column ranked-item-tr ui-flex-align-center"
  39. :class="{active : activeList.includes(stuItem.id)}">
  40. <image :src="getLevelIcon(stuItem)" mode="widthFix" style="width: 130rpx;height: 48rpx;"></image>
  41. <image style="width: 100rpx;height: 100rpx;margin-top: -20rpx;" :src="stuItem.student_cartoon_photo" mode=""></image>
  42. <view class="stu-tag text-center ui-flex-row ui-mt10">
  43. <view class="stu-tag-add ui-flex-1">{{stuItem.plus_score_total}}</view>
  44. <view class="stu-tag-sub ui-flex-1">{{stuItem.minus_score_total}}</view>
  45. </view>
  46. <view class="txt-white f28 ui-pt10">
  47. {{stuItem.title}}
  48. </view>
  49. <u-badge absolute style="left: 10px;top: 10px;"
  50. :value="activeList.indexOf(stuItem.id) + 1"></u-badge>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 切换班级 -->
  56. <!-- <u-picker :show="show_classes" @confirm="doChooseClass" :columns="classesList" keyName="class_name"
  57. @cancel="show_classes=false"></u-picker> -->
  58. <!-- <u-grid :border="false" >
  59. <u-grid-item v-for="(item,baseListIndex) in classesList" :key="item.id">
  60. <text class="grid-text">{{item.class_name}}</text>
  61. </u-grid-item>
  62. </u-grid> -->
  63. <!-- 点评 -->
  64. <markScore @change='change' @close='onScoreClose' :stuList='activeList' ref="markScore"></markScore>
  65. <!-- 点评记录 -->
  66. <!-- :stuList="activeList" -->
  67. <markScoreList ref="markScoreList" :chooseClassId="chooseClassId"></markScoreList>
  68. <!-- 随机点名 -->
  69. <randomRollCall ref="randomRollCall" :list="studentList" @comment="randomRollComment"></randomRollCall>
  70. <!-- 计时器 -->
  71. <timerClock ref="timerClock"></timerClock>
  72. <!-- 排行榜 -->
  73. <rankList ref="rankList" :chooseClassId="chooseClassId"></rankList>
  74. <view class="ui-pull-bottom ui-flex-row ui-p"
  75. style="background-color: #0000006b;backdrop-filter: blur(4px);border-top: 1px solid #616161;">
  76. <view class="ui-flex-1 ui-flex-row">
  77. <!-- -->
  78. <el-dropdown trigger="click" @command="doChooseClass">
  79. <view-btn-item title="选择班级" src="../../static/jyicon/shubao.png"></view-btn-item>
  80. <el-dropdown-menu slot="dropdown">
  81. <el-dropdown-item v-for="(item) in classesList" :key="item.id" :command="item">
  82. <text class="ui-mr10">{{item.class_name}}</text>
  83. <text v-if="item.id == chooseClassId" class="el-icon-check"></text>
  84. </el-dropdown-item>
  85. </el-dropdown-menu>
  86. </el-dropdown>
  87. <view-btn-item title="点评记录" src="../../static/jyicon/kedan.png" @click="$refs.markScoreList.open()"></view-btn-item>
  88. <view-btn-item title="座位调整" src="../../static/jyicon/xuewei.png" @click="$pageTo('./studentRankedChange')"></view-btn-item>
  89. <view-btn-item :title="multiSelect ? '取消多选' : '学生多选'" src="../../static/jyicon/gerenzhongxin.png" @click="setMulti"></view-btn-item>
  90. <view-btn-item title="随机点名" src="../../static/jyicon/fangfa.png" @click="$refs.randomRollCall.open()"></view-btn-item>
  91. <view-btn-item title="计时器" src="../../static/jyicon/shalou.png" @click="$refs.timerClock.open()"></view-btn-item>
  92. <view-btn-item title="撤销点评" src="../../static/jyicon/dingyue.png"
  93. :class="[lastTipBatchId ? 'bottom-btn-item' : 'bottom-btn-item-disabled']"
  94. @click="repealScore()"></view-btn-item>
  95. </view>
  96. <view class="ui-flex-row">
  97. <view-btn-item title="排行榜" src="../../static/jyicon/jiangpai.png" @click="$refs.rankList.open()"></view-btn-item>
  98. <!-- <view-btn-item title="切换老师" src="../../static/jyicon/jiangpai.png" @click="debug"></view-btn-item> -->
  99. <view-btn-item title="退出登录" src="../../static/jyicon/xiaoxi.png" @click="loginOut()"></view-btn-item>
  100. </view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import markScore from './components/mark-score.vue'
  106. import markScoreList from './components/mark-score-list.vue'
  107. import randomRollCall from './components/random-roll-call.vue'
  108. import timerClock from './components/timer-clock.vue'
  109. import rankList from './components/rank-list.vue'
  110. import viewBtnItem from './components/view-button-item.vue'
  111. import {
  112. getStuSchoolIdByStuClassId
  113. } from "@/common/api/stu.js"
  114. export default {
  115. components: {
  116. markScore,
  117. markScoreList,
  118. randomRollCall,
  119. timerClock,
  120. rankList,
  121. viewBtnItem,
  122. },
  123. data() {
  124. return {
  125. // show_classes: false,
  126. id: 1,
  127. list: [],
  128. classesList: [],
  129. chooseClassName: '',
  130. chooseClassId: '',
  131. activeList: [],
  132. multiSelect: false,
  133. lastTipBatchId : '' // 最后点评的uuid,用于撤销
  134. }
  135. },
  136. computed : {
  137. studentList(){
  138. let list = [];
  139. this.list.forEach(item => {
  140. item.nodes.forEach(el => {
  141. if (el.id) {
  142. list.push(el)
  143. }
  144. })
  145. })
  146. return list;
  147. }
  148. },
  149. mounted() {
  150. this.id = this.$store.state.teacherInfo.selfclass.id
  151. this.getClassroomList();
  152. },
  153. methods: {
  154. debug(){
  155. console.log(this)
  156. },
  157. getLevelIcon(item){
  158. let val = ~~((item.score_total)/10);
  159. val = (val <= 0 ? 1 : val);
  160. val = (val >= 16 ? 16 : val);
  161. return '../../static/level_icon/'+ val +'.png';
  162. },
  163. // change(e) {
  164. // this.type = e == 0 ? 1 : 2
  165. // this.getTabs()
  166. // },
  167. setMulti() {
  168. this.multiSelect = !this.multiSelect;
  169. this.activeList = [];
  170. },
  171. loginOut() {
  172. uni.setStorageSync("token", '')
  173. uni.navigateTo({
  174. url: "/pages/login/login"
  175. })
  176. },
  177. doChooseClass(val) {
  178. // console.log(val);
  179. uni.setStorage({
  180. key: 'lastClasses',
  181. data: val,
  182. success(e) {
  183. console.log(e)
  184. }
  185. });
  186. this.chooseClassId = val.id
  187. this.chooseClassName = val.class_name
  188. this.getStudent()
  189. // this.show_classes = false
  190. },
  191. // DelectSuccess(index) {
  192. // console.log(index);
  193. // this.getStudent()
  194. // this.getstudentTabLog()
  195. // },
  196. getClassroomList() {
  197. let teacher_id = this.$store.state.teacherInfo.id
  198. this.$api.sendRequest({
  199. url: `/mobile/teacher/teachClasses`,
  200. method: "post",
  201. data: {
  202. teacher_id: teacher_id
  203. },
  204. success: res => {
  205. this.classesList = res.data;
  206. if (res.data.length) {
  207. let value = uni.getStorageSync('lastClasses')
  208. this.$nextTick(() => {
  209. this.doChooseClass(value || res.data[0])
  210. })
  211. }
  212. }
  213. })
  214. },
  215. // 随机点名后批量评价
  216. randomRollComment(checkList){
  217. if(checkList.length){
  218. this.activeList = checkList.map(item => {
  219. return item.id
  220. });
  221. this.commentMulti();
  222. }
  223. },
  224. // 多选学生点评
  225. commentMulti() {
  226. // this.stuName = this.stuNameList.toString()
  227. let title = this.activeList.map(stuId => {
  228. return this.studentList.find(el => {
  229. return el.id == stuId;
  230. }).title;
  231. }).join( );
  232. // this.getTabs()
  233. this.$refs.markScore.open(title);
  234. },
  235. Comment(item) {
  236. if (this.multiSelect) {
  237. let index = this.activeList.indexOf(item.id)
  238. if (index >= 0) {
  239. this.activeList.splice(index, 1);
  240. } else {
  241. this.activeList.push(item.id);
  242. }
  243. return;
  244. }
  245. this.activeList = [item.id];
  246. this.commentMulti();
  247. },
  248. // 获取学生列表
  249. getStudent() {
  250. this.$api.sendRequest({
  251. url: `/mobile/studentTab/seat`,
  252. data: {
  253. class_id: this.chooseClassId
  254. },
  255. success: res => {
  256. this.list = res.data.reverse().map(item => {
  257. item.nodes = item.nodes.reverse().filter(el => {
  258. return !!el.id;
  259. })
  260. return item;
  261. })
  262. }
  263. })
  264. },
  265. // getTabs() {
  266. // this.$api.sendRequest({
  267. // url: `/mobile/studentTab/getStudentTabs`,
  268. // method: "post",
  269. // data: {
  270. // teacher_id: this.$store.state.teacher_id,
  271. // type: this.type
  272. // },
  273. // success: res => {
  274. // this.tabList = res.data
  275. // }
  276. // })
  277. // },
  278. onScoreClose(lastTipBatchId = false) {
  279. if(lastTipBatchId){
  280. this.activeList = []
  281. this.multiSelect = false
  282. this.getStudent();
  283. this.lastTipBatchId = lastTipBatchId;
  284. }
  285. // this.getstudentTabLog()
  286. },
  287. repealScore(){
  288. this.$api.sendRequest({
  289. url: `/mobile/studentTab/multiDelStudentTabLog`,
  290. method: "post",
  291. data: {
  292. batch_id : this.lastTipBatchId
  293. },
  294. success: res => {
  295. this.lastTipBatchId = null;
  296. }
  297. })
  298. }
  299. },
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. .page {
  304. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  305. background-size: 100% 100%;
  306. height: auto;
  307. // width: 750rpx;
  308. }
  309. .platform {
  310. display: flex;
  311. justify-content: center;
  312. align-items: center;
  313. position: relative;
  314. height: 30rpx;
  315. margin-top: 60rpx;
  316. .platform-color {
  317. position: absolute;
  318. left: 0;
  319. top: 0;
  320. height: 60rpx;
  321. background-color: rgba(5, 204, 161, 1);
  322. width: 10rpx;
  323. }
  324. .platform-text {
  325. text-align: center;
  326. width: 60%;
  327. margin-bottom: 40rpx;
  328. }
  329. }
  330. .pop-title {
  331. border-bottom: 1px solid #f2f2f2;
  332. font-size: 36rpx;
  333. padding-bottom: 20rpx;
  334. display: flex;
  335. align-items: center;
  336. }
  337. .popup-content {
  338. border-radius: 10px;
  339. box-sizing: border-box;
  340. padding: 0 32rpx;
  341. }
  342. .btn-roll {
  343. background-color: #fff;
  344. border-radius: 25rpx;
  345. width: 190rpx;
  346. color: #666;
  347. height: 60rpx;
  348. line-height: 60rpx;
  349. text-align: center;
  350. margin-left: 32rpx;
  351. }
  352. .ranked {
  353. width: 100%;
  354. text-align: center;
  355. font-size: 10px;
  356. box-sizing: border-box;
  357. display: flex;
  358. padding-top: 80rpx;
  359. }
  360. .ranked-item-tr {
  361. position: relative;
  362. margin-bottom: 26rpx;
  363. padding-top: 16rpx;
  364. padding-bottom: 16rpx;
  365. border-radius: 5px;
  366. box-sizing: border-box;
  367. width: 100%;
  368. cursor: pointer;
  369. transition: 100ms;
  370. display: flex;
  371. justify-content: center;
  372. }
  373. .active {
  374. background: #ffffff85;
  375. }
  376. .ranked-radio {
  377. width: 100px;
  378. position: absolute;
  379. left: 50%;
  380. transform: translate(-50%);
  381. bottom: 0rpx;
  382. border-bottom: 3px solid rgba(5, 204, 161, 1);
  383. border-radius: 50% 50% 0 0;
  384. }
  385. .visit-item {
  386. display: flex;
  387. align-items: center;
  388. .visit-item-left {
  389. width: 120rpx;
  390. color: #666;
  391. }
  392. }
  393. .stu-tag {
  394. width: 160rpx;
  395. margin-left: 10rpx;
  396. margin-right: 10rpx;
  397. border-radius: 15px;
  398. overflow: hidden;
  399. }
  400. .stu-tag-add {
  401. background-color: #ecf5ff;
  402. color: #3c9cff;
  403. border: 1px solid #fff;
  404. }
  405. .stu-tag-sub {
  406. background-color: #fef0f0;
  407. color: #f56c6c;
  408. border: 1px solid #fff;
  409. border-left: 0;
  410. }
  411. </style>