From 02c1436e2847f32a9e9f4f5c3c0c0fdf79d67485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E6=A0=88=E5=B0=8F=E5=AD=A6=E7=94=9F?= <1518079521@qq.com> Date: Sat, 20 May 2023 18:29:35 +0800 Subject: [PATCH] addon --- niucloud/addon/hello_world/HelloWorld.php | 36 ++++ .../views/diy/components/edit-hello-info.vue | 31 ++++ .../views/diy/components/edit-hello-text.vue | 31 ++++ .../admin/src/views/hello_world/index.vue | 12 ++ .../admin/src/views/hello_world/site.vue | 12 ++ .../app/adminapi/controller/Index.php | 29 +++ .../hello_world/app/adminapi/route/route.php | 19 ++ .../addon/hello_world/app/api/route/route.php | 1 + .../hello_world/app/enum/diy/components.php | 32 ++++ .../addon/hello_world/app/enum/diy/links.php | 8 + .../addon/hello_world/app/enum/diy/pages.php | 4 + .../addon/hello_world/app/enum/menu/admin.php | 18 ++ .../addon/hello_world/app/enum/menu/site.php | 18 ++ .../hello_world/app/enum/notice/notice.php | 13 ++ .../addon/hello_world/app/enum/notice/sms.php | 7 + .../hello_world/app/enum/notice/weapp.php | 9 + .../hello_world/app/enum/notice/wechat.php | 11 ++ niucloud/addon/hello_world/app/event.php | 16 ++ .../addon/hello_world/app/lang/zh-cn/api.php | 17 ++ .../addon/hello_world/app/lang/zh-cn/enum.php | 20 +++ .../hello_world/app/lang/zh-cn/validate.php | 18 ++ .../app/listener/AppManageListener.php | 48 +++++ .../hello_world/config/admin-package.json | 5 + .../addon/hello_world/config/composer.json | 6 + .../hello_world/config/uni-app-package.json | 5 + .../hello_world/config/uni-app-pages.json | 14 ++ .../addon/hello_world/config/web-package.json | 5 + niucloud/addon/hello_world/info.json | 10 ++ niucloud/addon/hello_world/resource/icon.png | Bin 0 -> 673 bytes niucloud/addon/hello_world/sql/install.sql | 6 + niucloud/addon/hello_world/sql/uninstall.sql | 1 + .../diy/comp-extend/hello-info/index.vue | 24 +++ .../diy/comp-extend/hello-text/index.vue | 24 +++ .../components/diy/comp-extend/index.vue | 20 +++ niucloud/addon/hello_world/uni-app/pages.json | 43 +++++ .../uni-app/pages/hello_world/index.vue | 166 ++++++++++++++++++ 36 files changed, 739 insertions(+) create mode 100644 niucloud/addon/hello_world/HelloWorld.php create mode 100644 niucloud/addon/hello_world/admin/src/views/diy/components/edit-hello-info.vue create mode 100644 niucloud/addon/hello_world/admin/src/views/diy/components/edit-hello-text.vue create mode 100644 niucloud/addon/hello_world/admin/src/views/hello_world/index.vue create mode 100644 niucloud/addon/hello_world/admin/src/views/hello_world/site.vue create mode 100644 niucloud/addon/hello_world/app/adminapi/controller/Index.php create mode 100644 niucloud/addon/hello_world/app/adminapi/route/route.php create mode 100644 niucloud/addon/hello_world/app/api/route/route.php create mode 100644 niucloud/addon/hello_world/app/enum/diy/components.php create mode 100644 niucloud/addon/hello_world/app/enum/diy/links.php create mode 100644 niucloud/addon/hello_world/app/enum/diy/pages.php create mode 100644 niucloud/addon/hello_world/app/enum/menu/admin.php create mode 100644 niucloud/addon/hello_world/app/enum/menu/site.php create mode 100644 niucloud/addon/hello_world/app/enum/notice/notice.php create mode 100644 niucloud/addon/hello_world/app/enum/notice/sms.php create mode 100644 niucloud/addon/hello_world/app/enum/notice/weapp.php create mode 100644 niucloud/addon/hello_world/app/enum/notice/wechat.php create mode 100644 niucloud/addon/hello_world/app/event.php create mode 100644 niucloud/addon/hello_world/app/lang/zh-cn/api.php create mode 100644 niucloud/addon/hello_world/app/lang/zh-cn/enum.php create mode 100644 niucloud/addon/hello_world/app/lang/zh-cn/validate.php create mode 100644 niucloud/addon/hello_world/app/listener/AppManageListener.php create mode 100644 niucloud/addon/hello_world/config/admin-package.json create mode 100644 niucloud/addon/hello_world/config/composer.json create mode 100644 niucloud/addon/hello_world/config/uni-app-package.json create mode 100644 niucloud/addon/hello_world/config/uni-app-pages.json create mode 100644 niucloud/addon/hello_world/config/web-package.json create mode 100644 niucloud/addon/hello_world/info.json create mode 100644 niucloud/addon/hello_world/resource/icon.png create mode 100644 niucloud/addon/hello_world/sql/install.sql create mode 100644 niucloud/addon/hello_world/sql/uninstall.sql create mode 100644 niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-info/index.vue create mode 100644 niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-text/index.vue create mode 100644 niucloud/addon/hello_world/uni-app/components/diy/comp-extend/index.vue create mode 100644 niucloud/addon/hello_world/uni-app/pages.json create mode 100644 niucloud/addon/hello_world/uni-app/pages/hello_world/index.vue diff --git a/niucloud/addon/hello_world/HelloWorld.php b/niucloud/addon/hello_world/HelloWorld.php new file mode 100644 index 000000000..4d94e9096 --- /dev/null +++ b/niucloud/addon/hello_world/HelloWorld.php @@ -0,0 +1,36 @@ + +
+

test信息设置

+ + + + + +
+ + + + + + + \ No newline at end of file diff --git a/niucloud/addon/hello_world/admin/src/views/diy/components/edit-hello-text.vue b/niucloud/addon/hello_world/admin/src/views/diy/components/edit-hello-text.vue new file mode 100644 index 000000000..fd0f02e60 --- /dev/null +++ b/niucloud/addon/hello_world/admin/src/views/diy/components/edit-hello-text.vue @@ -0,0 +1,31 @@ + + + + + + \ No newline at end of file diff --git a/niucloud/addon/hello_world/admin/src/views/hello_world/index.vue b/niucloud/addon/hello_world/admin/src/views/hello_world/index.vue new file mode 100644 index 000000000..51963a943 --- /dev/null +++ b/niucloud/addon/hello_world/admin/src/views/hello_world/index.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/niucloud/addon/hello_world/admin/src/views/hello_world/site.vue b/niucloud/addon/hello_world/admin/src/views/hello_world/site.vue new file mode 100644 index 000000000..405437b34 --- /dev/null +++ b/niucloud/addon/hello_world/admin/src/views/hello_world/site.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/niucloud/addon/hello_world/app/adminapi/controller/Index.php b/niucloud/addon/hello_world/app/adminapi/controller/Index.php new file mode 100644 index 000000000..faba9182e --- /dev/null +++ b/niucloud/addon/hello_world/app/adminapi/controller/Index.php @@ -0,0 +1,29 @@ + [ + 'title' => get_lang('enum_diy.component_type_basics'), + 'list' => [ + 'TestInfo' => [ + 'title' => '测试信息', + 'icon' => 'iconfont-iconhuiyuanzhongxin', + 'path' => 'edit-hello-info', + 'support_page' => [], + 'max_count' => 0, + 'sort' => 10007, + 'value' => [ + 'height' => 20 + ], + ], + 'TestText' => [ + 'title' => '测试文本', + 'icon' => 'iconfont-iconhuiyuanzhongxin', + 'path' => 'edit-hello-text', + 'support_page' => [], + 'max_count' => 0, + 'sort' => 10007, + 'value' => [ + 'height' => 20 + ], + ], + ], + ], + +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/diy/links.php b/niucloud/addon/hello_world/app/enum/diy/links.php new file mode 100644 index 000000000..fc96d30db --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/diy/links.php @@ -0,0 +1,8 @@ + 'HELLO_WORLD_INDEX', + 'title' => get_lang('enum_hello_world.links_hello_world_index'), + ], +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/diy/pages.php b/niucloud/addon/hello_world/app/enum/diy/pages.php new file mode 100644 index 000000000..6dd355233 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/diy/pages.php @@ -0,0 +1,4 @@ + '插件菜单', + 'menu_key' => 'niucloud_hello', + 'menu_type' => 1, + 'icon' => 'iconfont-iconyingyongshichang', + 'api_url' => '', + 'router_path' => 'hello_world', + 'view_path' => 'hello_world/index', + 'methods' => '', + 'sort' => 90, + 'status' => 1, + 'is_show' => 1, + 'en_menu_name' => '', + ], + ]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/menu/site.php b/niucloud/addon/hello_world/app/enum/menu/site.php new file mode 100644 index 000000000..f2843f7a2 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/menu/site.php @@ -0,0 +1,18 @@ + '插件站点菜单', + 'menu_key' => 'niucloud_site_hello', + 'menu_type' => 1, + 'icon' => 'iconfont-iconyingyongshichang', + 'api_url' => '', + 'router_path' => 'hello_world', + 'view_path' => 'hello_world/site', + 'methods' => '', + 'sort' => 90, + 'status' => 1, + 'is_show' => 1, + 'en_menu_name' => '', + ], + ]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/notice/notice.php b/niucloud/addon/hello_world/app/enum/notice/notice.php new file mode 100644 index 000000000..0a9e304d6 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/notice/notice.php @@ -0,0 +1,13 @@ + [ + 'key' => 'hello_world_test', + 'app_type' => 'site', + 'name' => 'hello world消息', + 'title' => 'hello world演示插件消息', + 'variable' =>[ + 'name' => '消息内容' + ], + ], + +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/notice/sms.php b/niucloud/addon/hello_world/app/enum/notice/sms.php new file mode 100644 index 000000000..edc6b7591 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/notice/sms.php @@ -0,0 +1,7 @@ + [ + 'content' => '检测发送信息:{name}', + ] + +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/notice/weapp.php b/niucloud/addon/hello_world/app/enum/notice/weapp.php new file mode 100644 index 000000000..823650272 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/notice/weapp.php @@ -0,0 +1,9 @@ + [ + 'temp_key' => '111', + 'content' => [ + ['消息内容', '{name}', 'keyword1'], + ], + ] +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/enum/notice/wechat.php b/niucloud/addon/hello_world/app/enum/notice/wechat.php new file mode 100644 index 000000000..d309d8ad4 --- /dev/null +++ b/niucloud/addon/hello_world/app/enum/notice/wechat.php @@ -0,0 +1,11 @@ + [ + 'temp_key' => 'OPENTM111', + 'first' => '', + 'content' => [ + ['消息内容', '{name}', 'keyword1'], + ], + 'remark' => '' + ] +]; \ No newline at end of file diff --git a/niucloud/addon/hello_world/app/event.php b/niucloud/addon/hello_world/app/event.php new file mode 100644 index 000000000..072b93c16 --- /dev/null +++ b/niucloud/addon/hello_world/app/event.php @@ -0,0 +1,16 @@ + [ + ], + + 'listen' => [ + + //应用管理 + 'appManage' => ['addon\hello_world\app\listener\AppManageListener'], + ], + + 'subscribe' => [ + ], +]; diff --git a/niucloud/addon/hello_world/app/lang/zh-cn/api.php b/niucloud/addon/hello_world/app/lang/zh-cn/api.php new file mode 100644 index 000000000..64ef6b820 --- /dev/null +++ b/niucloud/addon/hello_world/app/lang/zh-cn/api.php @@ -0,0 +1,17 @@ + 'hello world演示数据', +]; diff --git a/niucloud/addon/hello_world/app/lang/zh-cn/enum.php b/niucloud/addon/hello_world/app/lang/zh-cn/enum.php new file mode 100644 index 000000000..63dcc4b3d --- /dev/null +++ b/niucloud/addon/hello_world/app/lang/zh-cn/enum.php @@ -0,0 +1,20 @@ + [ + //菜单类型 + 'links_hello_world_index' => 'hello world 插件', + ], +]; diff --git a/niucloud/addon/hello_world/app/lang/zh-cn/validate.php b/niucloud/addon/hello_world/app/lang/zh-cn/validate.php new file mode 100644 index 000000000..ac91d1e1f --- /dev/null +++ b/niucloud/addon/hello_world/app/lang/zh-cn/validate.php @@ -0,0 +1,18 @@ + 100, + +]; diff --git a/niucloud/addon/hello_world/app/listener/AppManageListener.php b/niucloud/addon/hello_world/app/listener/AppManageListener.php new file mode 100644 index 000000000..b1889da10 --- /dev/null +++ b/niucloud/addon/hello_world/app/listener/AppManageListener.php @@ -0,0 +1,48 @@ + [ + //插件如果要单独分类展示,需要专门定义 + [ + "key" => "hello_world_category", + "name" => "第三方应用", + ], + ], + [ + "addon" => "hello_world", + "title" => "hello world", + "category" => "hello_world_category", //设置插件对应展示分类,默认basic + "desc" => "hello world 应用展示", + "icon" => addon_resource("hello_world", "icon.png"), //图标 + "cover" => "", //封面 + "url" => "/hello_world" + ], + ]; + return $data; + } +} \ No newline at end of file diff --git a/niucloud/addon/hello_world/config/admin-package.json b/niucloud/addon/hello_world/config/admin-package.json new file mode 100644 index 000000000..ee3152e45 --- /dev/null +++ b/niucloud/addon/hello_world/config/admin-package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@vueuse/core": "^9.12.0" + } +} diff --git a/niucloud/addon/hello_world/config/composer.json b/niucloud/addon/hello_world/config/composer.json new file mode 100644 index 000000000..71cd15d7a --- /dev/null +++ b/niucloud/addon/hello_world/config/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "firebase/php-jwt": "^5.0" + + } +} diff --git a/niucloud/addon/hello_world/config/uni-app-package.json b/niucloud/addon/hello_world/config/uni-app-package.json new file mode 100644 index 000000000..c91f0d264 --- /dev/null +++ b/niucloud/addon/hello_world/config/uni-app-package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "weixin-js-sdk": "^1.6.0" + } +} diff --git a/niucloud/addon/hello_world/config/uni-app-pages.json b/niucloud/addon/hello_world/config/uni-app-pages.json new file mode 100644 index 000000000..fca712b6e --- /dev/null +++ b/niucloud/addon/hello_world/config/uni-app-pages.json @@ -0,0 +1,14 @@ +{ + "pages": [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/hello_world/index", + "style": { + // #ifdef H5 + "navigationStyle": "custom", + // #endif + "navigationBarTitleText": "%pages.index.index%" + } + } + ] + +} \ No newline at end of file diff --git a/niucloud/addon/hello_world/config/web-package.json b/niucloud/addon/hello_world/config/web-package.json new file mode 100644 index 000000000..f3980cca7 --- /dev/null +++ b/niucloud/addon/hello_world/config/web-package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "sass": "^1.60.0" + } +} diff --git a/niucloud/addon/hello_world/info.json b/niucloud/addon/hello_world/info.json new file mode 100644 index 000000000..f2d50b5d7 --- /dev/null +++ b/niucloud/addon/hello_world/info.json @@ -0,0 +1,10 @@ +{ + "title": "hello world", + "desc": "Niucloud hello world演示插件", + "key": "hello_world", + "version": "1.0.1", + "author": "niucloud", + "url": "https://www.niucloud.com", + "type": "addon", + "support_app": "niucloud" +} \ No newline at end of file diff --git a/niucloud/addon/hello_world/resource/icon.png b/niucloud/addon/hello_world/resource/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8dad7331f96a43d4fd77be9779c4cc73214e798c GIT binary patch literal 673 zcmV;S0$%-zP)c7JR3z(kXRWlY}6|8LL>o;8{elM{>|;qI>YXXKG<7scXr;l-@N(W zyjg{7n;g;|N?}xv7P(YixE}L4r!{uu$b6hoS^8G|nHtt`c`WXJo!$-&(_eoW1kH(`;*nGufwO)D4|Hkn=K zWSC7BnL%ch9;yF)W)==FhuIn6D_M}f>zCOq3kM&@q2(+NTJ=~lSXlG748jRz-QM*xG9R zDg6!1lHUU6aFz5XdLf=JnN|CYpJQesa0@8mVoh0hQdO{plxB|h{E00000NkvXX Hu0mjfa$hfE literal 0 HcmV?d00001 diff --git a/niucloud/addon/hello_world/sql/install.sql b/niucloud/addon/hello_world/sql/install.sql new file mode 100644 index 000000000..5464ddfee --- /dev/null +++ b/niucloud/addon/hello_world/sql/install.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS `{{prefix}}hello_world` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='演示插件表'; +INSERT INTO `{{prefix}}hello_world`(`id`, `name`) VALUES (1, '名称'); \ No newline at end of file diff --git a/niucloud/addon/hello_world/sql/uninstall.sql b/niucloud/addon/hello_world/sql/uninstall.sql new file mode 100644 index 000000000..1f1678c70 --- /dev/null +++ b/niucloud/addon/hello_world/sql/uninstall.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `{{prefix}}hello_world`; \ No newline at end of file diff --git a/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-info/index.vue b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-info/index.vue new file mode 100644 index 000000000..34d1158bc --- /dev/null +++ b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-info/index.vue @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-text/index.vue b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-text/index.vue new file mode 100644 index 000000000..675230e9e --- /dev/null +++ b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/hello-text/index.vue @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/index.vue b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/index.vue new file mode 100644 index 000000000..c123926f4 --- /dev/null +++ b/niucloud/addon/hello_world/uni-app/components/diy/comp-extend/index.vue @@ -0,0 +1,20 @@ + + + diff --git a/niucloud/addon/hello_world/uni-app/pages.json b/niucloud/addon/hello_world/uni-app/pages.json new file mode 100644 index 000000000..75f858400 --- /dev/null +++ b/niucloud/addon/hello_world/uni-app/pages.json @@ -0,0 +1,43 @@ +{ + "pages" : [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/hello_world/index", + "style": { + // #ifdef H5 + "navigationStyle": "custom", + // #endif + "navigationBarTitleText": "%pages.hello_world.index%" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#F8F8F8", + "backgroundColorTop": "#F8F8F8", + "backgroundColorBottom": "#F8F8F8" + }, + "tabBar": { + "list": [ + { + "pagePath": "pages/index/index" + }, + { + "pagePath": "pages/article/list" + }, + { + "pagePath": "pages/member/index" + } + ] + }, + "uniIdRouter": {}, + "easycom": { + "custom": { + "^u-(.*)": "uview-plus/components/u-$1/u-$1.vue", + "diy-system-(\W.*)": "@/components/diy/system/$1/index.vue", + "diy-core-(\W.*)": "@/components/diy/core/$1/index.vue", + "diy-(\W.*)": "@/components/diy/$1/index.vue" + } + } +} diff --git a/niucloud/addon/hello_world/uni-app/pages/hello_world/index.vue b/niucloud/addon/hello_world/uni-app/pages/hello_world/index.vue new file mode 100644 index 000000000..85165f697 --- /dev/null +++ b/niucloud/addon/hello_world/uni-app/pages/hello_world/index.vue @@ -0,0 +1,166 @@ + + + + + \ No newline at end of file