更新插件功能
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
"""
|
||||
初始化插件
|
||||
"""
|
||||
import os
|
||||
|
||||
from flask import Flask
|
||||
from .main import helloworld_blueprint
|
||||
|
||||
# 获取插件所在的目录(结尾没有分割符号)
|
||||
dir_path = os.path.dirname(__file__).replace("\\", "/")
|
||||
folder_name = dir_path[dir_path.rfind("/") + 1:] # 插件文件夹名称
|
||||
|
||||
def event_enable():
|
||||
"""当此插件被启用时会调用此处"""
|
||||
print("启用插件")
|
||||
print(f"启用插件,dir_path: {dir_path} ; folder_name: {folder_name}")
|
||||
|
||||
|
||||
def event_disable():
|
||||
"""当此插件被禁用时会调用此处"""
|
||||
print("禁用插件")
|
||||
print(f"禁用插件,dir_path: {dir_path} ; folder_name: {folder_name}")
|
||||
|
||||
def event_init(app: Flask):
|
||||
"""初始化完成时会调用这里"""
|
||||
|
||||
@@ -2,13 +2,6 @@ from applications.dev import *
|
||||
|
||||
from flask import render_template, Blueprint
|
||||
|
||||
import os
|
||||
import psutil
|
||||
|
||||
# 获取插件所在的目录(结尾没有分割符号)
|
||||
dir_path = os.path.dirname(__file__).replace("\\", "/")
|
||||
folder_name = dir_path[dir_path.rfind("/") + 1:] # 插件文件夹名称
|
||||
|
||||
# 创建蓝图
|
||||
helloworld_blueprint = Blueprint('hello_world', __name__, template_folder='templates', static_folder="static",
|
||||
url_prefix="/hello_world")
|
||||
|
||||
@@ -1 +1,67 @@
|
||||
<h1>Test!</h1>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>pear-admin-flask</title>
|
||||
<meta name="description" content="pear-admin-flask">
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='index/layui/css/layui.css') }}"/>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='index/css/main.css') }}"/>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='index/css/load.css') }}"/>
|
||||
<style>
|
||||
.layui-nav .layui-this:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.layui-nav .layui-nav-bar {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- header -->
|
||||
<div class="ew-header">
|
||||
<img class="layui-logo" src="{{ url_for('static', filename='index/images/un28.svg') }}"
|
||||
style="height:50px;padding: 10px;"/>
|
||||
<div class="ew-nav-group">
|
||||
<div class="nav-toggle"><i class="layui-icon layui-icon-more-vertical"></i></div>
|
||||
<ul class="layui-nav" lay-filter="ew-header-nav">
|
||||
<li class="layui-nav-item">
|
||||
<a lay-href="/">首页</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="/admin" target="_blank">后台</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- banner -->
|
||||
<div class="ew-banner" style="box-shadow: 0 0 8px rgba(0,0,0,.101562);">
|
||||
<div class="layui-container">
|
||||
<div class="layui-row layui-col-space25" style="margin-top: 10px;">
|
||||
<h1>你好世界!这是一个测试页面!</h1>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- js部分 -->
|
||||
<script src="{{ url_for('static', filename='admin/component/layui/layui.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='admin/component/pear/pear.js') }}"></script>
|
||||
|
||||
<script>
|
||||
layui.use(['layer', 'form', 'jquery'], function () {
|
||||
var $ = layui.jquery
|
||||
var layer = layui.layer
|
||||
var form = layui.form
|
||||
var jquery = layui.jquery
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user