feat🔫: 修改部署脚本

This commit is contained in:
车厘子 2022-11-30 23:45:42 +08:00
parent 1d928b8a23
commit 293df6e0a1
5 changed files with 13 additions and 22 deletions

View File

@ -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"

View File

@ -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
} }

View File

@ -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 {
const { id } = await createBill(bill) await postBills(datasource)
if (!id) failures.push(bill) setDataSource([])
} catch (e) { } catch (err) {
failures.push(bill)
} }
}
setDataSource(failures)
setUploadLoading(false) setUploadLoading(false)
} }

View File

@ -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);

View File

@ -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/, ""),
} }