From a0e1df21f876fd8c1c1da6516f41772141c461af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Wed, 17 Jan 2024 10:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/UrlTool.js | 2 +- src/common/educoder.js | 2 +- .../Information/Component/comments/list.jsx | 10 +++++----- src/forge/Information/Pages/newsDetail.jsx | 20 +++++++++---------- src/forge/Information/index.jsx | 4 ++-- src/modules/tpm/TPMIndexHOC.js | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 452529717..5a9fa372e 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -19,7 +19,7 @@ export function getImageUrl(path) { return `${path}`; } -export function IsPC(){ +export function isPhone(){ var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", diff --git a/src/common/educoder.js b/src/common/educoder.js index 6575c5032..96896845a 100644 --- a/src/common/educoder.js +++ b/src/common/educoder.js @@ -7,7 +7,7 @@ export { getImageUrl as getImageUrl,getImageUrlAbsolute as getImageUrlAbsolute,getImage as getImage, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, getZoneUrl as getZoneUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth , getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl, - turnbar,returnbar,setSeoMeta as setSeoMeta , IsPC as IsPC, addMeta as addMeta + turnbar,returnbar,setSeoMeta as setSeoMeta , isPhone as isPhone, addMeta as addMeta } from './UrlTool'; export { setmiyah as setmiyah } from './Component'; diff --git a/src/forge/Information/Component/comments/list.jsx b/src/forge/Information/Component/comments/list.jsx index 4e70f5468..3cc1f286f 100644 --- a/src/forge/Information/Component/comments/list.jsx +++ b/src/forge/Information/Component/comments/list.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { Button, Popconfirm, Radio, Input, message, Tooltip, Spin, Pagination } from 'antd'; import axios from 'axios'; -import { getImageUrl, timeAgo } from 'educoder'; +import { getImageUrl, timeAgo, isPhone } from 'educoder'; import RenderHtml from '../../../../components/render-html'; import Attachment from '../../../Upload/attachment'; import EditComment from './editComment'; @@ -118,7 +118,7 @@ function IssueCommentList(props){ {/* 评论快速入口-仅有评论且登录时展示 */} - {login && category !== 'operate' && journalsCount > 0 &&
0 && 'pt15'}`}>
点击添加评论
} + {login && category !== 'operate' && journalsCount > 0 && !isPhone() &&
0 && 'pt15'}`}>
点击添加评论
} {/* 评论/操作日志 展示列表 */}
@@ -135,7 +135,7 @@ function IssueCommentList(props){ {item.user.name} {timeAgo(item.created_at)}
- {login &&
+ {login && !isPhone() &&
{/* 平台管理员/仓库管理员/发布评论者/issue创建者 */} {(admin || isManager || login === item.user.login || username === author) && {i.reply_user && i.reply_user.name} {timeAgo(i.created_at)}
- {login &&
+ {login && !isPhone() &&
{/* 平台管理员/仓库管理员/发布评论者/回复评论者/issue创建者 */} {(admin || isManager || login === i.user.login || (i.reply_user && login === i.reply_user.login) || username === author) && setPage(page)}/>
} {/* 添加评论 */} - {category !== 'operate' &&
+ {category !== 'operate' && !isPhone() &&
{login ? showEdit === 1 ? :
diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index 6ccd5c375..41b59abc3 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -4,7 +4,7 @@ import liulan from '../img/liulan.png'; import RenderHtml from '../../../components/render-html'; import { Base64 } from 'js-base64'; import { getNewsDetail } from '../api'; -import { IsPC } from 'educoder'; +import { isPhone } from 'educoder'; import { tempConfig } from '../tempInfo'; import Acce from '../Component/mobile/accessory'; import { addMeta, setSeoMeta } from 'educoder'; @@ -29,7 +29,7 @@ function NewsDetail(props){ document.title = `${ name }/${ cmsDir.name }`; addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`); } - if(IsPC() && zonedetail){ + if(isPhone() && zonedetail){ setTimeout(()=>{ window.scrollTo(0,1); if(detail) @@ -39,7 +39,7 @@ function NewsDetail(props){ document.querySelector('meta[name="viewport"]').setAttribute('content','width=device-width, user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0'); } return()=>{ - if(IsPC()){ + if(isPhone()){ document.querySelector('meta[name="viewport"]').setAttribute('content', initialContent); } if (zonedetail) { @@ -51,7 +51,7 @@ function NewsDetail(props){ useEffect(()=>{ if(id){ - window.scrollTo(0,IsPC() ? 0 : 450); + window.scrollTo(0,isPhone() ? 0 : 450); getDetails(); } },[id]) @@ -75,22 +75,22 @@ function NewsDetail(props){ return( { - IsPC() && + isPhone() && } -
+
{ detail &&
{ - IsPC() && zonedetail && + isPhone() && zonedetail && } { - !IsPC() && + !isPhone() && { zonedetail.sectionCmsTitle } { cmsDir && {cmsDir.name} } @@ -108,7 +108,7 @@ function NewsDetail(props){ { detail.auditStatus === '0' &&
  • }
    - { !IsPC() && } + { !isPhone() && } { content ? @@ -128,7 +128,7 @@ function NewsDetail(props){
    { - IsPC() && + isPhone() && } ) diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index bc381a14b..0f9449c7c 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -11,7 +11,7 @@ import Loading from "../../Loading"; import { getMainInfos , getCheckZoneRole, getCurrentRole } from './api'; import PublicBanner from "./Component/publicBanner"; import './index.scss'; -import { IsPC } from 'educoder'; +import { isPhone } from 'educoder'; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; import { tempEnum } from "./tempInfo"; @@ -93,7 +93,7 @@ function Index(props){ const [ temp , setTemp ] = useState(tempEnum.zone); const [ role , setRole ] = useState(undefined); const { pathname } = props.history.location; - const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && IsPC(); + const sourcedetail = pathname.indexOf(`/zone/${deptId}/newdetail/`)>-1 && isPhone(); const {current_user} = props; useEffect(()=>{ diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 3f0ae26db..0ad751e5c 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -11,7 +11,7 @@ import SupplyPhoneModal from '../../forge/Component/ProfileModal/SupplyPhone'; import SystemNotice from '../../forge/Component/NoticeModal/SystemNotice'; import cookie from 'react-cookies'; import NpsModal from '../modals/npsModal'; -import { IsPC } from 'educoder'; +import { isPhone } from 'educoder'; export function TPMIndexHOC(WrappedComponent) { return class II extends React.Component { @@ -287,7 +287,7 @@ export function TPMIndexHOC(WrappedComponent) { showNpsModal: this.showNpsModal }; let path =this.props.location.pathname; - let pathCheck = path.indexOf("/zone")>-1 && path.indexOf("/newdetail")>-1 && IsPC(); + let pathCheck = path.indexOf("/zone")>-1 && path.indexOf("/newdetail")>-1 && isPhone(); return (