移除推送代码

This commit is contained in:
砂糖
2025-07-10 16:36:17 +08:00
parent 5f861c58ee
commit faab5b2bd1
3 changed files with 84 additions and 62 deletions

52
App.vue
View File

@@ -30,41 +30,33 @@ export default {
console.error(`暂时不支持运行到小程序端`); console.error(`暂时不支持运行到小程序端`);
// #endif // #endif
// 集成cid全局获取和存储 // 集成cid全局获取和存储
uni.getPushClientId({ // uni.getPushClientId({
success: (res) => { // success: (res) => {
console.log(res, 'app-Push-ID'); // console.log(res, 'app-Push-ID');
if (res && res.cid) { // if (res && res.cid) {
uni.setStorageSync('cid', res.cid); // uni.setStorageSync('cid', res.cid);
} // }
}, // },
fail: (err) => { // fail: (err) => {
console.log(err) // console.log(err)
} // }
}) // })
}, },
onShow: function () { onShow: function () {
console.log("App Show"); console.log("App Show");
IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false); IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false);
uni.getPushClientId({
success(res) {
console.log(res, 'app-Push-ID');
},
fail(err) {
console.log(err)
}
})
//#ifdef APP-PLUS //#ifdef APP-PLUS
var info = plus.push.getClientInfo() // var info = plus.push.getClientInfo()
plus.push.addEventListener("click", function(msg) { // plus.push.addEventListener("click", function(msg) {
console.log("click:" + JSON.stringify(msg)); // console.log("click:" + JSON.stringify(msg));
console.log(msg.payload); // console.log(msg.payload);
console.log(JSON.stringify(msg)); // console.log(JSON.stringify(msg));
}, false); // }, false);
// 监听在线消息事件 // // 监听在线消息事件
plus.push.addEventListener("receive", function(msg) { // plus.push.addEventListener("receive", function(msg) {
//业务代码 // //业务代码
console.log("recevice:" + JSON.stringify(msg)) // console.log("recevice:" + JSON.stringify(msg))
}, false); // }, false);
//#endif //#endif

View File

@@ -74,7 +74,8 @@
"speech" : {}, "speech" : {},
"push" : { "push" : {
"unipush" : { "unipush" : {
"offline" : true "offline" : true,
"oppo" : {}
} }
} }
}, },

View File

@@ -216,42 +216,71 @@ export default {
this.$store.dispatch("contact/getSentFriendApplications"); this.$store.dispatch("contact/getSentFriendApplications");
this.$store.dispatch("contact/getRecvGroupApplications"); this.$store.dispatch("contact/getRecvGroupApplications");
this.$store.dispatch("contact/getSentGroupApplications"); this.$store.dispatch("contact/getSentGroupApplications");
// 登录成功后绑定deviceId与imId
// 获取设备cid调用云函数
// const cid = uni.getStorageSync('cid');
// uniCloud.callFunction({
// name: 'bindingIm',
// data: {
// deviceId: cid,
// imId: userID
// },
// success: (res) => {
// if (res.result.code === 200) {
// uni.showToast({
// title: res.result.msg,
// icon: 'success'
// });
// } else {
// uni.showToast({
// title: res.result.msg,
// icon: 'none'
// });
// }
// },
// fail: (err) => {
// uni.showToast({
// title: '云函数调用失败',
// icon: 'none'
// });
// console.error(err);
// }
// });
uni.switchTab({ uni.switchTab({
url: "/pages/conversation/conversationList/index", url: "/pages/conversation/conversationList/index",
}); });
await getSMSCodeFromOa(this.loginInfo.phoneNumber); await getSMSCodeFromOa(this.loginInfo.phoneNumber);
const info = await loginOaByPhone(this.loginInfo.phoneNumber) const info = await loginOaByPhone(this.loginInfo.phoneNumber)
console.log('用户信息', info) // console.log('用户信息', info)
const oaUserId = info.userInfo.userId; // const oaUserId = info.userInfo.userId;
// 获取设备cid调用云函数
const cid = uni.getStorageSync('cid'); // uniCloud.callFunction({
uniCloud.callFunction({ // name: 'binding',
name: 'binding', // data: {
data: { // oaId: oaUserId,
oaId: oaUserId, // deviceId: cid
deviceId: cid // },
}, // success: (res) => {
success: (res) => { // if (res.result.code === 200) {
if (res.result.code === 200) { // uni.showToast({
uni.showToast({ // title: res.result.msg,
title: res.result.msg, // icon: 'success'
icon: 'success' // });
}); // } else {
} else { // uni.showToast({
uni.showToast({ // title: res.result.msg,
title: res.result.msg, // icon: 'none'
icon: 'none' // });
}); // }
} // },
}, // fail: (err) => {
fail: (err) => { // uni.showToast({
uni.showToast({ // title: '云函数调用失败',
title: '云函数调用失败', // icon: 'none'
icon: 'none' // });
}); // console.error(err);
console.error(err); // }
} // });
});
this.loginInfo.password = ""; this.loginInfo.password = "";
this.loading = false; this.loading = false;