语音播报
This commit is contained in:
parent
391f4d3c14
commit
1745293d05
@ -25,5 +25,6 @@ export default {
|
|||||||
receive:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/receive`),
|
receive:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/receive`),
|
||||||
pickup:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/pickup`),
|
pickup:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/pickup`),
|
||||||
complete:(orderid,images)=>request.post(`/api/order/${orderid}/deliveryman/complete`,{images:images}),
|
complete:(orderid,images)=>request.post(`/api/order/${orderid}/deliveryman/complete`,{images:images}),
|
||||||
cancel:(orderid,reason)=>request.post(`/api/order/${orderid}/deliveryman/cancel`,{reason})
|
cancel:(orderid,reason)=>request.post(`/api/order/${orderid}/deliveryman/cancel`,{reason}),
|
||||||
|
check:()=>request.get('/api/order/deliveryman/check_new_order')
|
||||||
}
|
}
|
||||||
14
api/user.js
14
api/user.js
@ -53,5 +53,19 @@ export default {
|
|||||||
task.onProgressUpdate(progress);
|
task.onProgressUpdate(progress);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
downloadFile(url,filePath){
|
||||||
|
return new Promise((rs,rj)=>{
|
||||||
|
wx.downloadFile({
|
||||||
|
url: url,
|
||||||
|
filePath: filePath,
|
||||||
|
success: (result) => {
|
||||||
|
rs()
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
rj()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
6
app.js
6
app.js
@ -5,6 +5,9 @@ const date = new Date();
|
|||||||
App({
|
App({
|
||||||
verifyCodeWaitingTime:60,
|
verifyCodeWaitingTime:60,
|
||||||
onLaunch() {
|
onLaunch() {
|
||||||
|
wx.setInnerAudioOption({
|
||||||
|
obeyMuteSwitch:false
|
||||||
|
});
|
||||||
if(!token){
|
if(!token){
|
||||||
wx.reLaunch({
|
wx.reLaunch({
|
||||||
url: '/pages/login/index',
|
url: '/pages/login/index',
|
||||||
@ -16,6 +19,9 @@ App({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onHide(){
|
||||||
|
console.log('app on hide');
|
||||||
|
},
|
||||||
resetUserInfoUpdateTag(){
|
resetUserInfoUpdateTag(){
|
||||||
this.globalData.userInfoGetTime = null;
|
this.globalData.userInfoGetTime = null;
|
||||||
},
|
},
|
||||||
|
|||||||
5
app.json
5
app.json
@ -21,5 +21,8 @@
|
|||||||
"style": "v2",
|
"style": "v2",
|
||||||
"componentFramework": "glass-easel",
|
"componentFramework": "glass-easel",
|
||||||
"sitemapLocation": "sitemap.json",
|
"sitemapLocation": "sitemap.json",
|
||||||
"lazyCodeLoading": "requiredComponents"
|
"lazyCodeLoading": "requiredComponents",
|
||||||
|
"requiredBackgroundModes": [
|
||||||
|
"audio"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
21
app.wxss
21
app.wxss
@ -370,4 +370,25 @@ navigator button{
|
|||||||
}
|
}
|
||||||
list-view{
|
list-view{
|
||||||
display: block;
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch .wx-switch-input.wx-switch-input-checked {
|
||||||
|
background-color:var(--main-color);
|
||||||
|
border-color: var(--main-color);
|
||||||
|
}
|
||||||
|
switch .wx-switch-input::after {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.weui-loading{
|
||||||
|
font-size:16px;width:1em;height:1em;display:inline-block;vertical-align:middle;
|
||||||
|
background:transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3CanimateTransform attributeName='transform' begin='0s' dur='1s' type='rotate' values='0 40 40;360 40 40' repeatCount='indefinite'/%3E%3C/g%3E%3C/svg%3E%0A") no-repeat;
|
||||||
|
background-size:100%
|
||||||
}
|
}
|
||||||
BIN
assets/audio/order_complete.wav
Normal file
BIN
assets/audio/order_complete.wav
Normal file
Binary file not shown.
114
components/background-notice/index.js
Normal file
114
components/background-notice/index.js
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import userApi from '../../api/user';
|
||||||
|
|
||||||
|
Component({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
start:{
|
||||||
|
type:Boolean,
|
||||||
|
value:false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
emptyAudio:'',
|
||||||
|
haveOrderAudio:'',
|
||||||
|
initing:true
|
||||||
|
},
|
||||||
|
lifetimes:{
|
||||||
|
attached(){
|
||||||
|
this.data.initing = true;
|
||||||
|
this.downloadResource().then(()=>{
|
||||||
|
this.bgam = wx.getBackgroundAudioManager();
|
||||||
|
this.bgam.title = '后台通知';
|
||||||
|
this.bgam.audioType = 'music';
|
||||||
|
this.bgam.coverImgUrl = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/20250227/DoADoEhKi4U4ab75d180b27fa14b7c34ae7969762809_d7ee9018-828e-43c7-8b2b-29d4352c0277.jpg?imageMogr2/thumbnail/800x800/format/webp';
|
||||||
|
this.bgam.onEnded(()=>{
|
||||||
|
this.bgam.src = this.data.emptyAudio;
|
||||||
|
});
|
||||||
|
this.triggerEvent('initSuccess');
|
||||||
|
}).catch(()=>{
|
||||||
|
this.triggerEvent('initError');
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
observers:{
|
||||||
|
"start"(s){
|
||||||
|
if(s){
|
||||||
|
this.start();
|
||||||
|
}else{
|
||||||
|
this.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
async downloadResource(){
|
||||||
|
this.data.emptyAudio = `${wx.env.USER_DATA_PATH}/empty.mp3`;
|
||||||
|
const emptyServerPath = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/silence_file.wav';
|
||||||
|
this.data.haveOrderAudio = `${wx.env.USER_DATA_PATH}/haveorder.wav`;
|
||||||
|
const haveOrderPath = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/new_order.mp3'
|
||||||
|
await this.download(this.data.emptyAudio,emptyServerPath);
|
||||||
|
await this.download(this.data.haveOrderAudio,haveOrderPath);
|
||||||
|
},
|
||||||
|
async download(localPath,serverPath){
|
||||||
|
try {
|
||||||
|
//判断文件是否存在
|
||||||
|
const fs = wx.getFileSystemManager();
|
||||||
|
fs.accessSync(localPath);
|
||||||
|
} catch (error) {
|
||||||
|
await userApi.downloadFile(serverPath,localPath);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
start(){
|
||||||
|
this.bgam.src = this.data.emptyAudio;
|
||||||
|
if(this.loopOrderTimer){
|
||||||
|
clearInterval(this.loopOrderTimer);
|
||||||
|
}
|
||||||
|
this.loopOrderTimer = setInterval(()=>{
|
||||||
|
this.triggerEvent('onTrigger');
|
||||||
|
},10000);
|
||||||
|
},
|
||||||
|
stop(){
|
||||||
|
if(this.loopOrderTimer){
|
||||||
|
clearInterval(this.loopOrderTimer);
|
||||||
|
}
|
||||||
|
if(this.emptyAutioPlayTimer){
|
||||||
|
clearTimeout(this.emptyAutioPlayTimer)
|
||||||
|
}
|
||||||
|
if(this.bgam){
|
||||||
|
this.bgam.stop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
notice(){
|
||||||
|
if(this.emptyAutioPlayTimer){
|
||||||
|
clearTimeout(this.emptyAutioPlayTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.bgam.src = this.data.haveOrderAudio;
|
||||||
|
// this.bgam.onEnded(()=>{
|
||||||
|
// console.log('notice onend');
|
||||||
|
// this.emptyAutioPlayTimer = setTimeout(()=>{
|
||||||
|
// this.bgam.src = this.data.emptyAudio;
|
||||||
|
// },1000)
|
||||||
|
// });
|
||||||
|
|
||||||
|
const innerAudioContext = wx.createInnerAudioContext({
|
||||||
|
useWebAudioImplement:true
|
||||||
|
})
|
||||||
|
innerAudioContext.src = this.data.haveOrderAudio;
|
||||||
|
innerAudioContext.play();
|
||||||
|
innerAudioContext.onEnded(()=>{
|
||||||
|
innerAudioContext.destroy();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
4
components/background-notice/index.json
Normal file
4
components/background-notice/index.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
2
components/background-notice/index.wxml
Normal file
2
components/background-notice/index.wxml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!--components/background-notice/index.wxml-->
|
||||||
|
<text>components/background-notice/index.wxml</text>
|
||||||
1
components/background-notice/index.wxss
Normal file
1
components/background-notice/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* components/background-notice/index.wxss */
|
||||||
@ -79,7 +79,6 @@ Component({
|
|||||||
},
|
},
|
||||||
observers:{
|
observers:{
|
||||||
"loading"(l){
|
"loading"(l){
|
||||||
console.log('loading',l);
|
|
||||||
if(!l){
|
if(!l){
|
||||||
this.setData({
|
this.setData({
|
||||||
moveViewX:0,
|
moveViewX:0,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ const app = getApp();
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
currentOrder:null,
|
currentOrder:null,
|
||||||
|
haveNewOrder:false,
|
||||||
data: {
|
data: {
|
||||||
statusBarHeight:0,
|
statusBarHeight:0,
|
||||||
snBarHeight:0,
|
snBarHeight:0,
|
||||||
@ -52,9 +53,19 @@ Page({
|
|||||||
|
|
||||||
completing:false,
|
completing:false,
|
||||||
|
|
||||||
isShowRefundConfirm:false
|
isShowRefundConfirm:false,
|
||||||
|
|
||||||
|
isStartLoopOrder:false,
|
||||||
|
|
||||||
|
bgNoticeLoadResult:{
|
||||||
|
error:false,
|
||||||
|
loading:true
|
||||||
|
},
|
||||||
|
unReadOrderCount:0
|
||||||
},
|
},
|
||||||
onLoad(){
|
onLoad(){
|
||||||
|
console.log(wx.env.USER_DATA_PATH);
|
||||||
|
this.orderBackgroundNotice = this.selectComponent('#orderBackgroundNotice');
|
||||||
const snHeight = getStatusNavBarHeight();
|
const snHeight = getStatusNavBarHeight();
|
||||||
this.setData({
|
this.setData({
|
||||||
statusBarHeight:snHeight.statusBar,
|
statusBarHeight:snHeight.statusBar,
|
||||||
@ -74,6 +85,52 @@ Page({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
findNewOrder(){
|
||||||
|
// app.forceGetUserInfo().then((data)=>{
|
||||||
|
// if(data.nickname=='仙人模斗'){
|
||||||
|
// this.haveNewOrder = true;
|
||||||
|
// this.orderBackgroundNotice.notice();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// return;
|
||||||
|
orderApi.check().then((data)=>{
|
||||||
|
if(data.has_new_order){
|
||||||
|
this.orderBackgroundNotice.notice();
|
||||||
|
this.setData({
|
||||||
|
unReadOrderCount:this.data.unReadOrderCount+data.order_ids.length
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
bgNoticeSuccess(){
|
||||||
|
this.setData({
|
||||||
|
bgNoticeLoadResult:{
|
||||||
|
error:false,
|
||||||
|
loading:false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
bgNoticeError(){
|
||||||
|
wx.showToast({
|
||||||
|
icon:'error',
|
||||||
|
title: '资源加载失败',
|
||||||
|
})
|
||||||
|
this.setData({
|
||||||
|
bgNoticeLoadResult:{
|
||||||
|
error:true,
|
||||||
|
loading:false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
bgNoticeRetry(){
|
||||||
|
this.setData({
|
||||||
|
bgNoticeLoadResult:{
|
||||||
|
error:false,
|
||||||
|
loading:true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.orderBackgroundNotice.downloadResource();
|
||||||
|
},
|
||||||
async getUserInfo(){
|
async getUserInfo(){
|
||||||
await app.forceGetUserInfo().then((data)=>{
|
await app.forceGetUserInfo().then((data)=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -203,12 +260,16 @@ Page({
|
|||||||
pItem.receivedAll = this.getPackageReceiveStatus(item.orderid,pItem);
|
pItem.receivedAll = this.getPackageReceiveStatus(item.orderid,pItem);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.setData({
|
let needSetData = {
|
||||||
list:this.data.list,
|
list:this.data.list,
|
||||||
pager:this.data.pager,
|
pager:this.data.pager,
|
||||||
statusDetailKey:this.data.statusDetailKey,
|
statusDetailKey:this.data.statusDetailKey,
|
||||||
buildingIndex:this.data.buildingIndex
|
buildingIndex:this.data.buildingIndex
|
||||||
});
|
}
|
||||||
|
if(this.data.statusDetailKey==this.data.statusDetail.created.key.toLowerCase()){
|
||||||
|
needSetData.unReadOrderCount = 0;
|
||||||
|
}
|
||||||
|
this.setData(needSetData);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -384,7 +445,6 @@ Page({
|
|||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(this.data.tempImgs);
|
|
||||||
this.setData({
|
this.setData({
|
||||||
completing:true
|
completing:true
|
||||||
})
|
})
|
||||||
@ -469,6 +529,12 @@ Page({
|
|||||||
})
|
})
|
||||||
this.setData(needRefreshData);
|
this.setData(needRefreshData);
|
||||||
}
|
}
|
||||||
|
if(this.haveNewOrder){
|
||||||
|
this.data.statusDetailKey = this.data.statusDetail.created.key.toLowerCase();
|
||||||
|
this.data.buildingIndex = 0;
|
||||||
|
this.refreshList();
|
||||||
|
this.haveNewOrder = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getPackageReceiveStatus(orderId,pkg){
|
getPackageReceiveStatus(orderId,pkg){
|
||||||
let receivedInfo = wx.getStorageSync(orderId);
|
let receivedInfo = wx.getStorageSync(orderId);
|
||||||
@ -477,5 +543,10 @@ Page({
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
loopOrderChange(event){
|
||||||
|
this.setData({
|
||||||
|
isStartLoopOrder:event.detail.value
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"list-view":"/components/listView",
|
"list-view":"/components/listView",
|
||||||
"swipe-button":"/components/swipeButton",
|
"swipe-button":"/components/swipeButton",
|
||||||
"modal-view":"/components/modalView"
|
"modal-view":"/components/modalView",
|
||||||
|
"background-notice":"/components/background-notice"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white"
|
||||||
|
|||||||
@ -3,15 +3,25 @@
|
|||||||
<view style="height:{{statusBarHeight}}px" class="status-bar"></view>
|
<view style="height:{{statusBarHeight}}px" class="status-bar"></view>
|
||||||
<view class="nav-bar">
|
<view class="nav-bar">
|
||||||
<image src="/assets/icon/left-panel-btn.png" class="left-btn" bind:tap="openLeftPanel"/>
|
<image src="/assets/icon/left-panel-btn.png" class="left-btn" bind:tap="openLeftPanel"/>
|
||||||
<view class="community">
|
<!-- <view class="community">
|
||||||
<image class="icon" src="/assets/icon/community.png"/>
|
<image class="icon" src="/assets/icon/community.png"/>
|
||||||
<label>{{userInfo.community_name}}</label>
|
<label>{{userInfo.community_name}}</label>
|
||||||
|
</view> -->
|
||||||
|
<view class="loop-order-switch">
|
||||||
|
<label>语音播报</label>
|
||||||
|
<view class="weui-loading" wx:if="{{bgNoticeLoadResult.loading}}"></view>
|
||||||
|
<view class="retry" wx:elif="{{bgNoticeLoadResult.error}}" bind:tap="bgNoticeRetry">重试</view>
|
||||||
|
<switch wx:else class="switch" checked="{{isStartLoopOrder}}" bindchange="loopOrderChange"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="head {{pager.loading?'loading':''}}">
|
<view class="head {{pager.loading?'loading':''}}">
|
||||||
<view class="item {{statusDetailKey==key?'current':''}}" wx:for="{{statusDetail}}"
|
<view class="item {{statusDetailKey==key?'current':''}}" wx:for="{{statusDetail}}"
|
||||||
wx:for-index="key" wx:key="key" bind:tap="setStatus" data-item="{{item}}">
|
wx:for-index="key" wx:key="key" bind:tap="setStatus" data-item="{{item}}">
|
||||||
|
<view class="red-bubble"
|
||||||
|
wx:if="{{item.key==statusDetail.created.key&&unReadOrderCount>0}}">
|
||||||
|
{{unReadOrderCount}}
|
||||||
|
</view>
|
||||||
{{item.text}}({{item.value}})
|
{{item.text}}({{item.value}})
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -182,4 +192,8 @@
|
|||||||
</movable-area>
|
</movable-area>
|
||||||
|
|
||||||
|
|
||||||
<modal-view titleText="取消订单需联系客户说明原因" editable content-placeholder="请输入退款原因" bind:ok="refund" show="{{isShowRefundConfirm}}" wx:if="{{isShowRefundConfirm}}" titleTextCenter="{{false}}" editRequired/>
|
<modal-view titleText="取消订单需联系客户说明原因" editable content-placeholder="请输入退款原因" bind:ok="refund" show="{{isShowRefundConfirm}}" wx:if="{{isShowRefundConfirm}}" titleTextCenter="{{false}}" editRequired/>
|
||||||
|
|
||||||
|
<background-notice bind:onTrigger="findNewOrder" id="orderBackgroundNotice"
|
||||||
|
start="{{isStartLoopOrder}}" bind:initSuccess="bgNoticeSuccess"
|
||||||
|
bind:initError="bgNoticeError"/>
|
||||||
@ -8,6 +8,11 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.nav-bar .retry{
|
||||||
|
text-decoration: underline;
|
||||||
|
color: rgb(250, 67, 67);
|
||||||
|
padding:14rpx;
|
||||||
|
}
|
||||||
.nav-bar .left-btn{
|
.nav-bar .left-btn{
|
||||||
width:56rpx;
|
width:56rpx;
|
||||||
height:56rpx;
|
height:56rpx;
|
||||||
@ -26,6 +31,23 @@
|
|||||||
width:20rpx;height:20rpx;
|
width:20rpx;height:20rpx;
|
||||||
margin-right:8rpx;
|
margin-right:8rpx;
|
||||||
}
|
}
|
||||||
|
.nav-bar .loop-order-switch{
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
color: #fff;
|
||||||
|
padding:4rpx 4rpx 4rpx 18rpx;
|
||||||
|
margin-left:24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.nav-bar .loop-order-switch .switch .wx-switch-input{
|
||||||
|
width:84rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
--switch-checked-color:red;
|
||||||
|
--switch-node-size: 16rpx;
|
||||||
|
}
|
||||||
.head{
|
.head{
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #111111;
|
background-color: #111111;
|
||||||
@ -42,11 +64,20 @@
|
|||||||
flex:1;
|
flex:1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding:39rpx 0 19rpx 0;
|
padding:39rpx 0 19rpx 0;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.head .item.current{
|
.head .item.current{
|
||||||
color:#ffffff;
|
color:#ffffff;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
.head .item .red-bubble{
|
||||||
|
position: absolute;
|
||||||
|
right:8rpx;top:20rpx;
|
||||||
|
background-color: red;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding:4rpx 8rpx;
|
||||||
|
}
|
||||||
.building{
|
.building{
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|||||||
94
pages/test/audio.js
Normal file
94
pages/test/audio.js
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
// pages/test/audio.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
time:0
|
||||||
|
},
|
||||||
|
gbam:null,
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
this.bgam = wx.getBackgroundAudioManager();
|
||||||
|
this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/empty.mp3';
|
||||||
|
this.bgam.title = '后台通知';
|
||||||
|
this.bgam.audioType = 'music';
|
||||||
|
this.bgam.coverImgUrl = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/20250227/DoADoEhKi4U4ab75d180b27fa14b7c34ae7969762809_d7ee9018-828e-43c7-8b2b-29d4352c0277.jpg?imageMogr2/thumbnail/800x800/format/webp';
|
||||||
|
this.bgam.play();
|
||||||
|
this.bgam.onPlay();
|
||||||
|
this.bgam.onEnded(()=>{
|
||||||
|
console.log('end');
|
||||||
|
// this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/empty.mp3';
|
||||||
|
// this.bgam.play();
|
||||||
|
})
|
||||||
|
// const innerAudioContext = wx.createInnerAudioContext({
|
||||||
|
// useWebAudioImplement:true
|
||||||
|
// })
|
||||||
|
// innerAudioContext.src = '/assets/audio/order_complete.wav';
|
||||||
|
// innerAudioContext.play();
|
||||||
|
},
|
||||||
|
playAudio(){
|
||||||
|
setInterval(()=>{
|
||||||
|
this.setData({
|
||||||
|
time:this.data.time+1
|
||||||
|
});
|
||||||
|
},1000);
|
||||||
|
setInterval(()=>{
|
||||||
|
this.bgam.src = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/new_order.mp3';
|
||||||
|
this.bgam.play();
|
||||||
|
},10000)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
3
pages/test/audio.json
Normal file
3
pages/test/audio.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
1
pages/test/audio.wxml
Normal file
1
pages/test/audio.wxml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<button bind:tap="playAudio" type="primary">play({{time}})</button>
|
||||||
1
pages/test/audio.wxss
Normal file
1
pages/test/audio.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/test/audio.wxss */
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<view class="custom-scroll-view">
|
<view class="custom-scroll-view">
|
||||||
<view class="total">
|
<view class="total">
|
||||||
<view class="title">今日收益(元)</view>
|
<view class="title">今日收益(元)</view>
|
||||||
<view class="num">{{summary.total_income}}</view>
|
<view class="num">{{summary.today_income}}</view>
|
||||||
</view>
|
</view>
|
||||||
<list-view bind:refresh="refreshList" bind:loadMore="loadList"
|
<list-view bind:refresh="refreshList" bind:loadMore="loadList"
|
||||||
refresher-triggered="{{pager.refreshTrigger}}" class="income-list main"
|
refresher-triggered="{{pager.refreshTrigger}}" class="income-list main"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user