studentRanked.vue 12 KB

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