123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- layui.use(['layer','element','form','table'], function(){
- var laypage = layui.laypage //分页
- ,layer = layui.layer //弹层
- ,table = layui.table //表格
- ,element = layui.element //元素操作
- ,form = layui.form;
- layer.photos({
- photos: '#demo2',
- closeBtn: 1
- ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
- });
- //选项卡切换
- $('.layui-tab-title .site-demo-active').on('click', function(){
- $(this).addClass('layui-this').siblings().removeClass('layui-this');
- var lay_id = $(this).attr('lay-id');
- $('.layui-tab-item').removeClass('layui-show');
- $('.layui-tab-content #'+lay_id).addClass('layui-show');
- });
- var verdict = $('#editor').html();
- if(typeof verdict == "string"){
- var ue = UE.getEditor('editor'); //编辑器
- }
- form.on('submit(sync_edit)', function(data){
- layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
- var formData = new FormData($('#house_edit_form')[0]);
- $.ajax({
- cache : true,
- type : "post",
- url : "/othersync/houseadd",
- data : formData, // 你的formid
- async : false,
- contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
- processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
- error : function(request) {
- layer.alert("请联系管理员");
- },
- success : function(data) {
- if(data.data != null)
- {
- layer.msg(ReturnInfo(data.data),{icon:5});
- return false;
- }
- layer.msg(data.msg);
- TableClose();
- }
- });
- return false;
- });
- var data = {};
- form.on('checkbox(editlist)', function(obj){
- var paren = $(this).parent().parent().parent();
- var name = paren.attr('name');
- if(obj.elem.checked == true){
- var arr = [];
- data[name] = paren.find("input[name="+name+"]").val();
- $.each(paren.find('input:checkbox:checked'),function(){
- if($(this).val() != 'on'){
- arr.push($(this).val());
- }
- });
- if(arr.length>0){
- data[name] = arr;
- }
- }else if(obj.elem.checked == false){
- delete data[name];
- }
- // console.log( console.log(data));
- });
- // 添加页面提交
- form.on('submit(sync_infoedit)',function (arr) {
- layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
- var formData = new FormData($('#house_edit_form')[0]);
- $.post("/othersync/houseadd",{data:data,unid:formData.get('uniqid'),hid:formData.get('hid'),sync:formData.get('sync')},function(datas){
- if(datas.data != null)
- {
- layer.msg(ReturnInfo(datas.data),{icon:5});
- return false;
- }
- layer.msg(datas.msg);
- // TableClose();
- })
- return false;
- })
- // 添加页面提交
- form.on('submit(edit_Album)',function (data) {
- layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示
- $.post("/othersync/houseallbumform",{data:data.field,},function(datas){
- if(datas.data != null)
- {
- layer.msg(ReturnInfo(datas.data),{icon:5});
- return false;
- }
- layer.msg(datas.msg);
- // TableClose();
- })
- return false;
- })
- });
|