├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── package.json ├── public ├── babel-polyfill.v6_20_0.min.js ├── babel.min.js ├── bbg.jpg ├── fastclick.js ├── html2canvas.min.js ├── m15.png ├── onigasm.wasm ├── plupload.full.min.js ├── tinymce4.7.13 │ ├── langs │ │ └── zh_CN.js │ ├── plugins │ │ ├── codesample │ │ │ └── css │ │ │ │ └── prism.css │ │ ├── emoticons │ │ │ └── img │ │ │ │ ├── smiley-cool.gif │ │ │ │ ├── smiley-cry.gif │ │ │ │ ├── smiley-embarassed.gif │ │ │ │ ├── smiley-foot-in-mouth.gif │ │ │ │ ├── smiley-frown.gif │ │ │ │ ├── smiley-innocent.gif │ │ │ │ ├── smiley-kiss.gif │ │ │ │ ├── smiley-laughing.gif │ │ │ │ ├── smiley-money-mouth.gif │ │ │ │ ├── smiley-sealed.gif │ │ │ │ ├── smiley-smile.gif │ │ │ │ ├── smiley-surprised.gif │ │ │ │ ├── smiley-tongue-out.gif │ │ │ │ ├── smiley-undecided.gif │ │ │ │ ├── smiley-wink.gif │ │ │ │ └── smiley-yell.gif │ │ ├── help │ │ │ └── img │ │ │ │ └── logo.png │ │ └── visualblocks │ │ │ └── css │ │ │ └── visualblocks.css │ ├── skins │ │ └── lightgray │ │ │ ├── content.inline.min.css │ │ │ ├── content.min.css │ │ │ ├── content.mobile.min.css │ │ │ ├── fonts │ │ │ ├── tinymce-mobile.woff │ │ │ ├── tinymce-small.eot │ │ │ ├── tinymce-small.svg │ │ │ ├── tinymce-small.ttf │ │ │ ├── tinymce-small.woff │ │ │ ├── tinymce.eot │ │ │ ├── tinymce.svg │ │ │ ├── tinymce.ttf │ │ │ └── tinymce.woff │ │ │ ├── img │ │ │ ├── anchor.gif │ │ │ ├── loader.gif │ │ │ ├── object.gif │ │ │ └── trans.gif │ │ │ ├── skin.min.css │ │ │ ├── skin.min.css.map │ │ │ ├── skin.mobile.min.css │ │ │ └── skin.mobile.min.css.map │ └── tinymce.min.js ├── vue-router.v2_0_1.min.js ├── vue.runtime.v2_6_11.min.js └── vuex.v2_0_0.min.js ├── src ├── .DS_Store ├── Client.vue ├── Editor.vue ├── assets │ ├── data │ │ ├── empty.json │ │ └── script.json │ ├── image │ │ ├── bgblank.svg │ │ ├── cursor.svg │ │ ├── iphone-8.png │ │ ├── iphone-x.png │ │ └── ruler.png │ ├── images │ │ ├── dingding.jpg │ │ └── logo.png │ ├── js │ │ ├── common.js │ │ ├── date.js │ │ ├── dom.js │ │ ├── singleton-ema.js │ │ └── vuelint.js │ ├── layout │ │ ├── default.json │ │ ├── desktop.json │ │ ├── develop.json │ │ └── flutter.json │ └── style │ │ ├── animate.min.css │ │ ├── base.styl │ │ ├── cropper.css │ │ ├── custome-animate.css │ │ ├── element-variables.scss │ │ ├── m-1px.styl │ │ └── markdown.css ├── client.js ├── client.tpl ├── components │ ├── AssetsTags.vue │ ├── AssistLines.vue │ ├── ContextMenu.vue │ ├── Dialogs.vue │ ├── Header.vue │ ├── Node.vue │ ├── PerviewNode.vue │ ├── Selecter.vue │ ├── SliderTool.vue │ ├── Tips.vue │ ├── UploadImage.vue │ ├── attr │ │ ├── Data.vue │ │ ├── Event.vue │ │ ├── Function.vue │ │ ├── Resource.vue │ │ ├── RichText.vue │ │ └── index.js │ ├── bughd.vue │ ├── client │ │ ├── FitImg.vue │ │ ├── ImgViewer.vue │ │ ├── Loading.vue │ │ ├── Page.vue │ │ └── Toast.vue │ ├── code │ │ ├── index.vue │ │ ├── textmate │ │ │ ├── index.js │ │ │ ├── javascripttm.json │ │ │ ├── loadwasm.js │ │ │ └── monaco-theme-registry.js │ │ └── theme │ │ │ ├── OneMonokai-color-theme.json │ │ │ ├── dark_defaults.json │ │ │ ├── dark_plus.json │ │ │ ├── dark_vs.json │ │ │ ├── light_defaults.json │ │ │ ├── light_plus.json │ │ │ ├── light_vs.json │ │ │ └── sublime.json │ ├── dock │ │ ├── BasePanel.js │ │ ├── Dialog.vue │ │ ├── Main.vue │ │ ├── Panel.vue │ │ ├── Resizer.vue │ │ └── index.vue │ ├── style │ │ ├── Advanced.vue │ │ ├── Align.vue │ │ ├── Background.vue │ │ ├── Base.vue │ │ ├── Border.vue │ │ ├── ColorPicker.vue │ │ ├── Flutter.vue │ │ ├── Layout.vue │ │ ├── Num.vue │ │ ├── Position.vue │ │ ├── Radius.vue │ │ ├── Size.vue │ │ ├── Text.vue │ │ └── index.vue │ └── widget │ │ ├── Attribute.vue │ │ ├── CodePanel.vue │ │ ├── CombinedComponents.vue │ │ ├── ComponentInfo.vue │ │ ├── ComponentTree.vue │ │ ├── Components.vue │ │ ├── PageInfo.vue │ │ ├── PageTemplate.vue │ │ ├── Scene.vue │ │ ├── ScriptEditor.vue │ │ ├── Shop.vue │ │ ├── animate │ │ ├── AnimatePicker.vue │ │ ├── Cell.vue │ │ ├── LayerNode.vue │ │ ├── TimeLineNode.vue │ │ └── index.vue │ │ └── index.js ├── config │ ├── default.js │ ├── index.js │ ├── local.js │ └── production.js ├── dialog │ ├── d-Preview.vue │ ├── d-crop.vue │ ├── d-editScript.vue │ ├── d-nodejson.vue │ ├── d-psd.vue │ ├── d-resourceSelect.vue │ └── d-saveCombinedComponent.vue ├── editor.js ├── editor.tpl ├── extend │ ├── BaseComponent.js │ ├── BaseDialog.js │ ├── BaseNode.js │ ├── BasePage.js │ ├── ESlog.js │ ├── HistoryCache.js │ ├── RouterMap.js │ ├── Server.js │ ├── UploadImg.js │ ├── Util.js │ ├── client │ │ ├── filters.js │ │ ├── index.js │ │ └── mixin.js │ ├── componentLoader.js │ ├── emitter.js │ ├── fetch.js │ └── filter.js ├── store │ ├── actions.js │ ├── getters.js │ ├── index.js │ ├── metadata.js │ └── mutations.js └── transitions │ └── collapse-transition.js ├── tsconfig.json ├── vue.config.js └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | src/assets/**/*.js 2 | public/ -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | parser: "babel-eslint", 5 | sourceType: 'module', 6 | allowImportExportEverywhere: true 7 | }, 8 | env: { 9 | browser: true, 10 | node: true 11 | }, 12 | extends: [ 13 | 'plugin:vue/essential', 14 | 'standard' 15 | ], 16 | plugins: [ 17 | 'vue' 18 | ], 19 | 'rules': { 20 | "eol-last": 0, 21 | "vue/no-async-in-computed-properties": 0, 22 | "vue/no-side-effects-in-computed-properties": 0, 23 | "vue/no-side-effects-in-computed-properties": 0, 24 | "vue/valid-v-for": 0, 25 | "no-multiple-empty-lines": 0, 26 | "space-before-function-paren": 0, 27 | "no-return-await": 0, 28 | "vue/no-unused-vars": 0, 29 | "object-curly-spacing": 0, 30 | "no-proto": 0, 31 | "no-new": 0, 32 | "no-extra-boolean-cast": 0, 33 | "no-mixed-operators": 0, 34 | "no-eval": 0, 35 | // allow paren-less arrow functions 36 | 'arrow-parens': 0, 37 | 'no-useless-escape': 0, 38 | 'no-sparse-arrays': 0, 39 | // no-fallthrough 40 | 'no-fallthrough': 0, 41 | // allow debugger during development 42 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 43 | "eqeqeq": 0, //必须使用全等 44 | "no-extend-native": 0, 45 | "no-multi-spaces": 0, 46 | "indent": 0, 47 | "comma-dangle": [2, "only-multiline"] //定义数组或对象最后多余的逗号 48 | } 49 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .cache 3 | .DS_Store 4 | .vscode/ 5 | .idea/ 6 | node_modules/ 7 | dist/ 8 | npm-debug.log 9 | npm-debug.log.* 10 | selenium-debug.log 11 | test/unit/coverage 12 | test/e2e/reports 13 | converage/ 14 | ymm_build/ 15 | yarn-error.log 16 | distzip/ 17 | src/config/docker.js 18 | verify.md 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Full Truck Alliance 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | comments: true, 3 | presets: [ 4 | ['@vue/app', {useBuiltIns: false}] 5 | ], 6 | plugins: [ 7 | [ 8 | 'import', { 9 | libraryName: "mint-ui", 10 | style: (name) => `${name}/style.css`, 11 | } 12 | ] 13 | ], 14 | } 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gods-pen", 3 | "version": "1.0.0", 4 | "description": "gods-pen", 5 | "Copyright": "", 6 | "private": false, 7 | "keywords": [], 8 | "scripts": { 9 | "start": "npm run editor:dev & npm run client:dev", 10 | "editor:dev": "cross-env CODE_ENV=local PAGE=EDITOR vue-cli-service serve", 11 | "client:dev": "cross-env CODE_ENV=local PAGE=CLIENT vue-cli-service serve", 12 | "editor:build": "cross-env CODE_ENV=production PAGE=EDITOR vue-cli-service build", 13 | "client:build": "cross-env CODE_ENV=production PAGE=CLIENT vue-cli-service build", 14 | "editor:build-docker": "cross-env CODE_ENV=docker PAGE=EDITOR vue-cli-service build", 15 | "client:build-docker": "cross-env CODE_ENV=docker PAGE=CLIENT vue-cli-service build" 16 | }, 17 | "license": "ISC", 18 | "dependencies": { 19 | "@types/node": "^10.12.3", 20 | "axios": "^0.18.0", 21 | "babel-polyfill": "*", 22 | "caniuse-lite": "^1.0.0", 23 | "clipboard": "^2.0.0", 24 | "cropperjs": "^1.5.6", 25 | "element-ui": "2.4.11", 26 | "inversify": "^5.0.1", 27 | "js-cookie": "^2.2.0", 28 | "loader-utils": "^1.1.0", 29 | "lodash": "^4.17.4", 30 | "marked": "^0.4.0", 31 | "mint-ui": "2.2.0", 32 | "monaco-editor": "0.15.2", 33 | "monaco-editor-webpack-plugin": "1.5.3", 34 | "onigasm": "^2.2.1", 35 | "oniguruma": "7.0.1", 36 | "qrcode": "^1.4.4", 37 | "rider": "^2.0.0", 38 | "vscode-textmate": "^4.0.1", 39 | "vue": "2.6.11", 40 | "vue-router": "2.4.0", 41 | "vuex": "^2.0.0" 42 | }, 43 | "devDependencies": { 44 | "@vue/cli-plugin-babel": "^3.1.1", 45 | "@vue/cli-plugin-eslint": "^3.1.1", 46 | "@vue/cli-service": "^3.1.1", 47 | "babel-eslint": "^10.0.1", 48 | "babel-plugin-import": "1.11.0", 49 | "cross-env": "^5.2.0", 50 | "dotenv-webpack": "^1.5.7", 51 | "eslint": "5.8.0", 52 | "eslint-config-standard": "^12.0.0", 53 | "eslint-plugin-import": "^2.14.0", 54 | "eslint-plugin-node": "^8.0.0", 55 | "eslint-plugin-promise": "^4.0.1", 56 | "eslint-plugin-standard": "^4.0.0", 57 | "eslint-plugin-vue": "^5.0.0-0", 58 | "node-sass": "^4.10.0", 59 | "sass-loader": "^7.1.0", 60 | "stylus": "^0.54.5", 61 | "stylus-loader": "^3.0.2", 62 | "ts-loader": "^5.3.0", 63 | "typescript": "^3.1.6", 64 | "vue-template-compiler": "2.6.11" 65 | }, 66 | "postcss": { 67 | "plugins": { 68 | "autoprefixer": {} 69 | } 70 | }, 71 | "browserslist": [ 72 | "> 1%", 73 | "last 2 versions", 74 | "not ie <= 8" 75 | ] 76 | } 77 | -------------------------------------------------------------------------------- /public/bbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/bbg.jpg -------------------------------------------------------------------------------- /public/m15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/m15.png -------------------------------------------------------------------------------- /public/onigasm.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/onigasm.wasm -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/codesample/css/prism.css: -------------------------------------------------------------------------------- 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ 2 | /** 3 | * prism.js default theme for JavaScript, CSS and HTML 4 | * Based on dabblet (http://dabblet.com) 5 | * @author Lea Verou 6 | */ 7 | 8 | code[class*="language-"], 9 | pre[class*="language-"] { 10 | color: black; 11 | text-shadow: 0 1px white; 12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 13 | direction: ltr; 14 | text-align: left; 15 | white-space: pre; 16 | word-spacing: normal; 17 | word-break: normal; 18 | word-wrap: normal; 19 | line-height: 1.5; 20 | 21 | -moz-tab-size: 4; 22 | -o-tab-size: 4; 23 | tab-size: 4; 24 | 25 | -webkit-hyphens: none; 26 | -moz-hyphens: none; 27 | -ms-hyphens: none; 28 | hyphens: none; 29 | } 30 | 31 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 32 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 33 | text-shadow: none; 34 | background: #b3d4fc; 35 | } 36 | 37 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 38 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 39 | text-shadow: none; 40 | background: #b3d4fc; 41 | } 42 | 43 | @media print { 44 | code[class*="language-"], 45 | pre[class*="language-"] { 46 | text-shadow: none; 47 | } 48 | } 49 | 50 | /* Code blocks */ 51 | pre[class*="language-"] { 52 | padding: 1em; 53 | margin: .5em 0; 54 | overflow: auto; 55 | } 56 | 57 | :not(pre) > code[class*="language-"], 58 | pre[class*="language-"] { 59 | background: #f5f2f0; 60 | } 61 | 62 | /* Inline code */ 63 | :not(pre) > code[class*="language-"] { 64 | padding: .1em; 65 | border-radius: .3em; 66 | } 67 | 68 | .token.comment, 69 | .token.prolog, 70 | .token.doctype, 71 | .token.cdata { 72 | color: slategray; 73 | } 74 | 75 | .token.punctuation { 76 | color: #999; 77 | } 78 | 79 | .namespace { 80 | opacity: .7; 81 | } 82 | 83 | .token.property, 84 | .token.tag, 85 | .token.boolean, 86 | .token.number, 87 | .token.constant, 88 | .token.symbol, 89 | .token.deleted { 90 | color: #905; 91 | } 92 | 93 | .token.selector, 94 | .token.attr-name, 95 | .token.string, 96 | .token.char, 97 | .token.builtin, 98 | .token.inserted { 99 | color: #690; 100 | } 101 | 102 | .token.operator, 103 | .token.entity, 104 | .token.url, 105 | .language-css .token.string, 106 | .style .token.string { 107 | color: #a67f59; 108 | background: hsla(0, 0%, 100%, .5); 109 | } 110 | 111 | .token.atrule, 112 | .token.attr-value, 113 | .token.keyword { 114 | color: #07a; 115 | } 116 | 117 | .token.function { 118 | color: #DD4A68; 119 | } 120 | 121 | .token.regex, 122 | .token.important, 123 | .token.variable { 124 | color: #e90; 125 | } 126 | 127 | .token.important, 128 | .token.bold { 129 | font-weight: bold; 130 | } 131 | .token.italic { 132 | font-style: italic; 133 | } 134 | 135 | .token.entity { 136 | cursor: help; 137 | } 138 | 139 | -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-cool.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-cool.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-cry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-cry.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-embarassed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-embarassed.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-foot-in-mouth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-foot-in-mouth.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-frown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-frown.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-innocent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-innocent.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-kiss.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-kiss.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-laughing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-laughing.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-money-mouth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-money-mouth.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-sealed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-sealed.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-smile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-smile.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-surprised.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-surprised.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-tongue-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-tongue-out.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-undecided.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-undecided.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-wink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-wink.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/emoticons/img/smiley-yell.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/emoticons/img/smiley-yell.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/plugins/help/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/plugins/help/img/logo.png -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/content.inline.min.css: -------------------------------------------------------------------------------- 1 | .word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body.mce-content-readonly *[contentEditable=true]:focus,.mce-content-body.mce-content-readonly *[contentEditable=true]:hover{outline:none}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.mce-content-body table{-webkit-nbsp-mode:normal}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2}.mce-content-body{line-height:1.3} -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/content.min.css: -------------------------------------------------------------------------------- 1 | body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body.mce-content-readonly *[contentEditable=true]:focus,.mce-content-body.mce-content-readonly *[contentEditable=true]:hover{outline:none}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.mce-content-body table{-webkit-nbsp-mode:normal}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2} -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/content.mobile.min.css: -------------------------------------------------------------------------------- 1 | .tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{position:absolute;display:inline-block;background-color:green;opacity:.5}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%} -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce-mobile.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce-mobile.woff -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.eot -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.ttf -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce-small.woff -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce.eot -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce.ttf -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/fonts/tinymce.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/fonts/tinymce.woff -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/img/anchor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/img/anchor.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/img/loader.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/img/object.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/img/object.gif -------------------------------------------------------------------------------- /public/tinymce4.7.13/skins/lightgray/img/trans.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/public/tinymce4.7.13/skins/lightgray/img/trans.gif -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/.DS_Store -------------------------------------------------------------------------------- /src/Client.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 95 | 96 | 120 | -------------------------------------------------------------------------------- /src/assets/data/empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "root", 3 | "type": "truck/emptyContainer", 4 | "visible": true, 5 | "style": { 6 | "background-color": "rgba(255,255,255,1)", 7 | "min-height": "100%", 8 | "height": "auto", 9 | "width": "100%", 10 | "position": "absolute" 11 | }, 12 | "props": {}, 13 | "child": [{ 14 | "id": "truck/richtextj0n4g65h", 15 | "type": "truck/richtext", 16 | "label": "初次见面,请移除我", 17 | "visible": true, 18 | "path": "https://ymm-maliang.oss-cn-hangzhou.aliyuncs.com/truck/richtext/1.1.5/index.js", 19 | "style": { 20 | "position": "absolute", 21 | "width": "219px", 22 | "height": "80px", 23 | "left": "62.203125px", 24 | "top": "201.5px", 25 | "background-image": "", 26 | "right": "", 27 | "bottom": "" 28 | }, 29 | "animate": [], 30 | "props": { 31 | "text": "

Hi, there

" 32 | }, 33 | "script": [], 34 | "version": "1.1.5", 35 | "events": [], 36 | "url": "https://ymm-maliang.oss-cn-hangzhou.aliyuncs.com/truck/richtext/1.1.5/index.js" 37 | }], 38 | "script": [], 39 | "animate": [], 40 | "version": "1.0.2", 41 | "path": "https://ymm-maliang.oss-cn-hangzhou.aliyuncs.com/truck/emptyContainer/1.0.2/index.js", 42 | "events": [], 43 | "label": "root" 44 | } -------------------------------------------------------------------------------- /src/assets/data/script.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "name": "内部页面跳转", 3 | "content": "var node = {\n editorMethods: {\n projectJump: {\n label: '内部跳转',\n params: [{\n label: '跳转地址',\n desc: '项目相对地址',\n type: 'string',\n default: ''\n },{\n label: '参数',\n desc: 'query形式参数',\n type: 'object',\n default: {}\n }]\n }\n },\n methods:{\n projectJump:function(path,query){\n console.log(path,query)\n this.$router.push({\n path:path,\n query:query\n })\n }\n }\n}\nreturn node" 4 | }] -------------------------------------------------------------------------------- /src/assets/image/bgblank.svg: -------------------------------------------------------------------------------- 1 | 2 | 分组 34 3 | Created with Sketch. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
-------------------------------------------------------------------------------- /src/assets/image/cursor.svg: -------------------------------------------------------------------------------- 1 | yo -------------------------------------------------------------------------------- /src/assets/image/iphone-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/assets/image/iphone-8.png -------------------------------------------------------------------------------- /src/assets/image/iphone-x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/assets/image/iphone-x.png -------------------------------------------------------------------------------- /src/assets/image/ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/assets/image/ruler.png -------------------------------------------------------------------------------- /src/assets/images/dingding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/assets/images/dingding.jpg -------------------------------------------------------------------------------- /src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ymm-tech/gods-pen/c1c18ada8ff046b54f33030ebdabd92812eb2d11/src/assets/images/logo.png -------------------------------------------------------------------------------- /src/assets/js/date.js: -------------------------------------------------------------------------------- 1 | Date.prototype.Format = function (fmt) { // author: meizz 2 | var o = { 3 | 'M+': this.getMonth() + 1, // 月份 4 | 'd+': this.getDate(), // 日 5 | 'h+': this.getHours(), // 小时 6 | 'm+': this.getMinutes(), // 分 7 | 's+': this.getSeconds(), // 秒 8 | 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 9 | 'S': this.getMilliseconds() // 毫秒 10 | } 11 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) 12 | for (var k in o) { 13 | if (new RegExp('(' + k + ')').test(fmt)) { 14 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) 15 | } 16 | } 17 | return fmt 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/assets/js/singleton-ema.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 事件管理器。负责页面和页面,组件和组件之间事件通知管理 3 | * */ 4 | var EventManager = function(){ 5 | 6 | var manager = { 7 | bind: function(type, fn) { 8 | if(type && typeof type === "string" && fn && fn.constructor && typeof fn === "function"){ 9 | 10 | var handlers = this.events[type]; 11 | if (!handlers) { 12 | handlers = this.events[type] = []; 13 | } 14 | 15 | var i = handlers.length; 16 | while(i--) { 17 | if(handlers[i] == fn) { 18 | return false; 19 | } 20 | } 21 | handlers.push(fn); 22 | return true; 23 | } 24 | return false; 25 | }, 26 | unbind: function(type, fn) { 27 | 28 | if(type && type.constructor && type.constructor == String) { 29 | 30 | if(!fn) { 31 | delete this.events[type]; 32 | return true; 33 | }else if(fn && typeof fn === "function"){ 34 | var handlers = this.events[type]; 35 | if(handlers && handlers.length) { 36 | var i = handlers.length; 37 | while(i--) { 38 | if(handlers[i] == fn) { 39 | handlers.splice(i,1); 40 | break; 41 | } 42 | } 43 | return true; 44 | } 45 | return false; 46 | } 47 | } 48 | return false; 49 | }, 50 | clear:function(){ 51 | var me = this; 52 | this.events = []; 53 | }, 54 | fire: function(type) { 55 | var handlers; 56 | if(type && typeof type === "string" && (handlers = this.events[type]) && handlers.length){ 57 | var fn; 58 | var argsArray = Array.prototype.slice.call(arguments,1); 59 | var i=0; 60 | while ((fn = handlers[i++])) { 61 | fn.apply(window, argsArray); 62 | } 63 | return true; 64 | } 65 | return false; 66 | }, 67 | count: function(type) { 68 | var handlers = this.events[type]; 69 | return handlers ? handlers.length : 0; 70 | }, 71 | getProxy: function() { 72 | return new DisposeableEventManagerProxy(this); 73 | } 74 | } 75 | manager.events = []; 76 | return manager 77 | }; 78 | function DisposeableEventManagerProxy(msgslot) { 79 | this.msgslot = msgslot; 80 | this.msgs = []; 81 | var fire = msgslot.fire; 82 | var async = msgslot.async; 83 | this.fire = function(){fire.apply(msgslot, arguments)}; 84 | this.async = function(){async.apply(msgslot, arguments)}; 85 | } 86 | DisposeableEventManagerProxy.prototype = { 87 | bind: function(type, fn) { 88 | var result = this.msgslot.bind(type, fn); 89 | if(result) { 90 | this.msgs.push([type,fn]); 91 | } 92 | return result; 93 | }, 94 | unbind: function(type, fn) { 95 | var msgslot = this.msgslot; 96 | var msgs = this.msgs; 97 | 98 | if(fn && typeof fn === "function") { 99 | var result = msgslot.unbind(type, fn); 100 | var i = msgs.length; 101 | while(--i >= 0){ 102 | if(msgs[i][0] == type && msgs[i][1] == fn) { 103 | msgs.splice(i,1); 104 | } 105 | } 106 | return result; 107 | } 108 | else{ 109 | var i = this.msgs.length; 110 | while(i--){ 111 | if(msgs[i][0] == type) { 112 | msgslot.unbind(type, msgs[i][1]) 113 | msgs.splice(i,1); 114 | } 115 | } 116 | return true; 117 | } 118 | }, 119 | dispose: function() { 120 | if(this.msgs == null) return; 121 | var msgs = this.msgs; 122 | var msgslot = this.msgslot; 123 | var i = msgs.length; 124 | while(i--){ 125 | msgslot.unbind(msgs[i][0], msgs[i][1]); 126 | } 127 | this.msgslot = null; 128 | this.msgs = null; 129 | } 130 | }; 131 | module.exports = EventManager(); -------------------------------------------------------------------------------- /src/assets/js/vuelint.js: -------------------------------------------------------------------------------- 1 | const lint = [{ 2 | label: 'silent' 3 | }, 4 | { 5 | label: 'optionMergeStrategies' 6 | }, 7 | { 8 | label: 'devtools' 9 | }, 10 | { 11 | label: 'errorHandler' 12 | }, 13 | { 14 | label: 'warnHandler' 15 | }, 16 | { 17 | label: 'ignoredElements' 18 | }, 19 | { 20 | label: 'keyCodes' 21 | }, 22 | { 23 | label: 'performance' 24 | }, 25 | { 26 | label: 'productionTip' 27 | }, 28 | { 29 | label: 'extend' 30 | }, 31 | { 32 | label: 'nextTick' 33 | }, 34 | { 35 | label: 'set' 36 | }, 37 | { 38 | label: 'delete' 39 | }, 40 | { 41 | label: 'directive' 42 | }, 43 | { 44 | label: 'filter' 45 | }, 46 | { 47 | label: 'component' 48 | }, 49 | { 50 | label: 'use' 51 | }, 52 | { 53 | label: 'mixin' 54 | }, 55 | { 56 | label: 'compile' 57 | }, 58 | { 59 | label: 'version' 60 | }, 61 | { 62 | label: 'data' 63 | }, 64 | { 65 | label: 'props' 66 | }, 67 | { 68 | label: 'propsData' 69 | }, 70 | { 71 | label: 'computed' 72 | }, 73 | { 74 | label: 'methods' 75 | }, 76 | { 77 | label: 'watch' 78 | }, 79 | { 80 | label: 'el' 81 | }, 82 | { 83 | label: 'template' 84 | }, 85 | { 86 | label: 'render' 87 | }, 88 | { 89 | label: 'renderError' 90 | }, 91 | { 92 | label: 'beforeCreate' 93 | }, 94 | { 95 | label: 'created' 96 | }, 97 | { 98 | label: 'beforeMount' 99 | }, 100 | { 101 | label: 'mounted' 102 | }, 103 | { 104 | label: 'beforeUpdate' 105 | }, 106 | { 107 | label: 'updated' 108 | }, 109 | { 110 | label: 'activated' 111 | }, 112 | { 113 | label: 'deactivated' 114 | }, 115 | { 116 | label: 'beforeDestroy' 117 | }, 118 | { 119 | label: 'destroyed' 120 | }, 121 | { 122 | label: 'directives' 123 | }, 124 | { 125 | label: 'filters' 126 | }, 127 | { 128 | label: 'components' 129 | }, 130 | { 131 | label: 'parent' 132 | }, 133 | { 134 | label: 'mixins' 135 | }, 136 | { 137 | label: 'extends' 138 | }, 139 | { 140 | label: 'provide' 141 | }, 142 | { 143 | label: 'inject' 144 | }, 145 | { 146 | label: 'name' 147 | }, 148 | { 149 | label: 'delimiters' 150 | }, 151 | { 152 | label: 'functional' 153 | }, 154 | { 155 | label: 'model' 156 | }, 157 | { 158 | label: 'inheritAttrs' 159 | }, 160 | { 161 | label: 'comments' 162 | }, 163 | { 164 | label: '$data' 165 | }, 166 | { 167 | label: '$props' 168 | }, 169 | { 170 | label: '$el' 171 | }, 172 | { 173 | label: '$options' 174 | }, 175 | { 176 | label: '$parent' 177 | }, 178 | { 179 | label: '$root' 180 | }, 181 | { 182 | label: '$children' 183 | }, 184 | { 185 | label: '$slots' 186 | }, 187 | { 188 | label: '$scopedSlots' 189 | }, 190 | { 191 | label: '$refs' 192 | }, 193 | { 194 | label: '$isServer' 195 | }, 196 | { 197 | label: '$attrs' 198 | }, 199 | { 200 | label: '$listeners' 201 | }, 202 | { 203 | label: '$watch' 204 | }, 205 | { 206 | label: '$set' 207 | }, 208 | { 209 | label: '$delete' 210 | }, 211 | { 212 | label: '$on' 213 | }, 214 | { 215 | label: '$once' 216 | }, 217 | { 218 | label: '$off' 219 | }, 220 | { 221 | label: '$emit' 222 | }, 223 | { 224 | label: '$mount' 225 | }, 226 | { 227 | label: '$forceUpdate' 228 | }, 229 | { 230 | label: '$nextTick' 231 | }, 232 | { 233 | label: '$destroy' 234 | }, 235 | { 236 | label: 'v-text' 237 | }, 238 | { 239 | label: 'v-html' 240 | }, 241 | { 242 | label: 'v-show' 243 | }, 244 | { 245 | label: 'v-if' 246 | }, 247 | { 248 | label: 'v-else' 249 | }, 250 | { 251 | label: 'v-else-if' 252 | }, 253 | { 254 | label: 'v-for' 255 | }, 256 | { 257 | label: 'v-on' 258 | }, 259 | { 260 | label: 'v-bind' 261 | }, 262 | { 263 | label: 'v-model' 264 | }, 265 | { 266 | label: 'v-pre' 267 | }, 268 | { 269 | label: 'v-cloak' 270 | }, 271 | { 272 | label: 'v-once' 273 | }, 274 | { 275 | label: 'key' 276 | }, 277 | { 278 | label: 'ref' 279 | }, 280 | { 281 | label: 'slot' 282 | }, 283 | { 284 | label: 'is' 285 | }, 286 | { 287 | label: 'component' 288 | }, 289 | { 290 | label: 'transition' 291 | }, 292 | { 293 | label: 'transition-group' 294 | }, 295 | { 296 | label: 'keep-alive' 297 | }, 298 | { 299 | label: 'slot' 300 | }, 301 | { 302 | label: 'immediate' 303 | }, 304 | { 305 | label: 'handler' 306 | }, 307 | { 308 | label: 'editorMethods' 309 | }, 310 | { 311 | label: 'params' 312 | }, 313 | { 314 | label: 'desc' 315 | }, 316 | ] 317 | 318 | export default lint 319 | -------------------------------------------------------------------------------- /src/assets/layout/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout": { 3 | "children": [ 4 | { 5 | "children": [ 6 | { 7 | "children": [ 8 | { 9 | "name": "组件列表", 10 | "component": "widgetComponent", 11 | "close": true, 12 | "pop": true 13 | }, 14 | { 15 | "name": "组合组件", 16 | "component": "widgetCombinedComponents", 17 | "close": true, 18 | "pop": true 19 | } 20 | ], 21 | "type": "panel", 22 | "flex": 0.5 23 | }, 24 | { 25 | "children": [ 26 | { 27 | "name": "组件树", 28 | "component": "widgetComponentTree", 29 | "close": true, 30 | "pop": true 31 | }, 32 | { 33 | "name": "页面模板", 34 | "component": "widgetPageTemplate" 35 | } 36 | ], 37 | "type": "panel", 38 | "flex": 0.5 39 | } 40 | ], 41 | "type": "column", 42 | "flex": 0.20626959247648904 43 | }, 44 | { 45 | "children": [ 46 | { 47 | "children": [ 48 | { 49 | "name": "场景", 50 | "component": "widgetScene", 51 | "close": false, 52 | "pop": false 53 | }, 54 | { 55 | "name": "组件详情", 56 | "component": "widgetComponentInfo", 57 | "close": true, 58 | "pop": true 59 | }, 60 | { 61 | "name": "页面设置", 62 | "component": "widgetPageInfo", 63 | "close": true, 64 | "pop": true 65 | }, 66 | { 67 | "name": "商城", 68 | "component": "widgetShop", 69 | "close": true, 70 | "pop": true 71 | } 72 | ], 73 | "type": "panel", 74 | "flex": 0.9 75 | }, 76 | { 77 | "children": [ 78 | { 79 | "name": "动画", 80 | "component": "widgetAnimate", 81 | "close": true, 82 | "pop": true 83 | } 84 | ], 85 | "type": "panel", 86 | "flex": 0.1 87 | } 88 | ], 89 | "type": "column", 90 | "flex": 0.5512481056767048 91 | }, 92 | { 93 | "children": [ 94 | { 95 | "children": [ 96 | { 97 | "name": "属性", 98 | "component": "widgetAttribute", 99 | "close": false, 100 | "pop": true 101 | }, 102 | { 103 | "name": "样式", 104 | "component": "widgetStyleEditor", 105 | "close": false, 106 | "pop": true 107 | } 108 | ], 109 | "type": "panel", 110 | "flex": 0.7888643880926131 111 | }, 112 | { 113 | "children": [ 114 | { 115 | "name": "脚本", 116 | "component": "widgetScriptEditor", 117 | "close": true, 118 | "style": { 119 | "width": "300px", 120 | "height": "400px", 121 | "left": "300px", 122 | "top": "300px" 123 | }, 124 | "pop": true 125 | } 126 | ], 127 | "type": "panel", 128 | "flex": 0.211135611907387 129 | } 130 | ], 131 | "type": "column", 132 | "flex": 0.2424823018468062 133 | } 134 | ], 135 | "type": "row" 136 | }, 137 | "dialogs": [], 138 | "version": 1.3, 139 | "name": "default" 140 | } -------------------------------------------------------------------------------- /src/assets/layout/desktop.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout": { 3 | "children": [{ 4 | "children": [{ 5 | "children": [{ 6 | "name": "组场景", 7 | "component": "widgetScene", 8 | "close": false, 9 | "pop": false 10 | }, { 11 | "name": "脚本编辑", 12 | "component": "widgetCodePanel", 13 | "style": { 14 | "width": "300px", 15 | "height": "400px", 16 | "left": "441px", 17 | "top": "121px" 18 | }, 19 | "close": true, 20 | "pop": true 21 | }, { 22 | "name": "组件详情", 23 | "component": "widgetComponentInfo", 24 | "close": true, 25 | "pop": true, 26 | "style": { 27 | "width": "1820px", 28 | "height": "878px", 29 | "left": "3px", 30 | "top": "344px" 31 | } 32 | }], 33 | "type": "panel", 34 | "flex": 0.85 35 | }, { 36 | "children": [{ 37 | "name": "动画", 38 | "component": "widgetAnimate", 39 | "close": true, 40 | "pop": true, 41 | "style": { 42 | "width": "360px", 43 | "height": "400px", 44 | "left": "1920px", 45 | "top": "480px" 46 | } 47 | }], 48 | "type": "panel", 49 | "flex": 0.15 50 | }], 51 | "type": "column", 52 | "flex": 1 53 | }], 54 | "type": "row" 55 | }, 56 | "dialogs": [{ 57 | "children": [{ 58 | "children": [{ 59 | "name": "组件列表", 60 | "component": "widgetComponent", 61 | "close": true, 62 | "pop": true, 63 | "style": { 64 | "width": "360px", 65 | "height": "434.5px", 66 | "left": "100px", 67 | "top": "97px" 68 | } 69 | }, { 70 | "name": "合成组件", 71 | "component": "widgetCombinedComponents", 72 | "close": true, 73 | "pop": true, 74 | "style": { 75 | "width": "360px", 76 | "height": "434.5px", 77 | "left": "215px", 78 | "top": "135px" 79 | } 80 | }, { 81 | "name": "页面模板", 82 | "component": "widgetPageTemplate" 83 | }], 84 | "type": "panel", 85 | "flex": 1 86 | }], 87 | "type": "column", 88 | "flex": "1", 89 | "style": { 90 | "width": "360px", 91 | "height": "878px", 92 | "left": "-360px", 93 | "top": "75px" 94 | } 95 | }, { 96 | "name": "属性", 97 | "component": "widgetAttribute", 98 | "close": false, 99 | "pop": true, 100 | "style": { 101 | "width": "360px", 102 | "height": "685.515625px", 103 | "left": "1920px", 104 | "top": "75px" 105 | } 106 | }, { 107 | "name": "样式", 108 | "component": "widgetStyleEditor", 109 | "close": false, 110 | "pop": true, 111 | "style": { 112 | "width": "360px", 113 | "height": "685.515625px", 114 | "left": "1920px", 115 | "top": "210px" 116 | } 117 | }, { 118 | "name": "脚本", 119 | "component": "widgetScriptEditor", 120 | "style": { 121 | "width": "364px", 122 | "height": "406px", 123 | "left": "1920px", 124 | "top": "345px" 125 | }, 126 | "close": true, 127 | "pop": true 128 | }, { 129 | "name": "组件树", 130 | "component": "widgetComponentTree", 131 | "close": true, 132 | "pop": true, 133 | "style": { 134 | "width": "355px", 135 | "height": "741px", 136 | "left": "-353px", 137 | "top": "210px" 138 | } 139 | }, { 140 | "name": "页面设置", 141 | "component": "widgetPageInfo", 142 | "close": true, 143 | "pop": true, 144 | "style": { 145 | "width": "361px", 146 | "height": "600px", 147 | "left": "-361px", 148 | "top": "345px" 149 | } 150 | }], 151 | "version": 1, 152 | "name": "desktop" 153 | } -------------------------------------------------------------------------------- /src/assets/layout/develop.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout": { 3 | "children": [ 4 | { 5 | "children": [ 6 | { 7 | "children": [ 8 | { 9 | "name": "组件树", 10 | "component": "widgetComponentTree", 11 | "close": true, 12 | "pop": true 13 | } 14 | ], 15 | "type": "panel", 16 | "flex": 0.5371845949535192 17 | }, 18 | { 19 | "children": [ 20 | { 21 | "children": [ 22 | { 23 | "name": "脚本", 24 | "component": "widgetScriptEditor", 25 | "style": { 26 | "width": "300px", 27 | "height": "400px", 28 | "left": "300px", 29 | "top": "300px" 30 | }, 31 | "close": false, 32 | "pop": true 33 | }, 34 | { 35 | "name": "组件列表", 36 | "component": "widgetComponent", 37 | "close": true, 38 | "pop": true 39 | }, 40 | { 41 | "name": "组合组件", 42 | "component": "widgetCombinedComponents", 43 | "close": true, 44 | "pop": true, 45 | "style": { 46 | "width": "472.75px", 47 | "height": "378.5px", 48 | "left": "377px", 49 | "top": "472px" 50 | } 51 | } 52 | ], 53 | "type": "panel", 54 | "flex": 1 55 | } 56 | ], 57 | "type": "column", 58 | "flex": 0.4628154050464807 59 | } 60 | ], 61 | "type": "column", 62 | "flex": 0.2351640648382981 63 | }, 64 | { 65 | "children": [ 66 | { 67 | "children": [ 68 | { 69 | "name": "脚本编辑", 70 | "component": "widgetCodePanel", 71 | "close": false, 72 | "pop": false 73 | }, 74 | { 75 | "name": "场景", 76 | "component": "widgetScene", 77 | "close": false, 78 | "pop": false 79 | }, 80 | { 81 | "name": "商城", 82 | "component": "widgetShop", 83 | "close": true, 84 | "pop": true 85 | } 86 | ], 87 | "type": "panel", 88 | "flex": 1 89 | } 90 | ], 91 | "type": "column", 92 | "flex": 0.5016249900988153 93 | }, 94 | { 95 | "children": [ 96 | { 97 | "children": [ 98 | { 99 | "name": "属性", 100 | "component": "widgetAttribute", 101 | "close": false, 102 | "pop": true 103 | }, 104 | { 105 | "name": "样式", 106 | "component": "widgetStyleEditor", 107 | "close": false, 108 | "pop": true 109 | }, 110 | { 111 | "name": "动画", 112 | "component": "widgetAnimate", 113 | "close": true, 114 | "pop": true 115 | }, 116 | { 117 | "name": "页面设置", 118 | "component": "widgetPageInfo", 119 | "close": true, 120 | "pop": true 121 | } 122 | ], 123 | "type": "panel", 124 | "flex": 1 125 | } 126 | ], 127 | "type": "column", 128 | "flex": 0.2632109450628866 129 | } 130 | ], 131 | "type": "row" 132 | }, 133 | "dialogs": [], 134 | "version": 1.3, 135 | "name": "develop" 136 | } -------------------------------------------------------------------------------- /src/assets/layout/flutter.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout": { 3 | "children": [{ 4 | "children": [{ 5 | "children": [{ 6 | "name": "组件列表", 7 | "component": "widgetComponent", 8 | "close": true, 9 | "pop": true 10 | }, { 11 | "name": "合成组件", 12 | "component": "widgetCombinedComponents", 13 | "close": true, 14 | "pop": true 15 | }], 16 | "type": "panel", 17 | "flex": 0.5 18 | }, { 19 | "children": [{ 20 | "name": "组件树", 21 | "component": "widgetComponentTree", 22 | "close": true, 23 | "pop": true 24 | }], 25 | "type": "panel", 26 | "flex": 0.5 27 | }], 28 | "type": "column", 29 | "flex": 0.20626959247648904 30 | }, { 31 | "children": [{ 32 | "children": [{ 33 | "name": "组场景", 34 | "component": "widgetScene", 35 | "close": false, 36 | "pop": false 37 | }, { 38 | "name": "组件详情", 39 | "component": "widgetComponentInfo", 40 | "close": true, 41 | "pop": true 42 | }, { 43 | "name": "页面设置", 44 | "component": "widgetPageInfo", 45 | "close": true, 46 | "pop": true 47 | }], 48 | "type": "panel", 49 | "flex": 1 50 | }], 51 | "type": "column", 52 | "flex": 0.5512481056767048 53 | }, { 54 | "children": [{ 55 | "children": [{ 56 | "name": "属性", 57 | "component": "widgetAttribute", 58 | "close": false, 59 | "pop": true 60 | }, { 61 | "name": "样式", 62 | "component": "widgetStyleEditor", 63 | "close": false, 64 | "pop": true 65 | }, { 66 | "name": "脚本", 67 | "component": "widgetScriptEditor", 68 | "style": { 69 | "width": "300px", 70 | "height": "400px", 71 | "left": "300px", 72 | "top": "300px" 73 | }, 74 | "close": true, 75 | "pop": true 76 | }], 77 | "type": "panel", 78 | "flex": 1 79 | }], 80 | "type": "column", 81 | "flex": 0.2424823018468062 82 | }], 83 | "type": "row" 84 | }, 85 | "dialogs": [], 86 | "version": 1, 87 | "name": "default" 88 | } -------------------------------------------------------------------------------- /src/assets/style/base.styl: -------------------------------------------------------------------------------- 1 | @require('~rider/lib/rider/index.styl') 2 | 3 | // 基础配置信息 4 | $-base-font-size = 12 5 | $-bg-color = #262626 6 | $-bg-scend-color = #262626 7 | 8 | 9 | $-font-color = #fafafa 10 | $-grey-color-1 = #333 11 | $-grey-color-2 = #666 12 | $-grey-color-3 = #999 13 | 14 | 15 | 16 | // 设置背景图片 17 | mbg($src, $size = 100% 100%, $position = 0 0, $repeat = no-repeat) 18 | 19 | if not file-exists($src) 20 | error('$src 必须为本地已存在的图片路径:' + $src) 21 | 22 | background-image: url($src) 23 | background-size: $size 24 | background-position: $position 25 | background-repeat: $repeat 26 | -------------------------------------------------------------------------------- /src/assets/style/m-1px.styl: -------------------------------------------------------------------------------- 1 | .m-border-1px { 2 | position:relative; 3 | border:none!important 4 | } 5 | .m-border-1px:after { 6 | content:''; 7 | position:absolute; 8 | top:0; 9 | left:0; 10 | box-sizing:border-box; 11 | border-width:0; 12 | border-style:solid; 13 | border-color:#ccc; 14 | -webkit-transform-origin:50% 50%; 15 | transform-origin:50% 50%; 16 | width:100%; 17 | height:100% 18 | pointer-events: none; 19 | } 20 | .m-border-all:after { 21 | border-width:1px 22 | } 23 | .m-border-top:after { 24 | border-top-width:1px 25 | } 26 | .m-border-left:after { 27 | border-left-width:1px 28 | } 29 | .m-border-right:after { 30 | border-right-width:1px 31 | } 32 | .m-border-bottom:after { 33 | border-bottom-width:1px 34 | } 35 | @media (-webkit-min-device-pixel-ratio:2) { 36 | .m-border-1px:after { 37 | width:200%; 38 | height:200%; 39 | -webkit-transform:scale(.5) translate3D(-50%,-50%,0); //先缩放后平移 40 | transform:scale(.5) translate3D(-50%,-50%,0); 41 | } 42 | } 43 | @media (-webkit-min-device-pixel-ratio:3) { 44 | .m-border-1px:after { 45 | width:300%; 46 | height:300%; 47 | -webkit-transform:scale(.3333) translate3D(-100%,-100%,0); 48 | transform:scale(.3333) translate3D(-100%,-100%,0); 49 | } 50 | } 51 | @media (min-device-pixel-ratio:2) { 52 | .m-border-1px:after { 53 | width:200%; 54 | height:200%; 55 | -webkit-transform:scale(.5) translate3D(-50%,-50%,0); 56 | transform:scale(.5) translate3D(-50%,-50%,0); 57 | } 58 | } 59 | @media (min-device-pixel-ratio:3) { 60 | .m-border-1px:after { 61 | width: 300%; 62 | height: 300%; 63 | -webkit-transform: scale(.3333) translate3D(-100%,-100%,0); 64 | transform: scale(.3333) translate3D(-100%,-100%,0); 65 | } 66 | } 67 | 68 | /* 69 | ** 1px based on gradient 70 | */ 71 | 72 | .m-border-gradient-1px { 73 | background-repeat: no-repeat; 74 | } 75 | 76 | .m-border-gradient-1px.m-border-gradient-left { 77 | background-image: -webkit-gradient(linear, right bottom, left bottom, color-stop(0.3, transparent), color-stop(1, #ccc)); 78 | background-image: linear-gradient(to left, transparent 30%, #ccc); 79 | background-size: 1px 100%; 80 | background-position: left; 81 | } 82 | .m-border-gradient-1px.m-border-gradient-top { 83 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.3, transparent), color-stop(1, #ccc)); 84 | background-image: linear-gradient(to top, transparent 30%, #ccc); 85 | background-size: 100% 1px; 86 | background-position: top; 87 | } 88 | .m-border-gradient-1px.m-border-gradient-bottom { 89 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.3, transparent), color-stop(1, #ccc)); 90 | background-image: linear-gradient(to bottom, transparent 30%, #ccc); 91 | background-size: 100% 1px; 92 | background-position: bottom; 93 | } 94 | .m-border-gradient-1px.m-border-gradient-right { 95 | background-image: -webkit-gradient(linear, left top, right top, color-stop(0.3, transparent), color-stop(1, #ccc)); 96 | background-image: linear-gradient(to right, transparent 30%, #ccc); 97 | background-size: 1px 100%; 98 | background-position: right; 99 | } 100 | .m-border-gradient-1px.m-border-gradient-tb, .m-border-gradient-1px.m-border-gradient-bt { 101 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.3, transparent), color-stop(1, #ccc)), -webkit-gradient(linear, left bottom, left top, color-stop(0.3, transparent), color-stop(1, #ccc)); 102 | background-image: linear-gradient(to top, transparent 30%, #ccc), linear-gradient(to bottom, transparent 30%, #ccc); 103 | background-size: 100% 1px, 100% 1px; 104 | background-position: top, bottom; 105 | } 106 | 107 | .m-border-gradient-1px.m-border-gradient-lr, .m-border-gradient-1px.m-border-gradient-rl { 108 | background-image: -webkit-gradient(linear, left bottom, right bottom, color-stop(0.3, transparent), color-stop(1, #e0e0e0)), -webkit-gradient(linear, right top, left top, color-stop(0.3, transparent), color-stop(1, #e0e0e0)); 109 | background-image: linear-gradient(to right, transparent 30%, #ccc), linear-gradient(to left, transparent 30%, #ccc); 110 | background-size: 1px 100%, 1px 100%; 111 | background-position: right, left; 112 | } -------------------------------------------------------------------------------- /src/client.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './Client.vue' 3 | import VueRouter from 'vue-router' 4 | import FastClick from 'FastClick' 5 | import './assets/js/date' 6 | import routes from './extend/RouterMap' 7 | import ESlog from './extend/ESlog' 8 | import clientlib from './extend/client/' 9 | import {fetch} from './extend/fetch' 10 | import Util from './extend/Util' 11 | let config = require('./config/index') 12 | 13 | window.Truck = window.$GP = { 14 | Util, 15 | ESlog, 16 | Env: {}, 17 | Native: {}, 18 | Server: {fetch}, 19 | } 20 | window.Truck.Maliang = clientlib 21 | window.$GP.VueExtend = clientlib 22 | window.Vue = Vue 23 | /** 24 | * 定义编辑配置属性的混合策略 25 | */ 26 | var strategies = Vue.config.optionMergeStrategies 27 | strategies.editorMethods = strategies.methods 28 | strategies.editerMethods = strategies.methods 29 | Vue.use(VueRouter) 30 | FastClick.attach(document.body, {}) 31 | 32 | const router = new VueRouter(routes) 33 | 34 | const app = window.app = new Vue({ // eslint-disable-line 35 | router, 36 | render: h => h(App) 37 | }) 38 | 39 | function startApp () { 40 | if (startApp.started) return 41 | startApp.started = true 42 | mount() 43 | 44 | function mount () { 45 | Object.defineProperty(window, 'EventHub', { 46 | get () { return window.app } 47 | }) 48 | app.$mount('#app') 49 | window.addEventListener('pagehide', trackPVTime) 50 | sendPVTime() 51 | window.trackPVTime = trackPVTime 52 | } 53 | } 54 | startApp() 55 | 56 | function trackPVTime (from) { 57 | if (trackPVTime.called) return 58 | console.log(from) 59 | var end = Date.now() 60 | var start = window.loadingStartTime 61 | var route = window.location.pathname.match(new RegExp(`(?:/${config.VIEW_NAME || 'view'})?/(\\w+)`)) 62 | if (route && route[1]) { 63 | window.localStorage.setItem('ML_VIEW_TIME', route[1] + '|' + ((end - start) / 1000 | 0)) 64 | } 65 | trackPVTime.called = 1 66 | } 67 | 68 | function sendPVTime () { 69 | if (process.env.NODE_ENV !== 'production') return 70 | var ML_VIEW_TIME = (window.localStorage.getItem('ML_VIEW_TIME') || '').split('|') 71 | if (ML_VIEW_TIME && ML_VIEW_TIME.length == 2) { 72 | ESlog.track({ 73 | app_id: 'tview', 74 | page_id: ML_VIEW_TIME[0], 75 | action: 'PV_TIME', 76 | duration: +ML_VIEW_TIME[1] || 0, 77 | }, 'no-fp') 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/client.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 加载中... 6 | 8 | 9 | 10 | 11 | 12 | 13 | 108 | 109 | 110 |
111 |
112 |
113 |
114 | 115 |
116 |
117 |
118 | 129 | 130 | 131 | <% if (process.env.NODE_ENV === 'production') { %> 132 | 133 | 134 | 135 | <% } %> 136 | 137 | -------------------------------------------------------------------------------- /src/components/AssetsTags.vue: -------------------------------------------------------------------------------- 1 | 15 | 36 | 37 | 116 | -------------------------------------------------------------------------------- /src/components/AssistLines.vue: -------------------------------------------------------------------------------- 1 | 8 | 24 | 25 | 103 | 104 | -------------------------------------------------------------------------------- /src/components/Dialogs.vue: -------------------------------------------------------------------------------- 1 | 6 | 11 | 12 | 76 | 77 | -------------------------------------------------------------------------------- /src/components/Tips.vue: -------------------------------------------------------------------------------- 1 | 16 | 50 | 51 | 83 | 84 | -------------------------------------------------------------------------------- /src/components/UploadImage.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 154 | 155 | -------------------------------------------------------------------------------- /src/components/attr/Data.vue: -------------------------------------------------------------------------------- 1 | 6 | 12 | 13 | 86 | 87 | -------------------------------------------------------------------------------- /src/components/attr/Event.vue: -------------------------------------------------------------------------------- 1 | 21 | 33 | 34 | 134 | 135 | -------------------------------------------------------------------------------- /src/components/attr/Resource.vue: -------------------------------------------------------------------------------- 1 | 12 | 33 | 34 | 112 | 113 | -------------------------------------------------------------------------------- /src/components/attr/index.js: -------------------------------------------------------------------------------- 1 | 2 | import Data from './Data' 3 | import MEvent from './Event' 4 | import MFunction from './Function' 5 | import Resource from './Resource' 6 | import Richtext from './RichText' 7 | import Vue from 'vue' 8 | 9 | function install () { 10 | Vue.component('attr-data', Data) 11 | Vue.component('attr-resource', Resource) 12 | Vue.component('attr-function', MFunction) 13 | Vue.component('attr-richtext', Richtext) 14 | Vue.component('attr-event', MEvent) 15 | } 16 | 17 | export default { 18 | install 19 | } 20 | -------------------------------------------------------------------------------- /src/components/bughd.vue: -------------------------------------------------------------------------------- 1 | 9 | 29 | 63 | -------------------------------------------------------------------------------- /src/components/client/FitImg.vue: -------------------------------------------------------------------------------- 1 | 7 | 30 | 31 | 78 | -------------------------------------------------------------------------------- /src/components/client/ImgViewer.vue: -------------------------------------------------------------------------------- 1 | 12 | 37 | 38 | 79 | -------------------------------------------------------------------------------- /src/components/client/Loading.vue: -------------------------------------------------------------------------------- 1 | 8 | 24 | 25 | 55 | -------------------------------------------------------------------------------- /src/components/client/Toast.vue: -------------------------------------------------------------------------------- 1 | 4 | 53 | 54 | 115 | -------------------------------------------------------------------------------- /src/components/code/textmate/index.js: -------------------------------------------------------------------------------- 1 | import * as monaco from 'monaco-editor' 2 | import { 3 | SINGLETON 4 | } from './monaco-theme-registry' 5 | import onigasmPromise from './loadwasm' 6 | import { 7 | INITIAL, 8 | Registry, 9 | parseRawGrammar 10 | } from 'vscode-textmate' 11 | var currentTheme = '' 12 | var jtml = require('./javascripttm.json') 13 | 14 | var TokenizerState = (function () { 15 | function TokenizerState(ruleStack) { 16 | this.ruleStack = ruleStack 17 | } 18 | TokenizerState.prototype.clone = function () { 19 | return new TokenizerState(this.ruleStack) 20 | } 21 | TokenizerState.prototype.equals = function (other) { 22 | return other instanceof TokenizerState && (other === this || other.ruleStack === this.ruleStack) 23 | } 24 | return TokenizerState 25 | }()) 26 | var grammarPaths = { 27 | 'source.js': 'grammar.json' 28 | } 29 | 30 | 31 | function createTextmateTokenizer(grammar, options) { 32 | return { 33 | getInitialState: function () { 34 | return new TokenizerState(INITIAL) 35 | }, 36 | tokenizeEncoded: function (line, state) { 37 | var processedLine = line 38 | if (options.lineLimit !== undefined && line.length > options.lineLimit) { 39 | processedLine = line.substr(0, options.lineLimit) 40 | } 41 | var result = grammar.tokenizeLine2(processedLine, state.ruleStack) 42 | return { 43 | endState: new TokenizerState(result.ruleStack), 44 | tokens: result.tokens 45 | } 46 | } 47 | } 48 | } 49 | async function init(theme) { 50 | if (theme === currentTheme) { 51 | return 52 | } 53 | currentTheme = theme 54 | var registry = new Registry({ 55 | theme: SINGLETON.getTheme(theme), 56 | getOnigLib: () => onigasmPromise, 57 | loadGrammar: function (scopeName) { 58 | var path = grammarPaths[scopeName] 59 | if (path) { 60 | return new Promise((resolve, reject) => { 61 | var rawGrammar = parseRawGrammar(JSON.stringify(jtml), path) 62 | resolve(rawGrammar) 63 | }) 64 | } 65 | return null 66 | } 67 | }) 68 | const grammar = await registry.loadGrammarWithConfiguration('source.js', 42, {}) 69 | monaco.languages.setTokensProvider('javascript', createTextmateTokenizer(grammar, {})) 70 | monaco.editor.setTheme(theme) 71 | } 72 | 73 | export default { 74 | init: init 75 | } 76 | -------------------------------------------------------------------------------- /src/components/code/textmate/loadwasm.js: -------------------------------------------------------------------------------- 1 | import { 2 | loadWASM, 3 | OnigScanner, 4 | OnigString 5 | } from 'onigasm' 6 | export const isBasicWasmSupported = typeof window.WebAssembly !== 'undefined' 7 | 8 | export function fetchOnigasm () { 9 | return new Promise((resolve, reject) => { 10 | const request = new window.XMLHttpRequest() 11 | 12 | request.onreadystatechange = function () { 13 | if (this.readyState === window.XMLHttpRequest.DONE) { 14 | if (this.status === 200) { 15 | resolve(this.response) 16 | } else { 17 | reject(new Error('Could not fetch onigasm')) 18 | } 19 | } 20 | } 21 | 22 | request.open('GET', './onigasm.wasm', true) 23 | request.responseType = 'arraybuffer' 24 | request.send() 25 | }) 26 | } 27 | export class OnigasmLib { 28 | createOnigScanner (sources) { 29 | return new OnigScanner(sources) 30 | } 31 | createOnigString (sources) { 32 | return new OnigString(sources) 33 | } 34 | } 35 | const onigasmPromise = isBasicWasmSupported ? fetchOnigasm().then(async buffer => { 36 | await loadWASM(buffer) 37 | return new OnigasmLib() 38 | }) : Promise.reject(new Error('wasm not supported')) 39 | export default onigasmPromise 40 | -------------------------------------------------------------------------------- /src/components/code/theme/dark_defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "vscode://schemas/color-theme", 3 | "name": "Dark Default Colors", 4 | "colors": { 5 | "editor.background": "#1E1E1E", 6 | "editor.foreground": "#D4D4D4", 7 | "editor.inactiveSelectionBackground": "#3A3D41", 8 | "editorIndentGuide.background": "#404040", 9 | "editorIndentGuide.activeBackground": "#707070", 10 | "editor.selectionHighlightBackground": "#ADD6FF26", 11 | "list.dropBackground": "#383B3D", 12 | "activityBarBadge.background": "#007ACC", 13 | "sideBarTitle.foreground": "#BBBBBB" 14 | } 15 | } -------------------------------------------------------------------------------- /src/components/code/theme/light_defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "vscode://schemas/color-theme", 3 | "name": "Light Default Colors", 4 | "colors": { 5 | "editor.background": "#FFFFFF", 6 | "editor.foreground": "#000000", 7 | "editor.inactiveSelectionBackground": "#E5EBF1", 8 | "editorIndentGuide.background": "#D3D3D3", 9 | "editorIndentGuide.activeBackground": "#939393", 10 | "editor.selectionHighlightBackground": "#ADD6FF4D", 11 | "editorSuggestWidget.background": "#F3F3F3", 12 | "activityBarBadge.background": "#007ACC", 13 | "sideBarTitle.foreground": "#6F6F6F", 14 | "list.hoverBackground": "#E8E8E8", 15 | "input.placeholderForeground": "#ADADAD" 16 | } 17 | } -------------------------------------------------------------------------------- /src/components/code/theme/light_plus.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "vscode://schemas/color-theme", 3 | "name": "Light+ (default light)", 4 | "include": "./light_vs.json", 5 | "tokenColors": [ 6 | { 7 | "name": "Function declarations", 8 | "scope": [ 9 | "entity.name.function", 10 | "support.function", 11 | "support.constant.handlebars" 12 | ], 13 | "settings": { 14 | "foreground": "#795E26" 15 | } 16 | }, 17 | { 18 | "name": "Types declaration and references", 19 | "scope": [ 20 | "meta.return-type", 21 | "support.class", 22 | "support.type", 23 | "entity.name.type", 24 | "entity.name.class", 25 | "storage.type.numeric.go", 26 | "storage.type.byte.go", 27 | "storage.type.boolean.go", 28 | "storage.type.string.go", 29 | "storage.type.uintptr.go", 30 | "storage.type.cs", 31 | "storage.type.generic.cs", 32 | "storage.type.modifier.cs", 33 | "storage.type.variable.cs", 34 | "storage.type.annotation.java", 35 | "storage.type.generic.java", 36 | "storage.type.java", 37 | "storage.type.object.array.java", 38 | "storage.type.primitive.array.java", 39 | "storage.type.primitive.java", 40 | "storage.type.token.java", 41 | "storage.type.groovy", 42 | "storage.type.annotation.groovy", 43 | "storage.type.parameters.groovy", 44 | "storage.type.generic.groovy", 45 | "storage.type.object.array.groovy", 46 | "storage.type.primitive.array.groovy", 47 | "storage.type.primitive.groovy" 48 | ], 49 | "settings": { 50 | "foreground": "#267f99" 51 | } 52 | }, 53 | { 54 | "name": "Types declaration and references, TS grammar specific", 55 | "scope": [ 56 | "meta.type.cast.expr", 57 | "meta.type.new.expr", 58 | "support.constant.math", 59 | "support.constant.dom", 60 | "support.constant.json", 61 | "entity.other.inherited-class" 62 | ], 63 | "settings": { 64 | "foreground": "#267f99" 65 | } 66 | }, 67 | { 68 | "name": "Control flow keywords", 69 | "scope": "keyword.control", 70 | "settings": { 71 | "foreground": "#AF00DB" 72 | } 73 | }, 74 | { 75 | "name": "Variable and parameter name", 76 | "scope": [ 77 | "variable", 78 | "meta.definition.variable.name", 79 | "support.variable" 80 | ], 81 | "settings": { 82 | "foreground": "#001080" 83 | } 84 | }, 85 | { 86 | "name": "Object keys, TS grammar specific", 87 | "scope": [ 88 | "meta.object-literal.key" 89 | ], 90 | "settings": { 91 | "foreground": "#001080" 92 | } 93 | }, 94 | { 95 | "name": "CSS property value", 96 | "scope": [ 97 | "support.constant.property-value", 98 | "support.constant.font-name", 99 | "support.constant.media-type", 100 | "support.constant.media", 101 | "constant.other.color.rgb-value", 102 | "constant.other.rgb-value", 103 | "support.constant.color" 104 | ], 105 | "settings": { 106 | "foreground": "#0451a5" 107 | } 108 | }, 109 | { 110 | "name": "Regular expression groups", 111 | "scope": [ 112 | "punctuation.definition.group.regexp", 113 | "punctuation.definition.group.assertion.regexp", 114 | "punctuation.definition.character-class.regexp", 115 | "punctuation.character.set.begin.regexp", 116 | "punctuation.character.set.end.regexp", 117 | "keyword.operator.negation.regexp", 118 | "support.other.parenthesis.regexp" 119 | ], 120 | "settings": { 121 | "foreground": "#d16969" 122 | } 123 | }, 124 | { 125 | "scope": [ 126 | "constant.character.character-class.regexp", 127 | "constant.other.character-class.set.regexp", 128 | "constant.other.character-class.regexp", 129 | "constant.character.set.regexp" 130 | ], 131 | "settings": { 132 | "foreground": "#811f3f" 133 | } 134 | }, 135 | { 136 | "scope": "keyword.operator.quantifier.regexp", 137 | "settings": { 138 | "foreground": "#000000" 139 | } 140 | }, 141 | { 142 | "scope": [ 143 | "keyword.operator.or.regexp", 144 | "keyword.control.anchor.regexp" 145 | ], 146 | "settings": { 147 | "foreground": "#ff0000" 148 | } 149 | }, 150 | { 151 | "scope": "constant.character", 152 | "settings": { 153 | "foreground": "#0000ff" 154 | } 155 | }, 156 | { 157 | "scope": "constant.character.escape", 158 | "settings": { 159 | "foreground": "#ff0000" 160 | } 161 | } 162 | 163 | ] 164 | } -------------------------------------------------------------------------------- /src/components/dock/BasePanel.js: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'node', 3 | data: function (params) { 4 | return { 5 | showMask: false, 6 | dragPanel: null 7 | } 8 | }, 9 | watch: {}, 10 | mounted: function () { 11 | // panel 标题开始拖动事件处理 12 | this.ema.bind('dock.panelTitleDragStart', (target, info) => { 13 | this.showMask = true 14 | this.dragPanel = target 15 | this.dragInfo = info 16 | }) 17 | // 标题拖动完成事件处理 18 | this.ema.bind('dock.panelTitleDragEnd', (value) => { 19 | this.showMask = false 20 | }) 21 | }, 22 | methods: { 23 | dragover: function (ev) { 24 | ev.stopPropagation() 25 | ev.preventDefault() 26 | }, 27 | dragleave: function (ev) { 28 | ev.stopPropagation() 29 | ev.preventDefault() 30 | this.ema.fire('dock.maskDragleave') 31 | }, 32 | dragenter: function (ev) { 33 | ev.stopPropagation() 34 | this.ema.fire('dock.maskDragenter', ev, this) 35 | }, 36 | drop: function (ev) { 37 | ev.stopPropagation() 38 | ev.preventDefault() 39 | this.ema.fire('dock.panelTitleDrop', ev) 40 | // 处理元素的添加移除等逻辑 41 | this.showMask = false 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/components/dock/Resizer.vue: -------------------------------------------------------------------------------- 1 | 6 | 55 | 119 | 120 | -------------------------------------------------------------------------------- /src/components/style/Background.vue: -------------------------------------------------------------------------------- 1 | 26 | 31 | 129 | 130 | -------------------------------------------------------------------------------- /src/components/style/ColorPicker.vue: -------------------------------------------------------------------------------- 1 | 14 | 25 | 26 | 99 | 100 | -------------------------------------------------------------------------------- /src/components/style/Layout.vue: -------------------------------------------------------------------------------- 1 | 59 | 84 | 85 | 113 | 114 | -------------------------------------------------------------------------------- /src/components/style/Num.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 60 | 61 | 168 | 169 | -------------------------------------------------------------------------------- /src/components/style/Radius.vue: -------------------------------------------------------------------------------- 1 | 28 | 44 | 69 | 70 | -------------------------------------------------------------------------------- /src/components/style/Size.vue: -------------------------------------------------------------------------------- 1 | 29 | 34 | 35 | 60 | 61 | -------------------------------------------------------------------------------- /src/components/style/Text.vue: -------------------------------------------------------------------------------- 1 | 38 | 43 | 68 | 69 | -------------------------------------------------------------------------------- /src/components/style/index.vue: -------------------------------------------------------------------------------- 1 | 8 | 15 | 16 | 68 | 69 | -------------------------------------------------------------------------------- /src/components/widget/PageInfo.vue: -------------------------------------------------------------------------------- 1 | 32 | 42 | 43 | 103 | -------------------------------------------------------------------------------- /src/components/widget/Shop.vue: -------------------------------------------------------------------------------- 1 | 6 | 17 | 18 | 108 | -------------------------------------------------------------------------------- /src/components/widget/animate/LayerNode.vue: -------------------------------------------------------------------------------- 1 | 16 | 60 | 132 | 133 | -------------------------------------------------------------------------------- /src/components/widget/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Scene from './Scene' 3 | import PageTemplate from './PageTemplate' 4 | import Components from './Components' 5 | import ComponentInfo from './ComponentInfo' 6 | import Attribute from './Attribute' 7 | import ComponentTree from './ComponentTree' 8 | import CombinedComponents from './CombinedComponents' 9 | import ScriptEditor from './ScriptEditor' 10 | import Animate from './animate/index' 11 | import PageInfo from './PageInfo' 12 | import StyleEditor from '../style/index' 13 | import CodePanel from './CodePanel' 14 | import Shop from './Shop' 15 | 16 | function install() { 17 | Vue.component('widgetScene', Scene) 18 | Vue.component('widgetPageTemplate', PageTemplate) 19 | Vue.component('widgetAttribute', Attribute) 20 | Vue.component('widgetComponent', Components) 21 | Vue.component('widgetComponentTree', ComponentTree) 22 | Vue.component('widgetStyleEditor', StyleEditor) 23 | Vue.component('widgetScriptEditor', ScriptEditor) 24 | Vue.component('widgetAnimate', Animate) 25 | Vue.component('widgetPageInfo', PageInfo) 26 | Vue.component('widgetComponentInfo', ComponentInfo) 27 | Vue.component('widgetCombinedComponents', CombinedComponents) 28 | Vue.component('widgetCodePanel', CodePanel) 29 | Vue.component('widgetShop', Shop) 30 | } 31 | 32 | export default { 33 | install 34 | } -------------------------------------------------------------------------------- /src/config/default.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | SHOP: 'https://godspen.ymm56.com/shop/', 3 | VIEW_PATH: 'view', 4 | ADMIN_PATH: 'admin', 5 | EDITOR_PATH: 'editor', 6 | API_PATH: 'api', 7 | EDITOR_TITLE: '编辑器', 8 | ADMIN_TITLE: '管理后台', 9 | BAIDU_TONGJI: '' 10 | } 11 | -------------------------------------------------------------------------------- /src/config/index.js: -------------------------------------------------------------------------------- 1 | const defaultConfig = require('./default') 2 | 3 | let config = Object.assign(defaultConfig, require('./' + (process.env.CODE_ENV || 'local'))) 4 | 5 | ;['VIEW_PATH', 'ADMIN_PATH', 'EDITOR_PATH', 'API_PATH'].map(k => { 6 | if (config[k] === '/') return 7 | if (/^(https?:)?\/\//.test(config[k])) { 8 | config[k] = config[k].replace(/\/*$/, '/') 9 | } else { 10 | config[k] = config[k].replace(/^\/*|\/*$/g, '/') 11 | } 12 | }) 13 | 14 | config.VIEW_NAME = process.env.NODE_ENV === 'development' ? '' : (config.VIEW_PATH.match(/([^/]+)\/?$/) || ['', 'view'])[1] 15 | config.EDITOR_NAME = process.env.NODE_ENV === 'development' ? '' : (config.EDITOR_PATH.match(/([^/]+)\/?$/) || ['', 'editor'])[1] 16 | 17 | module.exports = config 18 | -------------------------------------------------------------------------------- /src/config/local.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 在本地开发调试时,三个web项目和一个node项目都是在独立运行的 3 | * 因此需要配置每个服务的本地访问地址,以使能互相调用/请求 4 | * admin、editor、view、api 四个服务的默认端口号分别为 5 | * 8567、8565、8566、7051,因此默认配置如下 6 | * 如果还希望像先前只启动本项目(demo 模式)进行体验,将 API_PATH 7 | * 设置为 ‘https://godspen.ymm56.com/api/' 即可 8 | */ 9 | 10 | module.exports = { 11 | EDITOR_PATH: 'http://127.0.0.1:8565/', // 编辑器访问地址 12 | VIEW_PATH: 'http://127.0.0.1:8566/', // 页面客户端访问地址 13 | ADMIN_PATH: 'http://127.0.0.1:8567/', // 管理后台访问地址 14 | // API_PATH: 'http://127.0.0.1:7051/api', // api 服务端访问地址 15 | API_PATH: 'https://godspen.ymm56.com/api/', // 启动demo模式,使用官方 api 服务 16 | } 17 | -------------------------------------------------------------------------------- /src/config/production.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 对于三个web项目,在构建阶段,web项目不再需要启动本地服务,一般来说, 3 | * 构建完成后会将所有静态资源文件部署在同一个(nginx)服务下,因此, 4 | * web项目的默认访问路径就是域名加项目名,如 xxxx.com/admin, 5 | * xxxx.com/editor,如无更名要求,无需再配置 6 | * 7 | * 对于 api 服务,服务启动以后,本地/内部访问地址为 http://127.0.0.1:7051/api, 8 | * 如果最终能通过 nginx 反代等操作使之与 web 服务同域名同端口号, 9 | * 则可以保持以下配置(无需配置)即可,否则,请将 API_PATH 配置为 api 服务外部实际访 10 | * 问路径,如 http://abc.125:7051/api 11 | */ 12 | 13 | module.exports = { 14 | } 15 | -------------------------------------------------------------------------------- /src/dialog/d-Preview.vue: -------------------------------------------------------------------------------- 1 | 12 | 102 | 150 | -------------------------------------------------------------------------------- /src/dialog/d-editScript.vue: -------------------------------------------------------------------------------- 1 | 17 | 27 | 101 | 102 | -------------------------------------------------------------------------------- /src/dialog/d-nodejson.vue: -------------------------------------------------------------------------------- 1 | 12 | 25 | 103 | -------------------------------------------------------------------------------- /src/dialog/d-saveCombinedComponent.vue: -------------------------------------------------------------------------------- 1 | 26 | 39 | 111 | 112 | -------------------------------------------------------------------------------- /src/editor.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Editor from './Editor.vue' 3 | import EMA from './assets/js/singleton-ema' 4 | import ElementUI from 'element-ui' 5 | import './assets/style/element-variables.scss' 6 | import store from './store' 7 | import * as monaco from 'monaco-editor' 8 | import vuelint from './assets/js/vuelint' 9 | import AttrComponent from './components/attr' 10 | import Widget from './components/widget' 11 | import clientlib from './extend/client/' 12 | import {fetch} from './extend/fetch' 13 | import Util from './extend/Util' 14 | 15 | function empty () {} 16 | 17 | if (process.env.NODE_ENV === 'development') { 18 | window.Vue = Vue 19 | } 20 | 21 | window.Truck = window.$GP = { 22 | Util, 23 | ESlog: {pageview: empty, track: empty, getFingerPrint: empty}, 24 | Maliang: clientlib, 25 | Env: {}, 26 | Native: {}, 27 | Server: {fetch}, 28 | } 29 | window.Truck.Maliang = clientlib 30 | window.$GP.VueExtend = clientlib 31 | window.Vue = Vue 32 | Vue.use(ElementUI) 33 | Vue.use(Widget) 34 | Vue.use(AttrComponent) 35 | 36 | // 集中添加追踪 37 | Vue.prototype.$reactiveSet = function (context, map) { 38 | for (let [key, val] of Object.entries(map)) { 39 | this.$set(context, key, val) 40 | } 41 | } 42 | // 集中移除追踪 43 | Vue.prototype.$reactiveDelete = function reactiveDelete (context, keys) { 44 | for (let key of keys) { 45 | this.$delete(context, key) 46 | } 47 | } 48 | 49 | // 将 API 安装到 Vue,并且检查版本的兼容性 50 | window.resourceEndTime = new Date() - 0 51 | window.EMA = EMA 52 | /** 53 | * 定义编辑配置属性的混合策略 54 | */ 55 | var strategies = Vue.config.optionMergeStrategies 56 | strategies.editorMethods = strategies.methods 57 | strategies.editerMethods = strategies.methods 58 | 59 | const editor = new Vue({ // eslint-disable-line 60 | store: store, 61 | render: h => h(Editor) 62 | }) 63 | 64 | editor.$mount('#app') 65 | 66 | window.onbeforeunload = function () { 67 | var warning = '确认退出?' 68 | return warning 69 | } 70 | window.onunload = function () {} 71 | // 脚本编辑器配置自动提醒 72 | monaco.languages.registerCompletionItemProvider('javascript', { 73 | provideCompletionItems: () => { 74 | return vuelint || [] 75 | } 76 | }) 77 | // 本地存储清理 78 | ;(function clearStorage () { 79 | const storageKeys = Object.keys(localStorage).filter(k => /EditorautoSave/.test(k)) 80 | const maxsize = 10 81 | const kyesToClear = storageKeys.length > maxsize ? storageKeys.slice(maxsize - storageKeys.length) : [] 82 | for (let key of kyesToClear) { 83 | localStorage.removeItem(key) 84 | } 85 | }()) 86 | -------------------------------------------------------------------------------- /src/editor.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= htmlWebpackPlugin.options.title %> 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 28 | <% if (/^[0-9a-zA-Z]{10,}$/.test(htmlWebpackPlugin.options.hmid)) { %> 29 | 30 | <% } %> 31 | 32 | 33 | 34 | 35 | 36 | <% if (process.env.NODE_ENV === 'production') { %> 37 | 38 | 39 | <% } %> 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/extend/BaseComponent.js: -------------------------------------------------------------------------------- 1 | import EMA from '../assets/js/singleton-ema' 2 | import { mapState } from 'vuex' 3 | 4 | export default { 5 | props: [], 6 | data: function () { 7 | return {} 8 | }, 9 | created: function () { 10 | this.ema = EMA.getProxy() 11 | }, 12 | computed: mapState({ 13 | Config: state => state.Config, 14 | Setting: state => state.setting, 15 | RootNodeInfo: state => state.RootNodeInfo, 16 | Metadata: state => state.Metadata, 17 | App: state => state.app, 18 | demoMode: state => state.setting.demoMode 19 | }), 20 | mounted: function () {}, 21 | destroyed: function () { 22 | if (this.ema) { 23 | this.ema.dispose() 24 | } 25 | }, 26 | methods: { 27 | bindEvent: function (key, fn) { 28 | if (!this.$options.name) { 29 | console.warn('绑定事件的组件不存在组件名称', key) 30 | } 31 | this.ema.bind(`${this.$options.name}.${key}`, fn) 32 | }, 33 | openDialog: function (data) { 34 | this.ema.fire('Dialogs.push', data) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/extend/BaseDialog.js: -------------------------------------------------------------------------------- 1 | import EMA from '../assets/js/singleton-ema' 2 | import {mapState} from 'vuex' 3 | 4 | export default { 5 | replace: true, 6 | data: function () { 7 | return { 8 | title: '', 9 | size: 'small', 10 | Visible: true // 弹出框显示状态 11 | } 12 | }, 13 | computed: mapState({ 14 | Config: state => state.Config, 15 | RootNodeInfo: state => state.RootNodeInfo, 16 | Metadata: state => state.Metadata, 17 | demoMode: state => state.setting.demoMode 18 | }), 19 | // 组件是你刚被创建,组件属性计算前 20 | beforeCreated: function () {}, 21 | // 组件创建完成,属性已绑定,但是dom还没生产,$el还不存在 22 | created: function () { 23 | this.ema = EMA.getProxy() 24 | }, 25 | // 模板编译挂载前 26 | beforeMount: function () {}, 27 | // 模板编译挂载之后,不保证组件已经在document中。 28 | mounted: function () {}, 29 | // 组件更新之前 30 | beforeUpdate: function () {}, 31 | // 组件更新之后 32 | updated: function () {}, 33 | // keep-alive 会用到 34 | // 组件被激活 35 | activated: function () {}, 36 | // 组件被移除 37 | deactivated: function () {}, 38 | beforDestroy: function () {}, 39 | destroyed: function () { 40 | this.ema.dispose() 41 | }, 42 | methods: { 43 | /** 44 | * 组件内部范围绑定事件 45 | * @param key 46 | * @param fn 47 | */ 48 | bindEvent: function (key, fn) { 49 | if (!this.$options.name) { 50 | console.warn('绑定事件的组件不存在组件名称', key) 51 | } 52 | this.ema.bind(`${this.$options.name}.${key}`, fn) 53 | }, 54 | /** 55 | * 打开一个弹出框 56 | * @param data 57 | * { 58 | * name:'', //弹出框名称,dialog目录下弹出框名称 59 | * data:{}, //传给弹出框的基础数据 data能包含数据 60 | * methods:{} //传给弹出框的基础方法。方便回调等操作 61 | * } 62 | */ 63 | openDialog: function (data) { 64 | this.ema.fire('Dialogs.push', data) 65 | }, 66 | close: function () { 67 | this.ema.fire('Dialogs.close', this.$options.name) 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/extend/BasePage.js: -------------------------------------------------------------------------------- 1 | import ESlog from '../extend/ESlog' 2 | import EMA from '../assets/js/singleton-ema' 3 | import * as Common from '../assets/js/common.js' 4 | import { mapState } from 'vuex' 5 | 6 | function setPageTitle (title) { 7 | document.title = title 8 | } 9 | 10 | export default { 11 | props: ['params'], 12 | data: function () { 13 | return {} 14 | }, 15 | computed: mapState({ 16 | Config: state => state.Config, 17 | RootNodeInfo: state => state.RootNodeInfo, 18 | Metadata: state => state.Metadata 19 | }), 20 | beforeCreate: function () { 21 | }, 22 | created: function () { 23 | this.ema = EMA.getProxy() 24 | this.Common = Common 25 | }, 26 | beforeMount: function () { 27 | }, 28 | mounted: function () { 29 | }, 30 | activated: function () { 31 | var me = this 32 | if (this.$options.pageName) { 33 | setPageTitle(this.$options.pageName) 34 | } 35 | this.$store.dispatch('setCurrentPage', me.$options.name) // 记录页面信息 36 | if (process.env.NODE_ENV === 'production') { 37 | ESlog.pageview({ 38 | app_id: 'tview', 39 | page_id: me.$route.params.pageKey 40 | }) 41 | } 42 | }, 43 | deactivated: function () { 44 | window.loading('hide') 45 | }, 46 | beforeDestroy: function () { 47 | }, 48 | destroyed: function () { 49 | if (this.ema) { 50 | this.ema.dispose() 51 | } 52 | }, 53 | 54 | methods: { 55 | setPageTitle: setPageTitle, 56 | /** 57 | * 组件内部范围绑定事件 58 | * @param key 59 | * @param fn 60 | */ 61 | bindEvent: function (key, fn) { 62 | if (!this.$options.name) { 63 | console.warn('绑定事件的组件不存在组件名称', key) 64 | } 65 | this.ema.bind(`${this.$options.name}.${key}`, fn) 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/extend/ESlog.js: -------------------------------------------------------------------------------- 1 | import { getFingerPrint } from './Util' 2 | 3 | let config = require('../config/index') 4 | let ES_LOG_URL = `${config.API_PATH}statistics/report?` 5 | 6 | async function track ({action, app_id, page_id, label}, noFingerprint) { // eslint-disable-line 7 | var arg = arguments[0] || {} 8 | if (!arg || typeof arg !== 'object') return 9 | // if (!track.img) track.img = new Image() 10 | var server = new Image() 11 | if (!noFingerprint) { 12 | try { 13 | arg.finger_print = await getFingerPrint().then((res) => { 14 | console.log(res) 15 | return res 16 | }) 17 | } catch (e) { 18 | arg.finger_print = 'unknown' 19 | console.warn(e) 20 | } 21 | } 22 | server.src = ES_LOG_URL + serializeParmas(arg) // 除argements列出字段外,可传入自定义字段 23 | } 24 | 25 | function serializeParmas(obj) { 26 | obj._t = Date.now() // 时间戳防止缓存 27 | return Object.keys(obj).map(k => `${k}=${encodeURIComponent(obj[k])}`).join('&') 28 | } 29 | 30 | function pageview ({app_id, page_id, label}) { // eslint-disable-line 31 | var arg = arguments[0] 32 | if (!arg || typeof arg !== 'object') return 33 | track(Object.assign(arg, {action: 'pageview'})) 34 | } 35 | 36 | export default { 37 | pageview, 38 | getFingerPrint, 39 | track 40 | } 41 | 42 | export { 43 | pageview, 44 | track, 45 | getFingerPrint, 46 | } 47 | -------------------------------------------------------------------------------- /src/extend/HistoryCache.js: -------------------------------------------------------------------------------- 1 | export default { 2 | EditorHistory: [], 3 | index: -1, // 未初始化 4 | maxLength: 50, 5 | getPrev: function () { 6 | var prev = this.index - 1 7 | var prevData = this.EditorHistory[prev] 8 | if (prevData) { 9 | this.index = prev 10 | try { 11 | prevData = JSON.parse(prevData) 12 | } catch (e) { 13 | prevData = null 14 | } 15 | } 16 | return prevData 17 | }, 18 | getNext: function () { 19 | var next = this.index + 1 20 | var nextData = this.EditorHistory[next] 21 | if (nextData) { 22 | this.index = next 23 | try { 24 | nextData = JSON.parse(nextData) 25 | } catch (e) { 26 | nextData = null 27 | } 28 | } 29 | return nextData 30 | }, 31 | add: function (data) { 32 | if (!data) return 33 | var index = this.index 34 | var startIndex = 0 35 | var length = this.EditorHistory.length 36 | if (!(index == length - 1 && length < this.maxLength)) { 37 | startIndex = Math.max(index + 2 - this.maxLength, 0) 38 | this.EditorHistory = this.EditorHistory.slice(startIndex, index + 1) 39 | } 40 | this.EditorHistory.push(JSON.stringify(data)) 41 | this.index = this.EditorHistory.length - 1 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/extend/RouterMap.js: -------------------------------------------------------------------------------- 1 | import Page from '../components/client/Page' 2 | let config = require('../config/index') 3 | 4 | var routerMap = { 5 | mode: 'history', 6 | base: '/' + config.VIEW_NAME, 7 | routes: [ 8 | { 9 | path: '/:pageKey', 10 | component: Page 11 | }, 12 | { 13 | path: '/:projectKey/:pageKey', 14 | component: Page 15 | } 16 | ] 17 | } 18 | export default routerMap 19 | -------------------------------------------------------------------------------- /src/extend/Server.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | let Config = require('../config/index') 3 | var demoMode = process.env.NODE_ENV !== 'production' && !location.search.includes('key=') && /^https?:\/\/godspen.ymm56.com/.test(Config.API_PATH) 4 | var instance = axios.create({ 5 | baseURL: Config.API_PATH, 6 | timeout: 60 * 60 * 1000, 7 | headers: demoMode ? {clikey: 'DEcTjQRFbiYitFydhC2m5kd8JHieQrsztrbiPaz5DbHk68AWbmMBe7ShXw2ncwp5'} : {}, 8 | trimNull: false, // 是否去除空值 9 | withCredentials: true, // default 10 | needLoading: false, // 是否需要加载效果 11 | ignoreCode: false // 是否忽略服务端的错误提示 12 | }) 13 | instance.interceptors.request.use(function (config) { 14 | if (config.needLoading) { 15 | window.EMA.fire('loading.show') 16 | } 17 | config.data = config.data || {} 18 | if (config.trimNull && !(config.data instanceof window.FormData)) { 19 | let _data = Object.assign({}, config.data) 20 | isNull(_data) 21 | config.data = _data 22 | } 23 | return config 24 | 25 | function isNull (obj) { 26 | for (let [key, value] of Object.entries(obj)) { 27 | if (!value && typeof value !== 'number') { 28 | obj[key] = null 29 | return 30 | } 31 | if (typeof value === 'object' && !(value instanceof Date)) isNull(value) 32 | } 33 | } 34 | }, function (error) { 35 | return Promise.reject(error) 36 | }) 37 | 38 | instance.interceptors.response.use(function (response) { 39 | if (response.config.needLoading) { 40 | window.EMA.fire('loading.hide') 41 | } 42 | var code = response.data.result == 0 ? '0' : (response.data.result || '') 43 | if (code && code != 1 && !response.config.ignoreCode) { 44 | switch (code) { 45 | case 999: 46 | window.EMA.fire('alert.show', '认证失败,重新登录', function () { 47 | window.EMA.fire('logout') 48 | }) 49 | break 50 | default: 51 | window.EMA.fire('alert.show', response.data.msg || response.data.errorMsg, function () {}) 52 | } 53 | return Promise.reject(response) 54 | } else { 55 | return response 56 | } 57 | }, function (error) { 58 | window.EMA.fire('loading.hide') 59 | var status = error.response && error.response.status 60 | var message = error.message 61 | if (status != 200) { 62 | if (status == 401) { 63 | window.EMA.fire('alert.show', '认证失败,重新登录', function () { 64 | window.EMA.fire('logout') 65 | }) 66 | } else if (status == 403) { 67 | ;(document.querySelector('body > .editorWarp') || {}).innerHTML = '' 68 | window.EMA.fire('alert.show', '你无权限访问该内容,请联系相关人员分配权限', function () { 69 | window.onbeforeunload = null 70 | window.onunload = null 71 | history.go(-1) 72 | }) 73 | } else { 74 | window.EMA.fire('alert.show', message, function () {}) 75 | } 76 | } 77 | return Promise.reject(error) 78 | }) 79 | 80 | export default instance 81 | -------------------------------------------------------------------------------- /src/extend/UploadImg.js: -------------------------------------------------------------------------------- 1 | import plupload from 'plupload' 2 | import { 3 | getBlobBydataURI, 4 | readAsDataURL 5 | } from './Util' 6 | import Server from '../extend/Server' 7 | var getUploadConfig = function (callback) { 8 | Server({ 9 | url: 'upload/getTocken', 10 | method: 'get', // default 11 | needLoading: false, 12 | data: {} 13 | }).then((respond) => { 14 | var data = respond.data.data 15 | callback(data) 16 | }) 17 | } 18 | 19 | var UploadImage = function ({ 20 | id, 21 | skipSizeCheck, 22 | filters, 23 | isAddUploadFile, 24 | callback 25 | }) { 26 | this.imgSrc = '' 27 | var uploadControll = false 28 | var me = this 29 | var acceptFilters = { 30 | image: { 31 | title: '资源选择', 32 | extensions: 'jpg,gif,png,jpeg' 33 | }, 34 | video: { 35 | title: '资源选择', 36 | extensions: 'mp4' 37 | }, 38 | audio: { 39 | title: '资源选择', 40 | extensions: 'mp3' 41 | }, 42 | file: { 43 | title: '资源选择', 44 | extensions: 'csv,json,txt' 45 | } 46 | } 47 | if (window.mOxie) window.mOxie.Mime.mimes.csv = '.csv' // csv mime hack 48 | this.uploader = new plupload.Uploader({ 49 | runtimes: 'html5', 50 | browse_button: id, 51 | url: 'https://oss.aliyuncs.com', 52 | filters: [acceptFilters[filters]], 53 | prevent_duplicates: true, 54 | max_file_size: '100mb', 55 | init: { 56 | PostInit() {}, 57 | FilesAdded(up, files) { 58 | if (uploadControll) { 59 | return false 60 | } 61 | uploadControll = true 62 | let that = this 63 | let name = files[0].name 64 | if (isAddUploadFile) { 65 | let pos = name.lastIndexOf('.') 66 | if (pos !== -1) { 67 | name = 'ymm_' + new Date().getTime() + name.substring(pos) 68 | } 69 | readAsDataURL(files[0].getNative(), function (src) { 70 | var filesSource = new window.File([getBlobBydataURI(src, files[0].type)], name, { 71 | type: files[0].type 72 | }) 73 | that.addFile(filesSource) 74 | that.removeFile(files[0]) 75 | me.send(name) 76 | }) 77 | } 78 | }, 79 | BeforeUpload(up, file) {}, 80 | UploadProgress(up, file) {}, 81 | FileUploaded(up, file, info) { 82 | if (info.status === 200) { 83 | me.imgSrc = me.imgSrc.replace('ymm.oss-cn-hangzhou.aliyuncs.com', 'imagecdn.ymm56.com') 84 | callback(me.imgSrc) 85 | } else {} 86 | uploadControll = false 87 | }, 88 | Error(up, err) {} 89 | } 90 | }) 91 | this.uploader.init() 92 | } 93 | 94 | UploadImage.prototype.send = function (name) { 95 | var fileName = name || 'ymm' + new Date().getTime() + '.png' 96 | getUploadConfig((configUplaod) => { 97 | configUplaod.key = configUplaod.dir + 'resource/' + fileName 98 | this.imgSrc = configUplaod.host + '/' + configUplaod.key 99 | let newMultipartParams = { 100 | 'key': configUplaod.key, 101 | 'policy': configUplaod.policy, 102 | 'OSSAccessKeyId': configUplaod.accessid, 103 | 'success_action_status': '200', 104 | 'signature': configUplaod.signature 105 | } 106 | console.log('newMultipartParams', newMultipartParams) 107 | this.uploader.setOption({ 108 | 'url': configUplaod.host, 109 | 'multipart_params': newMultipartParams 110 | }) 111 | this.uploader.start() 112 | }) 113 | } 114 | export default UploadImage 115 | -------------------------------------------------------------------------------- /src/extend/Util.js: -------------------------------------------------------------------------------- 1 | import {modifyNodeId} from '../assets/js/common' 2 | import Server from './Server' 3 | import htmlToCanvas from 'html2canvas' 4 | let config = require('../config/index') 5 | 6 | function html2canvas (dom, data) { 7 | data = Object.assign({ 8 | // allowTaint: true, 9 | // useCORS: false, 10 | proxy: `${config.API_PATH}cors-proxy` 11 | }, data) 12 | return htmlToCanvas(dom, data) 13 | } 14 | 15 | function removeAttr (data) { 16 | function walkall (data) { 17 | for (const key in data) { 18 | if (data.hasOwnProperty(key)) { 19 | if (/^__/g.test(key)) { 20 | delete data[key] 21 | } 22 | if (data.child) { 23 | data.child.forEach(element => { 24 | walkall(element) 25 | }) 26 | } 27 | } 28 | } 29 | } 30 | walkall(data) 31 | } 32 | 33 | function loadJs (url = '') { 34 | if (!url) return 35 | if (!loadJs.cache) loadJs.cache = {} 36 | if (loadJs.cache[url]) return Promise.resolve() 37 | return new Promise((resolve, reject) => { 38 | _loadjs( 39 | url, 40 | () => { 41 | loadJs.cache[url] = 'cached' 42 | resolve() 43 | }, 44 | () => { 45 | console.error(`${url} 加载失败`) 46 | reject(new Error(`${url} 加载失败`)) 47 | } 48 | ) 49 | }) 50 | 51 | function _loadjs (url, fn, fail) { 52 | var script = document.createElement('script') 53 | script.src = url 54 | script.async = true 55 | script.onload = fn 56 | script.onerror = fail 57 | ;(document.body || document.head).appendChild(script) 58 | } 59 | } 60 | 61 | function getBaseNode (node) { 62 | if (!node.id) return 63 | useComponent(node.id) 64 | var info = { 65 | id: node.name, 66 | type: node.name, 67 | label: node.label, 68 | version: node.version, 69 | url: node.path, 70 | visible: true, 71 | style: {}, 72 | animate: [], 73 | props: {}, 74 | path: node.path, 75 | script: '' 76 | } 77 | if (node.style) { 78 | info.style = Object.assign({ 79 | position: 'absolute', 80 | width: '80px', 81 | height: '80px', 82 | left: '0px', 83 | top: '0px' 84 | }, node.style) 85 | } 86 | var idCache = Object.keys(window.$_nodecomponents || {}).concat([node.name]) 87 | info = modifyNodeId(info, idCache) 88 | if (info.label) info.label = info.id.replace(node.id, info.label) // 给label添加id 89 | return info 90 | } 91 | 92 | function useComponent (id) { 93 | Server({ 94 | url: 'component/useone', 95 | method: 'post', // default 96 | needLoading: false, 97 | data: { 98 | id: id, 99 | } 100 | }) 101 | .then(() => true) 102 | .catch(console.log) 103 | } 104 | 105 | function getNumber (style) { 106 | style = style || '0' 107 | var arr = style.match(/^[-0-9.]+/) 108 | if (arr) { 109 | return arr[0] - 0 110 | } else { 111 | return 0 112 | } 113 | } 114 | 115 | function getBlobBydataURI (dataURI, type) { 116 | var binary = window.atob(dataURI.split(',')[1]) 117 | var array = [] 118 | for (let i = 0, leng = binary.length; i < leng; i++) { 119 | array.push(binary.charCodeAt(i)) 120 | } 121 | let blob = new window.Blob([new Uint8Array(array)], { 122 | type: type 123 | }) 124 | return blob 125 | } 126 | 127 | function readAsDataURL (file, callback) { 128 | const reader = new window.FileReader() 129 | reader.readAsDataURL(file) 130 | reader.onload = function (e) { 131 | callback && callback(this.result) 132 | } 133 | } 134 | 135 | var FINGER_PRINT_URL = 'https://cdn.staticfile.org/fingerprintjs2/1.8.0/fingerprint2.min.js' 136 | var STORAGE_KEY = 'YMMFP' 137 | 138 | function getFingerPrint () { 139 | if (!getFingerPrint.promise) { 140 | getFingerPrint.promise = new Promise((resolve) => { 141 | var fingerPrint = localStorage.getItem(STORAGE_KEY) 142 | if (fingerPrint) return resolve(fingerPrint) 143 | loadJs(FINGER_PRINT_URL).then(() => { 144 | if (!window.Fingerprint2) resolve('unknown') 145 | window.Fingerprint2 && new window.Fingerprint2().get((res) => { 146 | localStorage.setItem(STORAGE_KEY, res) 147 | resolve(res) 148 | }) 149 | }) 150 | }) 151 | } 152 | return getFingerPrint.promise 153 | } 154 | 155 | export default { 156 | html2canvas, 157 | removeAttr, 158 | loadJs, 159 | getBaseNode, 160 | useComponent, 161 | getNumber, 162 | getBlobBydataURI, 163 | readAsDataURL, 164 | getFingerPrint 165 | } 166 | 167 | export { 168 | html2canvas, 169 | removeAttr, 170 | loadJs, 171 | getBaseNode, 172 | useComponent, 173 | getNumber, 174 | getBlobBydataURI, 175 | readAsDataURL, 176 | getFingerPrint 177 | } 178 | -------------------------------------------------------------------------------- /src/extend/client/filters.js: -------------------------------------------------------------------------------- 1 | Date.prototype.Format = function (fmt) { // author: meizz 2 | var o = { 3 | 'M+': this.getMonth() + 1, // 月份 4 | 'd+': this.getDate(), // 日 5 | 'h+': this.getHours(), // 小时 6 | 'm+': this.getMinutes(), // 分 7 | 's+': this.getSeconds(), // 秒 8 | 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 9 | 'S': this.getMilliseconds() // 毫秒 10 | } 11 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) 12 | for (var k in o) { 13 | if (new RegExp('(' + k + ')').test(fmt)) { 14 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) 15 | } 16 | } 17 | return fmt 18 | } 19 | 20 | export default { 21 | datetime: function (value, format) { 22 | if (!value) return '' 23 | return (new Date(+value)).Format(format || 'yyyy-MM-dd hh:mm') 24 | }, 25 | moneyFormat: function (value, decimal) { 26 | value = value / 100 // 转换为元 27 | decimal = decimal || 2 28 | return isNaN(value) ? 0 : +(value.toFixed(decimal)) 29 | }, 30 | strSplit: function (str, interval, split) { 31 | split = split || ' ' 32 | str = str.replace(/\s+/g, '') 33 | interval = toString.call(interval) == toString.call([]) ? interval : [Number(interval)] 34 | var strArr = [] 35 | var reg 36 | while (1) { 37 | if (interval && interval.length) { 38 | reg = new RegExp(`(\\w{${interval.shift()}}(?!(?:\\s|$)))(.*)`) 39 | } 40 | var items = str.match(reg) 41 | if (!items) { 42 | strArr.push(str) 43 | break 44 | } 45 | strArr.push(items[1]) 46 | str = items[2] 47 | } 48 | return strArr.join(split) 49 | }, 50 | replace: function (value, pattern, target) { 51 | return (value || '').replace(pattern, target) 52 | }, 53 | ossImgCrop: function (src = '', width) { 54 | return String(src).replace('//image.ymm56.com', '//imagecdn.ymm56.com') + `?x-oss-process=image/resize,w_${width}` 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/extend/client/index.js: -------------------------------------------------------------------------------- 1 | import mixin from './mixin' 2 | 3 | var Maliang = { 4 | mixin 5 | } 6 | 7 | export { 8 | mixin 9 | } 10 | 11 | export default Maliang 12 | -------------------------------------------------------------------------------- /src/extend/componentLoader.js: -------------------------------------------------------------------------------- 1 | import {loadJs} from './Util' 2 | export default { 3 | getComponent ({type, version}) { 4 | let C_KEY = `${type}@${version}` 5 | return this.componentCache[C_KEY] 6 | }, 7 | componentCache: {}, 8 | requestCache: {}, 9 | async load ({type, path, version}) { 10 | version = version || '0.1.0' 11 | let C_KEY = `${type}@${version}` 12 | let component = this.getComponent({type, version}) 13 | if (component) return component 14 | let request, url 15 | if (!this.requestCache[C_KEY]) { 16 | url = path 17 | if (process.env.CODE_ENV !== 'production') { 18 | url += '?' + new Date().getTime() 19 | } 20 | this.requestCache[C_KEY] = request = loadJs(location.protocol === 'https:' ? url.replace(/^http:/, 'https:') : url) 21 | } else { 22 | request = this.requestCache[C_KEY] 23 | } 24 | return await request.then(s => { 25 | component = window[C_KEY + 'index'] || window[C_KEY] || window[C_KEY.replace('@', '')] 26 | this.componentCache[C_KEY] = component = component.default || component 27 | return component 28 | }).catch(h => { 29 | console.log('加载脚本失败', url) 30 | console.error(h) 31 | }) 32 | }, 33 | async loadEditor ({type, path, version}) { 34 | if (!path) return 35 | version = version || '0.1.0' 36 | let C_KEY = `${type}@${version}editor` 37 | let component = this.componentCache[C_KEY] 38 | if (component) return component 39 | let request, url 40 | if (!this.requestCache[C_KEY]) { 41 | url = path.replace('index.js', 'editor.js') 42 | if (process.env.CODE_ENV !== 'production') { 43 | url += '?' + new Date().getTime() 44 | } 45 | this.requestCache[C_KEY] = request = loadJs(location.protocol === 'https:' ? url.replace(/^http:/, 'https:') : url) 46 | } else { 47 | request = this.requestCache[C_KEY] 48 | } 49 | return await request.then(s => { 50 | component = window[C_KEY] 51 | this.componentCache[C_KEY] = component = component.default || component 52 | return component 53 | }).catch(h => { 54 | console.log('该组件不存在对应编辑器', type) 55 | }) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/extend/emitter.js: -------------------------------------------------------------------------------- 1 | function broadcast (componentName, eventName, params) { 2 | this.$children.forEach(child => { 3 | var name = child.$options.componentName 4 | 5 | if (name === componentName) { 6 | child.$emit.apply(child, [eventName].concat(params)) 7 | } else { 8 | broadcast.apply(child, [componentName, eventName].concat([params])) 9 | } 10 | }) 11 | } 12 | export default { 13 | methods: { 14 | dispatch (componentName, eventName, params) { 15 | var parent = this.$parent || this.$root 16 | var name = parent.$options.componentName 17 | 18 | while (parent && (!name || name !== componentName)) { 19 | parent = parent.$parent 20 | 21 | if (parent) { 22 | name = parent.$options.componentName 23 | } 24 | } 25 | if (parent) { 26 | parent.$emit.apply(parent, [eventName].concat(params)) 27 | } 28 | }, 29 | broadcast (componentName, eventName, params) { 30 | broadcast.call(this, componentName, eventName, params) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/extend/filter.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | require('../assets/js/date') 3 | /** 4 | * 时间格式化 5 | */ 6 | Vue.filter('datetime', function (value, format) { 7 | return (new Date(value)).Format(format || 'yyyy-MM-dd hh:mm') 8 | }) 9 | /** 10 | * 充值时间格式化,value是以秒为单位 11 | */ 12 | Vue.filter('sdatetime', function (value, format) { 13 | var val = parseInt(value + '000') 14 | return (new Date(val)).Format(format || 'yyyy-MM-dd hh:mm') 15 | }) 16 | /** 17 | * 时间格式化,显示年月日 18 | */ 19 | Vue.filter('fulldaytime', function (value, format) { 20 | return (new Date(value)).Format(format || 'yyyy-MM-dd') 21 | }) 22 | /** 23 | * 时间格式化,只显示月日 24 | */ 25 | Vue.filter('daytime', function (value, format) { 26 | return (new Date(value)).Format(format || 'MM-dd') 27 | }) 28 | 29 | /** 30 | * 金额格式化 31 | * value 金额,以分为单位 32 | */ 33 | Vue.filter('moneyFormat', function (value, num) { 34 | value = value / 100 // 转换为元 35 | num = num || 2 36 | if (parseFloat(value) > 0) { 37 | var str = parseFloat(value).toFixed(num) 38 | str = str.split('.') 39 | var start = parseFloat(str[0]).toString() 40 | return (str[1] == '00') ? (start) : (start + '.' + (str[1] || '')) 41 | } else { 42 | return 0 43 | } 44 | }) 45 | /** 46 | * 金额格式化(保存不同位小数) 47 | * value 金额,以分为单位 48 | */ 49 | Vue.filter('moneyDecFormat', function (value) { 50 | value = parseFloat(value) 51 | if (isNaN(value)) { 52 | return '' 53 | } 54 | value = value / 100 // 转换为元 55 | if (value > 100) { 56 | value = value.toFixed(0) 57 | return value 58 | } 59 | if (value >= 1 && value <= 10) { 60 | value = value.toFixed(1) 61 | return value 62 | } 63 | if (value < 1) { 64 | value = value.toFixed(2) 65 | return value 66 | } 67 | }) 68 | 69 | /** 70 | * 数值分割显示 71 | * @param:str 数值字符串 72 | * @param:num 分割长度 73 | */ 74 | Vue.filter('numSplit', function (str, num) { 75 | var reg = new RegExp(`(\\w{${num}}(?!(?:\\s|$)))`, 'g') 76 | return str.replace(/[^\d]+/g, '').replace(reg, function (m, p1) { 77 | return p1 + ' ' 78 | }) 79 | }) 80 | 81 | /** 82 | * 数值分割显示 sync 83 | * @param:str 数值字符串 84 | * @param:num 分割长度 85 | */ 86 | Vue.filter('numSplitSync', { 87 | read: function (str, num) { 88 | var reg = new RegExp(`(\\w{${num}}(?!(?:\\s|$)))`, 'g') 89 | var newStr = str.replace(/[^\d]+/g, '').replace(reg, function (m, p1) { 90 | return p1 + ' ' 91 | }) 92 | return newStr 93 | }, 94 | write: function (str, num) { 95 | return str.replace(/\s+/g, '') 96 | } 97 | }) 98 | 99 | /** 100 | * 非法输入过滤 sync 101 | * @param:str 输入字符串 102 | * @param:reg 正则 103 | */ 104 | Vue.filter('strFilterSync', { 105 | read: function (str, reg) { 106 | if (reg && typeof reg === 'string') { 107 | reg = new RegExp(reg, 'g') 108 | } 109 | return str.replace(reg, '') 110 | }, 111 | write: function (str, num) { 112 | return str 113 | } 114 | }) 115 | 116 | /** 117 | * 加单位 如果为0,则为空 118 | */ 119 | Vue.filter('unitFormat', function (num, unit) { 120 | return num <= 0 || !num ? '' : num + unit 121 | }) 122 | 123 | /** 124 | * 地名修剪 125 | */ 126 | Vue.filter('trimDest', function (dest, pattern) { 127 | pattern = new RegExp(pattern || '[省市区县]', 'g') 128 | return dest.replace(pattern, '') 129 | }) 130 | 131 | /* 132 | ** reg replace helper 133 | **/ 134 | 135 | Vue.filter('regReplace', function (value, regStr, target) { 136 | var reg = new RegExp(regStr, 'g') 137 | return (value || '').replace(reg, target) 138 | }) 139 | 140 | /* 141 | ** reg replace helper 142 | **/ 143 | 144 | Vue.filter('imageDefault', function (value) { 145 | value = value || 'http://fl5.gtimg.com/flpartition0/7088/631007088/564/3744770553906093122431120144653.png!t160x240.png' 146 | return value 147 | }) 148 | -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- 1 | import cloneDeep from 'lodash/cloneDeep' 2 | import common from '../assets/js/common' 3 | 4 | /** 5 | * 6 | * @param context 7 | */ 8 | export const initComponentList = ({ 9 | commit 10 | }, node) => { 11 | commit('initComponentList', node) 12 | } 13 | export const SettingChange = ({ 14 | commit 15 | }, node) => { 16 | commit('SettingChange', node) 17 | } 18 | 19 | export const setConfig = ({ 20 | commit 21 | }, cfg) => { 22 | commit('SET_CONFIG', cfg) 23 | } 24 | 25 | export const setUser = ({ 26 | commit 27 | }, user) => { 28 | commit('SET_USER', user) 29 | } 30 | 31 | export const setCurrentPage = ({ 32 | commit, 33 | state 34 | }, page) => { 35 | let info = Object.assign({}, state.pageInfo, { 36 | lastPage: state.pageInfo.currentPage, 37 | currentPage: page 38 | }) 39 | commit('SET_PAGE_INFO', info) 40 | } 41 | 42 | export const setPageInfo = ({ 43 | commit, 44 | state 45 | }, pageInfo) => { 46 | let info = Object.assign({}, state.pageInfo, pageInfo) 47 | commit('SET_PAGE_INFO', info) 48 | } 49 | 50 | export const dataHubSet = ({ 51 | commit, 52 | state 53 | }, { 54 | path, 55 | val 56 | }) => { 57 | let dataHub = cloneDeep(state.DataHub) 58 | common.objectSetByPath(dataHub, path, val) 59 | commit('DATA_HUB_SET', dataHub) 60 | } 61 | 62 | export const setCurrentLayout = ({commit}, type) => { 63 | commit('SET_CURRENT_LAYOUT', type) 64 | } 65 | 66 | export const setPageType = ({commit}, type) => { 67 | commit('SET_PAGE_TYPE', type) 68 | } 69 | -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | export const getMetadata = state => state.Metadata 2 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import Metadata from 'src/store/metadata' 4 | import * as actions from './actions' 5 | import * as getters from './getters' 6 | import * as mutations from './mutations' 7 | let Config = require('../config/index') 8 | 9 | const debug = process.env.NODE_ENV !== 'production' 10 | 11 | if (debug) Vue.use(Vuex) 12 | var nodeInfo = {} 13 | 14 | const state = { 15 | app: { 16 | userInfo: {} 17 | }, 18 | setting: Object.assign({ 19 | demoMode: false, 20 | phoneSize: { 21 | name: 'Mobile S', 22 | width: '320px', 23 | height: '500px' 24 | }, 25 | open: true, // 网格开关 26 | line: true, // 智能参考线显示 27 | color: '#409EFF', // 参考线颜色 28 | phoneline: true, // 手机框 29 | sorb: true // 是否拖拽吸附 30 | }, (() => { 31 | let editorSetting = {} 32 | try { 33 | editorSetting = JSON.parse(window.localStorage.getItem('EditorSetting')) || {} 34 | } catch (error) {} 35 | delete editorSetting.phoneSize 36 | delete editorSetting.demoMode 37 | return editorSetting 38 | })()), 39 | RootNodeInfo: nodeInfo, 40 | componentList: {}, 41 | componentMap: {}, 42 | pageInfo: { 43 | lastPage: '', 44 | currentPage: '' 45 | }, 46 | DataHub: {}, 47 | Config, 48 | Metadata, 49 | viewOption: { 50 | currentLayout: (() => window.localStorage.getItem('dockLayout_type') || 'default')(), 51 | pageType: 0, 52 | layouts: [ 53 | { 54 | type: 'default', 55 | name: '默认布局' 56 | }, 57 | { 58 | type: 'desktop', 59 | name: 'PC 布局' 60 | }, 61 | { 62 | type: 'flutter', 63 | name: 'flutter布局' 64 | }, 65 | { 66 | type: 'develop', 67 | name: '开发者布局' 68 | }, 69 | { 70 | type: 'custom', 71 | name: '自定义' 72 | } 73 | ], 74 | widgets: { 75 | 'widgetComponent': '组件列表', 76 | 'widgetCombinedComponents': '组合组件', 77 | 'widgetComponentTree': '组件树', 78 | 'widgetPageTemplate': '页面模板', 79 | 'widgetScene': '场景', 80 | 'widgetComponentInfo': '组件详情', 81 | 'widgetPageInfo': '页面设置', 82 | 'widgetAttribute': '属性', 83 | 'widgetStyleEditor': '样式', 84 | 'widgetScriptEditor': '脚本', 85 | 'widgetAnimate': '动画', 86 | 'widgetCodePanel': '脚本编辑', 87 | 'widgetShop': '商城' 88 | } 89 | } 90 | } 91 | 92 | export default new Vuex.Store({ 93 | strict: debug, 94 | state, 95 | actions, 96 | getters, 97 | mutations 98 | }) 99 | -------------------------------------------------------------------------------- /src/store/mutations.js: -------------------------------------------------------------------------------- 1 | export const initComponentList = function (state, node) { 2 | state.componentList = node || {} 3 | var componentMap = {} 4 | // 对组件列表扁平化 5 | for (const key in node) { 6 | const element = node[key] 7 | element.child.forEach(value => { 8 | if (componentMap[value.name]) { 9 | console.error('存在组件名字相同的组件', value.name) 10 | } else { 11 | componentMap[value.name] = value 12 | } 13 | }) 14 | } 15 | state.componentMap = componentMap 16 | } 17 | export const SettingChange = function (state, node) { 18 | Object.assign(state.setting, node) 19 | window.localStorage.setItem('EditorSetting', JSON.stringify(state.setting)) 20 | } 21 | 22 | export const SET_CONFIG = function (state, cfg) { 23 | state.Config = cfg 24 | } 25 | 26 | export const SET_USER = function (state, user) { 27 | state.app.userInfo = user 28 | } 29 | 30 | export const SET_PAGE_INFO = function (state, info) { 31 | state.pageInfo = info 32 | } 33 | 34 | export const DATA_HUB_SET = function (state, info) { 35 | state.DataHub = info 36 | } 37 | 38 | export const SET_CURRENT_LAYOUT = (state, payload) => { 39 | state.viewOption.currentLayout = payload 40 | } 41 | 42 | export const SET_PAGE_TYPE = (state, payload) => { 43 | state.viewOption.pageType = payload 44 | } 45 | -------------------------------------------------------------------------------- /src/transitions/collapse-transition.js: -------------------------------------------------------------------------------- 1 | import { addClass, removeClass } from '../assets/js/dom' 2 | 3 | class Transition { 4 | beforeEnter (el) { 5 | addClass(el, 'collapse-transition') 6 | if (!el.dataset) el.dataset = {} 7 | 8 | el.dataset.oldPaddingTop = el.style.paddingTop 9 | el.dataset.oldPaddingBottom = el.style.paddingBottom 10 | 11 | el.style.height = '0' 12 | el.style.paddingTop = 0 13 | el.style.paddingBottom = 0 14 | } 15 | 16 | enter (el) { 17 | el.dataset.oldOverflow = el.style.overflow 18 | if (el.scrollHeight !== 0) { 19 | el.style.height = el.scrollHeight + 'px' 20 | el.style.paddingTop = el.dataset.oldPaddingTop 21 | el.style.paddingBottom = el.dataset.oldPaddingBottom 22 | } else { 23 | el.style.height = '' 24 | el.style.paddingTop = el.dataset.oldPaddingTop 25 | el.style.paddingBottom = el.dataset.oldPaddingBottom 26 | } 27 | 28 | el.style.overflow = 'hidden' 29 | } 30 | 31 | afterEnter (el) { 32 | // for safari: remove class then reset height is necessary 33 | removeClass(el, 'collapse-transition') 34 | el.style.height = '' 35 | el.style.overflow = el.dataset.oldOverflow 36 | } 37 | 38 | beforeLeave (el) { 39 | if (!el.dataset) el.dataset = {} 40 | el.dataset.oldPaddingTop = el.style.paddingTop 41 | el.dataset.oldPaddingBottom = el.style.paddingBottom 42 | el.dataset.oldOverflow = el.style.overflow 43 | 44 | el.style.height = el.scrollHeight + 'px' 45 | el.style.overflow = 'hidden' 46 | } 47 | 48 | leave (el) { 49 | if (el.scrollHeight !== 0) { 50 | // for safari: add class after set height, or it will jump to zero height suddenly, weired 51 | addClass(el, 'collapse-transition') 52 | el.style.height = 0 53 | el.style.paddingTop = 0 54 | el.style.paddingBottom = 0 55 | } 56 | } 57 | 58 | afterLeave (el) { 59 | removeClass(el, 'collapse-transition') 60 | el.style.height = '' 61 | el.style.overflow = el.dataset.oldOverflow 62 | el.style.paddingTop = el.dataset.oldPaddingTop 63 | el.style.paddingBottom = el.dataset.oldPaddingBottom 64 | } 65 | } 66 | 67 | export default { 68 | name: 'MCollapseTransition', 69 | functional: true, 70 | render (h, { children }) { 71 | const data = { 72 | on: new Transition() 73 | } 74 | 75 | return h('transition', data, children) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "skipLibCheck": true, 4 | "declaration": true, 5 | "declarationMap": true, 6 | "noImplicitAny": true, 7 | "noEmitOnError": false, 8 | "noImplicitThis": true, 9 | "noUnusedLocals": true, 10 | "strictNullChecks": true, 11 | "experimentalDecorators": true, 12 | "emitDecoratorMetadata": true, 13 | "downlevelIteration": true, 14 | "module": "commonjs", 15 | "moduleResolution": "node", 16 | "target": "es5", 17 | "jsx": "react", 18 | "lib": [ 19 | "es6", 20 | "dom" 21 | ], 22 | "sourceMap": true, 23 | /** 24 | * #6: fix Intellisense and go to definition for absolute path 25 | * here you can learn more those links: 26 | * 1. https://code.visualstudio.com/docs/languages/jsconfig 27 | * 2. https://github.com/vuejs/vetur/blob/master/docs/setup.md#path-mapping 28 | * 3. https://github.com/vuejs/vetur/issues/423#issuecomment-340235722 29 | */ 30 | // see more: https://github.com/vuejs/vetur/blob/master/docs/setup.md#path-mapping 31 | // This must be specified if "paths" is set 32 | "baseUrl": ".", 33 | // Relative to "baseUrl" 34 | "paths": { 35 | "src/*": ["./src/*"], 36 | } 37 | }, 38 | "plugins": [{ 39 | "name": "tslint-language-service" 40 | }], 41 | "include": [ 42 | "src/components/code/**/*" 43 | ], 44 | "exclude": [ 45 | "node_modules", 46 | "**/*.spec.ts" 47 | ] 48 | } -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin') 3 | const config = require('./src/config/index') 4 | 5 | let page 6 | switch (process.env.PAGE) { 7 | case 'CLIENT': 8 | page = { 9 | entry: 'src/client.js', 10 | template: 'src/client.tpl', 11 | outputDir: `dist/${config.VIEW_NAME || 'view'}`, 12 | publicPath: '/' + config.VIEW_NAME, 13 | port: 8566, 14 | } 15 | break 16 | case 'EDITOR': 17 | default: 18 | page = { 19 | entry: 'src/editor.js', 20 | template: 'src/editor.tpl', 21 | outputDir: `dist/${config.EDITOR_NAME || 'editor'}`, 22 | publicPath: '/' + config.EDITOR_NAME, 23 | title: config.EDITOR_TITLE, 24 | port: 8565, 25 | externals: { 26 | 'plupload': 'plupload', 27 | }, 28 | alias: { 29 | 'onigasm.wasm': path.join(__dirname, './node_modules/onigasm/lib/onigasm.wasm'), 30 | }, 31 | plugins: [new MonacoWebpackPlugin()] 32 | } 33 | } 34 | 35 | const configureWebpack = { 36 | resolve: { 37 | alias: Object.assign({ 38 | 'src': path.join(__dirname, 'src') 39 | }, page.alias || {}) 40 | }, 41 | externals: Object.assign({ 42 | 'FastClick': 'FastClick', 43 | 'html2canvas': 'html2canvas' 44 | }, page.externals || {}), 45 | plugins: page.plugins || [] 46 | } 47 | 48 | if (process.env.NODE_ENV === 'production') { 49 | configureWebpack.externals.vue = 'Vue' 50 | configureWebpack.externals['vue-router'] = 'VueRouter' 51 | configureWebpack.externals.vuex = 'Vuex' 52 | } 53 | 54 | module.exports = { 55 | publicPath: page.publicPath, 56 | assetsDir: 'static', 57 | outputDir: page.outputDir, 58 | lintOnSave: process.env.NODE_ENV !== 'production', 59 | productionSourceMap: process.env.NODE_ENV !== 'production', 60 | pages: { 61 | index: { 62 | filename: 'index.html', 63 | entry: page.entry, 64 | template: page.template, 65 | title: page.title, 66 | hmid: config.BAIDU_TONGJI 67 | } 68 | }, 69 | devServer: { 70 | disableHostCheck: true, 71 | port: page.port, 72 | publicPath: '/', 73 | historyApiFallback: true 74 | }, 75 | configureWebpack: configureWebpack, 76 | chainWebpack: config => { 77 | config.plugins.delete('preload-index') 78 | config.plugins.delete('prefetch-index') 79 | 80 | config.plugin('define').tap(args => { 81 | args[0]['process.env'].CODE_ENV = JSON.stringify(process.env.CODE_ENV) 82 | return args 83 | }) 84 | config.module 85 | .rule('wasm') 86 | .test(/\.wasm$/) 87 | .use('file-loader') 88 | .loader('file-loader') 89 | .tap(options => { 90 | return { 91 | limit: 0 92 | } 93 | }) 94 | } 95 | } --------------------------------------------------------------------------------