|
@@ -1,10 +1,15 @@
|
|
|
<template>
|
|
|
<view class="">
|
|
|
- <view class="listBlock1" v-for="(i,index) in classList" :key="index+'a'" @click="gotoDetail" :data-aid="i.acId">
|
|
|
+
|
|
|
+ <msgPop :itemlist="animationDataArr"></msgPop>
|
|
|
+ <view class="listBlock1" v-for="(i,index) in classList" :key="index" @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="collArr.includes(i.acId) ? pic_coll2 : pic_coll " mode="aspectFill"></image>
|
|
|
+
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
<view class="right">
|
|
@@ -70,6 +75,16 @@
|
|
|
return {
|
|
|
// 收藏list
|
|
|
collArr: [],
|
|
|
+
|
|
|
+
|
|
|
+ timer: null,
|
|
|
+ animationDataArr: [],
|
|
|
+
|
|
|
+ // 收藏悬浮窗
|
|
|
+ collpopulShow: false,
|
|
|
+
|
|
|
+ // 决定悬浮窗显示哪些内容0 取消 1收藏
|
|
|
+ collAoff: 0,
|
|
|
// subArr: [],
|
|
|
pic_coll: 'https://teacherapi.cocorobo.cn/teaching-file/static/Stara.png',
|
|
|
pic_coll2: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect_yellow.png',
|
|
@@ -77,17 +92,24 @@
|
|
|
// pic_sub2: '../../static/mine/dingyue_blue.png'
|
|
|
};
|
|
|
},
|
|
|
+ onShow() {},
|
|
|
|
|
|
+ onUnload() {
|
|
|
+ this.timer.clear()
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 收藏事件
|
|
|
coll(event) {
|
|
|
const value = this.$store.state.user.openid;
|
|
|
- if(!value){
|
|
|
- uni.showToast({title: '未登录,请登录',icon: 'none'})
|
|
|
- setTimeout(this.goLog,1000)
|
|
|
+ if (!value) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未登录,请登录',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ setTimeout(this.goLog, 1000)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// return console.log(event);
|
|
|
let aId = event.currentTarget.dataset.e.acId
|
|
|
|
|
@@ -108,29 +130,47 @@
|
|
|
|
|
|
// iscoll为true表示已经收藏过,执行删除 为true则收藏
|
|
|
if (iscoll) {
|
|
|
+ this.animationDataArr.push({
|
|
|
+ collAoff: 0
|
|
|
+ })
|
|
|
+ // this.praiseMe()
|
|
|
console.log('执行删除');
|
|
|
this.$request('/deleteOperator', 'POST', data).then(res => {
|
|
|
this.getdata()
|
|
|
+ setTimeout(() => {
|
|
|
+ this.animationDataArr.shift()
|
|
|
+ console.log(this.animationDataArr);
|
|
|
+ }, 1500)
|
|
|
})
|
|
|
} else {
|
|
|
+
|
|
|
+ this.animationDataArr.push({
|
|
|
+ collAoff: 1
|
|
|
+ })
|
|
|
console.log('执行添加');
|
|
|
this.$request('/insertOperator', 'POST', data).then(res => {
|
|
|
this.getdata()
|
|
|
+ setTimeout(() => {
|
|
|
+ this.animationDataArr.shift()
|
|
|
+ // console.log(this.animationDataArr);
|
|
|
+ }, 1500)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 跳转到详情页
|
|
|
gotoDetail(e) {
|
|
|
const value = this.$store.state.user.openid;
|
|
|
- if(!value){
|
|
|
- uni.showToast({title: '未登录,请登录',icon: 'none'})
|
|
|
- setTimeout(this.goLog,1000)
|
|
|
+ if (!value) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未登录,请登录',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ setTimeout(this.goLog, 1000)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let aid = e.currentTarget.dataset.aid;
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/activityDetailNew/activityDetailNew?acId=${aid}`
|
|
@@ -140,12 +180,15 @@
|
|
|
//跳转到第三方链接
|
|
|
gotoLink(e) {
|
|
|
const value = this.$store.state.user.openid;
|
|
|
- if(!value){
|
|
|
- uni.showToast({title: '未登录,请登录',icon: 'none'})
|
|
|
- setTimeout(this.goLog,1000)
|
|
|
+ if (!value) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未登录,请登录',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ setTimeout(this.goLog, 1000)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let link = e.currentTarget.dataset.link;
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/skipone/skipone?url=" + encodeURIComponent(link),
|
|
@@ -154,9 +197,17 @@
|
|
|
|
|
|
// 获取收藏事件
|
|
|
getdata() {
|
|
|
+ console.log(111);
|
|
|
+ // this.timer=setInterval(() => {
|
|
|
+ // if(this.animationDataArr.length>0){
|
|
|
+ // console.log(this.animationDataArr.length);
|
|
|
+ // this.animationDataArr.unshift()
|
|
|
+ // }
|
|
|
+ // }, 1500)
|
|
|
+
|
|
|
const value = this.$store.state.user.openid;
|
|
|
- if(!value) return this.collArr = []
|
|
|
-
|
|
|
+ if (!value) return this.collArr = []
|
|
|
+
|
|
|
// 触发收藏事件
|
|
|
console.log('触发收藏事件');
|
|
|
// this.collArr: [],
|