From 63a64392402de46352f673c249aec82c1504ed5f Mon Sep 17 00:00:00 2001
From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com>
Date: Fri, 30 Jan 2026 11:17:12 +0800
Subject: [PATCH] app点击消息后跳转第三方
---
src/mobile/components/searchPicker.jsx | 1 -
src/routes/mobile/IndexMobile.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
src/utils/config.js | 2 +-
3 files changed, 60 insertions(+), 14 deletions(-)
diff --git a/src/mobile/components/searchPicker.jsx b/src/mobile/components/searchPicker.jsx
index c9140df..d24472a 100644
--- a/src/mobile/components/searchPicker.jsx
+++ b/src/mobile/components/searchPicker.jsx
@@ -3,7 +3,6 @@ import { List,} from 'antd-mobile-v2';
import { useState, useMemo } from 'react';
import styles from "./selectInput.less";
export default function SearchablePicker(props) {
- console.log("🚀 ~ SearchablePicker ~ props:", props)
const { onConfirm, initialValue, data, sTitle, onChange, value:newValue } = props;
const [searchValue, setSearchValue] = useState('');
diff --git a/src/routes/mobile/IndexMobile.js b/src/routes/mobile/IndexMobile.js
index 05ad57b..2571da4 100644
--- a/src/routes/mobile/IndexMobile.js
+++ b/src/routes/mobile/IndexMobile.js
@@ -125,7 +125,16 @@ class IndexMobile extends React.Component {
touchStartPageY: e.changedTouches[0].pageY,
});
};
-
+ // 在 IndexMobile 组件中任意位置(比如加个按钮)
+ closeDingtalkPage = () => {
+ const { plus } = window;
+ if (plus) {
+ const webView = plus.webview.getWebviewById('dingtalk_message_page');
+ if (webView) {
+ webView.close('auto'); // 'auto' 表示自动动画关闭
+ }
+ }
+ };
handleTouchEnd = e => {
const touchEndtPageX = e.changedTouches[0].pageX;
const touchEndtPageY = e.changedTouches[0].pageY;
@@ -266,7 +275,7 @@ class IndexMobile extends React.Component {
);
- } else if (location.pathname === "/indexMobile/quotationDetail") {
+ } else if (location.pathname === "/indexMobile/quotationDetail") {
return (
)
@@ -274,7 +283,7 @@ class IndexMobile extends React.Component {
return (
);
- }
+ }
}
}
@@ -324,8 +333,8 @@ class IndexMobile extends React.Component {
}
: { height: 400 }
}
- // onTouchStart={this.handleTouchStart.bind(this)}
- // onTouchEnd={this.handleTouchEnd.bind(this)}
+ // onTouchStart={this.handleTouchStart.bind(this)}
+ // onTouchEnd={this.handleTouchEnd.bind(this)}
>
{
const { app } = this.props;
- const { token , userinfo} = app;
- const {sBrandsId,sSubsidiaryId,sUserName} = userinfo || {}
+ const { token, userinfo } = app;
+ const { sBrandsId, sSubsidiaryId, sUserName } = userinfo || {}
commonBusiness.clearSocketData({ token, value: {}, sModelsId: 100 });
- this.setState({
- selectedTab: "message",
- title: message,
- });
+ // this.setState({
+ // selectedTab: "message",
+ // title: message,
+ // });
const url = `${commonConfig.server_host}/phone/phoneMsgFlowDingTalk/${sBrandsId}/${sSubsidiaryId}/${sUserName}`
- history.push(url);
+ // history.push(url);
+ const { plus } = window;
+ if (plus) {
+ // 创建一个唯一 ID 的 webview
+ const webViewId = 'phoneMsgFlowWebView';
+
+ // 先尝试获取已存在的 webview(避免重复创建)
+ let webView = plus.webview.getWebviewById(webViewId);
+ if (!webView) {
+ webView = plus.webview.create(
+ url,
+ webViewId,
+ {
+ top: '0px',
+ bottom: '0px',
+ scrollIndicator: 'none',
+ scalable: false,
+ }
+ );
+ }
+ webView.addEventListener('loaded', () => {
+ // 注入返回键处理逻辑
+ webView.evalJS(`
+ (function() {
+ if (window.plus) {
+ plus.key.addEventListener('backbutton', function() {
+ // 关闭自己,自动回到下层页面(即 /indexMobile)
+ plus.webview.currentWebview().close();
+ });
+ }
+ })();
+ `);
+ });
+ // 显示 webview(从右侧滑入)
+ plus.webview.show(webView, 'slide-in-right', 200);
+ } else {
+ // 非 plus 环境(如浏览器调试),降级用新窗口打开
+ window.open(url, '_blank');
+ }
}}
data-seed="logId"
>
diff --git a/src/utils/config.js b/src/utils/config.js
index fbfdd4b..2aa3ddd 100644
--- a/src/utils/config.js
+++ b/src/utils/config.js
@@ -9,7 +9,7 @@ const API = process.env.API;
const bHttps = false;
export const webSite = {
faceAddress: isDev ? '//km5cjx.gnway.cc:36867/xlyFace' : '//' + location.host + '/xlyFace',
- ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:36867/xlyEntry/' : '//' + location.host + '/xlyEntry/',
+ ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:37845/xlyEntry/' : '//' + location.host + '/xlyEntry/',
// ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//118.178.19.35:8088/xlyEntry/' : '//' + location.host + '/xlyEntry/',
// ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:36867/xlyEntry/' : '//' + location.host + '/xlyEntry/',
--
libgit2 0.22.2