From 236299f592461c7d4665d546123a621971eded3b Mon Sep 17 00:00:00 2001 From: taoxu <2622874537@qq.com> Date: Wed, 6 Dec 2023 10:06:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 3 +- pages/Mystudent/student.vue | 234 ++++++++++++++++++---------------- pages/compoents/indexList.vue | 2 +- 3 files changed, 129 insertions(+), 110 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 82a2f35..5dc3230 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -41,9 +41,10 @@ const install = (Vue, vm) => { // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 // const token = uni.getStorageSync('token'); - const token = "Bearer aca170b01b4b4c88b3629fde91a3b2b7" + const token = " Bearer a75c44e23b7740c48740c95ae3b7b427" // console.log("我是token", token) config.header.Authorization = token; + // config.header.Tenant-Id=1 // #ifdef H5 config.header.Authorization = 'Bearer '+token; // #endif diff --git a/pages/Mystudent/student.vue b/pages/Mystudent/student.vue index e082b66..92f9981 100644 --- a/pages/Mystudent/student.vue +++ b/pages/Mystudent/student.vue @@ -1,10 +1,10 @@ <template> <view class="view_body"> <u-navbar :is-back="false" - title='学生' + title='班级' title-color="#2E4975" :border-bottom="false" - :background="true" + :background="bgc" id="navbar"> </u-navbar> <view class="nocont" @@ -96,14 +96,15 @@ class="class_box_top_cont"> 班级人数 <view class="iconfont icon-arow_down"></view> - <view class="dropdown_box"> + <view class="dropdown_box" + v-show="false"> <view class="dropdown_item"> 降序 </view> <view class="dropdown_item"> - 升序 + 升序 </view> - + </view> </view> @@ -111,7 +112,8 @@ class="class_box_top_cont"> 标签文字 <view class="iconfont icon-arow_down"></view> - <view class="dropdown_box"> + <view class="dropdown_box" + v-show="false"> <view class="dropdown_item"> 标签文字 </view> @@ -129,17 +131,19 @@ - + </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_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班 + {{ item.name }} </view> <view class="class_card_right_bot"> 标签文字 @@ -153,7 +157,7 @@ 班级人数 </view> <view class="class_info_bot"> - 21 + {{ item.classify }} </view> </view> <view class="class_info"> @@ -161,7 +165,7 @@ 平均成绩/分 </view> <view class="class_info_bot"> - 21 + {{ item.avgScore }} </view> </view> <view class="class_info"> @@ -169,62 +173,26 @@ 作业完成度 </view> <view class="class_info_bot"> - 80% + <!-- {{ calculatePercentage(item.workCompletionDegree, item.totalMembers) }} --> + {{ calculatePercentage(2, 10) }} </view> </view> </view> </view> - <view class="class_card"> - <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 style="width: 100%;height: 50rpx;"> + </view> </view> </view> - <view class="overlay" v-if="false"> - <view class="addstudent" v-show="false"> - - <view class="close" > - <image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89" ></image> + <view class="overlay" + v-if="false"> + <view class="addstudent" + v-show="false"> + + <view class="close"> + <image src="https://file.langsi.online/yasiimg/web/static/uSzPsPoFgoVwcsl7pJ89"></image> </view> - + <view class="addstudent_tit"> 添加学生 </view> @@ -233,7 +201,10 @@ 学员名称 </view> <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 class="addstudent_input_box"> @@ -241,19 +212,23 @@ 学员ID </view> <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 class="addbtn"> 添加 </view> </view> - <view class="addtip" v-show="false"> - <view class="logo" > - <image src="https://file.langsi.online/yasiimg/web/static/uxsaoHOpSUoxnX7lU3Fe" ></image> + <view class="addtip" + v-show="false"> + <view class="logo"> + <image src="https://file.langsi.online/yasiimg/web/static/uxsaoHOpSUoxnX7lU3Fe"></image> </view> - <view class="close" > - <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> @@ -271,29 +246,59 @@ export default { data() { return { shownocont: false, + bgc: { + backgroundColor: "#F6F9FC", + }, checkindex: 1, isDropdownOpen: true, + classlist: {}, + isloding:true, } }, onLoad(option) { - + this.getclassList() }, methods: { + calculatePercentage(value1, value2) { + if (value2 === 0) { + console.log("value2 is zero, cannot calculate percentage"); + return '0%'; // 或者返回其他默认值 + } + + return ((value1 / value2) * 100).toFixed(0) + '%'; + }, toggleDropdown() { 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> <style lang="scss" > -page { - background: linear-gradient(180deg, #E1EEFF 0%, #FFFFFF 100%); -} - .view_body { width: 750rpx; + background: #F6F9FC; .nocont { margin-top: 340rpx; @@ -498,7 +503,7 @@ page { display: flex; flex-wrap: nowrap; align-items: center; - + // justify-content: space-around; .class_box_top_cont { @@ -518,30 +523,33 @@ page { margin-left: 8rpx; font-size: 18rpx; } - .dropdown_box{ + + .dropdown_box { left: 0; top: 100%; position: absolute; width: 160rpx; // height: 204rpx; 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; - .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; font-size: 20rpx; font-family: 'PingFang', 'PingFang'; font-weight: 500; - color: rgba(46,73,117,0.6); - border-bottom: 2rpx solid #F3F3F3; + color: rgba(46, 73, 117, 0.6); + border-bottom: 2rpx solid #F3F3F3; } } } - + @@ -632,7 +640,7 @@ page { display: flex; justify-content: center; align-items: center; - + position: fixed; top: 0; left: 0; @@ -648,13 +656,15 @@ page { height: 632rpx; background: #FFFFFF; border-radius: 20rpx 20rpx 20rpx 20rpx; - .close{ + + .close { top: 20rpx; right: 20rpx; position: absolute; width: 20rpx; height: 20rpx; } + .addstudent_tit { width: 100%; text-align: center; @@ -663,25 +673,29 @@ page { font-weight: 800; color: #2E4975; 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; width: 520rpx; height: 80rpx; @@ -702,9 +716,10 @@ page { box-sizing: border-box; } - } + } } - .addbtn{ + + .addbtn { display: flex; align-items: center; justify-content: center; @@ -713,15 +728,16 @@ page { height: 88rpx; background: #2D7CE6; border-radius: 20rpx 20rpx 20rpx 20rpx; - + font-size: 28rpx; - font-family:'PingFang'; + font-family: 'PingFang'; font-weight: 500; color: #FFFFFF; } } - .addtip{ + + .addtip { position: relative; display: flex; align-items: center; @@ -734,18 +750,20 @@ page { color: #2D7CE6; background: linear-gradient(180deg, #C2DCFF 0%, #FFFFFF 100%); border-radius: 20rpx 20rpx 20rpx 20rpx; - .logo{ + + .logo { position: absolute; width: 182rpx; height: 244rpx; top: -244rpx; left: 130rpx; } - .close{ + + .close { position: absolute; top: 10rpx; right: 20rpx; - + width: 20rpx; height: 20rpx; } diff --git a/pages/compoents/indexList.vue b/pages/compoents/indexList.vue index 694ad42..832b238 100644 --- a/pages/compoents/indexList.vue +++ b/pages/compoents/indexList.vue @@ -98,7 +98,7 @@ this.studentNames = studentNames; this.generateNameMap() - console.log('运行了'); + console.log('运行了',this.studentNames); }, generateNameMap() { const nameMap = {};