demo.html 2.45 KB
<div id="fhandwriting_page" class="page out" data-title="批注">
	<div class="page-content" id="fhandwriting_content">
		<div id="fhandwriting-header"></div>
		<div id="fhandwriting-form"></div>
		<div id="fhandwriting"></div>
		<div id="fhandwriting-fbutton"></div>
	</div>
</div>
<script>
require(["NavHeader", "Form", "FHandwriting", "FButton", "mUtil"], function(NavHeader, Form, FHandwriting, FButton, mUtil) {
	var _u = require("mUtil");
	var hasClsPicker = typeof clsPicker !== "undefined";

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

	new FHandwriting({
		el: "fhandwriting",
		option: {
			form : "fhandwriting-form",
			field : {
				label : "签字意见",//显示名
				name : "f1", //字段名
				value : ""//字段值
			},
			hint : "点击输入",
			height: 150,
			required : true,
			readonly : false
		}
	}).render().then(function() {
		if (!hasClsPicker) return;

		_u.vetically("#fhandwriting");

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

		new clsPicker({
			selector: ".wev-handwriting-label",
			text: ".wev-handwriting-label",
			lineYSkew: 20,
			skew: [8, ""],
			position: "top right"
		});
		new clsPicker({
			selector: ".wev-field.vertical>div:nth-child(2)",
			text: " ",
			lineYSkew: 50,
			skew: [1.2, ""],
			position: "top left"
		});
		new clsPicker({
			selector: ".wev-handwriting-wrap.wev-handwriting-empty",
			text: ".wev-handwriting-wrap",
			skew: [8, ""],
			lineYSkew: 20
		});
		new clsPicker({
			selector: ".wev-handwriting-wrap div",
			text: " ",
			skew: [1, ""],
			lineYSkew: 20,
			position: "bottom left"
		});
	});
	
	if(!hasClsPicker) {
		new FButton({
			el: "fhandwriting-fbutton",
			container: "#fhandwriting_page",
			option: {
				form : "fhandwriting-form",
				btns : [
					{
						text : "重置",
						action : "reset"
					},
					{
						text : "提交",
						action : "submit",
						callback : function(billid) {
							console.log(billid);
						},
						remindMsg : "操作成功"
					}
				],
				fixed : true
			}
		}).render();
	}

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