This commit is contained in:
cc_zbp 2023-06-02 16:49:03 +08:00
commit 028a8e342f
3 changed files with 1853 additions and 1791 deletions
pages
index
short_video/nvueSwiper
project.config.json

@ -77,7 +77,7 @@
where: {
category_id: 0,
page: 1,
limit: 15
limit: 30
},
currentItemId: 69, // 0 || 69
keyword: '',
@ -88,7 +88,6 @@
}
},
onPullDownRefresh() {
this.where.page = 1
this.getCateList()
this.getGoods()
this.selfLocation()
@ -197,9 +196,7 @@
}, ...data]
},
tabsChange(item) {
this.cateGoods = []
this.where.category_id = item.category_id
this.where.page = 1
this.getGoods()
this.street_id = item.id
this.tabsData.tabsActive = item.index

@ -41,10 +41,11 @@
v-if="Math.abs(k-index)<=1"
-->
<video :id="list.community_id+''+index" :loop="true" :muted="list.isplay"
:autoplay="index == k && isRoutine" :controls="false" :http-cache="true" :page-gesture="false"
:show-fullscreen-btn="false" :show-loading="false" :show-center-play-btn="false"
:enable-progress-gesture="false" :src="list.video_link" @ended="ended" @play="play(index)"
@click="tapVideoHover(list.state,$event)" @waiting="waiting(index)"
:autoplay="index == k && isRoutine" :controls="false" :http-cache="true"
:page-gesture="false" :show-fullscreen-btn="false" :show-loading="false"
:show-center-play-btn="false" :enable-progress-gesture="false" :src="list.video_link"
@ended="ended" @play="play(index)" @click="tapVideoHover(list.state,$event)"
@waiting="waiting(index)"
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;z-index: -1;'"></video>
</view>
<!-- 播放状态pause 的时候就会暂停 -->
@ -86,9 +87,10 @@
</view>
</view>
<view v-if="list.relevance.length == 1 && k===index" class="product">
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;" scroll-with-animation
show-scrollbar="true">
<view class="product-item" v-for="(goods,idx) in list.relevance" :key="idx" v-if="goods.spu">
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;"
scroll-with-animation show-scrollbar="true">
<view class="product-item" v-for="(goods,idx) in list.relevance" :key="idx"
v-if="goods.spu">
<view v-if="goods.spu" class="item-count acea-row" @click="goDetail(goods.spu)">
<view class="picture">
<image :src="goods.spu.image"></image>
@ -105,12 +107,13 @@
</scroll-view>
</view>
<view v-else-if="list.relevance.length > 1 && k===index" class="product">
<swiper :autoplay="true" :circular="circular" :interval="interval" :duration="duration" :loop="true"
next-margin="20rpx" previous-margin="20rpx">
<swiper :autoplay="true" :circular="circular" :interval="interval" :duration="duration"
:loop="true" next-margin="20rpx" previous-margin="20rpx">
<block v-for="(goods,idx) in list.relevance" :key="idx" v-if="goods.spu">
<swiper-item class="swiper-item">
<view class="swiper-count">
<view v-if="goods.spu" class="item-count acea-row" @click="goDetail(goods.spu)">
<view v-if="goods.spu" class="item-count acea-row"
@click="goDetail(goods.spu)">
<view class="picture">
<image :src="goods.spu.image"></image>
</view>
@ -138,15 +141,19 @@
<!-- 1.头像 -->
<navigator v-if="list.author && userInfo.uid != list.author.uid" hover-class="none"
:url="'/pages/plantGrass/plant_user/index?id='+list.uid" class="pictrue">
<image class="userAvatar" :src="list.author&&list.author.avatar || '/static/images/f.png'"
mode="aspectFill"></image>
<view v-if="!list.is_fans || !userInfo.uid" class="guanzhu" @click.stop="followAuthor(list)"><text
<image class="userAvatar"
:src="list.author&&list.author.avatar || '/static/images/f.png'" mode="aspectFill">
</image>
<view v-if="!list.is_fans || !userInfo.uid" class="guanzhu"
@click.stop="followAuthor(list)"><text
class="iconfont icon-shangpinshuliang-jia"></text></view>
<view v-else class="yiguanzhu"><text class="iconfont"></text></view>
</navigator>
<!-- 2.点赞 -->
<view @click="cLike(list);" style="margin-top: 5px;" :class="{'likeNumActive':list.relevance_id}">
<text class="iconfont icon-shipindianzan-yidian" :class="{'likeNumActive':list.relevance_id}"></text>
<view @click="cLike(list);" style="margin-top: 5px;"
:class="{'likeNumActive':list.relevance_id}">
<text class="iconfont icon-shipindianzan-yidian"
:class="{'likeNumActive':list.relevance_id}"></text>
<text class="info-text">{{list.count_start > 0 ? list.count_start : '点赞'}}</text>
</view>
<!-- 3.评论 -->
@ -161,7 +168,8 @@
<text class="info-text">分享</text>
</view>
<!-- 5.自己的视频 -->
<view v-if="list.author && userInfo.uid == list.author.uid && isUser" style="margin-top: 17px;">
<view v-if="list.author && userInfo.uid == list.author.uid && isUser"
style="margin-top: 17px;">
<view class="video-my">
<view class="video-dian" @click.stop="showManage = !showManage">
<text class="dian"></text>
@ -171,7 +179,8 @@
<view class="manage" v-show="showManage">
<navigator hover-class="none"
:url="'/pages/plantGrass/plant_release/index?id='+list.community_id+'&type=2'" class="items">
:url="'/pages/plantGrass/plant_release/index?id='+list.community_id+'&type=2'"
class="items">
<image class="image" src="../static/img/index/video-edit.png"></image>
<text>编辑</text>
</navigator>
@ -202,12 +211,13 @@
<view class="title">{{item.title}}</view>
<view class="goods_info flex_a_c">
<view class="l_info flex_a_c">
<image :src="(item.author && item.author.avatar) || '/static/images/f.png'" mode="aspectFill"
class="g_img"></image>
<image :src="(item.author && item.author.avatar) || '/static/images/f.png'"
mode="aspectFill" class="g_img"></image>
<view class="g_name">{{item.author && item.author.nickname}}</view>
</view>
<view class="nice_box flex_a_c" @click.stop="giveStart(item)">
<text class="iconfont" :class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
<text class="iconfont"
:class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
<text class="collect">{{item.count_start}}</text>
</view>
</view>
@ -241,7 +251,8 @@
</button>
<!-- #endif -->
<!-- #ifdef MP -->
<button class="item" :class="weixinStatus ? 'item3' : ''" open-type="share" hover-class='none' @click="goFriend">
<button class="item" :class="weixinStatus ? 'item3' : ''" open-type="share" hover-class='none'
@click="goFriend">
<view class="iconfont icon-weixin3"></view>
<view class="">发送给朋友</view>
</button>
@ -268,12 +279,20 @@
<script>
const app = getApp();
import { toLogin } from '@/libs/login.js';
import { mapGetters } from 'vuex';
import { configMap } from '@/utils';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from 'vuex';
import {
configMap
} from '@/utils';
import comment from '@/components/comment.vue';
import mentioned from '@/components/mentioned.vue';
import { HTTP_REQUEST_URL } from '@/config/app';
import {
HTTP_REQUEST_URL
} from '@/config/app';
import {
videoList,
myVideoList,
@ -284,7 +303,10 @@
focusArticleLst,
graphicLstApi
} from '@/api/community.js';
import { getUserInfo, imgToBase } from '@/api/user.js';
import {
getUserInfo,
imgToBase
} from '@/api/user.js';
import authorize from '@/components/Authorize';
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
export default {
@ -293,7 +315,9 @@
mentioned,
authorize
},
computed: configMap({ community_reply_status: 0 }, mapGetters(['isLogin', 'uid'])),
computed: configMap({
community_reply_status: 0
}, mapGetters(['isLogin', 'uid'])),
data() {
return {
imgHost: HTTP_REQUEST_URL,
@ -365,6 +389,7 @@
page: 1,
limit: 10
},
communityId:'',
}
},
watch: {
@ -389,9 +414,11 @@
this.dataList[new_k].state = 'play'
this.dataList[new_k].isplay = false
this.dataList[new_k].playIng = true
if (this.currentNav !== 3) {
setTimeout(() => {
uni.createVideoContext(this.dataList[new_k].community_id + '' + new_k, this).play()
}, 250)
}
this.videoShare(this.dataList[new_k])
// #endif
}
@ -409,7 +436,6 @@
this.get() //刚进入页面加载数据
if (this.isLogin) {
this.getUserInfo();
this.downloadFilePromotionCode(this.videoID);
}
// #ifdef H5
this.setOpenShare();
@ -464,7 +490,8 @@
this.page = 1;
this.loadVideo = true;
this.dataList = [];
n == 1 ? this.get() : this.getFocusList();
n == 1 ? this.get() : '';
n == 2 ? this.getFocusList() : '';
n == 3 ? this.getGoods() : '';
},
/**
@ -472,11 +499,14 @@
* 获取视频列表
*/
gogogo(item) {
this.flag = true
this.videoID = item.community_id
this.navTap(1)
},
async getGoods() {
const { data } = await graphicLstApi(this.where)
const {
data
} = await graphicLstApi(this.where)
this.cateGoods = data.list
},
/**
@ -495,7 +525,9 @@
this.isShowAuth = true
} else {
let status = 1
followAuthorApi(item.uid, { status: status }).then(res => {
followAuthorApi(item.uid, {
status: status
}).then(res => {
if (res.status === 200) {
item.is_fans = true
}
@ -525,7 +557,8 @@
});
setTimeout(function() {
uni.redirectTo({
url: '/pages/plantGrass/plant_user/index?id=' + item.uid
url: '/pages/plantGrass/plant_user/index?id=' +
item.uid
})
}, 1000);
}
@ -637,27 +670,25 @@
this.dataList[this.k].state = 'continue';
}
if (this.dataList[this.k].state == 'continue') {
uni.createVideoContext(this.dataList[this.k].community_id + '' + this.k, this).play(); //暂停以后继续播放
uni.createVideoContext(this.dataList[this.k].community_id + '' + this.k, this)
.play(); //暂停以后继续播放
}
if (this.dataList[this.k].state == 'pause') {
uni.createVideoContext(this.dataList[this.k].community_id + '' + this.k, this).pause(); //暂停以后继续播放
uni.createVideoContext(this.dataList[this.k].community_id + '' + this.k, this)
.pause(); //暂停以后继续播放
}
}
this.touchNum = 0;
}, 200)
},
change(event) {
console.log('eeeee', event.detail.current);
this.k = event.detail.current;
this.posterImage = false;
if (this.isLogin) {
this.downloadFilePromotionCode(this.dataList[this.k]['community_id']);
}
this.communityId = this.dataList[this.k]['community_id'];
},
animationfinish(event) {
// 1.这里进行判断,如果是最后一个视频就进入 get() 方法加载视频进入列表
if (this.k == this.dataList.length - 1) {
if (this.k == this.dataList.length - 1 && this.currentNav !== 2) {
this.loadVideo = true;
this.GET()
}
@ -759,6 +790,7 @@
})
},
videoData(list) {
this.communityId = list[0]['community_id']
if (list.length == 0) return
let that = this;
that.page = that.page + 1;
@ -841,9 +873,11 @@
type: type
}).then(async res => {
that.codeImg = res.data.url
}).catch(err => {
that.$set(that, 'PromotionCode', '');
});
},
/*
* 保存到手机相册
@ -899,15 +933,39 @@
* 生成海报
*/
async goPoster() {
if (!this.isLogin) {
let that = this;
if (!that.isLogin) {}
let type;
// #ifndef MP
type = 'wechat'
// #endif
// #ifdef MP
type = 'routine'
// #endif
getVideoCode(that.communityId, {
type: type
}).then(async res => {
if (res.status !== 200) {
that.$util.Tips({
title: '生成海报失败'
});
return false;
}
that.codeImg = res.data.url
}).catch(err => {
that.$set(that, 'PromotionCode', '');
that.$util.Tips({
title: '生成海报失败'
});
return false;
});
console.log(this.posterImage)
if (this.posterImage) {
this.posterImageStatus = true
this.posters = false
return
}
let that = this;
let arr2
that.posters = false;
that.$set(that, 'canvasStatus', true);
@ -930,15 +988,20 @@
// #endif
// #ifdef H5
if (that.dataList[that.k].author.avatar) {
arr2 = [that.posterbackgd, await that.imgToBase(that.dataList[that.k].image[0]), await that.imgToBase(that
.codeImg), await that.imgToBase(that.dataList[that.k].author.avatar)];
arr2 = [that.posterbackgd, await that.imgToBase(that.dataList[that.k].image[0]), await that
.imgToBase(that
.codeImg), await that.imgToBase(that.dataList[that.k].author.avatar)
];
} else {
arr2 = [that.posterbackgd, await that.imgToBase(that.dataList[that.k].image[0]), await that.imgToBase(that
.codeImg), that.avatar];
arr2 = [that.posterbackgd, await that.imgToBase(that.dataList[that.k].image[0]), await that
.imgToBase(that
.codeImg), that.avatar
];
}
// #endif
//生成推广海报
that.$util.videoPosterCanvas(arr2, that.dataList[that.k].content, that.dataList[that.k].author.nickname,
that.$util.videoPosterCanvas(arr2, that.dataList[that.k].content, that.dataList[that.k].author
.nickname,
function(tempFilePath) {
that.$set(that, 'posterImage', tempFilePath);
that.$set(that, 'posterImageStatus', true);
@ -959,7 +1022,7 @@
// #endif
return new Promise((resolve, reject) => {
uni.downloadFile({
url: url,
url,
success: function(res) {
resolve(res.tempFilePath);
},
@ -1030,7 +1093,9 @@
cLike(item) {
if (this.isLogin) {
let status = item.relevance_id ? 0 : 1
graphicStartApi(item.community_id, { status: status }).then(res => {
graphicStartApi(item.community_id, {
status: status
}).then(res => {
if (item.relevance_id) {
item.count_start--;
item.count_start = item.count_start == 0 ? 0 : item.count_start

@ -46,7 +46,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.14.3",
"appid": "wx7502b94d6a53d589",
"appid": "wx6e14cb98394e36bc",
"projectname": "crmeb_merchant_h5",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},