studentRanked.vue 16 KB

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