冲突
This commit is contained in:
parent
d44cd1516a
commit
ea320f4e54
132
App.vue
132
App.vue
@ -73,80 +73,80 @@ export default {
|
||||
// #endif
|
||||
|
||||
// uni-app客户端获取push客户端标记,代码可以实现在App.vue中
|
||||
uni.getPushClientId({
|
||||
success: (res) => {
|
||||
let push_clientid = res.cid
|
||||
uni.setStorageSync("push_clientid", push_clientid)
|
||||
console.log('客户端推送标识cid:',push_clientid)
|
||||
// uni.getPushClientId({
|
||||
// success: (res) => {
|
||||
// let push_clientid = res.cid
|
||||
// uni.setStorageSync("push_clientid", push_clientid)
|
||||
// console.log('客户端推送标识cid:',push_clientid)
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
console.log("systemInfo:", systemInfo)
|
||||
// const systemInfo = uni.getSystemInfoSync();
|
||||
// console.log("systemInfo:", systemInfo)
|
||||
|
||||
|
||||
let userInfo= uni.getStorageSync('userInfo')
|
||||
console.log("userinfo:", userInfo)
|
||||
if(!userInfo){
|
||||
return
|
||||
}
|
||||
if(userInfo.uuid){
|
||||
let client_type = ""
|
||||
if (systemInfo.platform === 'android') {
|
||||
client_type = "A"
|
||||
} else if (systemInfo.platform === 'ios') {
|
||||
client_type = "I"
|
||||
}
|
||||
console.log("client_type:", client_type)
|
||||
if(client_type){
|
||||
my_api.addUniappCid({
|
||||
user_uuid: userInfo.uuid,
|
||||
client_type:client_type,
|
||||
cid: push_clientid
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.error("unipush: ", err)
|
||||
}
|
||||
})
|
||||
// let userInfo= uni.getStorageSync('userInfo')
|
||||
// console.log("userinfo:", userInfo)
|
||||
// if(!userInfo){
|
||||
// return
|
||||
// }
|
||||
// if(userInfo.uuid){
|
||||
// let client_type = ""
|
||||
// if (systemInfo.platform === 'android') {
|
||||
// client_type = "A"
|
||||
// } else if (systemInfo.platform === 'ios') {
|
||||
// client_type = "I"
|
||||
// }
|
||||
// console.log("client_type:", client_type)
|
||||
// if(client_type){
|
||||
// my_api.addUniappCid({
|
||||
// user_uuid: userInfo.uuid,
|
||||
// client_type:client_type,
|
||||
// cid: push_clientid
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// fail(err) {
|
||||
// console.error("unipush: ", err)
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
uni.onPushMessage((res)=>{
|
||||
console.log("收到推送消息:", res)
|
||||
// uni.onPushMessage((res)=>{
|
||||
// console.log("收到推送消息:", res)
|
||||
|
||||
let app_isback = uni.getStorageSync("app_isback")
|
||||
console.log("app_isback:", app_isback)
|
||||
uni.showModal({
|
||||
title: res.data.title,
|
||||
content: res.type,
|
||||
showCancel: false
|
||||
});
|
||||
// let app_isback = uni.getStorageSync("app_isback")
|
||||
// console.log("app_isback:", app_isback)
|
||||
// uni.showModal({
|
||||
// title: res.data.title,
|
||||
// content: res.type,
|
||||
// showCancel: false
|
||||
// });
|
||||
|
||||
if(res.type === 'click' ){
|
||||
// if(res.type === 'click' ){
|
||||
|
||||
}else{
|
||||
if(app_isback){
|
||||
uni.createPushMessage({
|
||||
title: res.data.title,
|
||||
content: res.data.content,
|
||||
payload: res.data.payload,
|
||||
delay: 1,
|
||||
success: (res) => {
|
||||
console.log("创建推送消息成功", res)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
console.log('[App] emit global-dialog:show', res)
|
||||
uni.$emit('global-dialog:show', {
|
||||
title: res.data.title || '消息通知',
|
||||
content: res.data.content || '',
|
||||
confirmText: '我知道了',
|
||||
position: 'top',
|
||||
offsetTop: '160rpx'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// }else{
|
||||
// if(app_isback){
|
||||
// uni.createPushMessage({
|
||||
// title: res.data.title,
|
||||
// content: res.data.content,
|
||||
// payload: res.data.payload,
|
||||
// delay: 1,
|
||||
// success: (res) => {
|
||||
// console.log("创建推送消息成功", res)
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// console.log('[App] emit global-dialog:show', res)
|
||||
// uni.$emit('global-dialog:show', {
|
||||
// title: res.data.title || '消息通知',
|
||||
// content: res.data.content || '',
|
||||
// confirmText: '我知道了',
|
||||
// position: 'top',
|
||||
// offsetTop: '160rpx'
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
/** 设置语言 (此处为了方便demo切换语言,将其存到本地,实际需根据业务情况设置)*/
|
||||
setLanguage(
|
||||
|
||||
@ -21,13 +21,8 @@
|
||||
"Payment" : {},
|
||||
"Share" : {},
|
||||
"Webview-x5" : {},
|
||||
<<<<<<< HEAD
|
||||
"UIWebview" : {}
|
||||
=======
|
||||
"UIWebview" : {},
|
||||
"Push" : {},
|
||||
"VideoPlayer" : {}
|
||||
>>>>>>> 2532aa055c0df42bb4696ce75410718e31df24d1
|
||||
},
|
||||
/* 模块配置 */
|
||||
"distribute" : {
|
||||
@ -82,23 +77,7 @@
|
||||
}
|
||||
},
|
||||
"speech" : {},
|
||||
<<<<<<< HEAD
|
||||
"push" : {}
|
||||
=======
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"version" : "2",
|
||||
"offline" : false,
|
||||
"honor" : {},
|
||||
"meizu" : {},
|
||||
"mi" : {},
|
||||
"vivo" : {},
|
||||
"oppo" : {},
|
||||
"hms" : {},
|
||||
"fcm" : {}
|
||||
}
|
||||
}
|
||||
>>>>>>> 2532aa055c0df42bb4696ce75410718e31df24d1
|
||||
},
|
||||
"splashscreen" : {
|
||||
"androidStyle" : "common",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user