Commit 249dca19 authored by liuxinjun's avatar liuxinjun

增加视频-分享的自由配置切换解析

parent 38c441fb
......@@ -2236,6 +2236,7 @@ var sdk = {
getButtonConfig(buttonKey){
var c3 = this.getConfig3();
if(c3.length>0)
{
......@@ -2253,7 +2254,55 @@ var sdk = {
var nowTime =new Date().getTime();
if(nowTime >=d.s_time && nowTime <=d.e_time)
{
return d;
if(c.type==='mix')
{
var countKey = "getButtonConfig:"+i+":count";
var count = this.getItem(countKey);
console.log("getButtonConfig->"+countKey,count);
if(!count)
{
count = 1;
}
var startKey = "getButtonConfig:"+i+":start:"+d.data.start.type+":"+count;
var startVal = this.getItem(startKey);
console.log("getButtonConfig->"+startKey,startVal);
if(!startVal)
{
startVal = 0;
}
if(startVal>=d.data.start.count)
{
return this.nextConfig(d.data,d.data.start.next,i,count);
}else
{
//当前记录的次数小于配置次数
startVal++;
this.setItem(startKey,startVal);
d.data.start.left_count = d.data.start.count-startVal;
d.data.start.use_count = startVal;
return d.data.start;
}
}else
{
return d;
}
}
}
......@@ -2268,6 +2317,52 @@ var sdk = {
return null;
}
},
nextConfig(data,nextKey,i,count)
{
if(nextKey=='end')
{
return null;
}
var nextCacheKey = "getButtonConfig:"+i+":"+nextKey+":"+data[nextKey].type+":"+count;
var nextCacheVal = this.getItem(nextCacheKey);
console.log("nextConfig->"+nextCacheKey,nextCacheVal);
if(!nextCacheVal)
{
nextCacheVal = 1;
}else
{
nextCacheVal = nextCacheVal+1;
}
this.setItem(nextCacheKey,nextCacheVal);
if(nextCacheVal>=data[nextKey].count)
{
//当前缓存中的记录当前key的次数已经超过配置次数
if(data[nextKey].next=='start')
{
var countKey = "getButtonConfig:"+i+":count";
count=count+1;
this.setItem(countKey,count);
}
//往下递归
return this.nextConfig(data,data[nextKey].next,i,count);
}else
{
data[nextKey].left_count = data[nextKey].count-nextCacheVal;
data[nextKey].use_count = nextCacheVal;
return data[nextKey];
}
},
/**
* @apiGroup C
......@@ -2285,9 +2380,9 @@ var sdk = {
navigateToMiniProgram(config,success,fail,complete)
{
var nowTime =new Date().getTime();
if(nowTime >=config.s_time && nowTime <=config.e_time)
{
//var nowTime =new Date().getTime();
//if(nowTime >=config.s_time && nowTime <=config.e_time)
//{
wx.navigateToMiniProgram({
appId: config.app_id, // 要打开的小程序appId
path: config.path, // 打开的页面路径,如果为空则打开首页
......@@ -2297,7 +2392,7 @@ var sdk = {
fail: fail,
complete: complete,
});
}
//}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment