fix🛠️: 进入页面请求两次的bug;部署脚本
This commit is contained in:
parent
293df6e0a1
commit
d2edaa57e9
|
@ -5,7 +5,8 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build && pwsh scripts/build.ps1",
|
"build": "tsc && vite build",
|
||||||
|
"deploy": "tsc && vite build && pwsh scripts/build.ps1",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
$server_path='fadinglight:/root/docker/caddy/site/www'
|
$server_path='fadinglight:/root/docker/caddy/site/www'
|
||||||
|
|
||||||
|
ssh fadinglight "rm ${server_path}/* -r"
|
||||||
|
|
||||||
scp -r dist/* $server_path
|
scp -r dist/* $server_path
|
|
@ -1,6 +1,5 @@
|
||||||
import Layout from './components/layout'
|
import Layout from './components/layout'
|
||||||
import { Routes, Route } from 'react-router-dom'
|
import { Routes, Route } from 'react-router-dom'
|
||||||
import {useEffect} from "react";
|
|
||||||
import Home from './pages/Home/Home'
|
import Home from './pages/Home/Home'
|
||||||
import NotFound from './pages/NotFound'
|
import NotFound from './pages/NotFound'
|
||||||
import { Bill, BillContext } from "./store";
|
import { Bill, BillContext } from "./store";
|
||||||
|
@ -9,13 +8,6 @@ import Record from "./pages/Record/Record";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const billStore = new Bill()
|
const billStore = new Bill()
|
||||||
const now = new Date()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
billStore.fetch(now.getFullYear(), now.getMonth() + 1)
|
|
||||||
.then()
|
|
||||||
.catch(console.dir)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
|
|
|
@ -6,13 +6,7 @@ import { useContext, useEffect, useState } from "react";
|
||||||
import { BillContext } from "../../store";
|
import { BillContext } from "../../store";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import Pie from "../../components/charts/pie";
|
import Pie from "../../components/charts/pie";
|
||||||
import {
|
import { Card, Modal, DatePicker, Radio, Space } from "antd";
|
||||||
Card,
|
|
||||||
Modal,
|
|
||||||
DatePicker,
|
|
||||||
Radio,
|
|
||||||
Space,
|
|
||||||
} from "antd";
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import 'moment/locale/zh-cn';
|
import 'moment/locale/zh-cn';
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
|
@ -28,6 +28,9 @@ function Record() {
|
||||||
if (!!clsRef.current) clsRef.current.focus()
|
if (!!clsRef.current) clsRef.current.focus()
|
||||||
}, [clsRef])
|
}, [clsRef])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
billStore.fetchLabels().then()
|
||||||
|
}, [])
|
||||||
|
|
||||||
// table
|
// table
|
||||||
const columns = [
|
const columns = [
|
||||||
|
|
|
@ -16,7 +16,6 @@ export class Bill {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
makeAutoObservable(this)
|
makeAutoObservable(this)
|
||||||
this.fetchLabels().then()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get bills() {
|
get bills() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api/": {
|
"/api/": {
|
||||||
target: "https://www.fadinglight.cn/api/",
|
target: "https://bill.fadinglight.cn/api/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user