From 1629d48c881f9fd138e6902f9c0185afa8f7ea4d Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 14 七月 2025 09:01:20 +0800
Subject: [PATCH] 新增活动视频富文本
---
pages/tabbar/video/video.vue | 65 ++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 20 deletions(-)
diff --git a/pages/tabbar/video/video.vue b/pages/tabbar/video/video.vue
index be52e74..c601704 100644
--- a/pages/tabbar/video/video.vue
+++ b/pages/tabbar/video/video.vue
@@ -1,5 +1,5 @@
<template>
- <view class="publish-container">
+ <view class="publish-container" :style="{height: windowHeight - marginBottom - 50 + 'px'}">
<u-popup v-model="fileTypeShow" mode="bottom" round="20" height="35%">
<view style="width: 100%;height:100%;display: flex;flex-direction: column;justify-content: center;align-items: center;">
<view>璇烽�夋嫨瑕佸彂甯冪殑绫诲瀷</view>
@@ -75,7 +75,7 @@
@input="searchTags"
></u-input>
<!-- 宸查�夎瘽棰樺睍绀� -->
- <view class="tags-display" v-if="formData.tags.length > 0">
+ <view class="tags-display" v-show="formData.tags.length > 0">
<my-tag
v-for="(tag, index) in formData.tags"
:key="index"
@@ -85,12 +85,12 @@
@close="removeTag(index)"
/>
</view>
- <text class="tags-count" v-if="formData.tags.length > 0">
+ <text class="tags-count" v-show="formData.tags.length > 0">
宸查�� {{ formData.tags.length }}/5
</text>
</view>
<!-- 璇濋鎺ㄨ崘 -->
- <view class="hot-topics" v-if="showTopicRecommendations">
+ <view class="hot-topics" v-show="showTopicRecommendations">
<text class="section-title">{{ tagInput ? '鎺ㄨ崘璇濋' : '鐑棬璇濋' }}</text>
<view class="topic-list">
<my-tag
@@ -125,14 +125,14 @@
></u-icon>
</u-input>
<view class="goods-preview" @click="chooseGoods" v-for="goods in selectedGoodsList" :key="goods.id">
- <image :src="goods.thumbnail" class="goods-image"></image>
+ <image :src="endpoint + '/' + goods.thumbnail" class="goods-image"></image>
<view class="goods-info">
<text class="goods-name">{{ goods.goodsName }}</text>
<view style="display: flex;">
<view class="goods-price" style="flex: 1;">楼{{ goods.price }}</view>
<view @click.stop="() => {}" style="flex: 1;display: flex;justify-content: center;align-items: center;">
<view style="width: 90rpx">鏁伴噺锛�</view>
- <uni-number-box v-model="goods.selectNum" :min="0"/>
+ <uni-number-box v-model="goods.goodsNum" :min="1"/>
</view>
</view>
</view>
@@ -183,7 +183,7 @@
:key="goods.id"
@click="selectGoods(goods, index)"
>
- <image :src="goods.thumbnail" class="goods-image"></image>
+ <image :src="endpoint + '/' + goods.thumbnail" class="goods-image"></image>
<view class="goods-info">
<text class="goods-name">{{ goods.goodsName }}</text>
<text class="goods-price">楼{{ goods.price }}</text>
@@ -208,7 +208,7 @@
import '@/components/uview-components/uview-ui';
import MyTag from '@/components/my-tag.vue'
-import { getSTSToken, getFilePreviewUrl } from "@/api/common.js";
+import { getSTSToken } from "@/api/common.js";
import { publish } from "@/api/video.js";
import { getRecommendTag3 } from "@/api/video-tag.js";
import { getFileKey } from "@/utils/file.js";
@@ -239,7 +239,7 @@
goodsQuery: {
keyword: '',
searchFromSelfStore: false, // 鏄惁鏄煡璇㈣嚜瀹跺簵閾哄晢鍝�
- pageNumber: 1,
+ pageNumber: 0,
pageSize: 5
},
formData: {
@@ -249,7 +249,6 @@
videoFileKey: '',
videoDuration: 0,
videoFit: 'cover',
- goodsId: '',
videoContentType: 'video',
videoImgs: [],
tags: [],
@@ -266,7 +265,9 @@
]
},
screenWidth: 375,
- gap: 10 // 鍥剧墖闂磋窛
+ gap: 10, // 鍥剧墖闂磋窛
+ windowHeight: 0,
+ marginBottom: 0
};
},
computed: {
@@ -289,7 +290,9 @@
// 鑾峰彇灞忓箷瀹藉害
const systemInfo = uni.getSystemInfoSync()
this.screenWidth = systemInfo.windowWidth
- this.goodsQuery.pageNumber = 1
+ this.windowHeight = systemInfo.windowHeight
+ this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
+ this.goodsQuery.pageNumber = 0
this.goodsQuery.pageSize = 10
this.getVideoGoodsByEs()
},
@@ -310,7 +313,7 @@
},
// 澶勭悊鍟嗗搧鎼滅储鍊�
handlerGoodsSearch() {
- this.goodsQuery.pageNumber = 1
+ this.goodsQuery.pageNumber = 0
this.goodsQuery.pageSize = 10
this.getVideoGoodsByEs()
},
@@ -318,7 +321,7 @@
async getVideoGoodsByEs() {
getVideoGoodsList(this.goodsQuery).then(res => {
- if(this.goodsQuery.pageNumber === 1) {
+ if(this.goodsQuery.pageNumber === 0) {
this.goodsList = res.data.data
} else {
this.goodsList = [
@@ -451,7 +454,22 @@
},
// 閲嶆柊涓婁紶
reUpload() {
- this.resetData()
+ this.videoInfo = {
+ url: '',
+ fileKey: '',
+ fileType: '',
+ fileSize: 0,
+ originalFileName: '',
+ cover: ''
+ };
+ this.formData.videoFileKey = ''
+ this.formData.cover = ''
+ this.formData.videoFit = 'cover'
+ this.formData.videoDuration = 0
+ this.formData.videoImgs = []
+ this.formData.fileInfo = {}
+ this.formData.videoContentType = 'video'
+ this.videoPreviewImgs = []
this.fileTypeShow = true
},
// 閫夋嫨瑙嗛鍥鹃泦
@@ -470,7 +488,7 @@
let fileName = tmpImg.substring(tmpImg.lastIndexOf('/') + 1);
// 澶勭悊瀹夊崜鍙兘鐨刄RI缂栫爜
if(fileName.indexOf('%') > -1) {
- fileName = decodeURIComponent(fileName);
+ fileName = decodeURIComponent(fileName);
}
const fileKey = getFileKey(fileName);
this.cosClient.uploadFile({
@@ -527,13 +545,19 @@
// 閫夋嫨鍟嗗搧
chooseGoods() {
+ if(this.selectedGoodsList.length > 0) {
+ const selectedGoodsSkuIds = new Set(this.selectedGoodsList.map(i => i.id));
+ this.goodsList?.forEach(goods => {
+ this.$set(goods, 'selected', selectedGoodsSkuIds.has(goods.id));
+ });
+ }
this.showGoodsPicker = true;
},
// 閫夋嫨鍏蜂綋鍟嗗搧
selectGoods(goods, index) {
if(! this.selectedGoodsList.some(item => item.id === goods.id)) {
- goods["selectNum"] = 1
+ goods["goodsNum"] = 1
this.selectedGoodsList.push(goods)
this.goodsList[index].selected = true
} else {
@@ -616,7 +640,7 @@
if (valid && this.canPublish) {
this.loading = true;
this.formData.fileInfo = this.videoInfo;
- this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsNum: item.selectNum}});
+ this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsSkuId: item.id, goodsNum: item.goodsNum}});
publish(this.formData).then(res => {
uni.showToast({
title: '瑙嗛宸叉彁浜ゅ鏍竳',
@@ -661,7 +685,6 @@
cover: '',
videoFit: 'cover',
videoDuration: 0,
- goodsId: '',
videoContentType: 'video',
videoImgs: [],
tags: [],
@@ -677,7 +700,7 @@
<style scoped>
.publish-container {
padding: 10px;
- padding-bottom: 120rpx;
+ overflow-y: scroll;
}
.upload-section {
@@ -793,6 +816,7 @@
flex-wrap: wrap;
margin-top: 15rpx;
line-height: 22px;
+ height: 80rpx;
}
.hot-topics {
@@ -800,6 +824,7 @@
flex-direction: column;
margin-top: 15rpx;
margin-bottom: 15rpx;
+ height: 46rpx;
}
.section-title {
--
Gitblit v1.8.0