lilei 2 年 前
コミット
4338371fc6
5 ファイル変更34 行追加21 行削除
  1. 8 5
      App.vue
  2. 1 1
      libs/jgPush.js
  3. 5 1
      libs/tools.js
  4. 11 9
      manifest.json
  5. 9 5
      pages/login/login.vue

+ 8 - 5
App.vue

@@ -54,6 +54,8 @@
 						});
 					}
 				})
+				// 清空角标
+				skJGPush.setBadge(0)
 			}else{
 				// 极光推送-init
 				skJGPush.initJPushService()
@@ -75,12 +77,13 @@
 				if(result.notificationEventType == 'notificationOpened'){
 					this.setRead(result)
 				}else if(result.notificationEventType == 'notificationArrived'){
-					if(bgAudioManager){
-						bgAudioManager.src = '/static/notes.mp3';
-						bgAudioManager.play()
-					}
+					// if(bgAudioManager){
+					// 	bgAudioManager.src = '/static/notes.mp3';
+					// 	bgAudioManager.play()
+					// }
 				}else{
-					
+					// 清空角标
+					skJGPush.setBadge(0)
 				}
 			})
 			

+ 1 - 1
libs/jgPush.js

@@ -1,6 +1,6 @@
 // 引用方式
 var jpushModule = uni.requireNativePlugin("JG-JPush");
-console.log('【sk】【引用方式】【jpushModule】【requireNativePlugin】')
+console.log(jpushModule,'【sk】【引用方式】【jpushModule】【requireNativePlugin】')
  
 // 开启 debug 模式,默认是关闭
 function openDebug() {

+ 5 - 1
libs/tools.js

@@ -1,6 +1,5 @@
 let carmera = uni.requireNativePlugin('ziteng-maskcamera')
 let cameraModule = uni.requireNativePlugin("SMUniPlugin-CameraModule")
-
 // 处理数字千位分隔符  num 数值,decimal要保留的小数位数
 export const toThousands = (num, decimal) => {
   if (decimal) {
@@ -331,6 +330,11 @@ export const checkVersionToLoadUpdate = function(newVersion,type,callback){
 			cancelText:'稍后进行',
 			success: function (res) {
 				if (res.confirm) {
+					// 清空缓存token
+					let tmp = uni.getStorageSync('lifeData');
+					tmp = tmp ? tmp : {};
+					tmp['vuex_token'] = '';
+					uni.setStorageSync('lifeData', tmp);
 					if(curVer.platform == 'android'){
 						//设置 最新版本apk的下载链接
 						downloadApp(newVersion.attachment);

+ 11 - 9
manifest.json

@@ -54,7 +54,8 @@
         },
         /* 模块配置 */
         "modules" : {
-            "Bluetooth" : {}
+            "Bluetooth" : {},
+            "Push" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -95,12 +96,12 @@
                 "UIBackgroundModes" : "audio,bluetooth-central,remote-notification",
                 "privacyDescription" : {
                     //可选,JSON对象,iOS隐私信息访问的许可描述
-                    "NSPhotoLibraryUsageDescription" : "为了方便识别产品二维码,需要开启相册", //可选,字符串类型,系统相册读取权限描述
-                    "NSPhotoLibraryAddUsageDescription" : "为了方便识别产品二维码,需要开启相册", //可选,字符串类型,系统相册写入权限描述
-                    "NSCameraUsageDescription" : "为了方便识别产品二维码,需要开启相机", //可选,字符串类型,摄像头使用权限描述
-                    "NSLocationWhenInUseUsageDescription" : "为了连接蓝牙打印机,需要开启位", //可选,字符串类型,运行期访问位置权限描述
-                    "NSBluetoothPeripheralUsageDescription" : "为了连接蓝牙打印机,需要开启蓝牙", //可选,字符串类型,使用蓝牙权限描述
-                    "NSBluetoothAlwaysUsageDescription" : "为了连接蓝牙打印机,需要开启蓝牙" //可选,字符串类型,后台使用蓝牙权限描述
+                    "NSPhotoLibraryUsageDescription" : "扫描识别产品需要访问设备相册,是否同意?", //可选,字符串类型,系统相册读取权限描述
+                    "NSPhotoLibraryAddUsageDescription" : "扫描识别产品需要访问设备相册,是否同意?", //可选,字符串类型,系统相册写入权限描述
+                    "NSCameraUsageDescription" : "扫描识别产品二维码需要访问相机,是否同意?", //可选,字符串类型,摄像头使用权限描述
+                    "NSLocationWhenInUseUsageDescription" : "连接打印机需要开启位置权限,是否同意?", //可选,字符串类型,运行期访问位置权限描述
+                    "NSBluetoothPeripheralUsageDescription" : "连接打印机需要开启蓝牙权限,是否同意?", //可选,字符串类型,使用蓝牙权限描述
+                    "NSBluetoothAlwaysUsageDescription" : "连接打印机需要开启蓝牙权限,是否同意?" //可选,字符串类型,后台使用蓝牙权限描述
                 }
             },
             /* SDK配置 */
@@ -111,6 +112,9 @@
                     "system" : {
                         "__platform__" : [ "ios", "android" ]
                     }
+                },
+                "push" : {
+                    "unipush" : null
                 }
             },
             "icons" : {
@@ -221,8 +225,6 @@
                 "JPUSH_MEIZU_APPID" : "",
                 "JPUSH_XIAOMI_APPKEY" : "",
                 "JPUSH_XIAOMI_APPID" : "",
-                "JPUSH_HUAWEI_APPID" : "",
-                "JPUSH_HONOR_APPID" : "",
                 "__plugin_info__" : {
                     "name" : "JG-JPush",
                     "description" : "极光推送Hbuilder插件",

+ 9 - 5
pages/login/login.vue

@@ -72,14 +72,14 @@ export default {
 	onLoad() {
 		const token = this.$store.state.vuex_token
 		if(token){
-			this.toMain();
+			this.AndroidCheckUpdate(1)
 		}
 		this.isIos = uni.getSystemInfoSync().platform == "ios"
 		
 		// 点击消息
 		uni.$on('openMessage',item =>{
 			this.messageInfo = item
-			this.formSubmit()
+			this.AndroidCheckUpdate()
 		})
 	},
 	onUnload() {
@@ -113,19 +113,23 @@ export default {
 			});
 		},
 		// 版本更新
-		AndroidCheckUpdate(){
+		AndroidCheckUpdate(type){
 			let _this = this
 			let version = getApp().globalData.version
 			uni.showLoading({
 				title: '正在登录...'
 			});
-			getSysVersion({versionType:version.platform=='android'?'ANDROID':'IOS'}).then(ret => {
+			getSysVersion({versionType:uni.getSystemInfoSync().platform == "ios"?'IOS':'ANDROID'}).then(ret => {
 				if(ret.status == 200){
 					if(ret.data){
 						this.$store.state.vuex_versionInfo = ret.data || null
 						checkVersionToLoadUpdate(ret.data,0,_this.formSubmit)
 					}else{
-						this.formSubmit()
+						if(type){
+							this.toMain();
+						}else{
+							this.formSubmit();
+						}
 					}
 				}
 				uni.hideLoading()