educode_sales 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +30 -0
- data/Rakefile +32 -0
- data/app/assets/config/educode_sales_manifest.js +2 -0
- data/app/assets/fonts/iconfont.eot +0 -0
- data/app/assets/fonts/iconfont.svg +554 -0
- data/app/assets/fonts/iconfont.ttf +0 -0
- data/app/assets/fonts/iconfont.woff +0 -0
- data/app/assets/fonts/iconfont.woff2 +0 -0
- data/app/assets/images/educode_sales/favicon.ico +0 -0
- data/app/assets/images/educode_sales/icon-ext.png +0 -0
- data/app/assets/images/educode_sales/icon-login.png +0 -0
- data/app/assets/images/educode_sales/icon.png +0 -0
- data/app/assets/images/educode_sales/loading-0.gif +0 -0
- data/app/assets/images/educode_sales/loading-1.gif +0 -0
- data/app/assets/images/educode_sales/loading-2.gif +0 -0
- data/app/assets/images/educode_sales/loginbg.png +0 -0
- data/app/assets/images/educode_sales/logo.png +0 -0
- data/app/assets/javascripts/educode_sales/application.js +16 -0
- data/app/assets/javascripts/educode_sales/extent/miniPage.js +394 -0
- data/app/assets/javascripts/educode_sales/extent/request.js +137 -0
- data/app/assets/javascripts/educode_sales/extent/select_input.js +522 -0
- data/app/assets/javascripts/educode_sales/layui.js +5 -0
- data/app/assets/stylesheets/educode_sales/app.css +256 -0
- data/app/assets/stylesheets/educode_sales/application.css +17 -0
- data/app/assets/stylesheets/educode_sales/error.css +181 -0
- data/app/assets/stylesheets/educode_sales/layui.scss +1525 -0
- data/app/assets/stylesheets/educode_sales/layuimini.css +838 -0
- data/app/assets/stylesheets/educode_sales/login.scss +38 -0
- data/app/assets/stylesheets/educode_sales/modules/code.css +29 -0
- data/app/assets/stylesheets/educode_sales/modules/laydate/default/font.scss +16 -0
- data/app/assets/stylesheets/educode_sales/modules/laydate/default/laydate.css +152 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/icon-ext.png +0 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/icon.png +0 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/layer.scss +179 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/loading-0.gif +0 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/loading-1.gif +0 -0
- data/app/assets/stylesheets/educode_sales/modules/layer/default/loading-2.gif +0 -0
- data/app/assets/stylesheets/educode_sales/modules/select_input.css +103 -0
- data/app/assets/stylesheets/educode_sales/public.css +47 -0
- data/app/controllers/educode_sales/activities_controller.rb +58 -0
- data/app/controllers/educode_sales/application_controller.rb +35 -0
- data/app/controllers/educode_sales/businesses_controller.rb +189 -0
- data/app/controllers/educode_sales/commons_controller.rb +54 -0
- data/app/controllers/educode_sales/follow_ups_controller.rb +140 -0
- data/app/controllers/educode_sales/home_controller.rb +40 -0
- data/app/controllers/educode_sales/key_person_controller.rb +29 -0
- data/app/controllers/educode_sales/operation_plans_controller.rb +53 -0
- data/app/controllers/educode_sales/operation_reports_controller.rb +6 -0
- data/app/controllers/educode_sales/operations_controller.rb +38 -0
- data/app/controllers/educode_sales/places_controller.rb +69 -0
- data/app/controllers/educode_sales/plans_controller.rb +208 -0
- data/app/controllers/educode_sales/roles_controller.rb +69 -0
- data/app/controllers/educode_sales/sale_reports_controller.rb +133 -0
- data/app/controllers/educode_sales/sale_trends_controller.rb +45 -0
- data/app/controllers/educode_sales/sales_controller.rb +64 -0
- data/app/controllers/educode_sales/sessions_controller.rb +51 -0
- data/app/controllers/educode_sales/staffs_controller.rb +81 -0
- data/app/controllers/educode_sales/teachers_controller.rb +167 -0
- data/app/helpers/educode_sales/activities_helper.rb +4 -0
- data/app/helpers/educode_sales/application_helper.rb +44 -0
- data/app/helpers/educode_sales/business_helper.rb +4 -0
- data/app/helpers/educode_sales/home_helper.rb +4 -0
- data/app/helpers/educode_sales/sessions_helper.rb +4 -0
- data/app/helpers/educode_sales/teachers_helper.rb +4 -0
- data/app/jobs/educode_sales/application_job.rb +4 -0
- data/app/mailers/educode_sales/application_mailer.rb +6 -0
- data/app/models/ability.rb +54 -0
- data/app/models/educode_sales/activity.rb +6 -0
- data/app/models/educode_sales/activity_teacher.rb +6 -0
- data/app/models/educode_sales/application_record.rb +5 -0
- data/app/models/educode_sales/business.rb +11 -0
- data/app/models/educode_sales/common.rb +32 -0
- data/app/models/educode_sales/course_subject.rb +5 -0
- data/app/models/educode_sales/follow_up.rb +14 -0
- data/app/models/educode_sales/key_person.rb +11 -0
- data/app/models/educode_sales/market_area.rb +6 -0
- data/app/models/educode_sales/money_plan.rb +22 -0
- data/app/models/educode_sales/operation_plan.rb +6 -0
- data/app/models/educode_sales/operation_report.rb +5 -0
- data/app/models/educode_sales/operation_trend.rb +5 -0
- data/app/models/educode_sales/permission.rb +16 -0
- data/app/models/educode_sales/place.rb +7 -0
- data/app/models/educode_sales/place_area.rb +6 -0
- data/app/models/educode_sales/role.rb +8 -0
- data/app/models/educode_sales/role_area.rb +13 -0
- data/app/models/educode_sales/role_permission.rb +6 -0
- data/app/models/educode_sales/sale_plan.rb +6 -0
- data/app/models/educode_sales/sale_report.rb +5 -0
- data/app/models/educode_sales/sale_trend.rb +4 -0
- data/app/models/educode_sales/staff.rb +41 -0
- data/app/models/educode_sales/teacher.rb +12 -0
- data/app/models/educode_sales/teacher_follow.rb +6 -0
- data/app/views/educode_sales/activities/edit.html.erb +82 -0
- data/app/views/educode_sales/activities/index.html.erb +172 -0
- data/app/views/educode_sales/activities/index.json.jbuilder +14 -0
- data/app/views/educode_sales/activities/new.html.erb +81 -0
- data/app/views/educode_sales/activities/show_teachers.html.erb +368 -0
- data/app/views/educode_sales/businesses/edit.html.erb +82 -0
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +138 -0
- data/app/views/educode_sales/businesses/edit_plan.html.erb +172 -0
- data/app/views/educode_sales/businesses/index.html.erb +364 -0
- data/app/views/educode_sales/businesses/index.json.jbuilder +20 -0
- data/app/views/educode_sales/businesses/new.html.erb +80 -0
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +144 -0
- data/app/views/educode_sales/businesses/show_follow.html.erb +466 -0
- data/app/views/educode_sales/businesses/show_follow.json.jbuilder +21 -0
- data/app/views/educode_sales/businesses/show_follow_record.html.erb +81 -0
- data/app/views/educode_sales/businesses/show_keys.html.erb +56 -0
- data/app/views/educode_sales/businesses/unfinish_plans.json.jbuilder +14 -0
- data/app/views/educode_sales/commons/edit.html.erb +112 -0
- data/app/views/educode_sales/commons/index.html.erb +132 -0
- data/app/views/educode_sales/commons/index.json.jbuilder +13 -0
- data/app/views/educode_sales/commons/new.html.erb +58 -0
- data/app/views/educode_sales/commons/show.json.jbuilder +9 -0
- data/app/views/educode_sales/follow_ups/money_plans.json.jbuilder +11 -0
- data/app/views/educode_sales/follow_ups/teachers.json.jbuilder +16 -0
- data/app/views/educode_sales/home/index.html.erb +1 -0
- data/app/views/educode_sales/home/no_permission.html.erb +27 -0
- data/app/views/educode_sales/home/search.json.jbuilder +8 -0
- data/app/views/educode_sales/home/search_edu_teacher.json.jbuilder +14 -0
- data/app/views/educode_sales/home/search_teacher.json.jbuilder +24 -0
- data/app/views/educode_sales/home/search_users.json.jbuilder +8 -0
- data/app/views/educode_sales/home/statistics.html.erb +68 -0
- data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +288 -0
- data/app/views/educode_sales/operation_plans/_monthly.html.erb +284 -0
- data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +291 -0
- data/app/views/educode_sales/operation_plans/_weekly.html.erb +275 -0
- data/app/views/educode_sales/operation_plans/edit_month.html.erb +60 -0
- data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +175 -0
- data/app/views/educode_sales/operation_plans/edit_week.html.erb +72 -0
- data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +173 -0
- data/app/views/educode_sales/operation_plans/index.html.erb +22 -0
- data/app/views/educode_sales/operation_plans/new_month.html.erb +79 -0
- data/app/views/educode_sales/operation_plans/new_monthly.html.erb +176 -0
- data/app/views/educode_sales/operation_plans/new_week.html.erb +86 -0
- data/app/views/educode_sales/operation_plans/new_weekly.html.erb +174 -0
- data/app/views/educode_sales/operation_plans/operation.html.erb +0 -0
- data/app/views/educode_sales/operation_plans/show_month.html.erb +36 -0
- data/app/views/educode_sales/operation_plans/show_monthly.html.erb +171 -0
- data/app/views/educode_sales/operation_plans/show_week.html.erb +43 -0
- data/app/views/educode_sales/operation_plans/show_weekly.html.erb +170 -0
- data/app/views/educode_sales/operations/trends.html.erb +191 -0
- data/app/views/educode_sales/places/edit.html.erb +91 -0
- data/app/views/educode_sales/places/index.html.erb +137 -0
- data/app/views/educode_sales/places/index.json.jbuilder +13 -0
- data/app/views/educode_sales/places/new.html.erb +77 -0
- data/app/views/educode_sales/plans/_monthPlan.html.erb +258 -0
- data/app/views/educode_sales/plans/_monthly.html.erb +302 -0
- data/app/views/educode_sales/plans/_weekPlan.html.erb +265 -0
- data/app/views/educode_sales/plans/_weekly.html.erb +296 -0
- data/app/views/educode_sales/plans/audit_weekly.html.erb +177 -0
- data/app/views/educode_sales/plans/edit_month.html.erb +74 -0
- data/app/views/educode_sales/plans/edit_monthly.html.erb +179 -0
- data/app/views/educode_sales/plans/edit_week.html.erb +81 -0
- data/app/views/educode_sales/plans/edit_weekly.html.erb +238 -0
- data/app/views/educode_sales/plans/index.html.erb +54 -0
- data/app/views/educode_sales/plans/index.json.jbuilder +19 -0
- data/app/views/educode_sales/plans/my_month.json.jbuilder +18 -0
- data/app/views/educode_sales/plans/my_week.json.jbuilder +19 -0
- data/app/views/educode_sales/plans/new_month.html.erb +89 -0
- data/app/views/educode_sales/plans/new_monthly.html.erb +235 -0
- data/app/views/educode_sales/plans/new_week.html.erb +95 -0
- data/app/views/educode_sales/plans/new_weekly.html.erb +262 -0
- data/app/views/educode_sales/plans/operation.html.erb +0 -0
- data/app/views/educode_sales/plans/show_month.html.erb +30 -0
- data/app/views/educode_sales/plans/show_monthly.html.erb +175 -0
- data/app/views/educode_sales/plans/show_week.html.erb +38 -0
- data/app/views/educode_sales/plans/show_weekly.html.erb +143 -0
- data/app/views/educode_sales/roles/edit.html.erb +127 -0
- data/app/views/educode_sales/roles/index.html.erb +105 -0
- data/app/views/educode_sales/roles/index.json.jbuilder +10 -0
- data/app/views/educode_sales/roles/new.html.erb +51 -0
- data/app/views/educode_sales/sale_reports/audit.html.erb +209 -0
- data/app/views/educode_sales/sale_reports/edit.html.erb +240 -0
- data/app/views/educode_sales/sale_reports/index.json.jbuilder +17 -0
- data/app/views/educode_sales/sale_reports/plans.json.jbuilder +19 -0
- data/app/views/educode_sales/sale_reports/show.html.erb +172 -0
- data/app/views/educode_sales/sale_trends/operations.html.erb +49 -0
- data/app/views/educode_sales/sale_trends/trends.html.erb +213 -0
- data/app/views/educode_sales/sales/index.html.erb +60 -0
- data/app/views/educode_sales/sales/index.json.jbuilder +17 -0
- data/app/views/educode_sales/sales/operations.html.erb +108 -0
- data/app/views/educode_sales/sales/operations.json.jbuilder +14 -0
- data/app/views/educode_sales/sales/school.html.erb +29 -0
- data/app/views/educode_sales/sales/trends.html.erb +216 -0
- data/app/views/educode_sales/sales/xschool.html.erb +35 -0
- data/app/views/educode_sales/sessions/login.html.erb +87 -0
- data/app/views/educode_sales/staffs/edit.html.erb +116 -0
- data/app/views/educode_sales/staffs/follow_up_departments.json.jbuilder +13 -0
- data/app/views/educode_sales/staffs/follow_up_schools.json.jbuilder +12 -0
- data/app/views/educode_sales/staffs/index.html.erb +141 -0
- data/app/views/educode_sales/staffs/index.json.jbuilder +15 -0
- data/app/views/educode_sales/staffs/new.html.erb +73 -0
- data/app/views/educode_sales/teachers/activities.json.jbuilder +9 -0
- data/app/views/educode_sales/teachers/add_courses.html.erb +53 -0
- data/app/views/educode_sales/teachers/add_event.html.erb +49 -0
- data/app/views/educode_sales/teachers/add_keys.html.erb +282 -0
- data/app/views/educode_sales/teachers/course_list.json.jbuilder +22 -0
- data/app/views/educode_sales/teachers/edit.html.erb +109 -0
- data/app/views/educode_sales/teachers/edit_follow_record.html.erb +67 -0
- data/app/views/educode_sales/teachers/index.html.erb +461 -0
- data/app/views/educode_sales/teachers/index.json.jbuilder +23 -0
- data/app/views/educode_sales/teachers/new.html.erb +166 -0
- data/app/views/educode_sales/teachers/new_follow_record.html.erb +67 -0
- data/app/views/educode_sales/teachers/search_new.html.erb +138 -0
- data/app/views/educode_sales/teachers/show_class.html.erb +101 -0
- data/app/views/educode_sales/teachers/show_follow.html.erb +511 -0
- data/app/views/educode_sales/teachers/show_follow_record.html.erb +67 -0
- data/app/views/layouts/educode_sales/application.html.erb +104 -0
- data/app/views/layouts/educode_sales/login.html.erb +20 -0
- data/config/locales/sale.zh-CN.yml +9 -0
- data/config/routes.rb +162 -0
- data/db/migrate/20210830081842_create_educode_sales_staffs.rb +9 -0
- data/db/migrate/20210831022421_create_educode_sales_sale_trends.rb +13 -0
- data/db/migrate/20210831085201_create_educode_sales_commons.rb +11 -0
- data/db/migrate/20210901025628_create_educode_sales_roles.rb +19 -0
- data/db/migrate/20210901031626_create_educode_sales_market_areas.rb +10 -0
- data/db/migrate/20210902061835_create_educode_sales_role_areas.rb +11 -0
- data/db/migrate/20210902064029_create_educode_sales_permissions.rb +12 -0
- data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +62 -0
- data/db/migrate/20210902073832_create_educode_sales_businesses.rb +11 -0
- data/db/migrate/20210902080535_create_educode_sales_places.rb +10 -0
- data/db/migrate/20210902080918_create_educode_sales_follow_ups.rb +20 -0
- data/db/migrate/20210902101022_create_educode_sales_teachers.rb +20 -0
- data/db/migrate/20210902103331_create_educode_sales_teacher_follows.rb +15 -0
- data/db/migrate/20210903015810_create_educode_sales_sale_plans.rb +14 -0
- data/db/migrate/20210903020721_create_educode_sales_sale_reports.rb +21 -0
- data/db/migrate/20210903021458_create_educode_sales_operation_plans.rb +14 -0
- data/db/migrate/20210903021710_create_educode_sales_operation_reports.rb +19 -0
- data/db/migrate/20210903022055_create_educode_sales_operation_trends.rb +13 -0
- data/db/migrate/20210903032011_create_educode_sales_activities.rb +16 -0
- data/db/migrate/20210906104001_create_educode_sales_money_plans.rb +18 -0
- data/db/migrate/20210906105154_create_educode_sales_place_areas.rb +10 -0
- data/db/migrate/20210908014953_create_educode_sales_key_people.rb +21 -0
- data/db/migrate/20210912061148_add_audit_user_id_to_sales_reports.rb +11 -0
- data/db/migrate/20210913070728_create_educode_sales_activity_teachers.rb +11 -0
- data/db/migrate/20210913071607_create_educode_sales_course_subjects.rb +14 -0
- data/lib/educode_sales/engine.rb +5 -0
- data/lib/educode_sales/version.rb +3 -0
- data/lib/educode_sales.rb +5 -0
- data/lib/tasks/educode_sales_tasks.rake +4 -0
- metadata +342 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
15
|
+
//= require ./layui
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,394 @@
|
|
1
|
+
/**
|
2
|
+
* date:2020/02/27
|
3
|
+
* author:Mr.Chung
|
4
|
+
* version:2.0
|
5
|
+
* description:layuimini 单页框架扩展
|
6
|
+
*/
|
7
|
+
layui.define(["element", "jquery"], function (exports) {
|
8
|
+
var element = layui.element,
|
9
|
+
$ = layui.$,
|
10
|
+
// miniAdmin = layui.miniAdmin,
|
11
|
+
layer = layui.layer;
|
12
|
+
|
13
|
+
|
14
|
+
var miniPage = {
|
15
|
+
|
16
|
+
/**
|
17
|
+
* 初始化tab
|
18
|
+
* @param options
|
19
|
+
*/
|
20
|
+
render: function (options) {
|
21
|
+
options.homeInfo = options.homeInfo || {};
|
22
|
+
options.menuList = options.menuList || [];
|
23
|
+
options.multiModule = options.multiModule || false;
|
24
|
+
options.renderPageVersion = options.renderPageVersion || false;
|
25
|
+
options.listenSwichCallback = options.listenSwichCallback || function () {
|
26
|
+
};
|
27
|
+
var href = location.hash.replace(/^#\//, '');
|
28
|
+
if (href === null || href === undefined || href === '') {
|
29
|
+
miniPage.renderHome(options);
|
30
|
+
} else {
|
31
|
+
miniPage.renderPage(href, options);
|
32
|
+
if (options.multiModule) {
|
33
|
+
miniPage.listenSwitchMultiModule(href);
|
34
|
+
} else {
|
35
|
+
miniPage.listenSwitchSingleModule(href);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
miniPage.listen(options);
|
39
|
+
miniPage.listenHash(options);
|
40
|
+
},
|
41
|
+
|
42
|
+
/**
|
43
|
+
* 初始化主页
|
44
|
+
* @param options
|
45
|
+
*/
|
46
|
+
renderHome: function (options) {
|
47
|
+
options.homeInfo = options.homeInfo || {};
|
48
|
+
options.homeInfo.href = options.homeInfo.href || '';
|
49
|
+
options.renderPageVersion = options.renderPageVersion || false;
|
50
|
+
$('.layuimini-page-header').addClass('layui-hide');
|
51
|
+
miniPage.renderPageContent(options.homeInfo.href, options);
|
52
|
+
},
|
53
|
+
|
54
|
+
/**
|
55
|
+
* 初始化页面
|
56
|
+
* @param href
|
57
|
+
* @param options
|
58
|
+
*/
|
59
|
+
renderPage: function (href, options) {
|
60
|
+
miniPage.renderPageTitle(href, options);
|
61
|
+
miniPage.renderPageContent(href, options);
|
62
|
+
},
|
63
|
+
|
64
|
+
/**
|
65
|
+
* 初始化页面标题
|
66
|
+
* @param href
|
67
|
+
* @param options
|
68
|
+
*/
|
69
|
+
renderPageTitle: function (href, options) {
|
70
|
+
options.homeInfo = options.homeInfo || {};
|
71
|
+
options.homeInfo.title = options.homeInfo.title || '主页';
|
72
|
+
options.menuList = options.menuList || [];
|
73
|
+
$('.layuimini-page-header').removeClass('layui-hide');
|
74
|
+
var pageTitleHtml = '<a lay-href="" href="javascript:;" class="layuimini-back-home">' + options.homeInfo.title + '</a><span lay-separator="">/</span>\n';
|
75
|
+
var pageTitleArray = miniPage.buildPageTitleArray(href, options.menuList);
|
76
|
+
if (pageTitleArray.length > 0) {
|
77
|
+
for (var key in pageTitleArray) {
|
78
|
+
key = parseInt(key);
|
79
|
+
if (key !== pageTitleArray.length - 1) {
|
80
|
+
pageTitleHtml += '<a><cite>' + pageTitleArray[key] + '</cite></a><span lay-separator="">/</span>\n';
|
81
|
+
} else {
|
82
|
+
pageTitleHtml += '<a><cite>' + pageTitleArray[key] + '</cite></a>\n';
|
83
|
+
}
|
84
|
+
}
|
85
|
+
} else {
|
86
|
+
var title = sessionStorage.getItem('layuimini_page_title');
|
87
|
+
if (title === null || title === undefined || title === '') {
|
88
|
+
$('.layuimini-page-header').addClass('layui-hide');
|
89
|
+
} else {
|
90
|
+
pageTitleHtml += '<a><cite>' + title + '</cite></a>\n';
|
91
|
+
}
|
92
|
+
}
|
93
|
+
$('.layuimini-page-header .layuimini-page-title').empty().html(pageTitleHtml);
|
94
|
+
},
|
95
|
+
|
96
|
+
/**
|
97
|
+
* 初始化页面内容
|
98
|
+
* @param options
|
99
|
+
* @param href
|
100
|
+
*/
|
101
|
+
renderPageContent: function (href, options) {
|
102
|
+
options.renderPageVersion = options.renderPageVersion || false;
|
103
|
+
var container = '.layuimini-content-page';
|
104
|
+
if (options.renderPageVersion) {
|
105
|
+
var v = new Date().getTime();
|
106
|
+
href = href.indexOf("?") > -1 ? href + '&v=' + v : href + '?v=' + v;
|
107
|
+
}
|
108
|
+
if ($(".layuimini-page-header").hasClass("layui-hide")) {
|
109
|
+
$(container).removeAttr("style");
|
110
|
+
} else {
|
111
|
+
$(container).attr("style", "height: calc(100% - 36px)");
|
112
|
+
}
|
113
|
+
$(container).html('');
|
114
|
+
$.ajax({
|
115
|
+
url: href,
|
116
|
+
type: 'get',
|
117
|
+
dataType: 'html',
|
118
|
+
success: function (data) {
|
119
|
+
$(container).html(data);
|
120
|
+
element.init();
|
121
|
+
},
|
122
|
+
error: function (xhr, textstatus, thrown) {
|
123
|
+
return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!');
|
124
|
+
}
|
125
|
+
});
|
126
|
+
},
|
127
|
+
|
128
|
+
/**
|
129
|
+
* 刷新页面内容
|
130
|
+
* @param options
|
131
|
+
*/
|
132
|
+
refresh: function (options) {
|
133
|
+
var href = location.hash.replace(/^#\//, '');
|
134
|
+
if (href === null || href === undefined || href === '') {
|
135
|
+
miniPage.renderHome(options);
|
136
|
+
} else {
|
137
|
+
miniPage.renderPageContent(href, options);
|
138
|
+
}
|
139
|
+
},
|
140
|
+
|
141
|
+
/**
|
142
|
+
* 构建页面标题数组
|
143
|
+
* @param href
|
144
|
+
* @param menuList
|
145
|
+
*/
|
146
|
+
buildPageTitleArray: function (href, menuList) {
|
147
|
+
var array = [],
|
148
|
+
newArray = [];
|
149
|
+
for (key in menuList) {
|
150
|
+
var item = menuList[key];
|
151
|
+
if (item.href === href) {
|
152
|
+
array.push(item.title);
|
153
|
+
break;
|
154
|
+
}
|
155
|
+
if (item.child) {
|
156
|
+
newArray = miniPage.buildPageTitleArray(href, item.child);
|
157
|
+
if (newArray.length > 0) {
|
158
|
+
newArray.unshift(item.title);
|
159
|
+
array = array.concat(newArray);
|
160
|
+
break;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
return array;
|
165
|
+
},
|
166
|
+
|
167
|
+
/**
|
168
|
+
* 获取指定链接内容
|
169
|
+
* @param href
|
170
|
+
* @returns {string}
|
171
|
+
*/
|
172
|
+
getHrefContent: function (href) {
|
173
|
+
var content = '';
|
174
|
+
var v = new Date().getTime();
|
175
|
+
$.ajax({
|
176
|
+
url: href.indexOf("?") > -1 ? href + '&v=' + v : href + '?v=' + v,
|
177
|
+
type: 'get',
|
178
|
+
dataType: 'html',
|
179
|
+
async: false,
|
180
|
+
success: function (data) {
|
181
|
+
content = data;
|
182
|
+
},
|
183
|
+
error: function (xhr, textstatus, thrown) {
|
184
|
+
return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!');
|
185
|
+
}
|
186
|
+
});
|
187
|
+
return content;
|
188
|
+
},
|
189
|
+
|
190
|
+
/**
|
191
|
+
* 获取弹出层的宽高
|
192
|
+
* @returns {jQuery[]}
|
193
|
+
*/
|
194
|
+
getOpenWidthHeight: function () {
|
195
|
+
var clienWidth = $(".layuimini-content-page").width();
|
196
|
+
var clientHeight = $(".layuimini-content-page").height();
|
197
|
+
var offsetLeft = $(".layuimini-content-page").offset().left;
|
198
|
+
var offsetTop = $(".layuimini-content-page").offset().top;
|
199
|
+
return [clienWidth, clientHeight, offsetTop, offsetLeft];
|
200
|
+
},
|
201
|
+
|
202
|
+
/**
|
203
|
+
* 单模块切换
|
204
|
+
* @param tabId
|
205
|
+
*/
|
206
|
+
listenSwitchSingleModule: function (tabId) {
|
207
|
+
$("[layuimini-href]").each(function () {
|
208
|
+
if ($(this).attr("layuimini-href") === tabId) {
|
209
|
+
// 自动展开菜单栏
|
210
|
+
var addMenuClass = function ($element, type) {
|
211
|
+
if (type === 1) {
|
212
|
+
$element.addClass('layui-this');
|
213
|
+
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
214
|
+
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
215
|
+
} else {
|
216
|
+
addMenuClass($element.parent().parent(), 2);
|
217
|
+
}
|
218
|
+
} else {
|
219
|
+
$element.addClass('layui-nav-itemed');
|
220
|
+
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
221
|
+
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
222
|
+
} else {
|
223
|
+
addMenuClass($element.parent().parent(), 2);
|
224
|
+
}
|
225
|
+
}
|
226
|
+
};
|
227
|
+
addMenuClass($(this).parent(), 1);
|
228
|
+
return false;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
},
|
232
|
+
|
233
|
+
/**
|
234
|
+
* 多模块切换
|
235
|
+
* @param tabId
|
236
|
+
*/
|
237
|
+
listenSwitchMultiModule: function (tabId) {
|
238
|
+
$("[layuimini-href]").each(function () {
|
239
|
+
if ($(this).attr("layuimini-href") === tabId) {
|
240
|
+
|
241
|
+
// 自动展开菜单栏
|
242
|
+
var addMenuClass = function ($element, type) {
|
243
|
+
if (type === 1) {
|
244
|
+
$element.addClass('layui-this');
|
245
|
+
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
246
|
+
var moduleId = $element.parent().attr('id');
|
247
|
+
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
248
|
+
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
249
|
+
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
250
|
+
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
251
|
+
} else {
|
252
|
+
addMenuClass($element.parent().parent(), 2);
|
253
|
+
}
|
254
|
+
} else {
|
255
|
+
$element.addClass('layui-nav-itemed');
|
256
|
+
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
257
|
+
var moduleId = $element.parent().attr('id');
|
258
|
+
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
259
|
+
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
260
|
+
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
261
|
+
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
262
|
+
} else {
|
263
|
+
addMenuClass($element.parent().parent(), 2);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
};
|
267
|
+
addMenuClass($(this).parent(), 1);
|
268
|
+
return false;
|
269
|
+
}
|
270
|
+
});
|
271
|
+
},
|
272
|
+
|
273
|
+
/**
|
274
|
+
* 修改hash地址定位
|
275
|
+
* @param href
|
276
|
+
*/
|
277
|
+
hashChange: function (href) {
|
278
|
+
window.location.hash = "/" + href;
|
279
|
+
},
|
280
|
+
|
281
|
+
/**
|
282
|
+
* 修改hash地址为主页
|
283
|
+
*/
|
284
|
+
hashHome: function () {
|
285
|
+
window.location.hash = "/";
|
286
|
+
},
|
287
|
+
|
288
|
+
/**
|
289
|
+
* 监听
|
290
|
+
* @param options
|
291
|
+
*/
|
292
|
+
listen: function (options) {
|
293
|
+
|
294
|
+
/**
|
295
|
+
* 打开新窗口
|
296
|
+
*/
|
297
|
+
$('body').on('click', '[layuimini-href]', function () {
|
298
|
+
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
299
|
+
var href = $(this).attr('layuimini-href'),
|
300
|
+
target = $(this).attr('target');
|
301
|
+
if(!href) return ;
|
302
|
+
var me = this ;
|
303
|
+
var el = $("[layuimini-href='"+href+"']",".layuimini-menu-left") ;
|
304
|
+
layer.close(window.openTips);
|
305
|
+
if(el.length){
|
306
|
+
$(el).closest(".layui-nav-tree").find(".layui-this").removeClass("layui-this");
|
307
|
+
$(el).parent().addClass("layui-this");
|
308
|
+
}
|
309
|
+
if (target === '_blank') {
|
310
|
+
layer.close(loading);
|
311
|
+
window.open(href, "_blank");
|
312
|
+
return false;
|
313
|
+
}
|
314
|
+
miniPage.hashChange(href);
|
315
|
+
$('.layuimini-menu-left').attr('layuimini-page-add', 'yes');
|
316
|
+
layer.close(loading);
|
317
|
+
});
|
318
|
+
|
319
|
+
/**
|
320
|
+
* 在子页面上打开新窗口
|
321
|
+
*/
|
322
|
+
$('body').on('click', '[layuimini-content-href]', function () {
|
323
|
+
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
324
|
+
var href = $(this).attr('layuimini-content-href'),
|
325
|
+
title = $(this).attr('data-title'),
|
326
|
+
target = $(this).attr('target');
|
327
|
+
if(!href) return ;
|
328
|
+
var me = this ;
|
329
|
+
var el = $("[layuimini-href='"+href+"']",".layuimini-menu-left") ;
|
330
|
+
layer.close(window.openTips);
|
331
|
+
if(el.length){
|
332
|
+
$(el).closest(".layui-nav-tree").find(".layui-this").removeClass("layui-this");
|
333
|
+
$(el).parent().addClass("layui-this");
|
334
|
+
}
|
335
|
+
if (target === '_blank') {
|
336
|
+
parent.layer.close(loading);
|
337
|
+
window.open(href, "_blank");
|
338
|
+
return false;
|
339
|
+
}
|
340
|
+
sessionStorage.setItem('layuimini_page_title', title);
|
341
|
+
miniPage.hashChange(href);
|
342
|
+
parent.layer.close(loading);
|
343
|
+
});
|
344
|
+
|
345
|
+
/**
|
346
|
+
* 返回主页
|
347
|
+
*/
|
348
|
+
$('body').on('click', '.layuimini-back-home', function () {
|
349
|
+
miniPage.hashHome();
|
350
|
+
});
|
351
|
+
|
352
|
+
|
353
|
+
},
|
354
|
+
|
355
|
+
|
356
|
+
/**
|
357
|
+
* 监听hash变化
|
358
|
+
* @returns {boolean}
|
359
|
+
*/
|
360
|
+
listenHash: function (options) {
|
361
|
+
options.homeInfo = options.homeInfo || {};
|
362
|
+
options.multiModule = options.multiModule || false;
|
363
|
+
options.listenSwichCallback = options.listenSwichCallback || function () {
|
364
|
+
};
|
365
|
+
window.onhashchange = function () {
|
366
|
+
var href = location.hash.replace(/^#\//, '');
|
367
|
+
if (typeof options.listenSwichCallback === 'function') {
|
368
|
+
options.listenSwichCallback();
|
369
|
+
}
|
370
|
+
if (href === null || href === undefined || href === '') {
|
371
|
+
$("[layuimini-href]").parent().removeClass('layui-this');
|
372
|
+
miniPage.renderHome(options);
|
373
|
+
} else {
|
374
|
+
miniPage.renderPage(href, options);
|
375
|
+
}
|
376
|
+
if ($('.layuimini-menu-left').attr('layuimini-page-add') === 'yes') {
|
377
|
+
$('.layuimini-menu-left').attr('layuimini-page-add', 'no');
|
378
|
+
} else {
|
379
|
+
// 从页面中打开的话,浏览器前进后退、需要重新定位菜单焦点
|
380
|
+
$("[layuimini-href]").parent().removeClass('layui-this');
|
381
|
+
if (options.multiModule) {
|
382
|
+
miniPage.listenSwitchMultiModule(href);
|
383
|
+
} else {
|
384
|
+
miniPage.listenSwitchSingleModule(href);
|
385
|
+
}
|
386
|
+
}
|
387
|
+
};
|
388
|
+
},
|
389
|
+
|
390
|
+
|
391
|
+
};
|
392
|
+
|
393
|
+
exports("miniPage", miniPage);
|
394
|
+
});
|
@@ -0,0 +1,137 @@
|
|
1
|
+
layui.define(['jquery'], function(exports) {
|
2
|
+
var $ = layui.jquery;
|
3
|
+
var url = location.origin + "/";
|
4
|
+
|
5
|
+
var base = url;
|
6
|
+
|
7
|
+
var obj = {
|
8
|
+
get: get,
|
9
|
+
post: post,
|
10
|
+
delete: del,
|
11
|
+
put: put,
|
12
|
+
authGet: authGet,
|
13
|
+
authPost: authPost,
|
14
|
+
authDelete: authDel,
|
15
|
+
authPut: authPut
|
16
|
+
// vid: '5d8864f7fc650e050cc8b0d7'
|
17
|
+
}
|
18
|
+
|
19
|
+
//封装AJAX请求
|
20
|
+
function ajax(type, url, data, success, auth) {
|
21
|
+
var index = layer.load(0, {
|
22
|
+
shade: false
|
23
|
+
});
|
24
|
+
var headers = {
|
25
|
+
'X-CSRF-Token': $('meta[name=csrf-token]').attr('content'),
|
26
|
+
"Content-Type": "application/json;charset=UTF-8"
|
27
|
+
}
|
28
|
+
$.ajax({
|
29
|
+
//添加请求头
|
30
|
+
headers: headers,
|
31
|
+
url: base + url,
|
32
|
+
dataType: "json", //数据格式
|
33
|
+
data: JSON.stringify(data),
|
34
|
+
// JSON.stringify(data),
|
35
|
+
traditional:true,
|
36
|
+
type: type, //请求方式
|
37
|
+
// async: false, //是否异步请求
|
38
|
+
timeout: 30000, //超时时间:30秒
|
39
|
+
// beforeSend: function(XMLHttpRequest) {
|
40
|
+
// var token = localStorage.getItem("auth");
|
41
|
+
// //发送请求,如果token为空,跳转到登录页面
|
42
|
+
// if (token === undefined || token === "") {
|
43
|
+
// var url = window.document.location.href;
|
44
|
+
// if (url.indexOf('login.html') > -1) {} else {
|
45
|
+
// window.location.href = "/site_admin/login.html"
|
46
|
+
// }
|
47
|
+
// }
|
48
|
+
// },
|
49
|
+
success: function(res) {
|
50
|
+
return success(res);
|
51
|
+
},
|
52
|
+
complete: function(XMLHttpRequest, textStatus) {
|
53
|
+
layer.close(index);
|
54
|
+
},
|
55
|
+
error: function(res) {
|
56
|
+
if (res.responseJSON.msg) {
|
57
|
+
layer.alert(res.responseJSON.msg, {
|
58
|
+
icon: 5,
|
59
|
+
title: "提示"
|
60
|
+
});
|
61
|
+
} else {
|
62
|
+
layer.alert('系统繁忙,请稍后', {
|
63
|
+
icon: 5,
|
64
|
+
title: "提示"
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* 发送post请求
|
72
|
+
* @param {发送请求路径} url
|
73
|
+
* @param {JSON数据} data
|
74
|
+
* @param {发送成功回调函数} success
|
75
|
+
*/
|
76
|
+
function post(url, data, success) {
|
77
|
+
ajax('post', url, data, function(res) {
|
78
|
+
return success(res);
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* 发送GET请求
|
84
|
+
* @param {发送请求路径} url
|
85
|
+
* @param {JSON数据} data
|
86
|
+
* @param {发送成功回调函数} success
|
87
|
+
*/
|
88
|
+
function get(url, data, success) {
|
89
|
+
ajax('get', url, data, function(res) {
|
90
|
+
return success(res);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
|
94
|
+
function put(url, data, success) {
|
95
|
+
ajax('put', url, data, function(res) {
|
96
|
+
return success(res);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* 发送Delete请求
|
102
|
+
* @param {发送请求路径} url
|
103
|
+
* @param {JSON数据} data
|
104
|
+
* @param {发送成功回调函数} success
|
105
|
+
*/
|
106
|
+
function del(url, data, success) {
|
107
|
+
ajax('delete', url, data, function(res) {
|
108
|
+
return success(res);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
|
112
|
+
function authGet(url, data, success) {
|
113
|
+
ajax('get', url, data, function(res) {
|
114
|
+
return success(res);
|
115
|
+
}, true);
|
116
|
+
}
|
117
|
+
|
118
|
+
function authPost(url, data, success) {
|
119
|
+
ajax('post', url, data, function(res) {
|
120
|
+
return success(res);
|
121
|
+
}, true);
|
122
|
+
}
|
123
|
+
|
124
|
+
function authPut(url, data, success) {
|
125
|
+
ajax('put', url, data, function(res) {
|
126
|
+
return success(res);
|
127
|
+
}, true);
|
128
|
+
}
|
129
|
+
|
130
|
+
function authDel(url, data, success) {
|
131
|
+
ajax('delete', url, data, function(res) {
|
132
|
+
return success(res);
|
133
|
+
}, true);
|
134
|
+
}
|
135
|
+
|
136
|
+
exports("request", obj);
|
137
|
+
})
|