123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <template>
- <view class="activity">
- <statusBar :item="navBarData"></statusBar>
- <viewX-Case class="mid">
- <template #title>
- <view class="title three-font">直播活动</view>
- </template>
- <template #lookMore>
- <view class="lookMore fz-font" @click="gotoLiveList">查看更多</view>
- </template>
- <template #activeBlock>
- <view class="activeData" v-for="(item, index) in liveList" :key="index">
- <!-- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//activity/bg1.png" mode="aspectFill"></image> -->
- <image :src="item.pic" mode="aspectFill" @click="gotoAnnoun" :data-index="index"></image>
- <view class="liveBroadcast">
- <view class="title">
- <view class="tag bqZ-font">类型</view>
- <text three-font @click="gotoAnnoun" :data-index="index">{{ item.acName }}</text>
- </view>
- <view class="operate">
- <view class="left">
- <view class="img">
- <image :src="item.avatar" mode="aspectFill"></image>
- </view>
- <view class="user fwb-font">{{ item.username }}</view>
- </view>
- <view class="collection" @click="coll" :data-e="item">
- <!-- <view class="" style="display: flex;margin-right: 10rpx;align-items: center;"> -->
- <view class="img">
- <!-- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Vector (Stroke) (2).png"
- mode="aspectFill"></image> -->
- <image :src="collArr.includes(item.acId) ? pic_coll2 : pic_coll" mode="aspectFill">
- </image>
- </view>
- <text class="fz-font">收藏</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- </viewX-Case>
- <viewX-Case style="margin-top: 10px">
- <template #title>
- <view class="title three-font">常规教研活动</view>
- </template>
- <template #lookMore>
- <view class="lookMore fz-font" @click="lookMore">查看更多</view>
- </template>
- <template #activeBlock>
- <!-- <activity-case v-for="i in 10" :key="i"></activity-case> -->
- <teaching-case :activeList="activeList"></teaching-case>
- </template>
- </viewX-Case>
- <view class="" style="height: 30rpx; width: 100%"> </view>
- <view class="qiu" @click="fabClick">
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/jia.png" mode="aspectFill"></image>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: "活动", //导航栏标题
- btn: 0, //是否显示返回按钮 0不显示 1 显示
- },
- actData: {
- btn: 1,
- },
- title: "uni-fab",
- // 直播活动列表
- liveList: [],
- // 教研活动列表
- activeList: [],
- collArr:[],
- pic_coll:'http://43.139.158.220:5007/img/static/yym/Star 1 (Stroke).png',
- pic_coll2:'https://teacherapi.cocorobo.cn/teaching-file/static//mine/Collect_yellow.png'
- };
- },
- methods: {
- // 获取教研活动
- getData() {
- let data = {
- openid: uni.getStorageSync('oId'),
- ty: 1,
- page: 1, //下拉获取更多的备用字段
- lim: 6 //一次获取多少数据
- }
- this.$request('/selectActivity', "POST", data).then(res => {
- console.log(res[0]);
- // this.activeList=[...this.activeList,...res[0]]
- this.activeList = res[0]
- })
- },
- // 获取直播活动
- getData2() {
- let data = {
- openid: uni.getStorageSync('oId'),
- ty: 0,
- page: 1, //下拉获取更多的备用字段
- lim: 6 //一次获取多少数据
- }
- this.$request('/selectActivity', "POST", data).then(res => {
- console.log(res[0]);
- // this.activeList=[...this.activeList,...res[0]]
- this.liveList = res[0].slice(0, 6);
- })
- },
- getcoll(){
- let data={
- oid:this.$store.state.user.openid, //用户id
- }
- this.$request('/selectColl','POST',data).then(res=>{
- this.collArr=JSON.parse(res[0][0].coll)
- console.log('进来就显示',this.collArr);
- })
- },
- // 收藏事件
- coll(event){
- // console.log(event.currentTarget.dataset.e);
- console.log(this.$store.state.user.openid);
- let aId=event.currentTarget.dataset.e.acId
- // 先获取用户收藏信息
- let data={
- oid:this.$store.state.user.openid, //用户id
- }
- this.$request('/selectColl','POST',data).then(res=>{
- // console.log('获取收藏信息',res);
- // return console.log('获取收藏信息',res[0][0].coll=='');
- let res2
- let colls
- if(res[0][0].coll!==null && res[0][0].coll !==""){
- colls=JSON.parse(res[0][0].coll)
- console.log('获取收藏信息',colls);
- // 判断收藏表是否包含这个活动
- res2 = colls.some((e)=>{
- return e == aId
- })
- // console.log(res2);
- }
-
- // return console.log('2',res2);
- // 第一次存储返回值为null,然后存储收藏
- if(res[0][0].coll==null || res[0][0].coll==""){
- // 然后进行存储活动到用户coll字段
- let arr={
- oid:this.$store.state.user.openid, //用户id
- acid:JSON.stringify([aId])
- }
- this.$request('/updateColl','POST',arr).then(res=>{
- this.$request('/selectColl','POST',data).then(res=>{
- this.collArr=JSON.parse(res[0][0].coll)
- })
- })
- // 当数组中没有这个收藏活动时添加收藏
- }else if(!res2){
- colls.push(aId)
- let arr2={
- oid:this.$store.state.user.openid, //用户id
- acid:JSON.stringify(colls)
- }
- this.$request('/updateColl','POST',arr2).then(res=>{
- this.$request('/selectColl','POST',data).then(res=>{
- this.collArr=JSON.parse(res[0][0].coll)
- })
- })
- // 取消收藏
- }else if(res2){
- const newArray = colls.filter(item => item !== aId);
- let arr3={
- oid:this.$store.state.user.openid, //用户id
- acid:JSON.stringify(newArray)
- }
- this.$request('/updateColl','POST',arr3).then(res=>{
- this.$request('/selectColl','POST',data).then(res=>{
- this.collArr=JSON.parse(res[0][0].coll)
- })
- })
- }
- })
- },
- lookMore() {
- const value = this.$store.state.user.openid;
- if (value == '') {
- uni.navigateTo({
- url: "/pages/login_Wechat/login_Wechat",
- });
- } else {
- uni.navigateTo({
- url: "/pages/activityList/activityList",
- });
- }
- },
- gotoLiveList() {
- uni.navigateTo({
- url: '/pages/liveActivityList/liveActivityList'
- })
- },
- fabClick() {
- const value = this.$store.state.user.openid;
- if (value == '') {
- uni.navigateTo({
- url: "/pages/login_Wechat/login_Wechat",
- });
- } else {
- uni.navigateTo({
- url: "/pages/publish/publish",
- });
- }
- },
- gotoAnnoun(e) {
- let edata = e.currentTarget.dataset['index'];
- console.log(e.currentTarget.dataset['index'], 123);
- const clickedAcId = this.liveList[edata].acId;
- console.log(clickedAcId);
- const value = this.$store.state.user.openid;
- if (value == '') {
- uni.navigateTo({
- url: "/pages/login_Wechat/login_Wechat",
- });
- } else {
- uni.navigateTo({
- url: "/pages/activityDetail/activityDetail?acId=" + clickedAcId + "&ty=0",
- });
- // const urls = [
- // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1181",//丽湖职教双创教育国际虚拟教研室启动大会暨双创教育国际论坛圆满举行
- // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1234",//丽湖职教双创教育国际虚拟教研室 • 常规教研活动 第9期
- // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1210",//产教融合情境下的双创通识课程建设 | 丽湖职教双创教育国际虚拟教研室常规教研活动第2期顺利举行
- // "https://szptxnjys.yuketang.cn/pro/portal/announcementdetail/1209",//打造双创“金课” | 丽湖职教双创教育国际虚拟教研室常规
- // ];
- // if (index >= 0 && index < urls.length) {
- // const url = urls[index];
- // uni.navigateTo({
- // url: "/pages/skipone/skipone?url=" + encodeURIComponent(url),
- // });
- // }
- }
- },
- },
- onShow() {
- this.getData()
- this.getData2()
- this.getcoll()
- }
- };
- </script>
- <style lang="scss">
- .activity {
- .qiu {
- width: 90rpx;
- height: 90rpx;
- position: fixed;
- z-index: 19;
- right: 30rpx;
- bottom: 10vh;
- border-radius: 50%;
- background-color: rgba(0, 86, 168, 1);
- display: flex;
- justify-content: center;
- align-items: center;
- image {
- position: absolute;
- width: 36rpx;
- height: 36rpx;
- }
- }
- .mid {
- // margin:20px 0;
- .activeData {
- width: 460rpx;
- display: inline-block;
- margin-right: 20px;
- image {
- width: 100%;
- height: 120px;
- border-radius: 10px;
- margin-bottom: 10px;
- }
- .liveBroadcast {
- flex: 1;
- width: 460rpx;
- display: flex;
- flex-direction: column;
- align-content: flex-end;
- .title {
- display: flex;
- align-items: center;
- margin-bottom: 10rpx;
- .tag {
- // border: 1px #00b2b6 solid;
- // // font-size: 12px;
- // width: 64rpx;
- // height: 38rpx;
- // display: flex;
- // white-space: nowrap;
- // justify-content: center;
- // align-items: center;
- // // padding: 2px 4px;
- // padding: 1rpx 4rpx;
- // border-radius: 3px;
- // margin-right: 10rpx;
- // color: #00b2b6;
- border: 1px #00b2b6 solid;
- font-size: 20rpx;
- width: 64rpx;
- display: flex;
- height: 34rpx;
- white-space: nowrap;
- justify-content: center;
- align-items: center;
- // padding: 4px 12px 4px 12px;
- border-radius: 5rpx;
- margin-right: 10rpx;
- color: #00b2b6;
- }
- text {
- // display: -webkit-box;//对象作为弹性伸缩盒子模型显示
- // overflow: hidden;//溢出隐藏
- // -webkit-box-orient: vertical;//设置伸缩盒子对象的子元素的排列方式
- // -webkit-line-clamp: 2;//设置 块元素包含的文本行数
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .operate {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 0;
- color: #666666;
- // margin-bottom: 20rpx;
- // padding-bottom: 20rpx;
- .left {
- display: flex;
- align-items: center;
- .img {
- width: 48rpx;
- height: 48rpx;
- margin-right: 10rpx;
- image {
- width: 100%;
- height: 100%;
- border-radius: 50%;
- }
- }
- .user {}
- }
- .collection {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 88rpx;
- height: 32rpx;
- position: relative;
- .img {
- position: absolute;
- left: 0;
- top: 6rpx;
- transform: translate(-130%, 0);
- }
- image {
- width: 27rpx;
- height: 25rpx;
- display: block;
- }
- // float: right;
- // font-size: 14px;
- // padding-top: 10px;
- }
- }
- }
- }
- .activeData:nth-child(1) {
- margin-left: 15px;
- }
- }
- .title {
- font-weight: bold;
- // color: #999999;
- }
- .lookMore {
- color: #666666;
- // font-size: 14px;
- }
- }
- </style>
|