diff --git a/common/http.interceptor.js b/common/http.interceptor.js index c0daeb6..e15194c 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -41,7 +41,7 @@ const install = (Vue, vm) => { // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 // const token = uni.getStorageSync('token'); - const token = " Bearer 6ecfb3a42c3d43b3b950c6e911e46223" + const token = " Bearer 47c982b63064436bb905144c082ffba3" // console.log("我是token", token) config.header.Authorization = token; // config.header.Tenant-Id=1 diff --git a/pages.json b/pages.json index 33d5d2d..4e0d8f0 100644 --- a/pages.json +++ b/pages.json @@ -1,3 +1,4 @@ + { "easycom": { "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" @@ -206,3 +207,5 @@ } + + \ No newline at end of file diff --git a/pages/Mystudent/student.vue b/pages/Mystudent/student.vue index 92f9981..1c3b916 100644 --- a/pages/Mystudent/student.vue +++ b/pages/Mystudent/student.vue @@ -27,8 +27,8 @@ - 学生 - + {{ checkindex == 1 ? '班级' : '学生' }} + @@ -38,9 +38,11 @@ + v-model="searchKeyword" + placeholder="搜索相关内容..." + class="input" + placeholder-style="color:#C7CDD3" + @input="search()"> @@ -92,36 +94,51 @@ v-if="checkindex == 1"> - 班级人数 - + v-show="classnum"> + 降序 - + 升序 - 标签文字 - - 标签文字 + v-show="showtext"> + + 听力 - - 标签文字 + + 阅读 - - 标签文字 + + 写作 + + + 口语 @@ -135,8 +152,9 @@ + v-for="(item, index) in classlist" + v-if="isloding == false" + :key="index" @click="toclassdetal(item)"> @@ -145,19 +163,32 @@ {{ item.name }} - - 标签文字 + + 听力 + + + 阅读 + + + 写作 + + + 口语 + style="width:80rpx ;"> 班级人数 - {{ item.classify }} + {{ item.totalMembers }} @@ -173,14 +204,14 @@ 作业完成度 - - {{ calculatePercentage(2, 10) }} + {{ item.workCompletionDegree }}% + - + @@ -252,7 +283,13 @@ export default { checkindex: 1, isDropdownOpen: true, classlist: {}, - isloding:true, + isloding: true, + changeclasslist: {}, + classnum: false, + classnumindex: -1, + showtext: false, + textindex: 0, + searchKeyword: '', } }, onLoad(option) { @@ -260,34 +297,111 @@ export default { }, methods: { - calculatePercentage(value1, value2) { - if (value2 === 0) { - console.log("value2 is zero, cannot calculate percentage"); - return '0%'; // 或者返回其他默认值 - } - - return ((value1 / value2) * 100).toFixed(0) + '%'; + toclassdetal(item) { + console.log('点击了'); // 确保这一行输出 + uni.navigateTo({ + url: "/pages_teacher/teacher_class/class_detail?id=" + item.id + }).then(res => { + console.log('跳转成功', res); + }).catch(err => { + console.error('跳转失败', err); + }); }, - toggleDropdown() { - this.isDropdownOpen = !this.isDropdownOpen; + search() { + // 根据关键字过滤 this.classlist + if(this.searchKeyword!=''){ + const filteredList = JSON.parse(JSON.stringify(this.changeclasslist)).filter(item => item.name.includes(this.searchKeyword)); + // 更新 this.classlist 为过滤后的列表 + this.classlist = filteredList; + }else{ + this.fuwei() + } + + }, + calculatePercentage(value1, value2) { + if (value2 === 0) { + console.log("value2 is zero, cannot calculate percentage"); + return '0%'; // 或者返回其他默认值 + } + + return ((value1 / value2) * 100).toFixed(0) + '%'; + }, + changeclass() { + this.classnum = !this.classnum + }, + chengclassnumindex(num) { + if (num == this.classnumindex) { + this.classnumindex = -1 + } else { + this.classnumindex = num + } + if (this.classnumindex == 0) { + this.classlist.sort((a, b) => b.totalMembers - a.totalMembers); + } + if (this.classnumindex == 1) { + // 升序排列 classlist 数组,根据 totalMembers 属性 + this.classlist.sort((a, b) => a.totalMembers - b.totalMembers); + } + if (this.classnumindex == -1) { + this.fuwei() + } + + }, + fuwei() { + console.log(this.classlist, 'this.classlist'); + console.log(this.changeclasslist, 'this.changeclasslist'); + this.classlist = JSON.parse(JSON.stringify(this.changeclasslist)); + }, + changetext() { + this.showtext = !this.showtext + }, + chengetextindex(num) { + if (num == this.textindex) { + this.textindex = 0 + } else { + this.textindex = num + } + if (this.textindex !== 0 || this.classnumindex === 1) { + this.classlist.sort((a, b) => { + if (this.textindex !== 0 && a.classify === this.textindex) { + return -1; // 将匹配的项放在前面 + } + if (this.textindex !== 0 && b.classify === this.textindex) { + return 1; // 将匹配的项放在前面 + } + if (this.classnumindex === 0) { + return b.totalMembers - a.totalMembers; // 对 totalMembers 进行降序排列 + } + if (this.classnumindex === 1) { + return a.totalMembers - b.totalMembers; // 对 totalMembers 进行升序排列 + } + return 0; // 保持原有顺序 + }); + } else { + console.log('调用了'); + this.fuwei(); + } + + }, getclassList() { this.$u.get("https://api.admin-v2.langsi.online/admin-api/classroom/page").then(res => { console.log(res, '返回成功'); - - if(res.code==0){ - this.classlist = res.data.list - this.isloding=false + if (res.code === 0) { + this.classlist = res.data.list; + this.changeclasslist = JSON.parse(JSON.stringify(this.classlist)); + this.isloding = false; } - }) + }); }, getstuList() { this.$u.get("https://api.admin-v2.langsi.online/admin-api/classroom/page").then(res => { console.log(res, '返回成功'); - - if(res.code==0){ + + if (res.code == 0) { this.classlist = res.data.list - this.isloding=false + this.isloding = false + } }) } @@ -546,6 +660,10 @@ export default { color: rgba(46, 73, 117, 0.6); border-bottom: 2rpx solid #F3F3F3; } + + .act2 { + color: #2D7CE6; + } } } diff --git a/pages_teacher/teacher_teachers/components/compose.vue b/pages_teacher/teacher_teachers/components/compose.vue new file mode 100644 index 0000000..8a5fd33 --- /dev/null +++ b/pages_teacher/teacher_teachers/components/compose.vue @@ -0,0 +1,147 @@ + + + + +