studentRanked.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <view class="page">
  3. <!-- <u-popup :show="multiSelect" bgColor="#6e8fafde" mode="top" @close="multiSelect=false" :overlay="false">
  4. <view class="ui-p ui-flex ui-flex-align-center" style="justify-content: end;">
  5. <view class="ui-mr30">
  6. <text class="f32" style="#9ccbff">请点击选则学生批量点评</text>
  7. </view>
  8. <view class="ui-flex" style="width: 250px;">
  9. <u-button size="small" @click="setMulti" plain text="取消选择" style="background-color: #0d4980;"
  10. class="ui-mr10"></u-button>
  11. <u-button size="small" type="primary" @click="commentMulti()">
  12. <text class="ui-mr10">批量点评</text>
  13. <u-badge :value="activeList.length"></u-badge>
  14. </u-button>
  15. </view>
  16. </view>
  17. </u-popup> -->
  18. <view class="txt-white ui-flex-row ui-flex-align-center"
  19. style="border-bottom: 4px solid #4472C4;padding-left: 40rpx;height: 54px;"
  20. :style="{'background-color': multiSelect ? '#4472c4' : ''}">
  21. <view class="ui-p ui-flex-row">
  22. <text class="f40">{{chooseClassName}}</text>
  23. <!-- <view class="ui-flex-row">
  24. <text class="f40 ui-ml30 ui-mr10">李老师</text>
  25. <u-icon name="arrow-down-fill" color="#fff"></u-icon>
  26. </view> -->
  27. <el-dropdown trigger="click">
  28. <span class="f40 txt-white ui-ml30" style="cursor:pointer;">
  29. 李老师<i class="el-icon-arrow-down el-icon--right"></i>
  30. </span>
  31. <el-dropdown-menu slot="dropdown">
  32. <el-dropdown-item>周老师</el-dropdown-item>
  33. <el-dropdown-item>陈老师</el-dropdown-item>
  34. <el-dropdown-item>方老师</el-dropdown-item>
  35. <el-dropdown-item disabled>金老师</el-dropdown-item>
  36. <el-dropdown-item divided>退出登录</el-dropdown-item>
  37. </el-dropdown-menu>
  38. </el-dropdown>
  39. </view>
  40. <view class="ui-p ui-flex ui-flex-1 ui-flex-align-center" style="justify-content: end;" v-if="multiSelect">
  41. <view class="ui-mr30">
  42. <text class="f32" style="#9ccbff">请点击选则学生批量点评</text>
  43. </view>
  44. <view class="ui-flex" style="width: 250px;">
  45. <el-button @click="setMulti" plain text="取消选择" style="background-color: #0d4980;"
  46. class="ui-mr10">取消选择</el-button>
  47. <el-badge :value="activeList.length">
  48. <el-button type="primary" @click="commentMulti()">
  49. 批量点评
  50. </el-button>
  51. </el-badge>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="ui-flex-row ui-mt20 ui-flex-space-around">
  56. <view v-for="(column, index) in list" :key="index" v-if="index%2 == 0" class="ui-flex-row">
  57. <view v-for="index2 in 2" class="ui-flex-column" :class="{
  58. 'ui-mr10' : index2 == 1,
  59. 'ui-ml10' : index2 == 2
  60. }">
  61. <view @click="Comment(item1)" v-for="(item1,index1) in list[index2+index-1].nodes" :key="item1.id"
  62. class="ui-flex-column ranked-item-tr ui-flex-align-center"
  63. :class="{active : activeList.includes(item1.id)}">
  64. <image style="width: 100rpx;height: 100rpx;" :src="item1.student_cartoon_photo" mode=""></image>
  65. <view class="stu-tag text-center ui-flex-row ui-mt10">
  66. <view class="stu-tag-add ui-flex-1">{{item1.plus_score_total}}</view>
  67. <view class="stu-tag-sub ui-flex-1">{{item1.minus_score_total}}</view>
  68. </view>
  69. <view class="txt-white f28 ui-pt10">
  70. {{item1.title}}
  71. </view>
  72. <u-badge absolute style="left: 10px;top: 10px;"
  73. :value="activeList.indexOf(item1.id) + 1"></u-badge>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="platform" v-if="chooseClassName">
  79. <view class="ranked-radio"></view>
  80. <view class="platform-text txt-white">讲台</view>
  81. </view>
  82. <!-- 切换班级 -->
  83. <u-picker :show="show_classes" @confirm="doChooseClass" :columns="teachList" keyName="class_name"
  84. @cancel="show_classes=false"></u-picker>
  85. <!-- 点评 -->
  86. <markScore :title='stuName' @change='change' @close='close' :stuList='activeList' :list='tabList'
  87. ref="markScore"></markScore>
  88. <!-- 点评记录 -->
  89. <markScoreList @add='addTab' :list='studentTab.data' ref="markScoreList"></markScoreList>
  90. <el-drawer title="排行榜" :visible.sync="showRankList" direction="rtl">
  91. <view style="text-align: center;" class="">
  92. 开发中....!
  93. </view>
  94. </el-drawer>
  95. <view class="ui-pull-bottom ui-flex-row ui-p"
  96. style="background-color: #0000006b;border-top: 1px solid #616161;">
  97. <view class="ui-flex-1 ui-flex-row">
  98. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="show_classes=true">
  99. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  100. <view style="line-height: 1;">
  101. <text class="txt-white f24">评分记录</text>
  102. </view>
  103. </view>
  104. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="$refs.markScoreList.open()">
  105. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  106. <view style="line-height: 1;">
  107. <text class="txt-white f24">点评记录</text>
  108. </view>
  109. </view>
  110. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="$pageTo('./studentRankedChange')">
  111. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  112. <view style="line-height: 1;">
  113. <text class="txt-white f24">座位调整</text>
  114. </view>
  115. </view>
  116. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="setMulti">
  117. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  118. <view style="line-height: 1;">
  119. <text class="txt-white f24" v-if="multiSelect">取消多选</text>
  120. <text class="txt-white f24" v-else>学生多选</text>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="ui-flex-row">
  125. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="showRankList = true">
  126. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  127. <view style="line-height: 1;">
  128. <text class="txt-white f24">排行榜</text>
  129. </view>
  130. </view>
  131. <view class="ui-flex-column text-center ui-p bottom-btn-item">
  132. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  133. <view style="line-height: 1;">
  134. <text class="txt-white f24">切换老师</text>
  135. </view>
  136. </view>
  137. <view class="ui-flex-column text-center ui-p bottom-btn-item">
  138. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  139. <view style="line-height: 1;">
  140. <text class="txt-white f24">退出登录</text>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </template>
  147. <script>
  148. import markScore from './components/mark-score.vue'
  149. import markScoreList from './components/mark-score-list.vue'
  150. import {
  151. getStuSchoolIdByStuClassId
  152. } from "@/common/api/stu.js"
  153. export default {
  154. components: {
  155. markScore,
  156. markScoreList
  157. },
  158. data() {
  159. return {
  160. show_classes: false,
  161. id: 1,
  162. info: {},
  163. list: [],
  164. teachList: [],
  165. chooseClassName: '',
  166. chooseClassId: '',
  167. activeList: [],
  168. multiSelect: false,
  169. // 排行榜
  170. showRankList: false,
  171. tabList: [],
  172. studentTab: [],
  173. type: 1,
  174. stuNameList: [],
  175. stuName: ''
  176. }
  177. },
  178. mounted() {
  179. // this.id = this.$route.query.id
  180. this.id = this.$store.state.teacherInfo.selfclass.id
  181. this.getstudentTabLog()
  182. // this.getStudent()
  183. this.getClassroomList();
  184. setTimeout(() => {
  185. this.doChooseClass({
  186. value: [{
  187. class_name: "二年级2班",
  188. id: 2
  189. }]
  190. })
  191. }, 400)
  192. },
  193. methods: {
  194. change(e) {
  195. this.type = e == 0 ? 1 : 2
  196. this.getTabs()
  197. },
  198. setMulti() {
  199. this.multiSelect = !this.multiSelect;
  200. this.activeList = [];
  201. },
  202. loginOut() {
  203. uni.setStorageSync("token", '')
  204. uni.navigateTo({
  205. url: "/pages/login/login"
  206. })
  207. },
  208. doChooseClass(val) {
  209. this.chooseClassId = val.value[0].id
  210. this.chooseClassName = val.value[0].class_name
  211. this.getStudent()
  212. this.show_classes = false
  213. },
  214. getClassroomList() {
  215. let teacher_id = this.$store.state.teacherInfo.id
  216. this.$api.sendRequest({
  217. url: `/mobile/teacher/teachClasses`,
  218. method: "post",
  219. data: {
  220. teacher_id: teacher_id
  221. },
  222. success: res => {
  223. this.teachList.push(res.data)
  224. }
  225. })
  226. },
  227. // 多选学生点评
  228. commentMulti() {
  229. this.stuName = this.stuNameList.toString()
  230. this.getTabs()
  231. this.$refs.markScore.open(1);
  232. },
  233. Comment(item) {
  234. if (this.multiSelect) {
  235. let index = this.activeList.indexOf(item.id)
  236. if (index >= 0) {
  237. this.activeList.splice(index, 1);
  238. this.stuNameList.splice(index, 1);
  239. } else {
  240. this.activeList.push(item.id);
  241. this.stuNameList.push(item.title);
  242. }
  243. return;
  244. } else {
  245. this.activeList = [item.id]
  246. }
  247. this.stuName = item.title
  248. this.getTabs()
  249. this.$refs.markScore.open(1);
  250. return;
  251. //item的id是studentClass的id,需要转换成stu_school_id传到
  252. this.$api.sendRequest({
  253. url: getStuSchoolIdByStuClassId,
  254. data: {
  255. stu_class_id: item.id
  256. },
  257. success: res => {
  258. let stu_school_id = res.data.stu_school_id
  259. uni.navigateTo({
  260. url: "/pages/studentTab/studentTab?stu_school_id=" + stu_school_id
  261. })
  262. }
  263. })
  264. },
  265. getStudent() {
  266. this.$api.sendRequest({
  267. url: `/mobile/studentTab/seat`,
  268. data: {
  269. class_id: this.chooseClassId
  270. },
  271. success: res => {
  272. this.list = res.data
  273. }
  274. })
  275. },
  276. getTabs() {
  277. this.$api.sendRequest({
  278. url: `/mobile/studentTab/getStudentTabs`,
  279. method: "post",
  280. data: {
  281. teacher_id: this.$store.state.teacher_id,
  282. type: this.type
  283. },
  284. success: res => {
  285. this.tabList = res.data
  286. }
  287. })
  288. },
  289. CommentOn(item, score) {
  290. let info = {
  291. id: this.info.id,
  292. tab_id: item.tab_id,
  293. score: score
  294. }
  295. this.$api.sendRequest({
  296. url: `/mobile/student/eval`,
  297. data: info,
  298. success: res => {
  299. uni.showToast({
  300. title: `${this.info.title} ${item.tab_name} ${item.type == 1 ? '+':'-'} ${score}分`,
  301. icon: 'none'
  302. })
  303. this.$refs.CommentPopup.close()
  304. }
  305. })
  306. },
  307. close() {
  308. this.activeList = []
  309. this.multiSelect = false
  310. this.getStudent()
  311. this.getstudentTabLog()
  312. },
  313. getstudentTabLog() {
  314. this.$api.sendRequest({
  315. url: `/mobile/studentTab/getstudentTabLog`,
  316. data: {
  317. class_id: 2
  318. },
  319. method: "post",
  320. success: res => {
  321. this.studentTab = res.data
  322. }
  323. })
  324. },
  325. addTab() {
  326. if (this.studentTab.current_page == this.studentTab.last_page) {
  327. uni.showToast({
  328. title: '没有更多数据',
  329. 'icon': 'none',
  330. });
  331. return
  332. }
  333. this.$api.sendRequest({
  334. url: `/mobile/studentTab/getstudentTabLog`,
  335. method: "post",
  336. data: {
  337. page: this.studentTab.current_page + 1,
  338. class_id: 2
  339. },
  340. success: res => {
  341. let arr = [...this.studentTab.data, ...res.data.data]
  342. this.studentTab = res.data
  343. this.studentTab.data = arr
  344. }
  345. })
  346. }
  347. },
  348. }
  349. </script>
  350. <style lang="scss" scoped>
  351. .page {
  352. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  353. background-size: 100% 100%;
  354. height: 100vh;
  355. // width: 750rpx;
  356. }
  357. .platform {
  358. display: flex;
  359. justify-content: center;
  360. align-items: center;
  361. position: relative;
  362. height: 30rpx;
  363. margin-top: 60rpx;
  364. .platform-color {
  365. position: absolute;
  366. left: 0;
  367. top: 0;
  368. height: 60rpx;
  369. background-color: rgba(5, 204, 161, 1);
  370. width: 10rpx;
  371. }
  372. .platform-text {
  373. text-align: center;
  374. width: 60%;
  375. margin-top: 40rpx;
  376. }
  377. }
  378. .pop-title {
  379. border-bottom: 1px solid #f2f2f2;
  380. font-size: 36rpx;
  381. padding-bottom: 20rpx;
  382. display: flex;
  383. align-items: center;
  384. }
  385. .popup-content {
  386. border-radius: 10px;
  387. box-sizing: border-box;
  388. padding: 0 32rpx;
  389. }
  390. .btn-roll {
  391. background-color: #fff;
  392. border-radius: 25rpx;
  393. width: 190rpx;
  394. color: #666;
  395. height: 60rpx;
  396. line-height: 60rpx;
  397. text-align: center;
  398. margin-left: 32rpx;
  399. }
  400. .ranked {
  401. width: 100%;
  402. text-align: center;
  403. font-size: 10px;
  404. box-sizing: border-box;
  405. display: flex;
  406. padding-top: 80rpx;
  407. }
  408. .ranked-item-tr {
  409. position: relative;
  410. margin-bottom: 26rpx;
  411. padding-top: 16rpx;
  412. padding-bottom: 16rpx;
  413. border-radius: 5px;
  414. box-sizing: border-box;
  415. width: 100%;
  416. cursor: pointer;
  417. transition: 100ms;
  418. display: flex;
  419. justify-content: center;
  420. }
  421. .active {
  422. background: #ffffff85;
  423. }
  424. .ranked-radio {
  425. width: 100px;
  426. position: absolute;
  427. left: 50%;
  428. transform: translate(-50%);
  429. top: 0rpx;
  430. border-bottom: 3px solid rgba(5, 204, 161, 1);
  431. border-radius: 50% 50% 0 0;
  432. }
  433. .visit-item {
  434. display: flex;
  435. align-items: center;
  436. .visit-item-left {
  437. width: 120rpx;
  438. color: #666;
  439. }
  440. }
  441. .stu-tag {
  442. width: 90px;
  443. border-radius: 15px;
  444. overflow: hidden;
  445. }
  446. .stu-tag-add {
  447. background-color: #ecf5ff;
  448. color: #3c9cff;
  449. border: 1px solid #fff;
  450. }
  451. .stu-tag-sub {
  452. background-color: #fef0f0;
  453. color: #f56c6c;
  454. border: 1px solid #fff;
  455. border-left: 0;
  456. }
  457. .bottom-btn-item {
  458. position: relative;
  459. }
  460. .bottom-btn-item:hover {
  461. cursor: pointer;
  462. background-color: #ffffff3b;
  463. border-radius: 8px;
  464. }
  465. </style>