增加通用的webview页面
This commit is contained in:
parent
8e44bd6fe0
commit
5c866095af
@ -36,6 +36,7 @@ export default class extends wepy.app {
|
|||||||
'pages/search',
|
'pages/search',
|
||||||
'pages/jumppage',
|
'pages/jumppage',
|
||||||
'pages/video',
|
'pages/video',
|
||||||
|
'pages/webview',
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'light',
|
backgroundTextStyle: 'light',
|
||||||
|
@ -27,11 +27,16 @@ export default class cfgMixin extends wepy.mixin {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/*获取成就达成人数要求的配置*/
|
/*帮助视频地址*/
|
||||||
$getHelpVideoLink() {
|
$getHelpVideoLink() {
|
||||||
let cfgObj = wepy.getStorageSync('cfg');
|
let cfgObj = wepy.getStorageSync('cfg');
|
||||||
return cfgObj.help_video;
|
return cfgObj.help_video;
|
||||||
}
|
}
|
||||||
|
/*电影播放页面地址*/
|
||||||
|
$getMovieUrl() {
|
||||||
|
let cfgObj = wepy.getStorageSync('cfg');
|
||||||
|
return cfgObj.movieurl;
|
||||||
|
}
|
||||||
$getExtCfg(name) {
|
$getExtCfg(name) {
|
||||||
let cfgObj = wepy.getStorageSync('cfg');
|
let cfgObj = wepy.getStorageSync('cfg');
|
||||||
let price = cfgObj.ext_json_cfg;
|
let price = cfgObj.ext_json_cfg;
|
||||||
|
@ -27,4 +27,16 @@ export default class navMixin extends wepy.mixin {
|
|||||||
url: '/pages/video?link=' + encodeURIComponent(link) + '&title=' + encodeURIComponent(title)
|
url: '/pages/video?link=' + encodeURIComponent(link) + '&title=' + encodeURIComponent(title)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 电影播放页面
|
||||||
|
* @param {string} movieUrl 视频地址
|
||||||
|
* @param {string} title 页面标题,可为空
|
||||||
|
* */
|
||||||
|
$toMovie(movieUrl, title) {
|
||||||
|
let obj = `{"url": "${movieUrl}","name":"${title}"}`;
|
||||||
|
const link = `${this.$getMovieUrl()}?param=${encodeURIComponent(obj)}`;
|
||||||
|
wepy.navigateTo({
|
||||||
|
url: '/pages/webview?link=' + encodeURIComponent(link) + '&title=' + encodeURIComponent(title)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,9 +134,11 @@
|
|||||||
this.$toGameInfo(gid);
|
this.$toGameInfo(gid);
|
||||||
},
|
},
|
||||||
async toSearch() {
|
async toSearch() {
|
||||||
wepy.navigateTo({
|
// wepy.navigateTo({
|
||||||
url: '/pages/search'
|
// url: '/pages/search'
|
||||||
})
|
// })
|
||||||
|
let movie = 'http://iqiyi.kuyun-bofang.com/20190208/eebojrT3/index.m3u8'
|
||||||
|
this.$toMovie(movie, '流浪地球');
|
||||||
},
|
},
|
||||||
async showInviteView() {
|
async showInviteView() {
|
||||||
await this.updateInviteViewData();
|
await this.updateInviteViewData();
|
||||||
|
98
src/pages/webview.wpy
Normal file
98
src/pages/webview.wpy
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<style lang="less">
|
||||||
|
.container{
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<web-view src="{{link}}" @load="webloaded" @error="webloaderror" @message="onMessage"></web-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import wepy from 'wepy'
|
||||||
|
import base from '../mixins/base';
|
||||||
|
import tips from '../mixins/tips';
|
||||||
|
import cfg from '../mixins/cfg';
|
||||||
|
|
||||||
|
export default class WebViewPage extends wepy.page {
|
||||||
|
components = {};
|
||||||
|
mixins = [base, tips, cfg];
|
||||||
|
config = {
|
||||||
|
navigationBarBackgroundColor: '#000',
|
||||||
|
navigationBarTextStyle: 'white',
|
||||||
|
backgroundColor: '#000',
|
||||||
|
backgroundColorTop: '#000',
|
||||||
|
disableSwipeBack: true,
|
||||||
|
};
|
||||||
|
data = {
|
||||||
|
link: '',
|
||||||
|
movieUrl: '',
|
||||||
|
title: '',
|
||||||
|
};
|
||||||
|
methods = {
|
||||||
|
webloaded: function(e) {
|
||||||
|
console.log('page load finished', e);
|
||||||
|
},
|
||||||
|
webloaderror: function(e) {
|
||||||
|
console.log('page load error', e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad(params) {
|
||||||
|
this.$parent.log('web_view_page_onload', params);
|
||||||
|
this.gid = params.gid;
|
||||||
|
this.link = decodeURIComponent(params.link);
|
||||||
|
this.title = decodeURIComponent(params.title);
|
||||||
|
if (this.title) {
|
||||||
|
wepy.setNavigationBarTitle({
|
||||||
|
title: this.title
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
wepy.setNavigationBarTitle({
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log('load page: ' + this.link);
|
||||||
|
this.$apply();
|
||||||
|
}
|
||||||
|
onShow() {
|
||||||
|
let cfg = wepy.getStorageSync('cfg');
|
||||||
|
if (!cfg._getrewardtype) {
|
||||||
|
wepy.hideShareMenu();
|
||||||
|
} else {
|
||||||
|
wepy.showShareMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onShareAppMessage() {
|
||||||
|
let account = wepy.getStorageSync('account');
|
||||||
|
let url = `/pages/index?isShare=1&inviter_id=${account.account_id}`;
|
||||||
|
let shareObj = this.$getShareCfg();
|
||||||
|
let shareStr = shareObj.str;
|
||||||
|
let shareImg = shareObj.image
|
||||||
|
this.$parent.log('onShareAppMessage', {page: 'game', gid: this.gid, shareUrl: url});
|
||||||
|
console.log('share url: ' + url);
|
||||||
|
return {
|
||||||
|
title: shareStr,
|
||||||
|
path: url,
|
||||||
|
imageUrl: shareImg,
|
||||||
|
success: function (res) {
|
||||||
|
wepy.getShareInfo({
|
||||||
|
shareTicket: res.shareTickets[0]
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
// 分享失败
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user