From da32252d08f2a52f1ddcdac62e11febb2be3f711 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 19 一月 2026 16:08:09 +0800
Subject: [PATCH] 新增 个推 绑定用户设备码, 接受用户点击任务栏事件的功能
---
utils/getuiUtils.js | 52 +++++++++++++++++++++++--
pages/index/login.vue | 3 -
App.vue | 11 +++++
3 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/App.vue b/App.vue
index 129c3f5..540bc51 100644
--- a/App.vue
+++ b/App.vue
@@ -50,7 +50,7 @@
// 鐩戝惉閫氱煡鐐瑰嚮浜嬩欢锛堢儹鍚姩锛欰pp 鍚庡彴杩愯鏃剁偣鍑婚�氱煡锛�
plus.push.addEventListener("click", (msg) => {
let payload = {};
- console.log('payload: ', msg.payload);
+ console.log('msg: ', msg);
// 鍏煎涓嶅悓鏍煎紡鐨� payload锛堟湰鍦版帹閫� vs 杩滅▼鎺ㄩ�侊級
if (typeof msg.payload === "string") {
payload = JSON.parse(msg.payload); // 杩滅▼鎺ㄩ�佸彲鑳芥槸瀛楃涓诧紝闇�瑙f瀽
@@ -59,6 +59,15 @@
}
this.handlePushJump(payload); // 澶勭悊璺宠浆
});
+
+ // 涓帹v1鐗堟湰鍙兘閫氳繃閫忎紶浼犲弬
+ plus.push.addEventListener('receive', (msg) => {
+ console.log('鏀跺埌 V1 鐗堟湰閫忎紶娑堟伅锛�', msg);
+ // 浠呴�忎紶妯℃澘闇�瑕侊紙閫氱煡妯℃澘鏃犻渶澶勭悊锛�
+ if (msg.payload) {
+ this.handlePushJump(msg.payload);
+ }
+ }, false);
// #endif
},
onShow: function() {
diff --git a/pages/index/login.vue b/pages/index/login.vue
index 5065984..f6e8b25 100644
--- a/pages/index/login.vue
+++ b/pages/index/login.vue
@@ -341,8 +341,7 @@
this.CommonUtils.setServerUrl(this.serverUrl)
// this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc);
// getuiUtils.getClientID()
- var clientInfo = plus.push.getClientInfo();
- console.log('clientInfo: ', clientInfo);
+ getuiUtils.getClientID(res.data.data[0].Czybm,res.data.data[0].Czymc)
uni.reLaunch({
url: '/pages/index/index'
})
diff --git a/utils/getuiUtils.js b/utils/getuiUtils.js
index 5268ada..c9e8e10 100644
--- a/utils/getuiUtils.js
+++ b/utils/getuiUtils.js
@@ -1,16 +1,58 @@
+import {
+ CommonUtils
+} from "./common";
+
class getuiInstance {
constructor() {
this.cid = ""
}
- getClientID() {
+ getClientID(Userbm, UserName) {
// #ifdef APP-PLUS
- plus.push.getClientInfoAsync((info) => {
- this.cid = info["clientid"]
- console.log('cid: ', this.cid);
- });
+ const info = plus.push.getClientInfo()
+ this.cid = info["clientid"]
+ console.log('cid: ', this.cid);
+ this.setUserClientIDRelative(Userbm, UserName, this.cid, 1)
// #endif
+ };
+
+ async setUserClientIDRelative(Userbm, UserName, ClientID, Online) {
+ try {
+ let res = await CommonUtils.doRequest2Async({
+ url: "/Web/SetGy_UserClientIdConnection",
+ method: "POST",
+ data: {
+ HUserbm: Userbm,
+ HUserName: UserName,
+ HClientID: ClientID,
+ HOnline: Online
+ }
+ })
+
+
+ let {
+ data,
+ count,
+ Message
+ } = res.data
+
+ if(count != 1) {
+ CommonUtils.showTips({
+ title: "娓╅Θ鎻愮ず",
+ message: Message
+ })
+ }
+ }catch(err) {
+ CommonUtils.showTips({
+ title: "娓╅Θ鎻愮ず",
+ message: err
+ })
+ }
+
}
}
+
+
+
export default new getuiInstance()
\ No newline at end of file
--
Gitblit v1.9.1