提交
This commit is contained in:
commit
ae473ab007
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
{
|
||||
"easycom": {
|
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||
|
@ -206,3 +207,5 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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"
|
||||
placeholder="搜索相关内容..."
|
||||
class="input"
|
||||
placeholder-style="color:#C7CDD3 ">
|
||||
v-model="searchKeyword"
|
||||
placeholder="搜索相关内容..."
|
||||
class="input"
|
||||
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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
147
pages_teacher/teacher_teachers/components/compose.vue
Normal file
147
pages_teacher/teacher_teachers/components/compose.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user