123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540 |
- <template>
- <view class="activityPageNew">
- <statusBar :item="navBarData"></statusBar>
- <!-- 消息提示 -->
- <msgPop></msgPop>
- <view class="search">
- <uni-search-bar v-model.trim="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索"
- cancelButton="none" clearButton="none"></uni-search-bar>
- </view>
- <view class="top">
- <view class="right" @click="accountLogin" :class="current == 0 ? info1 : info2">
- <text class="">常规教研</text>
- <view v-if="current == 0" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view>
- <view class="left" @click="phoneLogin" :class="current == 1 ? info1 : info2">
- <text class="">专题教研</text>
- <view v-if="current == 1" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view>
- <!-- <view class="right" @click="costClass" :class="current == 2 ? info1 : info2">
- <text class="">付费教研</text>
- <view v-if="current == 2" class="yun">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Ellipse 10.png"
- mode="aspectFill"></image>
- </view>
- </view> -->
- </view>
- <!-- <swiper class="scroll-view-height" @change="swipeIndex" @transition='cutS' @animationfinish='ani' -->
- <swiper class="scroll-view-height" @change="swipeIndex" :current="current" :duration="300">
- <!-- 常规教研 -->
- <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="pulist"></listBlock1>
- </view>
- <view class="loading" v-show="!searchText">
- <view v-if="puLoading==1">数据加载中...</view>
- <view v-if="puLoading==2">没有更多了~~</view>
- </view>
- </scroll-view>
- </swiper-item>
- <!-- 专题教研 -->
- <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="teclist"></listBlock1>
- </view>
- <view class="loading" v-show="!searchText">
- <view v-if="acLoading==1">数据加载中...</view>
- <view v-if="acLoading==2">没有更多了~~</view>
- </view>
- </scroll-view>
- </swiper-item>
- <!-- 付费教研 -->
- <!-- <swiper-item>
- <scroll-view scroll-y="true" style="height: 100%;">
- <view class=""
- style="height: 100%; width: 750rpx;display: flex;justify-content: center;align-items: center;">
- <image src="../../static/Frame.png" style="width: 400rpx;height: 400rpx;" mode=""></image>
- </view>
- </scroll-view>
- </swiper-item> -->
- </swiper>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: "活动",
- btn: 0,
- },
- indexId: 1,
- current: 0, //控制展示哪一个
- info1: "info1", //类名
- info2: "info2",
- // swiper: 0,
- searchText: "", // 搜索文本
- acLoading: 0, //0默认值 1加载中 2没有更多了
- accurrentPage: 1, //页数
- puLoading: 0, //0默认值 1加载中 2没有更多了
- pucurrentPage: 1,
- // 教研
- teclist: [],
- // 常规
- pulist: [],
- // 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
- trigger: false, //专题
- putrigger: false, //常规
- // 在搜索框有文字的时候下拉刷新禁止触发watch,防止数据叠加
- bansearchData: false
- };
- },
- onShareTimeline() {
- uni.share({
- provider: "weixin",
- scene: "WXSceneTimeline",
- type: 0,
- href: "http://uniapp.dcloud.io/",
- title: "uni-app分享",
- summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
- imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
- success: function(res) {
- console.log("success:" + JSON.stringify(res));
- },
- fail: function(err) {
- console.log("fail:" + JSON.stringify(err));
- }
- });
- },
- // 分享
- onShareAppMessage() {
- uni.share({
- provider: "weixin",
- scene: "WXSceneSession",
- type: 1,
- summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
- success: function(res) {
- console.log("success:" + JSON.stringify(res));
- },
- fail: function(err) {
- console.log("fail:" + JSON.stringify(err));
- }
- });
- },
- 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()
- }
- },
- 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,
- }
- this.$request('/selectSearchdata', "get", data).then(res => {
- if (this.current == 0) {
- this.pulist = res[0]
- } else if (this.current == 1) {
- this.teclist = res[0]
- }
- })
- },
- // 专题教研下拉刷新
- repulling() {
- this.bansearchData = true
- this.trigger = true
- // this.isrepulling = true
- // setTimeout(() => {
- // this.trigger = false;
- // }, 1000);
- this.acLoading = 0 //0默认值 1加载中 2没有更多了
- this.accurrentPage = 1 //页数
- // this.teclist = [] // 教研
- if (this.searchText !== '') {
- this.puLoading = 0 //0默认值 1加载中 2没有更多了
- this.pucurrentPage = 1
- this.pulist = [] // 常规
- this.getpuData()
- }
- this.searchText = ''
- this.getTecData()
- // console.log(111);
- },
- // 常规教研下拉刷新
- purepulling() {
- this.bansearchData = true
- this.putrigger = true
- // this.isrepulling = true
- // setTimeout(() => {
- // this.putrigger = false;
- // }, 1000);
- 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);
- },
- // 专题教研触底
- 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)
- },
- // 获取专题
- getTecData() {
- let data = {
- openid: uni.getStorageSync('oId'),
- ty: 1,
- page: this.accurrentPage, //下拉获取更多的备用字段
- lim: 30 //一次获取多少数据
- }
- this.$request('/selectActivity', "POST", data).then(res => {
- // console.log('专题', res[0]);
- // this.teclist = res[0]
- if (!res[0].length) {
- this.acLoading = 2
- } else {
- this.acLoading = 0
- }
- if (this.accurrentPage == 1) {
- this.teclist = []
- }
- setTimeout(() => {
- this.trigger = false;
- }, 1000);
- 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: 30 //一次获取多少数据
- }
- // return console.log('获取常规', data);
- this.$request('/selectActivity', "POST", data).then(res => {
- // console.log('常规', res[0]);
- // this.pulist = res[0]
- console.log('this.pucurrentPag', this.pucurrentPage);
- if (this.pucurrentPage == 1) {
- this.pulist = []
- }
- if (!res[0].length) {
- this.puLoading = 2
- } else {
- this.puLoading = 0
- }
- setTimeout(() => {
- this.putrigger = false;
- }, 1000);
- this.pulist = [...this.pulist, ...res[0]]
- this.bansearchData = false
-
- })
- },
- // 区域滑动变换头部
- swipeIndex(index) {
- this.current = index.detail.current;
- if (this.searchText !== '') {
- this.selectSearchdata()
- }
- // this.selectSearchdata()
- // this.$refs.listBlock1.getdata()
- },
- // 区域滑动
- accountLogin() {
- this.current = 0;
- },
- // 点击专题教研
- phoneLogin() {
- this.current = 1;
- },
- // 点击常规教研
- costClass() {
- this.current = 2;
- }
- },
- onLoad() {
- },
- onShow() {
- // 必须要两个,因为常规与专题的是分两次进行的
- this.accurrentPage = 1
- this.pucurrentPage = 1
- if (this.searchText !== '') {
- this.selectSearchdata()
- } else {
- this.getpuData() //获取常规列表
- this.getTecData() //获取专题列表
- }
- // console.log('this.pucurrentPage',this.pucurrentPage);
- this.getAllMessage() // 调用app.js中的方法
- // 获取收藏事件
- this.$refs.listBlock1.getdata() //专题
- this.$refs.listBlock2.getdata() //常规
- }
- };
- </script>
- <style lang="scss" scoped>
- .btntop {
- width: 100%;
- }
- .searchPagedata {
- width: 750rpx;
- height: 40%;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .activityPageNew {
- display: flex;
- flex-direction: column;
- height: 100vh;
- .search {
- background-color: #ffffff;
- position: relative;
- display: flex;
- width: 750rpx;
- height: 88rpx;
- justify-content: center;
- align-items: center;
- .inpSer {
- width: 690rpx;
- height: 65rpx;
- margin: auto;
- background-color: rgba(240, 242, 245, 1);
- border-radius: 5rpx;
- color: rgba(0, 0, 0, 0.26);
- position: relative;
- .inpTxt {
- color: #000;
- height: 100%;
- width: 100%;
- }
- input::placeholder {
- color: #000;
- }
- .ico {
- position: absolute;
- top: 50%;
- left: 20rpx;
- transform: translate(0, -50%);
- display: flex;
- align-items: center;
- image {
- margin-right: 10rpx;
- }
- }
- }
- }
- .top {
- width: 100%;
- display: flex;
- justify-content: space-around;
- margin: auto;
- background-color: #ffffff;
- padding: 10px 60rpx;
- height: 98rpx;
- .info1 {
- font-weight: bold !important;
- position: relative;
- color: rgba(0, 0, 0, 0.8);
- font-size: 34rpx;
- line-height: 48rpx;
- width: 136rpx;
- height: 48rpx;
- text-align: center;
- // font-family: PingFang SC;
- // font-family: \9ed1\4f53;
- .yun {
- width: 134rpx;
- height: 32rpx;
- position: absolute;
- left: 0;
- bottom: -10rpx;
- // transform: translate(-50%,0%);
- // box-shadow: 0px 10rpx 30rpx 6rpx #4a97f2;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .info2 {
- color: rgba(0, 0, 0, 0.6);
- font-size: 34rpx;
- font-weight: 400;
- line-height: 48rpx;
- width: 136rpx;
- height: 48rpx;
- text-align: center;
- // font-family: 微软雅黑;
- }
- }
- .scroll-view-height {
- flex: 1;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .cont {
- background-color: #ffffff;
- width: 332rpx;
- padding: 20rpx 15rpx;
- border-radius: 10px;
- margin-bottom: 20rpx;
- image {
- width: 300rpx;
- height: 170rpx;
- border-radius: 10rpx;
- }
- .tit {
- width: 257rpx;
- margin: 10rpx 0;
- // height: 80rpx;
- font-weight: bold;
- white-space: normal;
- display: -webkit-box;
- word-break: break-all;
- text-overflow: ellipsis;
- overflow: hidden;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- /*设置 需要显示的行数*/
- }
- .teacher {
- color: #999999;
- }
- }
- }
- }
- </style>
|