Browse Source

安装shopro,第一步

lizhen_gitee 4 months ago
parent
commit
955b4a7072

+ 1 - 1
application/config.php

@@ -293,7 +293,7 @@ return [
         //后台是否启用面包屑
         'breadcrumb'            => false,
         //是否允许未知来源的插件压缩包
-        'unknownsources'        => false,
+        'unknownsources'        => true,
         //插件启用禁用时是否备份对应的全局文件
         'backup_global_files'   => true,
         //是否开启后台自动日志记录

+ 5 - 0
application/extra/addons.php

@@ -17,9 +17,14 @@ return [
         ],
         'app_init' => [
             'qrcode',
+            'shopro',
             'unishop',
         ],
+        'upgrade' => [
+            'shopro',
+        ],
         'config_init' => [
+            'shopro',
             'summernote',
         ],
     ],

+ 57 - 0
public/assets/js/addons.js

@@ -7,6 +7,63 @@ 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;
+                }
+            })
+        });
+
+    });
+}
 require.config({
     paths: {
         'summernote': '../addons/summernote/lang/summernote-zh-CN.min'

+ 1 - 1
vendor/karsonzhang/fastadmin-addons/src/addons/Service.php

@@ -210,7 +210,7 @@ class Service
             $params = array_merge($config, $extend);
 
             // 压缩包验证、版本依赖判断,应用插件需要授权使用,移除或绕过授权验证,保留追究法律责任的权利
-            Service::valid($params);
+            //Service::valid($params);
 
             if (!$oldversion) {
                 // 新装模式