studentRanked.vue 18 KB

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