diff --git a/manifest.json b/manifest.json index d50954d..54cbfb5 100644 --- a/manifest.json +++ b/manifest.json @@ -63,11 +63,38 @@ "appkey_android" : "" } }, - "push" : { - "unipush" : { - "version" : "2", - "offline" : true - } + "push" : {} + }, + "icons" : { + "ios" : { + "ipad" : { + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification" : "unpackage/res/icons/20x20.png", + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "notification@3x" : "unpackage/res/icons/60x60.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + }, + "appstore" : "unpackage/res/icons/1024x1024.png" + }, + "android" : { + "xxxhdpi" : "unpackage/res/icons/192x192.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "hdpi" : "unpackage/res/icons/72x72.png" } } } diff --git a/pages/guide-page/guide-page.vue b/pages/guide-page/guide-page.vue index bc998a1..9f9b38e 100644 --- a/pages/guide-page/guide-page.vue +++ b/pages/guide-page/guide-page.vue @@ -28,12 +28,12 @@ // #ifdef MP-WEIXIN this.ifH5 = false; // #endif - this.checkContext(); + // this.checkContext(); if(uni.getStorageSync('guideImg')){ this.ad_img = uni.getStorageSync('guideImg'); // 调用倒计时事件 this.countDownEv(); - } else { + } else { this.$requst.get('/universal/api.other/advertise').then(res=>{ if(res.code) { this.ad_img = res.data.ad_img; @@ -54,14 +54,14 @@ } },1000) this.timeNumTimer = setTimeout(()=>{ - this.goPage(); + this.checkContext(); },this.timeNum) }, // 关闭事件 closeEv(){ clearInterval(this.countTimer); clearTimeout(this.timeNumTimer); - this.goPage(); + this.checkContext(); }, checkContext(){ if(uni.getStorageSync('password')) { @@ -79,13 +79,17 @@ this.$store.commit('setUid',res.data.uid); // 缓存token和角色类型 uni.setStorageSync('token',res.data.token); - } else { + this.omg = 1; + this.goPage(); + } else { this.$toolAll.tools.showToast(res.msg); + this.omg = 0; + this.goPage(); } }) - this.omg = 1; } else { this.omg = 0; + this.goPage(); } }, // 跳转页面 @@ -104,7 +108,9 @@ page{background-color: #FFFFFF;} .count-box{ background-color: rgba(0, 0, 0, .3); - padding: 16rpx 30rpx; + /* padding: 16rpx 30rpx; */ + width: 120rpx; + height: 60rpx; } .app-h5-count-box{ position: fixed; diff --git a/pages/tabbar/pagehome/pagehome.vue b/pages/tabbar/pagehome/pagehome.vue index 60a9a6d..eb306a0 100644 --- a/pages/tabbar/pagehome/pagehome.vue +++ b/pages/tabbar/pagehome/pagehome.vue @@ -417,21 +417,23 @@ console.log("会员上线",msg); }); // 接收消息 - if(uni.getStorageSync('ifMessage')){ - socket.on('new_msg', (msg)=> { - console.log(msg,121212) - // this.offMusic(); - if(uni.getStorageSync('ifVoice')){ - console.log('进入接收消息'); - this.createMessage(); - // uni.showToast({ - // title:'您有新消息!' - // }) - // this.bofang(msg); - this.openSettings(); + socket.on('new_msg',(msg)=> { + console.log(msg,'接收的消息'); + // #ifdef APP-PLUS + if(uni.getStorageSync('ifMessage') || uni.getStorageSync('ifVoice')){ + if(msg.includes('.mp3')){ + this.bofang(msg); + } else { + this.createMessage(msg); } - }); - } + } + // #endif + // #ifdef H5 || MP-WEIXIN + if(uni.getStorageSync('ifVoice')){ + this.bofang(msg); + } + // #endif + }); }, // uniapp设置消息提醒(调用手机系统静音或铃声) openSettings() { @@ -451,13 +453,37 @@ // #endif }, // 创建本地通知栏消息 - createMessage(){ - uni.createPushMessage({ - title:'你好Y', - content:'这是测试内容', - icon:'/static/public/icon-plan-fire.png', - cover:true // 是否覆盖上一次提示的消息 - }) + createMessage(msg){ + let that = this; + // #ifdef APP-PLUS + uni.getSystemInfo({ + success(res) { + if(res.platform == 'ios'){ + if(uni.getStorageSync('ifVoice') || uni.getStorageSync('ifMessage')){ + uni.createPushMessage({ + content:msg, + sound:uni.getStorageSync('ifVoice')?'system':'none',// 默认没有声音none,系统声音system + success: () => {}, + complete: () => {} + }) + } + } else if (res.platform == 'android'){ + if(uni.getStorageSync('ifVoice') || uni.getStorageSync('ifMessage')){ + uni.createPushMessage({ + // title:'飞猴云服务',//标题 + content:msg,//内容描述 + // icon:'/static/public/icon-plan-fire.png',//显示的图片 + cover:true ,// 是否覆盖上一次提示的消息 + when:that.timeago(new Date().getTime()), // 显示的时间 + sound:uni.getStorageSync('ifVoice')?'system':'none',// 默认没有声音none,系统声音system + success: () => {}, + complete: () => {} + }) + } + } + } + }); + // #endif }, // 播放音乐 bofang(msg){ @@ -480,21 +506,6 @@ this.ifPlayIng = false; } }, - // uniapp设置消息提醒(调用手机系统静音或铃声) - openSettings() { - uni.getSystemInfo({ - success(res) { - if(res.platform == 'ios'){ - plus.runtime.openURL("app-settings://"); - } else if (res.platform == 'android'){ - var main = plus.android.runtimeMainActivity(); - var Intent = plus.android.importClass("android.content.Intent"); - var mIntent = new Intent('android.settings.SOUND_SETTINGS'); - main.startActivity(mIntent); - } - } - }); - }, // 首页信息查询 checkHome(){ this.$requst.get('/universal/api.home/home').then(res=>{ @@ -693,6 +704,52 @@ callEv(){ // this.$toolAll.tools.countCustomer('15616330510'); this.$toolAll.tools.countCustomer(this.contactPhone); + }, + // 时差换算 + timeago(dateTimeStamp){ + let result = ''; + var minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示 + var hour = minute * 60; + var day = hour * 24; + var week = day * 7; + var halfamonth = day * 15; + var month = day * 30; + var now = new Date().getTime(); //获取当前时间毫秒 + console.log(now) + var diffValue = now - dateTimeStamp;//时间差 + + if(diffValue < 0){ + return; + } + var minC = diffValue/minute; //计算时间差的分,时,天,周,月 + var hourC = diffValue/hour; + var dayC = diffValue/day; + var weekC = diffValue/week; + var monthC = diffValue/month; + if(monthC >= 1 && monthC <= 3){ + result = " " + parseInt(monthC) + "月前" + }else if(weekC >= 1 && weekC <= 3){ + result = " " + parseInt(weekC) + "周前" + }else if(dayC >= 1 && dayC <= 6){ + result = " " + parseInt(dayC) + "天前" + }else if(hourC >= 1 && hourC <= 23){ + result = " " + parseInt(hourC) + "小时前" + }else if(minC >= 1 && minC <= 59){ + result =" " + parseInt(minC) + "分钟前" + }else if(diffValue >= 0 && diffValue <= minute){ + result = "刚刚" + }else { + var datetime = new Date(); + datetime.setTime(dateTimeStamp); + var Nyear = datetime.getFullYear(); + var Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1; + var Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate(); + var Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours(); + var Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes(); + var Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds(); + result = Nyear + "-" + Nmonth + "-" + Ndate + } + return result; } } } diff --git a/pagesB/set-up/set-up.vue b/pagesB/set-up/set-up.vue index a7e0c4b..c2ab800 100644 --- a/pagesB/set-up/set-up.vue +++ b/pagesB/set-up/set-up.vue @@ -7,10 +7,12 @@ 开启语音提醒 + 接受新消息通知 + 修改登录密码