Просмотр исходного кода

[通信][修复]:切换为异步模式

tags/jenkins-front-end-screenad-143-v92^0
hupeng 6 лет назад
Родитель
Сommit
7f690c9406
2 измененных файлов: 14 добавлений и 7 удалений
  1. +7
    -6
      App.js
  2. +7
    -1
      HttpUtils.js

+ 7
- 6
App.js Просмотреть файл

@@ -307,17 +307,17 @@ componentDidMount() {
})
}

async routine() {
routine() {
hbRequestCount -=1;
getAdDataCount -=1;
pageChangeCount -=1;

try {
if (getAdDataCount<=0) {
await this.getAdDataList(false)
this.getAdDataList(false)
getAdDataCount = heartConfig.dataRefreshInterval
} else if (hbRequestCount<=0) {
await this.hbRequest()
this.hbRequest()
hbRequestCount = heartConfig.heartbeatInterval
}

@@ -328,8 +328,8 @@ async routine() {
this.setState({ contentDisplayStatus: true})
}
} else {
await this.getBaseInfo()
await this.getAdDataList(true)
this.getBaseInfo()
this.getAdDataList(true)
}
pageChangeCount = heartConfig.pageChangeInterval
}
@@ -423,7 +423,8 @@ getContentViewItem(contentItem, annomation) {
</View>
</View>
</View>
<Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} />
{/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
<Image source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode} />
</View>
{/* 优惠券底部商户名称 */}
<View style={styles.contentItemBottom}>


+ 7
- 1
HttpUtils.js Просмотреть файл

@@ -8,7 +8,13 @@ export default class HttpUtil {
*/
static get(url) {
request = new Promise((resolve, reject) => {
fetch(url)
fetch(url, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(result => resolve(result))
}).catch(e => reject(e.message));


Загрузка…
Отмена
Сохранить