|
@@ -4,8 +4,8 @@
|
|
|
<!-- 消息提示 -->
|
|
|
<msgPop></msgPop>
|
|
|
<view class="search">
|
|
|
- <uni-search-bar v-model="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索" cancelButton="none"
|
|
|
- clearButton="none"></uni-search-bar>
|
|
|
+ <uni-search-bar v-model.trim="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索"
|
|
|
+ cancelButton="none" clearButton="none"></uni-search-bar>
|
|
|
</view>
|
|
|
|
|
|
<view class="top">
|
|
@@ -41,8 +41,9 @@
|
|
|
<swiper-item>
|
|
|
<scroll-view scroll-y="true" refresher-enabled='true' :refresher-triggered="putrigger"
|
|
|
@refresherrefresh='purepulling' @scrolltolower="pulower" style="height: 100%;">
|
|
|
+ <view class="searchPagedata" v-if="!pulist.length">暂无数据</view>
|
|
|
<view>
|
|
|
- <listBlock1 ref="listBlock2" :classList="filteredClassList2"></listBlock1>
|
|
|
+ <listBlock1 ref="listBlock2" :classList="pulist"></listBlock1>
|
|
|
</view>
|
|
|
<view class="loading">
|
|
|
<view v-if="puLoading==1">数据加载中...</view>
|
|
@@ -56,8 +57,11 @@
|
|
|
<swiper-item>
|
|
|
<scroll-view scroll-y="true" refresher-enabled='true' :refresher-triggered="trigger"
|
|
|
@refresherrefresh='repulling' @scrolltolower="aclower" style="height: 100%;">
|
|
|
+
|
|
|
+ <view class="searchPagedata" v-if="!teclist.length">暂无数据</view>
|
|
|
+
|
|
|
<view class="">
|
|
|
- <listBlock1 ref="listBlock1" :classList="filteredClassList"></listBlock1>
|
|
|
+ <listBlock1 ref="listBlock1" :classList="teclist"></listBlock1>
|
|
|
</view>
|
|
|
<view class="loading">
|
|
|
<view v-if="acLoading==1">数据加载中...</view>
|
|
@@ -114,44 +118,81 @@
|
|
|
// 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
|
|
|
trigger: false, //专题
|
|
|
putrigger: false, //常规
|
|
|
- // 付费
|
|
|
- // monlist: [{
|
|
|
- // acId: "92e11d93-8778-11ee-b98c-005056b86db5",
|
|
|
- // acName: "丽湖职教双创教育国际虚拟教研室2023年常规教研活动安排",
|
|
|
- // acshape: "户外活动",
|
|
|
- // avatar: "http://139.159.246.165:7006/uploads/20231122/file-1700619408170.jpeg",
|
|
|
- // bnum: 0,
|
|
|
- // brief: "丽湖职教双创教育国际虚拟教研室为立足全国,辐射海外的国际化教研室,围绕创新创业教育的人才培养与课程建设开展深度研究。教研室以贯彻落实立德树人根本任务,通过加强跨专业、跨校、跨地域的教研交流,推动高校协同打造国际化的精品教学资源库、优秀教学案例库、优质教师培训资源库等,全面提高教师",
|
|
|
- // cost: "5000",
|
|
|
- // create_at: "2023.11.20 03:11",
|
|
|
- // pers: "15",
|
|
|
- // pic: "http://139.159.246.165:7006/uploads/20231120/file-1700466209242.png",
|
|
|
- // type: "1",
|
|
|
- // username: "袁一鸣",
|
|
|
- // }]
|
|
|
+
|
|
|
+ // 触底
|
|
|
+ // SearchLoading: 0, //0默认值 1加载中 2没有更多了
|
|
|
+ // 搜索页数
|
|
|
+ Searchpage: 1,
|
|
|
+
|
|
|
+ // 在搜索框有文字的时候下拉刷新禁止触发watch,防止数据叠加
|
|
|
+ bansearchData: false
|
|
|
};
|
|
|
},
|
|
|
- // 模糊搜索
|
|
|
- computed: {
|
|
|
- filteredClassList() {
|
|
|
- const filteredList = this.teclist.filter((item) =>
|
|
|
- item.acName.includes(this.searchText)
|
|
|
- );
|
|
|
- return this.searchText ? filteredList : this.teclist;
|
|
|
- },
|
|
|
- filteredClassList2() {
|
|
|
- const filterdList2 = this.pulist.filter((item) =>
|
|
|
- item.acName.includes(this.searchText)
|
|
|
- );
|
|
|
- return this.searchText ? filterdList2 : this.pulist;
|
|
|
- },
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- this.$store.dispatch('asyncDelAll')
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ searchText(val) {
|
|
|
+ // console.log(val);
|
|
|
+ if (this.bansearchData) return
|
|
|
+ if (val === '') {
|
|
|
+
|
|
|
+ this.acLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
+ this.accurrentPage = 1 //页数
|
|
|
+ this.teclist = [] // 教研
|
|
|
+ this.getTecData()
|
|
|
+
|
|
|
+
|
|
|
+ this.puLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
+ this.pucurrentPage = 1
|
|
|
+ this.pulist = [] // 常规
|
|
|
+
|
|
|
+ this.getpuData()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.selectSearchdata()
|
|
|
+ }
|
|
|
},
|
|
|
+ // onUnload() {
|
|
|
+ // this.$store.dispatch('asyncDelAll')
|
|
|
+ // },
|
|
|
methods: {
|
|
|
-
|
|
|
+ // 搜索
|
|
|
+ selectSearchdata() {
|
|
|
+ if (this.current === 2) return
|
|
|
+ let type = null
|
|
|
+ if (this.current == 0) {
|
|
|
+ type = 2
|
|
|
+ } else if (this.current == 1) {
|
|
|
+ type = 1
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // console.log(111);
|
|
|
+ let data = {
|
|
|
+ openid: uni.getStorageSync('oId'),
|
|
|
+ txt: this.searchText,
|
|
|
+ ty: type,
|
|
|
+ // page: this.Searchpage,
|
|
|
+ // lim: 15
|
|
|
+ }
|
|
|
+ // return console.log(data);
|
|
|
+ this.$request('/selectSearchdata', "get", data).then(res => {
|
|
|
+ console.log('常规', res);
|
|
|
+ if (this.current == 0) {
|
|
|
+ this.pulist = res[0]
|
|
|
+ } else if (this.current == 1) {
|
|
|
+ this.teclist = res[0]
|
|
|
+ }
|
|
|
+ // if (!res[0].length) {
|
|
|
+ // this.puLoading = 2
|
|
|
+ // } else {
|
|
|
+ // this.puLoading = 0
|
|
|
+ // }
|
|
|
+ // this.pulist = [...this.pulist, ...res[0]]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 专题教研下拉刷新
|
|
|
repulling() {
|
|
|
+ this.bansearchData = true
|
|
|
this.trigger = true
|
|
|
// this.isrepulling = true
|
|
|
setTimeout(() => {
|
|
@@ -161,46 +202,58 @@
|
|
|
this.acLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
this.accurrentPage = 1 //页数
|
|
|
this.teclist = [] // 教研
|
|
|
-
|
|
|
- // this.puLoading= 0 //0默认值 1加载中 2没有更多了
|
|
|
- // this.pucurrentPage=1
|
|
|
- // this.pulist= []// 常规
|
|
|
+
|
|
|
+ if (this.searchText !== '') {
|
|
|
+ this.puLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
+ this.pucurrentPage = 1
|
|
|
+ this.pulist = [] // 常规
|
|
|
+ this.getpuData()
|
|
|
+ }
|
|
|
+ this.searchText = ''
|
|
|
|
|
|
this.getTecData()
|
|
|
- console.log(111);
|
|
|
+ // console.log(111);
|
|
|
},
|
|
|
+ // 常规教研下拉刷新
|
|
|
purepulling() {
|
|
|
+ this.bansearchData = true
|
|
|
this.putrigger = true
|
|
|
// this.isrepulling = true
|
|
|
setTimeout(() => {
|
|
|
this.putrigger = false;
|
|
|
}, 1000);
|
|
|
|
|
|
- // this.acLoading= 0 //0默认值 1加载中 2没有更多了
|
|
|
- // this.accurrentPage= 1 //页数
|
|
|
- // this.teclist= []// 教研
|
|
|
-
|
|
|
this.puLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
this.pucurrentPage = 1
|
|
|
this.pulist = [] // 常规
|
|
|
+ if (this.searchText !== '') {
|
|
|
+ this.acLoading = 0 //0默认值 1加载中 2没有更多了
|
|
|
+ this.accurrentPage = 1 //页数
|
|
|
+ this.teclist = [] // 教研
|
|
|
+ this.getTecData()
|
|
|
+ }
|
|
|
+ this.searchText = ''
|
|
|
|
|
|
this.getpuData()
|
|
|
- console.log(111);
|
|
|
+ // console.log(111);
|
|
|
},
|
|
|
-
|
|
|
+ // 专题教研触底
|
|
|
aclower() {
|
|
|
+ if (this.searchText !== '') return console.log('禁止触底');
|
|
|
console.log('没触底?');
|
|
|
if (this.acLoading == 2) return
|
|
|
this.acLoading = 1
|
|
|
this.accurrentPage++
|
|
|
setTimeout(this.getTecData, 1000)
|
|
|
},
|
|
|
+ // 常规教研触底
|
|
|
pulower() {
|
|
|
+ if (this.searchText !== '') return console.log('禁止触底');
|
|
|
console.log('没触底?');
|
|
|
if (this.puLoading == 2) return
|
|
|
this.puLoading = 1
|
|
|
this.pucurrentPage++
|
|
|
- setTimeout(this.getpuData, 1000)
|
|
|
+ setTimeout(this.getpuData(), 1000)
|
|
|
},
|
|
|
// 获取专题
|
|
|
getTecData() {
|
|
@@ -219,18 +272,24 @@
|
|
|
this.acLoading = 0
|
|
|
}
|
|
|
this.teclist = [...this.teclist, ...res[0]]
|
|
|
+ this.bansearchData = false
|
|
|
})
|
|
|
+ },
|
|
|
+ secherData() {
|
|
|
+
|
|
|
},
|
|
|
// 获取常规
|
|
|
getpuData() {
|
|
|
let data = {
|
|
|
openid: uni.getStorageSync('oId'),
|
|
|
ty: 2,
|
|
|
+ // txt: (e ? e : ''),
|
|
|
page: this.pucurrentPage, //下拉获取更多的备用字段
|
|
|
lim: 15 //一次获取多少数据
|
|
|
}
|
|
|
+ // return console.log('获取常规', data);
|
|
|
this.$request('/selectActivity', "POST", data).then(res => {
|
|
|
- // console.log('常规', res[0]);
|
|
|
+ console.log('常规', res[0]);
|
|
|
// this.pulist = res[0]
|
|
|
if (!res[0].length) {
|
|
|
this.puLoading = 2
|
|
@@ -238,12 +297,19 @@
|
|
|
this.puLoading = 0
|
|
|
}
|
|
|
this.pulist = [...this.pulist, ...res[0]]
|
|
|
+ this.bansearchData = false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 区域滑动变换头部
|
|
|
swipeIndex(index) {
|
|
|
+ // console.log(111);
|
|
|
+
|
|
|
this.current = index.detail.current;
|
|
|
+ if (this.searchText !== '') {
|
|
|
+ this.selectSearchdata()
|
|
|
+ }
|
|
|
+ // this.selectSearchdata()
|
|
|
// this.$refs.listBlock1.getdata()
|
|
|
},
|
|
|
|
|
@@ -251,37 +317,21 @@
|
|
|
accountLogin() {
|
|
|
this.current = 0;
|
|
|
},
|
|
|
+ // 点击专题教研
|
|
|
phoneLogin() {
|
|
|
this.current = 1;
|
|
|
},
|
|
|
-
|
|
|
+ // 点击常规教研
|
|
|
costClass() {
|
|
|
this.current = 2;
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
-
|
|
|
-
|
|
|
- // 刷新
|
|
|
- // 教研
|
|
|
- // this.teclist = []
|
|
|
- // // 常规
|
|
|
- // this.pulist = []
|
|
|
- // this.accurrentPage = 1
|
|
|
- // this.pucurrentPage = 1
|
|
|
-
|
|
|
- // console.log('刷新',this.teclis);
|
|
|
-
|
|
|
this.getpuData() //获取常规列表
|
|
|
this.getTecData() //获取专题列表
|
|
|
-
|
|
|
- // 因为组件没有onshow
|
|
|
- // 获取订阅事件
|
|
|
- // this.$refs.listBlock1.getSub()
|
|
|
},
|
|
|
onShow() {
|
|
|
|
|
|
-
|
|
|
this.getAllMessage() // 调用app.js中的方法
|
|
|
// 获取收藏事件
|
|
|
this.$refs.listBlock1.getdata() //专题
|
|
@@ -295,6 +345,14 @@
|
|
|
width: 100%;
|
|
|
}
|
|
|
|
|
|
+ .searchPagedata {
|
|
|
+ width: 750rpx;
|
|
|
+ height: 40%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
.activityPageNew {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|