admin/addon/giftcard/shop/view/public/js/media.js

31 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 素材
function openMedia(callback, imgNum) {
layui.use(['layer'], function () {
layer.open({
type: 2,
title: '素材管理',
area: ['1050px', '600px'],
fixed: false, //不固定
btn: ['保存', '返回'],
content: ns.url("giftcard://shop/media/media?mediaIds=" + mediaIds + "&imgNum=" + imgNum),
yes: function (index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象执行iframe页的方法
iframeWin.getCheckItem(function (obj) {
if (typeof callback == "string") {
try {
eval(callback + '(obj)');
layer.close(index);
} catch (e) {
console.error('回调函数' + callback + '未定义');
}
} else if (typeof callback == "function") {
callback(obj);
layer.close(index);
}
});
}
});
});
}