webupload 踩过的坑

本文详细介绍了webupload组件的使用方法,包括按钮元素绑定、动态按钮绑定及上传额外参数的设置。通过具体代码示例,展示了如何在上传前添加自定义参数,确保后台能以表单形式接收数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. webupload 绑定的按钮元素内必须包含内容

2.动态绑定按钮,在改变页面元素后,在create一遍即可

2.动态上传额外参数(以表单数据形式上传,后台以表单形式获取数据)

uploader.on('uploadBeforeSend', function(obj, data, headers) {

                  data = $.extend(data, {

                                       "manuscript_guid": manuscriptGuid

                      });

});

<template> <view> <view style="position: relative;"> <!-- banner --> <view class="container"> <swiper class="view_banner" :indicator-dots="true" autoplay interval="5000" duration="500" circular="true" previous-margin="20px" next-margin="20px"> <swiper-item v-for="(item, index) in bannerItem" :key="index" style="margin-top: 5%;"> <view class="swiper_banner" @click="bannerClik(item)"> <image :src="item.fileImg" mode="aspectFill"></image> </view> </swiper-item> </swiper> </view> <!-- banner下功能按钮 --> <view class="function-btn"> <view class="btn-history" @click="bindHistory()"> <image class="btn-image" src="@/static/images/index/我的追剧.png" mode="aspectFit"></image> <view class="btn-text">我的追剧</view> </view> <view class="btn-history" @click="bindSort()"> <image class="btn-image" src="@/static/images/index/排行榜.png" mode="aspectFit"></image> <view class="btn-text">排行榜</view> </view> <view class="btn-history" @click="fulllist()"> <image class="btn-image" src="@/static/images/index/短剧-copy-copy.png" mode="aspectFill"></image> <view class="btn-text">完整短剧</view> </view> <view class="btn-history" @click="freelist()"> <image class="btn-image" src="@/static/images/index/free.png" mode="aspectFill"></image> <view class="btn-text">免费短剧</view> </view> </view> <view class="gradient-background"> <view style="display: flex; align-items: center;"> <view class="view-desc" style="margin-top: 20px; margin-bottom: -4px;"> <image src="@/static/images/index/toplist.png" mode="scaleToFill"></image> 短剧排行 <text style="font-size: 14px; font-weight: normal; position: absolute; right: 0; margin-right: 12px;" @click="bindSort()"> 完整榜单> </text> </view> </view> <view v-for="(item, index) in hotVideoItem" v-if="index < 3" style="border-radius: 8px; background-color: white; margin: 15px; height: 200px;"> <view style="display: flex; width: 100%;"> <image :src="item.picUrl" style="width: 50%; height: 200px; border-radius: 8px 0px 0px 8px"></image> <view class="video-number" style="left: 0; position: absolute; margin-left: 15px; font-weight: bold;">TOP {{ index + 1 }}</view> <view style="flex-direction: column; margin: 20px; width: 50%;"> <view style="font-size: 16px;"> {{ item.name }} </view> <view style="color: #a1a0a0; font-size: 14px; margin-top: 6px;"> 全{{ item.totalVideo }}集 </view> <view style="color: #a1a0a0; margin-top: 4px;"> <image src="@/static/images/index/播放量.png" style="width: 18px; height: 12px;" mode="scaleToFill"></image> <text style="font-size: 14px; margin-left: 2%;">{{ formatPlays(item.plays) }}</text> </view> <view style="display: flex; font-size: 16px; margin-top: 30px;"> <view @click="videoPlay(item)" style="border-radius: 50px; height: 35px; width: 115px; text-align: center; color: white; display: flex; border: 1px solid #3d8aff; justify-content: center; align-items: center;" class="text-container"> <image src="@/static/images/index/play.png" mode="scaleToFill" style="height: 50%; width: 20%;"></image> <text style="margin-left: 2%; font-size: 12px;">立即观看</text> </view> <view v-if="item.state == 'NO' || item.state == null" @click="changeChase(item, index)" style="border-radius: 50px; height: 35px; width: 115px; text-align: center; background-color: white; display: flex; margin-left: 8%; color: #3d8aff; border: 1px solid #3d8aff; justify-content: center; align-items: center;"> <image src="@/static/images/index/收藏.png" mode="scaleToFill" style="height: 40%; width: 20%;"></image> <text style="margin-left: 2%; font-size: 12px;">加入追剧</text> </view> <view v-else @click="changeChase(item, index)" style="border-radius: 50px; height: 35px; width: 115px; text-align: center; background-color: white; display: flex; margin-left: 8%; color: #3d8aff; border: 1px solid #3d8aff; justify-content: center; align-items: center;"> <image src="@/static/images/index/收藏后.png" mode="scaleToFill" style="height: 50%; width: 25%;"></image> <text style="margin-left: 2%; font-size: 12px;">已追剧</text> </view> </view> </view> </view> </view> </view> <view style="color: dimgray; font-weight: bold; font-size: 15px; display: flex; overflow-x: scroll; justify-content: flex-start; margin-top: 20px; margin-left: 20px; margin-right: 20px;"> <view style="white-space: nowrap;" key="'0'" :class="{ 'selected-text': selectedTagId == '0' }"> <text @click="getHomeVideo()">全部</text> </view> <view v-for="(item, index) in tagList" :key="item.id" style="white-space: nowrap; margin-left: 20px;" :class="{ 'selected-text': selectedTagId == item.id }"> <text @click="getSortVideo(item)">{{ item.tag }}</text> </view> </view> <view class="container-video" v-if="selectedTagId == '0'"> <view class="video-list" v-for="(item, index) in videoItem" :key="index"> <view class="video-item" @click="videoPlay(item)"> <image :src="item.picUrl" mode="scaleToFill" style="border-radius: 8px 8px 0px 0px;"></image> <text style="margin-top: 2%;">{{ item.name }}</text> <text style="font-size: 14px; color: #a1a0a0;">全{{ item.totalVideo }}集</text> <view style="color: #a1a0a0; display: flex; margin-left: 3%;"> <image src="@/static/images/index/播放量.png" style="width: 18px; height: 12px; margin-top: 4%;" mode="scaleToFill"></image> <text style="font-size: 14px; margin-left: 2%; color: #a1a0a0;"> {{ formatPlays(item.plays) }} </text> </view> </view> </view> </view> <view class="end-style" v-if="historyList.length > 0 && showHistoryList"> <view class="collapsible-view" @click="toPlay()"> <view class="close-button" @click.stop="toggleHistoryList">×</view> <image :src="historyList[0].picUrl" style="width: 25%; height: 100%; border-radius: 5px 0px 0px 5px;"></image> <view style="display: grid; margin-left: 10px;"> <text style="font-size: 14px; margin-top: 8%;">{{ historyList[0].seriesName }}</text> <view style="display: flex; margin-top: -2%;"> <text style="font-size: 14px;">上次看到第{{ historyList[0].videoName }}集</text> <view @click="toPlay()" style="border-radius: 50px; height: 30px; width: 80px; color: white; display: flex; border: 1px solid #3d8aff; justify-content: center; align-items: center; margin-top: 5%; margin-left: 60px;" class="text-container"> <text style="font-size: 14px;">立即观看</text> </view> </view> </view> </view> </view> </view> </view> </template> <script> import BASE_URL from '@/components/baseUrl'; import request from "@/components/request.js" // const PlayerManager = require('@/pages/utils/playerManager.js') // 注释掉这一行 export default { data() { return { videoItem: [], bannerItem: [], page: 1, hotVideoItem: [], videoName: "", sortHotItem: [], sortHighItem: [], sortNewItem: [], searchPlaceholder: "输入短剧名称", isNew: false, has: true, historyList: [], linkId: "", mediaId: "", seriesId: "", seriesName: "", platform: "", adId: "", adAccount: "", total: 0, tagList: [], selectedTagId: '0', sortItem: [], showHistoryList: true, // 控制历史记录折叠视图的显示与隐藏 } }, onLoad: function(options) { var that = this; console.log("loading...", uni.getStorageSync("option")); console.log("some field:", options); console.log(BASE_URL); this.linkId = options.Lid; this.seriesId = options.videoId; this.mediaId = options.mediaId; this.seriesName = options.videoName; if (this.linkId != undefined && this.mediaId == undefined) { if (!uni.getStorageSync("userInfo")) { this.getSeriesByLink(this.linkId); } } if (options.adv_id) { this.adId = options.adv_id; this.platforms = "DOUYIN"; this.adAccount = options.advertiser_id; const query = { adId: this.adAccount, platform: this.platforms, clickId: options.clue_token, exposureId: options.exposure_id, callback: null, }; uni.setStorageSync("option", query); } this.getIndex(); uni.request({ url: BASE_URL + "/program/page", method: "POST", data: { current: 1, name: "合恕小剧场", size: 10, type: "", }, header: { "Content-Type": "application/json", }, success: (res) => { console.log("请求成功:", res); if (res.data.data.records.length > 0) { uni.setStorageSync("programId", res.data.data.records[0].id); uni.setStorageSync("program", res.data.data.records[0]); uni.setStorageSync("pay", res.data.data.records[0]); if (uni.getStorageSync("userInfo")) { // 如果用户已登录,执行相关操作 console.log("用户已登录"); if ( this.seriesName != undefined && this.seriesId != undefined && this.linkId != undefined && this.mediaId != undefined ) { console.log("存在系列名称、系列 ID、链接 ID 和媒体 ID,调用 getDramaVideo 方法"); this.getDramaVideo(uni.getStorageSync("userInfo").isVip); } else { console.log("媒体 ID 不存在,发起请求获取相关数据"); if (this.linkId != undefined && this.mediaId == undefined) { uni.request({ url: BASE_URL + "/biz/link/queryByLink", method: "GET", header: { "token": uni.getStorageSync("token"), "programId": uni.getStorageSync("programId"), }, data: { link: this.linkId, }, success: (res) => { console.log("请求链接相关数据成功"); this.seriesId = res.data.data.seriesId; this.mediaId = res.data.data.mediaId; this.seriesName = res.data.data.seriesName; if ( this.seriesName != undefined && this.seriesId != undefined && this.linkId != undefined && this.mediaId != undefined ) { console.log("成功获取系列名称、系列 ID、链接 ID 和媒体 ID,调用 getDramaVideo 方法"); this.getDramaVideo(uni.getStorageSync("userInfo").isVip); } }, fail: (err) => { console.error("请求链接相关数据失败:", err); } }); } } console.log("获取用户信息及其他页面数据"); this.getUserInfo(); this.queryDict(); this.getHistory(); this.getBanner(); this.getHomeVideo(); this.getSortList(); this.getRecommend(); } else { // 如果用户未登录,调用抖音登录接口 console.log("用户未登录,调用抖音登录接口"); tt.login({ success(res) { console.log("抖音登录成功,返回结果:", res); if (res.code) { console.log("获取到有效的 code:", res.code); uni.request({ url: BASE_URL + "/auth/b/getOpenid", header: { "programId": uni.getStorageSync("programId"), }, method: "GET", data: { code: res.code, programType: "DOUYIN", }, success: (res) => { console.log("请求获取 OpenID 成功,返回结果:", res); if (res.data.code === 200) { console.log("成功获取 OpenID,调用 loginFirst 方法进行登录"); that.loginFirst(res.data.data); } else { console.error("获取 OpenID 失败,错误信息:", res); } }, fail: (err) => { console.error("请求获取 OpenID 失败,错误信息:", err); }, }); } else { console.error("未获取到有效的 code,抖音登录失败"); } }, fail(err) { console.error("抖音登录失败,错误信息:", err); }, }); } } }, fail: (err) => { console.error("请求失败:", err); }, }); this.getSortTag(); this.isNew = getApp().globalData.isNew; }, onPullDownRefresh() { // this.getHistory() this.getBanner() // this.page = 1 // this.getHomeVideo() }, onShow() { this.getHistory() this.getSortList() }, methods: { formatPlays(plays) { if (plays < 10000) { return `${plays}次`; // 不足1万,直接显示数字 } else { return `${(plays / 10000).toFixed(2)}万`; // 超过1万,显示为X.XX万 } }, toggleHistoryList(event) { this.showHistoryList = !this.showHistoryList; // 切换显示与隐藏 }, bindSign() { uni.navigateTo({ url: "/packagesUser/sign/sign" }) }, bindSort() { uni.navigateTo({ url: "/packagesVideo/videoSort/videoSort" }) }, bindHistory() { uni.navigateTo({ url: "/pages/chase/chase" }) }, loginFirst(phoneNumber) { console.log("loginFirst called with phoneNumber:", phoneNumber); // 加载加密库 const sm2 = require("sm-crypto").sm2; const cipherMode = 0; // 加密用户输入的密码(假设用户输入的密码存储在 this.userPassword 中) const encryptedPassword = sm2.doEncrypt("123456", "03c0e7c1d3d5c33325ee5abc68a8c37dddeab3d2d2b90fde0cfaa78315b8e87f68", cipherMode); // 显示加载提示 uni.showLoading({ title: "正在登录", }); uni.request({ url: BASE_URL + "/auth/b/loginOrCreat", method: "POST", header: { "programId": uni.getStorageSync("programId"), "content-type": "application/json; charset=utf-8;", }, data: { account: phoneNumber, password: encryptedPassword, platform: 2, // 抖音平台标识 adId: uni.getStorageSync("option").adId, adAccount: this.adAccount, invest: { exposureId: uni.getStorageSync("option").exposureId, eventType: 0, platform: uni.getStorageSync("option").platform, fee: 0, clickId: uni.getStorageSync("option").clickId, code: uni.getStorageSync("douyinCode"), adId: uni.getStorageSync("option").adId, callback: uni.getStorageSync("option").callback, }, }, success: (res) => { uni.hideLoading(); console.log("loginOrCreat response:", res); if (res.data && res.data.code === 200) { uni.setStorageSync("token", res.data.data.token); uni.setStorageSync("userInfo", res.data.data.user); this.getUserInfo(); uni.showToast({ title: "登录成功", icon: "success", }); } else { console.error("loginOrCreat failed", res); uni.showToast({ title: "登录失败,请重试", icon: "none", }); } }, fail: (err) => { uni.hideLoading(); console.error("loginOrCreat failed", err); uni.showToast({ title: "网络请求失败,请检查网络", icon: "none", }); }, }); }, getDramaVideo(param) { uni.request({ url: BASE_URL + '/biz/series/detail', method: 'GET', data: { id: this.seriesId }, success: (res) => { if (res.data.code == 200) { // 注释掉与 PlayerManager 相关的代码 // if (param != null && param == "YES") { // PlayerManager.navigateToPlayer(res.data.data.mediaId, res.data.data.start - 1, // res.data.data.totalVideo, currentseries) // } else if (res.data.data.isPay == "NO") { // PlayerManager.navigateToPlayer(res.data.data.mediaId, res.data.data.totalVideo, // res.data.data.totalVideo, currentseries) // } else { // const currentseries = res.data.data // uni.request({ // url: BASE_URL + "/biz/order/getExpendByUser", // method: 'POST', // header: { // token: uni.getStorageSync("token") // }, // data: { // seriesName: this.seriesName, // userId: uni.getStorageSync("userInfo").id, // seriesId: this.seriesId // }, // success: (res) => { // if (res.data.code == 200) { // const len = res.data.data.length // PlayerManager.navigateToPlayer(currentseries.mediaId, // currentseries.start - 1, 0, currentseries, len) // if (len > 0) { // uni.setStorageSync("haveVideo", res.data.data) // } // } // } // }) // } } }, }) }, getUserInfo() { var that = this; console.log("当前 token:", uni.getStorageSync("token")); uni.request({ url: BASE_URL + "/biz/user/getLoginUserByToken", method: "GET", header: { "token": uni.getStorageSync("token"), "programId": uni.getStorageSync("programId"), }, data: { link: this.linkId, }, success: (res) => { console.log("getLoginUserByToken response:", res); // 检查后端返回的数据是否包含用户信息 if (res.data && res.data.id) { // 如果后端直接返回用户信息 uni.setStorageSync("userInfo", res.data); this.userInfo = uni.getStorageSync("userInfo"); } else if (res.data && res.data.code === 401) { // 处理 token 无效的情况 console.error("Token无效,重新登录"); this.loginFirst(); } else { // 如果返回的数据不符合预期,抛出错误 console.error("getLoginUserByToken failed", res); } }, fail: (err) => { console.error("request failed", err); } }); }, freelist() { uni.navigateTo({ url: '/pages/freelist/freelist' }) }, changeChase(item, index) { uni.showLoading({ title:"加载中..." }) var that = this var state = "" if (item.state == "YES") { state = "NO" } else { state = "YES" } uni.request({ url: BASE_URL + "/chase/addOrCancel", method:'POST', header:{ token: uni.getStorageSync("token") }, data: { userId: uni.getStorageSync("userInfo").id, seriesId: item.id, state: state }, success: (res) => { uni.hideLoading() that.hotVideoItem[index].state = state if (uni.getStorageSync("userInfo").chase == 0 && state == "YES") { const user = uni.getStorageSync("userInfo") user.chase = 1 uni.setStorageSync("userInfo", user) this.userInfo = uni.getStorageSync("userInfo") uni.showToast({ title: '恭喜获得30金豆', image: '/static/images/index/bean.png' }) } },fail: () => { uni.hideLoading() uni.showToast({ title:'请求失败,请稍后再试~', icon: 'none' }) } }) }, fulllist() { uni.navigateTo({ url: '/pages/fulllist/fulllist' }) }, getBanner() { let data = { current: 1, size: 20 } uni.request({ url: BASE_URL + "/biz/banner/page", method: "GET", header: { "programId": uni.getStorageSync("programId"), 'content-type': 'application/json; charset=utf-8;', }, data: { current: 1, size: 20 }, success: (res) => { if (res.data.code == 200) { for (let i = 0; i < res.data.data.records.length; i++) { if (res.data.data.records[i].tag != "RECOMMEND") { this.bannerItem.push(res.data.data.records[i]) } } console.log(this.bannerItem) } }, }) }, getHomeVideo() { this.selectedTagId = '0' uni.request({ url: BASE_URL + "/biz/series/page", methods: 'GET', header: { "programId": uni.getStorageSync("programId"), 'content-type': 'application/json; charset=utf-8;', "token": uni.getStorageSync("token"), }, data: { isPay: 'YES' }, success: (res) => { if (res.data.code == 200) { this.videoItem = res.data.data } }, fail: (e) => { console.log("错误:" + e) } }) }, // getHomeVideo() { // request.getHomeVideo({ // current: this.page, // size: 20, // }) // .then(res => { // this.videoItem = res.data.records // this.sortNewItem = this.videoItem // }) // }, bannerClik(item) { switch (item.tag) { case "VIDEO": // for (let i = 0; i < this.historyList.length; i++) { // if (this.historyList[i].seriesId == item.url) { // item.number = this.historyList[i].videoName // break // } // } const vip = uni.getStorageSync("userInfo").isVip const currentseries = { id: item.url, mediaId: item.mediaId, need: item.need, name: item.seriesName, start: item.start, totalVideo: item.totalVideo } // 注释掉与 PlayerManager 相关的代码 // if (vip != null && vip == "YES") { // PlayerManager.navigateToPlayer(item.mediaId, item.start - 1, item.totalVideo, currentseries) // } else if (item.isPay == "NO") { // PlayerManager.navigateToPlayer(item.mediaId, item.totalVideo, item.totalVideo, currentseries) // } else { // uni.request({ // url: BASE_URL + "/biz/order/getExpendByUser", // method: 'POST', // header: { // token: uni.getStorageSync("token") // }, // data: { // seriesName: currentseries.name, // userId: uni.getStorageSync("userInfo").id, // seriesId: currentseries.id // }, // success: (res) => { // const len = res.data.data.length // if (len > 0) { // uni.setStorageSync("haveVideo", res.data.data) // } // PlayerManager.navigateToPlayer(currentseries.mediaId, currentseries.start -1, 0, currentseries, len) // } // }) // } break case "URL": const webUrl = item.url uni.navigateTo({ url: "/packagesVideo/webView/webView?url=" + webUrl + "&title=" + item.title }) break; } }, getIndex() { let interstitialAd = null if (wx.createInterstitialAd) { interstitialAd = wx.createInterstitialAd({ adUnitId: 'adunit-66eeb550ffb21da4' }) interstitialAd.onLoad(() => {}) interstitialAd.onError((err) => {}) interstitialAd.onClose(() => {}) } if (interstitialAd) { interstitialAd.show().catch((err) => {}) } }, getSortTag() { this.tagList = [] var that = this uni.request({ url: BASE_URL + "/biz/videotag/page", method: 'GET', data: { current: 1, size: 50 }, success(res) { if (res.data.code === 200) { that.tagList = res.data.data.records } } }) }, //热播TOP tableSort() { uni.navigateTo({ url: "/packagesVideo/videoSort/videoSort" }) }, //签到 tableSign() { let token = uni.getStorageSync("token"); if (token == "") { uni.navigateTo({ url: "/packagesUser/login/login" }) } else { uni.navigateTo({ url: "/packagesUser/sign/sign" }) } }, //视频列表 --- 视频播放 videoPlay(item) { let token = uni.getStorageSync("token"); if (token == "") { uni.navigateTo({ url: "/packagesUser/login/login", }) } else { // 注释掉与 PlayerManager 相关的代码 // const vip = uni.getStorageSync("userInfo").isVip // if (vip != null && vip == "YES") { // PlayerManager.navigateToPlayer(item.mediaId, item.start - 1, item.totalVideo, item) // } else if (item.isPay == "NO") { // PlayerManager.navigateToPlayer(item.mediaId, item.totalVideo, // item.totalVideo, item) // } else { // uni.request({ // url: BASE_URL + "/biz/order/getExpendByUser", // method: 'POST', // header: { // token: uni.getStorageSync("token") // }, // data: { // seriesName: item.name, // userId: uni.getStorageSync("userInfo").id, // seriesId: item.id // }, // success: (res) => { // const len = res.data.data.length // PlayerManager.navigateToPlayer(item.mediaId, item.start - 1, 0, item, len) // if (len > 0) { // uni.setStorageSync("haveVideo", res.data.data) // } // } // }) // } } }, queryDict() { uni.request({ url: BASE_URL + "/dev/dict/tree", method: "GET", header: { "programId": uni.getStorageSync("programId"), 'content-type': 'application/json; charset=utf-8;', }, success: (res) => { uni.setStorageSync("dict", res.data.data) } }) }, getSortList() { uni.request({ url: BASE_URL + "/biz/series/getRank", method: 'GET', header: { "programId": uni.getStorageSync("programId"), "token": uni.getStorageSync("token") }, data: { current:1, size: 3 }, success: (res) => { if (res.data.code == 200) { //this.sortHighItem = res.data.data if (res.data.data.records.length > 8) { this.hotVideoItem = res.data.data.records.slice(0, 8) } else { this.hotVideoItem = res.data.data.records } } } }) }, getHistory() { console.log(BASE_URL) uni.request({ url: BASE_URL + "/history/getByUser", method: 'GET', header: { "token": uni.getStorageSync("token") }, success: (res) => { if (res.data.code == 200) { this.historyList = [] if (res.data.data.length > 0) { this.historyList.push(res.data.data[0]) } } } }) }, // 推荐页数据 getRecommend() { var that = this uni.request({ url: BASE_URL + "/biz/seriesvideo/recommend", method: 'GET', header: { "token": uni.getStorageSync("token"), "programId": uni.getStorageSync("programId"), }, data: { current: that.page, size: 20, userId: uni.getStorageSync("userInfo").id }, success: (res) => { if (res.data.data.records.length > 0) { for (let i = 0; i < res.data.data.records.length; i++) { res.data.data.records[i].isplay = true res.data.data.records[i].state = "pause" res.data.data.records[i].playIng = false } uni.setStorageSync("recommendList", res.data.data.records) console.log("获取推荐数据") console.log(uni.getStorageSync("recommendList")) } }, fail(e) { console.log("错误:" + e) } }) }, getSeriesByLink(param) { var that = this uni.request({ url: BASE_URL + "/biz/link/queryByLink", method: 'GET', header: { "token": uni.getStorageSync("token"), "programId": uni.getStorageSync("programId"), }, data: { link: param }, success: (res) => { this.seriesId = res.data.data.seriesId this.mediaId = res.data.data.mediaId this.seriesName = res.data.data.seriesName } }) }, getSortVideo(param) { this.selectedTagId = param.id uni.request({ url: BASE_URL + "/biz/videotag/getSeriesListById", method: 'GET', header: { "token": uni.getStorageSync("token") }, data: { id: param.id }, success: (res) => { if (res.data.code) { this.sortItem = res.data.data } } }) }, toPlay() { uni.request({ url: BASE_URL + '/biz/series/detail', method: 'GET', data: { id: this.historyList[0].seriesId }, success: (res) => { // 注释掉与 PlayerManager 相关的代码 // const vip = uni.getStorageSync("userInfo").isVip // if (vip != null && vip == "YES") { // PlayerManager.navigateToPlayer(res.data.data.mediaId, res.data.data.start - 1, // res.data.data.totalVideo, res.data.data) // } else if (res.data.data.isPay == "NO") { // PlayerManager.navigateToPlayer(res.data.data.mediaId, res.data.data.totalVideo, // res.data.data.totalVideo, res.data.data) // } else { // const seriesdetail = res.data.data // uni.request({ // url: BASE_URL + "/biz/order/getExpendByUser", // method: 'POST', // header: { // token: uni.getStorageSync("token") // }, // data: { // seriesName: seriesdetail.name, // userId: uni.getStorageSync("userInfo").id, // seriesId: seriesdetail.id // }, // success: (res) => { // const len = res.data.data.length // PlayerManager.navigateToPlayer(seriesdetail.mediaId, // seriesdetail.start - 1, 0, seriesdetail, len) // if (len > 0) { // uni.setStorageSync("haveVideo", res.data.data) // } // } // }) // } } }) } } } </script> <style lang="scss"> page { background-color: #f6f6f6; // banner .view_banner { height: 100%; align-self: center; transform-style: preserve-3d; .swiper_banner { text-align: center; border-radius: 25px; width: 96%; height: 90%; margin-left: 2%; margin-right: 2%; image { width: 100%; height: 100%; border-radius: 25px; // transform: scale(0.8); } } } .swiper_banner-active image { transform: scale(0.2); } .container { background: linear-gradient(to bottom, #87a5fe, #f6f6f6); height: 250px; } .gradient-background { background: linear-gradient(to bottom, #b6d6ff, #f6f6f6); border-radius: 16px; } // banner下功能按钮 .function-btn { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; .btn-history { width: 25%; box-sizing: border-box; text-align: center; padding: 10px; .btn-image { width: 30px; height: 30px; } .btn-text { color: black; font-size: 14px; text-align: center; } } } .text-container { background: linear-gradient(to right, #3d8aff, #67a4ff); } .view-desc { color: #217aff; margin-left: 20px; margin-top: 10px; display: flex; align-items: center; width: 50%; font-size: 20px; font-weight: 700; image { width: 22px; height: 22px; margin-right: 5px; } } .video-number { border-top-left-radius: 5px; border-bottom-right-radius: 5px; padding: 2px 10px; font-size: 10px; color: white; background-image: linear-gradient(90deg, #ff4eb5 0%, #ffa065 100%); } .selected-text text { font-size: 16px; color: #3d8aff; } // 优选好剧 .container-video { width: 100%; min-height: 550px; margin-left: 1%; margin-right: 1%; text-align: left; .video-list { width: 46%; height: 350px; background: white; border-radius: 8px; text-align: left; .video-item { display: grid; margin: -5%; image { width: 100%; height: 280px; } text { margin-left: 3%; font-size: 16px; color: black; text-overflow: ellipsis; width: 100%; overflow: hidden; word-break: break-all; display: -webkit-box; overflow: hidden; word-wrap: break-word; white-space: normal !important; -webkit-line-clamp: 1; -webkit-box-orient: vertical; text-align: left; margin-top: 2%; } } } } //热播TOP .scrollContainer { height: auto; margin-top: 20px; white-space: nowrap; padding-bottom: 10px; .scrollitem { width: 80px; background-color: rgba(0, 0, 0, 0.3); border-radius: 10px; display: inline-block; margin-left: 15rpx; height: auto; padding-bottom: 10px; color: white; text-align: center; image { width: 80px; height: 125px; margin-right: 10px; border-radius: 5px; } .sort-content { .video-name { font-size: 13px; margin-top: 5px; display: -webkit-box; overflow: hidden; text-overflow: ellipsis; word-wrap: break-word; white-space: normal !important; -webkit-line-clamp: 1; -webkit-box-orient: vertical; } .video-upload { font-size: 10px; color: lightslategray; } } .sort-txt { .video-ji { font-size: 10px; margin-top: 5px; color: #33cccc; } } } } .end-style { overflow: hidden; position: fixed; width: 100%; bottom: 0; } .close-button { position: absolute; top: 10px; right: 10px; font-size: 24px; color: white; cursor: pointer; } .collapsible-view { width: 96%; height: 100px; margin: 2%; background-color: rgba(0, 0, 0, 0.6); border-radius: 5px; transition: transform 0.3s ease; transform-origin: left; color: white; display: flex; } } </style> 学习这段代码
最新发布
06-05
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值