数据处理 渲染修改 逻辑修改

This commit is contained in:
taoxu 2023-12-12 00:42:01 +08:00
parent 1202742ead
commit e4fcedb6e0
9 changed files with 1770 additions and 1601 deletions

View File

@ -42,7 +42,7 @@ const install = (Vue, vm) => {
// 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值
// const token = uni.getStorageSync('token');
const token = " Bearer 0b34feaf02224ccb9d4e09730ab68c35"
const token = " Bearer e465eb9d9ae74b4dad7a63dbe0e54587"
// console.log("我是token", token)
config.header.Authorization = token;

View File

@ -62,8 +62,8 @@
}
},
onLoad(option) {
// this.classid=option.id
this.classid=15
this.classid=option.id
// this.classid=15
this.getallstu()
},
methods: {

View File

@ -95,8 +95,8 @@ export default {
}
},
onLoad(option) {
// this.classid=option.id
this.classid=15
this.classid=option.id
// this.classid=15
},
onShow() {

View File

@ -47,7 +47,7 @@
</view>
<view class="info_box">
<view class="info_cont"
style="width:90rpx ;">
style="width:80rpx ;">
<view class="info_cont_top">
学生人数
</view>

View File

@ -131,8 +131,8 @@
}
},
onLoad(option) {
/* > */ // this.classid=option.id
this.classid=15
this.classid=option.id
// this.classid=15
},
onShow(){

View File

@ -37,7 +37,7 @@
shape="circle"></u-checkbox>
</view>
</view>
<view class="partshow" v-if="tk==partitem.id">
<view class="partshow" v-if="selectedItems.includes(partitem.id)">
<view class="Part2" v-for="(quesitem,quesindex) in partitem.modules" :key="quesindex">
<view class="imaflex">
<view>{{quesitem.number}} {{quesitem.typeText}}</view>
@ -66,6 +66,8 @@
image: true,
tk: null,
selectwrite: [],
selectedItems: [],
}
},
@ -93,6 +95,23 @@
this.itemActive = activeindex;
this.updateSubsetsInListHearing()
console.log(this.listHearing, "this.itemActivethis.itemActive");
const uniquePartIds = new Set();
// Loop through listHearing and collect unique part IDs
this.listHearing.forEach((paper) => {
paper.tests.forEach((test) => {
test.parts.forEach((part) => {
const hasSelectedQuesitem = part.modules.some((quesitem) => quesitem.subsets);
if (hasSelectedQuesitem) {
uniquePartIds.add(part.id);
}
});
});
});
// Convert the Set to an array and update selectedItems
this.selectedItems = Array.from(uniquePartIds);
});
},
Bages_addActive(TextIndex, id) {
@ -101,12 +120,12 @@
},
icon(id) {
this.image = !this.image;
this.tk = id;
if (this.image == false) {
this.tk = id;
if (this.image) {
this.selectedItems = this.selectedItems.filter(item => item !== id);
} else {
this.tk = null;
this.selectedItems.push(id);
}
console.log(this.selectedItems,'this.selectedItemsthis.selectedItems');
},
checkboxChange(partitem, e) {
if (e.value) {

View File

@ -37,7 +37,7 @@
shape="circle"></u-checkbox>
</view>
</view>
<view class="partshow" v-if="tk==partitem.id">
<view class="partshow" v-if="selectedItems.includes(partitem.id)">
<view class="Part2" v-for="(quesitem,quesindex) in partitem.modules" :key="quesindex">
<view class="imaflex">
<view>{{quesitem.number}}{{quesitem.typeText}}</view>
@ -66,6 +66,7 @@
image: true,
tk: null,
selectwrite: [],
selectedItems: [],
}
},
@ -91,6 +92,24 @@
}
this.itemActive = activeindex
this.updateSubsetsInListHearing()
const uniquePartIds = new Set();
// Loop through listHearing and collect unique part IDs
this.listHearing.forEach((paper) => {
paper.tests.forEach((test) => {
test.parts.forEach((part) => {
const hasSelectedQuesitem = part.modules.some((quesitem) => quesitem.subsets);
if (hasSelectedQuesitem) {
uniquePartIds.add(part.id);
}
});
});
});
// Convert the Set to an array and update selectedItems
this.selectedItems = Array.from(uniquePartIds);
console.log( this.selectedItems ,' this.selectedItems ');
})
},
// test
@ -100,13 +119,13 @@
},
//
icon(id) {
this.image = !this.image
this.tk = id
if (this.image == false) {
this.tk = id
this.image = !this.image;
if (this.image) {
this.selectedItems = this.selectedItems.filter(item => item !== id);
} else {
this.tk = null
this.selectedItems.push(id);
}
console.log(this.selectedItems,'this.selectedItemsthis.selectedItems');
},
checkboxChange(partitem, e) {
if (e.value) {
@ -200,6 +219,8 @@
});
});
});
console.log(this.selectwrite,'selectwriteselectwrite');
},
// selectwrite

View File

@ -1,21 +1,14 @@
<template>
<view class="concent">
<view class="view_body">
<u-navbar :is-back="true"
title='添加作业'
title-color="#000"
:border-bottom="false"
:background="bgc"
<u-navbar :is-back="true" title='添加作业' title-color="#000" :border-bottom="false" :background="bgc"
id="navbar">
</u-navbar>
<view class="view_header">
<view class="view_title">标题</view>
<view class="view_input">
<u-form-item prop="value">
<u-input v-model="worktit"
:type="type"
:border="border"
placeholder="输入作业标题" />
<u-input v-model="worktit" :type="type" :border="border" placeholder="输入作业标题" />
</u-form-item>
</view>
</view>
@ -23,39 +16,32 @@
<view>
<view class="view_tubiao">
<view class="view_title">班级安排</view>
<view class="view_tb"
@click="addclass()">
<view class="view_tb" @click="addclass()">
+
</view>
</view>
<view class="noting"
v-if="classinfo.length <= 0">
<view class="noting" v-if="classinfo.length <= 0">
<image src="https://file.langsi.online/yasiimg/web/static/ulqScWZvBYd22CW5uV0H"></image>
<view class="text1">
暂未安排哦
</view>
<view class="text2"
@click="addclass()">
<view class="text2" @click="addclass()">
去安排
</view>
</view>
<view class="class_bj">
<view class="class_images">
<view class="class_ys"
v-for="(item, index) in classinfo"
:key="index"
<view class="class_ys" v-for="(item, index) in classinfo" :key="index"
style="position: relative;">
<view class="close"
style="position: absolute;top: 0rpx;right: 8rpx;width: 20rpx;height: 20rpx;"
@click="delcls(item.id)">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE"
mode="">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE" mode="">
</image>
</view>
<view class="class_tp">
<image src="https://file.langsi.online/yasiimg/web/static/u4T48EWFfk5p6yrV3gOw"
mode="">
<image src="https://file.langsi.online/yasiimg/web/static/u4T48EWFfk5p6yrV3gOw" mode="">
</image>
</view>
<view class="class_wz">{{ item.name }}</view>
@ -69,39 +55,32 @@
<view>
<view class="view_tubiao">
<view class="view_title">学员安排</view>
<view class="view_tb"
@click="toaddstu()">
<view class="view_tb" @click="toaddstu()">
+
</view>
</view>
<view class="noting"
v-if="stuinfo.length <= 0">
<view class="noting" v-if="stuinfo.length <= 0">
<image src="https://file.langsi.online/yasiimg/web/static/ulqScWZvBYd22CW5uV0H"></image>
<view class="text1">
暂未安排哦
</view>
<view class="text2"
@click="toaddstu()">
<view class="text2" @click="toaddstu()">
去安排
</view>
</view>
<view class="class_bj">
<view class="class_images">
<view class="class_ys"
v-for="(item, index) in stuinfo"
:key="index"
<view class="class_ys" v-for="(item, index) in stuinfo" :key="index"
style="position: relative;">
<view class="close"
style="position: absolute;top: 0rpx;right: 8rpx;width: 20rpx;height: 20rpx;"
@click="delstu(item.id)">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE"
mode="">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE" mode="">
</image>
</view>
<view class="class_tp">
<image :src="item.avatar"
mode=""></image>
<image :src="item.avatar" mode=""></image>
</view>
<view class="class_wz">{{ item.name }}</view>
</view>
@ -126,14 +105,12 @@
<view
style="background-color: #fff; padding: 32rpx 40rpx;border-radius: 20rpx 20rpx 20rpx 20rpx;">
<u-time-line>
<u-time-line-item nodeTop="2"
v-for="(items,indexs) in item.message" :key="indexs">
<u-time-line-item nodeTop="2" v-for="(items,indexs) in item.message" :key="indexs">
<template v-slot:content>
<view>
<view style="display: flex;flex-wrap: nowrap;">
<view class="Test"
>{{items.testname}}</view>
<view class="Test">{{items.testname}}</view>
<view class="ellipses">阅读</view>
@ -156,14 +133,12 @@
<view
style="background-color: #fff; padding: 32rpx 40rpx;border-radius: 20rpx 20rpx 20rpx 20rpx;">
<u-time-line>
<u-time-line-item nodeTop="2"
v-for="(items,indexs) in item.message" :key="indexs">
<u-time-line-item nodeTop="2" v-for="(items,indexs) in item.message" :key="indexs">
<template v-slot:content>
<view>
<view style="display: flex;flex-wrap: nowrap;">
<view class="Test"
>{{items.testname}}</view>
<view class="Test">{{items.testname}}</view>
<view class="greener">听力</view>
@ -186,16 +161,16 @@
<view
style="background-color: #fff; padding: 32rpx 40rpx;border-radius: 20rpx 20rpx 20rpx 20rpx;">
<u-time-line>
<u-time-line-item nodeTop="2"
v-for="(items,indexs) in item.message" :key="indexs">
<u-time-line-item nodeTop="2" v-for="(items,indexs) in item.message" :key="indexs">
<template v-slot:content>
<view>
<view style="display: flex;flex-wrap: nowrap;">
<view class="Test"
>{{items.test}}</view>
<view class="Test">{{items.test}}</view>
<view class="ellipses" style="background: rgba(63,122,242,0.2);color: #3F7AF2;">写作</view>
<view class="ellipses"
style="background: rgba(63,122,242,0.2);color: #3F7AF2;">写作
</view>
</view>
<view class="u-order-desc">
@ -215,15 +190,14 @@
<view
style="background-color: #fff; padding: 32rpx 40rpx;border-radius: 20rpx 20rpx 20rpx 20rpx;">
<u-time-line>
<u-time-line-item nodeTop="2"
v-for="(item, index) in selectspeak"
:key="index">
<u-time-line-item nodeTop="2" v-for="(item, index) in selectspeak" :key="index">
<template v-slot:content>
<view>
<view style="display: flex;flex-wrap: nowrap;">
<view class="Test"
style="width: 80%;">{{ item.part }}-{{ item.introduction }}</view>
<view class="Test" style="width: 80%;">
{{ item.part }}-{{ item.introduction }}
</view>
<view class="erotic">口语</view>
@ -231,10 +205,8 @@
<view class="u-order-desc">
<view style="display: inline;">
<view class="txt">{{ item.topicEn }}:</view>
<view v-for="(items, indexs) in item.speakingType"
:key="indexs"
class="type"
style="display: inline;">
<view v-for="(items, indexs) in item.speakingType" :key="indexs"
class="type" style="display: inline;">
<view v-if="items == 1">串题</view>
<view v-else-if="items == 2">跟读</view>
<view v-else-if="items == 3">模考</view>
@ -250,8 +222,7 @@
</view>
</view>
<!--按钮 -->
<view style="display: flex; justify-content: center; margin-top: 32rpx;"
@click="addwork()">
<view style="display: flex; justify-content: center; margin-top: 32rpx;" @click="addwork()">
<view class="increase">
<u-icon name="plus"></u-icon>
添加
@ -267,17 +238,10 @@
</view>
<view>
<view class="view_form">
<u-picker mode="time"
v-model="show"
:params="params"
@confirm="printValue"></u-picker>
<u-picker mode="time" v-model="show" :params="params" @confirm="printValue"></u-picker>
<u-form-item prop="times">
<u-input v-model="times"
:type="type"
:border="border"
placeholder="选择作业截止的时间"
@click="show = true"
placeholder-style="color: rgba(46,73,117,0.4);font-size: 24rpx;" />
<u-input v-model="times" :type="type" :border="border" placeholder="选择作业截止的时间"
@click="show = true" placeholder-style="color: rgba(46,73,117,0.4);font-size: 24rpx;" />
</u-form-item>
@ -290,21 +254,18 @@
<view class="view_title">描述</view>
</view>
<view class="view_textrea">
<textarea value=""
placeholder="输入你的描述... "
<textarea v-model="classword" placeholder="输入你的描述... "
placeholder-style="color: rgba(46,73,117,0.4);font-size: 24rpx;" />
</view>
</view>
</view>
<!-- 按钮 -->
<view class="zhanwei"
style="width: 100%;height: 230rpx;">
<view class="zhanwei" style="width: 100%;height: 230rpx;">
</view>
<view class="botbtn">
<view class="btn"
@click="addclassinfo()">
<view class="btn" @click="addclassinfo()">
确定添加
</view>
</view>
@ -312,7 +273,7 @@
</view>
</template>
<script>
export default {
export default {
data() {
return {
bgc: {
@ -325,7 +286,8 @@ export default {
day: true,
hour: true,
minute: false,
second: false
second: false,
timestamp: true
},
show: false,
radio: '',
@ -334,6 +296,7 @@ export default {
stuinfo: [],
worktit: '',
times: '',
time: 0,
selectspeak: [],
selectwrite: [],
selectlisten: [],
@ -341,19 +304,22 @@ export default {
selectwritelist: [],
selectlistenlist: [],
selectreadlist: [],
classword: 'aaa',
mocktype:'0'
}
},
onLoad(option) {
uni.removeStorageSync('selectedClassInfo');
uni.removeStorageSync('selectedStuInfo');
// this.classinfo=JSON.parse(decodeURIComponent(option.classinfo))
let classinofs = [{
name: '阅读5班',
avatar: 'Excepteur',
id: 15,
// uni.removeStorageSync('selectedClassInfo');
// uni.removeStorageSync('selectedStuInfo');
// uni.removeStorageSync('selectforwork');
// this.classinfo = JSON.parse(decodeURIComponent(option.classinfo))
// let classinofs = [{
// name: '5',
// avatar: 'Excepteur',
// id: 15,
}]
// }]
this.classinfo = classinofs
},
@ -388,6 +354,7 @@ export default {
this.selectwrite = selectforwork.selectwrite
this.selectlisten = selectforwork.selectlisten
this.selectread = selectforwork.selectread
this.mocktype= selectforwork.mocktype
// this.selectwrite = selectforwork.selectwrite;
//
const groupedItems = {};
@ -432,7 +399,7 @@ export default {
testId: item.testId,
testname: item.testname,
typeName: item.typeName,
questionname:item. questionname,
questionname: item.questionname,
});
});
@ -459,15 +426,15 @@ export default {
testId: item.testId,
testname: item.testname,
typeName: item.typeName,
questionname:item. questionname,
questionname: item.questionname,
});
});
// Convert groupedItems object to an array
this.selectreadlist = Object.values(groupedItems2);
console.log(this.selectreadlist, 'this.selectread');
console.log(this.selectlistenlist, 'this.selectlisten');
console.log(this.selectread, 'this.selectread');
console.log(this.selectlisten, 'this.selectlisten');
// Remove duplicates from this.classinfo
// this.stuinfo = this.stuinfo.filter(item => !selectedstuInfo.some(selectedItem => selectedItem.id === item.id));
@ -484,10 +451,12 @@ export default {
selectspeak: this.selectspeak,
selectwrite: this.selectwrite,
selectlisten: this.selectlisten,
selectread: this.selectread
selectread: this.selectread,
mocktype:this.mocktype,
};
uni.navigateTo({
url: "/pages_teacher/teacher_teachers/teacher_writeadd?dataToSave=" + encodeURIComponent(JSON.stringify(dataToSave))
url: "/pages_teacher/teacher_teachers/teacher_writeadd?dataToSave=" + encodeURIComponent(JSON
.stringify(dataToSave))
}).then(res => {
}).catch(err => {
@ -502,7 +471,8 @@ export default {
},
toaddstu() {
uni.navigateTo({
url: "/pages_teacher/pages_add/add_studentsforwork?stuinfo=" + encodeURIComponent(JSON.stringify(this.stuinfo))
url: "/pages_teacher/pages_add/add_studentsforwork?stuinfo=" + encodeURIComponent(JSON
.stringify(this.stuinfo))
}).then(res => {
@ -523,16 +493,108 @@ export default {
//
printValue(e) {
this.times = `${e.year}-${e.month}-${e.day}`
// console.log(e,'timestamp: truetimestamp: true');
this.times = `${e.year}-${e.month}-${e.day}-${e.hour}`;
this.time = e.timestamp
},
submit() {
addclassinfo() {
let classIdSet = []; // class id
let studentIdSet = []; // class id
let workDetailsPageReqVOList = [];
let des =this.classword
let doneTime = this.times
let name =this.worktit
this.classinfo.forEach(item => {
classIdSet.push(item.id); // id
});
this.stuinfo.forEach(item => {
studentIdSet.push(item.id); // id
});
// classIdSet class id
// console.log(studentIdSet);
// let classIdSet
this.selectspeak.forEach(item => {
workDetailsPageReqVOList.push({
classify:'4',
questionId: item.id,
speakingType: item.speakingType.join(','), //
//
});
});
this.selectwrite.forEach(item => {
workDetailsPageReqVOList.push({
questionId: item.id,
classify:'3'
// speakingType: item.speakingType.join(','), //
//
});
});
this.selectlisten.forEach(item => {
workDetailsPageReqVOList.push({
moduleId: item.id,
testId: item.testId,
partId: item.partId,
paperId: item.paperId,
classify:'1'
// speakingType: item.speakingType.join(','), //
//
});
});
this.selectread.forEach(item => {
workDetailsPageReqVOList.push({
moduleId: item.id,
testId: item.testId,
partId: item.partId,
paperId: item.paperId,
classify:'2'
// speakingType: item.speakingType.join(','), //
//
});
});
// this.workDetailsPageReqVOList
let data={
mockType:this.mocktype,
name:name,
des:des,
doneTime:doneTime,
classIdSet:classIdSet,
studentIdSet:studentIdSet,
workDetailsPageReqVOList:workDetailsPageReqVOList
}
this.$u.post(`https://api.admin-v2.langsi.online/admin-api/classroom/work-record/add`, data).then(res => {
if (res.code === 0) {
this.$refs.uToast.show({
title: '添加成功',
type: 'success',
position:'top'
})
this.selectedIds=[]
this.fuwei()
}else{
this.$refs.uToast.show({
title: '添加失败',
type: 'error',
position:'top'
})
this.selectedIds=[]
this.fuwei()
}
});
// let json = JSON.stringify(data)
// console.log(json, 'workDetailsPageReqVOList');
}
}
}
}
</script>
<style lang="scss" scoped>
.botbtn {
.botbtn {
padding: 32rpx 32rpx 0 32rpx;
// margin-left: -32rpx;
position: fixed;
@ -557,39 +619,39 @@ export default {
background: linear-gradient(180deg, #74AFFF 0%, #2D7CE6 100%);
border-radius: 104rpx 104rpx 104rpx 104rpx;
}
}
}
// 穿
::v-deep .u-dot {
// 穿
::v-deep .u-dot {
background: #2D7CE6 !important;
}
}
.concent {
.concent {
width: 100vw;
background: linear-gradient(183deg, #F0F6FF 0%, #FAFAFA 100%);
}
}
.view_body {
.view_body {
width: 91.3%;
margin: 0 auto;
}
}
.view_title {
.view_title {
font-size: 28rpx;
font-family: 'PingFang';
font-weight: 800;
color: #2E4975;
}
}
.view_input {
.view_input {
line-height: 70rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin-top: 16rpx;
padding: 0 24rpx;
}
}
.view_tubiao {
.view_tubiao {
display: flex;
justify-content: space-between;
align-items: center;
@ -610,9 +672,9 @@ export default {
color: #F18F21;
font-size: 30rpx;
}
}
}
.noting {
.noting {
display: flex;
flex-wrap: nowrap;
align-items: center;
@ -644,37 +706,37 @@ export default {
color: #2D7CE6;
border-bottom: 2px solid #2D7CE6;
}
}
}
.class_bj {
.class_bj {
margin-top: 16rpx;
}
}
.class_images {
.class_images {
display: flex;
flex-wrap: wrap;
// justify-content: space-between;
// margin-top: 20rpx;
}
}
.class_tp {
.class_tp {
width: 56rpx;
height: 56rpx;
margin-right: 12rpx;
}
}
.Ielts {
.Ielts {
font-size: 40rpx;
font-weight: 400;
color: #2E4975;
margin: 20rpx 0;
}
}
.class_ys:nth-child(3n) {
.class_ys:nth-child(3n) {
margin-right: 0;
}
}
.class_ys {
.class_ys {
margin-top: 20rpx;
margin-right: 20rpx;
width: 215rpx;
@ -687,10 +749,10 @@ export default {
height: 96rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.class_wz {
.class_wz {
width: 125rpx;
font-size: 28rpx;
font-family: 'PingFang';
@ -699,25 +761,25 @@ export default {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.view_form {
.view_form {
padding: 0rpx 32rpx;
background: #FFFFFF;
margin-top: 16rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.view_textrea {
.view_textrea {
height: 260rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
;
margin-top: 16rpx;
padding: 28rpx 32rpx;
}
}
.view_button {
.view_button {
width: 93.1%;
margin: auto;
text-align: center;
@ -725,9 +787,9 @@ export default {
background: linear-gradient(180deg, #74AFFF 0%, #2D7CE6 100%);
border-radius: 104rpx 104rpx 104rpx 104rpx;
color: #FFFFFF;
}
}
.view_footer {
.view_footer {
width: 100%;
padding: 0 16rpx;
height: 144rpx;
@ -736,9 +798,9 @@ export default {
background-color: #fff;
box-shadow: 0rpx -10rpx 16rpx 0rpx rgba(202, 202, 202, 0.25);
margin-top: 8rpx;
}
}
.u-node {
.u-node {
width: 44rpx;
height: 44rpx;
border-radius: 100rpx;
@ -746,9 +808,9 @@ export default {
justify-content: center;
align-items: center;
background: #d0d0d0;
}
}
.u-order-desc {
.u-order-desc {
display: block;
// flex-wrap: nowrap;
padding: 20rpx;
@ -762,37 +824,37 @@ export default {
font-weight: 500;
color: #2E4975;
}
}
}
.u-order-time {
.u-order-time {
color: rgb(200, 200, 200);
font-size: 26rpx;
}
}
.yuandi {
.yuandi {
width: 18rpx;
height: 18rpx;
background: #2D7CE6;
border-radius: 24rpx 24rpx 24rpx 24rpx;
}
}
.Test {
.Test {
font-size: 28rpx;
font-weight: 800;
color: #2E4975;
margin-left: 12rpx;
}
}
.ellipses {
.ellipses {
font-size: 20rpx;
background: rgba(242, 170, 2, 0.2);
margin-left: 12rpx;
padding: 8rpx 20rpx;
color: #F2AA02;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.erotic {
.erotic {
display: flex;
justify-content: center;
align-items: center;
@ -804,22 +866,22 @@ export default {
// padding: 8rpx 20rpx;
color: #F23FEB;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.greener {
.greener {
font-size: 20rpx;
background: rgba(27, 225, 178, 0.1);
margin-left: 12rpx;
padding: 8rpx 20rpx;
color: #1BE1B2;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.increase {
.increase {
padding: 26rpx 125rpx;
color: #FFFFFF;
background-color: #F39852;
border-radius: 20rpx 20rpx 20rpx 20rpx;
text-align: center;
}
}
</style>

View File

@ -1,23 +1,13 @@
<template>
<view class="view_template">
<view class="view_body">
<u-navbar :is-back="true"
title='添加作业'
title-color="#000"
:border-bottom="false"
:background="true"
<u-navbar :is-back="true" title='添加作业' title-color="#000" :border-bottom="false" :background="true"
id="navbar">
</u-navbar>
<!-- 搜索 -->
<view class="view_search"
v-if="search">
<u-search v-model="searchKeyword"
:show-action="false"
:animation="true"
bg-color="#fff"
placeholder="搜索相关内容..."
color="#3E97FF"
@input="searchs()"></u-search>
<view class="view_search" v-if="search">
<u-search v-model="searchKeyword" :show-action="false" :animation="true" bg-color="#fff"
placeholder="搜索相关内容..." color="#3E97FF" @input="searchs()"></u-search>
</view>
<!-- <view class="serchbox">
<view class="serchimg">
@ -34,50 +24,35 @@
</view> -->
<!--导航栏 -->
<view class="view_tabs">
<u-tabs :list="list"
:is-scroll="false"
:current="current"
@change="change"
active-color="#2D7CE6"
<u-tabs :list="list" :is-scroll="false" :current="current" @change="change" active-color="#2D7CE6"
bg-color="0"></u-tabs>
</view>
<!-- 轮播图 -->
<swiper :interval="5000"
:duration="1000"
is-scroll="true"
:current="current"
@change="updateCurrent"
<swiper :interval="5000" :duration="1000" is-scroll="true" :current="current" @change="updateCurrent"
class="swiper">
<!-- 口语 -->
<swiper-item style="height: 300rpx;">
<view>
<view class="view_left">
<view class="view_left_pd"
@click="arrow_xl">
<view class="view_left_pd" @click="arrow_xl">
<view class="pull_down">
<view>{{ selectedOption }}</view>
<u-icon name="arrow-down"
size="22"></u-icon>
<u-icon name="arrow-down" size="22"></u-icon>
</view>
<view class="pull_Down"
v-if="arrow">
<view v-for="(item, index) in options"
:key="index"
@click="arrow_options(item.id)">{{ item.name }}</view>
<view class="pull_Down" v-if="arrow">
<view v-for="(item, index) in options" :key="index" @click="arrow_options(item.id)">
{{ item.name }}</view>
</view>
</view>
</view>
<!-- 口语主体 -->
<view v-for="(item, index) in slanderpart1" v-if="selectedOption=='Part1'"
:key="index">
<view v-for="(item, index) in slanderpart1" v-if="selectedOption=='Part1'" :key="index">
<view class="view_inuygs">
<view class="header_part">
<view class="unite">{{ item.label }}</view>
</view>
<view class="bottom_one"
v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="bottom_one" v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list" :key='indexs'>
<view :class="{ 'active': items.ischuanti === true }"
@click="updateSelectspeak(items, 'ischuanti', indexs)">串题</view>
<view :class="{ 'active': items.isgendu === true }"
@ -88,11 +63,8 @@
</view>
<!-- part1-->
<view class="slander_for"
v-if="item.list.length > 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length > 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual" v-html="highlightSearch( items.topicEn)">
</view>
@ -107,11 +79,8 @@
</view>
</view>
<!-- part2-->
<view class="slander_for"
v-if="item.list.length <= 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length <= 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual2" v-html="highlightSearch( items.topicEn)">
</view>
@ -119,16 +88,13 @@
</view>
</view>
<!-- part2 -->
<view v-for="(item, index) in slanderpart2" v-if="selectedOption=='Part2'"
:key="index">
<view v-for="(item, index) in slanderpart2" v-if="selectedOption=='Part2'" :key="index">
<view class="view_inuygs">
<view class="header_part">
<view class="unite">{{ item.label }}</view>
</view>
<view class="bottom_one"
v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="bottom_one" v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list" :key='indexs'>
<view :class="{ 'active': items.ischuanti === true }"
@click="updateSelectspeak(items, 'ischuanti', indexs)">串题</view>
<view :class="{ 'active': items.isgendu === true }"
@ -139,11 +105,8 @@
</view>
<!-- part1-->
<view class="slander_for"
v-if="item.list.length > 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length > 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual" v-html="highlightSearch( items.topicEn)">
</view>
@ -158,11 +121,8 @@
</view>
</view>
<!-- part2-->
<view class="slander_for"
v-if="item.list.length <= 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length <= 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual2" v-html="highlightSearch( items.topicEn)">
</view>
@ -170,16 +130,13 @@
</view>
</view>
<!-- part3 -->
<view v-for="(item, index) in slanderpart3" v-if="selectedOption=='Part3'"
:key="index">
<view v-for="(item, index) in slanderpart3" v-if="selectedOption=='Part3'" :key="index">
<view class="view_inuygs">
<view class="header_part">
<view class="unite">{{ item.label }}</view>
</view>
<view class="bottom_one"
v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="bottom_one" v-if="item.list.length <= 1"
v-for="(items, indexs) in item.list" :key='indexs'>
<view :class="{ 'active': items.ischuanti === true }"
@click="updateSelectspeak(items, 'ischuanti', indexs)">串题</view>
<view :class="{ 'active': items.isgendu === true }"
@ -190,11 +147,8 @@
</view>
<!-- part1-->
<view class="slander_for"
v-if="item.list.length > 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length > 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual" v-html="highlightSearch( items.topicEn)">
</view>
@ -209,11 +163,8 @@
</view>
</view>
<!-- part2-->
<view class="slander_for"
v-if="item.list.length <= 1">
<view class="slander_of"
v-for="(items, indexs) in item.list"
:key='indexs'>
<view class="slander_for" v-if="item.list.length <= 1">
<view class="slander_of" v-for="(items, indexs) in item.list" :key='indexs'>
<view class="textual2" v-html="highlightSearch( items.topicEn)">
</view>
@ -239,23 +190,22 @@
</swiper>
</view>
<!-- 底部按钮 -->
<view :class="search == true ? 'footer2' : 'footer'"
v-if="totalLength != 0">
<view class="footer_button" @click="submessage()">
<view :class="search == true ? 'button_andadd' : 'button_show'">确定添加{{ totalLength }}</view>
<view class="footer_button_right"
v-if="search">口语模考</view>
<view :class="search == true ? 'footer2' : 'footer'" v-if="totalLength != 0">
<view class="footer_button">
<view :class="search == true ? 'button_andadd' : 'button_show'" @click="submessage()">确定添加{{ totalLength }}</view>
<view class="footer_button_right" v-if="search" :class="mocktype==1?'act1':''" @click="ismock()">口语模考</view>
</view>
</view>
</view>
</view></template>
</view>
</template>
<script>
import audiology from './components/audiology.vue'
import reading from './components/reading.vue'
import slander from './components/slander.vue'
import compose from './components/compose.vue'
export default {
import audiology from './components/audiology.vue'
import reading from './components/reading.vue'
import slander from './components/slander.vue'
import compose from './components/compose.vue'
export default {
data() {
return {
//
@ -333,7 +283,8 @@ export default {
selectspeak: [],
selectwrite: [],
selectlisten: [],
selectread: []
selectread: [],
mocktype:'0',
}
},
components: {
@ -346,40 +297,54 @@ export default {
},
onLoad(option) {
const dataToSave =JSON.parse(decodeURIComponent(option.dataToSave))
this.selectspeak=dataToSave.selectspeak
this.selectwrite=dataToSave.selectwrite
this.selectlisten=dataToSave.selectlisten
this.selectread=dataToSave.selectread
if(option!=undefined){
const dataToSave = JSON.parse(decodeURIComponent(option.dataToSave))
this.selectspeak = dataToSave.selectspeak
this.selectwrite = dataToSave.selectwrite
this.selectlisten = dataToSave.selectlisten
this.selectread = dataToSave.selectread
this.mocktype=dataToSave.mocktype
this.$refs.compose.updatawrite(this.selectwrite)
this.$refs.audiology.updatawrite(this.selectlisten)
this.$refs.reading.updatawrite(this.selectread)
this.calculateTotalLength()
console.log(dataToSave,'optionoptionoptionoptionoptionoption');
}
},
methods: {
updatawrite(data){
this.selectwrite=data
ismock(){
console.log(this.mocktype,'this.mocktype');
if(this.mocktype=="0"){
this.mocktype='1'
}else if(this.mocktype=="1"){
this.mocktype='0'
}
},
updatawrite(data) {
this.selectwrite = data
console.log(this.selectwrite, ' this.selectwrite this.selectwrite');
this.calculateTotalLength()
},
updataread(data){
this.selectread=data
updataread(data) {
this.selectread = data
console.log(this.selectread, ' this.selectwrite this.selectwrite');
this.calculateTotalLength()
},
updatalisten(data){
this.selectlisten=data
updatalisten(data) {
this.selectlisten = data
console.log(this.selectlisten, ' this.selectwrite this.selectwrite');
this.calculateTotalLength()
},
submessage(){
submessage() {
const dataToSave = {
selectspeak: this.selectspeak,
selectwrite: this.selectwrite,
selectlisten: this.selectlisten,
selectread: this.selectread
selectread: this.selectread,
mocktype:this.mocktype,
};
//
@ -405,7 +370,7 @@ export default {
// });
},
searchs() {
if(this.selectedOption=='Part1'){
if (this.selectedOption == 'Part1') {
const filteredSlander = [];
// 使
@ -436,7 +401,7 @@ export default {
// this.slander
this.slanderpart1 = filteredSlander;
}else if(this.selectedOption=='Part2'){
} else if (this.selectedOption == 'Part2') {
const filteredSlander = [];
// 使
@ -467,7 +432,7 @@ export default {
// this.slander
this.slanderpart2 = filteredSlander;
}else if(this.selectedOption=='Part3'){
} else if (this.selectedOption == 'Part3') {
const filteredSlander = [];
// 使
@ -511,7 +476,8 @@ export default {
return name;
},
calculateTotalLength() {
this.totalLength = this.selectspeak.length + this.selectwrite.length + this.selectlisten.length + this.selectread.length;
this.totalLength = this.selectspeak.length + this.selectwrite.length + this.selectlisten.length + this
.selectread.length;
},
calculateTotal(array) {
@ -601,7 +567,7 @@ export default {
}
},
getList() {
let postdata= {
let postdata = {
"key": "",
"pageNum": 0,
"mode": "home",
@ -615,10 +581,10 @@ export default {
"level": 0,
"isNew": 0
}
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata).then(res => {
if(res.code==0){
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata).then(
res => {
if (res.code == 0) {
this.getpart2()
}
let keyArr = Object.keys(res.data)
let valueArr = Object.values(res.data)
this.slanderpart1 = keyArr.map((item, index) => {
@ -633,8 +599,13 @@ export default {
list: valueArr[index]
}
})
this.originslanderpart1part1 = JSON.parse(JSON.stringify(this.originslanderpart1part1));
this.originslanderpart1part1 = JSON.parse(JSON.stringify(this.originslanderpart1));
let json = JSON.stringify(res.data)
this.updatapart1()
}
// console.log(json);
})
@ -642,8 +613,37 @@ export default {
},
getpart2(){
let postdata1= {
updatapart1() {
console.log('调用了');
// Iterate through each item in selectspeak
this.selectspeak.forEach(selectItem => {
// Find the corresponding item in slanderpart1
const slanderItem = this.slanderpart1.find(slanderItem =>
slanderItem.list.some(item => item.id === selectItem.id)
);
console.log(slanderItem, 'slanderItemslanderItem');
// If a corresponding item is found, update properties based on speakingType
if (slanderItem) {
const listItemIndex = slanderItem.list.findIndex(item => item.id === selectItem.id);
if (listItemIndex !== -1) {
// Use Vue.set to ensure reactivity when updating array elements by index
this.$set(slanderItem.list, listItemIndex, {
...slanderItem.list[listItemIndex],
ischuanti: selectItem.speakingType.includes('1'),
isgendu: selectItem.speakingType.includes('2'),
ismk: selectItem.speakingType.includes('3'),
});
}
}
});
console.log(this.slanderpart1, 'slanderpart1slanderpart1slanderpart1');
//
// console.log('Matching contents:', matchingContents);
},
getpart2() {
let postdata1 = {
"key": "",
"pageNum": 0,
"mode": "home",
@ -657,8 +657,9 @@ export default {
"level": 0,
"isNew": 0
}
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata1).then(res => {
if(res.code==0){
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata1).then(
res => {
if (res.code == 0) {
this.getpart3()
}
let keyArr = Object.keys(res.data)
@ -669,19 +670,50 @@ export default {
list: valueArr[index]
}
})
this.originslanderpart2 = keyArr.map((item, index) => {
return {
label: item,
list: valueArr[index]
}
})
this.updatapart2()
this.originslanderpart2 = JSON.parse(JSON.stringify(this.originslanderpart2));
// let json = JSON.stringify(res.data)
})
},
getpart3(){
let postdata2= {
updatapart2() {
console.log('调用了');
// Iterate through each item in selectspeak
this.selectspeak.forEach(selectItem => {
// Find the corresponding item in slanderpart1
const slanderItem = this.slanderpart2.find(slanderItem =>
slanderItem.list.some(item => item.id === selectItem.id)
);
console.log(slanderItem, 'slanderItemslanderItem');
// If a corresponding item is found, update properties based on speakingType
if (slanderItem) {
const listItemIndex = slanderItem.list.findIndex(item => item.id === selectItem.id);
if (listItemIndex !== -1) {
// Use Vue.set to ensure reactivity when updating array elements by index
this.$set(slanderItem.list, listItemIndex, {
...slanderItem.list[listItemIndex],
ischuanti: selectItem.speakingType.includes('1'),
isgendu: selectItem.speakingType.includes('2'),
ismk: selectItem.speakingType.includes('3'),
});
}
}
});
//
// console.log('Matching contents:', matchingContents);
},
getpart3() {
let postdata2 = {
"key": "",
"pageNum": 0,
"mode": "home",
@ -695,7 +727,8 @@ export default {
"level": 0,
"isNew": 0
}
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata2).then(res => {
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata2).then(
res => {
let keyArr = Object.keys(res.data)
let valueArr = Object.values(res.data)
this.slanderpart3 = keyArr.map((item, index) => {
@ -710,11 +743,41 @@ export default {
list: valueArr[index]
}
})
this.updatapart3()
this.originslanderpart3 = JSON.parse(JSON.stringify(this.originslanderpart3));
let json = JSON.stringify(res.data)
// console.log(json);
})
},
updatapart3() {
console.log('调用了');
// Iterate through each item in selectspeak
this.selectspeak.forEach(selectItem => {
// Find the corresponding item in slanderpart1
const slanderItem = this.slanderpart2.find(slanderItem =>
slanderItem.list.some(item => item.id === selectItem.id)
);
console.log(slanderItem, 'slanderItemslanderItem');
// If a corresponding item is found, update properties based on speakingType
if (slanderItem) {
const listItemIndex = slanderItem.list.findIndex(item => item.id === selectItem.id);
if (listItemIndex !== -1) {
// Use Vue.set to ensure reactivity when updating array elements by index
this.$set(slanderItem.list, listItemIndex, {
...slanderItem.list[listItemIndex],
ischuanti: selectItem.speakingType.includes('1'),
isgendu: selectItem.speakingType.includes('2'),
ismk: selectItem.speakingType.includes('3'),
});
}
}
});
//
// console.log('Matching contents:', matchingContents);
},
//
arrow_xl() {
this.arrow = !this.arrow
@ -732,8 +795,7 @@ export default {
this.part2 = true
this.grizzly = false
}
else if (id == 3) {
} else if (id == 3) {
this.postdata.part = "part3"
this.part2 = true
this.grizzly = false
@ -753,16 +815,16 @@ export default {
}
}
}
}
</script>
<style lang="scss" scoped>
.view_template {
.view_template {
width: 100%;
background: linear-gradient(183deg, #F0F6FF 0%, #FAFAFA 100%);
}
}
.serchbox {
.serchbox {
padding: 0 32rpx;
display: flex;
flex-wrap: nowrap;
@ -801,9 +863,9 @@ export default {
box-sizing: border-box;
}
}
}
.view_body {
.view_body {
height: 89vh;
width: 91.3%;
margin: 0 auto;
@ -1090,18 +1152,18 @@ export default {
}
}
.footer {
.footer {
position: fixed;
bottom: 0;
width: 100%;
background: #FFFFFF;
box-shadow: 0rpx -6rpx 14rpx 0rpx rgba(177, 177, 177, 0.25);
padding: 30rpx 32rpx;
}
}
.footer2 {
.footer2 {
position: fixed;
bottom: 0;
width: 100%;
@ -1109,62 +1171,62 @@ export default {
box-shadow: 0rpx -6rpx 14rpx 0rpx rgba(177, 177, 177, 0.25);
padding: 30rpx 32rpx;
margin-top: 25rpx;
}
}
.footer_button {
.footer_button {
display: flex;
justify-content: space-between;
}
}
.button_ky {
.button_ky {
padding: 24rpx 52rpx;
border-radius: 104rpx 104rpx 104rpx 104rpx;
color: #2E4975;
background-color: #FAFAFA;
}
}
.button_andadd {
.button_andadd {
background: linear-gradient(180deg, #74AFFF 0%, #2D7CE6 100%);
border-radius: 104rpx 104rpx 104rpx 104rpx;
padding: 26rpx 125rpx;
color: #fff;
}
}
.button_show {
.button_show {
width: 100%;
background: linear-gradient(180deg, #74AFFF 0%, #2D7CE6 100%);
border-radius: 104rpx 104rpx 104rpx 104rpx;
padding: 26rpx 125rpx;
color: #fff;
text-align: center;
}
}
.view_fff_bottom {
.view_fff_bottom {
margin-bottom: 54rpx;
}
}
.Task {
.Task {
font-size: 24rpx;
font-weight: 500;
color: #2E4975;
}
}
.view_left {
.view_left {
display: flex;
justify-content: left;
margin-top: 20rpx;
}
}
.view_left_pd {
.view_left_pd {
position: relative;
padding: 12rpx 32rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin-right: 15rpx;
font-size: 24rpx;
}
}
.pull_Down {
.pull_Down {
position: absolute;
bottom: -130rpx;
left: 50%;
@ -1178,9 +1240,9 @@ export default {
padding: 15rpx 50rpx;
border-bottom: 2rpx solid #F2F2F2;
}
}
}
.pull_DownTow {
.pull_DownTow {
width: 150rpx;
position: absolute;
bottom: -133rpx;
@ -1197,20 +1259,25 @@ export default {
border-bottom: 2rpx solid #F2F2F2;
}
}
}
.pull_Down view:last-child {
.pull_Down view:last-child {
border: none;
}
}
.sl_body {
.sl_body {
background-color: #fff;
}
}
.footer_button_right {
.footer_button_right {
padding: 24rpx 62rpx;
border: 1px solid #2D7CE6;
border-radius: 104rpx 104rpx 104rpx 104rpx;
color: #2D7CE6;
}
}
.act1{
color: #fff;
background: #2D7CE6 ;
border: 1px solid #2D7CE6;
}
</style>