Commit 3979a58f by 梁建民

css

parent 98094069
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
title="期货" checked id="daytext"> title="期货" checked id="daytext">
<div class="lineBlock" id="day"> <div class="lineBlock" id="day">
<input type="text" placeholder="输入时间" class="boxsiz day_input input" <input type="text" placeholder="输入时间" class="boxsiz day_input input"
lay-verify="required|number" name="day"> lay-verify="required" name="day">
<i class="day"></i> <i class="day"></i>
</div> </div>
</div> </div>
......
...@@ -56,13 +56,11 @@ ...@@ -56,13 +56,11 @@
</div> </div>
<div class="search_command clr"> <div class="search_command clr">
<span class="fl comman_title">热门搜索:</span> <span class="fl comman_title">热门搜索:</span>
<div class="fl command_name"> <div class="fl command_name">
<div class="fl">LM358</div> <volist name="hot_goods" id="vo">
<div class="fl">LM358</div> <a class="fl" href="{$vo.url}" title="{$vo.title}" target="_blank">{$vo.title}</a>
<div class="fl">LM358</div> </volist>
<div class="fl">LM358</div>
<div class="fl">LM358</div>
<div class="fl">LM358</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -110,13 +110,14 @@ ...@@ -110,13 +110,14 @@
color: #8A9299; color: #8A9299;
width: 625px; width: 625px;
} }
.home_content .search_section .search_command .command_name div { .home_content .search_section .search_command .command_name a {
margin-left: 20px; margin-left: 20px;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
display: block;
} }
.home_content .search_section .search_command .command_name div.active, .home_content .search_section .search_command .command_name a.active,
.home_content .search_section .search_command .command_name div:hover { .home_content .search_section .search_command .command_name a:hover {
color: #0D84D1; color: #0D84D1;
} }
.home_content .xj_title { .home_content .xj_title {
......
{"version":3,"sources":["home.less"],"names":[],"mappings":"AAAA,aACI;EACI,aAAA;EACA,sBAAA;EACA,6BAAA;EACA,eAAA;;AALR,aACI,WAMI;EACI,gBAAA;EACA,OAAO,kBAAP;EACA,mBAAA;;AAVZ,aACI,WAMI,aAKI;EACI,aAAA;EACA,YAAA;EACA,sBAAA;EACA,kB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gCAAA;;AAEA,aA9BZ,QAgBI,aAII,aAUK;EACG,mBAAA;;AAjQpB,aAkOI,QAgBI,aAII,aAcI;EACI,cAAA;EACA,eAAA;EACA,UAAA;;AAvQpB,aAkOI,QAgBI,aAII,aAoBI;EACI,UAAA;;AA3QpB,aAkOI,QAgBI,aAII,aAoBI,OAGI;EACI,cAAA;;AA9QxB,aAkOI,QAgBI,aAII,aA4BI;EACI,UAAA;;AAnRpB,aAkOI,QAgBI,aAII,aA4BI,KAGI;EACI,cAAA;;AAtRxB,aAkOI,QAgBI,aAII,aAoCI;EACI,UAAA;;AA3RpB,aAkOI,QAgBI,aAII,aAoCI,SAGI;EACI,eAAA;EACA,cAAA;EACA,yCAAA;EACA,8BAAA;EACA,gBAAA;EACA,kBAAA;;AAEA,aAnEpB,QAgBI,aAII,aAoCI,SAGI,MAQK;EACG,yCAAA;EACA,cAAA;;AAvS5B,aAkOI,QAgBI,aAII,aAoCI,SAiBI;EACI,cAAA;;AA5SxB,aAkOI,QAgBI,aAII,aA0DI;EACI,UAAA;;AAjTpB,aAkOI,QAgBI,aAII,aA+DI;EACI,WAAA;EACA,cAAA;EACA,SAAA;EACA,eAAA;;AAGJ,aA1FZ,QAgBI,aAII,aAsEK;EACG,qDAAA","file":"home.css"} {"version":3,"sources":["home.less"],"names":[],"mappings":"AAAA,aACI;EACI,aAAA;EACA,sBAAA;EACA,6BAAA;EACA,eAAA;;AALR,aACI,WAMI;EACI,gBAAA;EACA,OAAO,kBAAP;EACA,mBAAA;;AAVZ,aACI,WAMI,aAKI;EACI,aAAA;EACA,YAAA;EACA,sBAAA;EACA,kBAAA;;AAhBhB,aACI,WAMI,aAYI;EACI,cAAA;EACA,OAAO,kBAAP;;AArBhB,aACI,WAMI,aAYI,WAII;EACI,eAAA;;AAxBpB,aACI,WAMI,aAYI,WASI;EACI,gBAAA;EACA,eAAA;EACA,mBAAA;;AA/BpB,aACI,WAMI,aAYI,WAeI;EACI,cAAA;EACA,eAAA;EACA,gBAA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;AA/QxB,aAmOI,QAgBI,aAII,aA4BI;EACI,UAAA;;AApRpB,aAmOI,QAgBI,aAII,aA4BI,KAGI;EACI,cAAA;;AAvRxB,aAmOI,QAgBI,aAII,aAoCI;EACI,UAAA;;AA5RpB,aAmOI,QAgBI,aAII,aAoCI,SAGI;EACI,eAAA;EACA,cAAA;EACA,yCAAA;EACA,8BAAA;EACA,gBAAA;EACA,kBAAA;;AAEA,aAnEpB,QAgBI,aAII,aAoCI,SAGI,MAQK;EACG,yCAAA;EACA,cAAA;;AAxS5B,aAmOI,QAgBI,aAII,aAoCI,SAiBI;EACI,cAAA;;AA7SxB,aAmOI,QAgBI,aAII,aA0DI;EACI,UAAA;;AAlTpB,aAmOI,QAgBI,aAII,aA+DI;EACI,WAAA;EACA,cAAA;EACA,SAAA;EACA,eAAA;;AAGJ,aA1FZ,QAgBI,aAII,aAsEK;EACG,qDAAA","file":"home.css"}
\ No newline at end of file \ No newline at end of file
...@@ -136,10 +136,11 @@ ...@@ -136,10 +136,11 @@
color: #8A9299; color: #8A9299;
width: 625px; width: 625px;
div { a {
margin-left: 20px; margin-left: 20px;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
display: block;
&.active ,&:hover{ &.active ,&:hover{
color: #0D84D1; color: #0D84D1;
......
! function () { !function () {
window.AccountController = { window.AccountController = {
isClick: false, isClick: false,
token: Util.getCookie('token') || '', token: Util.getCookie('token') || '',
...@@ -7,42 +7,42 @@ ...@@ -7,42 +7,42 @@
this.created(this).isIe(this).mounted(this).handleBind(this); this.created(this).isIe(this).mounted(this).handleBind(this);
}, },
created: function (opt) { created: function (opt) {
//默认获取省 //默认获取省
IcController.getData(apis.regionPcd, 'POST', { IcController.getData(apis.regionPcd, 'POST', {
token: opt.token token: opt.token
}, function (res) { }, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
var getTpl = provinceHtml.innerHTML; var getTpl = provinceHtml.innerHTML;
layui.laytpl(getTpl).render(res.data, function (html) { layui.laytpl(getTpl).render(res.data, function (html) {
$("#province_id").empty().html(html); $("#province_id").empty().html(html);
layui.form.render(); layui.form.render();
}); });
} }
}); });
return this; return this;
}, },
mounted: function (opt) { mounted: function (opt) {
//获取会员信息 //获取会员信息
IcController.getData(apis.userInfo, 'GET', { IcController.getData(apis.userInfo, 'GET', {
token: opt.token token: opt.token
}, function (res) { }, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
//手机号 //手机号
$("input[name='mobile']").val(res.data.mobile); $("input[name='mobile']").val(res.data.mobile);
//消息通知 //消息通知
layui.form.val("userInfo", { layui.form.val("userInfo", {
"sys_msg": Number(res.data.sys_msg), "sys_msg": Number(res.data.sys_msg),
...@@ -55,12 +55,12 @@ ...@@ -55,12 +55,12 @@
$('#fileLoad img').attr('src', res.data.avatar) $('#fileLoad img').attr('src', res.data.avatar)
} else { } else {
//非ie低版本 //非ie低版本
$('#upload_section img').attr('src',res.data.avatar) $('#upload_section img').attr('src', res.data.avatar)
} }
} }
if (res.data.province && res.data.city && res.data.district) { if (res.data.province && res.data.city && res.data.district) {
//省 //省
Observer.emit('region', { Observer.emit('region', {
type: 'province_id', type: 'province_id',
...@@ -70,10 +70,10 @@ ...@@ -70,10 +70,10 @@
detail_address: res.data.detail_address, detail_address: res.data.detail_address,
flag: true flag: true
}); });
//市 //市
setTimeout(function () { setTimeout(function () {
Observer.emit('region', { Observer.emit('region', {
type: 'city_id', type: 'city_id',
province_id: Number(res.data.province), province_id: Number(res.data.province),
...@@ -82,15 +82,15 @@ ...@@ -82,15 +82,15 @@
detail_address: res.data.detail_address, detail_address: res.data.detail_address,
flag: true flag: true
}); });
}, 200) }, 200)
} }
} }
}); });
return this; return this;
}, },
uploadFun: function () { uploadFun: function () {
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
data: { data: {
token: Util.getCookie('token'), token: Util.getCookie('token'),
source: 2, source: 2,
}, },
field: "upload", field: "upload",
before: function () { before: function () {
...@@ -123,42 +123,62 @@ ...@@ -123,42 +123,62 @@
err: function () { err: function () {
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg('上传失败'); layer.msg('上传失败');
} }
}); });
}, },
isIe: function (opt) { isIe: function (opt) {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) { if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
//ie版本 //ie版本
$('#fileLoad').show(); $('#fileLoad').show();
document.domain = cookieHostname; //设置domian跨域拿到iframe的内容 document.domain = cookieHostname; //设置domian跨域拿到iframe的内容
var iframe = document.getElementById("test"); var iframe = document.getElementById("test");
if (iframe.attachEvent) { if (iframe.attachEvent) {
iframe.attachEvent("onload", opt.iframeOnload); iframe.attachEvent("onload", opt.iframeOnload);
} else { } else {
iframe.onload = opt.iframeOnload; iframe.onload = opt.iframeOnload;
};
}
opt.formSubmit(); opt.formSubmit();
$('#mineFiles').on('change', function () { $('#mineFiles').on('change', function () {
layer.load(1, { layer.load(1, {
offset: ['50%', "50%"], offset: ['50%', "50%"],
shade: false shade: false
}); });
$('#fileLoad').submit(); $('#fileLoad').submit();
}) })
} else { } else {
//非ie低版本 //非ie低版本
$('.sc_div').show(); $('.sc_div').show();
opt.uploadFun(); opt.uploadFun();
} }
return this; return this;
}, },
formSubmit: function () { formSubmit: function () {
$('#fileLoad').submit(function () { $('#fileLoad').submit(function () {
var uploadFileForm = document.getElementById("fileLoad"); var uploadFileForm = document.getElementById("fileLoad");
uploadFileForm.action = apis.ossupload; uploadFileForm.action = apis.ossupload;
$('#token').val(Util.getCookie('token')); $('#token').val(Util.getCookie('token'));
$('#ie').val(cookieHostname); $('#ie').val(cookieHostname);
}) })
}, },
...@@ -178,7 +198,7 @@ ...@@ -178,7 +198,7 @@
console.log(e) console.log(e)
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg('上传失败'); layer.msg('上传失败');
} }
if (json) { if (json) {
layer.closeAll('loading'); layer.closeAll('loading');
...@@ -187,186 +207,186 @@ ...@@ -187,186 +207,186 @@
AccountController.imgUrl = json.data[0] || ''; AccountController.imgUrl = json.data[0] || '';
} else { } else {
layer.msg(json.errmsg) layer.msg(json.errmsg)
} }
} }
}, },
handleBind: function (opt) { handleBind: function (opt) {
//系统消息通知 //系统消息通知
layui.form.on('switch(sys_msg)', function (data) { layui.form.on('switch(sys_msg)', function (data) {
Observer.emit('switch', { Observer.emit('switch', {
type: 1, type: 1,
data: data.elem.checked ? 1 : 0 data: data.elem.checked ? 1 : 0
}); });
}); });
//业务通知 //业务通知
layui.form.on('switch(business_msg)', function (data) { layui.form.on('switch(business_msg)', function (data) {
Observer.emit('switch', { Observer.emit('switch', {
type: 2, type: 2,
data: data.elem.checked ? 1 : 0 data: data.elem.checked ? 1 : 0
}); });
}); });
//活动通知 //活动通知
layui.form.on('switch(activity_msg)', function (data) { layui.form.on('switch(activity_msg)', function (data) {
Observer.emit('switch', { Observer.emit('switch', {
type: 3, type: 3,
data: data.elem.checked ? 1 : 0 data: data.elem.checked ? 1 : 0
}); });
}); });
//监听消息推送 //监听消息推送
Observer.on('switch', function (e) { Observer.on('switch', function (e) {
IcController.getData(apis.userSetmsg, 'GET', { IcController.getData(apis.userSetmsg, 'GET', {
token: opt.token, token: opt.token,
type: e.args.type, type: e.args.type,
is_open: e.args.data is_open: e.args.data
}, function (res) { }, function (res) {
if (res.errcode == 0) { if (res.errcode == 0) {
layer.msg('设置成功'); layer.msg('设置成功');
} else { } else {
layer.msg(res.msg); layer.msg(res.msg);
} }
}) })
}); });
//账户设置 //账户设置
layui.form.on('submit(account)', function (data) { layui.form.on('submit(account)', function (data) {
$(data.elem).addClass("layui-btn-disabled"); $(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) { if (!opt.isClick) {
opt.isClick = true; opt.isClick = true;
var params = $.extend({}, data.field, { var params = $.extend({}, data.field, {
token: opt.token, token: opt.token,
avatar: opt.imgUrl avatar: opt.imgUrl
}); });
IcController.getData(apis.userAccount, 'GET', params, function (res) { IcController.getData(apis.userAccount, 'GET', params, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
layer.msg(res.errmsg); layer.msg(res.errmsg);
opt.isClick = false; opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled"); $(data.elem).removeClass("layui-btn-disabled");
} else { } else {
layer.msg(res.errmsg); layer.msg(res.errmsg);
opt.isClick = false; opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled"); $(data.elem).removeClass("layui-btn-disabled");
} }
}); });
} }
}); });
//省 //省
layui.form.on('select(province_id)', function (data) { layui.form.on('select(province_id)', function (data) {
Observer.emit('region', { Observer.emit('region', {
type: 'province_id', type: 'province_id',
province_id: data.value, province_id: data.value,
city_id: '' city_id: ''
}); });
}); });
//市 //市
layui.form.on('select(city_id)', function (data) { layui.form.on('select(city_id)', function (data) {
Observer.emit('region', { Observer.emit('region', {
type: 'city_id', type: 'city_id',
province_id: $('select[name="province_id"]').val(), province_id: $('select[name="province_id"]').val(),
city_id: data.value city_id: data.value
}); });
}); });
//监听省市区 //监听省市区
Observer.on('region', function (e) { Observer.on('region', function (e) {
var getTpl = cityHtml.innerHTML, var getTpl = cityHtml.innerHTML,
getTpl1 = districtHtml.innerHTML, getTpl1 = districtHtml.innerHTML,
tpl = ''; tpl = '';
e.args.type == 'province_id' ? tpl = getTpl : tpl = getTpl1; e.args.type == 'province_id' ? tpl = getTpl : tpl = getTpl1;
var params = { var params = {
token: opt.token, token: opt.token,
province_id: e.args.province_id, province_id: e.args.province_id,
city_id: e.args.city_id city_id: e.args.city_id
}; };
IcController.getData(apis.regionPcd, 'GET', params, function (res) { IcController.getData(apis.regionPcd, 'GET', params, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
layui.laytpl(tpl).render(res.data, function (html) { layui.laytpl(tpl).render(res.data, function (html) {
if (e.args.type == 'province_id') { if (e.args.type == 'province_id') {
//省联动市 //省联动市
$("#city_id").empty().html(html); $("#city_id").empty().html(html);
$("#district_id").empty().html('<select name="district_id" lay-verify="required" lay-filter="district_id">' + $("#district_id").empty().html('<select name="district_id" lay-verify="required" lay-filter="district_id">' +
' <option value=""></option>' + ' <option value=""></option>' +
'</select>'); '</select>');
} else if (e.args.type == 'city_id') { } else if (e.args.type == 'city_id') {
//市联动区 //市联动区
$("#district_id").empty().html(html); $("#district_id").empty().html(html);
} }
//获取默认省市区 //获取默认省市区
if (e.args.flag) { if (e.args.flag) {
layui.form.val("account", { layui.form.val("account", {
"province_id": e.args.province_id, "province_id": e.args.province_id,
"city_id": e.args.city_id, "city_id": e.args.city_id,
"district_id": e.args.district_id, "district_id": e.args.district_id,
"detail_address": e.args.detail_address "detail_address": e.args.detail_address
}) })
} }
layui.form.render(); layui.form.render();
}); });
} }
}, false); }, false);
}); });
return this; return this;
}, },
}, $(function () { }, $(function () {
......
! function () { !function () {
window.UploadSingleController = { window.UploadSingleController = {
isClick: false, isClick: false,
token: Util.getCookie('token') || '', token: Util.getCookie('token') || '',
...@@ -7,23 +7,23 @@ ...@@ -7,23 +7,23 @@
this.created(this).isIe(this).mounted(this).handleBind(this); this.created(this).isIe(this).mounted(this).handleBind(this);
}, },
created: function (opt) { created: function (opt) {
//判断编辑 新增状态 //判断编辑 新增状态
var id = Util.getRequest('id'), var id = Util.getRequest('id'),
text = ''; text = '';
id ? text = '编辑商品' : text = '上传商品'; id ? text = '编辑商品' : text = '上传商品';
$("#title").text(text); $("#title").text(text);
return this; return this;
}, },
mounted: function (opt) { mounted: function (opt) {
var id = Util.getRequest('id'), var id = Util.getRequest('id'),
text = ''; text = '';
//编辑 //编辑
if (id) { if (id) {
IcController.getData(apis.goodsInfo, 'GET', {token: opt.token, 'goods_id/eq': id}, function (res) { IcController.getData(apis.goodsInfo, 'GET', {token: opt.token, 'goods_id/eq': id}, function (res) {
...@@ -39,14 +39,22 @@ ...@@ -39,14 +39,22 @@
"currency": res['goods_list'][id].currency, "currency": res['goods_list'][id].currency,
"delivery_time": res['goods_list'][id].delivery_time "delivery_time": res['goods_list'][id].delivery_time
}); });
if (res['goods_list'][id].goods_images) { if (res['goods_list'][id].goods_images) {
opt.imgUrl = res['goods_list'][id].goods_images; opt.imgUrl = res['goods_list'][id].goods_images;
$('#fileLoad').hide(); $('#fileLoad').hide();
$('.sc_div').hide(); $('.sc_div').hide();
$('.upload_result').show(); $('.upload_result').show();
$('.upload_result img').attr('src',res['goods_list'][id].goods_images)
$('.upload_result img').attr('src', res['goods_list'][id].goods_images);
} }
setTimeout(function () { setTimeout(function () {
...@@ -58,7 +66,7 @@ ...@@ -58,7 +66,7 @@
setTimeout(function () { setTimeout(function () {
layui.form.val("goodsave", { layui.form.val("goodsave", {
"day": res['goods_list'][id].delivery_time "day": res['goods_list'][id].delivery_time.replace('天', '')
}); });
...@@ -68,24 +76,24 @@ ...@@ -68,24 +76,24 @@
layui.form.render(); layui.form.render();
} }
}); });
} }
return this; return this;
}, },
uploadFun: function () { uploadFun: function () {
var self = this; var self = this;
layui.upload.render({ layui.upload.render({
elem: '#upload_section', elem: '#upload_section',
url: apis.ossupload, url: apis.ossupload,
data: { data: {
token: Util.getCookie('token'), token: Util.getCookie('token'),
source: 2, source: 2
}, },
field: "upload", field: "upload",
before: function () { before: function () {
...@@ -95,23 +103,34 @@ ...@@ -95,23 +103,34 @@
}); });
}, },
done: function (res) { done: function (res) {
layer.closeAll('loading'); layer.closeAll('loading');
if (res.errcode == 103200) { if (res.errcode == 103200) {
$('#upload_section').hide(); $('#upload_section').hide();
$('.upload_result').show(); $('.upload_result').show();
$('.upload_result img').attr('src', res.data[0])
$('.upload_result img').attr('src', res.data[0]);
self.imgUrl = res.data[0] || ''; self.imgUrl = res.data[0] || '';
} else { } else {
layer.msg(res.errmsg)
layer.msg(res.errmsg);
} }
}, },
err: function () { err: function () {
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg('上传失败'); layer.msg('上传失败');
} }
}); });
}, },
isIe: function (opt) { isIe: function (opt) {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) { if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
...@@ -123,7 +142,8 @@ ...@@ -123,7 +142,8 @@
iframe.attachEvent("onload", opt.iframeOnload); iframe.attachEvent("onload", opt.iframeOnload);
} else { } else {
iframe.onload = opt.iframeOnload; iframe.onload = opt.iframeOnload;
}; }
;
opt.formSubmit(); opt.formSubmit();
$('#mineFiles').on('change', function () { $('#mineFiles').on('change', function () {
layer.load(1, { layer.load(1, {
...@@ -163,7 +183,7 @@ ...@@ -163,7 +183,7 @@
console.log(e) console.log(e)
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg('上传失败'); layer.msg('上传失败');
} }
if (json) { if (json) {
layer.closeAll('loading'); layer.closeAll('loading');
...@@ -174,48 +194,51 @@ ...@@ -174,48 +194,51 @@
UploadSingleController.imgUrl = json.data[0] || ''; UploadSingleController.imgUrl = json.data[0] || '';
} else { } else {
layer.msg(json.errmsg) layer.msg(json.errmsg)
} }
} }
}, },
handleBind: function (opt) { handleBind: function (opt) {
//货期选择 //货期选择
layui.form.on('radio(delivery)', function (data) { layui.form.on('radio(delivery)', function (data) {
var str = '期货'; var str = '期货';
data.value == '现货' ? str = '现货' : str = '期货'; data.value == '现货' ? str = '现货' : str = '期货';
var getTpl = deliveryHtml.innerHTML; var getTpl = deliveryHtml.innerHTML;
layui.laytpl(getTpl).render(str, function (html) { layui.laytpl(getTpl).render(str, function (html) {
$("#day").empty().html(html); $("#day").empty().html(html);
}); });
}); });
//天数同步期货 //天数同步期货
$(document).on('input propertychange', 'input[name="day"]', function () { $(document).on('input propertychange', 'input[name="day"]', function () {
var val = $(this).val(); var val = $(this).val();
$("#daytext").val(val + '天'); $("#daytext").val(val + '天');
}); });
//上传商品发布 //上传商品发布
layui.form.on('submit(add)', function (data) { layui.form.on('submit(add)', function (data) {
$(data.elem).addClass("layui-btn-disabled"); $(data.elem).addClass("layui-btn-disabled");
var id = Util.getRequest('id'), var id = Util.getRequest('id'),
params = {}, params = {},
url = ''; url = '';
if (!opt.isClick) { if (!opt.isClick) {
opt.isClick = true; opt.isClick = true;
id ? params = $.extend({}, data.field, { id ? params = $.extend({}, data.field, {
goods_images: opt.imgUrl, goods_images: opt.imgUrl,
token: opt.token, token: opt.token,
...@@ -224,48 +247,54 @@ ...@@ -224,48 +247,54 @@
goods_images: opt.imgUrl, goods_images: opt.imgUrl,
token: opt.token token: opt.token
}); });
id ? url = apis.goodsSave : url = apis.goodsAdd; id ? url = apis.goodsSave : url = apis.goodsAdd;
IcController.getData(url, 'GET', params, function (res) { IcController.getData(url, 'GET', params, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
layer.msg('上传商品成功', { layer.msg('上传商品成功', {
time: 2000 time: 2000
}, function () { }, function () {
window.location.href = '/goodmanage'; window.location.href = '/goodmanage';
}); });
} else { } else {
layer.msg(res.errmsg); layer.msg(res.errmsg);
opt.isClick = false; opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled"); $(data.elem).removeClass("layui-btn-disabled");
} }
}); });
} }
}); });
$('.form_content').on('click', '.deleteicon', function () { $('.form_content').on('click', '.deleteicon', function () {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) { if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
//ie版本 //ie版本
$('#fileLoad').show(); $('#fileLoad').show();
} else { } else {
//非ie低版本 //非ie低版本
$('#upload_section').show(); $('#upload_section').show();
} }
$('.upload_result').hide(); $('.upload_result').hide();
$('.upload_result img').attr('src', ''); $('.upload_result img').attr('src', '');
opt.imgUrl = ""; opt.imgUrl = "";
}) });
return this; return this;
}, },
}, $(function () { }, $(function () {
......
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 sign in to comment