对接消息推送

This commit is contained in:
zhouyanli
2026-06-01 11:38:03 +08:00
parent fbe07e21a6
commit 3fa853cb4c
6 changed files with 41 additions and 30 deletions

View File

@@ -1,7 +1,17 @@
{
"permissions": {
"allow": [
"WebFetch(domain:app.apifox.com)"
"WebFetch(domain:app.apifox.com)",
"Bash(sed -i '545s/.*/\\\\t\\\\t\\\\t.activity-card{\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t.uni-card{/' pages/index/index.vue)",
"Bash(sed -n '544,549p' pages/index/index.vue)",
"Bash(sed -i '548d' pages/index/index.vue)",
"Bash(sed -n '544,552p' pages/index/index.vue)",
"Bash(cat)",
"Bash(python /tmp/notice_edit.py)",
"Bash(node *)",
"Bash(git checkout *)",
"Bash(sed -i '207,213d' D:/wuye-jumin-front/property-uniapp-project/pageSubPack/loginSub/login.vue)",
"Bash(sed -n '203,213p' D:/wuye-jumin-front/property-uniapp-project/pageSubPack/loginSub/login.vue)"
]
}
}

View File

@@ -3,12 +3,12 @@
// 应用启动时执行
onLaunch(() => {
console.log('App 启动')
console.log('App 启动')
// #ifdef APP-PLUS
// 只有 App 平台才获取 CID
getPushCID()
// #endif
// #ifdef APP-PLUS
// 只有 App 平台才获取 CID
getPushCID()
// #endif
})
// 获取 uniPush 2.0 CID
@@ -20,29 +20,12 @@
// 存起来备用
uni.setStorageSync('push_cid', res.cid)
// 弹出CID给你看
// uni.showModal({
// title: '你的CID',
// content: res.cid
// })
},
fail: (err) => {
console.error('获取推送 CID 失败', err)
}
})
}
// export default {
// on
// onShow: function() {
// // console.log('App Show')
// },
// onHide: function() {
// console.log('App Hide')
// },
// }
</script>
<style lang="scss">

View File

@@ -88,7 +88,8 @@
"appid" : "",
"UniversalLinks" : ""
}
}
},
"payment" : {}
}
}
},

View File

@@ -139,3 +139,7 @@ export const addVisitorData = (data) =>{
export const uploadFile = (filePath) => {
return upload(filePath,'/api/resident/file/uploadImage');
}
// 单推消息推送
export const getPushSingle = (data) =>{
return post("/api/push/single", data)
}

View File

@@ -186,10 +186,12 @@ const handleLogin = () => {
return;
}
uni.showLoading({ title: '登录中...', mask: true });
const push_cid = uni.getStorageSync('push_cid')
let params = {
phone:phoneNumber.value,
smsCode:verifyCode.value,
scene:'login',
cid:push_cid
}
getLoginBySms(params).then(res =>{
if(res.code === 200){
@@ -204,6 +206,7 @@ const handleLogin = () => {
uni.setStorageSync('currentVillageId', currentVillageId);
uni.hideLoading();
uni.showToast({ title: '登录成功', icon: 'success' });
setTimeout(() =>{
uni.switchTab({ url: '/pages/index/index' });
},1500)
@@ -231,6 +234,14 @@ const handleLogin = () => {
// title:"登录成功",
// icon:'success'
// })
// 登录成功后上报推送 CID
// #ifdef APP-PLUS
const cid = uni.getStorageSync('push_cid')
if (cid) {
reportPushCID(cid)
}
// #endif
// setTimeout(() =>{
// uni.switchTab({ url: '/pages/index/index' });
// },1500)

View File

@@ -134,9 +134,11 @@ const handleLogin = () => {
return;
}
uni.showLoading({ title: '登录中...', mask: true });
const push_cid = uni.getStorageSync('push_cid')
let params = {
username:phoneNumber.value,
password:password.value
password:password.value,
cid:push_cid
}
getLoginPassword(params).then(res =>{
if(res.code === 200){