mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:33:27 +08:00
【新增】微信小程序直播增加历史直播回放功能。
This commit is contained in:
@@ -13190,5 +13190,10 @@
|
|||||||
订单号
|
订单号
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:CoreCms.Net.Model.WeChatEntites.MyWxaBusinessGetLiveInfoRequest">
|
||||||
|
<summary>
|
||||||
|
<para>扩展 表示 [POST] /wxa/business/getliveinfo 接口的请求。</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.WeChatEntites
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>扩展 表示 [POST] /wxa/business/getliveinfo 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class MyWxaBusinessGetLiveInfoRequest : SKIT.FlurlHttpClient.Wechat.Api.Models.WxaBusinessGetLiveInfoRequest
|
||||||
|
{
|
||||||
|
[Newtonsoft.Json.JsonProperty("action")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("action")]
|
||||||
|
public string Action { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,61 +10,63 @@
|
|||||||
<view slot="right">
|
<view slot="right">
|
||||||
</view>
|
</view>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
|
<view class="coreshop-padding-left-10 coreshop-padding-right-10 coreshop-padding-top-10">
|
||||||
|
<u-subsection :list="items" :current="current" :animation="true" @change="onClickItem" active-color="#ff9900"></u-subsection>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-padding-left-5 coreshop-padding-right-5 coreshop-padding-top-5">
|
||||||
|
<view class="coreshop-margin-top-10" v-if="list.length > 0">
|
||||||
|
<view class="coreshop-bg-white coreshop-border-radius-9 coreshop-margin-10" v-for="item in list" :key="item.roomid" @click="goRoom(item.roomid)">
|
||||||
|
<view class="coreshop-flex coreshop-position-relative coreshop-border-radius-9">
|
||||||
|
<view style="border-top-right-radius: 10px; border-top-left-radius: 10px ">
|
||||||
|
<u--image :src="item.share_img" mode="widthFix" width="698rpx" height="250px"></u--image>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==101">
|
||||||
|
<u-tag text="直播中" size="mini" type="success"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==102">
|
||||||
|
<u-tag text="未开始" size="mini"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==103">
|
||||||
|
<u-tag text="已结束" size="mini" type="warning"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==104">
|
||||||
|
<u-tag text="禁播" size="mini" type="warning"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==105">
|
||||||
|
<u-tag text="暂停" size="mini" type="error"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==106">
|
||||||
|
<u-tag text="异常" size="mini" type="error"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute" v-if="item.live_status==107">
|
||||||
|
<u-tag text="已过期" size="mini" type="error"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-position-absolute coreshop-padding-8" style="bottom: 0rpx;">
|
||||||
|
<view class="coreshop-font-14 coreshop-text-white">{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="coreshop-margin-top-10" v-if="list.length > 0">
|
<view class="coreshop-flex coreshop-flex-wrap coreshop-justify-start coreshop-font-sm coreshop-flex-direction-row coreshop-align-center coreshop-padding-top-10 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-padding-bottom-5">
|
||||||
<view class="coreshop-bg-white coreshop-border-radius-9 coreshop-margin-10" v-for="item in list" :key="item.roomid" @click="goRoom(item.roomid)">
|
<view class="coreshop-font-14 coreshop-text-black">
|
||||||
<view class="coreshop-flex coreshop-position-relative coreshop-border-radius-9" >
|
主播:
|
||||||
<view style="border-top-right-radius: 10px; border-top-left-radius: 10px ">
|
</view>
|
||||||
<u--image :src="item.share_img" mode="widthFix" width="716rpx" height="170px" ></u--image>
|
<view class="coreshop-font-14 coreshop-text-black">{{ item.anchor_name }}</view>
|
||||||
|
<view class="coreshop-font-12 coreshop-text-black coreshop-padding-left-4 coreshop-padding-right-4 "> | </view>
|
||||||
|
<view class="coreshop-font-12 coreshop-text-black">直播商品:{{ item.goods.length }}件</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==101">
|
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-font-12 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-padding-bottom-8 coreshop-text-grey">
|
||||||
<u-tag text="直播中" size="mini" type="success"></u-tag>
|
直播时间:{{$u.timeFormat(item.start_time, 'yyyy-mm-dd hh:MM:ss')}} 至 {{$u.timeFormat(item.end_time, 'yyyy-mm-dd hh:MM:ss')}}
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==102">
|
|
||||||
<u-tag text="未开始" size="mini"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==103">
|
|
||||||
<u-tag text="已结束" size="mini" type="warning"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==104">
|
|
||||||
<u-tag text="禁播" size="mini" type="warning"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==105">
|
|
||||||
<u-tag text="暂停" size="mini" type="error"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==106">
|
|
||||||
<u-tag text="异常" size="mini" type="error"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute" v-if="item.live_status==107">
|
|
||||||
<u-tag text="已过期" size="mini" type="error"></u-tag>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-position-absolute coreshop-padding-8" style="bottom: 0rpx; ">
|
|
||||||
<view class="coreshop-font-14 coreshop-text-white">{{ item.name }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view>
|
||||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-justify-start coreshop-font-sm coreshop-flex-direction-row coreshop-align-center coreshop-padding-top-10 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-padding-bottom-5">
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="0" margin-bottom="20" class="coreshop-padding-top-10" />
|
||||||
<view class="coreshop-font-14 coreshop-text-black">
|
|
||||||
主播:
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-font-14 coreshop-text-black">{{ item.anchor_name }}</view>
|
|
||||||
<view class="coreshop-font-12 coreshop-text-black coreshop-padding-left-4 coreshop-padding-right-4 "> | </view>
|
|
||||||
<view class="coreshop-font-12 coreshop-text-black">直播商品:{{ item.goods.length }}件</view>
|
|
||||||
</view>
|
|
||||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-font-12 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-padding-bottom-8 coreshop-text-grey">
|
|
||||||
直播时间:{{$u.timeFormat(item.start_time, 'yyyy-mm-dd hh:MM:ss')}} 至 {{$u.timeFormat(item.end_time, 'yyyy-mm-dd hh:MM:ss')}}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<!-- 无数据时默认显示 -->
|
||||||
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="0" margin-bottom="20" class="coreshop-padding-top-10" />
|
<view class="coreshop-emptybox" v-else>
|
||||||
|
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="当前列表为空" mode="list"></u-empty>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 无数据时默认显示 -->
|
|
||||||
<view class="coreshop-emptybox" v-else>
|
|
||||||
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="当前列表为空" mode="list"></u-empty>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 登录提示 -->
|
<!-- 登录提示 -->
|
||||||
<coreshop-login-modal></coreshop-login-modal>
|
<coreshop-login-modal></coreshop-login-modal>
|
||||||
</view>
|
</view>
|
||||||
@@ -75,8 +77,10 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
items: ['直播计划', '历史直播'],
|
||||||
|
current: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10,
|
limit: 50,
|
||||||
list: [],
|
list: [],
|
||||||
status: 'loadmore',
|
status: 'loadmore',
|
||||||
iconType: 'flower',
|
iconType: 'flower',
|
||||||
@@ -119,11 +123,30 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// tab点击切换
|
||||||
|
onClickItem(index) {
|
||||||
|
if (this.current !== index) {
|
||||||
|
this.current = index;
|
||||||
|
this.page = 1;
|
||||||
|
this.list = [];
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
},
|
||||||
getList() {
|
getList() {
|
||||||
let data = {
|
let data = {
|
||||||
page: this.page,
|
page: this.page,
|
||||||
limit: this.limit,
|
limit: this.limit,
|
||||||
};
|
};
|
||||||
|
if (this.current == 0) {
|
||||||
|
data['where'] = '';
|
||||||
|
}
|
||||||
|
if (this.current == 1) {
|
||||||
|
data['where'] = 'get_replay';
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
this.status = 'loading';
|
this.status = 'loading';
|
||||||
this.$u.api.getLiveInfo(data).then(res => {
|
this.$u.api.getLiveInfo(data).then(res => {
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
@@ -132,12 +155,15 @@
|
|||||||
if (res.data.total > this.list.length) {
|
if (res.data.total > this.list.length) {
|
||||||
this.status = 'loadmore';
|
this.status = 'loadmore';
|
||||||
this.page++;
|
this.page++;
|
||||||
|
uni.hideLoading();
|
||||||
} else {
|
} else {
|
||||||
// 数据已加载完毕
|
// 数据已加载完毕
|
||||||
this.status = 'nomore';
|
this.status = 'nomore';
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 接口请求出错了
|
// 接口请求出错了
|
||||||
|
uni.hideLoading();
|
||||||
this.$u.toast(res.msg);
|
this.$u.toast(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
|
using CoreCms.Net.Model.WeChatEntites;
|
||||||
|
|
||||||
namespace CoreCms.Net.Web.WebApi.Controllers
|
namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
{
|
{
|
||||||
@@ -42,10 +43,12 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||||
|
|
||||||
var request = new WxaBusinessGetLiveInfoRequest
|
var request = new MyWxaBusinessGetLiveInfoRequest
|
||||||
{
|
{
|
||||||
AccessToken = accessToken,
|
AccessToken = accessToken,
|
||||||
Limit = entity.limit,
|
Limit = entity.limit,
|
||||||
|
Offset = (entity.page - 1) * entity.limit,
|
||||||
|
Action = !string.IsNullOrEmpty(entity.where) ? "get_replay" : ""
|
||||||
};
|
};
|
||||||
|
|
||||||
var response = await client.ExecuteWxaBusinessGetLiveInfoAsync(request);
|
var response = await client.ExecuteWxaBusinessGetLiveInfoAsync(request);
|
||||||
@@ -57,7 +60,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
jm.status = false;
|
jm.status = false;
|
||||||
jm.msg = response.ErrorCode == 9410000 ? "直播间列表为空" : response.ErrorMessage;
|
jm.msg = response.ErrorCode == 9410000 ? "暂无直播信息" : response.ErrorMessage;
|
||||||
jm.otherData = response;
|
jm.otherData = response;
|
||||||
}
|
}
|
||||||
return jm;
|
return jm;
|
||||||
|
|||||||
Reference in New Issue
Block a user