Commit 69aa9f54f0213449942540013e7d982c264f7b11

Authored by wangfan
1 parent 3c9ae71d

快速预定

... ... @@ -47,7 +47,11 @@
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular">提前点餐</view>
<view class="share-but Regular flex-cc" wx:if="{{!detail.orderid}}">
<view>查看菜品</view>
<image class="order-cook" src="http://qn.colorcun.com/custom/lite-yd-cook/image/order-cook.png"></image>
</view>
<view class="share-but Regular" wx:else="">提前点餐</view>
</userinfo>
</view>
<view style="height: 40rpx;"></view>
... ...
... ... @@ -120,4 +120,9 @@
.more{
width: 14rpx;
height: 26rpx;
}
.order-cook{
width: 44rpx;
height: 30rpx;
margin-left: 10rpx;
}
\ No newline at end of file
... ...
... ... @@ -39,15 +39,12 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
}
if(!fouce && cachetime!=0){//优先使用缓存
let getCache= cache(cache_key);
//console.log('getCache.'+getCache,cache_key);
if(getCache!=-99999){
return new Promise((success,fail)=>{
if(true){
getCache.isCache=true;
console.log(cache_key+'\nuse cache',getCache);
success(getCache);
}else{
fail();
}
getCache.isCache=true;
console.log(cache_key+'\nuse cache',getCache);
success(getCache);
})
}
}
... ... @@ -78,7 +75,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
console.log('request.api==>',host+cache_key+'\nrequest.success',res.data);
// return;
if(res.data){
if(cachetime!=0 && res.data.ret==200 && res.data.data){
if(cachetime!=0 && res.data.ret==200){
cache(cache_key,res.data,cachetime);//.then().catch();
}
if(res.data.ret!==200){
... ... @@ -166,7 +163,7 @@ function cache(key,val=-99999,timeout=-1){
}
let res=wx.getStorageSync(key);
let time=Date.parse(new Date())/1000;
if(res && (res.timeout==-1 || res.timeout>time) && res.data.data){
if(res && (res.timeout==-1 || res.timeout>time) && res.data){
return res.data;
}else{
return -99999
... ...