mm_os 1.3.3 → 1.3.5

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.
Files changed (368) hide show
  1. package/README.en.md +36 -0
  2. package/README.md +25 -166
  3. package/conf.json +3 -0
  4. package/core/base/index.js +29 -0
  5. package/core/base/mqtt/index.js +268 -0
  6. package/core/base/mqtt/lib.js +40 -0
  7. package/core/base/web/index.js +110 -0
  8. package/core/com/api/com.json +4 -0
  9. package/{bin → core}/com/api/config.tpl.json +9 -7
  10. package/{bin → core}/com/api/drive.js +239 -64
  11. package/{bin → core}/com/api/index.js +8 -9
  12. package/{bin → core}/com/api/oauth.js +23 -14
  13. package/core/com/api/script.js +32 -0
  14. package/core/com/db/com.json +4 -0
  15. package/{bin → core}/com/db/drive.js +99 -65
  16. package/{bin → core}/com/db/index.js +2 -2
  17. package/core/com/event/com.json +4 -0
  18. package/{bin → core}/com/event/config.tpl.json +2 -2
  19. package/core/com/event/drive.js +125 -0
  20. package/{bin → core}/com/event/index.js +5 -10
  21. package/core/com/event/script.js +26 -0
  22. package/core/com/eventer/com.js +450 -0
  23. package/core/com/eventer/com.json +4 -0
  24. package/core/com/middleware/com.js +128 -0
  25. package/core/com/middleware/com.json +4 -0
  26. package/core/com/middleware/config.tpl.json +8 -0
  27. package/core/com/middleware/script.js +9 -0
  28. package/core/com/mqtt/com.json +4 -0
  29. package/core/com/mqtt/config.tpl.json +12 -0
  30. package/core/com/mqtt/drive.js +139 -0
  31. package/core/com/mqtt/index.js +138 -0
  32. package/core/com/mqtt/script.js +33 -0
  33. package/core/com/msg/com.js +296 -0
  34. package/core/com/msg/com.json +4 -0
  35. package/{bin → core}/com/nav/drive.js +42 -17
  36. package/{bin → core}/com/nav/index.js +4 -4
  37. package/core/com/nav/tpl/admin_pc/page_channel.vue +299 -0
  38. package/core/com/nav/tpl/admin_pc/page_config.vue +279 -0
  39. package/core/com/nav/tpl/admin_pc/page_config_form.vue +194 -0
  40. package/core/com/nav/tpl/admin_pc/page_default.vue +287 -0
  41. package/core/com/nav/tpl/admin_pc/page_form.vue +180 -0
  42. package/core/com/nav/tpl/admin_pc/page_lang.vue +265 -0
  43. package/core/com/nav/tpl/admin_pc/page_nav.vue +313 -0
  44. package/core/com/nav/tpl/admin_pc/page_table.vue +285 -0
  45. package/core/com/nav/tpl/admin_pc/page_type.vue +313 -0
  46. package/core/com/nav/tpl/dev_pc/page_channel.vue +253 -0
  47. package/core/com/nav/tpl/dev_pc/page_config.vue +253 -0
  48. package/core/com/nav/tpl/dev_pc/page_default.vue +247 -0
  49. package/core/com/nav/tpl/dev_pc/page_form.vue +162 -0
  50. package/core/com/nav/tpl/dev_pc/page_nav.vue +253 -0
  51. package/core/com/nav/tpl/dev_pc/page_table.vue +247 -0
  52. package/core/com/nav/tpl/dev_pc/page_type.vue +253 -0
  53. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_channel.vue +231 -231
  54. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_default.vue +231 -231
  55. package/{bin → core}/com/nav/tpl/home_pc/page_form.vue +9 -9
  56. package/{bin → core}/com/nav/tpl/home_pc/page_list.vue +231 -231
  57. package/{bin → core}/com/nav/tpl/home_pc/page_nav.vue +221 -221
  58. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_type.vue +231 -231
  59. package/{bin → core}/com/nav/tpl/home_pc/page_view.vue +8 -8
  60. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_channel.vue +231 -231
  61. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_default.vue +231 -231
  62. package/{bin → core}/com/nav/tpl/home_phone/page_form.vue +9 -9
  63. package/{bin → core}/com/nav/tpl/home_phone/page_list.vue +231 -231
  64. package/{bin/com/nav/tpl/admin_pc → core/com/nav/tpl/home_phone}/page_nav.vue +236 -220
  65. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_type.vue +231 -231
  66. package/{bin → core}/com/nav/tpl/home_phone/page_view.vue +8 -8
  67. package/core/com/nav/viewmodel.js +296 -0
  68. package/{bin → core}/com/param/config.tpl.json +24 -0
  69. package/{bin → core}/com/param/drive.js +47 -15
  70. package/core/com/plugin/com.json +4 -0
  71. package/core/com/plugin/config.tpl.json +20 -0
  72. package/{bin → core}/com/plugin/drive.js +5 -8
  73. package/{bin → core}/com/plugin/index.js +11 -56
  74. package/core/com/socket/README.md +47 -0
  75. package/core/com/socket/com.json +4 -0
  76. package/core/com/socket/config.tpl.json +14 -0
  77. package/{bin → core}/com/socket/drive.js +74 -51
  78. package/{bin → core}/com/socket/index.js +4 -2
  79. package/{bin → core}/com/socket/script.js +8 -6
  80. package/core/com/sql/config.tpl.json +70 -0
  81. package/{bin → core}/com/sql/drive.js +281 -58
  82. package/core/com/static/com.json +4 -0
  83. package/core/com/static/config.tpl.json +20 -0
  84. package/{bin → core}/com/static/drive.js +6 -4
  85. package/{bin → core}/com/static/index.js +5 -1
  86. package/core/com/task/com.json +4 -0
  87. package/core/com/task/config.tpl.json +24 -0
  88. package/core/com/task/drive.js +374 -0
  89. package/{bin → core}/com/task/index.js +14 -20
  90. package/core/com/task/script.js +37 -0
  91. package/core/com/timer/com.js +217 -0
  92. package/core/com/timer/com.json +4 -0
  93. package/core/com/tpl/com.js +19 -0
  94. package/core/com/tpl/com.json +4 -0
  95. package/index.js +161 -740
  96. package/lib/actions.js +50 -0
  97. package/lib/app.js +73 -0
  98. package/lib/base.js +355 -0
  99. package/lib/com.js +31 -0
  100. package/lib/game.js +31 -0
  101. package/lib/ref.js +121 -0
  102. package/middleware/cors/index.js +57 -0
  103. package/middleware/cors/middleware.json +7 -0
  104. package/middleware/mqtt_base/index.js +10 -0
  105. package/middleware/mqtt_base/middleware.json +8 -0
  106. package/{waf.js → middleware/waf/index.js} +12 -2
  107. package/middleware/waf/middleware.json +9 -0
  108. package/middleware/web_base/index.js +67 -0
  109. package/middleware/web_base/middleware.json +9 -0
  110. package/middleware/web_event/index.js +411 -0
  111. package/middleware/web_event/middleware.json +10 -0
  112. package/middleware/web_proxy/index.js +24 -0
  113. package/middleware/web_proxy/middleware.json +9 -0
  114. package/middleware/web_router/index.js +33 -0
  115. package/middleware/web_router/middleware.json +10 -0
  116. package/middleware/web_socket/index.js +21 -0
  117. package/middleware/web_socket/middleware.json +9 -0
  118. package/middleware/web_static/index.js +26 -0
  119. package/middleware/web_static/middleware.json +9 -0
  120. package/nodemon.json +12 -2
  121. package/package.json +56 -66
  122. package/.gitattributes +0 -5
  123. package/bin/com/README.md +0 -2
  124. package/bin/com/api/script.js +0 -14
  125. package/bin/com/cmd/README.md +0 -3
  126. package/bin/com/cmd/config.tpl.json +0 -41
  127. package/bin/com/cmd/drive.js +0 -512
  128. package/bin/com/cmd/index.js +0 -213
  129. package/bin/com/cmd/old/5w2h.js +0 -54
  130. package/bin/com/cmd/old/drive.js +0 -423
  131. package/bin/com/cmd/script.js +0 -11
  132. package/bin/com/event/drive.js +0 -69
  133. package/bin/com/event/script.js +0 -12
  134. package/bin/com/nav/tpl/admin_pc/page_channel.vue +0 -234
  135. package/bin/com/nav/tpl/admin_pc/page_default.vue +0 -236
  136. package/bin/com/nav/tpl/admin_pc/page_form.vue +0 -152
  137. package/bin/com/nav/tpl/admin_pc/page_table.vue +0 -236
  138. package/bin/com/nav/tpl/admin_pc/page_type.vue +0 -234
  139. package/bin/com/nav/tpl/home_phone/page_nav.vue +0 -221
  140. package/bin/com/nav/viewmodel.js +0 -161
  141. package/bin/com/plugin/config.tpl.json +0 -11
  142. package/bin/com/socket/config.tpl.json +0 -8
  143. package/bin/com/sql/config.tpl.json +0 -34
  144. package/bin/com/static/config.tpl.json +0 -11
  145. package/bin/com/task/config.tpl.json +0 -13
  146. package/bin/com/task/drive.js +0 -288
  147. package/bin/com/task/script.js +0 -38
  148. package/bin/com.js +0 -74
  149. package/bin/mm.conf +0 -48
  150. package/bin/static/404.html +0 -52
  151. package/bin/static/README.md +0 -1
  152. package/bin/static/css/font-awesome.min.css +0 -7
  153. package/bin/static/css/mm_base.css +0 -220
  154. package/bin/static/css/mm_common.css +0 -518
  155. package/bin/static/css/mm_component.css +0 -307
  156. package/bin/static/css/mm_expand.css +0 -634
  157. package/bin/static/css/mm_theme.css +0 -291
  158. package/bin/static/css/new_file.css +0 -79
  159. package/bin/static/css/swiper.min.css +0 -12
  160. package/bin/static/favicon.ico +0 -0
  161. package/bin/static/font/FontAwesome.otf +0 -0
  162. package/bin/static/font/HelveticaNeue.eot +0 -0
  163. package/bin/static/font/HelveticaNeue.otf +0 -0
  164. package/bin/static/font/HelveticaNeue.svg +0 -1273
  165. package/bin/static/font/HelveticaNeue.woff +0 -0
  166. package/bin/static/font/HelveticaNeue.woff2 +0 -0
  167. package/bin/static/font/fontawesome-webfont.eot +0 -0
  168. package/bin/static/font/fontawesome-webfont.svg +0 -2671
  169. package/bin/static/font/fontawesome-webfont.ttf +0 -0
  170. package/bin/static/font/fontawesome-webfont.woff +0 -0
  171. package/bin/static/font/fontawesome-webfont.woff2 +0 -0
  172. package/bin/static/h5.html +0 -325
  173. package/bin/static/highlight/highlight.pack.js +0 -2
  174. package/bin/static/highlight/styles/a11y-dark.css +0 -99
  175. package/bin/static/highlight/styles/a11y-light.css +0 -99
  176. package/bin/static/highlight/styles/agate.css +0 -108
  177. package/bin/static/highlight/styles/an-old-hope.css +0 -89
  178. package/bin/static/highlight/styles/androidstudio.css +0 -66
  179. package/bin/static/highlight/styles/arduino-light.css +0 -88
  180. package/bin/static/highlight/styles/arta.css +0 -73
  181. package/bin/static/highlight/styles/ascetic.css +0 -45
  182. package/bin/static/highlight/styles/atelier-cave-dark.css +0 -83
  183. package/bin/static/highlight/styles/atelier-cave-light.css +0 -85
  184. package/bin/static/highlight/styles/atelier-dune-dark.css +0 -69
  185. package/bin/static/highlight/styles/atelier-dune-light.css +0 -69
  186. package/bin/static/highlight/styles/atelier-estuary-dark.css +0 -84
  187. package/bin/static/highlight/styles/atelier-estuary-light.css +0 -84
  188. package/bin/static/highlight/styles/atelier-forest-dark.css +0 -69
  189. package/bin/static/highlight/styles/atelier-forest-light.css +0 -69
  190. package/bin/static/highlight/styles/atelier-heath-dark.css +0 -69
  191. package/bin/static/highlight/styles/atelier-heath-light.css +0 -69
  192. package/bin/static/highlight/styles/atelier-lakeside-dark.css +0 -69
  193. package/bin/static/highlight/styles/atelier-lakeside-light.css +0 -69
  194. package/bin/static/highlight/styles/atelier-plateau-dark.css +0 -84
  195. package/bin/static/highlight/styles/atelier-plateau-light.css +0 -84
  196. package/bin/static/highlight/styles/atelier-savanna-dark.css +0 -84
  197. package/bin/static/highlight/styles/atelier-savanna-light.css +0 -84
  198. package/bin/static/highlight/styles/atelier-seaside-dark.css +0 -69
  199. package/bin/static/highlight/styles/atelier-seaside-light.css +0 -69
  200. package/bin/static/highlight/styles/atelier-sulphurpool-dark.css +0 -69
  201. package/bin/static/highlight/styles/atelier-sulphurpool-light.css +0 -69
  202. package/bin/static/highlight/styles/atom-one-dark-reasonable.css +0 -77
  203. package/bin/static/highlight/styles/atom-one-dark.css +0 -96
  204. package/bin/static/highlight/styles/atom-one-light.css +0 -96
  205. package/bin/static/highlight/styles/brown-paper.css +0 -64
  206. package/bin/static/highlight/styles/brown-papersq.png +0 -0
  207. package/bin/static/highlight/styles/codepen-embed.css +0 -60
  208. package/bin/static/highlight/styles/color-brewer.css +0 -71
  209. package/bin/static/highlight/styles/darcula.css +0 -77
  210. package/bin/static/highlight/styles/dark.css +0 -63
  211. package/bin/static/highlight/styles/darkula.css +0 -6
  212. package/bin/static/highlight/styles/default.css +0 -99
  213. package/bin/static/highlight/styles/docco.css +0 -97
  214. package/bin/static/highlight/styles/dracula.css +0 -76
  215. package/bin/static/highlight/styles/far.css +0 -71
  216. package/bin/static/highlight/styles/foundation.css +0 -88
  217. package/bin/static/highlight/styles/github-gist.css +0 -79
  218. package/bin/static/highlight/styles/github.css +0 -99
  219. package/bin/static/highlight/styles/gml.css +0 -78
  220. package/bin/static/highlight/styles/googlecode.css +0 -89
  221. package/bin/static/highlight/styles/grayscale.css +0 -101
  222. package/bin/static/highlight/styles/gruvbox-dark.css +0 -108
  223. package/bin/static/highlight/styles/gruvbox-light.css +0 -108
  224. package/bin/static/highlight/styles/hopscotch.css +0 -83
  225. package/bin/static/highlight/styles/hybrid.css +0 -102
  226. package/bin/static/highlight/styles/idea.css +0 -97
  227. package/bin/static/highlight/styles/ir-black.css +0 -73
  228. package/bin/static/highlight/styles/isbl-editor-dark.css +0 -112
  229. package/bin/static/highlight/styles/isbl-editor-light.css +0 -112
  230. package/bin/static/highlight/styles/kimbie.dark.css +0 -74
  231. package/bin/static/highlight/styles/kimbie.light.css +0 -74
  232. package/bin/static/highlight/styles/lightfair.css +0 -87
  233. package/bin/static/highlight/styles/magula.css +0 -70
  234. package/bin/static/highlight/styles/mono-blue.css +0 -59
  235. package/bin/static/highlight/styles/monokai-sublime.css +0 -83
  236. package/bin/static/highlight/styles/monokai.css +0 -70
  237. package/bin/static/highlight/styles/nord.css +0 -309
  238. package/bin/static/highlight/styles/obsidian.css +0 -88
  239. package/bin/static/highlight/styles/ocean.css +0 -74
  240. package/bin/static/highlight/styles/paraiso-dark.css +0 -72
  241. package/bin/static/highlight/styles/paraiso-light.css +0 -72
  242. package/bin/static/highlight/styles/pojoaque.css +0 -83
  243. package/bin/static/highlight/styles/pojoaque.jpg +0 -0
  244. package/bin/static/highlight/styles/purebasic.css +0 -96
  245. package/bin/static/highlight/styles/qtcreator_dark.css +0 -83
  246. package/bin/static/highlight/styles/qtcreator_light.css +0 -83
  247. package/bin/static/highlight/styles/railscasts.css +0 -106
  248. package/bin/static/highlight/styles/rainbow.css +0 -85
  249. package/bin/static/highlight/styles/routeros.css +0 -108
  250. package/bin/static/highlight/styles/school-book.css +0 -69
  251. package/bin/static/highlight/styles/school-book.png +0 -0
  252. package/bin/static/highlight/styles/shades-of-purple.css +0 -97
  253. package/bin/static/highlight/styles/solarized-dark.css +0 -84
  254. package/bin/static/highlight/styles/solarized-light.css +0 -84
  255. package/bin/static/highlight/styles/sunburst.css +0 -102
  256. package/bin/static/highlight/styles/tomorrow-night-blue.css +0 -75
  257. package/bin/static/highlight/styles/tomorrow-night-bright.css +0 -74
  258. package/bin/static/highlight/styles/tomorrow-night-eighties.css +0 -74
  259. package/bin/static/highlight/styles/tomorrow-night.css +0 -75
  260. package/bin/static/highlight/styles/tomorrow.css +0 -72
  261. package/bin/static/highlight/styles/vs.css +0 -68
  262. package/bin/static/highlight/styles/vs2015.css +0 -115
  263. package/bin/static/highlight/styles/xcode.css +0 -104
  264. package/bin/static/highlight/styles/xt256.css +0 -92
  265. package/bin/static/highlight/styles/zenburn.css +0 -80
  266. package/bin/static/highlight/vue-highlight.js +0 -29
  267. package/bin/static/ifame.html +0 -24
  268. package/bin/static/img/add.png +0 -0
  269. package/bin/static/img/avatar.png +0 -0
  270. package/bin/static/img/banner_2.png +0 -0
  271. package/bin/static/img/default.png +0 -0
  272. package/bin/static/img/loading.svg +0 -1
  273. package/bin/static/img/logo.png +0 -0
  274. package/bin/static/img/logo1.png +0 -0
  275. package/bin/static/img/logo_gray.png +0 -0
  276. package/bin/static/img/logo_round.png +0 -0
  277. package/bin/static/img/mm.ico +0 -0
  278. package/bin/static/img/mm.jpg +0 -0
  279. package/bin/static/img/select.png +0 -0
  280. package/bin/static/img/web.png +0 -0
  281. package/bin/static/index.html +0 -12
  282. package/bin/static/js/clipboard.min.js +0 -257
  283. package/bin/static/js/css.min.js +0 -1
  284. package/bin/static/js/echarts.js +0 -22
  285. package/bin/static/js/html5.min.js +0 -1
  286. package/bin/static/js/jquery.lazyload.min.js +0 -2
  287. package/bin/static/js/jquery.min.js +0 -4189
  288. package/bin/static/js/jquery.scrollstop.min.js +0 -2
  289. package/bin/static/js/mm-requirejs-vue.js +0 -283
  290. package/bin/static/js/mm_check.js +0 -490
  291. package/bin/static/js/mm_flexble.js +0 -112
  292. package/bin/static/js/mm_picker.js +0 -1417
  293. package/bin/static/js/mm_pinyinlite.js +0 -873
  294. package/bin/static/js/mm_sdk.js +0 -2841
  295. package/bin/static/js/mm_ui_expand.js +0 -468
  296. package/bin/static/js/mm_vue.js +0 -376
  297. package/bin/static/js/mm_vue_ui.js +0 -2375
  298. package/bin/static/js/mm_websocket.js +0 -145
  299. package/bin/static/js/require.js +0 -5
  300. package/bin/static/js/sortable.min.js +0 -3
  301. package/bin/static/js/swiper.min.js +0 -13
  302. package/bin/static/js/text.min.js +0 -1
  303. package/bin/static/js/vue-router.min.js +0 -6
  304. package/bin/static/js/vue.js +0 -12338
  305. package/bin/static/js/vuedraggable.min.js +0 -2
  306. package/bin/static/js/vuex.min.js +0 -6
  307. package/bin/static/src/components/bar/mm_action.vue +0 -19
  308. package/bin/static/src/components/bar/mm_buy.vue +0 -19
  309. package/bin/static/src/components/bar/mm_chat.vue +0 -18
  310. package/bin/static/src/components/bar/mm_count.vue +0 -18
  311. package/bin/static/src/components/bar/mm_filter.vue +0 -18
  312. package/bin/static/src/components/bar/mm_search.vue +0 -18
  313. package/bin/static/src/components/bar/mm_sort.vue +0 -18
  314. package/bin/static/src/components/bar/mm_tag.vue +0 -18
  315. package/bin/static/src/components/bar/mm_title.vue +0 -19
  316. package/bin/static/src/components/content/mm_pre.vue +0 -70
  317. package/bin/static/src/components/expand/mm_drag.vue +0 -39
  318. package/bin/static/src/components/item/mm_article.vue +0 -115
  319. package/bin/static/src/components/item/mm_base.vue +0 -26
  320. package/bin/static/src/components/item/mm_contact.vue +0 -25
  321. package/bin/static/src/components/item/mm_goods.vue +0 -23
  322. package/bin/static/src/components/item/mm_img.vue +0 -21
  323. package/bin/static/src/components/item/mm_media.vue +0 -18
  324. package/bin/static/src/components/item/mm_message.vue +0 -18
  325. package/bin/static/src/components/item/mm_music.vue +0 -95
  326. package/bin/static/src/components/item/mm_news.vue +0 -22
  327. package/bin/static/src/components/item/mm_number.vue +0 -26
  328. package/bin/static/src/components/item/mm_question.vue +0 -35
  329. package/bin/static/src/components/item/mm_user.vue +0 -22
  330. package/bin/static/src/components/item/mm_video.vue +0 -95
  331. package/bin/static/src/components/slide/mm_slide_card.vue +0 -64
  332. package/bin/static/src/components/slide/mm_slide_img.vue +0 -47
  333. package/bin/static/src/components/slide/mm_slide_page.vue +0 -8
  334. package/bin/static/src/components/slide/mm_slide_text.vue +0 -54
  335. package/bin/static/src/main.js +0 -84
  336. package/bin/static/src/mixins/form.js +0 -223
  337. package/bin/static/src/mixins/item.js +0 -242
  338. package/bin/static/src/mixins/list.js +0 -244
  339. package/bin/static/src/mixins/page.js +0 -1011
  340. package/bin/static/src/mm_component.js +0 -74
  341. package/bin/static/src/router.js +0 -72
  342. package/bin/static/src/store/user.js +0 -75
  343. package/bin/static/src/store/web.js +0 -50
  344. package/bin/static/user/1/number_info.xlsx +0 -0
  345. package/bin/static/w3c.html +0 -94
  346. package/init.js +0 -55
  347. package/update.md +0 -1
  348. /package/{bin → core}/com/api/README.md +0 -0
  349. /package/{bin → core}/com/api/rpc.js +0 -0
  350. /package/{bin → core}/com/db/README.md +0 -0
  351. /package/{bin → core}/com/event/README.md +0 -0
  352. /package/{bin/com/socket → core/com/mqtt}/README.md +0 -0
  353. /package/{bin → core}/com/nav/README.md +0 -0
  354. /package/{bin → core}/com/nav/config.tpl.json +0 -0
  355. /package/{bin → core}/com/param/README.md +0 -0
  356. /package/{bin → core}/com/param/index.js +0 -0
  357. /package/{bin → core}/com/param/script.js +0 -0
  358. /package/{bin → core}/com/param/test.js +0 -0
  359. /package/{bin → core}/com/plugin/README.md +0 -0
  360. /package/{bin → core}/com/plugin/script.js +0 -0
  361. /package/{bin → core}/com/sql/README.md +0 -0
  362. /package/{bin → core}/com/sql/index.js +0 -0
  363. /package/{bin → core}/com/sql/script.js +0 -0
  364. /package/{bin → core}/com/static/README.md +0 -0
  365. /package/{bin → core}/com/static/script.js +0 -0
  366. /package/{bin → core}/com/task/README.md +0 -0
  367. /package/{bin/rps.bat → rps.bat} +0 -0
  368. /package/{bin/tps.bat → tps.bat} +0 -0
@@ -1,490 +0,0 @@
1
-
2
- (function(){
3
- // 语言包
4
- var lang = {
5
- type: "数据类型不正确",
6
- notEmpty: "不能为空",
7
- required: "是必填字段",
8
- email: "需为有效的电子邮件地址",
9
- phone: "需为11位数的有效电话号码",
10
- url: "需为有效的网址",
11
- date: "需为有效的日期",
12
- dateISO: "需为有效的日期 (YYYY-MM-DD)",
13
- dateTime: "需为有效的日期时间",
14
- time: "需为有效的时间",
15
- number: "需为有效的数值",
16
- num: "只能输入数字",
17
- digits: "只能输入数字",
18
- creditcard: "需为有效的信用卡号码",
19
- identical: "与 {1} 不一致",
20
- different: "不能与 {1} 相同",
21
- extension: "需为有效的后缀, 仅支持 '{0}'",
22
- maxLength: "最多只能输入 {0} 个字符",
23
- minLength: "最少需要输入 {0} 个字符",
24
- rangeLength: "请输入长度在 {0} 到 {1} 之间的字符串",
25
- range: "请输入范围在 {0} 到 {1} 之间的数值",
26
- max: "请输入不大于 {0} 的数值",
27
- min: "请输入不小于 {0} 的数值",
28
- regex: "格式不正确",
29
- en: "只能输入英文",
30
- ch: "只能输入中文",
31
- chs: "只能输入中文",
32
- username: "只能由英文字母和数字组成",
33
- password: "不能包含特殊字符"
34
- };
35
-
36
- /**
37
- * @description 参数验证函数
38
- * @param {Object} config 配置
39
- */
40
- function Check(config){
41
- // 分隔符号, 用于查询时判断多个传参
42
- this.splitter = "|";
43
- // 参数类型 string字符串、number数字、bool布尔、dateTime时间、array数组类型、object对象类型
44
- this.type = "string";
45
- // 字符串相关验证
46
- this.string = {
47
- // 非空
48
- notEmpty: false,
49
- // 最小长度
50
- min: 0,
51
- // 最大长度
52
- max: 0,
53
- // 验证字符串范围, 传入两个成员, 最小长度和最大长度。例如:[0, 0]
54
- range: [],
55
- // 验证正则表达式
56
- regex: "",
57
- // 验证与某个参数值是否相同
58
- identical: "",
59
- // 验证与某个参数值是否不同
60
- different: "",
61
- // 后缀名, 多个后缀名用“|”分隔
62
- extension: "",
63
- // 格式验证 email、url、date、dateISO、number、digits、phone
64
- format: ""
65
- };
66
- // 数值相关验证
67
- this.number = {
68
- // 最小值
69
- min: 0,
70
- // 最大值
71
- max: 0,
72
- // 验证字符串范围
73
- range: []
74
- };
75
- if (config) {
76
- $.push(this, config, true);
77
- }
78
- }
79
-
80
- /**
81
- * @description 获取或设置错误提示
82
- * @param {Object} obj 设置的提示,可以为空,为空表示获取
83
- * @return {Object} 错误提示集合
84
- */
85
- Check.prototype.lang = function(obj) {
86
- if (obj) {
87
- $.push(lang, obj, true);
88
- } else {
89
- return lang;
90
- }
91
- };
92
-
93
- /**
94
- * @description 取错误提示
95
- * @param {String} key 语言包键
96
- * @param {String} v1 替换的词1
97
- * @param {String} v2 替换的词2
98
- * @return {String} 错误语句
99
- */
100
- Check.prototype.msg = function(key, v1, v2) {
101
- var str = lang[key];
102
- if (str) {
103
- if (v2) {
104
- return str.replace("{0}", v1).replace('{1}', v2);
105
- } else {
106
- return str.replace("{0}", v1);
107
- }
108
- } else {
109
- return "参数不正确!";
110
- }
111
- };
112
-
113
- /**
114
- * @description 验证数值
115
- * @param {Numbr} value 被验证的值
116
- * @return {String} 没通过返回信息, 否则返回空
117
- */
118
- Check.prototype.check_number = function(value) {
119
- var n = this.number;
120
- if (n.range.length === 2) {
121
- if (n.range[0] > value || n.range[1] < value) {
122
- return this.msg('range', n.range[0], n.range[1]);
123
- }
124
- } else {
125
- if (n.min !== 0 && n.min > value) {
126
- return this.msg('min', n.min);
127
- }
128
- if (n.max !== 0 && n.max < value) {
129
- return this.msg('max', n.max);
130
- }
131
- }
132
- return null;
133
- };
134
-
135
- /**
136
- * @description 验证字符串范围
137
- * @param {String} value 被验证的值
138
- * @return {String} 没通过返回信息,否则返回空
139
- */
140
- Check.prototype.check_string_range = function(value) {
141
- var n = this.string;
142
- var len = value.length;
143
- if (n.range.length === 2) {
144
- if (n.range[0] > len || n.range[1] < len) {
145
- return this.msg('rangeLength', n.range[0], n.range[1]);
146
- }
147
- } else {
148
- if (n.min !== 0 && n.min > len) {
149
- return this.msg('minLength', n.min);
150
- }
151
- if (n.max !== 0 && n.max < len) {
152
- return this.msg('maxLength', n.max);
153
- }
154
- }
155
- return null;
156
- };
157
-
158
- /**
159
- * @description 验证拓展名
160
- * @param {String} value 被验证的值
161
- * @return {String} 没通过返回信息,否则返回空
162
- */
163
- Check.prototype.check_extension = function(value) {
164
- var n = this.string;
165
- if (n.extension) {
166
- var arr = n.extension.split('|');
167
- var bl = false;
168
- var val = value.toLowerCase();
169
- for (var i = 0; i < arr.length; i++) {
170
- if (val.endWith(arr[i])) {
171
- bl = true;
172
- break;
173
- }
174
- }
175
- if (!bl) {
176
- return this.msg('extension', n.extension);
177
- }
178
- }
179
- return null;
180
- };
181
-
182
- /**
183
- * @description 正则验证字符串
184
- * @param {String} value 被验证的值
185
- * @return {String} 没通过返回信息,否则返回空
186
- */
187
- Check.prototype.check_string_regex = function(value) {
188
- var rx = this.string.regex;
189
- if (rx && !value.regex(rx)) {
190
- return this.msg('regex');
191
- }
192
- return null;
193
- };
194
-
195
- /**
196
- * @description 验证字符串格式
197
- * @param {String} value 被验证的值
198
- * @return {String} 没通过返回信息,否则返回空
199
- */
200
- Check.prototype.check_string_format = function(value) {
201
- var fmt = this.string.format;
202
- if (fmt) {
203
- var bl = value.checkFormat(fmt);
204
- if (!bl) {
205
- return this.msg(fmt);
206
- }
207
- }
208
- return null;
209
- };
210
-
211
- /**
212
- * @description 验证字符串
213
- * @param {String} value 被验证的值
214
- * @return {String} 没通过返回信息,否则返回空
215
- */
216
- Check.prototype.check_string = function(value) {
217
- if (value === '' && this.string.notEmpty) {
218
- return this.msg('notEmpty');
219
- } else {
220
- var msg = this.check_string_range(value);
221
- if (!msg) {
222
- msg = this.check_string_format(value);
223
- }
224
- if (!msg) {
225
- msg = this.check_extension(value);
226
- }
227
- if (!msg) {
228
- msg = this.check_string_regex(value);
229
- }
230
- return msg;
231
- }
232
- };
233
-
234
- /**
235
- * @description 验证值是否正确
236
- * @param {Object} value
237
- * @return {String} 没通过返回信息,否则返回空
238
- */
239
- Check.prototype.run = function(value) {
240
- var msg = null;
241
- if (value) {
242
- var type = this.type;
243
- var p = typeof(value);
244
- if (type !== p) {
245
- if (type === 'number') {
246
- if (p === 'string') {
247
- if (this.splitter) {
248
- var arr = value.split(this.splitter);
249
- for (var i = 0; i < arr.length; i++) {
250
- var val = arr[i];
251
- if (isNaN(val)) {
252
- msg = this.msg('number');
253
- } else {
254
- msg = this.check_number(Number(val));
255
- }
256
- if (msg) {
257
- break;
258
- }
259
- }
260
- } else {
261
- if (isNaN(value)) {
262
- msg = this.msg('number');
263
- } else {
264
- msg = this.check_number(Number(value));
265
- }
266
- }
267
- } else {
268
- msg = this.check_number(value);
269
- }
270
- } else if (type === 'bool') {
271
- if (value !== 'true' && value !== 'false' && value !== '1' && value !== '0') {
272
- msg = this.msg('type');
273
- }
274
- } else {
275
- msg = this.msg('type');
276
- }
277
- } else if (type === 'string') {
278
- if (this.splitter) {
279
- var arr = value.split(this.splitter);
280
- for (var i = 0; i < arr.length; i++) {
281
- msg = this.check_string(arr[i]);
282
- if (msg) {
283
- break;
284
- }
285
- }
286
- } else {
287
- msg = this.check_string(value);
288
- }
289
- } else if (type === 'number') {
290
- msg = this.check_number(value);
291
- }
292
- }
293
- return msg;
294
- };
295
-
296
- var Item = require('mm_machine').Item;
297
- var Check = require('mm_check');
298
-
299
- /**
300
- * @description Param参数驱动类
301
- * @extends {Item}
302
- * @class
303
- */
304
- function Drive(cg) {
305
- this.query = [];
306
- this.query_required = [];
307
- this.body = [];
308
- this.body_required = [];
309
- $.push(this, cg);
310
- }
311
-
312
- /**
313
- * @description 验证值是否符合
314
- * @param {Object} model 验证模型
315
- * @param {Object} value 被验证的值
316
- * @param {String} method 请求方式, post提交、get增、del删、set改、get查、import导入、export导出
317
- * @return {Object} 没通过返回信息,否则返回空
318
- */
319
- Drive.prototype.check_item = function(model, value, method) {
320
- var msg;
321
- if (value === undefined || value === null) {
322
- if (method.has(model.name)) {
323
- msg = this.title(model) + model.msg('required');
324
- }
325
- } else {
326
- msg = model.run(value);
327
- if (!msg) {
328
- msg = this.main(model, value);
329
- }
330
- if (msg) {
331
- return this.title(model) + msg;
332
- }
333
- }
334
- return msg;
335
- };
336
-
337
- /**
338
- * @description 获取模型
339
- * @param {String} name 名称
340
- * @return {Object} 配置模型
341
- */
342
- Drive.prototype.getModel = function(name) {
343
- var model;
344
- var lt = this.config.list;
345
- for (var i = 0; i < lt.length; i++) {
346
- var o = lt[i];
347
- if (o['name'] === name) {
348
- model = o;
349
- break;
350
- }
351
- }
352
- return model;
353
- };
354
-
355
- /**
356
- * @description 执行验证
357
- * @param {Object} params 请求参数集合
358
- * @param {Array} arr 要验证的参数名数组
359
- * @param {Array} required 必填项名称数组
360
- * @return {String} 返回验证结果
361
- */
362
- Drive.prototype.check_sub = function(params, arr, required) {
363
- var msg;
364
- for (var i = 0; i < arr.length; i++) {
365
- var k = arr[i];
366
- var o = this.getModel(k);
367
- if (o) {
368
- var value = params[k];
369
- msg = this.check_item(o, value, required);
370
- var s = o.string;
371
- if (!msg && value && s) {
372
- if (s.identical) {
373
- var val = params[s.identical];
374
- if (val !== value) {
375
- var m = this.getModel(s.identical);
376
- if (m) {
377
- msg = this.title(o) + o.msg('identical', o.title + '(' + o.name + ')', m.title + '(' + m.name +
378
- ')');
379
- } else {
380
- msg = this.title(o) + o.msg('identical', o.title + '(' + o.name + ')', s.identical);
381
- }
382
- }
383
- } else if (s.different) {
384
- var val = params[s.different];
385
- if (val === value) {
386
- var m = this.getModel(s.different);
387
- if (m) {
388
- msg = this.title(o) + o.msg('different', o.title + '(' + o.name + ')', m.title + '(' + m.name +
389
- ')');
390
- } else {
391
- msg = this.title(o) + o.msg('different', o.title + '(' + o.name + ')', s.different);
392
- }
393
- }
394
- }
395
- }
396
- if (msg) {
397
- break;
398
- }
399
- }
400
- }
401
- return msg;
402
- };
403
-
404
- /**
405
- * @description 验证参数是否符合
406
- * @param {Object} query url参数集合
407
- * @param {Object} body 正文参数集合
408
- * @param {String} method 请求方式,get增、del删、set改、get查、import导入、export导出
409
- * @return {Object} 没通过返回信息,否则返回空
410
- */
411
- Drive.prototype.check = function(query, body, method) {
412
- if (method !== 'GET') {
413
- method = method.toLowerCase();
414
- }
415
- var cg = this.config;
416
- var m = cg[method];
417
- if (!m) {
418
- var m_key = cg.method;
419
- if (m_key) {
420
- var md = query[m_key];
421
- if (md) {
422
- m = cg[md];
423
- }
424
- }
425
- if (!m) {
426
- m = cg["get"];
427
- }
428
- }
429
- var arr = m["query"];
430
- if (!arr || arr.length === 0) {
431
- arr = [];
432
- for (var k in query) {
433
- if (arr.indexOf(k) == -1) {
434
- arr.push(k);
435
- }
436
- }
437
- }
438
-
439
- var arr_query = m['query_required'] ? m['query_required'] : [];
440
- arr.addList(arr_query);
441
- var msg = this.check_sub(query, arr, arr_query);
442
- if (!msg) {
443
- var ar = m['body_not'];
444
- if (ar && body && ar.length > 0) {
445
- for (var i = 0; i < ar.length; i++) {
446
- var k = ar[i];
447
- delete body[k];
448
- }
449
- }
450
-
451
- arr = m["body"];
452
- if (!arr || arr.length === 0) {
453
- arr = [];
454
- for (var k in query) {
455
- if (arr.indexOf(k) == -1) {
456
- arr.push(k);
457
- }
458
- }
459
- }
460
- var arr_body = m['body_required'] ? m['body_required'] : [];
461
- arr.addList(arr_body);
462
- msg = this.check_sub(body, arr, arr_body);
463
- }
464
- return msg;
465
- };
466
-
467
- /**
468
- * @description 取字段
469
- * @param {Object} model 验证模型
470
- * @return {String} 返回名称
471
- */
472
- Drive.prototype.title = function(model) {
473
- if (!model.title) {
474
- return model.name + " ";
475
- } else {
476
- return model.title + "(" + model.name + ") ";
477
- }
478
- };
479
-
480
- /**
481
- * @description 验证回调函数
482
- * @param {Object} model 当前的验证模型
483
- * @param {Object} value 当前的验证值
484
- * @return {Object} 没通过返回信息,否则返回空
485
- */
486
- Drive.prototype.main = function(model, value) {
487
- return null;
488
- };
489
-
490
- })();
@@ -1,112 +0,0 @@
1
- (function(win, lib) {
2
- var doc = win.document;
3
- var docEl = doc.documentElement;
4
- var metaEl = doc.querySelector('meta[name="viewport"]');
5
- var flexibleEl = doc.querySelector('meta[name="flexible"]');
6
- var dpr = 0;
7
- var scale = 0;
8
- var tid;
9
- var flexible = lib.flexible || (lib.flexible = {});
10
-
11
- if (metaEl) {
12
- console.warn('将根据已有的meta标签来设置缩放比例');
13
- var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/);
14
- if (match) {
15
- scale = parseFloat(match[1]);
16
- dpr = parseInt(1 / scale);
17
- }
18
- } else if (flexibleEl) {
19
- var content = flexibleEl.getAttribute('content');
20
- if (content) {
21
- var initialDpr = content.match(/initial\-dpr=([\d\.]+)/);
22
- var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/);
23
- if (initialDpr) {
24
- dpr = parseFloat(initialDpr[1]);
25
- scale = parseFloat((1 / dpr).toFixed(2));
26
- }
27
- if (maximumDpr) {
28
- dpr = parseFloat(maximumDpr[1]);
29
- scale = parseFloat((1 / dpr).toFixed(2));
30
- }
31
- }
32
- }
33
- if (!dpr && !scale) {
34
- var isAndroid = win.navigator.appVersion.match(/android/gi);
35
- var isIPhone = win.navigator.appVersion.match(/iphone/gi);
36
- var devicePixelRatio = win.devicePixelRatio;
37
- if (isIPhone) {
38
- // iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案
39
- if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
40
- dpr = 3;
41
- } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){
42
- dpr = 2;
43
- } else {
44
- dpr = 1;
45
- }
46
- } else {
47
- // 其他设备下,仍旧使用1倍的方案
48
- dpr = 1;
49
- }
50
- scale = 1 / dpr;
51
- }
52
- docEl.setAttribute('data-dpr', dpr);
53
- if (!metaEl) {
54
- metaEl = doc.createElement('meta');
55
- metaEl.setAttribute('name', 'viewport');
56
- metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no');
57
- if (docEl.firstElementChild) {
58
- docEl.firstElementChild.appendChild(metaEl);
59
- } else {
60
- var wrap = doc.createElement('div');
61
- wrap.appendChild(metaEl);
62
- doc.write(wrap.innerHTML);
63
- }
64
- }
65
- function refreshRem(){
66
- var width = docEl.getBoundingClientRect().width;
67
- if (width > 415){
68
- width = 320;
69
- }
70
- else if (width / dpr > 540) {
71
- width = 540 * dpr;
72
- }
73
- var rem = width / 10 / 2;
74
- docEl.style.fontSize = rem + 'px';
75
- flexible.rem = win.rem = rem;
76
- }
77
- win.addEventListener('resize', function() {
78
- clearTimeout(tid);
79
- tid = setTimeout(refreshRem, 300);
80
- }, false);
81
- win.addEventListener('pageshow', function(e) {
82
- if (e.persisted) {
83
- clearTimeout(tid);
84
- tid = setTimeout(refreshRem, 300);
85
- }
86
- }, false);
87
- if (doc.readyState === 'complete') {
88
- doc.body.style.fontSize = 16 * dpr + 'px';
89
- } else {
90
- doc.addEventListener('DOMContentLoaded', function(e) {
91
- doc.body.style.fontSize = 16 * dpr + 'px';
92
- }, false);
93
- }
94
-
95
- refreshRem();
96
- flexible.dpr = win.dpr = dpr;
97
- flexible.refreshRem = refreshRem;
98
- flexible.rem2px = function(d) {
99
- var val = parseFloat(d) * this.rem;
100
- if (typeof d === 'string' && d.match(/rem$/)) {
101
- val += 'px';
102
- }
103
- return val;
104
- }
105
- flexible.px2rem = function(d) {
106
- var val = parseFloat(d) / this.rem;
107
- if (typeof d === 'string' && d.match(/px$/)) {
108
- val += 'rem';
109
- }
110
- return val;
111
- }
112
- })(window, window['lib'] || (window['lib'] = {}));