diff --git a/.gitignore b/.gitignore index 021a767..d0f2094 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,5 @@ dist .idea/ data/*.db -build/*.exe \ No newline at end of file +build/*.exe +/build/bin/go-stock-dev.exe diff --git a/build/bin/go-stock.exe b/build/bin/go-stock.exe index e7d41e7..df1c294 100644 Binary files a/build/bin/go-stock.exe and b/build/bin/go-stock.exe differ diff --git a/frontend/src/components/stock.vue b/frontend/src/components/stock.vue index 5883f91..9948bcf 100644 --- a/frontend/src/components/stock.vue +++ b/frontend/src/components/stock.vue @@ -12,18 +12,14 @@ const ticker=ref({}) const stockList=ref([]) const followList=ref([]) const options=ref([]) - +const modalShow = ref(false) const formModel = ref({ + name: "", + code: "", costPrice: 0.000, volume: 0 }) -const form = h(NForm, { labelPlacement: 'left',model: formModel}, [ - h(NFormItem, { label: '成本(元)',path:"costPrice" }, [h(NInputNumber, {path:"costPrice", onUpdateValue: updateCostPrice, clearable: true,precision:3, placeholder: '买入成本价(元)', })]), - h(NFormItem, { label: '数量(股)',path:"volume" }, [h(NInputNumber, {path:"volume",onUpdateValue: updateVolume, clearable: true,precision:0, placeholder: '买入股数,1手=100股', })]), -]); - - const data = reactive({ name: "", code: "", @@ -160,55 +156,21 @@ function search(code,name){ window.open("https://xueqiu.com/S/"+code) }, 500) } -function updateCostPrice(v) { - console.log(formModel.value.costPrice) - formModel.value.costPrice=v - console.log(formModel.value.costPrice) - -} - -function updateVolume(v) { - console.log(formModel.value.volume) - formModel.value.volume=v - console.log(formModel.value.volume) -} - function setStock(code,name){ - - let res=followList.value.filter(item => item.StockCode===code) - console.log("res:",res) - formModel.value.volume=res[0].Volume - formModel.value.costPrice=res[0].CostPrice - - const m = modal.create({ - title: name, - preset: 'card', - style: { - width: '400px' - }, - content: () => form, - footer: () => - h(NFlex, { justify: 'center' },[ - h( - NButton, - {size:'small', type: 'primary', onClick: () =>updateCostPriceAndVolume(m,code,formModel.value.costPrice,formModel.value.volume) }, - () => '保存' - ), - h( - NButton, - { size:'small', type: 'warning', onClick: () => m.destroy() }, - () => '关闭' - ), - ]) - - - }) + let res=followList.value.filter(item => item.StockCode===code) + console.log("res:",res) + formModel.value.name=name + formModel.value.code=code + formModel.value.volume=res[0].Volume + formModel.value.costPrice=res[0].CostPrice + modalShow.value=true } -function updateCostPriceAndVolume(m,code,price,volume){ + +function updateCostPriceAndVolumeNew(code,price,volume){ console.log(code,price,volume) SetCostPriceAndVolume(code,price,volume).then(result => { + modalShow.value=false message.success(result) - m.destroy() GetFollowList().then(result => { followList.value = result for (const followedStock of result) { @@ -267,6 +229,20 @@ function updateCostPriceAndVolume(m,code,price,volume){ placeholder="股票名称或者代码" clearable class="input" @input="getStockList" :on-select="onSelect"/> 添加 + + + + + + + + + + + +