demo.html 2.5 KB
<div id="flbs_page" class="page out" data-title="LBS">
	<div class="page-content" id="flbs_content">
		<div id="flbs-header"></div>
		<div id="flbs-form"></div>
		<div id="flbs"></div>
		<div id="flbs-fbutton"></div>
	</div>
</div>
<script>
require(["NavHeader", "Form", "FLbs", "FButton", "mUtil"], function(NavHeader, Form, FLbs, FButton, mUtil) {
	var _u = require("mUtil");
	var hasClsPicker = typeof clsPicker !== "undefined";

	if(!hasClsPicker) {
		new NavHeader({
			el: "flbs-header",
			option: {
				title:"表单-LBS", 
				smallTitle:"flbs"
			}
		}).render();
		
		new Form({
			el: "flbs-form",
			option: {
				submit : {
					action : "/mobilemode/mobile/demo/plugin/Form/formAction.jsp",//提交地址
					validate : function(){
						//表单提交前验证脚本
					}
				}
			}
		}).render();
	}

	new FLbs({
		el: "flbs",
		option: {
			form : "flbs-form",
			field : {
				label : "所在位置",//显示名称
				name : "f1", //对应字段
				address : "f2",//对应地址中文字段
				value : "31.173211,121.475134",//对应字段value
				addrvalue : "上海市闵行区联航路1088号"//对应地址中文value
			},
			datatype : "3",//数据保存类型
			poi : {
				postype : 1,//定位类型
				radius : 500,//poi半径
				num : 10,//热点个数
				btntext : "确定"//按钮名称
			},
			isShowCurrLocation : true,//显示当前位置
			required : true,
			readonly : false
		}
	}).render().then(function () {
		if (!hasClsPicker) return;

		_u.vetically("#flbs");

		clsPicker.golalSetting({
			container: ".wev-comp-FLbs",
			type: "FLbs"
		});

		new clsPicker({
			selector: ".wev-flbs-content",
			text: ".wev-flbs-content",
			lineYSkew: 20,
		});
		new clsPicker({
			selector: ".wev-field",
			text: ".wev-field",
			skew: [3, ""],
			lineYSkew: 50,
		});
		
		new clsPicker({
			selector: ".wev-flbs-detail",
			text: ".wev-flbs-detail",
			lineYSkew: 20,
			position: "top left"
		});
		new clsPicker({
			selector: ".wev-flbs-clear-btn",
			text: ".wev-flbs-clear-btn",
			lineYSkew: 50,
			position: "top left"
		});
	});
	
	if(!hasClsPicker) {
		new FButton({
			el: "flbs-fbutton",
			container: "#flbs_page",
			option: {
				form : "flbs-form",
				btns : [
					{
						text : "重置",
						action : "reset"
					},
					{
						text : "提交",
						action : "submit",
						callback : function(billid) {
							console.log(billid);
						},
						remindMsg : "操作成功"
					}
				],
				fixed : true
			}
		}).render();
	}

	mUtil.trigger('load');//页面渲染完成回调
});
</script>