bootstrap.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.actionname == 'index') {
  2. require.config({
  3. paths: {
  4. 'vue3': "../addons/shopro/libs/vue",
  5. 'vue': "../addons/shopro/libs/vue.amd",
  6. 'text': "../addons/shopro/libs/require-text",
  7. 'SaChat': '../addons/shopro/chat/index',
  8. 'ElementPlus': '../addons/shopro/libs/element-plus/index',
  9. 'ElementPlusIconsVue3': "../addons/shopro/libs/element-plus/icons-vue",
  10. 'ElementPlusIconsVue': '../addons/shopro/libs/element-plus/icons-vue.amd',
  11. 'io': '../addons/shopro/libs/socket.io',
  12. },
  13. shim: {
  14. 'ElementPlus': {
  15. deps: ['css!../addons/shopro/libs/element-plus/index.css']
  16. },
  17. },
  18. });
  19. require(['vue3', 'ElementPlusIconsVue3'], function (Vue3, ElementPlusIconsVue3) {
  20. require(['vue', 'jquery', 'SaChat', 'text!../addons/shopro/chat/index.html', 'ElementPlus', 'ElementPlusIconsVue', 'io'], function (Vue, $, SaChat, SaChatTemplate, ElementPlus, ElementPlusIconsVue, io) {
  21. if (Config.dark_type != 'none') {
  22. SaChatTemplate = SaChatTemplate.replaceAll('__DARK__', `<link rel="stylesheet" href="__CDN__/assets/addons/shopro/css/dark.css?v={$site.version|htmlentities}" />`)
  23. }
  24. SaChatTemplate = SaChatTemplate.replaceAll('__DARK__', ``)
  25. SaChatTemplate = SaChatTemplate.replaceAll('__CDN__', Config.__CDN__)
  26. Fast.api.ajax({
  27. url: 'shopro/chat/index/init',
  28. loading: false,
  29. type: 'GET'
  30. }, function (ret, res) {
  31. $("body").append(`<div id="SaChatTemplateContainer"></div>
  32. <div id="SaChatWrap"><sa-chat></sa-chat></div>`);
  33. $("#SaChatTemplateContainer").append(SaChatTemplate);
  34. const { createApp } = Vue
  35. const app = createApp({})
  36. app.use(ElementPlus)
  37. for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  38. app.component(key, component)
  39. }
  40. app.component('sa-chat', SaChat)
  41. app.mount(`#SaChatWrap`)
  42. return false;
  43. }, function (ret, res) {
  44. if (res.msg == '') {
  45. return false;
  46. }
  47. })
  48. });
  49. });
  50. }