studentRanked.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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;"
  65. :src="'https://zhxy.obs.cn-hz1.ctyun.cn:443/static/student_icon/'+ (index1%7) +'.png'"
  66. mode=""></image>
  67. <view class="stu-tag text-center ui-flex-row ui-mt10">
  68. <view class="stu-tag-add ui-flex-1">72</view>
  69. <view class="stu-tag-sub ui-flex-1">-32</view>
  70. </view>
  71. <view class="txt-white f28 ui-pt10">
  72. {{item1.title}}
  73. </view>
  74. <u-badge absolute style="left: 10px;top: 10px;"
  75. :value="activeList.indexOf(item1.id) + 1"></u-badge>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="platform" v-if="chooseClassName">
  81. <view class="ranked-radio"></view>
  82. <view class="platform-text txt-white">讲台</view>
  83. </view>
  84. <!-- 切换班级 -->
  85. <u-picker :show="show_classes" @confirm="doChooseClass" :columns="teachList" keyName="class_name"
  86. @cancel="show_classes=false"></u-picker>
  87. <!-- 点评 -->
  88. <markScore ref="markScore"></markScore>
  89. <!-- 点评记录 -->
  90. <markScoreList ref="markScoreList"></markScoreList>
  91. <el-drawer title="排行榜" :visible.sync="showRankList" direction="rtl">
  92. <span>我来啦!</span>
  93. </el-drawer>
  94. <view class="ui-pull-bottom ui-flex-row ui-p"
  95. style="background-color: #0000006b;border-top: 1px solid #616161;">
  96. <view class="ui-flex-1 ui-flex-row">
  97. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="show_classes=true">
  98. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  99. <view style="line-height: 1;">
  100. <text class="txt-white f24">评分记录</text>
  101. </view>
  102. </view>
  103. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="$refs.markScoreList.open()">
  104. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  105. <view style="line-height: 1;">
  106. <text class="txt-white f24">点评记录</text>
  107. </view>
  108. </view>
  109. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="$pageTo('./studentRankedChange')">
  110. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  111. <view style="line-height: 1;">
  112. <text class="txt-white f24">座位调整</text>
  113. </view>
  114. </view>
  115. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="setMulti">
  116. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  117. <view style="line-height: 1;">
  118. <text class="txt-white f24" v-if="multiSelect">取消多选</text>
  119. <text class="txt-white f24" v-else>学生多选</text>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="ui-flex-row">
  124. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="showRankList = true">
  125. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  126. <view style="line-height: 1;">
  127. <text class="txt-white f24">排行榜</text>
  128. </view>
  129. </view>
  130. <view class="ui-flex-column text-center ui-p bottom-btn-item">
  131. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  132. <view style="line-height: 1;">
  133. <text class="txt-white f24">切换老师</text>
  134. </view>
  135. </view>
  136. <view class="ui-flex-column text-center ui-p bottom-btn-item">
  137. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  138. <view style="line-height: 1;">
  139. <text class="txt-white f24">退出登录</text>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </template>
  146. <script>
  147. import markScore from './components/mark-score.vue'
  148. import markScoreList from './components/mark-score-list.vue'
  149. import {
  150. getStuSchoolIdByStuClassId
  151. } from "@/common/api/stu.js"
  152. export default {
  153. components: {
  154. markScore,
  155. markScoreList
  156. },
  157. data() {
  158. return {
  159. show_classes: false,
  160. id: 1,
  161. info: {},
  162. list: [],
  163. teachList: [],
  164. chooseClassName: '',
  165. chooseClassId: '',
  166. activeList: [],
  167. multiSelect: false,
  168. // 排行榜
  169. showRankList: false,
  170. }
  171. },
  172. mounted() {
  173. // this.id = this.$route.query.id
  174. this.id = this.$store.state.teacherInfo.selfclass.id
  175. // this.getStudent()
  176. this.getClassroomList();
  177. setTimeout(() => {
  178. this.doChooseClass({
  179. value: [{
  180. class_name: "二年级2班",
  181. id: 2
  182. }]
  183. })
  184. }, 400)
  185. },
  186. methods: {
  187. setMulti() {
  188. this.multiSelect = !this.multiSelect;
  189. this.activeList = [];
  190. },
  191. loginOut() {
  192. uni.setStorageSync("token", '')
  193. uni.navigateTo({
  194. url: "/pages/login/login"
  195. })
  196. },
  197. doChooseClass(val) {
  198. console.log(val, "val");
  199. this.chooseClassId = val.value[0].id
  200. this.chooseClassName = val.value[0].class_name
  201. this.getStudent()
  202. this.show_classes = false
  203. },
  204. getClassroomList() {
  205. let teacher_id = this.$store.state.teacherInfo.id
  206. this.$api.sendRequest({
  207. url: `/mobile/teacher/teachClasses`,
  208. method: "post",
  209. data: {
  210. teacher_id: teacher_id
  211. },
  212. success: res => {
  213. this.teachList.push(res.data)
  214. console.log(this.teachList);
  215. }
  216. })
  217. },
  218. // 多选学生点评
  219. commentMulti() {
  220. this.$refs.markScore.open(1);
  221. },
  222. Comment(item) {
  223. if (this.multiSelect) {
  224. let index = this.activeList.indexOf(item.id)
  225. if (index >= 0) {
  226. this.activeList.splice(index, 1);
  227. } else {
  228. this.activeList.push(item.id);
  229. }
  230. return;
  231. }
  232. console.log(item, "sgism");
  233. this.$refs.markScore.open(1);
  234. return;
  235. //item的id是studentClass的id,需要转换成stu_school_id传到
  236. this.$api.sendRequest({
  237. url: getStuSchoolIdByStuClassId,
  238. data: {
  239. stu_class_id: item.id
  240. },
  241. success: res => {
  242. console.log(res, "resrrrrr");
  243. let stu_school_id = res.data.stu_school_id
  244. uni.navigateTo({
  245. url: "/pages/studentTab/studentTab?stu_school_id=" + stu_school_id
  246. })
  247. }
  248. })
  249. },
  250. getStudent() {
  251. this.$api.sendRequest({
  252. url: `/mobile/getSeat?classroom_id=${this.chooseClassId}`,
  253. success: res => {
  254. this.list = res.data
  255. }
  256. })
  257. },
  258. CommentOn(item, score) {
  259. let info = {
  260. id: this.info.id,
  261. tab_id: item.tab_id,
  262. score: score
  263. }
  264. this.$api.sendRequest({
  265. url: `/mobile/student/eval`,
  266. data: info,
  267. success: res => {
  268. uni.showToast({
  269. title: `${this.info.title} ${item.tab_name} ${item.type == 1 ? '+':'-'} ${score}分`,
  270. icon: 'none'
  271. })
  272. this.$refs.CommentPopup.close()
  273. }
  274. })
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .page {
  281. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  282. background-size: 100% 100%;
  283. height: 100vh;
  284. // width: 750rpx;
  285. }
  286. .platform {
  287. display: flex;
  288. justify-content: center;
  289. align-items: center;
  290. position: relative;
  291. height: 30rpx;
  292. margin-top: 60rpx;
  293. .platform-color {
  294. position: absolute;
  295. left: 0;
  296. top: 0;
  297. height: 60rpx;
  298. background-color: rgba(5, 204, 161, 1);
  299. width: 10rpx;
  300. }
  301. .platform-text {
  302. text-align: center;
  303. width: 60%;
  304. margin-top: 40rpx;
  305. }
  306. }
  307. .pop-title {
  308. border-bottom: 1px solid #f2f2f2;
  309. font-size: 36rpx;
  310. padding-bottom: 20rpx;
  311. display: flex;
  312. align-items: center;
  313. }
  314. .popup-content {
  315. border-radius: 10px;
  316. box-sizing: border-box;
  317. padding: 0 32rpx;
  318. }
  319. .btn-roll {
  320. background-color: #fff;
  321. border-radius: 25rpx;
  322. width: 190rpx;
  323. color: #666;
  324. height: 60rpx;
  325. line-height: 60rpx;
  326. text-align: center;
  327. margin-left: 32rpx;
  328. }
  329. .ranked {
  330. width: 100%;
  331. text-align: center;
  332. font-size: 10px;
  333. box-sizing: border-box;
  334. display: flex;
  335. padding-top: 80rpx;
  336. }
  337. .ranked-item-tr {
  338. position: relative;
  339. margin-bottom: 26rpx;
  340. padding-top: 16rpx;
  341. padding-bottom: 16rpx;
  342. border-radius: 5px;
  343. box-sizing: border-box;
  344. width: 100%;
  345. cursor: pointer;
  346. transition: 100ms;
  347. display: flex;
  348. justify-content: center;
  349. }
  350. .active {
  351. background: #ffffff85;
  352. }
  353. .ranked-radio {
  354. width: 100px;
  355. position: absolute;
  356. left: 50%;
  357. transform: translate(-50%);
  358. top: 0rpx;
  359. border-bottom: 3px solid rgba(5, 204, 161, 1);
  360. border-radius: 50% 50% 0 0;
  361. }
  362. .visit-item {
  363. display: flex;
  364. align-items: center;
  365. .visit-item-left {
  366. width: 120rpx;
  367. color: #666;
  368. }
  369. }
  370. .stu-tag {
  371. width: 90px;
  372. border-radius: 15px;
  373. overflow: hidden;
  374. }
  375. .stu-tag-add {
  376. background-color: #ecf5ff;
  377. color: #3c9cff;
  378. border: 1px solid #fff;
  379. }
  380. .stu-tag-sub {
  381. background-color: #fef0f0;
  382. color: #f56c6c;
  383. border: 1px solid #fff;
  384. border-left: 0;
  385. }
  386. .bottom-btn-item {
  387. position: relative;
  388. }
  389. .bottom-btn-item:hover {
  390. cursor: pointer;
  391. background-color: #ffffff3b;
  392. border-radius: 8px;
  393. }
  394. </style>