123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633 |
- <template>
- <view class="mineCollNew">
- <statusBar :item="navBarData"></statusBar>
- <!-- 消息提示 -->
- <msgPop></msgPop>
- <view class="top">
- <view class="left" @click="acpag" :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="right" @click="clapag" :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>
- <swiper class="scroll-view-height" @change="swipeIndex" :current="current" :duration="300">
- <swiper-item>
- <scroll-view scroll-y="true" @scrolltolower="lower" style="height: 100%;">
- <view class="">
- <view class="classListFlex" v-if="aclist.length==0">
- </view>
- <view class="listBlock1" v-for="(i,index) in aclist" :key="i.acId" @click="gotoDetail"
- :data-aid="i.acId">
- <view class="img cell-img">
- <image :src="i.pic" mode="aspectFill"></image>
- <image class="star" @click.stop="coll" :data-e="i" :src="pic_coll2" mode=""></image>
- </view>
- <view class="right">
- <view class="title">
- <view class="bqZ-font" style="font-size: 20rpx;"
- :class="i.acshape=='线下活动'?'tag':'tag1'"> {{i.acshape}}</view>
- <view class="titTxt btn-font " style="font-size:34rpx ;">
- {{i.acName}}
- </view>
- </view>
- <view class="introduce">
- <view class="bri">
- 深圳职业技术大学
- <!-- {{ i.address }} -->
- </view>
- <view class="tim">
- {{ i.create_at }}
- </view>
- </view>
- <view class="operate">
- <view class="left">
- <view class="add fz-font">已报名{{i.bnum}}人</view>
- </view>
- <view class="Oright">
- <view class="text">{{ i.signNum?'已报名':'报名' }}</view>
- <view class="arrow">
- <image
- src="https://teacherapi.cocorobo.cn/teaching-file/static/mine/arrow-right-blue.png"
- mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="loading">
- <view v-if="newsLoading==1">数据加载中...</view>
- <view v-if="newsLoading==2">没有更多了~~</view>
- </view>
- </scroll-view>
- </swiper-item>
- <swiper-item>
- <scroll-view scroll-y="true" @scrolltolower="cllower" style="height: 100%;">
- <view class="classListFlex">
- <view class="cont" @click="gotoWeb" v-for="(item, index) in classlist" :index="index"
- :key="i.cid" :data-kid="item.href">
- <image class="star" :src="pic_coll2" @click.stop="collcl" :data-e="item" mode="aspectFill">
- </image>
- <image class="img" :src="item.img" mode="aspectFill" />
- <view class="tit btn-font">{{ item.ctit }}</view>
- <!-- <view class="teacher fz-font">{{ item.school }}</view> -->
- </view>
- </view>
- <view class="loading">
- <view v-if="clLoading==1">数据加载中...</view>
- <view v-if="clLoading==2">没有更多了~~</view>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- <!-- <view class="" style="height: 68rpx;width: 750rpx;">
- </view> -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: '我的收藏',
- btn: 1
- },
- current: 0, //课程活动切换
- info1: "info1", //类名
- info2: "info2",
- aclist: [], //活动数据list
- classlist: [], //课程数据list
- // // 收藏活动list
- // collArr: [],
- // // 收藏课程list
- // collArrcl: [],
- // 触底加载动画提示
- newsLoading: 0, //0默认值 1加载中 2没有更多了
- currentPage: 1,
- clLoading: 0, //0默认值 1加载中 2没有更多了
- clcurrentPage: 1,
- pic_coll: 'https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/Vstar21707269669382.png',
- pic_coll2: 'https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/VStar1707269577778.png',
- };
- },
- methods: {
- // 获取活动数据
- getData() {
- let data = {
- oid: this.$store.state.user.openid, //用户id
- type: 0,
- page: this.currentPage, //下拉获取更多的备用字段
- lim: 30 //一次获取多少数据
- }
- console.log('data', data);
- this.$request('/selectCollAcList', 'POST', data).then(res => {
- console.log('获取活动数据', res);
- if (this.currentPage == 1) {
- this.aclist = [] //活动数据list
- }
- if (!res[0].length) {
- this.newsLoading = 2
- } else {
- this.newsLoading = 0
- }
- this.aclist = [...this.aclist, ...res[0]]
- })
- },
- // 获取课程数据
- getTeachData() {
- // console.log('触发课程收藏事件');
- let data = {
- oid: this.$store.state.user.openid, //用户id
- type: 1,
- page: this.clcurrentPage, //下拉获取更多的备用字段
- lim: 30 //一次获取多少数据
- }
- this.$request('/selectOperatorTech', 'POST', data).then(res => {
- console.log('获取课程数据', res);
- // 每次调用前清零,防止push叠加错误
- // this.classlist = []
- if (this.clcurrentPage == 1) {
- this.classlist = [] //课程数据list
- }
- if (!res[0].length) {
- this.clLoading = 2
- } else {
- this.clLoading = 0
- }
- this.classlist = [...this.classlist, ...res[0]]
- // this.classlist = res[0]
- })
- },
- // 跳转活动详情页
- gotoDetail(e) {
- let aid = e.currentTarget.dataset.aid;
- uni.navigateTo({
- url: `/pages/activityDetailNew/activityDetailNew?acId=${aid}`
- });
- },
- // 查看课程外部链接
- gotoWeb(e) {
- // return console.log('aaaaaa', e.currentTarget.dataset);
- let acid = e.currentTarget.dataset.kid
- uni.navigateTo({
- url: "/pages/skipone/skipone?item=" + encodeURIComponent(JSON.stringify(acid))
- // url: "/pages/skipone/skipone?url=" + encodeURIComponent(acid),
- });
- },
- // 取消活动收藏事件
- coll(event) {
- let aId = event.currentTarget.dataset.e.acId
- let data = {
- acid: aId,
- oid: this.$store.state.user.openid, //用户id
- ty: 0
- }
- this.$store.dispatch('asyncUpdatemsg', {
- collAoff: 0
- })
- this.$request('/deleteOperator', 'POST', data).then(res => {
- // console.log(res);
- setTimeout(() => {
- this.$store.dispatch('asyncDelMsg')
- }, 1500)
- this.aclist = this.aclist.filter(e => {
- return e.acId != aId
- })
- // 防止一直取消收藏导致触发不了触底刷新
- if (this.aclist.length < 15) {
- this.lower()
- }
- })
- },
- // 取消课程收藏事件
- collcl(event) {
- let cId = event.currentTarget.dataset.e.cid
- let data = {
- cid: cId,
- oid: this.$store.state.user.openid, //用户id
- ty: 1
- }
- this.$store.dispatch('asyncUpdatemsg', {
- collAoff: 0
- })
- this.$request('/deleteOperator', 'POST', data).then(res => {
- // console.log('取消课程收藏', res);
- setTimeout(() => {
- this.$store.dispatch('asyncDelMsg')
- }, 1500)
- this.classlist = this.classlist.filter(e => {
- return e.cid != cId
- })
- // 防止一直取消收藏导致触发不了触底刷新
- if (this.classlist.length < 15) {
- this.cllower()
- }
- })
- },
- // 活动触底加载更多
- lower() {
- console.log('活动没触底?');
- if (this.newsLoading == 2) return
- this.newsLoading = 1
- this.currentPage++
- setTimeout(this.getData, 1000)
- },
- // 课程触底加载更多
- cllower() {
- console.log('课程没触底?');
- if (this.clLoading == 2) return
- this.clLoading = 1
- this.clcurrentPage++
- setTimeout(this.getTeachData, 1000)
- },
- //跳转到第三方链接
- gotoLink(e) {
- let link = e.currentTarget.dataset.link;
- uni.navigateTo({
- url: "/pages/skipone/skipone?url=" + encodeURIComponent(link),
- });
- },
- swipeIndex(index) {
- this.current = index.detail.current;
- },
- // 区域滑动
- acpag() {
- this.current = 0;
- },
- clapag() {
- this.current = 1;
- },
- },
- onLoad(e) {
- console.log('e', e);
- if (Object.keys(e).length != 0) {
- this.current = e.ty * 1
- // console.log(99999);
- }
- },
- onShow() {
- this.clcurrentPage = 1;
- this.currentPage = 1;
- // 获取数据
- this.getData()
- this.getTeachData()
- }
- }
- </script>
- <style lang="scss" scoped>
- .mineCollNew {
- display: flex;
- flex-direction: column;
- height: 100vh;
- .classListFlex {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- padding: 30rpx;
- }
- .cont {
- background-color: #ffffff;
- width: 332rpx;
- padding: 20rpx 15rpx;
- border-radius: 10px;
- margin-bottom: 20rpx;
- position: relative;
- .star {
- position: absolute;
- right: 30rpx;
- top: 30rpx;
- width: 30rpx;
- height: 30rpx;
- }
- .img {
- width: 300rpx;
- height: 170rpx;
- border-radius: 10rpx;
- }
- .tit {
- width: 257rpx;
- margin: 10rpx 0;
- 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;
- }
- .mon {
- font-size: 34rpx;
- color: rgba(246, 135, 23, 1);
- font-weight: 34rpx;
- margin-top: 10rpx;
- .cost {
- font-weight: 40rpx;
- }
- }
- }
- .loading {
- height: 30rpx;
- text-align: center;
- padding-top: 20rpx;
- padding-bottom: 100rpx;
- font-size: 26rpx;
- color: #888;
- line-height: 2em;
- }
- .top {
- width: 100%;
- display: flex;
- justify-content: space-between;
- margin: 0;
- background-color: #ffffff;
- padding: 10px 150rpx;
- 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;
- .yun {
- width: 134rpx;
- height: 32rpx;
- position: absolute;
- left: 0;
- bottom: -10rpx;
- 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;
- }
- .listBlock1 {
- display: flex;
- justify-content: space-between;
- background-color: #ffffff;
- padding: 20rpx 30rpx;
- width: 100%;
- .img {
- width: 160rpx;
- height: 160rpx;
- flex-shrink: 0;
- position: relative;
- .star {
- position: absolute;
- right: 10rpx;
- top: 10rpx;
- width: 30rpx;
- height: 30rpx;
- }
- image {
- width: 100%;
- height: 100%;
- border-radius: 10rpx;
- }
- }
- .right {
- padding-left: 20rpx;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .title {
- display: flex;
- width: 500rpx;
- justify-content: flex-start;
- align-items: center;
- .titTxt {
- flex: 1;
- color: rgba(0, 0, 0, 0.8);
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- text {
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .introduce {
- font-size: 24rpx;
- display: flex;
- justify-content: space-between;
- .bri {
- width: 250rpx;
- color: #a7a7a7;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .tim {
- color: #a7a7a7;
- }
- }
- .operate {
- display: flex;
- justify-content: space-between;
- .left {
- display: flex;
- align-items: baseline;
- position: relative;
- width: 60%;
- .add {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- padding-left: 3rpx;
- color: rgba(0, 0, 0, 0.6) !important;
- }
- }
- .Oright {
- // width: 80px;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .text {
- font-size: 24rpx;
- color: #3081E8;
- }
- .arrow {
- display: flex;
- justify-content: center;
- margin-top: 5rpx;
- image {
- width: 32rpx;
- height: 32rpx;
- }
- }
- }
- }
- }
- .tag {
- border: 1px rgba(0, 178, 182, 1) solid;
- flex-shrink: 0;
- letter-spacing: 2rpx;
- // min-width: 104rpx;
- // height: 36rpx;
- padding: 2rpx 4rpx;
- display: flex;
- white-space: nowrap;
- justify-content: center;
- align-items: center;
- border-radius: 4rpx;
- margin-right: 10rpx;
- color: rgba(0, 178, 182, 1);
- line-height: 32rpx;
- // border: 1px #00b2b6 solid;
- // flex-shrink: 0;
- // letter-spacing: 2rpx;
- // width: 104rpx;
- // height: 32rpx;
- // display: flex;
- // white-space: nowrap;
- // justify-content: center;
- // align-items: center;
- // border-radius: 4rpx;
- // margin-right: 10rpx;
- // color: #00b2b6;
- // line-height: 32rpx;
- }
- .tag1 {
- flex-shrink: 0;
- letter-spacing: 2rpx;
- // min-width: 104rpx;
- // height: 36rpx;
- padding: 2rpx 4rpx;
- display: flex;
- white-space: nowrap;
- justify-content: center;
- align-items: center;
- border-radius: 4rpx;
- margin-right: 10rpx;
- line-height: 32rpx;
- border: 1px rgba(0, 86, 168, 1) solid;
- color: rgba(0, 86, 168, 1);
- // border: 1px rgba(0, 86, 168, 1) solid;
- // flex-shrink: 0;
- // letter-spacing: 2rpx;
- // width: 104rpx;
- // height: 32rpx;
- // display: flex;
- // white-space: nowrap;
- // justify-content: center;
- // align-items: center;
- // border-radius: 4rpx;
- // margin-right: 10rpx;
- // color: rgba(0, 86, 168, 1);
- // line-height: 32rpx;
- }
- }
- }
- </style>
|