Commit 63a64392402de46352f673c249aec82c1504ed5f

Authored by chenxt
1 parent f943a940

app点击消息后跳转第三方

src/mobile/components/searchPicker.jsx
... ... @@ -3,7 +3,6 @@ import { List,} from 'antd-mobile-v2';
3 3 import { useState, useMemo } from 'react';
4 4 import styles from "./selectInput.less";
5 5 export default function SearchablePicker(props) {
6   - console.log("🚀 ~ SearchablePicker ~ props:", props)
7 6 const { onConfirm, initialValue, data, sTitle, onChange, value:newValue } = props;
8 7  
9 8 const [searchValue, setSearchValue] = useState('');
... ...
src/routes/mobile/IndexMobile.js
... ... @@ -125,7 +125,16 @@ class IndexMobile extends React.Component {
125 125 touchStartPageY: e.changedTouches[0].pageY,
126 126 });
127 127 };
128   -
  128 + // 在 IndexMobile 组件中任意位置(比如加个按钮)
  129 + closeDingtalkPage = () => {
  130 + const { plus } = window;
  131 + if (plus) {
  132 + const webView = plus.webview.getWebviewById('dingtalk_message_page');
  133 + if (webView) {
  134 + webView.close('auto'); // 'auto' 表示自动动画关闭
  135 + }
  136 + }
  137 + };
129 138 handleTouchEnd = e => {
130 139 const touchEndtPageX = e.changedTouches[0].pageX;
131 140 const touchEndtPageY = e.changedTouches[0].pageY;
... ... @@ -266,7 +275,7 @@ class IndexMobile extends React.Component {
266 275 <Quotation {...this.props} sModelType={pageText} sModelsId="101251240115016076506222050" />
267 276 </div>
268 277 );
269   - } else if (location.pathname === "/indexMobile/quotationDetail") {
  278 + } else if (location.pathname === "/indexMobile/quotationDetail") {
270 279 return (
271 280 <QuotationDetail {...this.props} sModelType={pageText} sModelsId="101251240115016076506222050" />
272 281 )
... ... @@ -274,7 +283,7 @@ class IndexMobile extends React.Component {
274 283 return (
275 284 <CommobileList {...this.props} sModelsId="101251240115017633494461850" />
276 285 );
277   - }
  286 + }
278 287 }
279 288 }
280 289  
... ... @@ -324,8 +333,8 @@ class IndexMobile extends React.Component {
324 333 }
325 334 : { height: 400 }
326 335 }
327   - // onTouchStart={this.handleTouchStart.bind(this)}
328   - // onTouchEnd={this.handleTouchEnd.bind(this)}
  336 + // onTouchStart={this.handleTouchStart.bind(this)}
  337 + // onTouchEnd={this.handleTouchEnd.bind(this)}
329 338 >
330 339 <TabBar
331 340 tabBarPosition="bottom"
... ... @@ -360,15 +369,53 @@ class IndexMobile extends React.Component {
360 369 badge={msgObj.iCount || 0}
361 370 onPress={() => {
362 371 const { app } = this.props;
363   - const { token , userinfo} = app;
364   - const {sBrandsId,sSubsidiaryId,sUserName} = userinfo || {}
  372 + const { token, userinfo } = app;
  373 + const { sBrandsId, sSubsidiaryId, sUserName } = userinfo || {}
365 374 commonBusiness.clearSocketData({ token, value: {}, sModelsId: 100 });
366   - this.setState({
367   - selectedTab: "message",
368   - title: message,
369   - });
  375 + // this.setState({
  376 + // selectedTab: "message",
  377 + // title: message,
  378 + // });
370 379 const url = `${commonConfig.server_host}/phone/phoneMsgFlowDingTalk/${sBrandsId}/${sSubsidiaryId}/${sUserName}`
371   - history.push(url);
  380 + // history.push(url);
  381 + const { plus } = window;
  382 + if (plus) {
  383 + // 创建一个唯一 ID 的 webview
  384 + const webViewId = 'phoneMsgFlowWebView';
  385 +
  386 + // 先尝试获取已存在的 webview(避免重复创建)
  387 + let webView = plus.webview.getWebviewById(webViewId);
  388 + if (!webView) {
  389 + webView = plus.webview.create(
  390 + url,
  391 + webViewId,
  392 + {
  393 + top: '0px',
  394 + bottom: '0px',
  395 + scrollIndicator: 'none',
  396 + scalable: false,
  397 + }
  398 + );
  399 + }
  400 + webView.addEventListener('loaded', () => {
  401 + // 注入返回键处理逻辑
  402 + webView.evalJS(`
  403 + (function() {
  404 + if (window.plus) {
  405 + plus.key.addEventListener('backbutton', function() {
  406 + // 关闭自己,自动回到下层页面(即 /indexMobile)
  407 + plus.webview.currentWebview().close();
  408 + });
  409 + }
  410 + })();
  411 + `);
  412 + });
  413 + // 显示 webview(从右侧滑入)
  414 + plus.webview.show(webView, 'slide-in-right', 200);
  415 + } else {
  416 + // 非 plus 环境(如浏览器调试),降级用新窗口打开
  417 + window.open(url, '_blank');
  418 + }
372 419 }}
373 420 data-seed="logId"
374 421 >
... ...
src/utils/config.js
... ... @@ -9,7 +9,7 @@ const API = process.env.API;
9 9 const bHttps = false;
10 10 export const webSite = {
11 11 faceAddress: isDev ? '//km5cjx.gnway.cc:36867/xlyFace' : '//' + location.host + '/xlyFace',
12   - ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:36867/xlyEntry/' : '//' + location.host + '/xlyEntry/',
  12 + ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:37845/xlyEntry/' : '//' + location.host + '/xlyEntry/',
13 13  
14 14 // ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//118.178.19.35:8088/xlyEntry/' : '//' + location.host + '/xlyEntry/',
15 15 // ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:36867/xlyEntry/' : '//' + location.host + '/xlyEntry/',
... ...