fix: template

This commit is contained in:
archer
2023-06-20 10:40:49 +08:00
parent a02a528737
commit 3166376173
6 changed files with 12 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
# 运行端口,如果不是 3000 口运行,需要改成其他的。注意:不是改了这个变量就会变成其他端口,而是因为改成其他端口,才用这个变量。
DB_MAX_LINK=15 # database max link
PORT=3000
# database max link
DB_MAX_LINK=15
# 代理
# AXIOS_PROXY_HOST=127.0.0.1
# AXIOS_PROXY_PORT=7890

View File

@@ -31,7 +31,7 @@ const queryClient = new QueryClient({
function App({ Component, pageProps }: AppProps) {
const {
loadInitData,
initData: { googleVerKey }
initData: { googleVerKey, baiduTongji }
} = useGlobalStore();
useEffect(() => {
@@ -52,7 +52,7 @@ function App({ Component, pageProps }: AppProps) {
<Script src="/js/qrcode.min.js" strategy="afterInteractive"></Script>
<Script src="/js/pdf.js" strategy="afterInteractive"></Script>
<Script src="/js/html2pdf.bundle.min.js" strategy="afterInteractive"></Script>
<Script src="/js/baidutongji.js" strategy="afterInteractive"></Script>
{baiduTongji && <Script src="/js/baidutongji.js" strategy="afterInteractive"></Script>}
{googleVerKey && (
<>
<Script

View File

@@ -5,13 +5,15 @@ import { jsonRes } from '@/service/response';
export type InitDateResponse = {
beianText: string;
googleVerKey: string;
baiduTongji: boolean;
};
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
jsonRes<InitDateResponse>(res, {
data: {
beianText: process.env.SAFE_BEIAN_TEXT || '',
googleVerKey: process.env.CLIENT_GOOGLE_VER_TOKEN || ''
googleVerKey: process.env.CLIENT_GOOGLE_VER_TOKEN || '',
baiduTongji: process.env.BAIDU_TONGJI === '1'
}
});
}

View File

@@ -19,7 +19,8 @@ export const useGlobalStore = create<State>()(
immer((set, get) => ({
initData: {
beianText: '',
googleVerKey: ''
googleVerKey: '',
baiduTongji: false
},
async loadInitData() {
try {