@@ -29,7 +29,7 @@ const getMyFundDetails = async () => {
2929 return ;
3030 }
3131 let lastTime = fundValuationDetail . Expansion . GZTIME ;
32- let nowJJJZ = Number ( fundValuationDetail . Expansion . GZ ) ;
32+ let nowJJJZ = Number ( fundValuationDetail . Expansion . GZ || '0' ) ;
3333 let isValuation = true ;
3434 const searchFundResult = await get < ISearchFundResult > ( `http://fundsuggest.eastmoney.com/FundSearch/api/FundSearchAPI.ashx?m=1&key=${ oldData . id } ` ) ;
3535 if ( searchFundResult . ErrCode !== 0 ) {
@@ -43,14 +43,14 @@ const getMyFundDetails = async () => {
4343 if ( lastTime . includes ( searchFundDetail . FundBaseInfo . FSRQ ) ) {
4444 // console.log(`净值:`, searchFundDetail.FundBaseInfo);
4545 lastTime = searchFundDetail . FundBaseInfo . FSRQ ;
46- nowJJJZ = Number ( searchFundDetail . FundBaseInfo . DWJZ ) ;
46+ nowJJJZ = Number ( searchFundDetail . FundBaseInfo . DWJZ || '0' ) ;
4747 isValuation = false ;
4848 }
4949 }
5050 db . data = {
5151 ...oldData ,
52- yesJJJZ : Number ( fundValuationDetail . Expansion . DWJZ ) ,
53- nowJJJZ : Number ( nowJJJZ ) ,
52+ yesJJJZ : Number ( fundValuationDetail . Expansion . DWJZ || '0' ) ,
53+ nowJJJZ : Number ( nowJJJZ || '0' ) ,
5454 lastTime,
5555 isValuation,
5656 } ;
@@ -70,7 +70,7 @@ const fundDetailsToCbList = (dbList: DBItem<IFundEnt>[], searchWord = '') => {
7070 let sumIncome = 0 ;
7171 let cbList = dbList . map ( db => {
7272 const fund = db . data ;
73- const rate = fund . nowJJJZ / fund . yesJJJZ - 1 ;
73+ const rate = fund . yesJJJZ === 0 ? 0 : fund . nowJJJZ / fund . yesJJJZ - 1 ;
7474 const income = fund . holdCount > 0 ? rate * fund . holdCount * fund . yesJJJZ : 0 ;
7575 sumIncome += Math . round ( income * 100 ) / 100 ;
7676 const cb : CallbackListItem = {
@@ -190,9 +190,15 @@ const unregisterShortCut = async () => {
190190 // Mousetrap.unbind(['up', 'down', 'mod+del', 'mod+ins']);
191191} ;
192192const showFundDetail = async ( fundEnt : Partial < IFundEnt > ) => {
193- const fundCode = fundEnt . id ;
194- const fundName = fundEnt . name ;
195- const url = `/assets/html/fundDetail/fundDetail.html?fundCode=${ fundCode } &fundName=${ encodeURIComponent ( fundName ) } ` ;
193+ const dbList = FundDBHelper . getAll ( ) ;
194+ const fundList = dbList . map ( db => {
195+ return {
196+ fundcode : db . data . id ,
197+ name : db . data . name ,
198+ } ;
199+ } ) ;
200+ const fundIndex = fundList . findIndex ( x => x . fundcode === fundEnt . id ) ;
201+ const url = `/assets/html/fundDetail/fundDetail.html?fundList=${ encodeURIComponent ( JSON . stringify ( fundList ) ) } &fundIndex=${ fundIndex } ` ;
196202 // const title = `${fundName}(${fundCode})`;
197203 const fundDetailUbWindow = utools . createBrowserWindow (
198204 url ,
0 commit comments