APICloud成长记录 一 欢迎页制作总结

本文介绍了一个O2O应用的启动流程,包括对于首次使用应用的用户展示欢迎页面,并通过本地缓存来判断是否为首次启动。文章详细描述了使用API函数实现不同场景下页面的加载方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>O2Odemo</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <style type="text/css">
  
    </style>
</head>
<body>
   
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
	
    apiready = function(){
    	//判断第一次进来显示欢迎页,并将其缓存在本地
    	var welcomeShowed = $api.getStorage('welcomeShowed');
    	//alert(welcomeShowed+"你要获取的是welcomeShowed");
    	//如果本地有数据就直接打开页面
    	if(welcomeShowed){
    		api.openWin({
		        name: 'main',
		        url: './html/main.html',
		        bounces:false,
		        pageParam:{key : ''},
	        	animation: {
	        		type: 'none' //动画为none
	        	}
        });
        //如果本地没有,是第一次进来,就进入欢迎页
    }else{
	    api.openFrameGroup({
		            name: 'welcomFrames',
		            scrollEnabled:true,
		            rect:{
		            x:0,
		            y:0,
		            w:'auto',
		            h:'auto'
		            },
		            index:0,
		            frames:[{
		            	name:'welcome_frame_1',
		            	url:'./html/welcome_frame_1.html',
		            	bgColor:'./image/welcome/1.png',
		            	bounces:false,
		            	vScrollBarEnabled:false,
		            	hScrollBarEnabled:false
		            },{
			            name:'welcome_frame_2',
			            url:'./html/welcome_frame_2.html',
			            bgColor:'./image/welcome/2.png',
			            bounces:false,
		            	vScrollBarEnabled:false,
		            	hScrollBarEnabled:false
		            },{
			            name:'welcome_frame_3',
			            url:'./html/welcome_frame_3.html',
			            bgColor:'./image/welcome/3.png',
			            bounces:false,
		            	vScrollBarEnabled:false,
		            	hScrollBarEnabled:false
		            },{
			            name:'welcome_frame_4',
			            url:'./html/welcome_frame_4.html',
			            bgColor:'./image/welcome/4.png',
			            bounces:false,
		            	vScrollBarEnabled:false,
		            	hScrollBarEnabled:false
		            }]
	            },function(ret,err){
	            	var name = ret.name;
	            	var index = ret.index;
	            });
	            $api.setStorage('welcomeShowed', '0');
	    	}		
	   };
</script>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值