style(jinja2):修改模板的复用方式

This commit is contained in:
zhengxinonly
2022-05-24 18:53:37 +08:00
parent d54eb4dc3e
commit 9fc2eb0ae3
24 changed files with 2954 additions and 2963 deletions
+23 -23
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@@ -79,43 +79,43 @@
<!-- 依 赖 脚 本 -->
{% include 'admin/common/footer.html' %}
<script>
layui.use(['admin', 'jquery', 'layer', 'popup'], function () {
let admin = layui.admin
let $ = layui.jquery
let layer = layui.layer
let popup = layui.popup
let MODULE_PATH = '/api/v1/rights/'
layui.use(['admin', 'jquery', 'layer', 'popup'], function() {
let admin = layui.admin;
let $ = layui.jquery;
let layer = layui.layer;
let popup = layui.popup;
let MODULE_PATH = '/api/v1/rights/';
// 框架初始化时会读取 根目录下 pear.configs.yml 文件作为初始化配置
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
// 你可以通过 admin.setConfigType 方法修改配置文件类型
admin.setConfigType('json')
admin.setConfigPath(MODULE_PATH + 'configs')
admin.setConfigType('json');
admin.setConfigPath(MODULE_PATH + 'configs');
admin.render()
admin.render();
// 注销实现
admin.logout(function () {
let loading = layer.load()
admin.logout(function() {
let loading = layer.load();
$.ajax({
url: '/passport/logout',
dataType: 'json',
type: 'post',
success: function (result) {
layer.close(loading)
success: function(result) {
layer.close(loading);
if (result.success) {
popup.success(result.message, function () {
location.href = '/admin'
})
return true
popup.success(result.message, function() {
location.href = '/admin';
});
return true;
}
}
})
})
},
});
});
// 初始化消息事件
admin.message()
})
admin.message();
});
</script>
</body>
</html>
+7 -7
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>pear-admin-flask</title>
@@ -154,12 +154,12 @@
<script src="/static/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
})
layui.use(['layer', 'form', 'jquery'], function() {
var $ = layui.jquery;
var layer = layui.layer;
var form = layui.form;
var jquery = layui.jquery;
});
</script>
</body>
</html>
+37 -35
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>登录</title>
@@ -37,20 +37,22 @@
</button>
</div>
</form>
{% include 'admin/common/footer.html' %}
<script>
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function () {
let form = layui.form
let $ = layui.jquery
let layer = layui.layer
let button = layui.button
let popup = layui.popup
let captchaPath = '/passport/getCaptcha'
form.on('submit(login)', function (data) {
<script src="/static/admin/component/layui/layui.js"></script>
<script src="/static/admin/component/pear/pear.js"></script>
<script>
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function() {
let form = layui.form;
let $ = layui.jquery;
let layer = layui.layer;
let button = layui.button;
let popup = layui.popup;
let captchaPath = '/passport/getCaptcha';
form.on('submit(login)', function(data) {
// data 是表单的数据
let loader = layer.load() // 加载按钮
let btn = button.load({ elem: '.login' })
let loader = layer.load(); // 加载按钮
let btn = button.load({elem: '.login'});
$.ajax({
url: '/api/v1/passport/login',
data: JSON.stringify(data.field),
@@ -58,38 +60,38 @@
type: 'post',
dataType: 'json',
// 请求成功之后返回的数据
success: function (result) {
layer.close(loader) // 关闭加载按钮
btn.stop(function () {
success: function(result) {
layer.close(loader); // 关闭加载按钮
btn.stop(function() {
if (result.success) {
popup.success(result.message, function () {
location.href = '/admin'
})
popup.success(result.message, function() {
location.href = '/admin';
});
} else {
popup.failure(result.message, function () {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
})
popup.failure(result.message, function() {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
});
}
})
}
})
return false
})
});
},
});
return false;
});
// 点击按钮更新验证码
$('#captchaImage').click(function () {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
})
$('#captchaImage').click(function() {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
});
// 定时器,定时更新验证码
setInterval(function () {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
}, 30 * 1000)
})
setInterval(function() {
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
}, 30 * 1000);
});
</script>
<script>
if (window !== top) {
top.location.href = location.href
top.location.href = location.href;
}
</script>
</body>
+98 -90
View File
@@ -1,8 +1,12 @@
<!DOCTYPE html>
<html>
<html lang="zh-CN">
<head>
<title>首页</title>
{% include 'admin/common/header.html' %}
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/static/admin/component/pear/css/pear.css"/>
<link rel="stylesheet" href="/static/admin/admin/css/other/console1.css"/>
<!-- 主 题 更 换 -->
@@ -290,124 +294,128 @@
</div>
</div>
</div>
<!--</div>-->
{% include 'admin/common/footer.html' %}
<script src="/static/admin/component/layui/layui.js"></script>
<script src="/static/admin/component/pear/pear.js"></script>
<script>
layui.use(['layer', 'echarts', 'element', 'count'], function () {
layui.use(['layer', 'echarts', 'element', 'count'], function() {
var $ = layui.jquery,
layer = layui.layer,
element = layui.element,
count = layui.count,
echarts = layui.echarts
layer = layui.layer,
element = layui.element,
count = layui.count,
echarts = layui.echarts;
count.up('value1', {
time: 4000,
num: 440.34,
bit: 2,
regulator: 50
})
regulator: 50,
});
count.up('value2', {
time: 4000,
num: 236.30,
bit: 2,
regulator: 50
})
regulator: 50,
});
count.up('value3', {
time: 4000,
num: 634.43,
bit: 2,
regulator: 50
})
regulator: 50,
});
count.up('value4', {
time: 4000,
bit: 2,
num: 373.23,
regulator: 50
})
regulator: 50,
});
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden')
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
var option = {
tooltip: {
trigger: 'axis'
trigger: 'axis',
},
xAxis: [{
type: 'category',
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
axisLine: {
lineStyle: {
color: '#999'
}
}
}],
yAxis: [{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD'
}
},
axisLine: {
show: false,
lineStyle: {
color: '#333'
},
},
nameTextStyle: {
color: '#999'
},
splitArea: {
show: false
}
}],
series: [{
name: '课时',
type: 'line',
data: [23, 60, 20, 36, 23, 85],
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
colorStops: [{
offset: 0,
color: '#A9F387' // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
xAxis: [
{
type: 'category',
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
axisLine: {
lineStyle: {
color: '#999',
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20
}
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: '#A9F387'
}
},
smooth: true
}]
}
echartsRecords.setOption(option)
},
}],
yAxis: [
{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD',
},
},
axisLine: {
show: false,
lineStyle: {
color: '#333',
},
},
nameTextStyle: {
color: '#999',
},
splitArea: {
show: false,
},
}],
series: [
{
name: '课时',
type: 'line',
data: [23, 60, 20, 36, 23, 85],
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
window.onresize = function () {
echartsRecords.resize()
}
colorStops: [
{
offset: 0,
color: '#A9F387', // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF', // 100% 处的颜色
}],
globalCoord: false, // 缺省为 false
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20,
},
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: '#A9F387',
},
},
smooth: true,
}],
};
echartsRecords.setOption(option);
})
window.onresize = function() {
echartsRecords.resize();
};
});
</script>
</body>
</html>