diff --git a/pages.json b/pages.json index c9c45a4..4e0d8f0 100644 --- a/pages.json +++ b/pages.json @@ -1,3 +1,4 @@ + { "easycom": { "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" @@ -43,69 +44,7 @@ "navigationStyle": "custom" } }, - { - "path" : "pages_teacher/teacher_class/class_detail", - "style" : - { - "navigationBarTitleText": "班级详情", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path" : "pages_teacher/pages_add/add_operation", - "style" : - { - "navigationBarTitleText": "添加听力", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path":"pages_teacher/teacher_teachers/teacher_addOperation", - "style" : - { - "navigationBarTitleText": "添加作业", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - - { - "path":"pages_teacher/teacher_teachers/teacher_speechadd", - "style" : - { - "navigationBarTitleText": "添加口语", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path":"pages_teacher/teacher_teachers/teacher_writeadd", - "style" : - { - "navigationBarTitleText": "添加写作", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - - }, - { - "path":"pages_teacher/teacher_teachers/operation_detail", - "style" : - { - "navigationBarTitleText": "作业详情", - "navigationBarBackgroundColor": "#4473f6", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - - }, + { @@ -190,6 +129,73 @@ } } ], + "subPackages": [ + { + "root": "pages_teacher", + "pages": [ + { + "path":"teacher_teachers/teacher_writeadd", + "style" : + { + "navigationBarTitleText": "添加写作", + "navigationBarBackgroundColor": "#4473f6", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + + }, + { + "path":"teacher_teachers/operation_detail", + "style" : + { + "navigationBarTitleText": "作业详情", + "navigationBarBackgroundColor": "#4473f6", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + + }, + { + "path":"teacher_teachers/teacher_addOperation", + "style" : + { + "navigationBarTitleText": "添加作业", + "navigationBarBackgroundColor": "#4473f6", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path" : "pages_add/add_operation", + "style" : + { + "navigationBarTitleText": "添加听力", + "navigationBarBackgroundColor": "#4473f6", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path" : "teacher_class/class_detail", + "style" : + { + "navigationBarTitleText": "班级详情", + "navigationBarBackgroundColor": "#4473f6", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + } + + ] + } + + + + + + + + ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uni-app", @@ -197,5 +203,9 @@ "backgroundColor": "#F8F8F8" }, "uniIdRouter": {} + + } + + \ 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/slander.vue b/pages_teacher/teacher_teachers/components/slander.vue index 1543c3f..b34c522 100644 --- a/pages_teacher/teacher_teachers/components/slander.vue +++ b/pages_teacher/teacher_teachers/components/slander.vue @@ -1,37 +1,42 @@