This commit is contained in:
全栈小学生 2025-02-17 18:36:32 +08:00
parent 44e7ce9a5d
commit 6648951a28
23 changed files with 346 additions and 8 deletions

View File

@ -1,14 +1,19 @@
<?php
return [
'pages' => <<<EOT
// PAGE_BEGIN
// *********************************** hello world ***********************************
{
"path": "{{addon_name}}/pages/hello_world/index",
"style": {
"navigationBarTitleText": "%{{addon_name}}.pages.hello_world.index%"
// PAGE_BEGIN
// *********************************** {{addon_name}} ***********************************
{
"root": "addon/{{addon_name}}",
"pages": [
{
"path": "pages/hello_world/index",
"style": {
"navigationBarTitleText": "%{{addon_name}}.pages.hello_world.index%"
}
}
},
// PAGE_END
]
},
// PAGE_END
EOT
];

View File

@ -0,0 +1,7 @@
import request from '@/utils/request'
/***************************************************** hello world ****************************************************/
export function getHelloWorld() {
return request.get(`{key}/hello_world`)
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,17 @@
<template>
<span class="text-[20px]">{{hello_world_text}}</span>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { getHelloWorld } from '@/addon/{key}/api/hello_world'
const hello_world_text = ref('');
const getHelloWorldInfo = async () => {
hello_world_text.value = await (await getHelloWorld()).data
}
getHelloWorldInfo()
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,19 @@
<?php
return [
'pages' => <<<EOT
// PAGE_BEGIN
// *********************************** {{addon_name}} ***********************************
{
"root": "addon/{{addon_name}}",
"pages": [
{
"path": "pages/hello_world/index",
"style": {
"navigationBarTitleText": "%{{addon_name}}.pages.hello_world.index%"
}
}
]
},
// PAGE_END
EOT
];

View File

@ -0,0 +1,36 @@
<?php
namespace addon\{key};
/**
* 插件安装之后单独的插件方法
*/
class Addon
{
/**
* 插件安装执行
*/
public function install()
{
return true;
}
/**
* 插件卸载执行
*/
public function uninstall()
{
return true;
}
/**
* 插件升级执行
*/
public function upgrade()
{
return true;
}
}

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\{key}\app\adminapi\controller\hello_world;
use core\base\BaseAdminController;
use think\Response;
class Index extends BaseAdminController
{
/**
* Hello World
* @return Response
*/
public function index()
{
return success('SUCCESS', 'Hello World');
}
}

View File

@ -0,0 +1,4 @@
<?php
return [
];

View File

@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use think\facade\Route;
use app\adminapi\middleware\AdminCheckRole;
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
/**
* {title}
*/
Route::group('{key}', function () {
/***************************************************** hello world ****************************************************/
Route::get('hello_world', 'addon\{key}\app\adminapi\controller\hello_world\Index@index');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
AdminLog::class
]);

View File

@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\{key}\app\api\controller\hello_world;
use core\base\BaseApiController;
use think\Response;
class Index extends BaseApiController
{
/**
* Hello World
* @return Response
*/
public function index()
{
return success('SUCCESS', 'Hello World');
}
}

View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\api\middleware\ApiCheckToken;
use app\api\middleware\ApiLog;
use app\api\middleware\ApiChannel;
use think\facade\Route;
/**
* {title}
*/
Route::group('{key}', function() {
/***************************************************** hello world ****************************************************/
Route::get('hello_world', 'addon\{key}\app\api\controller\hello_world\Index@index');
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, false) //false表示不验证登录
->middleware(ApiLog::class);
Route::group('{key}', function() {
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true) //表示验证登录
->middleware(ApiLog::class);

View File

@ -0,0 +1,4 @@
<?php
return [
];

View File

@ -0,0 +1,12 @@
<?php
return [
'bind' => [
],
'listen' => [
],
'subscribe' => [
],
];

View File

@ -0,0 +1,11 @@
{
"title": "{title}",
"desc": "{desc}",
"key": "{key}",
"version": "{version}",
"author": "{author}",
"type": "{type}",
"support_app": "{support_app}",
"compile":[],
"support_version": "{support_version}"
}

View File

@ -0,0 +1,33 @@
<?php
return [
[
'menu_name' => '{title}',
'menu_key' => '{key}',
'menu_type' => 0,
'icon' => '',
'api_url' => '',
'router_path' => '',
'view_path' => '',
'methods' => '',
'sort' => 100,
'status' => 1,
'is_show' => 1,
'children' => [
[
'menu_name' => '{title}',
'menu_key' => '{key}_hello_world',
'menu_type' => 1,
'icon' => '',
'api_url' => '{key}/hello_world',
'router_path' => '{key}/hello_world',
'view_path' => 'hello_world/index',
'methods' => 'get',
'sort' => 100,
'status' => 1,
'is_show' => 1,
'children' => []
],
]
]
];

View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
/***************************************************** hello world ****************************************************/
export function getHelloWorld() {
return request.get(`{key}/hello_world`)
}

View File

@ -0,0 +1,2 @@
{}

View File

@ -0,0 +1,18 @@
<template>
<text class="text-[20px]">{{helloWorld}}</text>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { getHelloWorld } from '@/addon/{key}/api/hello_world'
import { onLoad } from '@dcloudio/uni-app'
let helloWorld = ref('');
onLoad(() => {
getHelloWorld().then((res) => {
helloWorld.value = res.data
})
})
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,8 @@
/**
* hello world
*/
export function getHelloWorld() {
return request.get('{key}/hello_world')
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,9 @@
{
"pages": {
"{key}": {
"hello_world": {
"index": "hello_world"
}
}
}
}

View File

@ -0,0 +1,6 @@
export default [
{
path: "/{key}/hello_world/index",
component: () => import('~/addon/{key}/pages/hello_world/index.vue')
}
]

View File

@ -0,0 +1,15 @@
<template>
<span class="text-[24px]">{{hello_world_text}}</span>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { getHelloWorld } from '@/addon/{key}/api/hello_world'
const hello_world_text = ref('');
getHelloWorld().then(res => {
hello_world_text.value = res.data;
})
</script>
<style lang="scss" scoped></style>