studentRanked.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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" style="border-bottom: 4px solid #4472C4;padding-left: 40rpx;height: 54px;" :style="{'background-color': multiSelect ? '#4472c4' : ''}">
  19. <view class="ui-p ui-flex-row">
  20. <text class="f40">{{chooseClassName}}</text>
  21. <view class="ui-flex-row">
  22. <text class="f40 ui-ml30 ui-mr10">李老师</text>
  23. <u-icon name="arrow-down-fill" color="#fff"></u-icon>
  24. </view>
  25. </view>
  26. <view class="ui-p ui-flex ui-flex-1 ui-flex-align-center" style="justify-content: end;" v-if="multiSelect">
  27. <view class="ui-mr30">
  28. <text class="f32" style="#9ccbff">请点击选则学生批量点评</text>
  29. </view>
  30. <view class="ui-flex" style="width: 250px;">
  31. <u-button size="small" @click="setMulti" plain text="取消选择" style="background-color: #0d4980;"
  32. class="ui-mr10"></u-button>
  33. <u-button size="small" type="primary" @click="commentMulti()">
  34. <text class="ui-mr10">批量点评</text>
  35. <u-badge :value="activeList.length"></u-badge>
  36. </u-button>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="ui-flex-row ui-mt20 ui-flex-space-around">
  41. <view v-for="(column, index) in list" :key="index" v-if="index%2 == 0" class="ui-flex-row">
  42. <view v-for="index2 in 2" class="ui-flex-column" :class="{
  43. 'ui-mr10' : index2 == 1,
  44. 'ui-ml10' : index2 == 2
  45. }">
  46. <view @click="Comment(item1)" v-for="(item1,index1) in list[index2+index-1].nodes" :key="item1.id" class="ui-flex-column ranked-item-tr ui-flex-align-center"
  47. :class="{active : activeList.includes(item1.id)}">
  48. <image style="width: 100rpx;height: 100rpx;" :src="'https://zhxy.obs.cn-hz1.ctyun.cn:443/static/student_icon/'+ (index1%7) +'.png'" mode=""></image>
  49. <view class="stu-tag text-center ui-flex-row ui-mt10">
  50. <view class="stu-tag-add ui-flex-1">72</view>
  51. <view class="stu-tag-sub ui-flex-1">-32</view>
  52. </view>
  53. <view class="txt-white f28 ui-pt10">
  54. {{item1.title}}
  55. </view>
  56. <u-badge absolute style="left: 10px;top: 10px;" :value="activeList.indexOf(item1.id) + 1"></u-badge>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="platform" v-if="chooseClassName">
  62. <view class="ranked-radio"></view>
  63. <view class="platform-text txt-white">讲台</view>
  64. </view>
  65. <!-- 切换班级 -->
  66. <u-picker :show="show_classes" @confirm="doChooseClass" :columns="teachList" keyName="class_name"
  67. @cancel="show_classes=false"></u-picker>
  68. <markScore ref="markScore"></markScore>
  69. <view class="ui-pull-bottom ui-flex-row ui-p"
  70. style="background-color: #0000006b;border-top: 1px solid #616161;">
  71. <view class="ui-flex-1 ui-flex-row">
  72. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="show_classes=true">
  73. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  74. <view style="line-height: 1;">
  75. <text class="txt-white f24">{{chooseClassName || '加载中...'}}</text>
  76. </view>
  77. </view>
  78. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="$pageTo('./studentRankedChange')">
  79. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  80. <view style="line-height: 1;">
  81. <text class="txt-white f24">座位调整</text>
  82. </view>
  83. </view>
  84. <view class="ui-flex-column text-center ui-p bottom-btn-item" @click="setMulti">
  85. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  86. <view style="line-height: 1;">
  87. <text class="txt-white f24" v-if="multiSelect">取消多选</text>
  88. <text class="txt-white f24" v-else>学生多选</text>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="ui-flex-row">
  93. <view class="ui-flex-column text-center ui-p bottom-btn-item">
  94. <image src="../../static/uni.png" style="width: 30px;height: 30px;" 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">
  100. <image src="../../static/uni.png" style="width: 30px;height: 30px;" 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">
  106. <image src="../../static/uni.png" style="width: 30px;height: 30px;" mode=""></image>
  107. <view style="line-height: 1;">
  108. <text class="txt-white f24">退出登录</text>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import markScore from './components/mark-score.vue'
  117. import {
  118. getStuSchoolIdByStuClassId
  119. } from "@/common/api/stu.js"
  120. export default {
  121. components: {
  122. markScore
  123. },
  124. data() {
  125. return {
  126. show_classes: false,
  127. id: 1,
  128. info: {},
  129. list: [],
  130. teachList: [],
  131. chooseClassName: '',
  132. chooseClassId: '',
  133. activeList: [],
  134. multiSelect: false,
  135. }
  136. },
  137. mounted() {
  138. // this.id = this.$route.query.id
  139. this.id = this.$store.state.teacherInfo.selfclass.id
  140. // this.getStudent()
  141. this.getClassroomList();
  142. setTimeout(() => {
  143. this.doChooseClass({
  144. value: [{
  145. class_name: "二年级2班",
  146. id: 2
  147. }]
  148. })
  149. }, 400)
  150. },
  151. methods: {
  152. setMulti() {
  153. this.multiSelect = !this.multiSelect;
  154. this.activeList = [];
  155. },
  156. loginOut() {
  157. uni.setStorageSync("token", '')
  158. uni.navigateTo({
  159. url: "/pages/login/login"
  160. })
  161. },
  162. doChooseClass(val) {
  163. console.log(val, "val");
  164. this.chooseClassId = val.value[0].id
  165. this.chooseClassName = val.value[0].class_name
  166. this.getStudent()
  167. this.show_classes = false
  168. },
  169. getClassroomList() {
  170. let teacher_id = this.$store.state.teacherInfo.id
  171. this.$api.sendRequest({
  172. url: `/mobile/teacher/teachClasses`,
  173. method: "post",
  174. data: {
  175. teacher_id: teacher_id
  176. },
  177. success: res => {
  178. this.teachList.push(res.data)
  179. console.log(this.teachList);
  180. }
  181. })
  182. },
  183. // 多选学生点评
  184. commentMulti() {
  185. this.$refs.markScore.open(1);
  186. },
  187. Comment(item) {
  188. if (this.multiSelect) {
  189. let index = this.activeList.indexOf(item.id)
  190. if (index >= 0) {
  191. this.activeList.splice(index, 1);
  192. } else {
  193. this.activeList.push(item.id);
  194. }
  195. return;
  196. }
  197. console.log(item, "sgism");
  198. this.$refs.markScore.open(1);
  199. return;
  200. //item的id是studentClass的id,需要转换成stu_school_id传到
  201. this.$api.sendRequest({
  202. url: getStuSchoolIdByStuClassId,
  203. data: {
  204. stu_class_id: item.id
  205. },
  206. success: res => {
  207. console.log(res, "resrrrrr");
  208. let stu_school_id = res.data.stu_school_id
  209. uni.navigateTo({
  210. url: "/pages/studentTab/studentTab?stu_school_id=" + stu_school_id
  211. })
  212. }
  213. })
  214. },
  215. getStudent() {
  216. this.$api.sendRequest({
  217. url: `/mobile/getSeat?classroom_id=${this.chooseClassId}`,
  218. success: res => {
  219. this.list = res.data
  220. }
  221. })
  222. },
  223. CommentOn(item, score) {
  224. let info = {
  225. id: this.info.id,
  226. tab_id: item.tab_id,
  227. score: score
  228. }
  229. this.$api.sendRequest({
  230. url: `/mobile/student/eval`,
  231. data: info,
  232. success: res => {
  233. uni.showToast({
  234. title: `${this.info.title} ${item.tab_name} ${item.type == 1 ? '+':'-'} ${score}分`,
  235. icon: 'none'
  236. })
  237. this.$refs.CommentPopup.close()
  238. }
  239. })
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. .page {
  246. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  247. background-size: 100% 100%;
  248. height: 100vh;
  249. // width: 750rpx;
  250. }
  251. .platform {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. position: relative;
  256. height: 30rpx;
  257. margin-top: 60rpx;
  258. .platform-color {
  259. position: absolute;
  260. left: 0;
  261. top: 0;
  262. height: 60rpx;
  263. background-color: rgba(5, 204, 161, 1);
  264. width: 10rpx;
  265. }
  266. .platform-text {
  267. text-align: center;
  268. width: 60%;
  269. margin-top: 40rpx;
  270. }
  271. }
  272. .pop-title {
  273. border-bottom: 1px solid #f2f2f2;
  274. font-size: 36rpx;
  275. padding-bottom: 20rpx;
  276. display: flex;
  277. align-items: center;
  278. }
  279. .popup-content {
  280. border-radius: 10px;
  281. box-sizing: border-box;
  282. padding: 0 32rpx;
  283. }
  284. .btn-roll {
  285. background-color: #fff;
  286. border-radius: 25rpx;
  287. width: 190rpx;
  288. color: #666;
  289. height: 60rpx;
  290. line-height: 60rpx;
  291. text-align: center;
  292. margin-left: 32rpx;
  293. }
  294. .ranked {
  295. width: 100%;
  296. text-align: center;
  297. font-size: 10px;
  298. box-sizing: border-box;
  299. display: flex;
  300. padding-top: 80rpx;
  301. }
  302. .ranked-item-tr {
  303. position: relative;
  304. margin-bottom: 26rpx;
  305. padding-top: 16rpx;
  306. padding-bottom: 16rpx;
  307. border-radius: 5px;
  308. box-sizing: border-box;
  309. width: 100%;
  310. cursor: pointer;
  311. display: flex;
  312. justify-content: center;
  313. }
  314. .active {
  315. background: #ffffff85;
  316. }
  317. .ranked-radio {
  318. width: 100px;
  319. position: absolute;
  320. left: 50%;
  321. transform: translate(-50%);
  322. top: 0rpx;
  323. border-bottom: 3px solid rgba(5, 204, 161, 1);
  324. border-radius: 50% 50% 0 0;
  325. }
  326. .visit-item {
  327. display: flex;
  328. align-items: center;
  329. .visit-item-left {
  330. width: 120rpx;
  331. color: #666;
  332. }
  333. }
  334. .stu-tag {
  335. width: 90px;
  336. border-radius: 15px;
  337. overflow: hidden;
  338. }
  339. .stu-tag-add {
  340. background-color: #ecf5ff;
  341. color: #3c9cff;
  342. border: 1px solid #fff;
  343. }
  344. .stu-tag-sub {
  345. background-color: #fef0f0;
  346. color: #f56c6c;
  347. border: 1px solid #fff;
  348. border-left: 0;
  349. }
  350. .bottom-btn-item {
  351. position: relative;
  352. }
  353. .bottom-btn-item:hover {
  354. cursor: pointer;
  355. background-color: #ffffff3b;
  356. border-radius: 8px;
  357. }
  358. </style>