Merge branch 'uni-push' into bill

# Conflicts:
#	App.vue
#	manifest.json
#	pages/users/login/login_copy.vue
This commit is contained in:
THK3121 2023-07-01 14:34:03 +08:00
commit fe2fe620a8
5 changed files with 68 additions and 37 deletions

65
App.vue
View File

@ -20,6 +20,7 @@
history
} from '@/api/public.js'
import Routine from './libs/routine.js';
var jpushModule = uni.requireNativePlugin("JG-JPush");
export default {
globalData: {
spid: 0,
@ -123,24 +124,24 @@
jpushModule.initJPushService()
jpushModule.addConnectEventListener(result=>{
let connectEnable = result.connectEnable
console.log("jpush连接", connectEnable)
// console.log("jpush", connectEnable)
})
jpushModule.initJPushService();
//
jpushModule.setAlias({
'alias': uni.getStorageSync('userId'),
'sequence': 1
})
// jpushModule.setAlias({
// 'alias': uni.getStorageSync('userId'),
// 'sequence': 1
// })
//
jpushModule.addTagAliasListener(result => {
let code = result.code
let sequence = result.sequence
let tags = result.tags
let tag = result.tag
let tagEnable = result.tagEnable
let alias = result.alias
console.log(alias, '别名')
})
// jpushModule.addTagAliasListener(result => {
// let code = result.code
// let sequence = result.sequence
// let tags = result.tags
// let tag = result.tag
// let tagEnable = result.tagEnable
// let alias = result.alias
// console.log(alias, '')
// })
//
jpushModule.addNotificationListener(result => {
let notificationEventType = result.notificationEventType
@ -148,31 +149,27 @@
let title = result.title
let content = result.content
let extras = result.extras
console.log("通知", result.extras.userinfo)
console.log("通知", result)
//
if (notificationEventType == 'notificationOpened') {
if(result.extras.userinfo){
uni.navigateTo({
url: result.extras.userinfo
})
}
uni.navigateTo({
url: result.extras.route
})
}
})
jpushModule.getRegistrationID(result => {
console.log("注册ID", result.registerID)
if (result.registerID) {
uni.setStorageSync("register_id", result.registerID)
}
})
jpushModule.addCustomMessageListener(result => {
let messageID = result.messageID
let content = result.content
let extras = result.extras
console.log("自定义消息", result)
})
// jpushModule.addCustomMessageListener(result => {
// let messageID = result.messageID
// let content = result.content
// let extras = result.extras
// console.log("", result)
// })
//#endif
},
onShow() {
let that = this

View File

@ -74,6 +74,16 @@ export function bindMp(data) {
noAuth: true
});
}
/**
* 绑定极光id
* @param data object 小程序用户登陆信息
*/
export function bindJG(data) {
return request.post("auth/bindJg", data, {
noAuth: true
});
}
/**
* 分享
* @returns {*}

View File

@ -284,6 +284,7 @@
}
}
}
}
}
},
@ -305,6 +306,7 @@
},
"requiredPrivateInfos" : [ "getLocation", "chooseAddress" ],
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
@ -333,5 +335,6 @@
},
"title" : "加载中...",
"template" : "template.h5.html"
}
}

View File

@ -108,6 +108,17 @@
this.getGoods()
this.selfLocation()
this.Area()
uni.$on('connectstatusChange',(connectstatus) =>{
var connectstr = ''
if (connectstatus == true) {
connectstr ='已连接'
this.getRegistrationID()
}else{
connectstr ='未连接'
}
this.connectstatus = connectStr
})
},
onShow() {},
onReachBottom() {

View File

@ -280,7 +280,8 @@
getLogo,
getconfig,
getVersion,
bindMp
bindMp,
bindJG
} from "@/api/public";
// import cookie from "@/utils/store/cookie";
import {
@ -295,6 +296,7 @@
mapGetters
} from "vuex";
import Verify from '@/components/verify/verify.vue';
var jpushModule = uni.requireNativePlugin("JG-JPush");
const BACK_URL = "login_back_url";
export default {
@ -920,8 +922,7 @@
code: res.code,
iv: iv,
encryptedData: encryptedData,
phone: that
.account
phone: that.account
}).then(res => {
// console.log(res);
})
@ -936,6 +937,15 @@
}
})
}
jpushModule.initJPushService()
jpushModule.getRegistrationID(result => {
if (result.registerID) {
bindJG({
phone: this.account,
jg_register_id: result.registerID
})
}
})
}
}
};