studentTab.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view class="" style="">
  3. <view style="padding: 32rpx;box-sizing: border-box;"
  4. class="">
  5. <view style="font-size: 32rpx;margin-bottom: 32rpx;" class="ui-flex ui-flex-space-between ui-flex-align-center">
  6. <span class="ui-flex">所有标签 <span @click="showCourse=true" class="ui-ml20 ui-flex">{{ course_text }}<u-icon name="arrow-down"></u-icon></span></span>
  7. <view v-if="teacher_id" style="background-color: #05CCA1;color: #fff;" class="edit-tag-item-btn " @click="openPop">
  8. + 添加标签
  9. </view>
  10. </view>
  11. <view class="log" >
  12. <view class="" v-if="list.length">
  13. <u-list @scrolltolower="scrolltolower" height="90vh">
  14. <view v-for="(item,index) in list" :key="index" class="log-item" @click="xiugaiFenshu(item,index)">
  15. <view class="log-item-info">
  16. <view style="color: #999;">
  17. {{ item.studentTab.tab_name }}
  18. </view>
  19. <view>
  20. {{ item.score>0 ? "+"+item.score : item.score }}
  21. </view>
  22. </view>
  23. <view class="log-item-info" style="border-bottom: none;">
  24. <view style="color: #999;">
  25. {{ item.course.course_name }} - {{ item.parentTab.tab_name }}
  26. </view>
  27. <view>
  28. {{ item.created_at }}
  29. </view>
  30. </view>
  31. </view>
  32. <u-loadmore status="nomore" v-if="is_bottom"/>
  33. </u-list>
  34. </view>
  35. <view class="" v-else>
  36. <u-empty mode="data" ></u-empty>
  37. </view>
  38. </view>
  39. </view>
  40. <uni-data-picker style="background-color: transparent;" ref="picker" placeholder="请选择" popup-title="请选择"
  41. :localdata="erjiBiaoqianShu" v-model="classes" @change="onchange" @nodeclick="onnodeclick"
  42. @popupopened="onpopupopened" @popupclosed="onpopupclosed">
  43. </uni-data-picker>
  44. <u-picker :show="xianshiFenshuXiala" :columns="fenshuLiebiao" @confirm="querenFenshu" @cancel="xianshiFenshuXiala=false" @close="xianshiFenshuXiala=false"></u-picker>
  45. <student-edit-tag ref="studentEditTag" @del="delTag()"></student-edit-tag>
  46. <u-picker :show="showCourse" :columns="courseColumns" keyName="course_name" @cancel="showCourse=false" @confirm="querenKemu"></u-picker>
  47. </view>
  48. </template>
  49. <script>
  50. import studentEditTag from "@/pages/studentTab/studentEditTag.vue"
  51. import Util from "@/common/js/util.js"
  52. import { getSubjectByStudentId } from "@/common/api/course.js"
  53. import { getStudentTabTreeByTeacherId,huoquBiaoqianXinxi,geiXueshengTianjiaBiaoqian,xueshengBiaoqianLiebiao } from "@/common/api/tab.js"
  54. export default {
  55. components : {
  56. studentEditTag
  57. },
  58. data() {
  59. return {
  60. showCourse : false,
  61. list : [],
  62. classes: '',
  63. type : 'center',
  64. teacher_id : '',
  65. erjiBiaoqianShu: [],
  66. suoxuanBiaoqianXinxi : {},
  67. jiafenLiebiao : [["+1","+2","+3","+4","+5"]],
  68. koufenLiebiao : [["-1","-2","-3","-4","-5"]],
  69. fenshuLiebiao : [],
  70. xianshiFenshuXiala : false,
  71. xuanzhongBiaoqianId : '',
  72. biaoqianXinxi : {
  73. leixing : '',
  74. fenshu : '',
  75. },
  76. stu_school_id : '',
  77. page : 1,
  78. is_bottom : false,
  79. chooseTabIndex : '',
  80. course_text : '选择科目',
  81. course_id : '',
  82. courseColumns : [[]],
  83. kemuXinxi : {},
  84. }
  85. },
  86. mounted() {
  87. this.stu_school_id = this.$route.query.stu_school_id //学生stu_school_id
  88. if(this.$route.query.course_id){
  89. this.course_id=this.$route.query.course_id
  90. }
  91. this.getSubjectByStudentId()
  92. this.xueshengBiaoqianLiebiao()
  93. //如果是老师身份
  94. if(this.$store.state.teacher_id){
  95. this.teacher_id=this.$store.state.teacher_id
  96. this.huoquBiaoqianShu()
  97. }
  98. },
  99. methods: {
  100. querenKemu(val){
  101. this.kemuXinxi=val.value[0]
  102. this.course_text=this.kemuXinxi.course_name
  103. this.showCourse=false
  104. this.list=[]
  105. this.page=1
  106. this.course_id=this.kemuXinxi.course_id
  107. this.xueshengBiaoqianLiebiao()
  108. },
  109. getSubjectByStudentId(){
  110. this.$api.sendRequest({
  111. url: getSubjectByStudentId,
  112. data : {
  113. stu_school_id : this.stu_school_id,
  114. },
  115. success: res => {
  116. this.courseColumns=[[]]
  117. res.data.map(item=>{
  118. item.course_name=item.course.course_name
  119. this.courseColumns[0].push(item)
  120. if(item.course_id==this.course_id){
  121. this.course_text=item.course_name
  122. }
  123. })
  124. }
  125. })
  126. },
  127. xiugaiFenshu(item,index){
  128. if(this.teacher_id==item.eval_teacher_id){
  129. this.$refs.studentEditTag.showTag=true
  130. this.$refs.studentEditTag.tagInfo=item
  131. this.$refs.studentEditTag.score= item.score
  132. this.chooseTabIndex=index
  133. }
  134. },
  135. xueshengBiaoqianLiebiao(){
  136. this.$api.sendRequest({
  137. url: xueshengBiaoqianLiebiao,
  138. data : {
  139. stu_school_id : this.stu_school_id,
  140. page : this.page,
  141. course_id : this.course_id
  142. },
  143. success: res => {
  144. if(res.data.data.length==0){
  145. this.is_bottom=true
  146. }else{
  147. res.data.data.map(item=>{
  148. this.list.push(item)
  149. })
  150. this.page++
  151. }
  152. }
  153. })
  154. },
  155. querenFenshu(e){
  156. this.biaoqianXinxi.fenshu=e.indexs[0]+1
  157. this.$api.sendRequest({
  158. url: geiXueshengTianjiaBiaoqian,
  159. data : {
  160. teacher_id : this.teacher_id,
  161. tab_id : this.xuanzhongBiaoqianId,
  162. stu_school_id : this.stu_school_id,
  163. type : this.biaoqianXinxi.leixing,
  164. score : this.biaoqianXinxi.fenshu
  165. },
  166. method : 'post',
  167. success: res => {
  168. console.log(res,"shis,");
  169. this.xianshiFenshuXiala=false
  170. this.page=1
  171. this.list=[]
  172. this.xueshengBiaoqianLiebiao()
  173. }
  174. })
  175. },
  176. openPop() {
  177. this.$refs.picker.show()
  178. },
  179. onnodeclick(e) {
  180. },
  181. onpopupopened(e) {
  182. console.log('popupopened');
  183. },
  184. onpopupclosed(e) {
  185. console.log('popupclosed',e);
  186. },
  187. onchange(e) {
  188. console.log(e,"biaoqianxinxi");
  189. this.suoxuanBiaoqianXinxi=e.detail.value
  190. this.course_id=e.detail.value[0].value
  191. this.course_text=e.detail.value[0].text
  192. this.xuanzhongBiaoqianId=e.detail.value[2].value
  193. //去后台查找标签信息
  194. this.chazhaoBiaoqianXinxi()
  195. },
  196. chazhaoBiaoqianXinxi(){
  197. this.$api.sendRequest({
  198. url: huoquBiaoqianXinxi,
  199. data : {
  200. tab_id : this.xuanzhongBiaoqianId
  201. },
  202. success: res => {
  203. console.log(res,"chazhaoshuju");
  204. if(res.data.type==1){
  205. this.fenshuLiebiao=this.jiafenLiebiao
  206. }else{
  207. this.fenshuLiebiao=this.koufenLiebiao
  208. }
  209. this.biaoqianXinxi.leixing=res.data.type
  210. this.$refs.picker.hide()
  211. //选择完成后,弹出加分,扣分选项
  212. this.xianshiFenshuXiala=true
  213. }
  214. })
  215. },
  216. delTag(item,index){
  217. this.list.splice(this.chooseTabIndex,1)
  218. },
  219. huoquBiaoqianShu(){
  220. this.$api.sendRequest({
  221. url: getStudentTabTreeByTeacherId,
  222. method : 'post',
  223. data : {
  224. teacher_id : this.teacher_id,
  225. },
  226. success: res => {
  227. console.log(res,"shu");
  228. this.dataTree=res.data
  229. res.data.map((item)=>{
  230. let obj={
  231. text: item.course_name,
  232. value: item.course_id,
  233. children:[],
  234. course_id : item.course_id,
  235. }
  236. item.tabLv2.map(item2=>{
  237. let children1={
  238. text: item2.tab_name,
  239. value: item2.tab_id,
  240. tab_id : item2.tab_id,
  241. children :[],
  242. }
  243. if(item2.tabLv3){
  244. item2.tabLv3.map(item3=>{
  245. let children2={
  246. text: item3.tab_name,
  247. value: item3.tab_id,
  248. tab_id : item3.tab_id,
  249. }
  250. children1.children.push(children2)
  251. })
  252. }
  253. obj.children.push(children1)
  254. })
  255. this.erjiBiaoqianShu.push(obj)
  256. })
  257. }
  258. })
  259. },
  260. scrolltolower(){
  261. if(this.is_bottom==true) return
  262. this.xueshengBiaoqianLiebiao()
  263. },
  264. }
  265. }
  266. </script>
  267. <style lang="scss" scoped>
  268. /deep/.uni-data-tree-input {
  269. display: none;
  270. }
  271. .edit-tag {
  272. }
  273. .edit-tag-item-btn {
  274. background: rgba(5, 204, 161, 0.10);
  275. border-radius: 14.33px;
  276. padding: 4rpx 20rpx;
  277. width: fit-content;
  278. }
  279. .edit-tag-item {
  280. background: rgba(5, 204, 161, 0.10);
  281. border-radius: 14.33px;
  282. padding: 4rpx 20rpx;
  283. margin-right: 32rpx;
  284. margin-bottom: 32rpx;
  285. position: relative;
  286. .edit-tag-item-icon {
  287. position: absolute;
  288. width: 40rpx;
  289. border-radius: 50%;
  290. height: 40rpx;
  291. text-align: center;
  292. line-height: 40rpx;
  293. background-color: rgba(66, 185, 131, 1);
  294. right: -20rpx;
  295. top: -20rpx;
  296. }
  297. }
  298. .edit-tag-item-add {}
  299. .log {
  300. box-sizing: border-box;
  301. width: 100%;
  302. height: 60vh;
  303. .log-item {
  304. padding: 16rpx;
  305. box-sizing: border-box;
  306. margin-bottom: 28rpx;
  307. width: 100%;
  308. background: #ffffff;
  309. border-radius: 5.33px;
  310. box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.10);
  311. .log-item-info {
  312. width: 100%;
  313. padding: 20rpx 0;
  314. border-bottom: 1px solid #f2f2f2;
  315. display: flex;
  316. justify-content: space-between;
  317. }
  318. .log-item-content {
  319. width: 100%;
  320. border-bottom: 1px solid #f2f2f2;
  321. font-size: 20rpx;
  322. padding-bottom: 20rpx;
  323. display: flex;
  324. align-items: center;
  325. }
  326. .log-item-content-left {
  327. display: flex;
  328. align-items: center;
  329. flex: 1;
  330. .log-item-content-left-text {
  331. margin-left: 32rpx;
  332. }
  333. }
  334. .log-item-content-right {
  335. display: flex;
  336. align-items: center;
  337. }
  338. .log-item-content-right-color {
  339. width: 20rpx;
  340. height: 20rpx;
  341. border-radius: 50%;
  342. margin-right: 20rpx;
  343. }
  344. }
  345. }
  346. </style>
  347. <style lang="scss">
  348. /deep/ .selected-item-active{
  349. border-bottom: 2px solid #05cca1 !important;
  350. }
  351. /deep/ .check{
  352. border: 2px solid #05cca1;
  353. border-left: 0;
  354. border-top:0
  355. }
  356. </style>