mirror of
https://gitee.com/liuxioabin/fengketrade.git
synced 2026-04-17 21:03:17 +08:00
124 lines
5.5 KiB
JavaScript
124 lines
5.5 KiB
JavaScript
define([], function () {
|
||
if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.actionname == 'index') {
|
||
require.config({
|
||
paths: {
|
||
'vue3': "../addons/shopro/libs/vue",
|
||
'vue': "../addons/shopro/libs/vue.amd",
|
||
'text': "../addons/shopro/libs/require-text",
|
||
'SaChat': '../addons/shopro/chat/index',
|
||
'ElementPlus': '../addons/shopro/libs/element-plus/index',
|
||
'ElementPlusIconsVue3': "../addons/shopro/libs/element-plus/icons-vue",
|
||
'ElementPlusIconsVue': '../addons/shopro/libs/element-plus/icons-vue.amd',
|
||
'io': '../addons/shopro/libs/socket.io',
|
||
},
|
||
shim: {
|
||
'ElementPlus': {
|
||
deps: ['css!../addons/shopro/libs/element-plus/index.css']
|
||
},
|
||
},
|
||
});
|
||
require(['vue3', 'ElementPlusIconsVue3'], function (Vue3, ElementPlusIconsVue3) {
|
||
require(['vue', 'jquery', 'SaChat', 'text!../addons/shopro/chat/index.html', 'ElementPlus', 'ElementPlusIconsVue', 'io'], function (Vue, $, SaChat, SaChatTemplate, ElementPlus, ElementPlusIconsVue, io) {
|
||
if (Config.dark_type != 'none') {
|
||
SaChatTemplate = SaChatTemplate.replaceAll('__DARK__', `<link rel="stylesheet" href="__CDN__/assets/addons/shopro/css/dark.css?v={$site.version|htmlentities}" />`)
|
||
}
|
||
|
||
SaChatTemplate = SaChatTemplate.replaceAll('__DARK__', ``)
|
||
SaChatTemplate = SaChatTemplate.replaceAll('__CDN__', Config.__CDN__)
|
||
|
||
Fast.api.ajax({
|
||
url: 'shopro/chat/index/init',
|
||
loading: false,
|
||
type: 'GET'
|
||
}, function (ret, res) {
|
||
$("body").append(`<div id="SaChatTemplateContainer"></div>
|
||
<div id="SaChatWrap"><sa-chat></sa-chat></div>`);
|
||
|
||
$("#SaChatTemplateContainer").append(SaChatTemplate);
|
||
|
||
const { createApp } = Vue
|
||
const app = createApp({})
|
||
|
||
app.use(ElementPlus)
|
||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||
app.component(key, component)
|
||
}
|
||
|
||
app.component('sa-chat', SaChat)
|
||
app.mount(`#SaChatWrap`)
|
||
return false;
|
||
}, function (ret, res) {
|
||
if (res.msg == '') {
|
||
return false;
|
||
}
|
||
})
|
||
});
|
||
|
||
});
|
||
}
|
||
window.UEDITOR_HOME_URL = Config.__CDN__ + "/assets/addons/ueditor/";
|
||
require.config({
|
||
paths: {
|
||
'ueditor.config': '../addons/ueditor/ueditor.config',
|
||
'ueditor': '../addons/ueditor/ueditor.all.min',
|
||
'ueditor.zh': '../addons/ueditor/i18n/zh-cn/zh-cn',
|
||
'zeroclipboard': '../addons/ueditor/third-party/zeroclipboard/ZeroClipboard.min',
|
||
},
|
||
shim: {
|
||
'ueditor': {
|
||
deps: ['zeroclipboard', 'ueditor.config'],
|
||
exports: 'UE',
|
||
init: function (ZeroClipboard) {
|
||
//导出到全局变量,供ueditor使用
|
||
window.ZeroClipboard = ZeroClipboard;
|
||
},
|
||
},
|
||
'ueditor.zh': ['ueditor'],
|
||
}
|
||
});
|
||
require(['form', 'upload'], function (Form, Upload) {
|
||
var _bindevent = Form.events.bindevent;
|
||
Form.events.bindevent = function (form) {
|
||
_bindevent.apply(this, [form]);
|
||
try {
|
||
//绑定editor事件
|
||
require(['ueditor', 'ueditor.zh'], function (UE, undefined) {
|
||
UE.list = [];
|
||
window.UEDITOR_CONFIG['uploadService'] = function (context, editor) {
|
||
return {
|
||
Upload: () => { return Upload },
|
||
Fast: () => { return Fast },
|
||
}
|
||
};
|
||
$(Config.ueditor.classname || '.editor', form).each(function () {
|
||
var id = $(this).attr("id");
|
||
var name = $(this).attr("name");
|
||
$(this).removeClass('form-control');
|
||
UE.list[id] = UE.getEditor(id, {
|
||
allowDivTransToP: false, //阻止div自动转p标签
|
||
initialFrameWidth: '100%',
|
||
initialFrameHeight: 320,
|
||
autoFloatEnabled: false,
|
||
baiduMapAk: Config.ueditor.baiduMapAk || '', //百度地图api密钥(ak)
|
||
// autoHeightEnabled: true, //自动高度
|
||
imageMaxSize: 0, //图片上传编辑器不做限制
|
||
fileMaxSize: 0, //文件上传编辑器不做限制
|
||
zIndex: 90,
|
||
xssFilterRules: false,
|
||
outputXssFilter: false,
|
||
inputXssFilter: false,
|
||
catchRemoteImageEnable: Config.ueditor.catchRemoteImageEnable || false, //不抓取远程图片
|
||
imageAllowFiles: '',//允许上传的图片格式,编辑器默认[".png", ".jpg", ".jpeg", ".gif", ".bmp"]
|
||
});
|
||
UE.list[id].addListener("contentChange", function () {
|
||
$('#' + id).val(this.getContent());
|
||
$('textarea[name="' + name + '"]').val(this.getContent());
|
||
})
|
||
});
|
||
})
|
||
} catch (e) {
|
||
console.log('绑定editor事件', e)
|
||
}
|
||
}
|
||
});
|
||
}); |