mm_os 1.3.4 → 1.3.6
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.
- package/README.en.md +36 -0
- package/README.md +25 -166
- package/conf.json +3 -0
- package/core/base/index.js +29 -0
- package/core/base/mqtt/index.js +268 -0
- package/core/base/mqtt/lib.js +40 -0
- package/core/base/web/index.js +110 -0
- package/core/com/api/com.json +4 -0
- package/{bin → core}/com/api/config.tpl.json +9 -7
- package/{bin → core}/com/api/drive.js +239 -64
- package/{bin → core}/com/api/index.js +8 -9
- package/{bin → core}/com/api/oauth.js +23 -14
- package/core/com/api/script.js +32 -0
- package/core/com/db/com.json +4 -0
- package/{bin → core}/com/db/drive.js +99 -65
- package/{bin → core}/com/db/index.js +2 -2
- package/core/com/event/com.json +4 -0
- package/{bin → core}/com/event/config.tpl.json +2 -2
- package/core/com/event/drive.js +125 -0
- package/{bin → core}/com/event/index.js +5 -10
- package/core/com/event/script.js +26 -0
- package/core/com/eventer/com.js +450 -0
- package/core/com/eventer/com.json +4 -0
- package/core/com/middleware/com.js +128 -0
- package/core/com/middleware/com.json +4 -0
- package/core/com/middleware/config.tpl.json +8 -0
- package/core/com/middleware/script.js +9 -0
- package/core/com/mqtt/com.json +4 -0
- package/core/com/mqtt/config.tpl.json +12 -0
- package/core/com/mqtt/drive.js +139 -0
- package/core/com/mqtt/index.js +138 -0
- package/core/com/mqtt/script.js +33 -0
- package/core/com/msg/com.js +296 -0
- package/core/com/msg/com.json +4 -0
- package/{bin → core}/com/nav/drive.js +42 -17
- package/{bin → core}/com/nav/index.js +4 -4
- package/core/com/nav/tpl/admin_pc/page_channel.vue +299 -0
- package/core/com/nav/tpl/admin_pc/page_config.vue +279 -0
- package/core/com/nav/tpl/admin_pc/page_config_form.vue +194 -0
- package/core/com/nav/tpl/admin_pc/page_default.vue +287 -0
- package/core/com/nav/tpl/admin_pc/page_form.vue +180 -0
- package/core/com/nav/tpl/admin_pc/page_lang.vue +265 -0
- package/core/com/nav/tpl/admin_pc/page_nav.vue +313 -0
- package/core/com/nav/tpl/admin_pc/page_table.vue +285 -0
- package/core/com/nav/tpl/admin_pc/page_type.vue +313 -0
- package/core/com/nav/tpl/dev_pc/page_channel.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_config.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_default.vue +247 -0
- package/core/com/nav/tpl/dev_pc/page_form.vue +162 -0
- package/core/com/nav/tpl/dev_pc/page_nav.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_table.vue +247 -0
- package/core/com/nav/tpl/dev_pc/page_type.vue +253 -0
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_channel.vue +231 -231
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_default.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_form.vue +9 -9
- package/{bin → core}/com/nav/tpl/home_pc/page_list.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_nav.vue +221 -221
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_type.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_view.vue +8 -8
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_channel.vue +231 -231
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_default.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_phone/page_form.vue +9 -9
- package/{bin → core}/com/nav/tpl/home_phone/page_list.vue +231 -231
- package/{bin/com/nav/tpl/admin_pc → core/com/nav/tpl/home_phone}/page_nav.vue +236 -220
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_type.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_phone/page_view.vue +8 -8
- package/core/com/nav/viewmodel.js +296 -0
- package/{bin → core}/com/param/config.tpl.json +24 -0
- package/{bin → core}/com/param/drive.js +47 -15
- package/core/com/plugin/com.json +4 -0
- package/core/com/plugin/config.tpl.json +20 -0
- package/{bin → core}/com/plugin/drive.js +5 -8
- package/{bin → core}/com/plugin/index.js +11 -56
- package/core/com/socket/README.md +47 -0
- package/core/com/socket/com.json +4 -0
- package/core/com/socket/config.tpl.json +14 -0
- package/{bin → core}/com/socket/drive.js +74 -51
- package/{bin → core}/com/socket/index.js +4 -2
- package/{bin → core}/com/socket/script.js +8 -6
- package/core/com/sql/config.tpl.json +70 -0
- package/{bin → core}/com/sql/drive.js +281 -58
- package/core/com/static/com.json +4 -0
- package/core/com/static/config.tpl.json +20 -0
- package/{bin → core}/com/static/drive.js +6 -4
- package/{bin → core}/com/static/index.js +5 -1
- package/core/com/task/com.json +4 -0
- package/core/com/task/config.tpl.json +24 -0
- package/core/com/task/drive.js +374 -0
- package/{bin → core}/com/task/index.js +14 -20
- package/core/com/task/script.js +37 -0
- package/core/com/timer/com.js +217 -0
- package/core/com/timer/com.json +4 -0
- package/core/com/tpl/com.js +19 -0
- package/core/com/tpl/com.json +4 -0
- package/index.js +161 -740
- package/lib/actions.js +50 -0
- package/lib/app.js +73 -0
- package/lib/base.js +355 -0
- package/lib/com.js +31 -0
- package/lib/game.js +31 -0
- package/lib/ref.js +121 -0
- package/middleware/cors/index.js +57 -0
- package/middleware/cors/middleware.json +7 -0
- package/middleware/mqtt_base/index.js +10 -0
- package/middleware/mqtt_base/middleware.json +8 -0
- package/{waf.js → middleware/waf/index.js} +12 -2
- package/middleware/waf/middleware.json +9 -0
- package/middleware/web_base/index.js +67 -0
- package/middleware/web_base/middleware.json +9 -0
- package/middleware/web_event/index.js +411 -0
- package/middleware/web_event/middleware.json +10 -0
- package/middleware/web_proxy/index.js +24 -0
- package/middleware/web_proxy/middleware.json +9 -0
- package/middleware/web_router/index.js +33 -0
- package/middleware/web_router/middleware.json +10 -0
- package/middleware/web_socket/index.js +21 -0
- package/middleware/web_socket/middleware.json +9 -0
- package/middleware/web_static/index.js +26 -0
- package/middleware/web_static/middleware.json +9 -0
- package/nodemon.json +12 -2
- package/package.json +56 -66
- package/.gitattributes +0 -5
- package/bin/com/README.md +0 -2
- package/bin/com/api/script.js +0 -14
- package/bin/com/cmd/README.md +0 -3
- package/bin/com/cmd/config.tpl.json +0 -41
- package/bin/com/cmd/drive.js +0 -512
- package/bin/com/cmd/index.js +0 -213
- package/bin/com/cmd/old/5w2h.js +0 -54
- package/bin/com/cmd/old/drive.js +0 -423
- package/bin/com/cmd/script.js +0 -11
- package/bin/com/event/drive.js +0 -69
- package/bin/com/event/script.js +0 -12
- package/bin/com/nav/tpl/admin_pc/page_channel.vue +0 -234
- package/bin/com/nav/tpl/admin_pc/page_default.vue +0 -236
- package/bin/com/nav/tpl/admin_pc/page_form.vue +0 -152
- package/bin/com/nav/tpl/admin_pc/page_table.vue +0 -236
- package/bin/com/nav/tpl/admin_pc/page_type.vue +0 -234
- package/bin/com/nav/tpl/home_phone/page_nav.vue +0 -221
- package/bin/com/nav/viewmodel.js +0 -161
- package/bin/com/plugin/config.tpl.json +0 -11
- package/bin/com/socket/config.tpl.json +0 -8
- package/bin/com/sql/config.tpl.json +0 -34
- package/bin/com/static/config.tpl.json +0 -11
- package/bin/com/task/config.tpl.json +0 -13
- package/bin/com/task/drive.js +0 -288
- package/bin/com/task/script.js +0 -38
- package/bin/com.js +0 -74
- package/bin/mm.conf +0 -48
- package/bin/static/404.html +0 -52
- package/bin/static/README.md +0 -1
- package/bin/static/css/font-awesome.min.css +0 -7
- package/bin/static/css/mm_base.css +0 -220
- package/bin/static/css/mm_common.css +0 -518
- package/bin/static/css/mm_component.css +0 -307
- package/bin/static/css/mm_expand.css +0 -634
- package/bin/static/css/mm_theme.css +0 -291
- package/bin/static/css/new_file.css +0 -79
- package/bin/static/css/swiper.min.css +0 -12
- package/bin/static/favicon.ico +0 -0
- package/bin/static/font/FontAwesome.otf +0 -0
- package/bin/static/font/HelveticaNeue.eot +0 -0
- package/bin/static/font/HelveticaNeue.otf +0 -0
- package/bin/static/font/HelveticaNeue.svg +0 -1273
- package/bin/static/font/HelveticaNeue.woff +0 -0
- package/bin/static/font/HelveticaNeue.woff2 +0 -0
- package/bin/static/font/fontawesome-webfont.eot +0 -0
- package/bin/static/font/fontawesome-webfont.svg +0 -2671
- package/bin/static/font/fontawesome-webfont.ttf +0 -0
- package/bin/static/font/fontawesome-webfont.woff +0 -0
- package/bin/static/font/fontawesome-webfont.woff2 +0 -0
- package/bin/static/h5.html +0 -325
- package/bin/static/highlight/highlight.pack.js +0 -2
- package/bin/static/highlight/styles/a11y-dark.css +0 -99
- package/bin/static/highlight/styles/a11y-light.css +0 -99
- package/bin/static/highlight/styles/agate.css +0 -108
- package/bin/static/highlight/styles/an-old-hope.css +0 -89
- package/bin/static/highlight/styles/androidstudio.css +0 -66
- package/bin/static/highlight/styles/arduino-light.css +0 -88
- package/bin/static/highlight/styles/arta.css +0 -73
- package/bin/static/highlight/styles/ascetic.css +0 -45
- package/bin/static/highlight/styles/atelier-cave-dark.css +0 -83
- package/bin/static/highlight/styles/atelier-cave-light.css +0 -85
- package/bin/static/highlight/styles/atelier-dune-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-dune-light.css +0 -69
- package/bin/static/highlight/styles/atelier-estuary-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-estuary-light.css +0 -84
- package/bin/static/highlight/styles/atelier-forest-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-forest-light.css +0 -69
- package/bin/static/highlight/styles/atelier-heath-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-heath-light.css +0 -69
- package/bin/static/highlight/styles/atelier-lakeside-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-lakeside-light.css +0 -69
- package/bin/static/highlight/styles/atelier-plateau-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-plateau-light.css +0 -84
- package/bin/static/highlight/styles/atelier-savanna-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-savanna-light.css +0 -84
- package/bin/static/highlight/styles/atelier-seaside-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-seaside-light.css +0 -69
- package/bin/static/highlight/styles/atelier-sulphurpool-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-sulphurpool-light.css +0 -69
- package/bin/static/highlight/styles/atom-one-dark-reasonable.css +0 -77
- package/bin/static/highlight/styles/atom-one-dark.css +0 -96
- package/bin/static/highlight/styles/atom-one-light.css +0 -96
- package/bin/static/highlight/styles/brown-paper.css +0 -64
- package/bin/static/highlight/styles/brown-papersq.png +0 -0
- package/bin/static/highlight/styles/codepen-embed.css +0 -60
- package/bin/static/highlight/styles/color-brewer.css +0 -71
- package/bin/static/highlight/styles/darcula.css +0 -77
- package/bin/static/highlight/styles/dark.css +0 -63
- package/bin/static/highlight/styles/darkula.css +0 -6
- package/bin/static/highlight/styles/default.css +0 -99
- package/bin/static/highlight/styles/docco.css +0 -97
- package/bin/static/highlight/styles/dracula.css +0 -76
- package/bin/static/highlight/styles/far.css +0 -71
- package/bin/static/highlight/styles/foundation.css +0 -88
- package/bin/static/highlight/styles/github-gist.css +0 -79
- package/bin/static/highlight/styles/github.css +0 -99
- package/bin/static/highlight/styles/gml.css +0 -78
- package/bin/static/highlight/styles/googlecode.css +0 -89
- package/bin/static/highlight/styles/grayscale.css +0 -101
- package/bin/static/highlight/styles/gruvbox-dark.css +0 -108
- package/bin/static/highlight/styles/gruvbox-light.css +0 -108
- package/bin/static/highlight/styles/hopscotch.css +0 -83
- package/bin/static/highlight/styles/hybrid.css +0 -102
- package/bin/static/highlight/styles/idea.css +0 -97
- package/bin/static/highlight/styles/ir-black.css +0 -73
- package/bin/static/highlight/styles/isbl-editor-dark.css +0 -112
- package/bin/static/highlight/styles/isbl-editor-light.css +0 -112
- package/bin/static/highlight/styles/kimbie.dark.css +0 -74
- package/bin/static/highlight/styles/kimbie.light.css +0 -74
- package/bin/static/highlight/styles/lightfair.css +0 -87
- package/bin/static/highlight/styles/magula.css +0 -70
- package/bin/static/highlight/styles/mono-blue.css +0 -59
- package/bin/static/highlight/styles/monokai-sublime.css +0 -83
- package/bin/static/highlight/styles/monokai.css +0 -70
- package/bin/static/highlight/styles/nord.css +0 -309
- package/bin/static/highlight/styles/obsidian.css +0 -88
- package/bin/static/highlight/styles/ocean.css +0 -74
- package/bin/static/highlight/styles/paraiso-dark.css +0 -72
- package/bin/static/highlight/styles/paraiso-light.css +0 -72
- package/bin/static/highlight/styles/pojoaque.css +0 -83
- package/bin/static/highlight/styles/pojoaque.jpg +0 -0
- package/bin/static/highlight/styles/purebasic.css +0 -96
- package/bin/static/highlight/styles/qtcreator_dark.css +0 -83
- package/bin/static/highlight/styles/qtcreator_light.css +0 -83
- package/bin/static/highlight/styles/railscasts.css +0 -106
- package/bin/static/highlight/styles/rainbow.css +0 -85
- package/bin/static/highlight/styles/routeros.css +0 -108
- package/bin/static/highlight/styles/school-book.css +0 -69
- package/bin/static/highlight/styles/school-book.png +0 -0
- package/bin/static/highlight/styles/shades-of-purple.css +0 -97
- package/bin/static/highlight/styles/solarized-dark.css +0 -84
- package/bin/static/highlight/styles/solarized-light.css +0 -84
- package/bin/static/highlight/styles/sunburst.css +0 -102
- package/bin/static/highlight/styles/tomorrow-night-blue.css +0 -75
- package/bin/static/highlight/styles/tomorrow-night-bright.css +0 -74
- package/bin/static/highlight/styles/tomorrow-night-eighties.css +0 -74
- package/bin/static/highlight/styles/tomorrow-night.css +0 -75
- package/bin/static/highlight/styles/tomorrow.css +0 -72
- package/bin/static/highlight/styles/vs.css +0 -68
- package/bin/static/highlight/styles/vs2015.css +0 -115
- package/bin/static/highlight/styles/xcode.css +0 -104
- package/bin/static/highlight/styles/xt256.css +0 -92
- package/bin/static/highlight/styles/zenburn.css +0 -80
- package/bin/static/highlight/vue-highlight.js +0 -29
- package/bin/static/ifame.html +0 -24
- package/bin/static/img/add.png +0 -0
- package/bin/static/img/avatar.png +0 -0
- package/bin/static/img/banner_2.png +0 -0
- package/bin/static/img/default.png +0 -0
- package/bin/static/img/loading.svg +0 -1
- package/bin/static/img/logo.png +0 -0
- package/bin/static/img/logo1.png +0 -0
- package/bin/static/img/logo_gray.png +0 -0
- package/bin/static/img/logo_round.png +0 -0
- package/bin/static/img/mm.ico +0 -0
- package/bin/static/img/mm.jpg +0 -0
- package/bin/static/img/select.png +0 -0
- package/bin/static/img/web.png +0 -0
- package/bin/static/index.html +0 -12
- package/bin/static/js/clipboard.min.js +0 -257
- package/bin/static/js/css.min.js +0 -1
- package/bin/static/js/echarts.js +0 -22
- package/bin/static/js/html5.min.js +0 -1
- package/bin/static/js/jquery.lazyload.min.js +0 -2
- package/bin/static/js/jquery.min.js +0 -4189
- package/bin/static/js/jquery.scrollstop.min.js +0 -2
- package/bin/static/js/mm-requirejs-vue.js +0 -283
- package/bin/static/js/mm_check.js +0 -490
- package/bin/static/js/mm_flexble.js +0 -112
- package/bin/static/js/mm_picker.js +0 -1417
- package/bin/static/js/mm_pinyinlite.js +0 -873
- package/bin/static/js/mm_sdk.js +0 -2841
- package/bin/static/js/mm_ui_expand.js +0 -468
- package/bin/static/js/mm_vue.js +0 -376
- package/bin/static/js/mm_vue_ui.js +0 -2375
- package/bin/static/js/mm_websocket.js +0 -145
- package/bin/static/js/require.js +0 -5
- package/bin/static/js/sortable.min.js +0 -3
- package/bin/static/js/swiper.min.js +0 -13
- package/bin/static/js/text.min.js +0 -1
- package/bin/static/js/vue-router.min.js +0 -6
- package/bin/static/js/vue.js +0 -12338
- package/bin/static/js/vuedraggable.min.js +0 -2
- package/bin/static/js/vuex.min.js +0 -6
- package/bin/static/src/components/bar/mm_action.vue +0 -19
- package/bin/static/src/components/bar/mm_buy.vue +0 -19
- package/bin/static/src/components/bar/mm_chat.vue +0 -18
- package/bin/static/src/components/bar/mm_count.vue +0 -18
- package/bin/static/src/components/bar/mm_filter.vue +0 -18
- package/bin/static/src/components/bar/mm_search.vue +0 -18
- package/bin/static/src/components/bar/mm_sort.vue +0 -18
- package/bin/static/src/components/bar/mm_tag.vue +0 -18
- package/bin/static/src/components/bar/mm_title.vue +0 -19
- package/bin/static/src/components/content/mm_pre.vue +0 -70
- package/bin/static/src/components/expand/mm_drag.vue +0 -39
- package/bin/static/src/components/item/mm_article.vue +0 -115
- package/bin/static/src/components/item/mm_base.vue +0 -26
- package/bin/static/src/components/item/mm_contact.vue +0 -25
- package/bin/static/src/components/item/mm_goods.vue +0 -23
- package/bin/static/src/components/item/mm_img.vue +0 -21
- package/bin/static/src/components/item/mm_media.vue +0 -18
- package/bin/static/src/components/item/mm_message.vue +0 -18
- package/bin/static/src/components/item/mm_music.vue +0 -95
- package/bin/static/src/components/item/mm_news.vue +0 -22
- package/bin/static/src/components/item/mm_number.vue +0 -26
- package/bin/static/src/components/item/mm_question.vue +0 -35
- package/bin/static/src/components/item/mm_user.vue +0 -22
- package/bin/static/src/components/item/mm_video.vue +0 -95
- package/bin/static/src/components/slide/mm_slide_card.vue +0 -64
- package/bin/static/src/components/slide/mm_slide_img.vue +0 -47
- package/bin/static/src/components/slide/mm_slide_page.vue +0 -8
- package/bin/static/src/components/slide/mm_slide_text.vue +0 -54
- package/bin/static/src/main.js +0 -84
- package/bin/static/src/mixins/form.js +0 -223
- package/bin/static/src/mixins/item.js +0 -242
- package/bin/static/src/mixins/list.js +0 -244
- package/bin/static/src/mixins/page.js +0 -1011
- package/bin/static/src/mm_component.js +0 -74
- package/bin/static/src/router.js +0 -72
- package/bin/static/src/store/user.js +0 -75
- package/bin/static/src/store/web.js +0 -50
- package/bin/static/user/1/number_info.xlsx +0 -0
- package/bin/static/w3c.html +0 -94
- package/init.js +0 -55
- package/update.md +0 -1
- /package/{bin → core}/com/api/README.md +0 -0
- /package/{bin → core}/com/api/rpc.js +0 -0
- /package/{bin → core}/com/db/README.md +0 -0
- /package/{bin → core}/com/event/README.md +0 -0
- /package/{bin/com/socket → core/com/mqtt}/README.md +0 -0
- /package/{bin → core}/com/nav/README.md +0 -0
- /package/{bin → core}/com/nav/config.tpl.json +0 -0
- /package/{bin → core}/com/param/README.md +0 -0
- /package/{bin → core}/com/param/index.js +0 -0
- /package/{bin → core}/com/param/script.js +0 -0
- /package/{bin → core}/com/param/test.js +0 -0
- /package/{bin → core}/com/plugin/README.md +0 -0
- /package/{bin → core}/com/plugin/script.js +0 -0
- /package/{bin → core}/com/sql/README.md +0 -0
- /package/{bin → core}/com/sql/index.js +0 -0
- /package/{bin → core}/com/sql/script.js +0 -0
- /package/{bin → core}/com/static/README.md +0 -0
- /package/{bin → core}/com/static/script.js +0 -0
- /package/{bin → core}/com/task/README.md +0 -0
- /package/{bin/rps.bat → rps.bat} +0 -0
- /package/{bin/tps.bat → tps.bat} +0 -0
package/bin/static/js/mm_vue.js
DELETED
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
define(["Vue"], function(Vue) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var getHost = function() {
|
|
5
|
-
var tag = $.html.tag('script', 'src', '*require.js');
|
|
6
|
-
|
|
7
|
-
if (tag) {
|
|
8
|
-
var server = tag.dataset.server;
|
|
9
|
-
if (server) {
|
|
10
|
-
return server;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return "/";
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
var mm = {
|
|
17
|
-
/**
|
|
18
|
-
* @description 安装
|
|
19
|
-
* @param {Object} Vue 框架
|
|
20
|
-
* @param {Object} options 配置参数
|
|
21
|
-
*/
|
|
22
|
-
install: function install(Vue, options) {
|
|
23
|
-
var host;
|
|
24
|
-
|
|
25
|
-
if (options) {
|
|
26
|
-
if (options.host) {
|
|
27
|
-
host = options.host;
|
|
28
|
-
} else {
|
|
29
|
-
host = getHost();
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
host = getHost();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
*/
|
|
38
|
-
Vue.prototype.$ = $;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 路由跳转
|
|
42
|
-
* @param {String} url
|
|
43
|
-
*/
|
|
44
|
-
Vue.prototype.$redirect = function(url) {
|
|
45
|
-
if (url) {
|
|
46
|
-
$.route.redirect_url = url;
|
|
47
|
-
} else {
|
|
48
|
-
return $.route.redirect_url;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @description 路由跳转
|
|
54
|
-
*/
|
|
55
|
-
Vue.prototype.$back = function() {
|
|
56
|
-
this.$router.back();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 转为键值
|
|
61
|
-
* @param {Object} arr 数组
|
|
62
|
-
* @param {String} key 键
|
|
63
|
-
* @param {String} name 名称
|
|
64
|
-
*/
|
|
65
|
-
Vue.prototype.$to_kv = function(arr, key, name) {
|
|
66
|
-
var list = [];
|
|
67
|
-
if(arr.length > 0){
|
|
68
|
-
if (key) {
|
|
69
|
-
var n = name ? name : 'name';
|
|
70
|
-
for (var i = 0; i < arr.length; i++) {
|
|
71
|
-
var o = arr[i];
|
|
72
|
-
list.push({
|
|
73
|
-
name: o[n],
|
|
74
|
-
value: o[key]
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
if(arr[0].name !== ''){
|
|
78
|
-
list.unshift({ name: '', value: '' });
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
list[0].value = '';
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
for (var i = 0; i < arr.length; i++) {
|
|
85
|
-
var o = arr[i];
|
|
86
|
-
list.push({
|
|
87
|
-
name: o,
|
|
88
|
-
value: i
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
if(arr[0] !== ''){
|
|
92
|
-
list.unshift({ name: '', value: '' });
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
list[0].value = '';
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return list;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 转换时间
|
|
104
|
-
* @param {String} datetime
|
|
105
|
-
* @param {String} format
|
|
106
|
-
*/
|
|
107
|
-
Vue.prototype.$to_time = function(datetime, format) {
|
|
108
|
-
if(!format)
|
|
109
|
-
{
|
|
110
|
-
format = 'yyyy-MM-dd hh:mm';
|
|
111
|
-
}
|
|
112
|
-
return new Date(datetime).toStr(format);
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* 转页面大小
|
|
116
|
-
* @param {Object} arr
|
|
117
|
-
*/
|
|
118
|
-
Vue.prototype.$to_size = function(arr) {
|
|
119
|
-
if(!arr || arr.length == 0){
|
|
120
|
-
arr = [10, 30, 50, 100, 200];
|
|
121
|
-
}
|
|
122
|
-
var list =[];
|
|
123
|
-
for(var i = 0; i < arr.length; i++){
|
|
124
|
-
var n = arr[i];
|
|
125
|
-
list.push({name: n + "条/页", value: n});
|
|
126
|
-
}
|
|
127
|
-
return list;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* @description 取host地址
|
|
132
|
-
* @param {String} pathAndQuery 路径和参数 例如:'/app/test?name=123'
|
|
133
|
-
*/
|
|
134
|
-
Vue.prototype.$host = function(pathAndQuery) {
|
|
135
|
-
return host + pathAndQuery;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @description 跳转连接
|
|
140
|
-
* @param {String} url 路径
|
|
141
|
-
*/
|
|
142
|
-
Vue.prototype.$url = function(url) {
|
|
143
|
-
return window.location.protocol + "//" + window.location.host + url;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @description 复制
|
|
148
|
-
*/
|
|
149
|
-
Vue.prototype.$copy = function(text) {
|
|
150
|
-
$.copyText(text);
|
|
151
|
-
$.toast("复制成功");
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @description 引入get请求函数
|
|
156
|
-
* @param {String} url 请求地址
|
|
157
|
-
* @param {Object} query 请求参数
|
|
158
|
-
* @param {Function} func 回调函数
|
|
159
|
-
*/
|
|
160
|
-
Vue.prototype.$get = function(url, query, func) {
|
|
161
|
-
var token = $.db.get("token");
|
|
162
|
-
var u = url.replace("~/", host);
|
|
163
|
-
u = query ? $.toUrl(query, u) : u;
|
|
164
|
-
var _this = this;
|
|
165
|
-
$.http.get(u, function(json, status) {
|
|
166
|
-
if (json.error) {
|
|
167
|
-
var msg = json.error.message;
|
|
168
|
-
if (msg.indexOf('未登录') !== -1 || msg.indexOf('非法') !== -1) {
|
|
169
|
-
$.db.set("token", "", 120);
|
|
170
|
-
_this.$router.push('/sign_in');
|
|
171
|
-
} else if (msg.indexOf('没有') !== -1) {
|
|
172
|
-
_this.$router.push('/not_power');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (func) {
|
|
176
|
-
func(json, status);
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
"x-auth-token": token
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @description 引入post请求
|
|
185
|
-
* @param {String} url 请求地址
|
|
186
|
-
* @param {Object} param 请求参数
|
|
187
|
-
* @param {Function} func 回调函数
|
|
188
|
-
* @param {String} type 发送的数据类型 xml类型、json类型、form类型
|
|
189
|
-
*/
|
|
190
|
-
Vue.prototype.$post = function(url, param, func, type) {
|
|
191
|
-
var token = $.db.get("token");
|
|
192
|
-
$.http.post(url.replace("~/", host), param, func, {
|
|
193
|
-
"x-auth-token": token
|
|
194
|
-
}, type);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @description 跳转到指定页面
|
|
199
|
-
* @param {String} url 跳转网址
|
|
200
|
-
* @param {Boolean} bl 是否返回到标签页
|
|
201
|
-
*/
|
|
202
|
-
Vue.prototype.$nav = function(url, bl) {
|
|
203
|
-
if (url.indexOf("http") === 0) {
|
|
204
|
-
location.href = url;
|
|
205
|
-
} else {
|
|
206
|
-
this.$router.push(url);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @description 引入上传请求
|
|
212
|
-
* @param {String} url 上传地址
|
|
213
|
-
* @param {Object} form 表单数据
|
|
214
|
-
* @param {Object} fileObj 上传文件对象
|
|
215
|
-
* @param {Function} func 回调函数
|
|
216
|
-
*/
|
|
217
|
-
Vue.prototype.$upload = function(url, form, fileObj, func) {
|
|
218
|
-
var token = $.db.get("token");
|
|
219
|
-
var headers = {
|
|
220
|
-
"x-auth-token": token
|
|
221
|
-
};
|
|
222
|
-
$.file.upload(url.replace("~/", host), form, fileObj, func, headers);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @description 被转换的数值
|
|
227
|
-
* @param {Object} num 引入浮点数
|
|
228
|
-
* @return {String} 浮点数数值
|
|
229
|
-
*/
|
|
230
|
-
Vue.prototype.$float = function(num) {
|
|
231
|
-
var str = num.toFloor(8).toStr(8);
|
|
232
|
-
for (var i = 0; i < 9; i++) {
|
|
233
|
-
if (!str.endWith("0") && !str.endWith(".")) {
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
str = str.substring(0, str.length - 1);
|
|
237
|
-
}
|
|
238
|
-
return str;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* @description 转双精度
|
|
243
|
-
* @param {Number} num 被转换的数值
|
|
244
|
-
* @return {String} 返回双精度字符串
|
|
245
|
-
*/
|
|
246
|
-
Vue.prototype.$double = function(num) {
|
|
247
|
-
return num.toFloor(2).toStr(2);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* @description 搁一法
|
|
252
|
-
* @param {Number} num 被转换的数值
|
|
253
|
-
* @param {Number} len 保留小数位
|
|
254
|
-
* @return {Number} 浮点数数值
|
|
255
|
-
*/
|
|
256
|
-
Vue.prototype.$floor = function(num, len) {
|
|
257
|
-
return num.toFloor(len);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @description 科学计数转浮点数
|
|
262
|
-
* @param {String} num 被转换的数值
|
|
263
|
-
* @return {Number} 数值
|
|
264
|
-
*/
|
|
265
|
-
Vue.prototype.$num = function(num) {
|
|
266
|
-
return new Number(num);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* @description 引入截取字符串函数
|
|
271
|
-
* @param {String} str 被截取的字符串
|
|
272
|
-
* @param {String} start 起始字符串
|
|
273
|
-
* @param {String} end 结束字符串
|
|
274
|
-
* @return {String} 截取后的字符串
|
|
275
|
-
*/
|
|
276
|
-
Vue.prototype.$substr = function(str, start, end) {
|
|
277
|
-
return str.substring(start, end);
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* @description 转字符串并截取长度
|
|
282
|
-
* @param {Object} value 被转换的数值
|
|
283
|
-
* @param {Number} num 保留长度
|
|
284
|
-
* @return {String} 截取后字符串
|
|
285
|
-
*/
|
|
286
|
-
Vue.prototype.$toStr = function(value, num) {
|
|
287
|
-
return value.toStr(num);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
/* === 注册过滤器, 备注:过滤器在$-app中无法使用 === */
|
|
291
|
-
/**
|
|
292
|
-
* @description 转双精度小数字符串
|
|
293
|
-
* @param {Object} value 被转换的数值
|
|
294
|
-
* @return {String} 返回双精度数字符串
|
|
295
|
-
*/
|
|
296
|
-
Vue.filter("double", function(value) {
|
|
297
|
-
return parseFloat(value).toFloor(2).toStr(2);
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @description 转浮点数字符串
|
|
302
|
-
* @param {Object} value 被转换的数值
|
|
303
|
-
* @return {String} 返回浮点数字符串
|
|
304
|
-
*/
|
|
305
|
-
Vue.filter("float", function(value) {
|
|
306
|
-
return parseFloat(value).toFloor(8).toStr(8);
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* @description 全局混入
|
|
313
|
-
*/
|
|
314
|
-
Vue.mixin({
|
|
315
|
-
methods: {
|
|
316
|
-
/**
|
|
317
|
-
* @description 读取语言库
|
|
318
|
-
* @param {String} name 名称
|
|
319
|
-
* @return {String} 返回语言值
|
|
320
|
-
*/
|
|
321
|
-
$lang: function $lang(name) {
|
|
322
|
-
var lang = this.$store.state.web.lang;
|
|
323
|
-
var title = "";
|
|
324
|
-
for (var i = 0; i < lang.length; i++) {
|
|
325
|
-
if (name = o.name) {
|
|
326
|
-
title = o.title;
|
|
327
|
-
break;
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
return title;
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* @description 数字货币转法币
|
|
335
|
-
* @param {Object} coin 货币数值
|
|
336
|
-
* @return {Number} 法币数值
|
|
337
|
-
*/
|
|
338
|
-
$money: function $money(coin) {
|
|
339
|
-
return parseFloat(coin * this.$store.state.web.rate).toFloor(2);
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* @description 法币转数字货币
|
|
344
|
-
* @param {Object} money 法币数值
|
|
345
|
-
* @return {Number} 货币数值
|
|
346
|
-
*/
|
|
347
|
-
$coin: function $coin(money) {
|
|
348
|
-
return parseFloat(money / this.$store.state.web.rate).toFloor(8);
|
|
349
|
-
},
|
|
350
|
-
/**
|
|
351
|
-
* @description 获取用户信息
|
|
352
|
-
* @param {Function} func
|
|
353
|
-
*/
|
|
354
|
-
$get_user: function $get_user(func) {
|
|
355
|
-
var _this = this;
|
|
356
|
-
this.$get('~/api/user/state', null, function(json, status) {
|
|
357
|
-
if (json.result) {
|
|
358
|
-
_this.$sotre.commit('set_user', json.result);
|
|
359
|
-
} else if (json.error) {
|
|
360
|
-
// 非法访问或未登录
|
|
361
|
-
// $.toast(json.error.message);
|
|
362
|
-
$.db.set("token", "");
|
|
363
|
-
// _this.$router.push('/signin')
|
|
364
|
-
} else {
|
|
365
|
-
$.toast('服务器连接失败!');
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
if (func) {
|
|
369
|
-
func();
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
return mm;
|
|
376
|
-
});
|