提交 6aa329a0 作者: 18928357778

Merge branch 'master' of ssh://git.mmcuav.cn:8222/root/sharefly-web-nextjs into caoyun

......@@ -10,12 +10,7 @@ import config from './config';
*/
export default function request(url: string, method: String = 'get', data?: any, options: any & { hideError?: boolean, headers?: { token?: string } } = {}): Promise<Response<any>> {
let token = localStorage.getItem('token') || '';
options = {
headers: {
token
},
...options,
}
switch (method.toLowerCase()) {
case 'get':
let params = new URLSearchParams();
......@@ -32,7 +27,7 @@ export default function request(url: string, method: String = 'get', data?: any,
options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
...options,
......@@ -40,9 +35,17 @@ export default function request(url: string, method: String = 'get', data?: any,
break;
}
if(options.headers){
options.headers.token = token;
}else{
options.headers = {
token
}
}
function errMsg(msg: string) {
if (!options.hideError) {
errMsg(msg);
window.messageApi.error(msg);
}
}
......
......@@ -3,6 +3,18 @@
"plugins": [
[
"styled-components",{ "ssr":true }
],
[
"styled-components-px2rem",
{
"rootValue": 1,
"unitPrecision": 5,
"propList": ["*"],
"selectorBlackList": [], //排除html样式
"replace": true,
"mediaQuery": false,
"minPixelValue": 0
}
]
]
}
\ No newline at end of file
.content{
min-height: 120px;
line-height: 1;
width: 1200px;
position: relative;
margin: 0 auto;
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { Layout, Space } from "antd";
import NavHeader from "~/components/NavHeader";
import FooterView from "~/components/footer";
import {useRouter} from 'next/router'
import styles from './index.module.scss';
const { Header, Footer, Content } = Layout;
//底部栏固定定位
......@@ -60,7 +61,7 @@ export default function LayoutView(props: Props) {
<Header style={headerStyle}>
<NavHeader />
</Header>
<Content style={contentStyle}>{props.children}</Content>
<Content className={styles.content}>{props.children}</Content>
{!props.hideFooter && (
<Footer style={ includesPage.includes(router.pathname) ? {...footerStyle,...homeStyle} : footerStyle}>
<FooterView></FooterView>
......
......@@ -2,6 +2,7 @@ import React, { useContext, useEffect, useState } from "react";
import { Modal, Image } from "antd";
import api from "~/api";
import { UserContext } from "~/lib/userProvider";
import errImg from "~/assets/errImg";
type Props = {
open: boolean;
......@@ -27,6 +28,7 @@ export default function LoginModal(props: Props) {
});
} */
if (!props.open) {
setQrCode("");
return;
}
......@@ -38,6 +40,8 @@ export default function LoginModal(props: Props) {
.then((res) => {
if (res.code == "200") {
setQrCode("data:image/png;base64," + res.result || "");
} else {
window.messageApi.error("获取登录二维码失败");
}
});
}, [props.open]);
......@@ -97,7 +101,12 @@ export default function LoginModal(props: Props) {
欢迎来到云享飞
</div>
<div id="login_container" style={{ margin: "auto", display: "table" }}>
<Image src={qrCode} width={150} height={150}></Image>
<Image
src={qrCode}
width={150}
height={150}
fallback={errImg}
></Image>
</div>
<div
style={{
......
......@@ -34,12 +34,14 @@
"@hapi/iron": "^7.0.1",
"@types/styled-components": "^5.1.26",
"babel-plugin-styled-components": "^2.1.1",
"babel-plugin-styled-components-px2rem": "^1.5.5",
"cookie": "^0.5.0",
"moment": "^2.29.4",
"next-connect": "^1.0.0",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"pinyin-pro": "^3.14.0",
"postcss-pxtorem": "^6.0.0",
"react-infinite-scroll-component": "^6.1.0",
"styled-components": "^6.0.0-rc.1",
"swiper": "^9.3.2",
......
import '../public/antd.min.css';
import '../styles/index.scss';
import type { AppProps } from 'next/app';
import withTheme from '../theme';
import { message } from 'antd';
import { useEffect } from 'react';
import "../public/antd.min.css";
import "../styles/index.scss";
import type { AppProps } from "next/app";
import withTheme from "../theme";
import { message } from "antd";
import { useEffect } from "react";
import Head from "next/head";
import Script from 'next/script';
import Script from "next/script";
import UserProvider, { UserContext } from "~/lib/userProvider";
export default function App({ Component, pageProps }: AppProps) {
......@@ -13,14 +13,18 @@ export default function App({ Component, pageProps }: AppProps) {
useEffect(() => {
//全局消息提示
window.messageApi = messageApi;
}, [])
//@ts-ignore
window.onresize = function(){
window.document.querySelector('html')!.style.fontSize = (window.innerWidth / 1920) + 'PX';
}
}, []);
return withTheme(
<>
<Head>
<meta
name="viewport"
content="width=device-width,initial-scale=1"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
></meta>
</Head>
<Script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></Script>
......
......@@ -24,7 +24,7 @@ export default class MyDocument extends Document {
render() {
return (
<Html lang='en'>
<Html lang='en' style={{fontSize: 1}}>
<Head />
<body>
<Main />
......
......@@ -13,7 +13,6 @@
.title {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #3c3e42;
width: 649px;
@include ellipsis(1);
......
......@@ -12,15 +12,14 @@
.info {
.title {
font-size: 16px;
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #3c3e42;
width: 649px;
@include ellipsis(1);
}
.desc {
font-size: 16px;
font-size: 14px;
font-family: MicrosoftYaHei;
color: #ff552d;
margin-top: 9px;
......
......@@ -22,9 +22,8 @@ export interface Params {
provinceCode?: number; //省编码
}
const items = (params:any) => ["项目需求", "招投标项目", "业务案例", "行业新闻"].map(
(value) => {
const items = (params: any) =>
["项目需求", "招投标项目", "业务案例", "行业新闻"].map((value) => {
let children: JSX.Element | string = <></>;
switch (value) {
......@@ -49,14 +48,14 @@ const items = (params:any) => ["项目需求", "招投标项目", "业务案例"
key: value,
children: children,
};
}
);
});
export default function ProjectInfo() {
const [region, setRegion] = useState<Array<RegionResp>>([]);
const [params, setParams] = useState<Params | null>({});
useEffect(() => {
window!.document!.querySelector('body')!.style.background = '#fff';
commonApi.region().then((res) => {
let temp = res.result || [];
let temp1: Array<RegionResp> = [];
......@@ -77,15 +76,15 @@ export default function ProjectInfo() {
console.log(value);
let params1: Params = {
provinceCode: undefined,
districtCode: undefined
districtCode: undefined,
};
list?.forEach(item => {
if(item.level == 1){
list?.forEach((item) => {
if (item.level == 1) {
params1.provinceCode = item.id;
} else if(item.level == 2){
} else if (item.level == 2) {
params1.districtCode = item.id;
}
})
});
setParams({
...params,
...params1,
......
module.exports = {
plugins: {
"postcss-pxtorem": {
rootValue: 1,
unitPrecision: 5,
propList: ["*"],
selectorBlackList: [], //排除html样式
replace: true,
mediaQuery: false,
minPixelValue: 0,
},
},
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论