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

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>
@ -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');
// uni.removeStorageSync('selectedClassInfo');
// uni.removeStorageSync('selectedStuInfo');
// uni.removeStorageSync('selectforwork');
// this.classinfo = JSON.parse(decodeURIComponent(option.classinfo))
let classinofs = [{
name: '阅读5班',
avatar: 'Excepteur',
id: 15,
// 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 = {};
@ -466,8 +433,8 @@ export default {
// 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,10 +493,102 @@ 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');
}
}
}

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,16 +190,15 @@
</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'
@ -333,7 +283,8 @@ export default {
selectspeak: [],
selectwrite: [],
selectlisten: [],
selectread: []
selectread: [],
mocktype:'0',
}
},
components: {
@ -346,19 +297,32 @@ export default {
},
onLoad(option) {
const dataToSave =JSON.parse(decodeURIComponent(option.dataToSave))
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: {
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');
@ -379,7 +343,8 @@ export default {
selectspeak: this.selectspeak,
selectwrite: this.selectwrite,
selectlisten: this.selectlisten,
selectread: this.selectread
selectread: this.selectread,
mocktype:this.mocktype,
};
//
@ -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) {
@ -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 => {
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,14 +599,48 @@ 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);
})
},
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 = {
@ -657,7 +657,8 @@ export default {
"level": 0,
"isNew": 0
}
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata1).then(res => {
this.$u.post('https://api.admin-v2.langsi.online/admin-api/speaking/topic/home/list', postdata1).then(
res => {
if (res.code == 0) {
this.getpart3()
}
@ -669,17 +670,48 @@ 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)
})
},
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": "",
@ -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
@ -1213,4 +1275,9 @@ export default {
border-radius: 104rpx 104rpx 104rpx 104rpx;
color: #2D7CE6;
}
.act1{
color: #fff;
background: #2D7CE6 ;
border: 1px solid #2D7CE6;
}
</style>