This commit is contained in:
taoxu 2023-12-06 10:06:54 +08:00
parent d43b7f7059
commit 236299f592
3 changed files with 129 additions and 110 deletions

View File

@ -41,9 +41,10 @@ const install = (Vue, vm) => {
// 方式四如果token放在了Storage本地存储中拦截是每次请求都执行的 // 方式四如果token放在了Storage本地存储中拦截是每次请求都执行的
// 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值 // 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值
// const token = uni.getStorageSync('token'); // const token = uni.getStorageSync('token');
const token = "Bearer aca170b01b4b4c88b3629fde91a3b2b7" const token = " Bearer a75c44e23b7740c48740c95ae3b7b427"
// console.log("我是token", token) // console.log("我是token", token)
config.header.Authorization = token; config.header.Authorization = token;
// config.header.Tenant-Id=1
// #ifdef H5 // #ifdef H5
config.header.Authorization = 'Bearer '+token; config.header.Authorization = 'Bearer '+token;
// #endif // #endif

View File

@ -1,10 +1,10 @@
<template> <template>
<view class="view_body"> <view class="view_body">
<u-navbar :is-back="false" <u-navbar :is-back="false"
title='学生' title='班级'
title-color="#2E4975" title-color="#2E4975"
:border-bottom="false" :border-bottom="false"
:background="true" :background="bgc"
id="navbar"> id="navbar">
</u-navbar> </u-navbar>
<view class="nocont" <view class="nocont"
@ -96,14 +96,15 @@
class="class_box_top_cont"> class="class_box_top_cont">
班级人数 班级人数
<view class="iconfont icon-arow_down"></view> <view class="iconfont icon-arow_down"></view>
<view class="dropdown_box"> <view class="dropdown_box"
v-show="false">
<view class="dropdown_item"> <view class="dropdown_item">
降序 降序
</view> </view>
<view class="dropdown_item"> <view class="dropdown_item">
升序 升序
</view> </view>
</view> </view>
</view> </view>
@ -111,7 +112,8 @@
class="class_box_top_cont"> class="class_box_top_cont">
标签文字 标签文字
<view class="iconfont icon-arow_down"></view> <view class="iconfont icon-arow_down"></view>
<view class="dropdown_box"> <view class="dropdown_box"
v-show="false">
<view class="dropdown_item"> <view class="dropdown_item">
标签文字 标签文字
</view> </view>
@ -129,17 +131,19 @@
</view> </view>
<view class="class_card"> <view class="class_card"
v-for="(item, index) in classlist" v-if="isloding==false"
:key="index">
<view class="class_card_top"> <view class="class_card_top">
<view class="class_card_left"> <view class="class_card_left">
<image src=" https://file.langsi.online/yasiimg/web/static/udWNTRG6GulmTtgPRQ49"></image> <image src=" https://file.langsi.online/yasiimg/web/static/udWNTRG6GulmTtgPRQ49"></image>
</view> </view>
<view class="class_card_right"> <view class="class_card_right">
<view class="class_card_right_top"> <view class="class_card_right_top">
雅思1班 {{ item.name }}
</view> </view>
<view class="class_card_right_bot"> <view class="class_card_right_bot">
标签文字 标签文字
@ -153,7 +157,7 @@
班级人数 班级人数
</view> </view>
<view class="class_info_bot"> <view class="class_info_bot">
21 {{ item.classify }}
</view> </view>
</view> </view>
<view class="class_info"> <view class="class_info">
@ -161,7 +165,7 @@
平均成绩/ 平均成绩/
</view> </view>
<view class="class_info_bot"> <view class="class_info_bot">
21 {{ item.avgScore }}
</view> </view>
</view> </view>
<view class="class_info"> <view class="class_info">
@ -169,62 +173,26 @@
作业完成度 作业完成度
</view> </view>
<view class="class_info_bot"> <view class="class_info_bot">
80% <!-- {{ calculatePercentage(item.workCompletionDegree, item.totalMembers) }} -->
{{ calculatePercentage(2, 10) }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="class_card"> <view style="width: 100%;height: 50rpx;">
<view class="class_card_top">
<view class="class_card_left">
<image src=" https://file.langsi.online/yasiimg/web/static/udWNTRG6GulmTtgPRQ49"></image>
</view>
<view class="class_card_right">
<view class="class_card_right_top">
雅思1班
</view>
<view class="class_card_right_bot">
标签文字
</view>
</view>
</view>
<view class="class_infobox">
<view class="class_info"
style="width:90rpx ;">
<view class="class_info_top">
班级人数
</view>
<view class="class_info_bot">
21
</view>
</view>
<view class="class_info">
<view class="class_info_top">
平均成绩/
</view>
<view class="class_info_bot">
21
</view>
</view>
<view class="class_info">
<view class="class_info_top">
作业完成度
</view>
<view class="class_info_bot">
80%
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="overlay" v-if="false"> <view class="overlay"
<view class="addstudent" v-show="false"> v-if="false">
<view class="addstudent"
<view class="close" > v-show="false">
<image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89" ></image>
<view class="close">
<image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89"></image>
</view> </view>
<view class="addstudent_tit"> <view class="addstudent_tit">
添加学生 添加学生
</view> </view>
@ -233,7 +201,10 @@
学员名称 学员名称
</view> </view>
<view class="addstudent_input"> <view class="addstudent_input">
<input type="text" placeholder="搜索相关内容..." class="input" placeholder-style="color:#C7CDD3;font-size: 24rpx; "> <input type="text"
placeholder="搜索相关内容..."
class="input"
placeholder-style="color:#C7CDD3;font-size: 24rpx; ">
</view> </view>
</view> </view>
<view class="addstudent_input_box"> <view class="addstudent_input_box">
@ -241,19 +212,23 @@
学员ID 学员ID
</view> </view>
<view class="addstudent_input"> <view class="addstudent_input">
<input type="text" placeholder="搜索相关内容..." class="input" placeholder-style="color:#C7CDD3;font-size: 24rpx; "> <input type="text"
placeholder="搜索相关内容..."
class="input"
placeholder-style="color:#C7CDD3;font-size: 24rpx; ">
</view> </view>
</view> </view>
<view class="addbtn"> <view class="addbtn">
添加 添加
</view> </view>
</view> </view>
<view class="addtip" v-show="false"> <view class="addtip"
<view class="logo" > v-show="false">
<image src="https://file.langsi.online/yasiimg/web/static/uxsaoHOpSUoxnX7lU3Fe" ></image> <view class="logo">
<image src="https://file.langsi.online/yasiimg/web/static/uxsaoHOpSUoxnX7lU3Fe"></image>
</view> </view>
<view class="close" > <view class="close">
<image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89" ></image> <image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89"></image>
</view> </view>
已添加成功 已添加成功
</view> </view>
@ -271,29 +246,59 @@ export default {
data() { data() {
return { return {
shownocont: false, shownocont: false,
bgc: {
backgroundColor: "#F6F9FC",
},
checkindex: 1, checkindex: 1,
isDropdownOpen: true, isDropdownOpen: true,
classlist: {},
isloding:true,
} }
}, },
onLoad(option) { onLoad(option) {
this.getclassList()
}, },
methods: { methods: {
calculatePercentage(value1, value2) {
if (value2 === 0) {
console.log("value2 is zero, cannot calculate percentage");
return '0%'; //
}
return ((value1 / value2) * 100).toFixed(0) + '%';
},
toggleDropdown() { toggleDropdown() {
this.isDropdownOpen = !this.isDropdownOpen; this.isDropdownOpen = !this.isDropdownOpen;
}, },
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
}
})
},
getstuList() {
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
}
})
}
} }
} }
</script> </script>
<style lang="scss" > <style lang="scss" >
page {
background: linear-gradient(180deg, #E1EEFF 0%, #FFFFFF 100%);
}
.view_body { .view_body {
width: 750rpx; width: 750rpx;
background: #F6F9FC;
.nocont { .nocont {
margin-top: 340rpx; margin-top: 340rpx;
@ -498,7 +503,7 @@ page {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
align-items: center; align-items: center;
// justify-content: space-around; // justify-content: space-around;
.class_box_top_cont { .class_box_top_cont {
@ -518,30 +523,33 @@ page {
margin-left: 8rpx; margin-left: 8rpx;
font-size: 18rpx; font-size: 18rpx;
} }
.dropdown_box{
.dropdown_box {
left: 0; left: 0;
top: 100%; top: 100%;
position: absolute; position: absolute;
width: 160rpx; width: 160rpx;
// height: 204rpx; // height: 204rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0,0,0,0.25); box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.25);
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
.dropdown_item:last-child{
border-bottom: 0rpx solid #FFFFFF; .dropdown_item:last-child {
border-bottom: 0rpx solid #FFFFFF;
} }
.dropdown_item{
.dropdown_item {
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
font-size: 20rpx; font-size: 20rpx;
font-family: 'PingFang', 'PingFang'; font-family: 'PingFang', 'PingFang';
font-weight: 500; font-weight: 500;
color: rgba(46,73,117,0.6); color: rgba(46, 73, 117, 0.6);
border-bottom: 2rpx solid #F3F3F3; border-bottom: 2rpx solid #F3F3F3;
} }
} }
} }
@ -632,7 +640,7 @@ page {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -648,13 +656,15 @@ page {
height: 632rpx; height: 632rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
.close{
.close {
top: 20rpx; top: 20rpx;
right: 20rpx; right: 20rpx;
position: absolute; position: absolute;
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
} }
.addstudent_tit { .addstudent_tit {
width: 100%; width: 100%;
text-align: center; text-align: center;
@ -663,25 +673,29 @@ page {
font-weight: 800; font-weight: 800;
color: #2E4975; color: #2E4975;
line-height: 36rpx; line-height: 36rpx;
}
.addstudent_input_box{
margin-top: 40rpx;
.addstudent_input_tit{
font-size: 28rpx;
font-family: 'PingFang';
font-weight: 500;
color: #2E4975;
}
.addstudent_input{
margin-top: 16rpx;
width: 520rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #DDE2EE; }
.input {
.addstudent_input_box {
margin-top: 40rpx;
.addstudent_input_tit {
font-size: 28rpx;
font-family: 'PingFang';
font-weight: 500;
color: #2E4975;
}
.addstudent_input {
margin-top: 16rpx;
width: 520rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #DDE2EE;
.input {
// margin-left: 24rpx; // margin-left: 24rpx;
width: 520rpx; width: 520rpx;
height: 80rpx; height: 80rpx;
@ -702,9 +716,10 @@ page {
box-sizing: border-box; box-sizing: border-box;
} }
} }
} }
.addbtn{
.addbtn {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -713,15 +728,16 @@ page {
height: 88rpx; height: 88rpx;
background: #2D7CE6; background: #2D7CE6;
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
font-size: 28rpx; font-size: 28rpx;
font-family:'PingFang'; font-family: 'PingFang';
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
} }
} }
.addtip{
.addtip {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
@ -734,18 +750,20 @@ page {
color: #2D7CE6; color: #2D7CE6;
background: linear-gradient(180deg, #C2DCFF 0%, #FFFFFF 100%); background: linear-gradient(180deg, #C2DCFF 0%, #FFFFFF 100%);
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
.logo{
.logo {
position: absolute; position: absolute;
width: 182rpx; width: 182rpx;
height: 244rpx; height: 244rpx;
top: -244rpx; top: -244rpx;
left: 130rpx; left: 130rpx;
} }
.close{
.close {
position: absolute; position: absolute;
top: 10rpx; top: 10rpx;
right: 20rpx; right: 20rpx;
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
} }

View File

@ -98,7 +98,7 @@
this.studentNames = studentNames; this.studentNames = studentNames;
this.generateNameMap() this.generateNameMap()
console.log('运行了'); console.log('运行了',this.studentNames);
}, },
generateNameMap() { generateNameMap() {
const nameMap = {}; const nameMap = {};