├── src ├── store │ ├── mutations-types.js │ ├── modules │ │ └── moduleA.js │ ├── state.js │ ├── getters.js │ ├── actions.js │ ├── index.js │ └── mutations.js ├── assets │ └── css │ │ ├── base.css │ │ └── normalize.css ├── main.js ├── router │ └── index.js ├── views │ └── Index │ │ └── Index.vue ├── App.vue └── common │ └── websocket.js ├── README.md ├── public ├── favicon.ico └── index.html ├── babel.config.js ├── .editorconfig ├── vue-config.js ├── .gitignore ├── package.json └── LICENSE /src/store/mutations-types.js: -------------------------------------------------------------------------------- 1 | export const INCREMENT = 'increment' -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Autojs-Control 2 | 基于AUto.js网页在线云控设备 3 | 4 | 最近在弄其他项目,精力有限,暂时放一边 -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Oct1a/Autojs-Control/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/css/base.css: -------------------------------------------------------------------------------- 1 | @import url('./normalize.css'); 2 | body { 3 | font-size: 20px 4 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /src/store/modules/moduleA.js: -------------------------------------------------------------------------------- 1 | export default { 2 | getName() { 3 | // return $store.state 4 | } 5 | } -------------------------------------------------------------------------------- /src/store/state.js: -------------------------------------------------------------------------------- 1 | export default { 2 | counter: 1000, 3 | info: { 4 | age: 19, 5 | name: 'kebe' 6 | } 7 | } -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | powerCounter: state => state.counter * state.counter, 3 | counterLength: (state, getters) => getters.powerCounter.length, 4 | 5 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /vue-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | configureWebpack: { 3 | resolve: { 4 | alias: { 5 | 'assets': '@/assets', 6 | 'common': '@/common', 7 | 'components': '@/components', 8 | 'network': '@/network', 9 | 'views': '@/views', 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- 1 | export default { 2 | // 异步操作数据,与dispatch配合使用 3 | // context 上下文 4 | updataInfo(context, playload) { 5 | return new Promise((resolve, reject) => { 6 | setTimeout(() => { 7 | context.commit('decrement') 8 | resolve("已经完成") 9 | }, 1000); 10 | }) 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import ElementUI from 'element-ui' 6 | import 'element-ui/lib/theme-chalk/index.css' 7 | 8 | Vue.use(ElementUI) 9 | 10 | 11 | Vue.config.productionTip = false 12 | 13 | new Vue({ 14 | router, 15 | store, 16 | render: h => h(App) 17 | }).$mount('#app') -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | import state from '@/store/state' 5 | import mutations from '@/store/mutations' 6 | import actions from '@/store/actions' 7 | import getters from '@/store/getters' 8 | import moduleA from '@/store/modules/moduleA' 9 | 10 | // 安装VueX插件 11 | Vue.use(Vuex) 12 | 13 | // 2创建对象 14 | const store = new Vuex.Store({ 15 | state, 16 | mutations, 17 | actions, 18 | getters, 19 | modules: { 20 | moduleA 21 | } 22 | }) 23 | 24 | export default store -------------------------------------------------------------------------------- /src/store/mutations.js: -------------------------------------------------------------------------------- 1 | import { INCREMENT } from '@/store/mutations-types.js' //引用常量 2 | 3 | 4 | export default { 5 | [INCREMENT]: state => state.counter++, 6 | decrement: state => state.counter--, 7 | incrementCount: (state, playload) => state.counter += playload.count, 8 | updateState(state) { 9 | // 添加 10 | // state.info['address'] = "洛杉矶" //这种方式无效,无法响应式 11 | Vue.set(state.info, 'address', '洛杉矶') //增加元素 12 | // 删除 13 | // delete state.info.age //这种删除也无法响应式 14 | Vue.delete(state.info, 'age') //删除元素 15 | } 16 | } -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | const Index = () => 5 | import ('../views/Index/Index') 6 | 7 | Vue.use(VueRouter) 8 | 9 | const routes = [{ 10 | path: '/', 11 | name: 'Index', 12 | components: Index 13 | }, 14 | { 15 | path: '/home', 16 | name: 'Index', 17 | components: Index 18 | }, 19 | ] 20 | 21 | const router = new VueRouter({ 22 | mode: 'history', 23 | base: process.env.BASE_URL, 24 | routes 25 | }) 26 | 27 | router.beforeEach((to, from, next) => { 28 | document.title = to.name 29 | next() 30 | }) 31 | 32 | export default router -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Autojs-Control", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "core-js": "^3.6.5", 11 | "element-ui": "^2.14.1", 12 | "vue": "^2.6.11", 13 | "vue-router": "^3.2.0", 14 | "vuex": "^3.4.0" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "~4.5.0", 18 | "@vue/cli-plugin-router": "~4.5.0", 19 | "@vue/cli-plugin-vuex": "~4.5.0", 20 | "@vue/cli-service": "~4.5.0", 21 | "vue-template-compiler": "^2.6.11" 22 | }, 23 | "browserslist": [ 24 | "> 1%", 25 | "last 2 versions", 26 | "not dead" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 YIHONG LIU 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 | -------------------------------------------------------------------------------- /src/views/Index/Index.vue: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 23 | 24 | 53 | -------------------------------------------------------------------------------- /src/common/websocket.js: -------------------------------------------------------------------------------- 1 | import { Message } from 'element-ui' 2 | // import { getToken } from '@/utils/authToken' // 与后端的协商,websocket请求需要带上token参数 3 | let websock = null 4 | let messageCallback = null 5 | let errorCallback = null 6 | let wsUrl = '' 7 | 8 | // 接收ws后端返回的数据 9 | function websocketonmessage(e) { 10 | // messageCallback(JSON.parse(e.data)) 11 | messageCallback(e.data) 12 | } 13 | 14 | /** 15 | * 发起websocket连接 16 | * @param {Object} agentData 需要向后台传递的参数数据 17 | */ 18 | function websocketSend(agentData) { 19 | // 加延迟是为了尽量让ws连接状态变为OPEN 20 | setTimeout(() => { 21 | // 添加状态判断,当为OPEN时,发送消息 22 | if (websock.readyState === websock.OPEN) { // websock.OPEN = 1 23 | // 发给后端的数据需要字符串化 24 | // websock.send(JSON.stringify(agentData)) 25 | websock.send(agentData) 26 | 27 | } 28 | if (websock.readyState === websock.CLOSED) { // websock.CLOSED = 3 29 | console.log('websock.readyState=3') 30 | Message.error('ws连接异常,请稍候重试') 31 | errorCallback() 32 | } 33 | }, 500) 34 | } 35 | 36 | // 关闭ws连接 37 | function websocketclose(e) { 38 | // e.code === 1000 表示正常关闭。 无论为何目的而创建, 该链接都已成功完成任务。 39 | // e.code !== 1000 表示非正常关闭。 40 | if (e && e.code !== 1000) { 41 | Message.error('ws连接异常,请稍候重试') 42 | errorCallback() 43 | } 44 | } 45 | // 建立ws连接 46 | function websocketOpen(e) { 47 | // console.log('ws连接成功') 48 | } 49 | 50 | // 初始化weosocket 51 | function initWebSocket() { 52 | if (typeof(WebSocket) === 'undefined') { 53 | Message.error('您的浏览器不支持WebSocket,无法获取数据') 54 | return false 55 | } 56 | 57 | // const token = 'JWT=' + getToken() 58 | // + '?' + token 59 | // ws请求完整地址 60 | const requstWsUrl = wsUrl 61 | websock = new WebSocket(requstWsUrl) 62 | 63 | websock.onmessage = function(e) { 64 | websocketonmessage(e) 65 | } 66 | websock.onopen = function() { 67 | websocketOpen() 68 | } 69 | websock.onerror = function() { 70 | Message.error('ws连接异常,请稍候重试') 71 | errorCallback() 72 | } 73 | websock.onclose = function(e) { 74 | websocketclose(e) 75 | } 76 | } 77 | 78 | /** 79 | * 发起websocket请求函数 80 | * @param {string} url ws连接地址 81 | * @param {Object} agentData 传给后台的参数 82 | * @param {function} successCallback 接收到ws数据,对数据进行处理的回调函数 83 | * @param {function} errCallback ws连接错误的回调函数 84 | */ 85 | export function sendWebsocket(url, agentData, successCallback, errCallback) { 86 | wsUrl = url 87 | initWebSocket() 88 | messageCallback = successCallback 89 | errorCallback = errCallback 90 | websocketSend(agentData) 91 | } 92 | 93 | /** 94 | * 关闭websocket函数 95 | */ 96 | export function closeWebsocket() { 97 | if (websock) { 98 | websock.close() // 关闭websocket 99 | websock.onclose() // 关闭websocket 100 | } 101 | } -------------------------------------------------------------------------------- /src/assets/css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | 4 | /* Document 5 | ========================================================================== */ 6 | 7 | 8 | /** 9 | * 1. Correct the line height in all browsers. 10 | * 2. Prevent adjustments of font size after orientation changes in iOS. 11 | */ 12 | 13 | html { 14 | line-height: 1.15; 15 | /* 1 */ 16 | -webkit-text-size-adjust: 100%; 17 | /* 2 */ 18 | } 19 | 20 | 21 | /* Sections 22 | ========================================================================== */ 23 | 24 | 25 | /** 26 | * Remove the margin in all browsers. 27 | */ 28 | 29 | body { 30 | margin: 0; 31 | } 32 | 33 | 34 | /** 35 | * Render the `main` element consistently in IE. 36 | */ 37 | 38 | main { 39 | display: block; 40 | } 41 | 42 | 43 | /** 44 | * Correct the font size and margin on `h1` elements within `section` and 45 | * `article` contexts in Chrome, Firefox, and Safari. 46 | */ 47 | 48 | h1 { 49 | font-size: 2em; 50 | margin: 0.67em 0; 51 | } 52 | 53 | 54 | /* Grouping content 55 | ========================================================================== */ 56 | 57 | 58 | /** 59 | * 1. Add the correct box sizing in Firefox. 60 | * 2. Show the overflow in Edge and IE. 61 | */ 62 | 63 | hr { 64 | box-sizing: content-box; 65 | /* 1 */ 66 | height: 0; 67 | /* 1 */ 68 | overflow: visible; 69 | /* 2 */ 70 | } 71 | 72 | 73 | /** 74 | * 1. Correct the inheritance and scaling of font size in all browsers. 75 | * 2. Correct the odd `em` font sizing in all browsers. 76 | */ 77 | 78 | pre { 79 | font-family: monospace, monospace; 80 | /* 1 */ 81 | font-size: 1em; 82 | /* 2 */ 83 | } 84 | 85 | 86 | /* Text-level semantics 87 | ========================================================================== */ 88 | 89 | 90 | /** 91 | * Remove the gray background on active links in IE 10. 92 | */ 93 | 94 | a { 95 | background-color: transparent; 96 | } 97 | 98 | 99 | /** 100 | * 1. Remove the bottom border in Chrome 57- 101 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 102 | */ 103 | 104 | abbr[title] { 105 | border-bottom: none; 106 | /* 1 */ 107 | text-decoration: underline; 108 | /* 2 */ 109 | text-decoration: underline dotted; 110 | /* 2 */ 111 | } 112 | 113 | 114 | /** 115 | * Add the correct font weight in Chrome, Edge, and Safari. 116 | */ 117 | 118 | b, 119 | strong { 120 | font-weight: bolder; 121 | } 122 | 123 | 124 | /** 125 | * 1. Correct the inheritance and scaling of font size in all browsers. 126 | * 2. Correct the odd `em` font sizing in all browsers. 127 | */ 128 | 129 | code, 130 | kbd, 131 | samp { 132 | font-family: monospace, monospace; 133 | /* 1 */ 134 | font-size: 1em; 135 | /* 2 */ 136 | } 137 | 138 | 139 | /** 140 | * Add the correct font size in all browsers. 141 | */ 142 | 143 | small { 144 | font-size: 80%; 145 | } 146 | 147 | 148 | /** 149 | * Prevent `sub` and `sup` elements from affecting the line height in 150 | * all browsers. 151 | */ 152 | 153 | sub, 154 | sup { 155 | font-size: 75%; 156 | line-height: 0; 157 | position: relative; 158 | vertical-align: baseline; 159 | } 160 | 161 | sub { 162 | bottom: -0.25em; 163 | } 164 | 165 | sup { 166 | top: -0.5em; 167 | } 168 | 169 | 170 | /* Embedded content 171 | ========================================================================== */ 172 | 173 | 174 | /** 175 | * Remove the border on images inside links in IE 10. 176 | */ 177 | 178 | img { 179 | border-style: none; 180 | } 181 | 182 | 183 | /* Forms 184 | ========================================================================== */ 185 | 186 | 187 | /** 188 | * 1. Change the font styles in all browsers. 189 | * 2. Remove the margin in Firefox and Safari. 190 | */ 191 | 192 | button, 193 | input, 194 | optgroup, 195 | select, 196 | textarea { 197 | font-family: inherit; 198 | /* 1 */ 199 | font-size: 100%; 200 | /* 1 */ 201 | line-height: 1.15; 202 | /* 1 */ 203 | margin: 0; 204 | /* 2 */ 205 | } 206 | 207 | 208 | /** 209 | * Show the overflow in IE. 210 | * 1. Show the overflow in Edge. 211 | */ 212 | 213 | button, 214 | input { 215 | /* 1 */ 216 | overflow: visible; 217 | } 218 | 219 | 220 | /** 221 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 222 | * 1. Remove the inheritance of text transform in Firefox. 223 | */ 224 | 225 | button, 226 | select { 227 | /* 1 */ 228 | text-transform: none; 229 | } 230 | 231 | 232 | /** 233 | * Correct the inability to style clickable types in iOS and Safari. 234 | */ 235 | 236 | button, 237 | [type="button"], 238 | [type="reset"], 239 | [type="submit"] { 240 | -webkit-appearance: button; 241 | } 242 | 243 | 244 | /** 245 | * Remove the inner border and padding in Firefox. 246 | */ 247 | 248 | button::-moz-focus-inner, 249 | [type="button"]::-moz-focus-inner, 250 | [type="reset"]::-moz-focus-inner, 251 | [type="submit"]::-moz-focus-inner { 252 | border-style: none; 253 | padding: 0; 254 | } 255 | 256 | 257 | /** 258 | * Restore the focus styles unset by the previous rule. 259 | */ 260 | 261 | button:-moz-focusring, 262 | [type="button"]:-moz-focusring, 263 | [type="reset"]:-moz-focusring, 264 | [type="submit"]:-moz-focusring { 265 | outline: 1px dotted ButtonText; 266 | } 267 | 268 | 269 | /** 270 | * Correct the padding in Firefox. 271 | */ 272 | 273 | fieldset { 274 | padding: 0.35em 0.75em 0.625em; 275 | } 276 | 277 | 278 | /** 279 | * 1. Correct the text wrapping in Edge and IE. 280 | * 2. Correct the color inheritance from `fieldset` elements in IE. 281 | * 3. Remove the padding so developers are not caught out when they zero out 282 | * `fieldset` elements in all browsers. 283 | */ 284 | 285 | legend { 286 | box-sizing: border-box; 287 | /* 1 */ 288 | color: inherit; 289 | /* 2 */ 290 | display: table; 291 | /* 1 */ 292 | max-width: 100%; 293 | /* 1 */ 294 | padding: 0; 295 | /* 3 */ 296 | white-space: normal; 297 | /* 1 */ 298 | } 299 | 300 | 301 | /** 302 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 303 | */ 304 | 305 | progress { 306 | vertical-align: baseline; 307 | } 308 | 309 | 310 | /** 311 | * Remove the default vertical scrollbar in IE 10+. 312 | */ 313 | 314 | textarea { 315 | overflow: auto; 316 | } 317 | 318 | 319 | /** 320 | * 1. Add the correct box sizing in IE 10. 321 | * 2. Remove the padding in IE 10. 322 | */ 323 | 324 | [type="checkbox"], 325 | [type="radio"] { 326 | box-sizing: border-box; 327 | /* 1 */ 328 | padding: 0; 329 | /* 2 */ 330 | } 331 | 332 | 333 | /** 334 | * Correct the cursor style of increment and decrement buttons in Chrome. 335 | */ 336 | 337 | [type="number"]::-webkit-inner-spin-button, 338 | [type="number"]::-webkit-outer-spin-button { 339 | height: auto; 340 | } 341 | 342 | 343 | /** 344 | * 1. Correct the odd appearance in Chrome and Safari. 345 | * 2. Correct the outline style in Safari. 346 | */ 347 | 348 | [type="search"] { 349 | -webkit-appearance: textfield; 350 | /* 1 */ 351 | outline-offset: -2px; 352 | /* 2 */ 353 | } 354 | 355 | 356 | /** 357 | * Remove the inner padding in Chrome and Safari on macOS. 358 | */ 359 | 360 | [type="search"]::-webkit-search-decoration { 361 | -webkit-appearance: none; 362 | } 363 | 364 | 365 | /** 366 | * 1. Correct the inability to style clickable types in iOS and Safari. 367 | * 2. Change font properties to `inherit` in Safari. 368 | */ 369 | 370 | ::-webkit-file-upload-button { 371 | -webkit-appearance: button; 372 | /* 1 */ 373 | font: inherit; 374 | /* 2 */ 375 | } 376 | 377 | 378 | /* Interactive 379 | ========================================================================== */ 380 | 381 | 382 | /* 383 | * Add the correct display in Edge, IE 10+, and Firefox. 384 | */ 385 | 386 | details { 387 | display: block; 388 | } 389 | 390 | 391 | /* 392 | * Add the correct display in all browsers. 393 | */ 394 | 395 | summary { 396 | display: list-item; 397 | } 398 | 399 | 400 | /* Misc 401 | ========================================================================== */ 402 | 403 | 404 | /** 405 | * Add the correct display in IE 10+. 406 | */ 407 | 408 | template { 409 | display: none; 410 | } 411 | 412 | 413 | /** 414 | * Add the correct display in IE 10. 415 | */ 416 | 417 | [hidden] { 418 | display: none; 419 | } --------------------------------------------------------------------------------