feat🔫: 修改部署脚本
This commit is contained in:
parent
1d928b8a23
commit
293df6e0a1
|
@ -1,8 +1,3 @@
|
||||||
docker build . -t registry.cn-hangzhou.aliyuncs.com/fadinglight/bill-react:dev
|
$server_path='fadinglight:/root/docker/caddy/site/www'
|
||||||
|
|
||||||
docker push registry.cn-hangzhou.aliyuncs.com/fadinglight/bill-react:dev
|
scp -r dist/* $server_path
|
||||||
|
|
||||||
ssh fadinglight "cd /root/docker/bill-sys/;
|
|
||||||
docker compose down;
|
|
||||||
docker pull registry.cn-hangzhou.aliyuncs.com/fadinglight/bill-react:dev;
|
|
||||||
docker compose up -d"
|
|
|
@ -11,7 +11,7 @@ export async function getLabels() {
|
||||||
return data.data
|
return data.data
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createBill(bill: IBill) {
|
export async function postBills(bills: Array<IBill>) {
|
||||||
const data = await request.post(`/bill/`, bill)
|
const data = await request.post(`/bill/`, bills)
|
||||||
return data.data
|
return data.data
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ import { BillContext } from "../../store";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import styles from "./Record.module.scss"
|
import styles from "./Record.module.scss"
|
||||||
import { BaseSelectRef } from "rc-select/lib/BaseSelect";
|
import { BaseSelectRef } from "rc-select/lib/BaseSelect";
|
||||||
import { createBill } from "../../api/bills";
|
import { postBills } from "../../api/bills";
|
||||||
|
|
||||||
|
|
||||||
function Record() {
|
function Record() {
|
||||||
|
@ -117,16 +117,12 @@ function Record() {
|
||||||
const [uploadLoading, setUploadLoading] = useState(false)
|
const [uploadLoading, setUploadLoading] = useState(false)
|
||||||
const upload = async () => {
|
const upload = async () => {
|
||||||
setUploadLoading(true)
|
setUploadLoading(true)
|
||||||
const failures = []
|
datasource.forEach( it => Reflect.deleteProperty(it, "key"))
|
||||||
for (let bill of datasource) {
|
try {
|
||||||
try {
|
await postBills(datasource)
|
||||||
const { id } = await createBill(bill)
|
setDataSource([])
|
||||||
if (!id) failures.push(bill)
|
} catch (err) {
|
||||||
} catch (e) {
|
|
||||||
failures.push(bill)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setDataSource(failures)
|
|
||||||
setUploadLoading(false)
|
setUploadLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { makeAutoObservable, runInAction } from "mobx";
|
import { makeAutoObservable, runInAction } from "mobx";
|
||||||
import { createContext } from "react";
|
import { createContext } from "react";
|
||||||
import { createBill, getBills, getLabels } from "../api/bills";
|
import { postBills, getBills, getLabels } from "../api/bills";
|
||||||
import { BillType, IBill } from "../model";
|
import { BillType, IBill } from "../model";
|
||||||
import * as R from "ramda"
|
import * as R from "ramda"
|
||||||
import { BillLabel } from "./types";
|
import { BillLabel } from "./types";
|
||||||
|
@ -110,7 +110,7 @@ export class Bill {
|
||||||
|
|
||||||
|
|
||||||
async add(bill: IBill) {
|
async add(bill: IBill) {
|
||||||
const { id } = await createBill(bill)
|
const { id } = await postBills([bill])
|
||||||
bill.id = id
|
bill.id = id
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this._bills.push(bill);
|
this._bills.push(bill);
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api/": {
|
"/api/": {
|
||||||
target: "http://localhost:8080/api/v1/",
|
target: "https://www.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