This commit is contained in:
lipenggao 2024-10-16 17:56:25 +08:00
parent b61fa0a736
commit c9afb569b1
6 changed files with 59 additions and 32 deletions

View File

@ -56,7 +56,7 @@
<swiper class="_banner_swiper" interval={{4000}} duration={{150}} onChange="{{bannerChange}}">
<block a:for="{{pageDataInfo.bannerList}}">
<swiper-item class="" a:key={{item.bookid}}>
<view class="_ba_swiper_item" onTap="{{toPathVideo}}" data-item="{{item}}">
<view class="_ba_swiper_item" onTap="toPathVideo" data-item="{{item}}">
<image src="{{item.cover}}" mode="aspectFill" class="_is_swiper_img"></image>
</view>
</swiper-item>

View File

@ -1,3 +1,4 @@
import { objectToQueryString } from '../../utils/utils'
Page({
data: {
baoxianFlag: false,
@ -18,15 +19,16 @@ Page({
const sid = query.sid || '';
const id = query.id || '';
const tid = query.tid || '';
const systemInfo = getApp().globalData.systemInfo;
const systemInfo = my.getSystemInfoSync();
const isUrlString = objectToQueryString(query)
if (sid || id || tid) {
if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') {
my.navigateTo({
url: `/pages/videoAndroid/videoAndroid?sid=${sid}&id=${id}&tid=${tid}`,
url: `/pages/videoAndroid/videoAndroid?${isUrlString}`,
});
} else {
my.navigateTo({
url: `/pages/video/video?sid=${sid}&id=${id}&tid=${tid}`
url: `/pages/video/video?${isUrlString}`
});
}
} else {
@ -38,6 +40,10 @@ Page({
},
onShow() {
// 页面显示
const systemInfo = my.getSystemInfoSync();
this.setData({
systemInfo,
})
this.isGetList();
},
@ -117,6 +123,7 @@ Page({
toPathVideo(event) {
const data = event.target.dataset.item;
const systemInfo = this.data.systemInfo;
console.log(systemInfo, "systemInfo")
if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') {
my.navigateTo({
url: `/pages/videoAndroid/videoAndroid?sid=${data.id}`,

View File

@ -11,7 +11,7 @@ Page({
onShow() {
const historyData = my.getStorageSync({ key: 'historySearch' });
this.setData({
historySearch: historyData.data
historySearch: historyData.data || [],
})
},
@ -36,12 +36,12 @@ Page({
console.log(res, Array.isArray(res.data), "findfind")
if (Array.isArray(res.data)) {
historySearch.push(event);
this.setHistorySearch(historySearch);
this.setData({
searchList: res.data,
searchKeyword: event,
searchFlag: true
})
this.setHistorySearch(historySearch);
}
})
},
@ -90,6 +90,7 @@ Page({
httpRequest(paramenter).then(res => {
console.log(res, Array.isArray(res.data), "findfind")
if (Array.isArray(res.data)) {
console.log(historySearch, 'historySearch')
historySearch.push(item);
this.setHistorySearch(historySearch);
this.setData({

View File

@ -1,4 +1,5 @@
import { imageBasUrl } from '../../utils/config'
import { imageBasUrl } from '../../utils/config';
import { objectToQueryString } from '../../utils/utils'
const { httpRequest } = getApp();
// import { throttle } from 'lodash';
// import { throttle } from '../../utils/throttle'
@ -28,7 +29,8 @@ Page({
batchAllOrder: 0,
batchAllList: [],
isThrottle: null,
pageHideFlag: true
pageHideFlag: true,
initParams: {}
},
// 获取其它信息
isOtherFn() {
@ -118,24 +120,24 @@ Page({
},
// 获取 剧情
async isVideoPaymentFn(sid, id, tid) {
async isVideoPaymentFn(params) {
const body = {};
// const body = {};
if (sid) {
body.sid = sid;
}
if (sid) {
body.id = id;
}
if (sid) {
body.tid = tid;
}
// if (sid) {
// body.sid = sid;
// }
// if (sid) {
// body.id = id;
// }
// if (sid) {
// body.tid = tid;
// }
const paramVideo = {
path: '/videoread',
method: 'POST',
body: body
body: params
}
const videoRead = await httpRequest(paramVideo);
@ -198,7 +200,7 @@ Page({
content: res.msg || '购买成功',
duration: 1000,
})
this.isVideoPaymentFn(sid);
this.isVideoPaymentFn({ sid: sid, id: videoInfoObj.id, });
}
}).catch(err => {
if (err.status == 2) {
@ -334,7 +336,8 @@ Page({
this.setData({
sid: sid,
id: id,
tid: tid
tid: tid,
initParams: query
})
},
@ -342,8 +345,9 @@ Page({
const sid = this.data.sid;
const id = this.data.id;
const tid = this.data.tid;
const initParams = this.data.initParams;
this.isOtherFn();
this.isVideoPaymentFn(sid, id, tid);
this.isVideoPaymentFn(initParams);
// const lodash = require('lodash');
const isThrottle = _.throttle((current) => {
let id = '';

View File

@ -1,4 +1,5 @@
import { imageBasUrl } from '../../utils/config'
import { imageBasUrl } from '../../utils/config';
import { objectToQueryString } from '../../utils/utils'
const { httpRequest } = getApp();
// import { throttle } from 'lodash';
// import { throttle } from '../../utils/throttle'
@ -32,7 +33,8 @@ Page({
videoDuration: '0.00',
currentTime: '0.00',
sliderMax: 100,
sliderValue: 0
sliderValue: 0,
initParams: {}
},
// 获取其它信息
isOtherFn() {
@ -122,13 +124,11 @@ Page({
},
// 获取 剧情
async isVideoPaymentFn(sid) {
async isVideoPaymentFn(isBody) {
const paramVideo = {
path: '/videoread',
method: 'POST',
body: {
sid: sid
}
body: isBody
}
const videoRead = await httpRequest(paramVideo);
@ -190,7 +190,7 @@ Page({
content: res.msg || '购买成功',
duration: 1000,
})
this.isVideoPaymentFn(sid);
this.isVideoPaymentFn({ sid, id: videoInfoObj.id, });
}
}).catch(err => {
if (err.status == 2) {
@ -450,14 +450,16 @@ Page({
onLoad(query) {
const sid = query.sid;
this.setData({
sid: sid
sid: sid,
initParams: query
})
},
onShow() {
const sid = this.data.sid;
const initParams = this.data.initParams;
this.isOtherFn();
this.isVideoPaymentFn(sid);
this.isVideoPaymentFn(initParams);
// const lodash = require('lodash');
const isThrottle = _.throttle((current) => {
let id = '';

View File

@ -14,4 +14,17 @@ export const storageUid = (uid) => {
uid: uid
},
});
}
export function objectToQueryString(obj) {
return Object.keys(obj).map(key => {
let value = obj[key];
// 处理数组情况
if (Array.isArray(value)) {
value = value.map(v => encodeURIComponent(v)).join(',');
} else {
value = encodeURIComponent(value);
}
return `${encodeURIComponent(key)}=${value}`;
}).join('&');
}