mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-07 02:12:25 +08:00
小程序直播
This commit is contained in:
@ -75,7 +75,8 @@ App({
|
||||
application_describe: "{{application_describe}}",
|
||||
|
||||
// 价格符号
|
||||
price_symbol: "{{price_symbol}}"
|
||||
price_symbol: "{{price_symbol}}",
|
||||
price_symbol: "¥",
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -63,7 +63,10 @@
|
||||
"pages/plugins/wallet/user-cash/user-cash",
|
||||
"pages/plugins/wallet/user-cash-detail/user-cash-detail",
|
||||
"pages/plugins/excellentbuyreturntocash/profit/profit",
|
||||
"pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail"
|
||||
"pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail",
|
||||
"pages/plugins/weixinliveplayer/index/index",
|
||||
"pages/plugins/weixinliveplayer/search/search",
|
||||
"pages/plugins/weixinliveplayer/detail/detail"
|
||||
],
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
@ -111,7 +114,12 @@
|
||||
"request": 10000,
|
||||
"downloadFile": 10000
|
||||
},
|
||||
"plugins": {},
|
||||
"plugins": {
|
||||
"live-player-plugin": {
|
||||
"version": "1.0.5",
|
||||
"provider": "wx2b03c6e691cd7370"
|
||||
}
|
||||
},
|
||||
"debug": true,
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
sourcecode/weixin/images/plugins/weixinliveplayer/share-icon.png
Normal file
BIN
sourcecode/weixin/images/plugins/weixinliveplayer/share-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
sourcecode/weixin/images/plugins/weixinliveplayer/time-icon.png
Normal file
BIN
sourcecode/weixin/images/plugins/weixinliveplayer/time-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,160 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: null,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
detail: null,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 启动参数处理
|
||||
params = app.launch_params_handle(params);
|
||||
|
||||
//params['id'] = 1;
|
||||
this.setData({ params: params });
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var self = this;
|
||||
wx.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
wx.request({
|
||||
url: app.get_request_url("detail", "search", "weixinliveplayer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.params.id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
detail: data.data,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: '',
|
||||
});
|
||||
|
||||
// 标题
|
||||
wx.setNavigationBarTitle({ title: data.data.name });
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 详情图片查看
|
||||
detail_images_view_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if (value != null) {
|
||||
wx.previewImage({
|
||||
current: value,
|
||||
urls: [value]
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 进入直播
|
||||
player_event(e) {
|
||||
if ((this.data.detail || null) != null)
|
||||
{
|
||||
if (this.data.detail.status == 1 || this.data.detail.status == 2) {
|
||||
var room_id = this.data.detail.id
|
||||
var params = encodeURIComponent(JSON.stringify({type: 'detail'}));
|
||||
wx.navigateTo({
|
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${this.data.detail.id}&custom_params=${params}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
app.showToast('数据有误');
|
||||
}
|
||||
},
|
||||
|
||||
// 海报分享
|
||||
share_event() {
|
||||
var user = app.get_user_info(this, 'poster_event');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/login/login?event_callback=poster_event"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
wx.showLoading({ title: '生成中...' });
|
||||
wx.request({
|
||||
url: app.get_request_url('poster', 'index', 'weixinliveplayer'),
|
||||
method: 'POST',
|
||||
data: { "id": this.data.detail.id },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
wx.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
wx.previewImage({
|
||||
current: res.data.data,
|
||||
urls: [res.data.data]
|
||||
});
|
||||
} else {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user = app.get_user_cache_info() || null;
|
||||
var user_id = (user != null && (user.id || null) != null) ? user.id : 0;
|
||||
if ((this.data.detail || null) == null)
|
||||
{
|
||||
var did = this.data.detail.id;
|
||||
var name = this.data.detail.name;
|
||||
} else {
|
||||
var did = 0;
|
||||
var name = '';
|
||||
}
|
||||
return {
|
||||
title: app.data.application_title + name,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/plugins/weixinliveplayer/detail/detail?id=' + did + '&referrer=' + user_id
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "直播详情"
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
<view wx:if="{{detail != null}}" class="detail">
|
||||
<!-- 封面图片 -->
|
||||
<image wx:if="{{(detail || null) != null && (detail.share_img || null) != null}}" class="banner wh-auto dis-block" src="{{detail.share_img}}" mode="widthFix" bindtap="detail_images_view_event" data-value="{{detail.share_img}}" />
|
||||
|
||||
<!-- 标题 -->
|
||||
<view class="name">{{detail.name}}</view>
|
||||
|
||||
<!-- 基础信息 -->
|
||||
<view class="bg-white base">
|
||||
<view class="item">
|
||||
<image class="item-icon" src="/images/plugins/weixinliveplayer/status-icon.png" mode="widthFix" />
|
||||
<text class="cr-888">直播状态</text>
|
||||
<view class="fr more status-{{detail.status}}">{{detail.status_name}}</view>
|
||||
</view>
|
||||
<view class="item br-t item-time">
|
||||
<image class="item-icon" src="/images/plugins/weixinliveplayer/time-icon.png" mode="widthFix" />
|
||||
<text class="cr-888">开播时间</text>
|
||||
<view class="fr time">
|
||||
<view class="start-time">{{detail.start_time}}</view>
|
||||
<view class="end-time">{{detail.end_time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 导航 -->
|
||||
<view class="nav wh-auto">
|
||||
<button type="primary" class="share-submit fl" hover-class="none" bindtap="share_event">
|
||||
<image class="item-icon" src="/images/plugins/weixinliveplayer/share-icon.png" mode="widthFix" />
|
||||
<text>分享</text>
|
||||
</button>
|
||||
<button type="default" class="player-submit fr {{detail.status == 1 || detail.status == 2 ? '' : 'disabled'}}" hover-class="none" bindtap="player_event">
|
||||
<image class="item-icon" src="/images/plugins/weixinliveplayer/player-icon.png" mode="widthFix" />
|
||||
<text>{{detail.status_name}}</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<import src="/pages/common/nodata.wxml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
.detail {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
font-weight: 500;
|
||||
padding: 15rpx 10rpx;
|
||||
}
|
||||
.base {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 15rpx 10rpx 0 10rpx;
|
||||
}
|
||||
.base .item {
|
||||
line-height: 50rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.base .item .item-icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.base .item .more {
|
||||
color: #999;
|
||||
}
|
||||
.base .item .status-0 {
|
||||
color: #0e90d2;
|
||||
}
|
||||
.base .item .status-1 {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.base .item .status-2 {
|
||||
color: #F37B1D;
|
||||
}
|
||||
.base .item-time {
|
||||
line-height: 75rpx;
|
||||
}
|
||||
.base .item-time .time {
|
||||
line-height: 38rpx;
|
||||
}
|
||||
.base .item-time .start-time {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.base .item-time .end-time {
|
||||
color: #dd514c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航
|
||||
*/
|
||||
.nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
height: 100rpx;
|
||||
}
|
||||
.nav button {
|
||||
width: 50%;
|
||||
height: 100% !important;
|
||||
border-radius: 0;
|
||||
font-size: 32rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.nav button image {
|
||||
width: 40rpx;
|
||||
height: 40rpx !important;
|
||||
vertical-align: middle;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.nav button.player-submit {
|
||||
background: #d2364c;
|
||||
color: #fff;
|
||||
}
|
||||
.nav button.disabled {
|
||||
background: #ffc5cd;
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
load_status: 0,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '',
|
||||
data_list: [],
|
||||
data_base: null,
|
||||
banner_list: [],
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 启动参数处理
|
||||
params = app.launch_params_handle(params);
|
||||
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list() {
|
||||
var self = this;
|
||||
|
||||
// 加载loding
|
||||
wx.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
wx.request({
|
||||
url: app.get_request_url("index", "index", "weixinliveplayer"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
self.setData({ load_status: 1 });
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var status = ((data.data || null) == null || data.data.length == 0);
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
banner_list: data.banner_list || [],
|
||||
data_list: data.data,
|
||||
data_list_loding_status: status ? 0 : 3,
|
||||
data_bottom_line_status: !status,
|
||||
});
|
||||
|
||||
// 导航名称
|
||||
if ((data.base || null) != null && (data.base.application_name || null) != null) {
|
||||
wx.setNavigationBarTitle({ title: data.base.application_name });
|
||||
}
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user = app.get_user_cache_info() || null;
|
||||
var user_id = (user != null && (user.id || null) != null) ? user.id : 0;
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/plugins/weixinliveplayer/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "直播",
|
||||
"usingComponents": {
|
||||
"component-banner": "/components/slider/slider"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<!-- 轮播 -->
|
||||
<component-banner prop-data="{{banner_list}}"></component-banner>
|
||||
|
||||
<!-- 导航 -->
|
||||
<view wx:if="{{load_status == 1}}" class="nav bg-white spacing-mb">
|
||||
<view class="title">最新直播</view>
|
||||
<navigator url="/pages/plugins/weixinliveplayer/search/search" hover-class="none">
|
||||
<view class="arrow-right more">查看更多</view>
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<view wx:if="{{data_list.length > 0}}" class="data-list">
|
||||
<view wx:for="{{data_list}}" wx:key="key" wx:for-item="item" class="item bg-white spacing-mb">
|
||||
<navigator url="/pages/plugins/weixinliveplayer/detail/detail?id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.share_img}}" mode="aspectFit" class="fl" />
|
||||
<view class="fl base">
|
||||
<view class="single-text name">{{item.name}}</view>
|
||||
<view class="time">
|
||||
<view class="fl time-title">开播时间</view>
|
||||
<view class="start-time">{{item.start_time}}</view>
|
||||
<view class="end-time">{{item.end_time}}</view>
|
||||
</view>
|
||||
<view class="status status-{{item.status}}">{{item.status_name}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<import src="/pages/common/nodata.wxml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 导航
|
||||
*/
|
||||
.nav {
|
||||
padding: 20rpx 10rpx;
|
||||
position: relative;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.nav .title {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.nav .more {
|
||||
position: absolute;
|
||||
top: 22rpx;
|
||||
right: 10rpx;
|
||||
color: #888;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.data-list .item {
|
||||
overflow: hidden;
|
||||
padding: 20rpx 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.data-list .item image {
|
||||
width: 160rpx;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .item .base {
|
||||
width: calc(100% - 190rpx);
|
||||
text-align: left;
|
||||
padding: 0 10rpx 0 20rpx;
|
||||
}
|
||||
.data-list .item .base .name {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.data-list .item .base .time {
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
.data-list .item .base .time-title {
|
||||
width: 60rpx;
|
||||
background: #7ad2ff;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 10rpx;
|
||||
line-height: 30rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.data-list .item .base .start-time {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.data-list .item .base .end-time {
|
||||
color: #dd514c;
|
||||
}
|
||||
.data-list .item .base .status {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
bottom: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
.data-list .item .base .status-0 {
|
||||
color: #0e90d2;
|
||||
}
|
||||
.data-list .item .base .status-1 {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.data-list .item .base .status-2 {
|
||||
color: #F37B1D;
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
nav_status_list: [
|
||||
{ name: "全部", value: "-1" },
|
||||
{ name: "未开始", value: "0" },
|
||||
{ name: "直播中", value: "1" },
|
||||
{ name: "暂停中", value: "2" },
|
||||
{ name: "已结束", value: "3" },
|
||||
],
|
||||
nav_status_index: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 启动参数处理
|
||||
params = app.launch_params_handle(params);
|
||||
|
||||
// 是否指定状态
|
||||
var nav_status_index = 0;
|
||||
if ((params.status || null) != null) {
|
||||
for (var i in this.data.nav_status_list) {
|
||||
if (this.data.nav_status_list[i]['value'] == params.status) {
|
||||
nav_status_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
params: params,
|
||||
nav_status_index: nav_status_index,
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
wx.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var status = ((this.data.nav_status_list[this.data.nav_status_index] || null) == null) ? -1 : this.data.nav_status_list[this.data.nav_status_index]['value'];
|
||||
|
||||
// 获取数据
|
||||
wx.request({
|
||||
url: app.get_request_url("index", "search", "weixinliveplayer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page,
|
||||
status: status,
|
||||
is_more: 1,
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({ data_bottom_line_status: false });
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list: [],
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_status_index: e.currentTarget.dataset.index || 0,
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user = app.get_user_cache_info() || null;
|
||||
var user_id = (user != null && (user.id || null) != null) ? user.id : 0;
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/plugins/weixinliveplayer/search/search?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "直播列表"
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<!-- 导航 -->
|
||||
<view class="nav">
|
||||
<block wx:for="{{nav_status_list}}" wx:key="key">
|
||||
<view class="item fl tc cr-888 {{nav_status_index == index ? 'active' : ''}}" data-index="{{index}}" bindtap="nav_event">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view wx:if="{{data_list.length > 0}}" class="data-list">
|
||||
<view wx:for="{{data_list}}" wx:key="key" wx:for-item="item" class="item bg-white spacing-mb">
|
||||
<navigator url="/pages/plugins/weixinliveplayer/detail/detail?id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.share_img}}" mode="aspectFit" class="fl" />
|
||||
<view class="base fl">
|
||||
<view class="single-text name">{{item.name}}</view>
|
||||
<view class="time">
|
||||
<view class="time-title fl">开播时间</view>
|
||||
<view class="start-time">{{item.start_time}}</view>
|
||||
<view class="end-time">{{item.end_time}}</view>
|
||||
</view>
|
||||
<view class="status status-{{item.status}}">{{item.status_name}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<import src="/pages/common/nodata.wxml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}">
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
||||
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 导航
|
||||
*/
|
||||
.nav {
|
||||
background: #eee;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.nav .item {
|
||||
width: 20%;
|
||||
}
|
||||
.nav .active {
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 80rpx);
|
||||
}
|
||||
.data-list .item {
|
||||
overflow: hidden;
|
||||
padding: 20rpx 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.data-list .item image {
|
||||
width: 160rpx;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .item .base {
|
||||
width: calc(100% - 190rpx);
|
||||
text-align: left;
|
||||
padding: 0 10rpx 0 20rpx;
|
||||
}
|
||||
.data-list .item .base .name {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.data-list .item .base .time {
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
.data-list .item .base .time-title {
|
||||
width: 60rpx;
|
||||
background: #7ad2ff;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 10rpx;
|
||||
line-height: 30rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.data-list .item .base .start-time {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.data-list .item .base .end-time {
|
||||
color: #dd514c;
|
||||
}
|
||||
.data-list .item .base .status {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
bottom: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
.data-list .item .base .status-0 {
|
||||
color: #0e90d2;
|
||||
}
|
||||
.data-list .item .base .status-1 {
|
||||
color: #5eb95e;
|
||||
}
|
||||
.data-list .item .base .status-2 {
|
||||
color: #F37B1D;
|
||||
}
|
||||
Reference in New Issue
Block a user