@@ -42,7 +42,7 @@ const JOKE_ITEM_WIDTH = SCREEN_WIDTH - px2dp(40);
4242const JOKE_FONT_SIZE = FONT_SIZE ( 17 ) ;
4343
4444class BuDeJieMobx extends ConfigStore {
45- static async handleJokeTextWidth ( text ) {
45+ static async handleJokeTextWidth ( text : string ) {
4646 const heights = await MeasureText . heights ( {
4747 texts : [ text ] ,
4848 width : JOKE_ITEM_WIDTH ,
@@ -52,9 +52,7 @@ class BuDeJieMobx extends ConfigStore {
5252 return parseFloat ( heights . join ( ) ) ;
5353 }
5454
55- static async handleLargeListData ( parameters ) {
56- const { data, type } = parameters ;
57-
55+ static async handleLargeListData ( data : Array < RTBDJList > , type : any ) {
5856 const containerHeight =
5957 SCREEN_HEIGHT -
6058 DEFAULT_TAB_BAR_HEIGHT -
@@ -63,7 +61,7 @@ class BuDeJieMobx extends ConfigStore {
6361 DEFAULT_SCROLL_TOP_BAR_HEIGHT -
6462 DEFAULT_SPACE_HEIGHT ;
6563
66- const dataSource : Array = [ ] ;
64+ const dataSource : Array < any > = [];
6765
6866 const largeListData = { items : [ ] } ;
6967 const _containerHeight = containerHeight;
@@ -85,8 +83,7 @@ class BuDeJieMobx extends ConfigStore {
8583 item . isLongPictureCanOpened = ! ( height > _containerHeight && height > MAX_SCREEN_IMAGE_HEIGHT && ! isGif ) ;
8684
8785 const JokeHeight = await BuDeJieMobx . handleJokeTextWidth ( item . text ) ;
88- const ImageHeight = item . imageHeight ;
89- // const ImageHeight = 0;
86+ const ImageHeight = item ?. imageHeight ? item . imageHeight : 0 ;
9087 item . itemHeight = USER_INFO_HEIGHT + JokeHeight + ImageHeight + ITEM_HEIGHT_SPACE_HEIGHT ;
9188
9289 const {
@@ -106,7 +103,8 @@ class BuDeJieMobx extends ConfigStore {
106103 theme_name,
107104 is_gif,
108105 gifFistFrame,
109- imageHeight
106+ imageHeight,
107+ itemHeight
110108 } = item ;
111109
112110 const userInfoData = { profile_image, name, passtime, theme_name, type } ;
@@ -124,7 +122,8 @@ class BuDeJieMobx extends ConfigStore {
124122 is_gif,
125123 type,
126124 gifFistFrame,
127- ...item
125+ itemHeight,
126+ ...jokeData
128127 } ;
129128
130129 item . userInfoData = userInfoData ;
@@ -146,12 +145,7 @@ class BuDeJieMobx extends ConfigStore {
146145 @observable
147146 maxtime : string = '' ;
148147 @observable
149- largeListData : Array = [ { items : [ ] } ] ;
150-
151- constructor ( type ) {
152- super ( ) ;
153- console . log ( 'type------' , type ) ;
154- }
148+ largeListData : Array < any > = [ { items : [ ] } ] ;
155149
156150 /**
157151 * imageHeight: 所有Item中,Image的高度
@@ -165,10 +159,7 @@ class BuDeJieMobx extends ConfigStore {
165159 try {
166160 const buDeJieData : RTBDJResult = await loadBuDeJieData ( type , value ) ;
167161
168- const { largeListData, dataSource } = await BuDeJieMobx . handleLargeListData ( {
169- data : buDeJieData . list ,
170- type : type
171- } ) ;
162+ const { largeListData, dataSource } = await BuDeJieMobx . handleLargeListData ( buDeJieData . list , type ) ;
172163
173164 console . log ( 'largeListData' , largeListData ) ;
174165
@@ -190,12 +181,10 @@ class BuDeJieMobx extends ConfigStore {
190181 }
191182
192183 console . log ( 'this.largeListData.slice' , this . largeListData . slice ( ) ) ;
193-
194184 } catch ( e ) {
195185 this . showErrorView ( e ) ;
196186 }
197187 }
198-
199188}
200189
201190export { BuDeJieMobx } ;
0 commit comments