Commit 022faf0b authored by haitao's avatar haitao

fd

parent 66b3324e
<script>
<script>
const bgAudioMannager = uni.getBackgroundAudioManager();
const platform=uni.getSystemInfoSync().platform;
const time='';
import {newsRemind} from "@/utils/api/api.js";//获取商家消息
export default {
data:{
cid:'',
platform:''
},
onLaunch: function() {
this.hgServiceFun()
this.platform = uni.getSystemInfoSync().platform;
if(this.platform=='ios'){
bgAudioMannager.title = '您已进入鹿马配送...';
if(platform=='ios'){
bgAudioMannager.title = '您已进入鹿马商家助手...';
bgAudioMannager.singer = '小马将为你进行实时播报语音';
bgAudioMannager.coverImgUrl = 'https://runimg.jxdsy.cn/bank/logo.png';
bgAudioMannager.src = 'https://runimg.jxdsy.cn/bank/1703.mp3';
......@@ -18,12 +17,10 @@
bgAudioMannager.pause(); //pause 暂停
});
}
// #ifdef APP-PLUS
let cID = plus.push.getClientInfo();
this.cid = cID.clientid
// console.log(cid)
//app关闭默认的启动 方法关闭启动图。但是这个时间不能太晚,6s 超时后依旧会主动关闭。
setTimeout(()=>{
plus.navigator.closeSplashscreen();
......@@ -53,21 +50,11 @@
setTimeout(()=>{
this.getnewsRemind();//不要一上来就提示
},1000*15)
},
onShow: function() {
// console.log(this.cid);
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
},
computed: {
userInfo(){
return this.$store.state.userInfo;
......@@ -75,13 +62,10 @@
},
methods:{
hgServiceFun(){
let platform=uni.getSystemInfoSync().platform;
if(platform!='ios'){
const hgService = uni.requireNativePlugin("HG-Background"); //初始化
hgService.config({
title:"商家语音播报",
content:"鹿马商家语音播实时播报中",
title:"鹿马商家助手",
content:"小鹿正在为您进行实时播报...",
mode: 1, //0省电模式 1流氓模式
});
......@@ -91,164 +75,105 @@
hgService.requestIgnoreLimit(); //申请允许后台运行
}else{ //没有限制后台运行
console.log('没有限制')
console.log('没有限制');
hgService.startService(); //启动前台服务
//hgService.showSafeSetting();//打开安全管理 支持小米,华为,锤子,opp,vivo,三星,乐视,魅族
}
var globalEvent = uni.requireNativePlugin('globalEvent'); //全局事件回调 任务启动时间,会有一定延时 一般一分钟内。
// globalEvent.addEventListener('doJob', function() {
console.log(globalEvent,'aaaaa')
// });
}
//var globalEvent = uni.requireNativePlugin('globalEvent'); //全局事件回调 任务启动时间,会有一定延时 一般一分钟内。
},
//获取 语音消息
async getnewsRemind(){
// console.log(this.cid)
async getnewsRemind(type){
var date = new Date();
let hours = date.getHours();//当前 时间 小时
let datestime = 1000*5;//默认15秒
if(this.$store.state.token!=""){//判断是否 已登录
let datestime = 5000;//默认15秒
if(this.$store.state.token!=""){//判断是否 已登录
let res = await newsRemind({
uid:this.$store.state.userInfo.user_id,
cid:this.cid
})
if(res.code==0){
cid:plus.push.getClientInfo().clientid
});
if(res.code==0){
if(res.data.length!=0){
if(this.platform=='ios'){
let KJres = res.data.filter(item =>{ //快捷支付
return item.type==3
})
let PSres = res.data.filter(item => { //订单
return item.type==4 || item.type==5 || item.type==6
})
if(platform=='ios'){
if(bgAudioMannager.paused){ //没有播放或者暂停了播放
bgAudioMannager.title = '您已进入鹿马配送...';
bgAudioMannager.singer = '小马将为你进行实时播报语音';
bgAudioMannager.coverImgUrl = 'https://runimg.jxdsy.cn/bank/logo.png';
bgAudioMannager.src = 'https://runimg.jxdsy.cn/bank/run.mp3';
bgAudioMannager.seek({position:0});
bgAudioMannager.play();
bgAudioMannager.onEnded((res)=>{ //自然播放完毕
console.log('自然播放完毕');
bgAudioMannager.pause(); //pause 暂停
})
}else{
console.log('这里这里')
if(PSres.length!=0){
bgAudioMannager.src = 'https://runimg.jxdsy.cn/bank/run.mp3';
bgAudioMannager.seek({position:0});
bgAudioMannager.play();
bgAudioMannager.onEnded((res)=>{ //自然播放完毕
bgAudioMannager.pause(); //pause 暂停
})
}
if(KJres.length!=0){
bgAudioMannager.src = 'https://runimg.jxdsy.cn/bank/run.mp3';
bgAudioMannager.seek({position:0});
bgAudioMannager.play();
bgAudioMannager.onEnded((res)=>{ //自然播放完毕
bgAudioMannager.pause(); //pause 暂停
})
}
}
}else{
//进来了就是有消息
let msglist = res.data;
if(msglist.length==1){
//一条就播放 如果多条 直接告诉商家多少条
// isvoice 开关
if(PSres.length!=0 && KJres.length!=0){
let msgtext = `你有${PSres.length}条鹿马订单,请及时处理`;
if(this.$store.state.isvoice){
this.$store.dispatch('AudioVoice',msglist[0].message).then((e) => {
// console.log(e);
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
this.$store.dispatch('AudioVoice',msgtext).then((e) => {
uni.vibrateLong();//震动 调用//400ms//长震动
setTimeout(()=>{
let payText =""
KJres.map(item=>{
payText = payText+","+ item.contents
})
if(this.$store.state.isvoice){
this.$store.dispatch('AudioVoice',payText).then((e) => {
uni.vibrateLong();//震动 调用//400ms//长震动
})
}
})
})
}else{
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
}
},4000)
})
}
}else if(msglist.length!=0){
// 类型(0商城快捷支付,1商城快递,2商城店付,3餐饮快捷支付,4达达配送,5堂食,6鹿马配送)
let KJres = msglist.filter(item =>{
return item.type==3
})
let PSres = msglist.filter(item => {
return item.type==4 || item.type==5 || item.type==6
})
if(PSres.length !=0 ){
let msgtext = `你有新鹿马订单,请及时处理`;
}else{
if(PSres.length!=0){
let msgtext = `你有${PSres.length}条鹿马订单,请及时处理`;
if(this.$store.state.isvoice){
this.$store.dispatch('AudioVoice',msgtext).then((e) => {
console.info(e,"循环消息列表2");
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
}
})
})
}else{
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
}
uni.vibrateLong();//震动 调用//400ms//长震动
})
}
}
setTimeout(()=>{
if(KJres.length != 0){
if(KJres.length!=0){
let payText =""
for(let i=0 ;i<KJres.length;i++){
payText = payText+","+ KJres[i].contents
}
console.log(payText);
let msgtext = `${payText}`;
KJres.map(item=>{
payText = payText+","+ item.contents
});
if(this.$store.state.isvoice){
this.$store.dispatch('AudioVoice',msgtext).then((e) => {
console.info(e,"循环消息列表2");
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
}
})
})
}else{
//震动 调用//400ms//长震动
uni.vibrateLong({
success:(re)=> {
},
fail:(a)=> {
}
this.$store.dispatch('AudioVoice',payText).then((e) => {
uni.vibrateLong();//震动 调用//400ms//长震动
})
}
}
},1000*5)
}
}
//回调
setTimeout(()=>{
this.getnewsRemind()
},datestime)
}
}else{
//获取到的消息列表为空列表
//回调
setTimeout(()=>{
this.getnewsRemind()
},datestime)
}
}else{
//回调
setTimeout(()=>{
this.getnewsRemind()
},datestime)
}
}else{
//回调
setTimeout(()=>{
this.getnewsRemind()
},datestime)
}
}
if(type!=2){
return true;
}
}
}
},
}
......
......@@ -3,8 +3,8 @@
//"appid" : "__UNI__FC9419E",
"appid" : "__UNI__1EA80F1", //这个是 web
"description" : "商家",
"versionName" : "1.0.89",
"versionCode" : 189,
"versionName" : "1.0.90",
"versionCode" : 190,
"transformPx" : false,
/* 5+App特有相关weex */
"app-plus" : {
......@@ -56,7 +56,7 @@
/* ios打包配置 */
"ios" : {
"idfa" : false,
"UIBackgroundModes" : [ "location", "audio" ],
"UIBackgroundModes" : [ "audio" ],
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "需要获得的允许,才能在上传商城产品时选择图片",
"NSPhotoLibraryAddUsageDescription" : "需要获得的允许,才能在生成店铺二维码后将海报保存到相册",
......@@ -116,9 +116,9 @@
},
"splashscreen" : {
"android" : {
"hdpi" : "C:/Users/Administrator/Desktop/da/DefaultLaunch640_1136.png",
"xhdpi" : "C:/Users/Administrator/Desktop/da/DefaultLaunch750_1334.png",
"xxhdpi" : "C:/Users/Administrator/Desktop/da/DefaultLaunch1125_2436.png"
"hdpi" : "C:/Users/Administrator/Desktop/证书/d0abce82961b508e6a0b9924d15fe86.png",
"xhdpi" : "C:/Users/Administrator/Desktop/证书/d0abce82961b508e6a0b9924d15fe86.png",
"xxhdpi" : "C:/Users/Administrator/Desktop/证书/d0abce82961b508e6a0b9924d15fe86.png"
},
"ios" : {
"iphone" : {
......@@ -157,14 +157,14 @@
"nativePlugins" : {
"HG-Background" : {
"__plugin_info__" : {
"name" : "保活 前台运行 - [试用版,仅用于自定义调试基座]",
"name" : "保活 前台运行",
"description" : "用于提高app存活概率或添加前台显示 q群:219508489",
"platforms" : "Android",
"url" : "https://ext.dcloud.net.cn/plugin?id=2203",
"android_package_name" : "",
"android_package_name" : "com.app.lumastore",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 0,
"bought" : 1,
"pid" : "2203",
"parameters" : {}
}
......
......@@ -2,7 +2,7 @@
<!-- 商家助手首页 -->
<view class="index">
<view class="head">
<!-- @tap="demoaudio" -->
<view class="tit">店铺名称:{{ storeinfo.shop_name }}</view>
<!-- {{shop.shop_name}} -->
<view :class="['jiu', shop_type == 'ele'?'':'jus-b']">
......@@ -253,7 +253,6 @@
import{getskipShop} from "@/utils/api/merchant.js";
import uniBadge from "@/components/uni/uni-badge/uni-badge.vue"
import uniIcon from "@/components/uni/uni-icon/uni-icon.vue"
import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue'; //升级组件
import Welcome from "@/components/Welcome/Welcome.vue"; //欢迎回来
import {storeIndex} from "@/utils/api/api.js";
export default {
......@@ -273,7 +272,6 @@
components: {
uniIcon,
uniBadge,
yomolUpgrade, //升级组件
Welcome,
},
computed: {
......@@ -294,7 +292,29 @@
setTimeout(() => {
this.$refs.Welcome.show();
}, 2000)
if( (plus.device.getVolume() * 1000) < 600 ){ //获取手机音量
uni.showModal({
title: '提示:音量较小',
content: '当前手机音量较小,可能无法及时获取新的订单播报,建议设置为最大音量',
success:(res)=> {
if (res.confirm) {
plus.device.setVolume(1); //设置手机音量
setTimeout(()=>{
this.$api.msg('设置成功');
},500)
}
}
});
}
if(uni.getSystemInfoSync().platform!='ios'){
getApp().hgServiceFun(); //安卓后台运行
}
},
//下拉刷新
onPullDownRefresh() {
......@@ -304,17 +324,20 @@
onShow() {
this.storeIndexfun();
// 判断用户有没有绑定手机号
//检测更新
setTimeout(() => {
// #ifdef APP-PLUS
this.$refs.yomolUpgrade.checkVersionClick();
// #endif
}, 1000)
},
getApp().getnewsRemind().then((res)=>{
if(res){
let Timer=setInterval(()=>{
getApp().getnewsRemind(2);
console.log('这里');
},5000);
this.$store.commit('Timer',Timer);
}
})
},
methods: {
saoma(e){
uni.scanCode({
success:res => {
uni.request({
......@@ -364,48 +387,8 @@
},
shops(){
// if(this.is_luck_draw==1){
uni.navigateTo({
url:"/pages/details/details?shop_id="+this.shop_id
})
// }else{
// uni.showModal({
// title: '温馨提示',
// content: '不符合参与条件!请联系客服开通权限400-807-3023',
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// }
},
demoaudio() {
//语音提醒
this.$store.dispatch('AudioVoice', "您有新的订单,请注意查看").then((e) => {
console.log(e);
//震动 调用
//长震动
uni.vibrateLong({
success: (re) => {
},
fail: (a) => {
}
})
// 短震动
// uni.vibrateShort()({
// success:(re)=> {
// },
// fail:(a)=> {
// }
// })
uni.navigateTo({
url:"/pages/details/details?shop_id="+this.shop_id
})
},
//弹窗
......
......@@ -42,6 +42,12 @@
methods:{
totaggle(index){
this.$api.msg("切换成功");
if(this.$store.state.Timer != ''){
clearInterval(this.$store.state.Timer);
this.$store.commit('Timer','');
}
if(this.istologin==1){
//登录的时候选的
this.$store.commit('changeuserInfo', this.storelsit[index]);
......@@ -54,12 +60,9 @@
this.$store.commit('changeuserInfo', this.storelsit[index]);
uni.setStorageSync('userInfo', this.storelsit[index]);
setTimeout(()=>{
uni.navigateBack({
})
uni.navigateBack({});
},1000)
}
}
}
}
......
......@@ -74,9 +74,14 @@ const store = new Vuex.Store({
testvuex:false,//
CONFIG:uni.getStorageSync("CONFIG"),//配置信息 再首页获取的
count: 0,
isvoice:true,//是否播放语音提示
isvoice:true,//是否播放语音提示
Timer:'', //实时获取订单消息的定时器
},
mutations: {
mutations: {
Timer(state,type){
state.Timer=type;
},
login(state, provider) {
state.hasLogin = true;
state.loginProvider = provider;
......@@ -180,7 +185,6 @@ const store = new Vuex.Store({
console.log('音频开始播放了')
})
audio.play();
resolve();//结束
})
})
......
......@@ -5,8 +5,8 @@ module.exports = {
isdebug:false,//正式
// isdebug:true,//测试
isdebug:false,//正式
//isdebug:true,//测试
......@@ -15,7 +15,6 @@ module.exports = {
xqdebug:false,//正式权限
// xqdebug:true,//发布审核权限 也是测试环境的 主要用于ios
// #ifdef APP-PLUS
// isdebug:false,//正式 APP里面绝对是正式
// #endif
......
......@@ -43,6 +43,10 @@ export default function request(api, method, data, {noAuth = false, noVerify = f
// return //授权了之后再请求原来的 数据接口
// #ifdef APP-PLUS
// #endif
if(store.state.Timer!=''){
clearInterval(store.state.Timer);
store.commit('Timer','');
}
uni.showModal({
title: '提示',
......@@ -119,11 +123,11 @@ export default function request(api, method, data, {noAuth = false, noVerify = f
else if (res.data.code == 0)
reslove(res.data, res);
else if(res.data.code==-10800){
//没登录
// uni.navigateTo({
// url: '/pages/login/login?zd=1&isfanhui=2'
// });
if(store.state.Timer!=''){
clearInterval(store.state.Timer);
store.commit('Timer','');
}
store.commit("changetoken","");//清除
uni.setStorageSync("token","");//清除
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment