|
|
@@ -1,6 +1,6 @@
|
|
|
//index.js
|
|
|
//获取应用实例
|
|
|
-import { getRequirementsApi, } from "../../service/hwRequirement";
|
|
|
+import { getRequirementsImpl, } from "../../service/impl/hwRequirement.impl";
|
|
|
import { bannerApi } from "../../service/hwUser";
|
|
|
const app = getApp()
|
|
|
let cover_animation: any = {}
|
|
|
@@ -282,14 +282,12 @@ Page({
|
|
|
*/
|
|
|
getList(pageNo?: number, province_code?: number, city_code?: number, country_code?: number, trade_type?: number, priceType?: number) {
|
|
|
let _pageNo: number = pageNo || this.data.pageNo
|
|
|
+ let platform_id = 1
|
|
|
+ const userInfo = wx.getStorageSync('userInfo')
|
|
|
+ if (userInfo) {
|
|
|
+ platform_id = userInfo.platformId
|
|
|
+ }
|
|
|
const param = Object.assign({
|
|
|
- pageNo: _pageNo,
|
|
|
- province_code: this.data.province_id,
|
|
|
- city_code: this.data.city_id,
|
|
|
- country_code: this.data.area_id,
|
|
|
- trade_type: this.data.industry_id,
|
|
|
- priceType: this.data.price_id
|
|
|
- }, {
|
|
|
pageNo,
|
|
|
pageSize: 10,
|
|
|
province_code,
|
|
|
@@ -297,9 +295,18 @@ Page({
|
|
|
country_code,
|
|
|
trade_type,
|
|
|
priceType,
|
|
|
- platform_id: app.globalData.platformId
|
|
|
+ platform_id
|
|
|
+ }, {
|
|
|
+ pageNo: _pageNo,
|
|
|
+ province_code: this.data.province_id,
|
|
|
+ city_code: this.data.city_id,
|
|
|
+ country_code: this.data.area_id,
|
|
|
+ trade_type: this.data.industry_id,
|
|
|
+ priceType: this.data.price_id
|
|
|
})
|
|
|
- getRequirementsApi(param).then(res => {
|
|
|
+ getRequirementsImpl(param).then(res => {
|
|
|
+ console.log('res=>', res);
|
|
|
+
|
|
|
if (typeof res === 'string') {
|
|
|
// 如果没有网络 展示网络故障界面
|
|
|
if (res === 'offline' && this.data.list.length === 0) {
|
|
|
@@ -310,27 +317,31 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- const data = <responseOptionsType>res
|
|
|
- if (data.errcode === 0) {
|
|
|
- if (pageNo === 1 && data.data.requirements.length === 0) {
|
|
|
- // this.doAnimation(false);
|
|
|
+ if (<responseOptionsType>res) {
|
|
|
+ const data = <responseOptionsType>res
|
|
|
+ if (data.errCode === 0) {
|
|
|
+
|
|
|
+
|
|
|
+ if (_pageNo === 1 && data.data.requirements.length === 0) {
|
|
|
+ // this.doAnimation(false);
|
|
|
+ this.setData({
|
|
|
+ loading: false,
|
|
|
+ list_length: true,
|
|
|
+ offline: false
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 在成功后页数加一方便日后调用
|
|
|
+ _pageNo++;
|
|
|
this.setData({
|
|
|
- loading: false,
|
|
|
- list_length: true,
|
|
|
- offline: false
|
|
|
+ pageNo: _pageNo,
|
|
|
+ [`list[${_pageNo - 2}]`]: data.data.requirements,
|
|
|
+ isLast: data.data.isLast,
|
|
|
+ offline: false,
|
|
|
+ list_length: false,
|
|
|
+ loading: false
|
|
|
})
|
|
|
- return
|
|
|
}
|
|
|
- // 在成功后页数加一方便日后调用
|
|
|
- _pageNo++;
|
|
|
- this.setData({
|
|
|
- pageNo: _pageNo,
|
|
|
- [`list[${_pageNo - 2}]`]: data.data.requirements,
|
|
|
- isLast: data.data.isLast,
|
|
|
- offline: false,
|
|
|
- list_length: false,
|
|
|
- loading: false
|
|
|
- })
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
this.setData({
|
|
|
@@ -346,7 +357,7 @@ Page({
|
|
|
getBanner() {
|
|
|
bannerApi().then(res => {
|
|
|
const data = <responseOptionsType>res
|
|
|
- if (data.errcode === 0) {
|
|
|
+ if (data.errCode === 0) {
|
|
|
this.setData({
|
|
|
swiper: data.data.bannerList
|
|
|
})
|