First Commit

This commit is contained in:
Administrator
2025-05-12 12:04:42 +08:00
commit 6a5e13974c
1248 changed files with 366157 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
spring:
datasource:
url: jdbc:postgresql://localhost:5432/verich
username: postgres
password: 123456
driver-class-name: org.postgresql.Driver
type: com.zaxxer.hikari.HikariDataSource
hikari:
minimum-idle: 5
connection-test-query: SELECT 1
maximum-pool-size: 2000
auto-commit: true
idle-timeout: 30000
pool-name: SpringBootDemoHikariCP
max-lifetime: 60000
connection-timeout: 30000
sql:
init:
mode: always
continue-on-error: true

View File

@@ -0,0 +1,40 @@
spring:
datasource:
postgre:
jdbc-url: jdbc:postgresql://localhost:5432/verich
username: postgres
password: 123456
driver-class-name: org.postgresql.Driver
type: com.zaxxer.hikari.HikariDataSource
mapper-locations: classpath*:mapper/postgre/*.xml
type-aliases-package: quant.rich.emoney.entity.postgre
hikari:
minimum-idle: 5
connection-test-query: SELECT 1
maximum-pool-size: 2000
auto-commit: true
idle-timeout: 30000
pool-name: SpringBootDemoHikariCP
max-lifetime: 60000
connection-timeout: 30000
sqlite:
jdbc-url: jdbc:sqlite:E:/eclipse-workspace/emoney-auto/src/main/resources/database.db
driver-class-name: org.sqlite.JDBC
mapper-locations: classpath*:mapper/sqlite/*.xml
type-aliases-package: quant.rich.emoney.entity.sqlite
sql:
init:
mode: always
continue-on-error: true
mybatis-plus:
banner: false
mapper-locations:
- classpath*:mapper/postgre/*.xml
- classpath*:mapper/sqlite/*.xml
type-aliases-package:
- quant.rich.emoney.entity.postgre
- quant.rich.emoney.entity.sqlite
type-handlers-package: quant.rich.emoney.mybatis.typehandler
configuration:
map-underscore-to-camel-case: true
default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler

View File

@@ -0,0 +1,110 @@
server:
port: 7790
compression: #开启gzip压缩返回内容大于2k的才会进行压缩
enabled: true
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
min-response-size: 2048
logging.level:
'[quant.rich]': debug
'[org.springframework.security]': info
spring:
cache:
type: redis
redis:
key-prefix: 'emoney-auto:'
use-key-prefix: true
devtools:
restart:
additional-exclude: '**/*.html'
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: Asia/Shanghai
profiles.active: remote
session.timeout: 86400
thymeleaf:
prefix: classpath:/webpage/
suffix: .html
mode: HTML
encoding: UTF-8
cache: false
kaptcha:
border: "no"
image:
width: 130
height: 38
textproducer:
char:
length: 5
font:
color: 35,37,38,80
size: 30
names: Times New Roman,Sans,Microsoft Yahei UI,Consolas
session:
key: code
noise:
color: 35,37,38,80
# 程序默认配置,部分内容可以通过数据库覆写
# 当数据库不存在配置时默认加载文件内配置
emoney-auto-config:
username: admin
password: Em0nY_4u70~!
# emoney settings
emoney-client:
emoney-login-form:
acc-id: emy1730978
acc-type: 1
app-version: 5.0.0
channel-id: 1711
device-name: LIO-AN00
real-ex-identify:
imei:
android-id: 6e530d685bac6e00
mac:
os-finger-print: asus/android_x86/x86:5.1.1/LMY47I/V9.5.3.0.LACCNFA:user/release-keys
guid: 64de523312b56f1ab10c0423d537e2d6
hardware: 970e18b41745962e3d2dc359d81e4602
osVersion: 22
platform: android
product-id: 4
pwd: 777988
softwareType: Mobile
ssid: 0
emoney-anonymous-login-form:
acc-id: d31b7d82cb9c328e7351610bbefcece7
acc-type: 4
app-version: 5.0.0
channel-id: 1711
device-name: DT1901A
real-ex-identify:
imei: 864213083058479
android-id: a892551da95d26fa
mac:
os-finger-print: samsung/star2qltezh/star2qltechn:9/PQ3B.190801.002/G9650ZHU2ARC6:user/release-keys
guid: d31b7d82cb9c328e7351610bbefcece7
hardware: c19d981ba874e7c0f8911bcf575d6a2b
osVersion: 22
platform: android
product-id: 4
pwd:
softwareType: Mobile
ssid: 0
emoney-login-header:
emapp-view-mode: 1
x-android-agent: EMAPP/5.0.0(Android;22)
x-protocol-id: user%2Fauth%2Flogin
authorization:
user-agent: okhttp/3.12.2
emoney-request-header:
emapp-view-mode: 1
x-android-agent: EMAPP/5.0.0(Android;22)
authorization:
user-agent: okhttp/3.12.2

Binary file not shown.

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="quant.rich.emoney.mapper.postgre.EmoneyIndexMapper">
<insert id="insertOrUpdate" parameterType="list">
INSERT INTO emoney_index
(ts_code, trade_date, "value", index_param, index_name, line_name, line_shape, data_period)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.tsCode},
#{item.date},
#{item.value},
#{item.indexParam, typeHandler=quant.rich.data.typehandler.PostgreSQLJsonbTypeHandler},
#{item.indexName},
#{item.lineName},
#{item.lineShape},
#{item.dataPeriod}
)
</foreach>
ON CONFLICT (ts_code, trade_date, data_period, index_name, index_param, line_name ) DO UPDATE SET
ts_code = EXCLUDED.ts_code,
trade_date = EXCLUDED.trade_date,
"value" = EXCLUDED."value",
index_param = EXCLUDED.index_param,
index_name = EXCLUDED.index_name,
line_shape = EXCLUDED.line_shape,
data_period = EXCLUDED.data_period
</insert>
<select id="getLatestTradeDate" resultType="java.util.Date">
SELECT MAX(trade_date) FROM emoney_index
WHERE 1 = 1
AND index_name = #{indexName}
<if test="tsCode != null and tsCode != ''">
AND ts_code = #{tsCode}
</if>
<if test="stockSpan != null">
AND data_period = #{stockSpan.emoneyCode}
</if>
LIMIT 1
</select>
<select id="getEmoneyIndex" resultType="quant.rich.emoney.entity.postgre.EmoneyIndex">
SELECT *, trade_date AS date FROM emoney_index
WHERE
ts_code = #{tsCode}
AND index_name = #{indexName}
AND line_name = #{lineName}
AND data_period = #{stockSpan.emoneyCode}
<if test="startDate != null">
AND trade_date &gt;= #{startDate}
</if>
<if test="endDate != null">
AND trade_date &lt;= #{endDate}
</if>
ORDER BY trade_date ASC
</select>
<select id="getAllMissingDates" resultType="java.util.Date">
SELECT DISTINCT stock_daily.trade_date
FROM stock_daily
WHERE 1 = 1
<if test="stockInfo != null and stockInfo.getTsCode() != null and stockInfo.getTsCode() != ''">
AND stock_daily.ts_code = #{stockInfo.tsCode}
</if>
AND stock_daily.trade_date NOT IN (
SELECT DISTINCT emoney_index.trade_date
FROM emoney_index
WHERE 1 = 1
<if test="stockInfo != null and stockInfo.getTsCode() != null and stockInfo.getTsCode() != ''">
AND emoney_index.ts_code = #{stockInfo.tsCode}
</if>
<if test="indexName != null and indexName != ''">
AND emoney_index.index_name = #{indexName}
</if>
<if test="lineName != null and lineName != ''">
AND emoney_index.line_name = #{lineName}
</if>
)
<if test="stockInfo != null and stockInfo.getListDate() != null">
AND stock_daily.trade_date >= #{stockInfo.listDate}
</if>
<choose>
<when test="stockInfo.getDelistDate() != null">
AND stock_daily.trade_date &lt; #{stockInfo.delistDate}
</when>
<otherwise>
AND stock_daily.trade_date &lt; CURRENT_DATE + INTERVAL '1 DAY'
</otherwise>
</choose>
<if test="startDate != null">
AND stock_daily.trade_date >= #{startDate}
</if>
<if test="endDate != null">
AND stock_daily.trade_date &lt;= #{endDate}
</if>
ORDER BY stock_daily.trade_date ASC
</select>
</mapper>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="quant.rich.emoney.mapper.sqlite.PlanMapper">
</mapper>

View File

@@ -0,0 +1,398 @@
body {
background-color: #f2f2f2
}
.main-nav {
position: fixed;
z-index: 999;
width: 100%;
box-shadow: 0 0px 20px 0 rgb(158 158 158 / 86%);
}
.main-nav+* {
padding-top: 80px;
}
.layadmin-user-login-footer {
position: relative
}
.layui-icon-sm {
font-size: 12px
}
.layui-nav .layui-badge{
position: relative
}
.manage-body {
padding: 80px 18% 0
}
@media screen and (max-width: 960px) {
.manage-body {
padding: 80px 10% 0
}
.submit-toolbar.submit-fixed {
width: calc(80% - 10px)!important
}
}
@media screen and (max-width: 720px) {
.manage-body {
padding: 80px 5% 0
}
.submit-toolbar.submit-fixed {
width: calc(90% - 10px)!important
}
}
.manage-body .layui-table-view {
background-color: white
}
.manage-body>.layui-form {
padding: 18px 50px 1px 10px;background:white;
box-shadow: 0 10px 20px 0 rgba(236,236,236,.86);
border-radius: 5px;
}
h2.manage-title {
font-size: 1.28571em;
margin-bottom: 10px
}
h2.manage-title span {
margin-left: 10px;
padding: 3px 8px;
background: #E9E9E6;
font-size: .8em;
border-radius: 2px;
}
.with-inline-btn {
display: flex; align-items: center;
}
.with-inline-btn>.layui-form-label {
flex-shrink: 0
}
.with-inline-btn>.layui-form-label+.layui-inline {
flex: 1; margin-right: 10px
}
a.operate {
margin-left: 10px;
padding: 3px 8px;
background: #E9E9E6;
font-size: 14px;
border-radius: 2px;
}
a {
color: #467B96;
text-decoration: none;
}
a:hover {
color: #499BC3;
text-decoration: none
}
.manage-index a:hover, .layui-nav a:hover {
text-decoration: none;
}
a.external-link {
margin-left:5px;
color: #aaa;
}
a.external-link:hover {
color: #ddd;
}
.layui-form-label span {
color: #f20;
}
.layui-input.input-bold {
font-weight: bold;
font-size: 15px;
}
a.layui-btn {
text-decoration: none;
}
code {
font-family: Consolas;
}
/* layui-fixed START */
.layui-tab {
margin:0
}
.layui-tab-title, .layui-tab-title .layui-this:after {
height: 36px
}
.layui-tab-title li {
line-height: 36px
}
.layui-tree-icon {
height: 16px;
line-height: 15px;
width: 16px;
}
/* layui-fixed END */
.admin-row-space10>*:not(:last-child) {
margin-bottom: 10px
}
.editormd-fullscreen {
z-index: 99999
}
.outside-the-view {
position:absolute;
top: -999px;
left: -999px;
z-index: -9999
}
.password-visible {
width: 25px;
height: 15px;
position: absolute;
right: 5px;
margin-top: 12px;
top: 1px;
text-align: center;
}
.layui-upload-drag {
padding: 30px 0; width: 100%
}
#file-list, #link-list {
margin-bottom: 10px;
position: relative;
padding: 0;
width: 100%;
border: 1px dashed #e2e2e2;
background-color: #fff;
color: #999;
overflow-x: hidden;
overflow-y: scroll
}#file-list:last-child, #link-list:last-child {
margin-bottom: 0;
}
#file-list>*, #link-list>* {
padding: 10px;
}
#file-list>li>*, #link-list>li>* {
width:inherit;
overflow : hidden;
text-overflow: ellipsis;
display: block;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
word-break: no-wrap
}
#file-list>li>img, #link-list>li>img {
width: 50%; margin: 0 auto
}
#file-list .delete, #link-list .delete {
color: #c62627
}
#file-list .delete:hover, #link-list .delete:hover {
color: #f1494a
}
#file-list>*:not(:last-child), #link-list>*:not(:last-child) {
border-bottom: 1px dashed #e2e2e2;
}
#link-list {
height: 500px;overflow-y:scroll
}
[class*=-list-question] {
padding-left: 5px
}
.op-green, .op-green:hover {
color: #009688
}
.op-light-green, .op-light-green:hover {
color: #5FB878
}
.op-black, .op-black:hover {
color: #393D49
}
.op-dark-blue, .op-dark-blue:hover {
color: #467B96
}
.op-blue, .op-blue:hover {
color: #1E9FFF
}
.op-light-blue, .op-light-blue:hover {
color: #01AAED
}
.op-cyan, .op-cyan:hover {
color: #2F4056
}
.op-yellow, .op-yellow:hover {
color: #FFB800
}
.op-orange, .op-orange:hover {
color:#FF5722
}
.op-brown, .op-brown:hover {
color:#A75612
}
.op-red, .op-red:hover {
color:#F05252
}
.layui-layer.dog {
min-width: 0;
border: none;
border-radius: .5rem;
color: white;
background: black;
box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)
}
.layui-layer.dog i {
margin-right: .5em
}
.layui-layer.dog.success {
background: #0E9F6E
}
.layui-layer.dog.error {
background: #F05252
}
.comment-meta,.comment-author-meta {
font-size: 13px;
color: #999
}
.comment-author-meta {
line-height: 17px
}
.comment-author {
color: #444
}
.comment-author, .comment-email, .comment-ip {
text-overflow: ellipsis; overflow: hidden; white-space: nowrap
}
.comment-action * {
margin-right: 5px
}
.layui-table tr td .hidden-by-mouse {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
pointer-events: none;
}
.layui-table tr:hover td .hidden-by-mouse {
filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false);
opacity: 1;
pointer-events: unset;
}
p.overview>em {
color: #444;
font-size: 2em;
font-style: normal;
font-family: Georgia,serif;
}
#start-link {
margin-bottom: 25px;
overflow: auto;
}
.layui-card-header {
font-weight: bold;
}
#start-link li {
float: left;
margin-right: 1.5em;
}
ul.start-list>li {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
ul.start-list span {
display: inline-block;
margin-right: 4px;
padding-right: 8px;
border-right: 1px solid #ECECEC;
width: 37px;
text-align: right;
color: #999;
}
.badge-draft {
background-color: #ffde89!important;
color: #611414!important;
}
.badge-hidden {
background-color: #99fff6!important;
color: #611414!important;
}
.badge-private {
background-color: #ff9999!important;
color: #611414!important;
}
.badge-encrypted {
color: #F1C40F!important;
background-color: #2C3E50!important;
box-sizing: content-box;
}
/* 覆盖样式:导航下拉菜单 */
.layui-nav-child {
border-radius: 5px;
border: none;
padding: 0
}
/* 覆盖样式blockquote */
blockquote.layui-elem-quote {
border-radius: 5px;
}
.layui-layer-adminRight {
top: 0 !important;
bottom: 0;
box-shadow: 1px 1px 10px rgba(0, 0, 0, .1);
border-radius: 0;
}
.layui-layer>.layui-layer-content {
overflow: visible !important;
}
.layui-anim-rl {
-webkit-animation-name: layui-rl;
animation-name: layui-rl;
}
.layui-anim-rl.layer-anim-close {
-webkit-animation-name: layui-lr;
animation-name: layui-lr
}
@keyframes layui-rl {
from {
transform: translate3d(100%,0,0)
}
to {
transform: translate3d(0,0,0)
}
}
@keyframes layui-lr {
from {
transform: translate3d(0,0,0)
}
to {
transform: translate3d(100%,0,0)
}
}
.submit-toolbar.submit-fixed {
position: fixed;
bottom: 0;
background: white;
width: auto;
margin-bottom: 0;
padding: 15px 0 15px 10px;
margin-left: -10px;
width: 100%;
box-shadow: 0 -34px 23px -30px rgb(225 225 225 / 50%);
width: calc(64% - 10px);
}
.submit-toolbar.submit-static {
position: static
}
.bottom-anchor-before.submit-static {
height: 0
}
.bottom-anchor-before.submit-fixed {
height: 54px
}

View File

@@ -0,0 +1,195 @@
/**
@ Namelayui.cron Cron表达式解析器
@ Author贝哥哥
@ LicenseMIT
*/
/* 样式加载完毕的标识 */
html #layuicss-cron {
display: none;
position: absolute;
width: 1989px;
}
/* 初始化 */
.layui-cron * {
margin: 0;
padding: 0;
}
/* 主体结构 */
.layui-cron,
.layui-cron * {
box-sizing: border-box;
}
.layui-cron {
position: absolute;
z-index: 66666666;
margin: 5px 0;
border-radius: 2px;
font-size: 14px;
-webkit-animation-duration: 0.2s;
animation-duration: 0.2s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
/* .layui-cron-main{width: 272px;} */
.layui-cron-header *,
.layui-cron-content .btn {
transition-duration: .3s;
-webkit-transition-duration: .3s;
}
/* 微微往下滑入 */
@keyframes cron-downbit {
0% {
opacity: 0.3;
transform: translate3d(0, -5px, 0);
}
100% {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
.layui-cron{animation-name: cron-downbit;}
.layui-cron-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;}
/* 主体结构 */
.layui-cron-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
/* 底部结构 */
.layui-cron-footer{position: relative; height: 46px; line-height: 26px; padding: 10px 20px;border-top: 1px solid whitesmoke;}
.layui-cron-footer span{margin-right: 15px; display: inline-block; cursor: pointer; font-size: 12px;}
.layui-cron-footer span:hover{color: #5FB878;}
.cron-footer-btns{position: absolute; right: 10px; top: 10px;}
.cron-footer-btns span{height: 26px; line-height: 26px; margin: 0 0 0 -1px; padding: 0 10px; border: 1px solid #C9C9C9; background-color: #fff; white-space: nowrap; vertical-align: top; border-radius: 2px;}
/* 提示 */
.layui-cron-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;}
/* 默认简约主题 */
.layui-cron, .layui-cron-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;}
.layui-cron-content{border-top: none 0; border-bottom: none 0;}
/* tab */
.layui-cron .layui-tab-card{
border: none;
box-shadow: none;
}
.layui-cron .layui-tab-card > .layui-tab-title li{
min-width: 70px;
margin-left: 0;
margin-right: 0;
}
.layui-cron .layui-tab-content{
padding: 10px;
height: 230px;
overflow-y: scroll;
}
/* form */
.layui-cron .cron-input-mid {
display: inline-block;
vertical-align: middle;
padding: 0 12px;
height: 28px;
line-height: 28px;
box-sizing: border-box;
}
.layui-cron .cron-input {
display: inline-block;
vertical-align: middle;
padding: 0 8px;
background-color: #fff;
border: 1px solid #ccc;
height: 28px;
line-height: 28px;
box-sizing: border-box;
width: 48px;
text-align: right;
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
}
/* 谷歌 */
.layui-cron input::-webkit-outer-spin-button,
.layui-cron input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
/* 火狐 */
.layui-cron input[type="number"]{
-moz-appearance: textfield;
}
.layui-cron .cron-input:focus {
outline: 0;
border: 1px solid #01AAED;
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%), 0 0 4px 0px #01aaed;
translate: 1s;
}
.layui-cron .cron-tips {
color: grey;
line-height: 28px;
height: 28px;
display: inline-block;
vertical-align: middle;
margin-left: 5px;
}
.layui-cron .layui-form-radio{
margin-right: 10px;
}
.layui-cron .cron-row{
display: flex;
align-items: center;
}
.layui-cron .cron-row+.cron-row{
margin-top: 10px;
}
.layui-cron .cron-grid{
display: flex;
flex-wrap: wrap;
align-items: center;
width: 480px;
padding-left: 10px;
padding-top: 4px;
}
.layui-cron .cron-grid .layui-form-checkbox{
padding-left: 22px;
margin-bottom: 4px;
}
.layui-cron .cron-grid .layui-form-checkbox[lay-skin="primary"] span{
padding-right: 13px;
min-width: 29px;
}
/* 提示 */
.layui-cron-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;}
.layui-cron-run-hint{
max-height: 104px;
overflow-y: scroll;
padding: 10px;
padding-top: 0;
}
.cron-run-list+.cron-run-list{
margin-top: 4px;
}

View File

@@ -0,0 +1,87 @@
@keyframes fariy-fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.fairy-tag-container {
width: auto;
min-height: 23px;
padding: 5px;
border: 1px solid #e6e6e6;
background-color: #ffffff;
display: flex;
flex-wrap: wrap;
}
.fairy-tag-container:hover {
border-color: #d2d2d2;
}
.fairy-tag-container span.fairy-tag {
float: left;
font-size: 13px;
padding: 5px 8px;
margin-right: 5px;
margin-bottom: 5px;
border-radius: 2px;
line-height: 16px;
}
.fairy-tag-container span.fairy-tag a {
font-size: 11px;
font-weight: bolder;
color: #ffffff;
text-decoration: none;
margin-left: 6px;
}
.fairy-tag-container span.fairy-tag a:hover {
cursor: pointer;
}
.fairy-tag-container span.fairy-bg-red {
background-color: #FF5722;
}
.fairy-tag-container span.fairy-bg-orange {
background-color: #FFB800;
}
.fairy-tag-container span.fairy-bg-green {
background-color: #009688;
}
.fairy-tag-container span.fairy-bg-cyan {
background-color: #2F4056;
}
.fairy-tag-container span.fairy-bg-blue {
background-color: #1E9FFF;
}
.fairy-tag-container span.fairy-bg-black {
background-color: #393D49;
}
.fairy-tag-container span.fairy-bg-red,
.fairy-tag-container span.fairy-bg-orange,
.fairy-tag-container span.fairy-bg-green,
.fairy-tag-container span.fairy-bg-cyan,
.fairy-tag-container span.fairy-bg-blue,
.fairy-tag-container span.fairy-bg-black {
color: #ffffff;
}
.fairy-tag-container .fairy-anim-fadein {
animation: fariy-fadein 0.3s both;
}
.fairy-tag-container .fairy-tag-input[type='text'] {
font-size: 13px;
padding: 6px;
background: transparent;
border: 0 none;
outline: 0;
}
.fairy-tag-container .fairy-tag-input[type='text']:focus::-webkit-input-placeholder {
color: transparent;
}
.fairy-tag-container .fairy-tag-input[type='text']:focus:-moz-placeholder {
color: transparent;
}
.fairy-tag-container .fairy-tag-input[type='text']:focus:-moz-placeholder {
color: transparent;
}
.fairy-tag-container .fairy-tag-input[type='text']:focus:-ms-input-placeholder {
color: transparent;
}

View File

@@ -0,0 +1,177 @@
// src/main/resources/static/js/cronPicker.js
document.addEventListener('alpine:init', () => {
Alpine.data('cronPicker', () => {
// 1. 定义标签配置
const config = [
{ key:'seconds', title:'秒', range:[0,59], allowUnspec:false },
{ key:'minutes', title:'分', range:[0,59], allowUnspec:false },
{ key:'hours', title:'时', range:[0,23], allowUnspec:false },
{ key:'days', title:'日', range:[1,31], allowUnspec:true },
{ key:'months', title:'月', range:[1,12], allowUnspec:false },
{ key:'weeks', title:'周', range:[0,6], allowUnspec:false },
{ key:'years', title:'年', range:[1970,2099], allowUnspec:true }
];
// 2. 根据 config 预填 fields
const fields = {};
config.forEach(c => {
fields[c.key] = { type:'every', start:null, end:null, rate:1, values:[] };
});
return {
show: false,
cron: '',
activeTab: 0,
config,
fields,
init() {
// 3. 从 input 读取初始值
this.cron = this.$refs.trigger.value || config.map(_=>'*').join(' ');
this.parseCron();
// 4. 注入面板并初始化
this.injectTemplate();
Alpine.initTree(this.$el.querySelector('.cron-panel'));
},
injectTemplate() {
const tpl = `
<div
x-show="show"
@click.away="show = false"
class="cron-panel absolute z-50 mt-1 bg-white shadow-lg rounded-lg"
style="width:360px"
x-cloak
>
<!-- Tabs 列表 -->
<ul class="flex border-b">
<template x-for="(c,i) in config" :key="c.key">
<li class="flex-1 text-center">
<button
type="button"
@click="activeTab = i"
:class="activeTab===i
? 'border-b-2 border-blue-600 text-blue-600'
: 'text-gray-600 hover:text-blue-600'"
class="px-3 py-1 w-full"
><span x-text="c.title"></span></button>
</li>
</template>
</ul>
<!-- 每个 tab 的内容 -->
<div class="p-3 h-64 overflow-auto">
<template x-for="(c,i) in config" :key="c.key">
<!-- x-show 一定要在这里 -->
<div x-show="activeTab===i" class="space-y-3">
<!-- 下面就按你之前的 range / rate / custom 等 -->
<div class="space-x-2">
<label><input type="radio" :name="c.key+'-mode'" value="every" x-model="fields[c.key].type"/> 每次</label>
<label x-show="c.allowUnspec"><input type="radio" :name="c.key+'-mode'" value="unspecified" x-model="fields[c.key].type"/> 不指定</label>
<label><input type="radio" :name="c.key+'-mode'" value="range" x-model="fields[c.key].type"/> 周期</label>
<label><input type="radio" :name="c.key+'-mode'" value="rate" x-model="fields[c.key].type"/> 频率</label>
<label><input type="radio" :name="c.key+'-mode'" value="custom" x-model="fields[c.key].type"/> 指定</label>
</div>
<!-- range 示例 -->
<div x-show="fields[c.key].type==='range'" class="flex items-center space-x-2">
<input type="number" :min="c.range[0]" :max="c.range[1]" x-model.number="fields[c.key].start" class="border rounded w-16 px-1 py-0.5"/>
-
<input type="number" :min="c.range[0]" :max="c.range[1]" x-model.number="fields[c.key].end" class="border rounded w-16 px-1 py-0.5"/>
</div>
<!-- rate、自定义 同理… -->
</div>
</template>
</div>
<!-- Footer -->
<div class="flex justify-end space-x-2 p-2 border-t">
<button type="button" @click="run()" class="px-3 py-1 bg-gray-200 rounded hover:bg-gray-300">运行</button>
<button type="button" @click="confirm()" class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700">确定</button>
</div>
</div>
`;
// 插入到 wrapper div 末尾
this.$el.insertAdjacentHTML('beforeend', tpl);
// 重新扫描整个 wrapper确保所有 x-for/x-show 都被拾取
Alpine.initTree(this.$el);
},
parseCron() {
const parts = this.cron.trim().split(/\s+/);
this.config.forEach((c,i) => {
const v = parts[i] || '*', fld = this.fields[c.key];
if (v==='*') fld.type='every';
else if (v==='?') fld.type='unspecified';
else if (v.includes('-')) {
fld.type='range';
[fld.start, fld.end] = v.split('-').map(Number);
}
else if (v.startsWith('*/')) {
fld.type='rate';
fld.rate = Number(v.slice(2));
}
else {
fld.type='custom';
fld.values = v.split(',').map(Number);
}
});
},
confirm() {
// 遍历所有字段,先做校验
for (const c of this.config) {
const f = this.fields[c.key];
if (f.type === 'range') {
if (f.start == null || f.end == null || f.start === '' || f.end === '') {
alert(`请填写 “${c.title}” 的周期范围`);
// 切换到出问题的标签页
this.activeTab = this.config.findIndex(x => x.key === c.key);
return;
}
// 校验 start <= end
if (f.start > f.end) {
alert(`${c.title}” 的开始值不能大于结束值`);
this.activeTab = this.config.findIndex(x => x.key === c.key);
return;
}
}
if (f.type === 'rate') {
if (f.rate == null || f.rate === '' || isNaN(f.rate) || f.rate <= 0) {
alert(`请填写 “${c.title}” 的频率值`);
this.activeTab = this.config.findIndex(x => x.key === c.key);
return;
}
}
if (f.type === 'custom') {
if (!f.values.length) {
alert(`请至少选择一个 “${c.title}” 的值`);
this.activeTab = this.config.findIndex(x => x.key === c.key);
return;
}
}
}
// 校验通过后再拼接
const parts = this.config.map(c => {
const f = this.fields[c.key];
switch(f.type) {
case 'every': return '*';
case 'unspecified': return '?';
case 'range': return `${f.start}-${f.end}`;
case 'rate': return `*/${f.rate}`;
case 'custom': return f.values.sort((a,b)=>a-b).join(',');
}
});
this.cron = parts.join(' ');
this.$refs.trigger.value = this.cron;
this.show = false;
},
run() {
console.log('Run cron →', this.cron);
// 可调用后端接口测试
}
};
});
});

View File

@@ -0,0 +1,95 @@
// toast.js - 自包含模块,自动注入 HTML + 提供 toastModule.show() 接口
(function () {
// 注入 HTML 模板Alpine 控制 + Tailwind 样式)
function injectTemplate() {
if (document.getElementById('toast-container')) return;
const div = document.createElement('div');
div.id = 'toast-container';
div.innerHTML = `
<div class="fixed top-5 left-1/2 transform -translate-x-1/2 z-50"
x-data="toastAlpine()"
x-init="init()"
x-show="show"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="-translate-y-full opacity-0"
x-transition:enter-end="translate-y-0 opacity-100"
x-transition:leave="transition ease-in duration-300"
x-transition:leave-start="translate-y-0 opacity-100"
x-transition:leave-end="-translate-y-full opacity-0"
style="display: none">
<div class="flex items-center p-4 text-sm text-white rounded-lg shadow-md"
:class="type === 'success' ? 'bg-green-500' : 'bg-red-500'">
<i class="mr-2"
:class="type === 'success' ? 'fa-solid fa-circle-check' : 'fa-solid fa-circle-exclamation'"></i>
<span x-text="message"></span>
</div>
</div>
`;
document.body.appendChild(div);
}
// 注入 Alpine 方法
window.toastAlpine = function () {
return {
show: false,
message: '',
type: 'error',
init() {
window.addEventListener('toast', (e) => {
const { message, type, duration, onClose } = e.detail;
this.message = message;
this.type = type || 'error';
this.show = true;
setTimeout(() => {
this.show = false;
setTimeout(() => {
if (typeof onClose === 'function') onClose();
}, 300); // 动画时间
}, duration || 2000);
});
}
};
};
// 提供统一接口
window.toastModule = {
show({ message, type = 'error', duration = 2000, onClose = null }) {
window.dispatchEvent(new CustomEvent('toast', {
detail: { message, type, duration, onClose }
}));
},
success({message, duration, onClose}) {
this.show({message, type: 'success', duration, onClose})
},
error({message, duration, onClose}) {
this.show({message, type: 'error', duration, onClose})
},
errorLayer({msg, time, onClose}) {
layui.layer.msg(
'<i class="fa-solid fa-circle-exclamation"></i>' + msg, {
offset: '15px',
anim: 'slideDown',
time: time,
skin: 'giggity error',
end: onClose
})
},
successLayer({msg, time, onClose}) {
layui.layer.msg(
'<i class="fa-solid fa-circle-check"></i>' + msg, {
offset: '15px',
anim: 'slideDown',
time: time,
skin: 'giggity success',
end: onClose
})
}
};
// 注入模板
injectTemplate();
})();

View File

@@ -0,0 +1,25 @@
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1617002985516'); /* IE9 */
src: url('iconfont.eot?t=1617002985516#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAANIAAsAAAAAB5wAAAL8AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqCeIJWATYCJAMMCwgABCAFhG0HQhuoBsiemjwpAdlGiI+VEhsDcIJ4oNZe397u3ecgqQJJxPFAOB4AVYQuoFAs2VezzEQ2f3JNUwS5cUauxGpECuEhSb+Pl6bkBqwrzKoGqMQ0kJtcAwTQTq8Rm4vDaXP52G9ZbmtN2xh1AcYBBboHtskKZAEGgA1jV17EfgKqRoSYVk/OLwGnxBgWEE5IhAPOVEySWLEsKErmJuGhXDm7lX0CPPCfH/5JVCaTR8bYNYcmRDD80//ncLzYvGiHiyAfzwO2iIhZgETYVerbwhLmZrGoKhqrWg8UkiAbK9ls4stUQ7HSP15GKBildTANarOTkttiAn8OSyET0VD0KJwFPITYrkiu1GaQ2qzfVC6fObirtd+56QbN62rb7dsgjWhlcJHSMoppWLq8db4zl9fxZ7nDhuZ+97Kpdudpr2X0SXW7R3Wz/Yu2rfu3ebLWeHIzkFW3+7NsbFujrX6joZ5qoXGj3l7/jzMT9WAjId/EWxC91+Pt3vz4Bd81ND422l69XHp589HwtfPmi+MNUy2va1hzWalcpVuZ1ls6vAr407gJTs0b7xofSu6C0RvjgW+oYQ+A5uJYbPiFx9dx9j96jacF5X23dfF42ZPAjxutPzDaXNLeoXwH/sAfkbdsSqrSsMcky2yZjoxGx/1aVdWgJiPU4be/obt1KUFZdwyZkmGIyiYhE3ZWPFezn1IKZcsgVM00tbimE2URUgUznAAI2jxBpsUbiNq8IhP2B3I9/qHQVoSqTaFzzZopHXWvoohjSIR8A0qCrmHLydxB+QIiFYWjSaXPW0G0LCVhPBLLFqeQhugYE8pVkmAMQ0x1FU6Cw5Ci6NCgegkJLFJkzChEo7jsThFBV4HbKhTCYRARxGuAJAKdBrvtGXfu8QsQokLBoTUNFckVCFUmdQ/FRcRaIKd0WquGazmmrIpIYBgMwiidCpoEvRCFQgcZ5b1KEAETUeyRMRREzVa4rS4yv0F9vh1QZYyJIQsxJOUjFU4rWtOJ76AoMZ2GDY5IGgEA') format('woff2'),
url('iconfont.woff?t=1617002985516') format('woff'),
url('iconfont.ttf?t=1617002985516') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1617002985516#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-huanhang:before {
content: "\e60e";
}
.icon-editor-paging:before {
content: "\e967";
}

View File

@@ -0,0 +1 @@
!function(e){var t,n,a,o,i,l,d='<svg><symbol id="icon-huanhang" viewBox="0 0 1024 1024"><path d="M46.802824 37.647059a30.117647 30.117647 0 0 1 30.117647-30.117647h903.529411a30.117647 30.117647 0 0 1 30.117647 30.117647v4.035765a30.117647 30.117647 0 0 1-30.117647 30.117647h-903.529411a30.117647 30.117647 0 0 1-30.117647-30.117647V37.647059zM46.802824 294.671059a30.117647 30.117647 0 0 1 30.117647-30.117647h903.529411a30.117647 30.117647 0 0 1 30.117647 30.117647v3.975529a30.117647 30.117647 0 0 1-30.117647 30.117647h-903.529411a30.117647 30.117647 0 0 1-30.117647-30.117647v-3.975529zM46.802824 551.634824a30.117647 30.117647 0 0 1 30.117647-30.117648h765.831529a30.117647 30.117647 0 0 1 30.117647 30.117648v4.035764a30.117647 30.117647 0 0 1-30.117647 30.117647H76.920471a30.117647 30.117647 0 0 1-30.117647-30.117647v-4.035764zM46.802824 808.658824a30.117647 30.117647 0 0 1 30.117647-30.117648h352.798117a30.117647 30.117647 0 0 1 30.117647 30.117648v4.035764a30.117647 30.117647 0 0 1-30.117647 30.117647H76.920471a30.117647 30.117647 0 0 1-30.117647-30.117647v-4.035764z" fill="#666666" ></path><path d="M971.836235 521.517176a30.117647 30.117647 0 0 0-30.117647 30.117648v196.788705a30.117647 30.117647 0 0 1-30.117647 30.117647h-176.368941v-128.481882l-176.007529 136.854588a30.117647 30.117647 0 0 0 0 47.525647l176.007529 136.854589v-128.481883h245.217882a30.117647 30.117647 0 0 0 30.117647-30.117647V551.634824a30.117647 30.117647 0 0 0-30.117647-30.117648h-8.613647z" fill="#666666" ></path></symbol><symbol id="icon-editor-paging" viewBox="0 0 1024 1024"><path d="M80.76 508.875h107.993v53.996H80.758v-53.996z m161.99 0h161.992v53.996H242.75v-53.996z m215.99 0h107.993v53.996H458.74v-53.996z m161.992 0h161.99v53.996h-161.99v-53.996z m215.988 0h107.993v53.996H836.72v-53.996z m-0.66-431.74l0.66 377.742H188.753l-1.01-377.741 54.915-0.194 0.091 323.937h539.974l-0.22-323.743h53.559z m-648.22 863.13l0.913-323.398 647.308-0.081v324.062h-53.752l0.413-269.982H242.75l0.102 269.4H187.84z" ></path></symbol></svg>',c=(c=document.getElementsByTagName("script"))[c.length-1].getAttribute("data-injectcss");if(c&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(e){console&&console.log(e)}}function h(){i||(i=!0,a())}t=function(){var e,t,n,a;(a=document.createElement("div")).innerHTML=d,d=null,(n=a.getElementsByTagName("svg")[0])&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",e=n,(t=document.body).firstChild?(a=e,(n=t.firstChild).parentNode.insertBefore(a,n)):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(n=function(){document.removeEventListener("DOMContentLoaded",n,!1),t()},document.addEventListener("DOMContentLoaded",n,!1)):document.attachEvent&&(a=t,o=e.document,i=!1,(l=function(){try{o.documentElement.doScroll("left")}catch(e){return void setTimeout(l,50)}h()})(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,h())})}(window);

View File

@@ -0,0 +1,23 @@
{
"id": "",
"name": "",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "12719940",
"name": "换行",
"font_class": "huanhang",
"unicode": "e60e",
"unicode_decimal": 58894
},
{
"icon_id": "19912079",
"name": "editor-paging",
"font_class": "editor-paging",
"unicode": "e967",
"unicode_decimal": 59751
}
]
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="huanhang" unicode="&#58894;" d="M46.802824 858.352941a30.117647 30.117647 0 0 0 30.117647 30.117647h903.529411a30.117647 30.117647 0 0 0 30.117647-30.117647v-4.035765a30.117647 30.117647 0 0 0-30.117647-30.117647h-903.529411a30.117647 30.117647 0 0 0-30.117647 30.117647V858.352941zM46.802824 601.328941a30.117647 30.117647 0 0 0 30.117647 30.117647h903.529411a30.117647 30.117647 0 0 0 30.117647-30.117647v-3.975529a30.117647 30.117647 0 0 0-30.117647-30.117647h-903.529411a30.117647 30.117647 0 0 0-30.117647 30.117647v3.975529zM46.802824 344.365176a30.117647 30.117647 0 0 0 30.117647 30.117648h765.831529a30.117647 30.117647 0 0 0 30.117647-30.117648v-4.035764a30.117647 30.117647 0 0 0-30.117647-30.117647H76.920471a30.117647 30.117647 0 0 0-30.117647 30.117647v4.035764zM46.802824 87.341176a30.117647 30.117647 0 0 0 30.117647 30.117648h352.798117a30.117647 30.117647 0 0 0 30.117647-30.117648v-4.035764a30.117647 30.117647 0 0 0-30.117647-30.117647H76.920471a30.117647 30.117647 0 0 0-30.117647 30.117647v4.035764zM971.836235 374.482824a30.117647 30.117647 0 0 1-30.117647-30.117648v-196.788705a30.117647 30.117647 0 0 0-30.117647-30.117647h-176.368941v128.481882l-176.007529-136.854588a30.117647 30.117647 0 0 1 0-47.525647l176.007529-136.854589v128.481883h245.217882a30.117647 30.117647 0 0 1 30.117647 30.117647V344.365176a30.117647 30.117647 0 0 1-30.117647 30.117648h-8.613647z" horiz-adv-x="1024" />
<glyph glyph-name="editor-paging" unicode="&#59751;" d="M80.76 387.125h107.993v-53.996H80.758v53.996z m161.99 0h161.992v-53.996H242.75v53.996z m215.99 0h107.993v-53.996H458.74v53.996z m161.992 0h161.99v-53.996h-161.99v53.996z m215.988 0h107.993v-53.996H836.72v53.996z m-0.66 431.74l0.66-377.742H188.753l-1.01 377.741 54.915 0.194 0.091-323.937h539.974l-0.22 323.743h53.559z m-648.22-863.13l0.913 323.398 647.308 0.081v-324.062h-53.752l0.413 269.982H242.75l0.102-269.4H187.84z" horiz-adv-x="1024" />
</font>
</defs></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,26 @@
function InitDog() {
const dog = {};
dog.error = ({msg = '服务器错误', time = 2000, onClose}) => {
return layui.layer.msg(
'<i class="fa-solid fa-circle-exclamation"></i>' + msg, {
offset: '15px',
anim: 'slideDown',
time: time,
skin: 'dog error',
end: onClose
})
};
dog.success = ({msg = '操作成功', time = 2000, onClose}) => {
return layui.layer.msg(
'<i class="fa-solid fa-circle-check"></i>' + msg, {
offset: '15px',
anim: 'slideDown',
time: time,
skin: 'dog success',
end: onClose
})
}
return dog;
}
const Dog = window.Dog = InitDog();

View File

@@ -0,0 +1 @@
window.editormd&&(editormd.fn.setToolbarAutoFixed=function(a){var b,c=this.state,d=this.editor,e=this.toolbar,f=this.settings;return"undefined"!=typeof a&&(f.toolbarAutoFixed=a),b=function(){var a,b=$(window),c=b.scrollTop();return f.toolbarAutoFixed?(c-d.offset().top>10&&c<d.height()?(a=(b.width()-d.width())/2+"px",$(".layui-form").length&&(a=$(".layui-form").position().left+1+"px"),e.css({position:"fixed",width:d.width()+"px",left:a})):e.css({position:"absolute",width:"100%",left:0}),void 0):!1},!c.fullscreen&&!c.preview&&f.toolbar&&f.toolbarAutoFixed&&$(window).bind("scroll resize",b),this});

View File

@@ -0,0 +1,14 @@
if (!window.Helper) {window.Helper = {}}
window.Helper = {
emoneyPeriodToName: function(x) {
if (x < 10000) return `${x} 分钟`;
if (x == 10000) return '日线';
if (x == 20000) return '周线';
if (x == 30000) return '月线';
if (x == 40000) return '季线';
if (x == 50000) return '半年线';
if (x == 60000) return '年线';
},
allEmoneyPeriods: [1, 5, 15, 30, 60, 120, 10000, 20000, 30000, 40000, 50000, 60000]
}

View File

@@ -0,0 +1,266 @@
/*
Copyright © Doghole 2021 - 9999
License: MIT
You can compress it and remove comments below,
but the copyright and the license must be left.
@see https://daringfireball.net/projects/markdown/syntax
*/
var LinkSync = function() {
var LinkType = {
UNKNOWN: 'unknown', IMAGE: 'image', LINK: 'link'
}, that = this;
var f = {
regs : {
ref: {
/**
This pattern matches reference images or links:
1. ![alt as refName]
2. ![alt as refName][]
3. ![alt][refName]
4. [text as refName]
5. [text as refName][]
6. [text][refName]
In 1, 2, 4 and 5 cases, alt/text and refName
are same. For example, the reference image
element is:
![firework]
Then there should be a reference target like:
[firework]: /firework.jpg
^ notice here is the refName
And the final rendered html will be like:
<img src="/firework.jpg" target="_blank" alt="firework">
^ and here is the alt
*/
exp:/(!)?\[(.*?)\](\[(.*?)\])?(?!(: ((([^<>\s]+)|\<(\S+)\>)\s*("(.*?)"|'(.*?)'|\((.*?)\))?\s*$)|\(.*?\)))/gm,
match: function(text){
var that = this, results = [], m = text.match(that.exp) || [];
$.each(m, function(i, v){
var e = that.exp.exec(v),t;
!!e && (t = {
text: v,
scheme: 'ref',
linkType: e[1] == '!' ? LinkType.IMAGE : LinkType.LINK,
name: e[2],
refName: e[4] || e[2],
index: function(){
for(var j = results.length - 1; j >= 0; j--) {
if (results[j].text == v) {
return text.indexOf(v, results[j].index + 1)
}
}
return text.indexOf(v)
}()
},
t.selector = function(){
var sub = text.substring(0, t.index),
m = sub.match(/\n/g),
line = !!m?m.length:0,
ch0 = t.index - sub.lastIndexOf('\n') - 1,
ch1 = ch0 + t.text.length;
return [{line: line, ch: ch0}, {line: line, ch: ch1}]
}(), results.push(t))
that.exp.lastIndex = 0
})
return results;
}
},
refTarget: {
/**
This pattern matches several targets below:
[refName]: url "title(optional)"
[refName]: url 'title(optional)'
[refName]: url (title(optional))
Notice that the title is optional, and may
bracketed by single quotes, double quotes
or round brackets.
Sometimes the url may be bracketed by angle
brackets like below:
[refName]: <url> "title(optional)"
If the url is too long, author may take a
new line to place the title:
[refName]: url
"title(optional)"
*/
exp: /^\s{2,}(\[(.*?)\]: (([^<>\s]+)|\<(\S+)\>)\s*("(.*?)"|'(.*?)'|\((.*?)\))?\s*)$/gm,
match: function(text) {
var that = this, results = {}, m = text.match(that.exp) || [], t;
$.each(m, function(i, v){
var e = that.exp.exec(v);
!!e && (t = {
text: e[1],
scheme: 'refTarget',
refName: e[2],
url: e[4] || e[5],
title: e[7] || e[8] || e[9],
index: text.lastIndexOf(e[1])
},
t.selector = function(){
var sub = text.substring(0, t.index),
m = sub.match(/\n/g),
line = !!m?m.length:0,
ch0 = t.index - sub.lastIndexOf('\n') - 1,
ch1 = ch0 + t.text.length;
return [{line: line, ch: ch0}, {line: line, ch: ch1}]
}(), results[e[2].toLowerCase()] = t)
that.exp.lastIndex = 0
})
return results;
}
},
direct: {
exp: /((!)?\[(.*?)\]\((\S+)\s*("(.*?)"|'(.*?)'|\((.*?)\))?\))|<(https?:\/\/.*?)>/gmi,
match: function(text){
var that = this, results = [], m = text.match(that.exp) || [], t;
$.each(m, function(i, v){
var e = that.exp.exec(v);
!!e && (t = {
text: v,
scheme: 'direct',
linkType: e[2] == '!' ? LinkType.IMAGE : LinkType.LINK,
name: e[3] || e[9],
url: e[4],
title: e[6] || e[7] || e[8] || e[9],
index: function(){
for(var j = results.length - 1; j >= 0; j--) {
if (results[j].text == v) {
return text.indexOf(v, results[j].index + 1)
}
}
return text.indexOf(v)
}()
},
t.selector = function(){
var sub = text.substring(0, t.index),
m = sub.match(/\n/g),
line = !!m?m.length:0,
ch0 = t.index - sub.lastIndexOf('\n') - 1,
ch1 = ch0 + t.text.length;
return [{line: line, ch: ch0}, {line: line, ch: ch1}]
}(),
results.push(t))
that.exp.lastIndex = 0
})
return results;
}
},
code: {
exp: /(\s{0,3}```([\s\S]*?)```)|([^`]`([^`]*?)`[^`])/gm,
match: function(text) {
var that = this, results = [], m = text.match(that.exp) || [];
$.each(m, function(i, v){
var e = that.exp.exec(v);
!!e && (t = {
text: v,
scheme: 'code',
start: function(){
for(var j = results.length - 1; j >= 0; j--) {
if (results[j].text == v) {
return text.indexOf(v, results[j].index + 1)
}
}
return text.indexOf(v)
}()
}, t.end = t.start + v.length, results.push(t))
that.exp.lastIndex = 0
})
return results;
}
},
imgTag: {
exp:/<img .*?\/?(><\/img)?>/gmi,
match: function(text){
var that = this, results = [], m = text.match(that.exp) || [];
$.each(m, function(i, v){
var e = that.exp.exec(v),o,t;
!!e && (o = $(e[0]), a = o.attr('title') || o.attr('alt') || 'None', t = {
text: e[0],
scheme: 'ref',
linkType: LinkType.IMAGE,
name: a,
url: o.attr('src'),
refName: a,
index: function(){
for(var j = results.length - 1; j >= 0; j--) {
if (results[j].text == v) {
return text.indexOf(v, results[j].index + 1)
}
}
return text.indexOf(v)
}()
},
t.selector = function(){
var sub = text.substring(0, t.index),
m = sub.match(/\n/g),
line = !!m?m.length:0,
ch0 = t.index - sub.lastIndexOf('\n') - 1,
ch1 = ch0 + t.text.length;
return [{line: line, ch: ch0}, {line: line, ch: ch1}]
}(), results.push(t))
that.exp.lastIndex = 0
})
return results;
}
}
},
matchRefs : function(refs, refTargets) {
var results = [];
$.each(refs, function(i, ref){
var refTarget = refTargets[ref.refName.toLowerCase()];
!!refTarget && (ref.url = refTarget.url, ref.title = refTarget.title, ref.target = refTarget, results.push(ref))
})
return results;
},
checkRefs : function(refs, codes) {
var results = [];
$.each(refs, function(i, ref){
for(var j = 0; j < codes.length; j++){
var code = codes[j];
if (ref.index >= code.start && ref.index + ref.text.length <= code.end) {
return true;
}
}
results.push(ref);
})
return results;
},
list: function(text) {
if (!text) {
return null;
}
// Match reference target first
var refTargets = f.regs.refTarget.match(text),
refs = f.regs.ref.match(text),
directs = f.regs.direct.match(text),
imgTags = f.regs.imgTag.match(text),
codes = f.regs.code.match(text);
refs = f.matchRefs(refs, refTargets);
refs = refs.concat(directs);
refs = refs.concat(imgTags);
//for(var i = 0; i < directs.length; i++){
// refs.push(directs[i]);
//}
refs = f.checkRefs(refs, codes);
return refs.sort(function(a,b){return a.index-b.index});
}
}
return {
list: f.list,
regs: f.regs
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 326 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,144 @@
/*!
* 全局配置
*/
layui.define(['laytpl', 'layer', 'element', 'util'], function(exports){
exports('setter', {
container: 'LAY_app' //容器ID
,base: layui.cache.base //记录静态资源所在路径
,views: layui.cache.base + 'tpl/' //动态模板所在目录
,entry: 'index' //默认视图文件名
,engine: '.html' //视图文件后缀名
,pageTabs: true //是否开启页面选项卡功能。iframe版推荐开启
,name: 'layuiAdmin'
,tableName: 'layuiAdmin' //本地存储表名
,MOD_NAME: 'admin' //模块事件名
,debug: true //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
//自定义请求字段
,request: {
tokenName: false //自动携带 token 的字段名access_token。可设置 false 不携带。
}
//自定义响应字段
,response: {
statusName: 'code' //数据状态的字段名称
,statusCode: {
ok: 0 //数据状态一切正常的状态码
,logout: 1001 //登录状态失效的状态码
}
,msgName: 'msg' //状态信息的字段名称
,dataName: 'data' //数据详情的字段名称
}
//扩展的模块(相对于 lib/extend 目录)
,extend: {
echarts: 'echarts', //第三方 echarts 核心包
echartsTheme: 'echartsTheme', //第三方 echarts 主题
layim: 'layim/layim' //layim
}
//主题配置
,theme: {
//内置主题配色方案
color: [{
main: '#20222A' //主题色
,selected: '#009688' //选中色
,alias: 'default' //默认别名
},{
main: '#03152A'
,selected: '#3B91FF'
,alias: 'dark-blue' //藏蓝
},{
main: '#2E241B'
,selected: '#A48566'
,alias: 'coffee' //咖啡
},{
main: '#50314F'
,selected: '#7A4D7B'
,alias: 'purple-red' //紫红
},{
main: '#344058'
,logo: '#1E9FFF'
,selected: '#1E9FFF'
,alias: 'ocean' //海洋
},{
main: '#3A3D49'
,logo: '#2F9688'
,selected: '#5FB878'
,alias: 'green' //墨绿
},{
main: '#20222A'
,logo: '#F78400'
,selected: '#F78400'
,alias: 'red' //橙色
},{
main: '#28333E'
,logo: '#AA3130'
,selected: '#AA3130'
,alias: 'fashion-red' //时尚红
},{
main: '#24262F'
,logo: '#3A3D49'
,selected: '#009688'
,alias: 'classic-black' //经典黑
},{
logo: '#226A62'
,header: '#2F9688'
,alias: 'green-header' //墨绿头
},{
main: '#344058'
,logo: '#0085E8'
,selected: '#1E9FFF'
,header: '#1E9FFF'
,alias: 'ocean-header' //海洋头
},{
header: '#393D49'
,alias: 'classic-black-header' //经典黑头
},{
main: '#50314F'
,logo: '#50314F'
,selected: '#7A4D7B'
,header: '#50314F'
,alias: 'purple-red-header' //紫红头
},{
main: '#28333E'
,logo: '#28333E'
,selected: '#AA3130'
,header: '#AA3130'
,alias: 'fashion-red-header' //时尚红头
},{
main: '#28333E'
,logo: '#009688'
,selected: '#009688'
,header: '#009688'
,alias: 'green-header' //墨绿头
},{
main: '#393D49'
,logo: '#393D49'
,selected: '#009688'
,header: '#23262E'
,alias: 'Classic-style1' //经典风格1
},{
main: '#001529'
,logo: '#001529'
,selected: '#1890FF'
,header: '#1890FF'
,alias: 'Classic-style2' //经典风格2
},{
main: '#25282A'
,logo: '#25282A'
,selected: '#35BDB2'
,header: '#35BDB2'
,alias: 'Classic-style3' //经典风格3
}]
//初始的颜色索引,对应上面的配色方案数组索引
//如果本地已经有主题色记录则以本地记录为优先除非请求本地数据localStorage
,initColorIndex: 0
}
});
});

View File

@@ -0,0 +1,36 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"prograss": "开会"
,"time": "一小时"
,"complete": "已完成"
,"LAY_CHECKED": true
},{
"prograss": "项目开发"
,"time": "两小时"
,"complete": "进行中"
,"LAY_CHECKED": true
},{
"prograss": "陪吃饭"
,"time": "一小时"
,"complete": "未完成"
},{
"prograss": "修改小bug"
,"time": "半小时"
,"complete": "未完成"
},{
"prograss": "修改大bug"
,"time": "两小时"
,"complete": "未完成"
},{
"prograss": "修改小bug"
,"time": "半小时"
,"complete": "未完成"
},{
"prograss": "修改大bug"
,"time": "两小时"
,"complete": "未完成"
}]
}

View File

@@ -0,0 +1,76 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": 111
,"title": "热帖测试"
,"username": "test"
,"channel": "公告"
,"href": "http://www.baidu.com/jie/15697/"
,"crt": 61632
},{
"id": 222
,"title": "一周年"
,"username": "猫吃"
,"channel": "讨论"
,"href": "http://www.baidu.com/jie/16622/"
,"crt": 61632
},{
"id": 333
,"title": "四个月的前端"
,"username": "fd"
,"channel": "分享"
,"href": "http://www.baidu.com/jie/16651/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
},{
"id": 333
,"title": "如何评价前端 UI 框架"
,"username": "纸飞机"
,"channel": "提问"
,"href": "http://www.baidu.com/jie/9352/"
,"crt": 61632
}]
}

View File

@@ -0,0 +1,46 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"keywords": "UI"
,"frequency": 8520
,"userNums": 2216
},{
"keywords": "layer 弹出层组件"
,"frequency": 666
,"userNums": 333
},{
"keywords": "此表格是静态模拟数据"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
},{
"keywords": "前端 UI"
,"frequency": 666
,"userNums": 333
}]
}

View File

@@ -0,0 +1,56 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"reviewers": "赵"
,"content": "我又爱上编程了"
,"commtime": 20160312
},{
"id": "002"
,"reviewers": "钱"
,"content": "女生出门要小心"
,"commtime": 20160821
},{
"id": "003"
,"reviewers": "孙"
,"content": "框架就用layui"
,"commtime": 20161212
},{
"id": "004"
,"reviewers": "李"
,"content": "心姐么么哒"
,"commtime": 20170311
},{
"id": "005"
,"reviewers": "周"
,"content": "希望明天是个好天气"
,"commtime": 20170612
},{
"id": "006"
,"reviewers": "吴"
,"content": "我又爱上编程了"
,"commtime": 20171112
},{
"id": "007"
,"reviewers": "郑"
,"content": "女生出门要小心"
,"commtime": 20171230
},{
"id": "008"
,"reviewers": "王"
,"content": "框架就用layui"
,"commtime": 20180112
},{
"id": "009"
,"reviewers": "冯"
,"content": "心姐么么哒"
,"commtime": 20180221
},{
"id": "010"
,"reviewers": "陈"
,"content": "希望明天是个好天气"
,"commtime": 20180312
}]
}

View File

@@ -0,0 +1,62 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"label": "美食"
,"title": "舌尖上的中国第一季"
,"author": "作者-1"
,"content": "通过中华美食的多个侧面,来展现食物给中国人生活带来的仪式、伦理等方面的文化;见识中国特色食材以及与食物相关、构成中国美食特有气质的一系列元素;了解中华饮食文化的精致和源远流长"
,"uploadtime": 20121204
,"status": true
},{
"id": "002"
,"label": "美食"
,"title": "舌尖上的中国第二季"
,"author": "作者-2"
,"content": "以食物为窗口,读懂中国——通过美食,使人们可以有滋有味地认知这个古老的东方国度。“一方水土一方人”,本片将通过展示人们日常生活中与美食相关的多重侧面,描绘与感知中国人的文化传统、家族观念、生活态度与故土难离。人们收获、保存、烹饪、生产美食,并在其过程中留存和传承食物所承载的味觉记忆、饮食习俗、文化样态与家常情感。"
,"uploadtime": 20141204
,"status": false
},{
"id": "003"
,"label": "美食"
,"title": "舌尖上的中国第三季"
,"author": "作者-3"
,"content": "以食物为窗口,读懂中国——通过美食,使人们可以有滋有味地认知这个古老的东方国度。“一方水土一方人”,本片将通过展示人们日常生活中与美食相关的多重侧面,描绘与感知中国人的文化传统、家族观念、生活态度与故土难离。人们收获、保存、烹饪、生产美食,并在其过程中留存和传承食物所承载的味觉记忆、饮食习俗、文化样态与家常情感将世界美食和中国美食进行比照。春耕、夏耘、秋收、冬藏,天人合一的东方哲学让中国饮食依时而变,智慧灵动,中医营养摄生学说创造了食材运用的新天地,儒家人伦道德则把心意和家的味道端上我们的餐桌。淘洗历史,糅合时光,一代又一代的中国人在天地间升起烟火,用至精至诚的心意烹制食物,一餐一食之间,中国人展示个性,确认归属,构建文明,理解和把握着世界的奥妙。"
,"uploadtime": 20161204
,"status": false
},{
"id": "004"
,"label": "历史"
,"title": "诸葛亮骂王朗"
,"author": "作者-1"
,"content": "皓首匹夫!苍髯老贼!你即将命归于九泉之下,届时,有何面目见汉朝二十四代先帝?二臣贼子!你枉活七十有六,一生未立寸功,只会摇唇舞舌,助曹为虐!一条断脊之犬,还敢在我军阵前狺狺狂吠!我从未见过如此厚颜无耻之人!!!"
,"uploadtime": 20180201
,"status": false
},{
"id": "005"
,"label": "新闻"
,"title": "新时代特色中国梦"
,"author": "作者-1"
,"content": "今天,我们比历史上任何时期都更接近、更有信心和能力实现中华民族伟大复兴的目标。新时代已经到来,蓝图已经绘就,中国梦离我们越来越近了。"
,"uploadtime": 20180512
,"status": false
},{
"id": "006"
,"label": "新闻"
,"title": "新时代特色中国梦"
,"author": "作者-2"
,"content": "梦想不会主动走向我们,只有我们去主动实现梦想。行百里者半九十。虽然中国梦离我们越来越近了,但是要实现中国梦,还要靠我们以永不懈怠的精神状态、功在不舍的坚强意志,不忘初心,继续前进。"
,"uploadtime": 20180514
,"status": false
},{
"id": "007"
,"label": "体育"
,"title": "皇马大战利物浦"
,"author": "作者-3"
,"content": "对欧足联而言,更想要产生个新冠军。连续三年都是同一个冠军队,这会毁掉欧冠……”格里姆表态,“皇马有梦幻般的阵容,但从促进竞争的角度而言,另一支球队获胜会更好。"
,"uploadtime": 20180515
,"status": false
}]
}

View File

@@ -0,0 +1,21 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"tags": "美食"
},{
"id": "002"
,"tags": "新闻"
},{
"id": "003"
,"tags": "八卦"
},{
"id": "004"
,"tags": "体育"
},{
"id": "005"
,"tags": "音乐"
}]
}

View File

@@ -0,0 +1,62 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "1001"
,"poster": "赵"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "为什么花儿这么么红"
,"posttime": 20160805
,"top": false
},{
"id": "1002"
,"poster": "钱"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "喜欢纸飞机,赞赞赞"
,"posttime": 20161205
,"top": true
},{
"id": "1003"
,"poster": "孙"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "明天就要考试了,好紧张,求保佑"
,"posttime": 20170405
,"top": false
},{
"id": "1004"
,"poster": "李"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "希望明天是个好天气"
,"posttime": 20171005
,"top": false
},{
"id": "1005"
,"poster": "周"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "女追男隔层纱,是不是真的"
,"posttime": 20180205
,"top": false
},{
"id": "1006"
,"poster": "吴"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "竟然有人跳楼,年轻人想不开啊!"
,"posttime": 20180512
,"top": false
},{
"id": "1007"
,"poster": "郑"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "大家一定不能学那个年轻人,珍爱生命啊"
,"posttime": 20180512
,"top": false
},{
"id": "1008"
,"poster": "王"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "想知道南昌哪里有好吃的西安肉夹馍"
,"posttime": 20180514
,"top": false
}]
}

View File

@@ -0,0 +1,69 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"replyer": "吴"
,"cardid": "1002"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "有眼光,我也喜欢纸飞机!"
,"replytime": 20161205
},{
"id": "002"
,"replyer": "郑"
,"cardid": "1002"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "同上同上。"
,"replytime": 20161205
},{
"id": "003"
,"replyer": "王"
,"cardid": "1003"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "能过一定过,不能过紧张也没用"
,"replytime": 20170405
},{
"id": "004"
,"replyer": "冯"
,"cardid": "1001"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "可能因为你流鼻血了。"
,"replytime": 20170405
},{
"id": "005"
,"replyer": "陈"
,"cardid": "1003"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "加油加油,看好你"
,"replytime": 20170405
},{
"id": "006"
,"replyer": "褚"
,"cardid": "1005"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "纯属放屁"
,"replytime": 20180207
},{
"id": "007"
,"replyer": "卫"
,"cardid": "1005"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "可以试试"
,"replytime": 20180207
},{
"id": "006"
,"replyer": "蒋"
,"cardid": "1006"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "是啊是啊,太恐怖了。"
,"replytime": 20180512
},{
"id": "007"
,"replyer": "沈"
,"cardid": "1008"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"content": "魏家凉皮的凉皮就很不错奥。"
,"replytime": 20180515
}]
}

View File

@@ -0,0 +1,27 @@
{
"code": 0,
"msg": "",
"title": "JSON请求的相册",
"id": 8,
"start": 0,
"data": [
{
"alt": "layer",
"pid": 109,
"src": "https://sentsin.gitee.io/res/images/demo/layer.png",
"thumb": ""
},
{
"alt": "说好的一起Fly",
"pid": 110,
"src": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4kebemcj20ga09saa1.jpg",
"thumb": ""
},
{
"alt": "星空如此深邃",
"pid": 113,
"src": "https://sentsin.gitee.io/res/images/layui/avatar.png",
"thumb": ""
}
]
}

View File

@@ -0,0 +1,96 @@
{
"code": 0
,"msg": ""
,"data": {
"mine": {
"username": "测试名称"
,"id": "100000"
,"status": "online"
,"sign": "测试"
,"avatar": ""
}
,"friend": [{
"groupname": "测试分组一"
,"id": 0
,"list": [{
"username": "测试1"
,"id": "100001"
,"avatar": ""
,"sign": "测试内容1"
,"status": "online"
},{
"username": "测试2"
,"id": "100001222"
,"sign": "测试内容2"
,"avatar": ""
},{
"username": "测试3"
,"id": "10034001"
,"avatar": ""
,"sign": ""
},{
"username": "测试4"
,"id": "168168"
,"avatar": ""
,"sign": "测试内容4"
},{
"username": "测试5"
,"id": "666666"
,"avatar": ""
,"sign": "测试内容5"
}]
},{
"groupname": "测试分组二"
,"id": 1
,"list": [{
"username": "测试6"
,"id": "121286"
,"avatar": ""
,"sign": "测试内容6"
},{
"username": "测试7"
,"id": "108101"
,"avatar": ""
,"sign": "微电商达人"
},{
"username": "测试8"
,"id": "12123454"
,"avatar": ""
,"sign": "测试内容8"
},{
"username": "测试9"
,"id": "102101"
,"avatar": ""
,"sign": ""
},{
"username": "测试10"
,"id": "3435343"
,"avatar": ""
,"sign": ""
}]
},{
"groupname": "测试分组三"
,"id": 2
,"list": [{
"username": "测试11"
,"id": "76543"
,"avatar": ""
,"sign": "测试内容11"
},{
"username": "测试12"
,"id": "4803920"
,"avatar": ""
,"sign": "测试内容12"
}]
}]
,"group": [{
"groupname": "测试群组一"
,"id": "101"
,"avatar": ""
},{
"groupname": "测试群组二"
,"id": "102"
,"avatar": ""
}]
}
}

View File

@@ -0,0 +1,22 @@
{
"code": 0
,"msg": ""
,"data": {
"list": [{
"username": "测试1"
,"id": "100001"
,"avatar": ""
,"sign": "测试内容"
},{
"username": "测试6"
,"id": "121286"
,"avatar": ""
,"sign": "测试内容"
},{
"username": "测试8"
,"id": "12123454"
,"avatar": ""
,"sign": ""
}]
}
}

View File

@@ -0,0 +1,42 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"invoice": "X123565541"
,"username": "张小三"
,"orderDate": "2017-11-10"
,"amount": 800
,"status": 1
},{
"invoice": "X123565542"
,"username": "李小四"
,"orderDate": "2017-11-10"
,"amount": 800
,"status": 0
},{
"invoice": "X123565543"
,"username": "王老五"
,"orderDate": "2017-11-10"
,"amount": 800
,"status": 1
},{
"invoice": "X123565544"
,"username": "赵小六"
,"orderDate": "2017-11-09"
,"amount": 1600
,"status": 1
},{
"invoice": "X123565545"
,"username": "孙小七"
,"orderDate": "2017-11-09"
,"amount": 1600
,"status": -1
},{
"invoice": "X123565546"
,"username": "周小八"
,"orderDate": "2017-11-08"
,"amount": 2600
,"status": 1
}]
}

View File

@@ -0,0 +1,227 @@
{
"code": 0
,"msg": ""
,"data": [{
"name": "component"
,"title": "组件"
,"icon": "layui-icon-component"
,"list": [{
"name": "grid"
,"title": "栅格"
,"list": [{
"name": "list"
,"title": "等比例列表排列"
},{
"name": "mobile"
,"title": "按移动端排列"
},{
"name": "mobile-pc"
,"title": "移动桌面端组合"
},{
"name": "all"
,"title": "全端复杂组合"
},{
"name": "stack"
,"title": "低于桌面堆叠排列"
},{
"name": "speed-dial"
,"title": "九宫格"
}]
}, {
"name": "button"
,"title": "按钮"
}, {
"name": "form"
,"title": "表单"
,"list": [{
"name": "element"
,"title": "表单元素"
},{
"name": "group"
,"title": "表单组合"
}]
}, {
"name": "nav"
,"title": "导航"
}, {
"name": "tabs"
,"title": "选项卡"
}, {
"name": "progress"
,"title": "进度条"
}, {
"name": "panel"
,"title": "面板"
}, {
"name": "badge"
,"title": "徽章"
}, {
"name": "timeline"
,"title": "时间线"
}, {
"name": "anim"
,"title": "动画"
}, {
"name": "auxiliar"
,"title": "辅助"
}, {
"name": "layer"
,"title": "通用弹层"
,"list": [{
"name": "list"
,"title": "功能演示"
},{
"name": "special-demo"
,"title": "特殊示例"
},{
"name": "theme"
,"title": "风格定制"
}]
}, {
"name": "laydate"
,"title": "日期时间"
}, {
"name": "table"
,"title": "表格"
}, {
"name": "laypage"
,"title": "分页"
}, {
"name": "upload"
,"title": "上传"
}, {
"name": "carousel"
,"title": "轮播"
}, {
"name": "laytpl"
,"title": "模板引擎"
}, {
"name": "flow"
,"title": "流加载"
}, {
"name": "util"
,"title": "工具"
}, {
"name": "code"
,"title": "代码修饰"
}, {
"name": "layim"
,"title": "即时聊天"
,"jump": "senior/im/"
}]
}, {
"name": "template"
,"title": "模板"
,"icon": "layui-icon-template"
,"list": [{
"name": "user"
,"title": "用户相关"
,"spread": true
,"list": [{
"name": "reg"
,"title": "注册"
,"jump": "user/reg"
},{
"name": "login"
,"title": "登入"
,"jump": "user/login"
},{
"name": "forget"
,"title": "忘记密码"
,"jump": "user/forget"
}]
}, {
"name": "tips"
,"title": "提示页面"
,"spread": true
,"list": [{
"name": "404"
,"title": "404"
},{
"name": "error"
,"title": "错误提示"
}]
}, {
"name": ""
,"title": "内嵌页面"
,"spread": true
,"list": [{
"name": ""
,"title": "百度一下"
,"jump": "/iframe/link/baidu"
}, {
"name": ""
,"title": "layui官网"
,"jump": "/iframe/link/layui"
}, {
"name": ""
,"title": "layuiAdmin官网"
,"jump": "/iframe/link/layuiAdmin"
}]
}]
}, {
"name": "app"
,"title": "应用"
,"icon": "layui-icon-app"
,"list": [{
"name": "message"
,"title": "消息中心"
}]
}, {
"name": "senior"
,"title": "高级"
,"icon": "layui-icon-senior"
,"list": [{
"name": "im"
,"title": "通讯系统"
}]
}, {
"name": "user"
,"title": "用户"
,"icon": "layui-icon-user"
,"list": [{
"name": "user"
,"title": "用户"
,"spread": true
,"list": [{
"name": "list"
,"title": "用户列表"
}]
},{
"name": "administrators"
,"title": "后台管理组"
,"spread": true
,"list": [{
"name": "list"
,"title": "管理员列表"
},{
"name": "role"
,"title": "角色管理"
}]
}]
}, {
"name": "set"
,"title": "设置"
,"icon": "layui-icon-set"
,"list": [{
"name": "base"
,"title": "基本设置"
,"spread": true
,"list": [{
"name": "website"
,"title": "系统设置"
},{
"name": "email"
,"title": "邮件服务"
}]
},{
"name": "security"
,"title": "安全设置"
}]
}, {
"name": "get"
,"title": "授权"
,"icon": "layui-icon-auz"
,"jump": "system/get"
}]
}

View File

@@ -0,0 +1,46 @@
{
"code": 0
,"msg": ""
,"count": 60
,"data": [{
"id": 123
,"title": "Hello World"
,"time": 1510363800000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1507447570000
}]
}

View File

@@ -0,0 +1,10 @@
{
"code": 0
,"msg": ""
,"data": {
"id": 111
,"title": "Hello World"
,"content": "<p>来自通用型纯静态 UI 界面模板的初识语 本地模拟测试消息</p>"
,"time": 1510363800000
}
}

View File

@@ -0,0 +1,46 @@
{
"code": 0
,"msg": ""
,"count": 60
,"data": [{
"id": 123
,"title": "一段模拟的测试私信"
,"time": 1510363800000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1507447570000
}]
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": ""
,"data": {
"newmsg": 3
}
}

View File

@@ -0,0 +1,46 @@
{
"code": 0
,"msg": ""
,"count": 60
,"data": [{
"id": 123
,"title": "一段模拟的测试私信"
,"time": 1510363800000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1510212370000
}, {
"id": 111
,"title": "一段模拟的测试私信"
,"time": 1507447570000
}]
}

View File

@@ -0,0 +1,96 @@
{
"code": 0
,"msg": ""
,"count": 3000000
,"data": [{
"id": "10001"
,"username": "杜甫"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "点击此处,显示更多。当内容超出时,点击单元格会自动显示更多内容。"
,"experience": "116"
,"ip": "192.168.0.8"
,"logins": "108"
,"joinTime": "2016-10-14"
}, {
"id": "10002"
,"username": "李白"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
,"experience": "12"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
,"LAY_CHECKED": true
}, {
"id": "10003"
,"username": "王勃"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "65"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10004"
,"username": "李清照"
,"email": "xianxin@baidu.com"
,"sex": "女"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "666"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10005"
,"username": "冰心"
,"email": "xianxin@baidu.com"
,"sex": "女"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "86"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10006"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "12"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10007"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "16"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10008"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "106"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}]
}

View File

@@ -0,0 +1,61 @@
{
"code": 0
,"msg": ""
,"count": 66
,"data": [{
"username": "张小三"
,"amount": 18
,"province": "浙江"
,"city": "杭州"
,"zone": "西湖区"
,"street": "西溪街道"
,"address": "西溪花园"
,"house": "30栋1单元"
}, {
"username": "李小四"
,"amount": 39
,"province": "江苏"
,"city": "苏州"
,"zone": "姑苏区"
,"street": "丝绸路"
,"address": "天墅之城"
,"house": "9幢2单元"
}, {
"username": "王小五"
,"amount": 8
,"province": "江西"
,"city": "南昌"
,"zone": "青山湖区"
,"street": "艾溪湖办事处"
,"address": "中兴和园"
,"house": "1幢3单元"
}, {
"username": "赵小六"
,"amount": 16
,"province": "福建"
,"city": "泉州"
,"zone": "丰泽区"
,"street": "南洋街道"
,"address": "南洋村"
,"house": "6幢1单元"
}, {
"username": "孙小七"
,"amount": 12
,"province": "湖北"
,"city": "武汉"
,"zone": "武昌区"
,"street": "武昌大道"
,"address": "两湖花园"
,"house": "16幢2单元"
}, {
"username": "周小八"
,"amount": 11
,"province": "安徽"
,"city": "黄山"
,"zone": "黄山区"
,"street": "汤口镇"
,"address": "温泉村"
,"house": "21号"
}]
}

View File

@@ -0,0 +1,96 @@
{
"status": 200
,"message": ""
,"total": 8
,"rows": {
"item": [{
"id": "10001"
,"username": "杜甫"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "点击此处,显示更多。当内容超出时,点击单元格会自动显示更多内容。"
,"experience": "116"
,"ip": "192.168.0.8"
,"logins": "108"
,"joinTime": "2016-10-14"
}, {
"id": "10002"
,"username": "李白"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
,"experience": "12"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10003"
,"username": "王勃"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "65"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10004"
,"username": "李清照"
,"email": "xianxin@baidu.com"
,"sex": "女"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "666"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10005"
,"username": "冰心"
,"email": "xianxin@baidu.com"
,"sex": "女"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "86"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10006"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "12"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10007"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "16"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}, {
"id": "10008"
,"username": "tester"
,"email": "xianxin@baidu.com"
,"sex": "男"
,"city": "浙江杭州"
,"sign": "人生恰似一场修行"
,"experience": "106"
,"ip": "192.168.0.8"
,"logins": "106"
,"joinTime": "2016-10-14"
}]
}
}

View File

@@ -0,0 +1,2 @@
{"code":0,"msg":"","count":1000,"data":[{"id":10000,"username":"user-0","sex":"女","city":"城市-0","sign":"签名-0","experience":255,"logins":24,"wealth":82830700,"classify":"作家","score":57},{"id":10001,"username":"user-1","sex":"男","city":"城市-1","sign":"签名-1","experience":884,"logins":58,"wealth":64928690,"classify":"词人","score":27},{"id":10002,"username":"user-2","sex":"女","city":"城市-2","sign":"签名-2","experience":650,"logins":77,"wealth":6298078,"classify":"酱油","score":31},{"id":10003,"username":"user-3","sex":"女","city":"城市-3","sign":"签名-3","experience":362,"logins":157,"wealth":37117017,"classify":"诗人","score":68},{"id":10004,"username":"user-4","sex":"男","city":"城市-4","sign":"签名-4","experience":807,"logins":51,"wealth":76263262,"classify":"作家","score":6},{"id":10005,"username":"user-5","sex":"女","city":"城市-5","sign":"签名-5","experience":173,"logins":68,"wealth":60344147,"classify":"作家","score":87},{"id":10006,"username":"user-6","sex":"女","city":"城市-6","sign":"签名-6","experience":982,"logins":37,"wealth":57768166,"classify":"作家","score":34},{"id":10007,"username":"user-7","sex":"男","city":"城市-7","sign":"签名-7","experience":727,"logins":150,"wealth":82030578,"classify":"作家","score":28},{"id":10008,"username":"user-8","sex":"男","city":"城市-8","sign":"签名-8","experience":951,"logins":133,"wealth":16503371,"classify":"词人","score":14},{"id":10009,"username":"user-9","sex":"女","city":"城市-9","sign":"签名-9","experience":484,"logins":25,"wealth":86801934,"classify":"词人","score":75}]}

View File

@@ -0,0 +1,2 @@
{"code":0,"msg":"","count":1000,"data":[{"id":10000,"username":"user-0","sex":"女","city":"城市-0","sign":"签名-0","experience":255,"logins":24,"wealth":82830700,"classify":"作家","score":57},{"id":10001,"username":"user-1","sex":"男","city":"城市-1","sign":"签名-1","experience":884,"logins":58,"wealth":64928690,"classify":"词人","score":27},{"id":10002,"username":"user-2","sex":"女","city":"城市-2","sign":"签名-2","experience":650,"logins":77,"wealth":6298078,"classify":"酱油","score":31},{"id":10003,"username":"user-3","sex":"女","city":"城市-3","sign":"签名-3","experience":362,"logins":157,"wealth":37117017,"classify":"诗人","score":68},{"id":10004,"username":"user-4","sex":"男","city":"城市-4","sign":"签名-4","experience":807,"logins":51,"wealth":76263262,"classify":"作家","score":6},{"id":10005,"username":"user-5","sex":"女","city":"城市-5","sign":"签名-5","experience":173,"logins":68,"wealth":60344147,"classify":"作家","score":87},{"id":10006,"username":"user-6","sex":"女","city":"城市-6","sign":"签名-6","experience":982,"logins":37,"wealth":57768166,"classify":"作家","score":34},{"id":10007,"username":"user-7","sex":"男","city":"城市-7","sign":"签名-7","experience":727,"logins":150,"wealth":82030578,"classify":"作家","score":28},{"id":10008,"username":"user-8","sex":"男","city":"城市-8","sign":"签名-8","experience":951,"logins":133,"wealth":16503371,"classify":"词人","score":14},{"id":10009,"username":"user-9","sex":"女","city":"城市-9","sign":"签名-9","experience":484,"logins":25,"wealth":86801934,"classify":"词人","score":75},{"id":10010,"username":"user-10","sex":"女","city":"城市-10","sign":"签名-10","experience":1016,"logins":182,"wealth":71294671,"classify":"诗人","score":34},{"id":10011,"username":"user-11","sex":"女","city":"城市-11","sign":"签名-11","experience":492,"logins":107,"wealth":8062783,"classify":"诗人","score":6},{"id":10012,"username":"user-12","sex":"女","city":"城市-12","sign":"签名-12","experience":106,"logins":176,"wealth":42622704,"classify":"词人","score":54},{"id":10013,"username":"user-13","sex":"男","city":"城市-13","sign":"签名-13","experience":1047,"logins":94,"wealth":59508583,"classify":"诗人","score":63},{"id":10014,"username":"user-14","sex":"男","city":"城市-14","sign":"签名-14","experience":873,"logins":116,"wealth":72549912,"classify":"词人","score":8},{"id":10015,"username":"user-15","sex":"女","city":"城市-15","sign":"签名-15","experience":1068,"logins":27,"wealth":52737025,"classify":"作家","score":28},{"id":10016,"username":"user-16","sex":"女","city":"城市-16","sign":"签名-16","experience":862,"logins":168,"wealth":37069775,"classify":"酱油","score":86},{"id":10017,"username":"user-17","sex":"女","city":"城市-17","sign":"签名-17","experience":1060,"logins":187,"wealth":66099525,"classify":"作家","score":69},{"id":10018,"username":"user-18","sex":"女","city":"城市-18","sign":"签名-18","experience":866,"logins":88,"wealth":81722326,"classify":"词人","score":74},{"id":10019,"username":"user-19","sex":"女","city":"城市-19","sign":"签名-19","experience":682,"logins":106,"wealth":68647362,"classify":"词人","score":51},{"id":10020,"username":"user-20","sex":"男","city":"城市-20","sign":"签名-20","experience":770,"logins":24,"wealth":92420248,"classify":"诗人","score":87},{"id":10021,"username":"user-21","sex":"男","city":"城市-21","sign":"签名-21","experience":184,"logins":131,"wealth":71566045,"classify":"词人","score":99},{"id":10022,"username":"user-22","sex":"男","city":"城市-22","sign":"签名-22","experience":739,"logins":152,"wealth":60907929,"classify":"作家","score":18},{"id":10023,"username":"user-23","sex":"女","city":"城市-23","sign":"签名-23","experience":127,"logins":82,"wealth":14765943,"classify":"作家","score":30},{"id":10024,"username":"user-24","sex":"女","city":"城市-24","sign":"签名-24","experience":212,"logins":133,"wealth":59011052,"classify":"词人","score":76},{"id":10025,"username":"user-25","sex":"女","city":"城市-25","sign":"签名-25","experience":938,"logins":182,"wealth":91183097,"classify":"作家","score":69},{"id":10026,"username":"user-26","sex":"男","city":"城市-26","sign":"签名-26","experience":978,"logins":7,"wealth":48008413,"classify":"作家","score":65},{"id":10027,"username":"user-27","sex":"女","city":"城市-27","sign":"签名-27","experience":371,"logins":44,"wealth":64419691,"classify":"诗人","score":60},{"id":10028,"username":"user-28","sex":"女","city":"城市-28","sign":"签名-28","experience":977,"logins":21,"wealth":75935022,"classify":"作家","score":37},{"id":10029,"username":"user-29","sex":"男","city":"城市-29","sign":"签名-29","experience":647,"logins":107,"wealth":97450636,"classify":"酱油","score":27}]}

View File

@@ -0,0 +1,7 @@
{
"code": 0,
"msg": "",
"data": {
"src": "https://sentsin.gitee.io/res/images/layui/avatar.png"
}
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": "注册成功"
,"data": {
}
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": "登入成功"
,"data": {
"access_token": "c262e61cd13ad99fc650e6908c7e5e65b63d2f32185ecfed6b801ee3fbdd5c0a"
}
}

View File

@@ -0,0 +1,5 @@
{
"code": 0
,"msg": "退出成功"
,"data": null
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": "注册成功"
,"data": {
}
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": "注册成功"
,"data": {
}
}

View File

@@ -0,0 +1,9 @@
{
"code": 0
,"msg": ""
,"data": {
"username": "tester"
,"sex": "男"
,"role": 1
}
}

View File

@@ -0,0 +1,7 @@
{
"code": 0
,"msg": "注册成功"
,"data": {
}
}

View File

@@ -0,0 +1,78 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "1001"
,"loginname": "admin"
,"telphone": "11111111111"
,"email": "111@qq.com"
,"role": "超级管理员"
,"jointime": "20150217"
,"check": true
},{
"id": "1002"
,"loginname": "common-1"
,"telphone": "22222222222"
,"email": "222@qq.com"
,"role": "管理员"
,"jointime": "20160217"
,"check": false
},{
"id": "1003"
,"loginname": "common-2"
,"telphone": "33333333333"
,"email": "333@qq.com"
,"role": "管理员"
,"jointime": "20161012"
,"check": false
},{
"id": "1004"
,"loginname": "common-3"
,"telphone": "44444444444"
,"email": "444@qq.com"
,"role": "管理员"
,"jointime": "20170518"
,"check": true
},{
"id": "1005"
,"loginname": "common-4"
,"telphone": "55555555555"
,"email": "555@qq.com"
,"role": "管理员"
,"jointime": "20180101"
,"check": false
},{
"id": "1006"
,"loginname": "common-5"
,"telphone": "66666666666"
,"email": "666@qq.com"
,"role": "管理员"
,"jointime": "20160217"
,"check": false
},{
"id": "1007"
,"loginname": "common-6"
,"telphone": "77777777777"
,"email": "777@qq.com"
,"role": "管理员"
,"jointime": "20161012"
,"check": false
},{
"id": "1008"
,"loginname": "common-7"
,"telphone": "88888888888"
,"email": "888@qq.com"
,"role": "管理员"
,"jointime": "20170518"
,"check": true
},{
"id": "1009"
,"loginname": "common-8"
,"telphone": "99999999999"
,"email": "999@qq.com"
,"role": "管理员"
,"jointime": "20180101"
,"check": false
}]
}

View File

@@ -0,0 +1,54 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "1"
,"rolename": "超级管理员"
,"limits": "管理所有的管理员"
,"descr": "拥有至高无上的权利"
,"check": true
},{
"id": "2"
,"rolename": "管理员"
,"limits": "所有列表的管理"
,"descr": "事情很多,权力很大"
,"check": true
},{
"id": "3"
,"rolename": "文章撰写员"
,"limits": "负责文章的编写"
,"descr": "文采第一的人才集合"
,"check": false
},{
"id": "4"
,"rolename": "纠错员"
,"limits": "负责文章内容的修改"
,"descr": "暂无"
,"check": false
},{
"id": "5"
,"rolename": "统计人员"
,"limits": "对数据进行统计"
,"descr": "暂无"
,"check": false
},{
"id": "6"
,"rolename": "评估员"
,"limits": "对统计数据进行评估"
,"descr": "及时捕捉市场发展动态"
,"check": false
},{
"id": "7"
,"rolename": "采购员"
,"limits": "负责员工的伙食"
,"descr": "暂无"
,"check": false
},{
"id": "8"
,"rolename": "推销员"
,"limits": "介绍销售公司产品"
,"descr": "暂无"
,"check": false
}]
}

View File

@@ -0,0 +1,143 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"id": "001"
,"username": "用户-1"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "002"
,"username": "用户-2"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "003"
,"username": "用户-3"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "女"
,"ip": "1111111"
,"jointime": 20171011
,"LAY_CHECKED": true
},{
"id": "004"
,"username": "用户-4"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20160505
},{
"id": "005"
,"username": "用户-5"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "006"
,"username": "用户-6"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "007"
,"username": "用户-7"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20180210
},{
"id": "008"
,"username": "用户-8"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "女"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "009"
,"username": "用户-9"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "女"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "010"
,"username": "用户-10"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20170719
},{
"id": "011"
,"username": "用户-11"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "012"
,"username": "用户-12"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "女"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "013"
,"username": "用户-13"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "女"
,"ip": "1111111"
,"jointime": 20171204
,"LAY_CHECKED": true
},{
"id": "014"
,"username": "用户-14"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
},{
"id": "015"
,"username": "用户-15"
,"avatar": "https://sentsin.gitee.io/res/images/layui/avatar.png"
,"phone": 12345678901
,"email": "11111@qq.com"
,"sex": "男"
,"ip": "1111111"
,"jointime": 20171204
}]
}

View File

@@ -0,0 +1,78 @@
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"orderid": 111
,"title": "移动支付踏入马来西亚,聚合支付紧随其后"
,"attr": "公告"
,"progress": "25%"
,"submit": "tester"
,"accept": "员工-1"
,"state": "处理中"
},{
"orderid": 222
,"title": "凡科拖拽式免费建站神器,享双重优惠!"
,"attr": "讨论"
,"progress": "100%"
,"submit": "猫吃"
,"accept": "员工-1"
,"state": "已处理"
},{
"orderid": 333
,"title": "看着别人的老板给员工送汽车有感"
,"attr": "分享"
,"progress": "0%"
,"submit": "纸飞机"
,"accept": ""
,"state": "未分配"
},{
"orderid": 444
,"title": "DISCUZ的云平台还有戏吗"
,"attr": "提问"
,"progress": "0%"
,"submit": "纸飞机"
,"accept": ""
,"state": "未分配"
},{
"orderid": 555
,"title": "现在个人网站还有必要长期坚持下去吗?"
,"attr": "提问"
,"progress": "50%"
,"submit": "纸飞机"
,"accept": "员工-2"
,"state": "处理中"
},{
"orderid": 666
,"title": "求安排一个技术客服?"
,"attr": "公告"
,"progress": "25%"
,"submit": "纸飞机"
,"accept": "员工-3"
,"state": "处理中"
},{
"orderid": 777
,"title": "游戏 网页美工,一个月多少工资才正常?"
,"attr": "提问"
,"progress": "100%"
,"submit": "纸飞机"
,"accept": "员工-1"
,"state": "已处理"
},{
"orderid": 888
,"title": "几年没来了,蓝色理想帖子这么少了啊"
,"attr": "提问"
,"progress": "0%"
,"submit": "纸飞机"
,"accept": ""
,"state": "未分配"
},{
"orderid": 999
,"title": "我的天,求推荐靠谱的学习网站"
,"attr": "提问"
,"progress": "50%"
,"submit": "纸飞机"
,"accept": "员工-2"
,"state": "处理中"
}]
}

View File

@@ -0,0 +1,3 @@
注意:这里是模拟的数据。
实际应用时,请在模板文件(.html中的 lay-url="" 和其它相关接口的 url 设置成你真实的接口地址

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 299 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,860 @@
/*!
* 界面核心模块
*/
layui.define('view', function(exports){
var $ = layui.jquery
,laytpl = layui.laytpl
,element = layui.element
,table = layui.table
,upload = layui.upload
,setter = layui.setter
,view = layui.view
,device = layui.device()
,$win = $(window), $body = $('body')
,container = $('#'+ setter.container)
,SHOW = 'layui-show', HIDE = 'layui-hide', THIS = 'layui-this', DISABLED = 'layui-disabled', TEMP = 'template'
,APP_BODY = '#LAY_app_body', APP_FLEXIBLE = 'LAY_app_flexible'
,FILTER_TAB_TBAS = 'layadmin-layout-tabs'
,APP_SPREAD_SM = 'layadmin-side-spread-sm', TABS_BODY = 'layadmin-tabsbody-item'
,ICON_SHRINK = 'layui-icon-shrink-right', ICON_SPREAD = 'layui-icon-spread-left'
,SIDE_SHRINK = 'layadmin-side-shrink', SIDE_MENU = 'LAY-system-side-menu'
//通用方法
,admin = {
v: '1.7.2 std'
//数据的异步请求
,req: view.req
//清除本地 token并跳转到登入页
,exit: view.exit
//xss 转义
,escape: function(html){
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
}
//事件监听
,on: function(events, callback){
return layui.onevent.call(this, setter.MOD_NAME, events, callback);
}
//发送验证码
,sendAuthCode: function(options){
options = $.extend({
seconds: 60
,elemPhone: '#LAY_phone'
,elemVercode: '#LAY_vercode'
}, options);
var seconds = options.seconds
,btn = $(options.elem)
,token = null
,timer, countDown = function(loop){
seconds--;
if(seconds < 0){
btn.removeClass(DISABLED).html('获取验证码');
seconds = options.seconds;
clearInterval(timer);
} else {
btn.addClass(DISABLED).html(seconds + '秒后重获');
}
if(!loop){
timer = setInterval(function(){
countDown(true);
}, 1000);
}
};
options.elemPhone = $(options.elemPhone);
options.elemVercode = $(options.elemVercode);
btn.on('click', function(){
var elemPhone = options.elemPhone
,value = elemPhone.val();
if(seconds !== options.seconds || $(this).hasClass(DISABLED)) return;
if(!/^1\d{10}$/.test(value)){
elemPhone.focus();
return layer.msg('请输入正确的手机号')
};
if(typeof options.ajax === 'object'){
var success = options.ajax.success;
delete options.ajax.success;
}
admin.req($.extend(true, {
url: '/auth/code'
,type: 'get'
,data: {
phone: value
}
,success: function(res){
layer.msg('验证码已发送至你的手机,请注意查收', {
icon: 1
,shade: 0
});
options.elemVercode.focus();
countDown();
success && success(res);
}
}, options.ajax));
});
}
//屏幕类型
,screen: function(){
var width = $win.width()
if(width > 1200){
return 3; //大屏幕
} else if(width > 992){
return 2; //中屏幕
} else if(width > 768){
return 1; //小屏幕
} else {
return 0; //超小屏幕
}
}
//侧边伸缩
,sideFlexible: function(status){
var app = container
,iconElem = $('#'+ APP_FLEXIBLE)
,screen = admin.screen();
//设置状态PC默认展开、移动默认收缩
if(status === 'spread'){
//切换到展开状态的 icon箭头
iconElem.removeClass(ICON_SPREAD).addClass(ICON_SHRINK);
//移动从左到右位移PC清除多余选择器恢复默认
if(screen < 2){
app.addClass(APP_SPREAD_SM);
} else {
app.removeClass(APP_SPREAD_SM);
}
app.removeClass(SIDE_SHRINK)
} else {
//切换到搜索状态的 icon箭头
iconElem.removeClass(ICON_SHRINK).addClass(ICON_SPREAD);
//移动清除多余选择器恢复默认PC从右往左收缩
if(screen < 2){
app.removeClass(SIDE_SHRINK);
} else {
app.addClass(SIDE_SHRINK);
}
app.removeClass(APP_SPREAD_SM)
}
layui.event.call(this, setter.MOD_NAME, 'side({*})', {
status: status
});
}
//弹出面板
,popup: view.popup
//右侧面板
,popupRight: function(options){
//layer.close(admin.popup.index);
return admin.popup.index = layer.open($.extend({
type: 1
,id: 'LAY_adminPopupR'
,anim: -1
,title: false
,closeBtn: false
,offset: 'r'
,shade: 0.1
,shadeClose: true
,skin: 'layui-anim layui-anim-rl layui-layer-adminRight'
,area: '300px'
}, options));
}
//主题设置
,theme: function(options){
var theme = setter.theme
,local = layui.data(setter.tableName)
,id = 'LAY_layadmin_theme'
,style = document.createElement('style')
,styleText = laytpl([
//主题色
'.layui-side-menu,'
,'.layadmin-pagetabs .layui-tab-title li:after,'
,'.layadmin-pagetabs .layui-tab-title li.layui-this:after,'
,'.layui-layer-admin .layui-layer-title,'
,'.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child'
,'{background-color:{{d.color.main}} !important;}'
//选中色
,'.layui-nav-tree .layui-this,'
,'.layui-nav-tree .layui-this>a,'
,'.layui-nav-tree .layui-nav-child dd.layui-this,'
,'.layui-nav-tree .layui-nav-child dd.layui-this a'
,'{background-color:{{d.color.selected}} !important;}'
//logo
,'.layui-layout-admin .layui-logo{background-color:{{d.color.logo || d.color.main}} !important;}'
//头部色
,'{{# if(d.color.header){ }}'
,'.layui-layout-admin .layui-header{background-color:{{ d.color.header }};}'
,'.layui-layout-admin .layui-header a,'
,'.layui-layout-admin .layui-header a cite{color: #f8f8f8;}'
,'.layui-layout-admin .layui-header a:hover{color: #fff;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-nav-more{border-top-color: #fbfbfb;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-nav-mored{border-color: transparent; border-bottom-color: #fbfbfb;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-this:after, .layui-layout-admin .layui-header .layui-nav-bar{background-color: #fff; background-color: rgba(255,255,255,.5);}'
,'.layadmin-pagetabs .layui-tab-title li:after{display: none;}'
,'{{# } }}'
].join('')).render(options = $.extend({}, local.theme, options))
,styleElem = document.getElementById(id);
//添加主题样式
if('styleSheet' in style){
style.setAttribute('type', 'text/css');
style.styleSheet.cssText = styleText;
} else {
style.innerHTML = styleText;
}
style.id = id;
styleElem && $body[0].removeChild(styleElem);
$body[0].appendChild(style);
$body.attr('layadmin-themealias', options.color.alias);
//本地存储记录
local.theme = local.theme || {};
layui.each(options, function(key, value){
local.theme[key] = value;
});
layui.data(setter.tableName, {
key: 'theme'
,value: local.theme
});
}
//初始化主题
,initTheme: function(index){
var theme = setter.theme;
index = index || 0;
if(theme.color[index]){
theme.color[index].index = index;
admin.theme({
color: theme.color[index]
});
}
}
//记录最近一次点击的页面标签数据
,tabsPage: {}
//获取页面标签主体元素
,tabsBody: function(index){
return $(APP_BODY).find('.'+ TABS_BODY).eq(index || 0);
}
//切换页面标签主体
,tabsBodyChange: function(index, options){
options = options || {};
admin.tabsBody(index).addClass(SHOW).siblings().removeClass(SHOW);
events.rollPage('auto', index);
//执行 {setter.MOD_NAME}.tabsPage 下的事件
layui.event.call(this, setter.MOD_NAME, 'tabsPage({*})', {
url: options.url
,text: options.text
});
}
//resize事件管理
,resize: function(fn){
var router = layui.router()
,key = router.path.join('-');
if(admin.resizeFn[key]){
$win.off('resize', admin.resizeFn[key]);
delete admin.resizeFn[key];
}
if(fn === 'off') return; //如果是清除 resize 事件,则终止往下执行
fn(), admin.resizeFn[key] = fn;
$win.on('resize', admin.resizeFn[key]);
}
,resizeFn: {}
,runResize: function(){
var router = layui.router()
,key = router.path.join('-');
admin.resizeFn[key] && admin.resizeFn[key]();
}
,delResize: function(){
this.resize('off');
}
//关闭当前 pageTabs
,closeThisTabs: function(){
if(!admin.tabsPage.index) return;
$(TABS_HEADER).eq(admin.tabsPage.index).find('.layui-tab-close').trigger('click');
}
//全屏
,fullScreen: function(){
var ele = document.documentElement
,reqFullScreen = ele.requestFullScreen || ele.webkitRequestFullScreen
|| ele.mozRequestFullScreen || ele.msRequestFullscreen;
if(typeof reqFullScreen !== 'undefined' && reqFullScreen) {
reqFullScreen.call(ele);
};
}
//退出全屏
,exitScreen: function(){
var ele = document.documentElement
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
//……
};
//事件
var events = admin.events = {
//伸缩
flexible: function(othis){
var iconElem = othis.find('#'+ APP_FLEXIBLE)
,isSpread = iconElem.hasClass(ICON_SPREAD);
admin.sideFlexible(isSpread ? 'spread' : null);
}
//刷新
,refresh: function(){
var ELEM_IFRAME = '.layadmin-iframe'
,length = $('.'+ TABS_BODY).length;
if(admin.tabsPage.index >= length){
admin.tabsPage.index = length - 1;
}
var iframe = admin.tabsBody(admin.tabsPage.index).find(ELEM_IFRAME);
iframe[0].contentWindow.location.reload(true);
}
//输入框搜索
,serach: function(othis){
othis.off('keypress').on('keypress',function(e){
if(!this.value.replace(/\s/g, '')) return;
//回车跳转
if(e.keyCode === 13){
var href = othis.attr('lay-action')
,text = othis.attr('lay-text') || '搜索';
href = href + this.value;
text = text + ' <span style="color: #FF5722;">'+ admin.escape(this.value) +'</span>';
//打开标签页
layui.index.openTabsPage(href, text);
//如果搜索关键词已经打开,则刷新页面即可
events.serach.keys || (events.serach.keys = {});
events.serach.keys[admin.tabsPage.index] = this.value;
if(this.value === events.serach.keys[admin.tabsPage.index]){
events.refresh(othis);
}
//清空输入框
this.value = '';
}
});
}
//点击消息
,message: function(othis){
othis.find('.layui-badge-dot').remove();
}
//弹出主题面板
,theme: function(){
admin.popupRight({
id: 'LAY_adminPopupTheme'
,success: function(){
view(this.id).render('system/theme')
}
});
}
//本地便签
,note: function(othis){
var mobile = admin.screen() < 2
,note = layui.data(setter.tableName).note;
events.note.index = admin.popup({
title: '本地便签'
,shade: 0
,offset: [
'41px'
,(mobile ? null : (othis.offset().left - 250) + 'px')
]
,anim: -1
,id: 'LAY_adminNote'
,skin: 'layadmin-note layui-anim layui-anim-upbit'
,content: '<textarea placeholder="内容"></textarea>'
,resize: false
,success: function(layero, index){
var textarea = layero.find('textarea')
,value = note === undefined ? '便签中的内容会存储在本地,这样即便你关掉了浏览器,在下次打开时,依然会读取到上一次的记录。是个非常小巧实用的本地备忘录' : note;
textarea.val(value).focus().on('keyup', function(){
layui.data(setter.tableName, {
key: 'note'
,value: this.value
});
});
}
})
}
//全屏
,fullscreen: function(othis){
var SCREEN_FULL = 'layui-icon-screen-full'
,SCREEN_REST = 'layui-icon-screen-restore'
,iconElem = othis.children("i");
if(iconElem.hasClass(SCREEN_FULL)){
admin.fullScreen();
iconElem.addClass(SCREEN_REST).removeClass(SCREEN_FULL);
} else {
admin.exitScreen();
iconElem.addClass(SCREEN_FULL).removeClass(SCREEN_REST);
}
}
//弹出关于面板
,about: function(){
admin.popupRight({
id: 'LAY_adminPopupAbout'
,success: function(){
view(this.id).render('system/about');
}
});
}
//弹出更多面板
,more: function(){
admin.popupRight({
id: 'LAY_adminPopupMore'
,success: function(){
view(this.id).render('system/more');
}
});
}
//返回上一页
,back: function(){
history.back();
}
//主题设置
,setTheme: function(othis){
var index = othis.data('index')
,nextIndex = othis.siblings('.layui-this').data('index');
if(othis.hasClass(THIS)) return;
othis.addClass(THIS).siblings('.layui-this').removeClass(THIS);
admin.initTheme(index);
}
//左右滚动页面标签
,rollPage: function(type, index){
var tabsHeader = $('#LAY_app_tabsheader')
,liItem = tabsHeader.children('li')
,scrollWidth = tabsHeader.prop('scrollWidth')
,outerWidth = tabsHeader.outerWidth()
,tabsLeft = parseFloat(tabsHeader.css('left'));
//右左往右
if(type === 'left'){
if(!tabsLeft && tabsLeft <=0) return;
//当前的left减去可视宽度用于与上一轮的页标比较
var prefLeft = -tabsLeft - outerWidth;
liItem.each(function(index, item){
var li = $(item)
,left = li.position().left;
if(left >= prefLeft){
tabsHeader.css('left', -left);
return false;
}
});
} else if(type === 'auto'){ //自动滚动
(function(){
var thisLi = liItem.eq(index), thisLeft;
if(!thisLi[0]) return;
thisLeft = thisLi.position().left;
//当目标标签在可视区域左侧时
if(thisLeft < -tabsLeft){
return tabsHeader.css('left', -thisLeft);
}
//当目标标签在可视区域右侧时
if(thisLeft + thisLi.outerWidth() >= outerWidth - tabsLeft){
var subLeft = thisLeft + thisLi.outerWidth() - (outerWidth - tabsLeft);
liItem.each(function(i, item){
var li = $(item)
,left = li.position().left;
//从当前可视区域的最左第二个节点遍历,如果减去最左节点的差 > 目标在右侧不可见的宽度,则将该节点放置可视区域最左
if(left + tabsLeft > 0){
if(left - tabsLeft > subLeft){
tabsHeader.css('left', -left);
return false;
}
}
});
}
}());
} else {
//默认向左滚动
liItem.each(function(i, item){
var li = $(item)
,left = li.position().left;
if(left + li.outerWidth() >= outerWidth - tabsLeft){
tabsHeader.css('left', -left);
return false;
}
});
}
}
//向右滚动页面标签
,leftPage: function(){
events.rollPage('left');
}
//向左滚动页面标签
,rightPage: function(){
events.rollPage();
}
//关闭当前标签页
,closeThisTabs: function(){
var topAdmin = parent === self ? admin : parent.layui.admin;
topAdmin.closeThisTabs();
}
//关闭其它标签页
,closeOtherTabs: function(type){
var TABS_REMOVE = 'LAY-system-pagetabs-remove';
if(type === 'all'){
$(TABS_HEADER+ ':gt(0)').remove();
$(APP_BODY).find('.'+ TABS_BODY+ ':gt(0)').remove();
$(TABS_HEADER).eq(0).trigger('click');
} else {
$(TABS_HEADER).each(function(index, item){
if(index && index != admin.tabsPage.index){
$(item).addClass(TABS_REMOVE);
admin.tabsBody(index).addClass(TABS_REMOVE);
}
});
$('.'+ TABS_REMOVE).remove();
}
}
//关闭全部标签页
,closeAllTabs: function(){
events.closeOtherTabs('all');
//location.hash = '';
}
//遮罩
,shade: function(){
admin.sideFlexible();
}
//呼出IM 示例
,im: function(){
admin.popup({
id: 'LAY-popup-layim-demo' //定义唯一ID防止重复弹出
,shade: 0
,area: ['800px', '300px']
,title: '面板外的操作示例'
,offset: 'lb'
,success: function(){
//将 views 目录下的某视图文件内容渲染给该面板
layui.view(this.id).render('layim/demo').then(function(){
layui.use('im');
});
}
})
}
};
//初始
!function(){
//主题初始化,本地主题记录优先,其次为 initColorIndex
var local = layui.data(setter.tableName);
if(local.theme){
admin.theme(local.theme);
} else if(setter.theme){
admin.initTheme(setter.theme.initColorIndex);
}
//常规版默认开启多标签页
if(!('pageTabs' in layui.setter)) layui.setter.pageTabs = true;
//不开启页面标签时
if(!setter.pageTabs){
$('#LAY_app_tabs').addClass(HIDE);
container.addClass('layadmin-tabspage-none');
}
//低版本IE提示
if(device.ie && device.ie < 10){
view.error('IE'+ device.ie + '下访问可能不佳推荐使用Chrome / Firefox / Edge 等高级浏览器', {
offset: 'auto'
,id: 'LAY_errorIE'
});
}
}();
//admin.prevRouter = {}; //上一个路由
//监听 tab 组件切换,同步 index
element.on('tab('+ FILTER_TAB_TBAS +')', function(data){
admin.tabsPage.index = data.index;
});
//监听选项卡切换,改变菜单状态
admin.on('tabsPage(setMenustatus)', function(router){
var pathURL = router.url, getData = function(item){
return {
list: item.children('.layui-nav-child')
,a: item.children('*[lay-href]')
}
}
,sideMenu = $('#'+ SIDE_MENU)
,SIDE_NAV_ITEMD = 'layui-nav-itemed'
//捕获对应菜单
,matchMenu = function(list){
list.each(function(index1, item1){
var othis1 = $(item1)
,data1 = getData(othis1)
,listChildren1 = data1.list.children('dd')
,matched1 = pathURL === data1.a.attr('lay-href');
listChildren1.each(function(index2, item2){
var othis2 = $(item2)
,data2 = getData(othis2)
,listChildren2 = data2.list.children('dd')
,matched2 = pathURL === data2.a.attr('lay-href');
listChildren2.each(function(index3, item3){
var othis3 = $(item3)
,data3 = getData(othis3)
,matched3 = pathURL === data3.a.attr('lay-href');
if(matched3){
var selected = data3.list[0] ? SIDE_NAV_ITEMD : THIS;
othis3.addClass(selected).siblings().removeClass(selected); //标记选择器
return false;
}
});
if(matched2){
var selected = data2.list[0] ? SIDE_NAV_ITEMD : THIS;
othis2.addClass(selected).siblings().removeClass(selected); //标记选择器
return false
}
});
if(matched1){
var selected = data1.list[0] ? SIDE_NAV_ITEMD : THIS;
othis1.addClass(selected).siblings().removeClass(selected); //标记选择器
return false;
}
});
}
//重置状态
sideMenu.find('.'+ THIS).removeClass(THIS);
//移动端点击菜单时自动收缩
if(admin.screen() < 2) admin.sideFlexible();
//开始捕获
matchMenu(sideMenu.children('li'));
});
//监听侧边导航点击事件
element.on('nav(layadmin-system-side-menu)', function(elem){
if(elem.siblings('.layui-nav-child')[0] && container.hasClass(SIDE_SHRINK)){
admin.sideFlexible('spread');
layer.close(elem.data('index'));
};
admin.tabsPage.type = 'nav';
});
//监听选项卡的更多操作
element.on('nav(layadmin-pagetabs-nav)', function(elem){
var dd = elem.parent();
dd.removeClass(THIS);
dd.parent().removeClass(SHOW);
});
//同步路由
var setThisRouter = function(othis){
var layid = othis.attr('lay-id')
,attr = othis.attr('lay-attr')
,index = othis.index();
admin.tabsBodyChange(index, {
url: attr
});
//location.hash = layid === setter.entry ? '/' : attr;
}
,TABS_HEADER = '#LAY_app_tabsheader>li';
//标签页标题点击
$body.on('click', TABS_HEADER, function(){
var othis = $(this)
,index = othis.index();
admin.tabsPage.type = 'tab';
admin.tabsPage.index = index;
setThisRouter(othis);
});
//监听 tabspage 删除
element.on('tabDelete('+ FILTER_TAB_TBAS +')', function(obj){
var othis = $(TABS_HEADER+ '.layui-this');
obj.index && admin.tabsBody(obj.index).remove();
setThisRouter(othis);
//移除resize事件
admin.delResize();
});
//页面跳转
$body.on('click', '*[lay-href]', function(){
var othis = $(this)
,href = othis.attr('lay-href')
,text = othis.attr('lay-text')
,router = layui.router();
admin.tabsPage.elem = othis;
//admin.prevRouter[router.path[0]] = router.href; //记录上一次各菜单的路由信息
//执行跳转
var topLayui = parent === self ? layui : top.layui;
topLayui.index.openTabsPage(href, text || othis.text());
//如果为当前页,则执行刷新
if(href === admin.tabsBody(admin.tabsPage.index).find('iframe').attr('src')){
admin.events.refresh();
}
});
//点击事件
$body.on('click', '*[layadmin-event]', function(){
var othis = $(this)
,attrEvent = othis.attr('layadmin-event');
events[attrEvent] && events[attrEvent].call(this, othis);
});
//tips
$body.on('mouseenter', '*[lay-tips]', function(){
var othis = $(this);
if(othis.parent().hasClass('layui-nav-item') && !container.hasClass(SIDE_SHRINK)) return;
var tips = othis.attr('lay-tips')
,offset = othis.attr('lay-offset')
,direction = othis.attr('lay-direction')
,index = layer.tips(tips, this, {
tips: direction || 1
,time: -1
,success: function(layero, index){
if(offset){
layero.css('margin-left', offset + 'px');
}
}
});
othis.data('index', index);
}).on('mouseleave', '*[lay-tips]', function(){
layer.close($(this).data('index'));
});
//窗口resize事件
var resizeSystem = layui.data.resizeSystem = function(){
//layer.close(events.note.index);
layer.closeAll('tips');
if(!resizeSystem.lock){
setTimeout(function(){
admin.sideFlexible(admin.screen() < 2 ? '' : 'spread');
delete resizeSystem.lock;
}, 100);
}
resizeSystem.lock = true;
}
$win.on('resize', layui.data.resizeSystem);
//设置组件全局 token
;!function(){
var request = setter.request;
if(request.tokenName){
var obj = {};
obj[request.tokenName] = layui.data(setter.tableName)[request.tokenName] || ''
//table
table.set({
headers: obj, //通过 request 头传递
where: obj //通过参数传递
});
//upload
upload.set({
headers: obj, //通过 request 头传递
data: obj //通过参数传递
});
}
}();
//接口输出
exports('admin', admin);
});

View File

@@ -0,0 +1,819 @@
/**
@Namelayui.tree 树
@Authorstar1029
@LicenseMIT
*/
layui.define('form', function(exports){
"use strict";
var $ = layui.$
,form = layui.form
,layer = layui.layer
//模块名
,MOD_NAME = 'cateTree'
//外部接口
,cateTree = {
config: {}
,index: layui[MOD_NAME] ? (layui[MOD_NAME].index + 10000) : 0
//设置全局项
,set: function(options){
var that = this;
that.config = $.extend({}, that.config, options);
return that;
}
//事件监听
,on: function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
}
}
//操作当前实例
,thisModule = function(){
var that = this
,options = that.config
,id = options.id || that.index;
thisModule.that[id] = that; //记录当前实例对象
thisModule.config[id] = options; //记录当前实例配置项
return {
config: options
//重置实例
,reload: function(options){
that.reload.call(that, options);
}
,getChecked: function(){
return that.getChecked.call(that);
}
,setChecked: function(id){//设置值
return that.setChecked.call(that, id);
}
}
}
//获取当前实例配置项
,getThisModuleConfig = function(id){
var config = thisModule.config[id];
if(!config) hint.error('The ID option was not found in the '+ MOD_NAME +' instance');
return config || null;
}
//字符常量
,SHOW = 'layui-show', HIDE = 'layui-hide', NONE = 'layui-none', DISABLED = 'layui-disabled'
,ELEM_VIEW = 'layui-tree', ELEM_SET = 'layui-tree-set', ICON_CLICK = 'layui-tree-iconClick'
,ICON_ADD = 'layui-icon-addition', ICON_SUB = 'layui-icon-subtraction', ELEM_ENTRY = 'layui-tree-entry', ELEM_MAIN = 'layui-tree-main', ELEM_TEXT = 'layui-tree-txt', ELEM_PACK = 'layui-tree-pack', ELEM_SPREAD = 'layui-tree-spread'
,ELEM_LINE_SHORT = 'layui-tree-setLineShort', ELEM_SHOW = 'layui-tree-showLine', ELEM_EXTEND = 'layui-tree-lineExtend'
//构造器
,Class = function(options){
var that = this;
that.index = ++cateTree.index;
that.config = $.extend({}, that.config, cateTree.config, options);
that.render();
};
//默认配置
Class.prototype.config = {
data: [] //数据
,showCheckbox: false //是否显示复选框
,showLine: true //是否开启连接线
,accordion: false //是否开启手风琴模式
,onlyIconControl: false //是否仅允许节点左侧图标控制展开收缩
,isJump: false //是否允许点击节点时弹出新窗口跳转
,edit: false //是否开启节点的操作图标
,checkChild: true // 是否选择子元素
,text: {
defaultNodeName: '未命名' //节点默认名称
,none: '无数据' //数据为空时的文本提示
}
};
//重载实例
Class.prototype.reload = function(options){
var that = this;
layui.each(options, function(key, item){
if(item.constructor === Array) delete that.config[key];
});
that.config = $.extend(true, {}, that.config, options);
that.render();
};
//主体渲染
Class.prototype.render = function(){
var that = this
,options = that.config;
that.checkids = [];
var temp = $('<div class="layui-tree'+ (options.showCheckbox ? " layui-form" : "") + (options.showLine ? " layui-tree-line" : "") +'" lay-filter="LAY-tree-'+ that.index +'"></div>');
that.tree(temp);
var othis = options.elem = $(options.elem);
if(!othis[0]) return;
//索引
that.key = options.id || that.index;
//插入组件结构
that.elem = temp;
that.elemNone = $('<div class="layui-tree-emptyText">'+ options.text.none +'</div>');
othis.html(that.elem);
if(that.elem.find('.layui-tree-set').length == 0){
return that.elem.append(that.elemNone);
};
//复选框渲染
if(options.showCheckbox){
that.renderForm('checkbox');
};
that.elem.find('.layui-tree-set').each(function(){
var othis = $(this);
//最外层
if(!othis.parent('.layui-tree-pack')[0]){
othis.addClass('layui-tree-setHide');
};
//没有下一个节点 上一层父级有延伸线
if(!othis.next()[0] && othis.parents('.layui-tree-pack').eq(1).hasClass('layui-tree-lineExtend')){
othis.addClass(ELEM_LINE_SHORT);
};
//没有下一个节点 外层最后一个
if(!othis.next()[0] && !othis.parents('.layui-tree-set').eq(0).next()[0]){
othis.addClass(ELEM_LINE_SHORT);
};
});
that.events();
};
//渲染表单
Class.prototype.renderForm = function(type){
form.render(type, 'LAY-tree-'+ this.index);
};
//节点解析
Class.prototype.tree = function(elem, children){
var that = this
,options = that.config
,data = children || options.data;
//遍历数据
layui.each(data, function(index, item){
var hasChild = item.children && item.children.length > 0
,packDiv = $('<div class="layui-tree-pack" '+ (item.spread ? 'style="display: block;"' : '') +'></div>')
,entryDiv = $(['<div data-id="'+ item.id +'" class="layui-tree-set'+ (item.spread ? " layui-tree-spread" : "") + (item.checked ? " layui-tree-checkedFirst" : "") +'">'
,'<div class="layui-tree-entry">'
,'<div class="layui-tree-main">'
//箭头
,function(){
if(options.showLine){
if(hasChild){
return '<span class="layui-tree-iconClick layui-tree-icon"><i class="layui-icon '+ (item.spread ? "layui-icon-subtraction" : "layui-icon-addition") +'"></i></span>';
}else{
return '<span class="layui-tree-iconClick"><i class="layui-icon layui-icon-file"></i></span>';
};
}else{
return '<span class="layui-tree-iconClick"><i class="layui-tree-iconArrow '+ (hasChild ? "": HIDE) +'"></i></span>';
};
}()
//复选框
,function(){
return options.showCheckbox ? '<input type="checkbox" name="'+ (item.field || ('layuiTreeCheck_'+ item.id)) +'" same="layuiTreeCheck" lay-skin="primary" '+ (item.disabled ? "disabled" : "") +' value="'+ item.id +'">' : '';
}()
//节点
,function(){
if(options.isJump && item.href){
return '<a href="'+ item.href +'" target="_blank" class="'+ ELEM_TEXT +'">'+ (item.title || item.label || options.text.defaultNodeName) +'</a>';
}else{
return '<span class="'+ ELEM_TEXT + (item.disabled ? ' '+ DISABLED : '') +'">'+ (item.title || item.label || options.text.defaultNodeName) +'</span>';
}
}()
,'</div>'
//节点操作图标
,function(){
if(!options.edit) return '';
var editIcon = {
add: '<i class="layui-icon layui-icon-add-1" data-type="add"></i>'
,update: '<i class="layui-icon layui-icon-edit" data-type="update"></i>'
,del: '<i class="layui-icon layui-icon-delete" data-type="del"></i>'
}, arr = ['<div class="layui-btn-group layui-tree-btnGroup">'];
if(options.edit === true){
options.edit = ['update', 'del']
}
if(typeof options.edit === 'object'){
layui.each(options.edit, function(i, val){
arr.push(editIcon[val] || '')
});
return arr.join('') + '</div>';
}
}()
,'</div></div>'].join(''));
//如果有子节点,则递归继续生成树
if(hasChild){
entryDiv.append(packDiv);
that.tree(packDiv, item.children);
};
elem.append(entryDiv);
//若有前置节点,前置节点加连接线
if(entryDiv.prev('.'+ELEM_SET)[0]){
entryDiv.prev().children('.layui-tree-pack').addClass('layui-tree-showLine');
};
//若无子节点,则父节点加延伸线
if(!hasChild){
entryDiv.parent('.layui-tree-pack').addClass('layui-tree-lineExtend');
};
//展开节点操作
that.spread(entryDiv, item);
//选择框
if(options.showCheckbox){
item.checked && that.checkids.push(item.id);
that.checkClick(entryDiv, item);
}
//操作节点
options.edit && that.operate(entryDiv, item);
});
};
//展开节点
Class.prototype.spread = function(elem, item){
var that = this
,options = that.config
,entry = elem.children('.'+ELEM_ENTRY)
,elemMain = entry.children('.'+ ELEM_MAIN)
,elemIcon = entry.find('.'+ ICON_CLICK)
,elemText = entry.find('.'+ ELEM_TEXT)
,touchOpen = options.onlyIconControl ? elemIcon : elemMain //判断展开通过节点还是箭头图标
,state = '';
//展开收缩
touchOpen.on('click', function(e){
var packCont = elem.children('.'+ELEM_PACK)
,iconClick = touchOpen.children('.layui-icon')[0] ? touchOpen.children('.layui-icon') : touchOpen.find('.layui-tree-icon').children('.layui-icon');
//若没有子节点
if(!packCont[0]){
state = 'normal';
}else{
if(elem.hasClass(ELEM_SPREAD)){
elem.removeClass(ELEM_SPREAD);
packCont.slideUp(200);
iconClick.removeClass(ICON_SUB).addClass(ICON_ADD);
}else{
elem.addClass(ELEM_SPREAD);
packCont.slideDown(200);
iconClick.addClass(ICON_SUB).removeClass(ICON_ADD);
//是否手风琴
if(options.accordion){
var sibls = elem.siblings('.'+ELEM_SET);
sibls.removeClass(ELEM_SPREAD);
sibls.children('.'+ELEM_PACK).slideUp(200);
sibls.find('.layui-tree-icon').children('.layui-icon').removeClass(ICON_SUB).addClass(ICON_ADD);
};
};
};
});
//点击回调
elemText.on('click', function(){
var othis = $(this);
//判断是否禁用状态
if(othis.hasClass(DISABLED)) return;
//判断展开收缩状态
if(elem.hasClass(ELEM_SPREAD)){
state = options.onlyIconControl ? 'open' : 'close';
} else {
state = options.onlyIconControl ? 'close' : 'open';
}
//点击产生的回调
options.click && options.click({
elem: elem
,state: state
,data: item
});
});
};
//计算复选框选中状态
Class.prototype.setCheckbox = function(elem, item, elemCheckbox){
var that = this
,options = that.config
,checked = elemCheckbox.prop('checked');
if(elemCheckbox.prop('disabled')) return;
//同步子节点选中状态
if((typeof item.children === 'object' || elem.find('.'+ELEM_PACK)[0])&&(options.checkChild || !checked)){
var childs = elem.find('.'+ ELEM_PACK).find('input[same="layuiTreeCheck"]');
childs.each(function(){
if(this.disabled) return; //不可点击则跳过
this.checked = checked;
});
};
//同步父节点选中状态
var setParentsChecked = function(thisNodeElem){
//若无父节点,则终止递归
if(!thisNodeElem.parents('.'+ ELEM_SET)[0]) return;
var state
,parentPack = thisNodeElem.parent('.'+ ELEM_PACK)
,parentNodeElem = parentPack.parent()
,parentCheckbox = parentPack.prev().find('input[same="layuiTreeCheck"]');
//如果子节点有任意一条选中,则父节点为选中状态
if(checked){
parentCheckbox.prop('checked', checked);
} else { //如果当前节点取消选中,则根据计算“兄弟和子孙”节点选中状态,来同步父节点选中状态
parentPack.find('input[same="layuiTreeCheck"]').each(function(){
if(this.checked){
state = true;
}
});
// 如果兄弟子孙节点全部未选中,则父节点也应为非选中状态
// 如果希望兄弟子孙节点全部未选中时,父节点保持选中状态,请注释下面这行代码
// state || parentCheckbox.prop('checked', false);
}
//向父节点递归
setParentsChecked(parentNodeElem);
};
setParentsChecked(elem);
that.renderForm('checkbox');
};
//复选框选择
Class.prototype.checkClick = function(elem, item){
var that = this
,options = that.config
,entry = elem.children('.'+ ELEM_ENTRY)
,elemMain = entry.children('.'+ ELEM_MAIN);
//点击复选框
elemMain.on('click', 'input[same="layuiTreeCheck"]+', function(e){
layui.stope(e); //阻止点击节点事件
var elemCheckbox = $(this).prev()
,checked = elemCheckbox.prop('checked');
if(elemCheckbox.prop('disabled')) return;
that.setCheckbox(elem, item, elemCheckbox);
//复选框点击产生的回调
options.oncheck && options.oncheck({
elem: elem
,checked: checked
,data: item
});
});
};
//节点操作
Class.prototype.operate = function(elem, item){
var that = this
,options = that.config
,entry = elem.children('.'+ ELEM_ENTRY)
,elemMain = entry.children('.'+ ELEM_MAIN);
entry.children('.layui-tree-btnGroup').on('click', '.layui-icon', function(e){
layui.stope(e); //阻止节点操作
var type = $(this).data("type")
,packCont = elem.children('.'+ELEM_PACK)
,returnObj = {
data: item
,type: type
,elem:elem
};
//增加
if(type == 'add'){
//若节点本身无子节点
if(!packCont[0]){
//若开启连接线,更改图标样式
if(options.showLine){
elemMain.find('.'+ICON_CLICK).addClass('layui-tree-icon');
elemMain.find('.'+ICON_CLICK).children('.layui-icon').addClass(ICON_ADD).removeClass('layui-icon-file');
//若未开启连接线,显示箭头
}else{
elemMain.find('.layui-tree-iconArrow').removeClass(HIDE);
};
//节点添加子节点容器
elem.append('<div class="layui-tree-pack"></div>');
};
//新增节点
var key = options.operate && options.operate(returnObj)
,obj = {};
obj.title = options.text.defaultNodeName;
obj.id = key;
that.tree(elem.children('.'+ELEM_PACK), [obj]);
//放在新增后面,因为要对元素进行操作
if(options.showLine){
//节点本身无子节点
if(!packCont[0]){
//遍历兄弟节点,判断兄弟节点是否有子节点
var siblings = elem.siblings('.'+ELEM_SET), num = 1
,parentPack = elem.parent('.'+ELEM_PACK);
layui.each(siblings, function(index, i){
if(!$(i).children('.'+ELEM_PACK)[0]){
num = 0;
};
});
//若兄弟节点都有子节点
if(num == 1){
//兄弟节点添加连接线
siblings.children('.'+ELEM_PACK).addClass(ELEM_SHOW);
siblings.children('.'+ELEM_PACK).children('.'+ELEM_SET).removeClass(ELEM_LINE_SHORT);
elem.children('.'+ELEM_PACK).addClass(ELEM_SHOW);
//父级移除延伸线
parentPack.removeClass(ELEM_EXTEND);
//同层节点最后一个更改线的状态
parentPack.children('.'+ELEM_SET).last().children('.'+ELEM_PACK).children('.'+ELEM_SET).last().addClass(ELEM_LINE_SHORT);
}else{
elem.children('.'+ELEM_PACK).children('.'+ELEM_SET).addClass(ELEM_LINE_SHORT);
};
}else{
//添加延伸线
if(!packCont.hasClass(ELEM_EXTEND)){
packCont.addClass(ELEM_EXTEND);
};
//子节点添加延伸线
elem.find('.'+ELEM_PACK).each(function(){
$(this).children('.'+ELEM_SET).last().addClass(ELEM_LINE_SHORT);
});
//如果前一个节点有延伸线
if(packCont.children('.'+ELEM_SET).last().prev().hasClass(ELEM_LINE_SHORT)){
packCont.children('.'+ELEM_SET).last().prev().removeClass(ELEM_LINE_SHORT);
}else{
//若之前的没有,说明处于连接状态
packCont.children('.'+ELEM_SET).last().removeClass(ELEM_LINE_SHORT);
};
//若是最外层,要始终保持相连的状态
if(!elem.parent('.'+ELEM_PACK)[0] && elem.next()[0]){
packCont.children('.'+ELEM_SET).last().removeClass(ELEM_LINE_SHORT);
};
};
};
if(!options.showCheckbox) return;
//若开启复选框,同步新增节点状态
if(elemMain.find('input[same="layuiTreeCheck"]')[0].checked){
var packLast = elem.children('.'+ELEM_PACK).children('.'+ELEM_SET).last();
packLast.find('input[same="layuiTreeCheck"]')[0].checked = true;
};
that.renderForm('checkbox');
//修改
}else if(type == 'update'){
var text = elemMain.children('.'+ ELEM_TEXT).html();
elemMain.children('.'+ ELEM_TEXT).html('');
//添加输入框,覆盖在文字上方
elemMain.append('<input type="text" class="layui-tree-editInput">');
//获取焦点
elemMain.children('.layui-tree-editInput').val(text).focus();
//嵌入文字移除输入框
var getVal = function(input){
var textNew = input.val().trim();
textNew = textNew ? textNew : options.text.defaultNodeName;
input.remove();
elemMain.children('.'+ ELEM_TEXT).html(textNew);
//同步数据
returnObj.data.title = textNew;
//节点修改的回调
options.operate && options.operate(returnObj);
};
//失去焦点
elemMain.children('.layui-tree-editInput').blur(function(){
getVal($(this));
});
//回车
elemMain.children('.layui-tree-editInput').on('keydown', function(e){
if(e.keyCode === 13){
e.preventDefault();
getVal($(this));
};
});
//删除
} else {
layer.confirm('确认删除该节点 "<span style="color: #999;">'+ (item.title || '') +'</span>" 吗?', function(index){
options.operate && options.operate(returnObj); //节点删除的回调
returnObj.status = 'remove'; //标注节点删除
layer.close(index);
//若删除最后一个,显示空数据提示
if(!elem.prev('.'+ELEM_SET)[0] && !elem.next('.'+ELEM_SET)[0] && !elem.parent('.'+ELEM_PACK)[0]){
elem.remove();
that.elem.append(that.elemNone);
return;
};
//若有兄弟节点
if(elem.siblings('.'+ELEM_SET).children('.'+ELEM_ENTRY)[0]){
//若开启复选框
if(options.showCheckbox){
//若开启复选框,进行下步操作
var elemDel = function(elem){
//若无父结点,则不执行
if(!elem.parents('.'+ELEM_SET)[0]) return;
var siblingTree = elem.siblings('.'+ELEM_SET).children('.'+ELEM_ENTRY)
,parentTree = elem.parent('.'+ELEM_PACK).prev()
,checkState = parentTree.find('input[same="layuiTreeCheck"]')[0]
,state = 1, num = 0;
//若父节点未勾选
if(checkState.checked == false){
//遍历兄弟节点
siblingTree.each(function(i, item1){
var input = $(item1).find('input[same="layuiTreeCheck"]')[0]
if(input.checked == false && !input.disabled){
state = 0;
};
//判断是否全为不可勾选框
if(!input.disabled){
num = 1;
};
});
//若有可勾选选择框并且已勾选
if(state == 1 && num == 1){
//勾选父节点
checkState.checked = true;
that.renderForm('checkbox');
//向上遍历祖先节点
elemDel(parentTree.parent('.'+ELEM_SET));
};
};
};
elemDel(elem);
};
//若开启连接线
if(options.showLine){
//遍历兄弟节点,判断兄弟节点是否有子节点
var siblings = elem.siblings('.'+ELEM_SET), num = 1
,parentPack = elem.parent('.'+ELEM_PACK);
layui.each(siblings, function(index, i){
if(!$(i).children('.'+ELEM_PACK)[0]){
num = 0;
};
});
//若兄弟节点都有子节点
if(num == 1){
//若节点本身无子节点
if(!packCont[0]){
//父级去除延伸线,因为此时子节点里没有空节点
parentPack.removeClass(ELEM_EXTEND);
siblings.children('.'+ELEM_PACK).addClass(ELEM_SHOW);
siblings.children('.'+ELEM_PACK).children('.'+ELEM_SET).removeClass(ELEM_LINE_SHORT);
};
//若为最后一个节点
if(!elem.next()[0]){
elem.prev().children('.'+ELEM_PACK).children('.'+ELEM_SET).last().addClass(ELEM_LINE_SHORT);
}else{
parentPack.children('.'+ELEM_SET).last().children('.'+ELEM_PACK).children('.'+ELEM_SET).last().addClass(ELEM_LINE_SHORT);
};
//若为最外层最后一个节点,去除前一个结点的连接线
if(!elem.next()[0] && !elem.parents('.'+ELEM_SET)[1] && !elem.parents('.'+ELEM_SET).eq(0).next()[0]){
elem.prev('.'+ELEM_SET).addClass(ELEM_LINE_SHORT);
};
}else{
//若为最后一个节点且有延伸线
if(!elem.next()[0] && elem.hasClass(ELEM_LINE_SHORT)){
elem.prev().addClass(ELEM_LINE_SHORT);
};
};
};
}else{
//若无兄弟节点
var prevDiv = elem.parent('.'+ELEM_PACK).prev();
//若开启了连接线
if(options.showLine){
prevDiv.find('.'+ICON_CLICK).removeClass('layui-tree-icon');
prevDiv.find('.'+ICON_CLICK).children('.layui-icon').removeClass(ICON_SUB).addClass('layui-icon-file');
//父节点所在层添加延伸线
var pare = prevDiv.parents('.'+ELEM_PACK).eq(0);
pare.addClass(ELEM_EXTEND);
//兄弟节点最后子节点添加延伸线
pare.children('.'+ELEM_SET).each(function(){
$(this).children('.'+ELEM_PACK).children('.'+ELEM_SET).last().addClass(ELEM_LINE_SHORT);
});
}else{
//父节点隐藏箭头
prevDiv.find('.layui-tree-iconArrow').addClass(HIDE);
};
//移除展开属性
elem.parents('.'+ELEM_SET).eq(0).removeClass(ELEM_SPREAD);
//移除节点容器
elem.parent('.'+ELEM_PACK).remove();
};
elem.remove();
});
};
});
};
//部分事件
Class.prototype.events = function(){
var that = this
,options = that.config
,checkWarp = that.elem.find('.layui-tree-checkedFirst');
//初始选中
that.setChecked(that.checkids);
//搜索
that.elem.find('.layui-tree-search').on('keyup', function(){
var input = $(this)
,val = input.val()
,pack = input.nextAll()
,arr = [];
//遍历所有的值
pack.find('.'+ ELEM_TEXT).each(function(){
var entry = $(this).parents('.'+ELEM_ENTRY);
//若值匹配,加一个类以作标识
if($(this).html().indexOf(val) != -1){
arr.push($(this).parent());
var select = function(div){
div.addClass('layui-tree-searchShow');
//向上父节点渲染
if(div.parent('.'+ELEM_PACK)[0]){
select(div.parent('.'+ELEM_PACK).parent('.'+ELEM_SET));
};
};
select(entry.parent('.'+ELEM_SET));
};
});
//根据标志剔除
pack.find('.'+ELEM_ENTRY).each(function(){
var parent = $(this).parent('.'+ELEM_SET);
if(!parent.hasClass('layui-tree-searchShow')){
parent.addClass(HIDE);
};
});
if(pack.find('.layui-tree-searchShow').length == 0){
that.elem.append(that.elemNone);
};
//节点过滤的回调
options.onsearch && options.onsearch({
elem: arr
});
});
//还原搜索初始状态
that.elem.find('.layui-tree-search').on('keydown', function(){
$(this).nextAll().find('.'+ELEM_ENTRY).each(function(){
var parent = $(this).parent('.'+ELEM_SET);
parent.removeClass('layui-tree-searchShow '+ HIDE);
});
if($('.layui-tree-emptyText')[0]) $('.layui-tree-emptyText').remove();
});
};
//得到选中节点
Class.prototype.getChecked = function(){
var that = this
,options = that.config
,checkId = []
,checkData = [];
//遍历节点找到选中索引
that.elem.find('.layui-form-checked').each(function(){
checkId.push($(this).prev()[0].value);
});
//遍历节点
var eachNodes = function(data, checkNode){
layui.each(data, function(index, item){
layui.each(checkId, function(index2, item2){
if(item.id == item2){
var cloneItem = $.extend({}, item);
delete cloneItem.children;
checkNode.push(cloneItem);
if(item.children){
cloneItem.children = [];
eachNodes(item.children, cloneItem.children);
}
return true
}
});
});
};
eachNodes($.extend({}, options.data), checkData);
return {nodes:checkData, checkId:checkId};
};
//设置选中节点
Class.prototype.setChecked = function(checkedId){
var that = this
,options = that.config;
//初始选中
that.elem.find('.'+ELEM_SET).each(function(i, item){
var thisId = $(this).data('id')
,input = $(item).children('.'+ELEM_ENTRY).find('input[same="layuiTreeCheck"]')
,reInput = input.next()[0];
//若返回数字
if(typeof checkedId === 'number'){
if(thisId == checkedId){
if(!input[0].checked){
reInput.click();
};
return false;
};
}
//若返回数组
else if(typeof checkedId === 'object'){
layui.each(checkedId, function(index, value){
if(value == thisId && !input[0].checked){
reInput.click();
return true;
}
});
};
});
};
//记录所有实例
thisModule.that = {}; //记录所有实例对象
thisModule.config = {}; //记录所有实例配置项
//重载实例
cateTree.reload = function(id, options){
var that = thisModule.that[id];
that.reload(options);
return thisModule.call(that);
};
//获得选中的节点数据
cateTree.getChecked = function(id){
var that = thisModule.that[id];
return that.getChecked();
};
//设置选中节点
cateTree.setChecked = function(id, checkedId){
var that = thisModule.that[id];
return that.setChecked(checkedId);
};
//核心入口
cateTree.render = function(options){
var inst = new Class(options);
return thisModule.call(inst);
};
exports(MOD_NAME, cateTree);
})

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,267 @@
/**
@Nameecharts 主题
@LicenseGPL-2
*/
layui.define(function(exports) {
exports('echartsTheme', {
// 默认色板
color: [
'#009688','#1E9FFF','#5FB878','#FFB980','#D87A80',
'#8d98b3','#e5cf0d','#97b552','#95706d','#dc69aa',
'#07a2a4','#9a7fd1','#588dd5','#f5994e','#c05050',
'#59678c','#c9ab00','#7eb00a','#6f5553','#c14089'
],
// 图表标题
title: {
textStyle: {
fontWeight: 'normal',
color: '#666' // 主标题文字颜色
}
},
// 值域
dataRange: {
itemWidth: 15,
color: ['#009688','#e0ffff']
},
// 工具箱
toolbox: {
color : ['#1e90ff', '#1e90ff', '#1e90ff', '#1e90ff'],
effectiveColor : '#ff4500'
},
// 提示框
tooltip: {
backgroundColor: 'rgba(50,50,50,0.5)', // 提示背景颜色默认为透明度为0.7的黑色
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'line', // 默认为直线,可选为:'line' | 'shadow'
lineStyle : { // 直线指示器样式设置
color: '#009688'
},
crossStyle: {
color: '#008acd'
},
shadowStyle : { // 阴影指示器样式设置
color: 'rgba(200,200,200,0.2)'
}
}
},
// 区域缩放控制器
dataZoom: {
dataBackgroundColor: '#efefff', // 数据背景颜色
fillerColor: 'rgba(182,162,222,0.2)', // 填充颜色
handleColor: '#008acd' // 手柄颜色
},
// 网格
grid: {
borderColor: '#eee'
},
// 类目轴 - X轴
categoryAxis: {
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
color: '#009688'
}
},
axisTick: { //小标记
show: false
},
splitLine: { // 分隔线
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: ['#eee']
}
}
},
// 数值型坐标轴默认参数 - Y轴
valueAxis: {
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
color: '#009688'
}
},
splitArea : {
show : true,
areaStyle : {
color: ['rgba(250,250,250,0.1)','rgba(200,200,200,0.1)']
}
},
splitLine: { // 分隔线
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: ['#eee']
}
}
},
polar : {
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
color: '#ddd'
}
},
splitArea : {
show : true,
areaStyle : {
color: ['rgba(250,250,250,0.2)','rgba(200,200,200,0.2)']
}
},
splitLine : {
lineStyle : {
color : '#ddd'
}
}
},
timeline : {
lineStyle : {
color : '#009688'
},
controlStyle : {
normal : { color : '#009688'},
emphasis : { color : '#009688'}
},
symbol : 'emptyCircle',
symbolSize : 3
},
// 柱形图默认参数
bar: {
itemStyle: {
normal: {
barBorderRadius: 2
},
emphasis: {
barBorderRadius: 2
}
}
},
// 折线图默认参数
line: {
smooth : true,
symbol: 'emptyCircle', // 拐点图形类型
symbolSize: 3 // 拐点图形大小
},
// K线图默认参数
k: {
itemStyle: {
normal: {
color: '#d87a80', // 阳线填充颜色
color0: '#2ec7c9', // 阴线填充颜色
lineStyle: {
color: '#d87a80', // 阳线边框颜色
color0: '#2ec7c9' // 阴线边框颜色
}
}
}
},
// 散点图默认参数
scatter: {
symbol: 'circle', // 图形类型
symbolSize: 4 // 图形大小半宽半径参数当图形为方向或菱形则总宽度为symbolSize * 2
},
// 雷达图默认参数
radar : {
symbol: 'emptyCircle', // 图形类型
symbolSize:3
//symbol: null, // 拐点图形类型
//symbolRotate : null, // 图形旋转控制
},
map: {
itemStyle: {
normal: {
areaStyle: {
color: '#ddd'
},
label: {
textStyle: {
color: '#d87a80'
}
}
},
emphasis: { // 也是选中样式
areaStyle: {
color: '#fe994e'
}
}
}
},
force : {
itemStyle: {
normal: {
linkStyle : {
color : '#1e90ff'
}
}
}
},
chord : {
itemStyle : {
normal : {
borderWidth: 1,
borderColor: 'rgba(128, 128, 128, 0.5)',
chordStyle : {
lineStyle : {
color : 'rgba(128, 128, 128, 0.5)'
}
}
},
emphasis : {
borderWidth: 1,
borderColor: 'rgba(128, 128, 128, 0.5)',
chordStyle : {
lineStyle : {
color : 'rgba(128, 128, 128, 0.5)'
}
}
}
}
},
gauge : {
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
color: [[0.2, '#2ec7c9'],[0.8, '#5ab1ef'],[1, '#d87a80']],
width: 10
}
},
axisTick: { // 坐标轴小标记
splitNumber: 10, // 每份split细分多少段
length :15, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: 'auto'
}
},
splitLine: { // 分隔线
length :22, // 属性length控制线长
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: 'auto'
}
},
pointer : {
width : 5
}
},
textStyle: {
fontFamily: '微软雅黑, Arial, Verdana, sans-serif'
}
});
});

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>聊天记录</title>
<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
<style>
body .layim-chat-main{height: auto;}
</style>
</head>
<body>
<div class="layim-chat-main">
<ul id="LAY_view"></ul>
</div>
<div id="LAY_page" style="margin: 0 10px;"></div>
<textarea title="消息模版" id="LAY_tpl" style="display:none;">
{{# layui.each(d.data, function(index, item){
if(item.id == layui.layim.cache().mine.id){ }}
<li class="layim-chat-mine"><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite><i>{{ layui.data.date(item.timestamp) }}</i>{{ item.username }}</cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
{{# } else { }}
<li><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite>{{ item.username }}<i>{{ layui.data.date(item.timestamp) }}</i></cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
{{# }
}); }}
</textarea>
<!--
上述模版采用了 laytpl 语法
-->
<script src="//unpkg.com/layui/dist/layui.js"></script>
<script>
layui.link('../layim.css', 'skinlayimcss') //加载 css
layui.config({
layimPath: '../../' //配置 layim.js 所在目录
,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
}).use(['jquery'], function(){
var layim = parent.layui.layim
,laytpl = parent.layui.laytpl
,$ = layui.jquery
,laypage = parent.layui.laypage;
//聊天记录的分页此处不做演示,你可以采用 laypage
//开始请求聊天记录
var param = location.search //获得URL参数。该窗口url会携带会话id和type他们是你请求聊天记录的重要凭据
//实际使用时下述的res一般是通过 Ajax 获得,而此处仅仅只是演示数据格式
,res = {
code: 0
,msg: ''
,data: [{
username: '纸飞机'
,id: 100000
,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
,timestamp: 1480897882000
,content: '我方模拟记录111'
}, {
username: 'test123'
,id: 108101
,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
,timestamp: 1480897892000
,content: '对方模拟记录111'
},{
username: 'test123'
,id: 108101
,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
,timestamp: 1480897898000
,content: '对方模拟记录222'
},{
username: 'test123'
,id: 108101
,avatar: '' || layui.cache.layimAssetsPath + 'images/default.png'
,timestamp: 1480897908000
,content: '注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。\n该模版文件所在目录相对于layim.js\n/layim-assets/html/chatlog.html'
}]
}
//console.log(param)
var html = laytpl(LAY_tpl.value).render({
data: res.data
});
$('#LAY_view').html(html);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>发现</title>
<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
<style>
</style>
</head>
<body>
<div style="margin: 15px;">
<blockquote class="layui-elem-quote">此为自定义的【查找】页面,因需求不一,所以官方暂不提供该模版结构与样式,实际使用时,可移至该文件到你的项目中,对页面自行把控。
<br>文件所在目录相对于layui.js/layim-assets/html/find.html</blockquote>
</div>
<script src="//unpkg.com/layui/dist/layui.js"></script>
<script>
layui.config({
layimPath: '../../' //配置 layim.js 所在目录
,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
}).extend({
layim: layui.cache.layimPath + 'layim' //配置 layim 组件所在的路径
}).use(['layim', 'laypage'], function(){
var layim = layui.layim
,layer = layui.layer
,laytpl = layui.laytpl
,$ = layui.jquery
,laypage = layui.laypage;
//一些添加好友请求之类的交互参见文档
});
</script>
</body>
</html>

View File

@@ -0,0 +1,72 @@
{
"code": 0,
"pages": 1,
"data": [
{
"id": 76,
"content": "申请添加你为好友",
"uid": 168,
"from": 166488,
"from_group": 0,
"type": 1,
"remark": "test1",
"href": null,
"read": 1,
"time": "刚刚",
"user": {
"id": 166488,
"avatar": "http://q.qlogo.cn/qqapp/101235792/B704597964F9BD0DB648292D1B09F7E8/100",
"username": "测试111",
"sign": null
}
},
{
"id": 75,
"content": "申请添加你为好友",
"uid": 168,
"from": 347592,
"from_group": 0,
"type": 1,
"remark": "test2",
"href": null,
"read": 1,
"time": "刚刚",
"user": {
"id": 347592,
"avatar": "http://q.qlogo.cn/qqapp/101235792/B78751375E0531675B1272AD994BA875/100",
"username": "测试222",
"sign": null
}
},
{
"id": 62,
"content": "测试333 拒绝了你的好友申请",
"uid": 168,
"from": null,
"from_group": null,
"type": 1,
"remark": null,
"href": null,
"read": 1,
"time": "10天前",
"user": {
"id": null
}
},
{
"id": 60,
"content": "测试666 已经同意你的好友申请",
"uid": 168,
"from": null,
"from_group": null,
"type": 1,
"remark": null,
"href": null,
"read": 1,
"time": "10天前",
"user": {
"id": null
}
}
]
}

View File

@@ -0,0 +1,218 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>消息盒子</title>
<link rel="stylesheet" href="//unpkg.com/layui/dist/css/layui.css">
<style>
.layim-msgbox{margin: 15px;}
.layim-msgbox li{position: relative; margin-bottom: 10px; padding: 0 130px 10px 60px; padding-bottom: 10px; line-height: 22px; border-bottom: 1px dotted #e2e2e2;}
.layim-msgbox .layim-msgbox-tips{margin: 0; padding: 10px 0; border: none; text-align: center; color: #999;}
.layim-msgbox .layim-msgbox-system{padding: 0 10px 10px 10px;}
.layim-msgbox li p span{padding-left: 5px; color: #999;}
.layim-msgbox li p em{font-style: normal; color: #FF5722;}
.layim-msgbox-avatar{position: absolute; left: 0; top: 0; width: 50px; height: 50px;}
.layim-msgbox-user{padding-top: 5px;}
.layim-msgbox-content{margin-top: 3px;}
.layim-msgbox .layui-btn-small{padding: 0 15px; margin-left: 5px;}
.layim-msgbox-btn{position: absolute; right: 0; top: 12px; color: #999;}
</style>
</head>
<body>
<ul class="layim-msgbox" id="LAY_view"></ul>
<div style="margin: 0 15px;">
<blockquote class="layui-elem-quote">注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。
<br>该模版文件所在目录(相对于 layim.js/html/msgbox.html</blockquote>
</div>
<textarea title="消息模版" id="LAY_tpl" style="display:none;">
{{# layui.each(d.data, function(index, item){
if(item.from){ }}
<li data-uid="{{ item.from }}" data-fromGroup="{{ item.from_group }}">
<a href="/u/{{ item.from }}/" target="_blank">
<img src="{{ item.user.avatar }}" class="layui-circle layim-msgbox-avatar">
</a>
<p class="layim-msgbox-user">
<a href="/u/{{ item.from }}/" target="_blank">{{ item.user.username||'' }}</a>
<span>{{ item.time }}</span>
</p>
<p class="layim-msgbox-content">
{{ item.content }}
<span>{{ item.remark ? '附言: '+item.remark : '' }}</span>
</p>
<p class="layim-msgbox-btn">
<button class="layui-btn layui-btn-small" data-type="agree">同意</button>
<button class="layui-btn layui-btn-small layui-btn-primary" data-type="refuse">拒绝</button>
</p>
</li>
{{# } else { }}
<li class="layim-msgbox-system">
<p><em>系统:</em>{{ item.content }}<span>{{ item.time }}</span></p>
</li>
{{# }
}); }}
</textarea>
<!--
上述模版采用了 laytpl 语法
-->
<script src="//unpkg.com/layui/dist/layui.js"></script>
<script>
layui.config({
layimPath: '../../' //配置 layim.js 所在目录
,layimAssetsPath: '../../layim-assets/' //layim 资源文件所在目录
}).extend({
layim: layui.cache.layimPath + 'layim' //配置 layim 组件所在的路径
}).use(['layim', 'flow'], function(){
var layim = layui.layim
,layer = layui.layer
,laytpl = layui.laytpl
,$ = layui.jquery
,flow = layui.flow;
var cache = {}; //用于临时记录请求到的数据
//请求消息
var renderMsg = function(page, callback){
//实际部署时,请将下述 getmsg.json 改为你的接口地址
$.get('getmsg.json', {
page: page || 1
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
//记录来源用户信息
layui.each(res.data, function(index, item){
cache[item.from] = item.user;
});
callback && callback(res.data, res.pages);
});
};
//消息信息流
flow.load({
elem: '#LAY_view' //流加载容器
,isAuto: false
,end: '<li class="layim-msgbox-tips">暂无更多新消息</li>'
,done: function(page, next){ //加载下一页
renderMsg(page, function(data, pages){
var html = laytpl(LAY_tpl.value).render({
data: data
,page: page
});
next(html, page < pages);
});
}
});
//打开页面即把消息标记为已读
/*
$.post('/message/read', {
type: 1
});
*/
//操作
var active = {
//同意
agree: function(othis){
var li = othis.parents('li')
,uid = li.data('uid')
,from_group = li.data('fromGroup')
,user = cache[uid];
//选择分组
parent.layui.layim.setFriendGroup({
type: 'friend'
,username: user.username
,avatar: user.avatar
,group: parent.layui.layim.cache().friend //获取好友分组数据
,submit: function(group, index){
//将好友追加到主面板
parent.layui.layim.addList({
type: 'friend'
,avatar: user.avatar //好友头像
,username: user.username //好友昵称
,groupid: group //所在的分组id
,id: uid //好友ID
,sign: user.sign //好友签名
});
parent.layer.close(index);
othis.parent().html('已同意');
//实际部署时,请开启下述注释,并改成你的接口地址
/*
$.post('/im/agreeFriend', {
uid: uid //对方用户ID
,from_group: from_group //对方设定的好友分组
,group: group //我设定的好友分组
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
//将好友追加到主面板
parent.layui.layim.addList({
type: 'friend'
,avatar: user.avatar //好友头像
,username: user.username //好友昵称
,groupid: group //所在的分组id
,id: uid //好友ID
,sign: user.sign //好友签名
});
parent.layer.close(index);
othis.parent().html('已同意');
});
*/
}
});
}
//拒绝
,refuse: function(othis){
var li = othis.parents('li')
,uid = li.data('uid');
layer.confirm('确定拒绝吗?', function(index){
layer.close(index);
othis.parent().html('<em>已拒绝</em>');
/*
$.post('/im/refuseFriend', {
uid: uid //对方用户ID
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
layer.close(index);
othis.parent().html('<em>已拒绝</em>');
});
*/
});
}
};
$('body').on('click', '.layui-btn', function(){
var othis = $(this), type = othis.data('type');
active[type] ? active[type].call(this, othis) : '';
});
});
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More