许静 5 anni fa
parent
commit
30628ad48b
2 ha cambiato i file con 33 aggiunte e 25 eliminazioni
  1. 1
    2
      src/app.js
  2. 32
    23
      src/pages/shop/index.js

+ 1
- 2
src/app.js Vedi File

40
       }
40
       }
41
     },
41
     },
42
     pages: [
42
     pages: [
43
+      'pages/shop/index',
43
       'pages/activity/activity',
44
       'pages/activity/activity',
44
       'pages/activity/myActivity',
45
       'pages/activity/myActivity',
45
-      'pages/shop/index',
46
       'pages/project/index',
46
       'pages/project/index',
47
       'pages/person/index',
47
       'pages/person/index',
48
-
49
       'pages/person/profile/index',
48
       'pages/person/profile/index',
50
       'pages/project/detail/index',
49
       'pages/project/detail/index',
51
       'pages/activity/assemblePage',
50
       'pages/activity/assemblePage',

+ 32
- 23
src/pages/shop/index.js Vedi File

134
 
134
 
135
   handleClick(value) {
135
   handleClick(value) {
136
 
136
 
137
+    this.setState({
138
+      current: value
139
+    })
140
+
137
     const payload = {
141
     const payload = {
138
       pageNum: '1',
142
       pageNum: '1',
139
       pageSize: '9999',
143
       pageSize: '9999',
140
       buildingId: this.state.goodsBuilding[value].buildingId
144
       buildingId: this.state.goodsBuilding[value].buildingId
141
     }
145
     }
142
     getGoodsList(payload).then(res => {
146
     getGoodsList(payload).then(res => {
147
+      console.log(res.records, "22222222222222222222222222222222")
143
       this.setState({
148
       this.setState({
144
         goodsList: res.records || []
149
         goodsList: res.records || []
145
       })
150
       })
151
+      console.log(this.state.goodsList, "goodsList")
146
     })
152
     })
147
-    this.setState({
148
-      current: value
149
-    })
153
+
150
   }
154
   }
151
 
155
 
152
   onViewDetail(item) {
156
   onViewDetail(item) {
236
           </View>
240
           </View>
237
         }
241
         }
238
         {
242
         {
239
-          goodsBuilding && goodsBuilding.length > 2 &&
243
+          goodsBuilding && goodsBuilding.length >= 2 &&
240
           <AtTabs scroll tabDirection='horizontal' current={current} tabList={goodsBuilding} onClick={this.handleClick.bind(this)}>
244
           <AtTabs scroll tabDirection='horizontal' current={current} tabList={goodsBuilding} onClick={this.handleClick.bind(this)}>
241
-            <AtTabsPane current={current}  >
242
-              <View>
243
-                {
244
-                  goodsList.map(item => (
245
-                    <View className="item" key={item.goodsId} onClick={this.onViewDetail.bind(this, item)}>
246
-                      <Image className="item__img" src={item.imgUrl} />
247
-                      <View className="item__title">{item.goodsName}</View>
248
-                      <View className="item__des">
249
-                        <View>
250
-                          剩余数量{item.inventory}
251
-                        </View>
252
-                        <View >
253
-                          <Text className="item__jifen">{item.pointPrice}</Text>积分
245
+
246
+            {goodsBuilding.map((l_item, index) => (
247
+
248
+              <AtTabsPane current={current} index={index} >
249
+                <View>
250
+                  {
251
+                    goodsList.map(item => (
252
+                      <View className="item" key={item.goodsId} onClick={this.onViewDetail.bind(this, item)}>
253
+                        <Image className="item__img" src={item.imgUrl} />
254
+                        <View className="item__title">{item.goodsName}</View>
255
+                        <View className="item__des">
256
+                          <View>
257
+                            剩余数量{item.inventory}
258
+                          </View>
259
+                          <View >
260
+                            <Text className="item__jifen">{item.pointPrice}</Text>积分
254
                 </View>
261
                 </View>
255
-                      </View>
262
+                        </View>
256
 
263
 
257
-                    </View>
258
-                  ))
259
-                }
264
+                      </View>
265
+                    ))
266
+                  }
260
 
267
 
261
-              </View>
262
-            </AtTabsPane>
268
+                </View>
269
+              </AtTabsPane>
270
+            ))
271
+            }
263
           </AtTabs>
272
           </AtTabs>
264
         }
273
         }
265
       </View>
274
       </View>