Commit b4616c45 authored by GuanHua's avatar GuanHua

feat: 移动端资讯页面

parent 12ee430b
.detailContainer {
padding: 24px 12px;
padding-top: 64px;
}
.title {
......@@ -31,7 +32,40 @@
.informationContent {
img, video {
img,
video {
width: 100%;
}
}
.downloadCard {
position: fixed;
display: flex;
top: 0;
left: 0;
width: 100%;
padding: 8px 16px;
border-bottom: 1px solid #F4F5F7;
align-items: center;
background-color: #FFF;
.downloadAppIcon {
overflow: hidden;
border-radius: 8px;
}
.downloadAppName {
font-size: 14px;
margin-left: 12px;
}
.downloadBtn {
margin-left: auto;
background: #00B37A;
padding: 4px 12px;
font-size: 12px;
border-radius: 12px;
color: #FFF;
}
}
......@@ -3,8 +3,10 @@ import { Helmet } from 'umi'
import moment from 'moment'
import { PublicApi } from '@/services/api'
// import { RouteChildrenProps, RouteProps } from 'react-router'
import ImageBox from '@/components/ImageBox'
import { GetManageContentInformationFindByIdResponse } from '@/services/PassApi'
import { numFormat } from '@/utils/numberFomat'
import { GlobalConfig } from '@/global/config'
import styles from './mobileDetail.less'
const MobileDetail = (props) => {
......@@ -12,6 +14,10 @@ const MobileDetail = (props) => {
const [newsDetail, setNewsDetail] = useState<GetManageContentInformationFindByIdResponse>()
const [title, setTitle] = useState<string>('资讯详情')
const shopInfo = GlobalConfig.web.shopInfo.filter((item) => item.type === 1 && item.environment === 4)
const appInfo: any = shopInfo ? shopInfo[0] : {}
const fetchNewsDetail = () => {
const param = {
id
......@@ -30,12 +36,67 @@ const MobileDetail = (props) => {
}
}, [])
// const judgeExistApp = () => {
// if (navigator.userAgent.match(/android/i)) {
// // alert('android')
// // 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为
// // 否则打开a标签的href链接
// let isInstalled;
// //下面是安卓端APP接口调用的地址,自己根据情况去修改
// // const ifrSrc = 'mqq://';
// const ifrSrc = 'com.baidu.tieba://';
// const ifr = document.createElement('iframe');
// ifr.src = ifrSrc;
// ifr.style.display = 'none';
// document.body.appendChild(ifr);
// setTimeout(function() {
// document.body.removeChild(ifr);
// window.location.href = "https://www.baidu.com"
// }, 1000);
// }
// //ios判断
// if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
// //Animation://com.yz.animation
// let isInstalled;
// //var gz = '{"comName":"${com.short_name}","comID":"${com.id}","comPhoneNum":"${com.phone_num}","type":"0"}';
// //var jsongz =JSON.parse(gz);
// //下面是IOS调用的地址,自己根据情况去修改
// const ifrSrc = 'weixin://';
// const ifr = document.createElement( 'iframe' );
// ifr.src = ifrSrc;
// ifr.style.display = 'none' ;
// ifr.onload = function() {
// // alert('Is installed.');
// isInstalled = true ;
// alert(isInstalled);
// document.getElementById( 'openApp1' ).click();
// };
// ifr.onerror = function() {
// // alert('May be not installed.');
// isInstalled = false ;
// alert(isInstalled);
// }
// document.body.appendChild(ifr);
// setTimeout(function() {
// document.body.removeChild(ifr);
// }, 1000 );
// }
// }
return (
<>
<Helmet>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title>{title}</title>
</Helmet>
{/* <div className={styles.downloadCard}>
<ImageBox width={40} height={40} className={styles.downloadAppIcon} imgUrl={appInfo.logoUrl} />
<span className={styles.downloadAppName}>{appInfo.name}</span>
<div className={styles.downloadBtn} onClick={() => judgeExistApp()}>打开</div>
</div> */}
{
newsDetail && (
<div className={styles.detailContainer}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment