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

View File

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

View File

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

View File

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