vr-shopxo-source/public/static/admin/default/js/theme.js

41 lines
960 B
JavaScript
Raw Normal View History

2018-12-28 10:58:37 +00:00
$(function()
{
// 模板切换
$('.select-theme').on('click', function()
{
var theme = $(this).data('theme');
if(!$(this).parent().hasClass('theme-active'))
{
var $this = $(this);
if(theme != undefined)
{
// ajax请求
$.AMUI.progress.start();
2018-12-28 10:58:37 +00:00
$.ajax({
2022-05-14 07:37:28 +00:00
url: RequestUrlHandle($('.data-list').data('select-url')),
type: 'POST',
dataType: 'json',
timeout: 10000,
data: {"theme":theme},
success: function(result)
2018-12-28 10:58:37 +00:00
{
$.AMUI.progress.done();
2018-12-28 10:58:37 +00:00
if(result.code == 0)
{
$('.am-gallery-item').removeClass('theme-active');
$this.parent().addClass('theme-active');
Prompt(result.msg, 'success');
} else {
Prompt(result.msg);
}
},
error: function(xhr, type)
{
$.AMUI.progress.done();
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
}
2018-12-28 10:58:37 +00:00
});
}
}
});
});