This commit is contained in:
libowei 2023-12-06 17:17:34 +08:00
commit ae473ab007
4 changed files with 313 additions and 45 deletions

View File

@ -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

View File

@ -1,3 +1,4 @@
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
@ -206,3 +207,5 @@
}

View File

@ -27,8 +27,8 @@
<view class="student_page_top">
<view class="search_box">
<view class="check_search">
学生
<view class="iconfont icon-arow_down"></view>
{{ checkindex == 1 ? '班级' : '学生' }}
<!-- <view class="iconfont icon-arow_down"></view> -->
</view>
<view class="serchbox">
<view class="serchimg">
@ -38,9 +38,11 @@
</image>
</view>
<input type="text"
v-model="searchKeyword"
placeholder="搜索相关内容..."
class="input"
placeholder-style="color:#C7CDD3 ">
placeholder-style="color:#C7CDD3"
@input="search()">
</view>
</view>
<view class="info_box">
@ -92,36 +94,51 @@
v-if="checkindex == 1">
<view class="class_box_top">
<view @click="toggleDropdown"
<view @click="changeclass()"
class="class_box_top_cont">
班级人数
<view class="iconfont icon-arow_down"></view>
<view class="dropdown_box"
v-show="false">
<view class="dropdown_item">
v-show="classnum">
<view class="dropdown_item"
:class="classnumindex == 0 ? 'act2' : ''"
@click="chengclassnumindex(0)">
降序
</view>
<view class="dropdown_item">
<view class="dropdown_item"
:class="classnumindex == 1 ? 'act2' : ''"
@click="chengclassnumindex(1)">
升序
</view>
</view>
</view>
<view @click="toggleDropdown"
<view @click="changetext()"
class="class_box_top_cont">
标签文字
<view class="iconfont icon-arow_down"></view>
<view class="dropdown_box"
v-show="false">
<view class="dropdown_item">
标签文字
v-show="showtext">
<view class="dropdown_item"
:class="textindex == 1 ? 'act2' : ''"
@click="chengetextindex(1)">
听力
</view>
<view class="dropdown_item">
标签文字
<view class="dropdown_item"
:class="textindex == 2 ? 'act2' : ''"
@click="chengetextindex(2)">
阅读
</view>
<view class="dropdown_item">
标签文字
<view class="dropdown_item"
:class="textindex == 3 ? 'act2' : ''"
@click="chengetextindex(3)">
写作
</view>
<view class="dropdown_item"
:class="textindex == 4 ? 'act2' : ''"
@click="chengetextindex(4)">
口语
</view>
</view>
</view>
@ -135,8 +152,9 @@
</view>
<view class="class_card"
v-for="(item, index) in classlist" v-if="isloding==false"
:key="index">
v-for="(item, index) in classlist"
v-if="isloding == false"
:key="index" @click="toclassdetal(item)">
<view class="class_card_top">
<view class="class_card_left">
<image src=" https://file.langsi.online/yasiimg/web/static/udWNTRG6GulmTtgPRQ49"></image>
@ -145,19 +163,32 @@
<view class="class_card_right_top">
{{ item.name }}
</view>
<view class="class_card_right_bot">
标签文字
<view class="class_card_right_bot"
v-show="item.classify == 1">
听力
</view>
<view class="class_card_right_bot"
v-show="item.classify == 2">
阅读
</view>
<view class="class_card_right_bot"
v-show="item.classify == 3">
写作
</view>
<view class="class_card_right_bot"
v-show="item.classify == 4">
口语
</view>
</view>
</view>
<view class="class_infobox">
<view class="class_info"
style="width:90rpx ;">
style="width:80rpx ;">
<view class="class_info_top">
班级人数
</view>
<view class="class_info_bot">
{{ item.classify }}
{{ item.totalMembers }}
</view>
</view>
<view class="class_info">
@ -173,8 +204,8 @@
作业完成度
</view>
<view class="class_info_bot">
<!-- {{ calculatePercentage(item.workCompletionDegree, item.totalMembers) }} -->
{{ calculatePercentage(2, 10) }}
{{ item.workCompletionDegree }}%
</view>
</view>
</view>
@ -253,6 +284,12 @@ export default {
isDropdownOpen: true,
classlist: {},
isloding: true,
changeclasslist: {},
classnum: false,
classnumindex: -1,
showtext: false,
textindex: 0,
searchKeyword: '',
}
},
onLoad(option) {
@ -260,6 +297,27 @@ export default {
},
methods: {
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);
});
},
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");
@ -268,18 +326,73 @@ export default {
return ((value1 / value2) * 100).toFixed(0) + '%';
},
toggleDropdown() {
this.isDropdownOpen = !this.isDropdownOpen;
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 => {
@ -288,6 +401,7 @@ export default {
if (res.code == 0) {
this.classlist = res.data.list
this.isloding = false
}
})
}
@ -546,6 +660,10 @@ export default {
color: rgba(46, 73, 117, 0.6);
border-bottom: 2rpx solid #F3F3F3;
}
.act2 {
color: #2D7CE6;
}
}
}

View File

@ -0,0 +1,147 @@
<template>
<!-- 外层循环 -->
<view>
<view v-for="(item,index) in transformedData" :key="index">
<!-- 剑18循环 -->
<view>
<view class="view_bages">
<view>{{item.examName}}</view>
</view>
</view>
<!-- 渲染Text -->
<view class="substance">
<text v-for="text in textArr" :key="text" @click="textClick(item,text)" :class="{active: item.active == text}">{{text}}</text>
</view>
<!-- 内容 -->
<view class="compose_bodys">
<view v-for="text in textArr" :key="text" class="zz">
<view class="compose_body" v-for="Task in taskArr" :key="Task" v-if="item.active == text">
<view class="compose_left">
<view>{{Task}}</view>
<view>
<text class="fickle">{{item[text][Task].caption}}</text>
<text class="fickle2">{{item[text][Task].themeCaption}}</text>
</view>
</view>
<view>
<u-checkbox @change="checkboxChange(item[text][Task].id)" v-model="subsets">{{item.name}}</u-checkbox>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
transformedData: [],
//
subsets:[],
subsetArr:[],
textArr:['test1','test2','test3','test4'],
taskArr:['task1','task2'],
//
comsapi: {
"key": "",
"mode": "home",
"exam": "",
"caption": "0",
"themeCaption": "",
"type": "",
"isStudy": 0,
"isEval": 0
},
}
},
created() {
this.getCompose()
},
methods: {
//
getCompose() {
this.$u.post('https://api.admin-v2.langsi.online/admin-api/writing/all/search', this.comsapi).then(res => {
let arr = res.data
for(let a of arr) {
a.active = 'test1'
}
this.transformedData =arr
})
},
textClick(item, text) {
item.active = text
this.$forceUpdate()
},
checkboxChange(e){
this.subsetArr.push(e)
console.log((this.subsetArr))
}
}
}
</script>
<style lang="scss" scoped>
.view_bages {
font-size: 40rpx;
font-weight: 400;
color: #2E4975;
}
.substance {
margin: 20rpx 0;
text {
padding: 10rpx 30rpx;
margin-right: 20rpx;
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
}
.compose_bodys{
margin: 30rpx 0;
}
.compose_body {
display: flex;
background: #FFFFFF;
align-items: center;
justify-content: space-between;
margin: 0rpx 20rpx;
border-bottom: 2rpx solid #F2F2F2;
}
.compose_body:last-child {
border: none;
}
.zz{
background: #ffff;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
.compose_left {
display: flex;
padding: 24rpx 0;
margin: 0 24rpx;
}
.fickle {
padding: 4rpx 22rpx;
font-size: 20rpx;
font-weight: 500;
color: #2D7CE6;
margin-left: 12rpx;
background: #E1EEFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
.fickle2 {
padding: 4rpx 32rpx;
font-size: 20rpx;
font-weight: 500;
color: #FB9734;
margin-left: 12rpx;
background: #FFEBD7;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
.active {
color: #fff;
background: #007AFF !important;
}
</style>