mirror of
https://github.com/OBKoro1/autoCommit.git
synced 2024-11-25 11:59:23 +08:00
webview init
This commit is contained in:
parent
a6b5f3d039
commit
af14a9fb8c
@ -5,6 +5,7 @@
|
||||
<!-- TODO: package.json 抄一下 -->
|
||||
<!-- TODO: wiki readme -->
|
||||
<!-- TODO: npm包形式 -->
|
||||
<!-- webview 的icon -->
|
||||
|
||||
### [V1.0.0]
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
@font-face {font-family: "iconfont";
|
||||
src: url('iconfont.eot?t=1556172456353'); /* IE9 */
|
||||
src: url('iconfont.eot?t=1556172456353#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAR8AAsAAAAACWQAAAQvAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDSAqFXIRgATYCJAMYCw4ABCAFhG0HVBsSCBEVnKXJvkiwOVdw8wHj5Dy/qawRhsvNcxa0LLb4/g5tR4Nngudzv89zkzxYYFA7K4FAKECFCqFExtVWVgJCtoSy839+f++5X57EBiMZ901KQqJQl5RWN9/Nv9taNJaFeJaGHK75PCqMwjG9v0F/AFyuJYEDYXaq+MiVAAKb+/zB3iT75GtMjX5jC8r1f46lXiZYfjs7l4zgiucpeECRq8LRbA28gYz3fCCyQXeDA33l+yFAMOnoghqa3P3Bx2DvE0CmJ5JiwC9YMB1Mwde7Deca5Dig+GoPjcCx6PvlC2XCAIWjsY/2jDrEQ40FB61k/MfADRBAupwLYBeBBkoBDMhio2cBnWRKIROs/wZDGxCKj8JYbLyVtBOfh/+BgsIOCKGOG2SH/3loDIgL0oRCbEfWAYvHh4CN50OBTZR0a89DF5rTlELZPTK4C26JBXgCkoBNKWWvEIxBoaOE6fxNJEYiSmaYRAKvcDihBQ/ViSeeJSSSztUP4zBWT1e/SWzUrcUkn6AQdfbqgr41QKudmtDgpgyqbxBcq/3xEEvaH0F4rWHLh4YBRWohVXh2rlvs+v72brp5WO4e1+u23gVR+Ro9Dz7cPt73xINuG5Ugt9Z1Q6Kklir3fr5taZMIOkeIPzT5N2OxgDMtEo+Pt/vz6pn6OkyDUFNuQrGBqztuOCu71b71tapYrbjy1j2fuu6Ls0qIWvFGZw3OmOwsdX1QkXXsysu7rb3OU3AU815rt/P4LhGmEa6es+xFECmlIFGgapLiw2vaq8uqg9nMi2tx8+x7oxOEmf39d30loUJoBKJyrbPvT6s3R0fX6XjKRWzsBeXPTMYmymF9RY/5lVDYUdhEqnBwvXEYfdNwqdvLNeDX/9g9QEg8HqZdUVTc5h7/G3DmWn88+W+q1GoT+AltbgHC4nBxPBIhYU5UWXYhRWucCxDyakwDLBpuWiv378YiAIEUKzoGQP+Ed6KHWPUCAR8/tQXQ/9HHP+lnqLwd4x3Ft/3nhxgAHh/QEIwEfAKG+3zUXdPy30gHDhhDbltdo7X2tiKASwUseAEWgrOGvyUQzcdSurjBtSD4xGFQeKSBxicXabCl4BBCObj4VEMwJThdHEIMGWjEBAHFVAIQIpkERTgXQRPJOdJg38Ehni9wiRQyBDMkItcMIV80dmzboWDUIDtgFZXGtfNYXH+FaSMXLi+PWHfovI1DHETl/D6W6JY4wTfThNmAcVTAHngY5jlB5aiOioMac7UUhqbpiQJFRc9Yz7ZDwahBdsAqKk0wn8cqX3+FaSMXrqOlLniHztvFIQ6iAch9TTmo5VEe45tpwmzAOCpgD7gwdzIEVfOmOioOahNS1VKIRpmhmmB7XXGVdeAitrGfg/UiiCGBFDLIwYAUKhvzNi1FvqCJh6VgRtcZVDl5HGhZY3t6AAA=') format('woff2'),
|
||||
url('iconfont.woff?t=1556172456353') format('woff'),
|
||||
url('iconfont.ttf?t=1556172456353') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
|
||||
url('iconfont.svg?t=1556172456353#iconfont') format('svg'); /* iOS 4.1- */
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-back:before {
|
||||
content: "\e600";
|
||||
}
|
||||
|
||||
.icon-signal-dot:before {
|
||||
content: "\e616";
|
||||
}
|
||||
|
||||
.icon-battery:before {
|
||||
content: "\e6ae";
|
||||
}
|
||||
|
||||
.icon-close:before {
|
||||
content: "\e749";
|
||||
}
|
||||
|
||||
.icon-wifi:before {
|
||||
content: "\e618";
|
||||
}
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<!--
|
||||
2013-9-30: Created.
|
||||
-->
|
||||
<svg>
|
||||
<metadata>
|
||||
Created by iconfont
|
||||
</metadata>
|
||||
<defs>
|
||||
|
||||
<font id="iconfont" horiz-adv-x="1024" >
|
||||
<font-face
|
||||
font-family="iconfont"
|
||||
font-weight="500"
|
||||
font-stretch="normal"
|
||||
units-per-em="1024"
|
||||
ascent="896"
|
||||
descent="-128"
|
||||
/>
|
||||
<missing-glyph />
|
||||
|
||||
<glyph glyph-name="back" unicode="" d="M778.831952 796.363984L330.34711787 386.6552064l448.48483413-409.7087776c15.6992224-15.599024 15.6992224-40.92073601 0-56.534256-15.62759147-15.64187521-41.04950187-15.64187521-56.67709333 0L244.8166272 356.34359787000005c-8.33568214 8.33568214-11.91021866 19.41659519-11.3668 30.31182186-0.54341867 10.89501333 3.03111787 21.94735999 11.3668 30.31182187l477.33823147 435.93121174c15.62759147 15.64208747 41.04950187 15.64208747 56.67730559-2e-8C794.5311744 837.29900373 794.5311744 811.963008 778.831952 796.363984z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="signal-dot" unicode="" d="M96 384.00000001m-80 0a80 80 0 1 1 160 0 80 80 0 1 1-160 0ZM304 384.00000001m-80 0a80 80 0 1 1 160 0 80 80 0 1 1-160 0ZM512 384.00000001m-80 0a80 80 0 1 1 160 0 80 80 0 1 1-160 0ZM720 384.00000001m-80 0a80 80 0 1 1 160 0 80 80 0 1 1-160 0ZM928 384.00000001m-80 0a80 80 0 1 1 160 0 80 80 0 1 1-160 0Z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="battery" unicode="" d="M961.8925037 457.30322963v73.30322962c0 40.41386667-31.7970963 73.30322963-70.99733333 73.30322964H97.54548148c-39.20023703 0-70.99733333-32.768-70.99733333-73.30322964v-293.09155555c0-40.53522963 31.7970963-73.30322963 70.99733333-73.30322962h793.22832593c39.20023703 0 70.99733333 32.768 70.99733334 73.30322962v73.30322963c19.6608 0 35.55934815 16.384 35.55934814 36.65161482v73.30322963c0.12136297 20.02488889-15.77718518 36.53025185-35.43798519 36.53025185m-35.43798518-219.78832593c0-20.26761482-15.89854815-36.65161482-35.55934815-36.65161481H97.54548148c-19.6608 0-35.55934815 16.384-35.55934815 36.65161481V530.4850963c0 20.26761482 15.89854815 36.65161482 35.55934815 36.65161481h793.22832593c19.6608 0 35.55934815-16.384 35.55934814-36.65161481v-292.9701926z m0 0M96.33185185 237.5149037v294.912h795.65558518v-294.912H96.33185185z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="close" unicode="" d="M854.54777205 732.59326578a32.62236445 32.62236445 0 1 1-45.72309175-46.52570548c81.788928-80.40377205 126.86475061-187.70804939 126.86475061-302.09345106 0-233.63826725-190.02527289-423.66354015-423.66354015-423.66354015S88.33645985 150.33584197000005 88.33645985 384c0 114.48896475 45.04993185 221.74146053 126.86475062 302.09345106a32.62236445 32.62236445 0 1 1-45.72309175 46.52570547c-94.35889461-92.70188563-146.28282469-216.52447131-146.28282469-348.61915653 0-269.5617043 219.32067397-488.86943289 488.88237827-488.86943289S1000.88237827 114.41240493999999 1000.88237827 384c0 132.0429037-51.97571161 255.80076247-146.33460622 348.59326578zM512 351.4164717A32.60941906 32.60941906 0 0 1 544.60941906 384V840.28590459a32.60941906 32.60941906 0 0 1-65.21883812 0V384A32.60941906 32.60941906 0 0 1 512 351.4164717z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="wifi" unicode="" d="M520.92345605 594.6654742000001c144.86724308 0 284.17775427-55.66536794 389.16728063-155.49040479a20.13497775 20.13497775 0 0 1 28.33932876 0.22880659l75.57153911 76.25795881a20.95214431 20.95214431 0 0 1-0.163434 29.81022785c-275.54847731 264.07546367-710.28095163 264.07546367-985.82942898 0a20.95214431 20.95214431 0 0 1-0.19612119-29.81022785l75.60422631-76.25795881c7.77942322-7.84479575 20.42915685-7.94285725 28.33932873-0.22880659a564.69460348 564.69460348 0 0 0 389.16728063 155.49040479z m0-248.12437839c79.5919976 0 156.34025673-29.58141949 215.33966522-82.99140892a20.2984118 20.2984118 0 0 1 28.33932696 0.35955342l75.47347944 76.2579588a21.11557655 21.11557655 0 0 1-0.32686627 30.00634726c-179.64584102 167.12685247-457.87462459 167.12685247-637.55315099 0a21.14826371 21.14826371 0 0 1-0.29417909-30.00634726l75.4734794-76.2579588a20.2984118 20.2984118 0 0 1 28.33932698-0.35955342 320.98292415 320.98292415 0 0 0 215.20891835 82.99140892z m145.06336249-182.03196461a20.39647147 20.39647147 0 0 1-0.62104716 29.87559858 223.67476128 223.67476128 0 0 1-288.91731782 0 20.62527806 20.62527806 0 0 1-0.62104716-29.87559858l130.58317633-131.75989631a20.42915685 20.42915685 0 0 1 28.96037409 0l130.61586172 131.75989631z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
|
||||
|
||||
</font>
|
||||
</defs></svg>
|
Before Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
src/assets/qrcode.min.js
vendored
1
src/assets/qrcode.min.js
vendored
File diff suppressed because one or more lines are too long
1
src/assets/scripts/element2.13.min.js
vendored
Normal file
1
src/assets/scripts/element2.13.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,65 +0,0 @@
|
||||
@-webkit-keyframes slideLeftIn {
|
||||
0% {
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideLeftIn {
|
||||
0% {
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes slideRightOut {
|
||||
0% {
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideRightOut {
|
||||
0% {
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.slide-left-in {
|
||||
-webkit-animation: slideLeftIn 0.2s forwards;
|
||||
animation: slideLeftIn 0.2s forwards;
|
||||
}
|
||||
|
||||
.slide-right-out {
|
||||
-webkit-animation: slideRightOut 0.2s forwards;
|
||||
animation: slideRightOut 0.2s forwards;
|
||||
}
|
0
src/assets/styles/autoCommit.css
Normal file
0
src/assets/styles/autoCommit.css
Normal file
@ -15,22 +15,3 @@ body {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.flex-fill {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.device-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.device-select {
|
||||
padding: 10px 0 20px;
|
||||
}
|
||||
|
||||
.form-select {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
height: 40px;
|
||||
padding: 8px 12px;
|
||||
/* width: 100%; */
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-select:focus {
|
||||
border-color: #2b90d9;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.device-preview {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.device-preview-head {
|
||||
background-color: #2b2b2b;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.device-navigate-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
.device-navigate-left {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.device-navigate-time {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.device-navigate-right {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.device-navigate-operator {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.icon-signal-dot {
|
||||
font-size: 30px !important;
|
||||
}
|
||||
|
||||
.icon-battery {
|
||||
font-size: 25px !important;
|
||||
}
|
||||
|
||||
.device-navigate-bar {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.navigate-left {
|
||||
}
|
||||
|
||||
.navigate-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.navigate-right {
|
||||
}
|
||||
|
||||
.device-preview-body {
|
||||
border: none;
|
||||
flex: 1;
|
||||
}
|
2
src/assets/styles/element-ui2.13.min.css
vendored
Normal file
2
src/assets/styles/element-ui2.13.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
src/assets/styles/fonts/element-icons.woff
Normal file
BIN
src/assets/styles/fonts/element-icons.woff
Normal file
Binary file not shown.
@ -1,54 +0,0 @@
|
||||
.form-container {
|
||||
padding: 20px 15px;
|
||||
width: 400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.form-head {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.form-input-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
height: 40px;
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: #2b90d9;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.btn-login {
|
||||
padding: 8px 12px;
|
||||
background-color: #2b90d9;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-login:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.btn-login:active {
|
||||
background-color: #a5dff9;
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
#xpLogin {
|
||||
position: relative;
|
||||
}
|
||||
.form-container {
|
||||
padding: 20px 15px;
|
||||
width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.form-head {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
font-weight: bold;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.form-input-group {
|
||||
margin-bottom: 20px;
|
||||
width: 600px;
|
||||
display: flex;
|
||||
}
|
||||
.form-input-group span {
|
||||
width: 100px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
height: 40px;
|
||||
padding: 8px 12px;
|
||||
width: 67%;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: #2b90d9;
|
||||
outline: none;
|
||||
}
|
||||
.exit-enter {
|
||||
position: absolute;
|
||||
right: 10%;
|
||||
top: 5%;
|
||||
background-color: #2b90d9;
|
||||
padding: 8px 12px;
|
||||
width: 100px;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-login {
|
||||
padding: 8px 12px;
|
||||
background-color: #2b90d9;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 67%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.btn-login-loading {
|
||||
background: gray;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-login:focus {
|
||||
outline: none;
|
||||
}
|
||||
.qrcode_info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.qrcode_info div {
|
||||
margin: 8px 0;
|
||||
}
|
||||
.qrcode_father {
|
||||
margin: 50px 0 0 0;
|
||||
padding-bottom: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
#qrcode {
|
||||
padding: 25px;
|
||||
background: #fff;
|
||||
|
||||
}
|
||||
.cursor {
|
||||
cursor: pointer;
|
||||
}
|
@ -2,14 +2,14 @@
|
||||
* Author : OBKoro1
|
||||
* Date : 2019-12-25 15:15:42
|
||||
* LastEditors : OBKoro1
|
||||
* LastEditTime : 2019-12-26 21:00:27
|
||||
* LastEditTime : 2019-12-27 13:27:08
|
||||
* FilePath : /autoCommit/src/extension.ts
|
||||
* Description : 自动commit插件 入口
|
||||
* https://github.com/OBKoro1
|
||||
*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
// import ExtensionLogic from './models/index'
|
||||
import ExtensionLogic from './models/index'
|
||||
import { setExtensionContext } from './util/vscodeUtil'
|
||||
|
||||
|
||||
@ -18,8 +18,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
setExtensionContext(context)
|
||||
|
||||
const autoCommit = vscode.commands.registerCommand('extension.autoCommit', () => {
|
||||
// new ExtensionLogic(context)
|
||||
vscode.window.showInformationMessage('hello koro22333')
|
||||
new ExtensionLogic(context)
|
||||
})
|
||||
|
||||
// 当插件关闭时被清理的可清理列表
|
||||
|
94
src/index.js
94
src/index.js
@ -2,93 +2,97 @@
|
||||
* Author : OBKoro1
|
||||
* Date : 2019-12-19 20:23:57
|
||||
* LastEditors : OBKoro1
|
||||
* LastEditTime : 2019-12-25 15:23:38
|
||||
* LastEditTime : 2019-12-27 15:50:22
|
||||
* FilePath : /autoCommit/src/index.js
|
||||
* Description : 自动commit
|
||||
* https://github.com/OBKoro1
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process')
|
||||
const moment = require('moment')
|
||||
const fs = require('fs')
|
||||
const { execSync } = require('child_process');
|
||||
const moment = require('moment');
|
||||
const fs = require('fs');
|
||||
|
||||
class autoCommit {
|
||||
constructor() {
|
||||
this.init()
|
||||
this.init();
|
||||
}
|
||||
getData() {
|
||||
this.getAllDay(this.paramsObj.beginDay, this.paramsObj.endDay)
|
||||
this.readyCommit()
|
||||
this.getAllDay(this.paramsObj.beginDay, this.paramsObj.endDay);
|
||||
this.readyCommit();
|
||||
}
|
||||
// 格式化日期
|
||||
formatTime(time) {
|
||||
return `${time} 08:00`
|
||||
return `${time} 08:00`;
|
||||
}
|
||||
// 获取两个日期之间的间隔: [ '2019-02-02', '2019-02-03' ... ]
|
||||
getAllDay(begin, end) {
|
||||
this.timeArr = []
|
||||
const beginSplit = begin.split('-')
|
||||
const endSplit = end.split('-')
|
||||
const beginDate = new Date()
|
||||
beginDate.setUTCFullYear(beginSplit[0], beginSplit[1] - 1, beginSplit[2])
|
||||
const endDate = new Date()
|
||||
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2])
|
||||
const beginNumber = beginDate.getTime()
|
||||
const endNumber = endDate.getTime()
|
||||
this.timeArr = [];
|
||||
const beginSplit = begin.split('-');
|
||||
const endSplit = end.split('-');
|
||||
const beginDate = new Date();
|
||||
beginDate.setUTCFullYear(beginSplit[0], beginSplit[1] - 1, beginSplit[2]);
|
||||
const endDate = new Date();
|
||||
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2]);
|
||||
const beginNumber = beginDate.getTime();
|
||||
const endNumber = endDate.getTime();
|
||||
for (let k = beginNumber; k <= endNumber; ) {
|
||||
const day = new Date(parseInt(k))
|
||||
const dayFormat = moment(day).format('YYYY-MM-DD')
|
||||
this.timeArr.push(dayFormat)
|
||||
k = k + 24 * 60 * 60 * 1000
|
||||
const day = new Date(parseInt(k));
|
||||
const dayFormat = moment(day).format('YYYY-MM-DD');
|
||||
this.timeArr.push(dayFormat);
|
||||
k = k + 24 * 60 * 60 * 1000;
|
||||
}
|
||||
}
|
||||
init() {
|
||||
// TODO: 获取参数
|
||||
let paramsObj = {
|
||||
beginDay: '2019-12-20',
|
||||
beginDay: '2019-12-27',
|
||||
itemSrc: '/Users/koro/work/web_my/testCommit' // 要commit的项目地址
|
||||
}
|
||||
};
|
||||
let defaultOption = {
|
||||
beginDay: moment().format('YYYY-MM-DD'), // 默认为今天
|
||||
endDay: moment().format('YYYY-MM-DD'), // 默认为今天
|
||||
fileSrc: `commit.md`,
|
||||
commitNumber: 1 // 每天commit 次数
|
||||
}
|
||||
this.paramsObj = Object.assign(defaultOption, paramsObj)
|
||||
this.getData()
|
||||
};
|
||||
this.paramsObj = Object.assign(defaultOption, paramsObj);
|
||||
this.getData();
|
||||
}
|
||||
// commit
|
||||
readyCommit() {
|
||||
console.log('日期数组:', this.timeArr)
|
||||
console.log('每个日期提交次数:', this.paramsObj.commitNumber)
|
||||
let totalNum = 0 // 总commit次数
|
||||
console.log('日期数组:', this.timeArr);
|
||||
console.log('每个日期提交次数:', this.paramsObj.commitNumber);
|
||||
let totalNum = 0; // 总commit次数
|
||||
// 遍历日期
|
||||
this.timeArr.forEach(item => {
|
||||
// 每个日期commit次数
|
||||
for (let i = 0; i < this.paramsObj.commitNumber; i++) {
|
||||
let time = this.formatTime(item) // 2019-01-02 08:00
|
||||
time = moment(time).format() // 2019-01-02T00:00:00+0800
|
||||
const commitContent = `${time}${i}`
|
||||
let time = this.formatTime(item); // 2019-01-02 08:00
|
||||
time = moment(time).format(); // 2019-01-02T00:00:00+0800
|
||||
const commitContent = `${time}${i}`;
|
||||
fs.writeFileSync(
|
||||
`${this.paramsObj.itemSrc}/${this.paramsObj.fileSrc}`,
|
||||
commitContent,
|
||||
'utf-8'
|
||||
)
|
||||
this.myExecSync(
|
||||
);
|
||||
let res = this.myExecSync(
|
||||
`cd ${this.paramsObj.itemSrc} && git add . && git commit -m 'autoCommit' --date='${time}' && git pull && git push origin master`
|
||||
)
|
||||
);
|
||||
console.log('res 开始', res);
|
||||
console.log('res 结束');
|
||||
let cmd = `git log -1 \
|
||||
--date=iso --pretty=format:'{"commit": "%h","author": "%aN <%aE>","date": "%ad","message": "%s"},' \
|
||||
$@ | \
|
||||
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
|
||||
perl -pe 's/},]/}]/'`
|
||||
this.myExecSync(cmd)
|
||||
this.totalNum++
|
||||
perl -pe 's/},]/}]/'`;
|
||||
let log = this.myExecSync(cmd);
|
||||
console.log('log 开始', log);
|
||||
console.log('log 结束');
|
||||
totalNum++;
|
||||
|
||||
console.log('commit内容', commitContent)
|
||||
console.log(`总commit次数${totalNum}`)
|
||||
console.log('commit内容', commitContent);
|
||||
}
|
||||
})
|
||||
console.log(`总commit次数${totalNum}`);
|
||||
});
|
||||
}
|
||||
|
||||
myExecSync(cmd) {
|
||||
@ -101,12 +105,12 @@ class autoCommit {
|
||||
killSignal: 'SIGTERM',
|
||||
cwd: undefined,
|
||||
env: undefined
|
||||
})
|
||||
return res
|
||||
});
|
||||
return res;
|
||||
} catch (err) {
|
||||
console.log(`执行命令出错:${cmd}`)
|
||||
console.log(`执行命令出错:${cmd}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new autoCommit()
|
||||
new autoCommit();
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Author : OBKoro1
|
||||
* Date : 2019-12-25 17:08:18
|
||||
* LastEditors : OBKoro1
|
||||
* LastEditTime : 2019-12-26 17:41:05
|
||||
* LastEditTime : 2019-12-27 14:40:39
|
||||
* FilePath : /autoCommit/src/models/index.ts
|
||||
* Description : 插件逻辑入口
|
||||
* https://github.com/OBKoro1
|
||||
@ -20,6 +20,7 @@ class ExtensionLogic {
|
||||
public constructor(context: vscode.ExtensionContext) {
|
||||
this.context = context;
|
||||
this.autoCommitView = new WebView(this.context, this.messageCallBack);
|
||||
this.createView()
|
||||
}
|
||||
createView() {
|
||||
const option = {
|
||||
|
18
src/util/util.ts
Normal file
18
src/util/util.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Author : OBKoro1
|
||||
* Date : 2019-12-27 15:55:42
|
||||
* LastEditors : OBKoro1
|
||||
* LastEditTime : 2019-12-27 15:57:54
|
||||
* FilePath : /autoCommit/src/util/util.ts
|
||||
* Description : 公共函数
|
||||
* https://github.com/OBKoro1
|
||||
*/
|
||||
|
||||
// 生成指定范围的随机数
|
||||
function RandomNumber(min: number, max: number): number {
|
||||
return Math.round(Math.random() * (max - min)) + min;
|
||||
}
|
||||
|
||||
export {
|
||||
RandomNumber // 生成指定范围的随机数
|
||||
};
|
@ -1,77 +1,60 @@
|
||||
<!--
|
||||
* @Github: https://github.com/OBKoro1
|
||||
* @Author: OBKoro1
|
||||
* @Date: 2019-06-29 13:27:49
|
||||
* @LastEditors: OBKoro1
|
||||
* @LastEditTime: 2019-11-27 11:32:30
|
||||
* @Description: webview 登录页面
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>晓黑板登录</title>
|
||||
|
||||
<title>Github自动提交commit工具</title>
|
||||
<link href="../assets/styles/element-ui2.13.min.css" rel="stylesheet" />
|
||||
<link href="../assets/styles/base.css" rel="stylesheet" />
|
||||
<link href="../assets/styles/login.css" rel="stylesheet" />
|
||||
<link href="../assets/styles/autoCommit.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="form-container text-center v-cloak" id="xpLogin">
|
||||
<div class="form-head">
|
||||
<p class="form-title">晓黑板账号密码登录</p>
|
||||
</div>
|
||||
<div class="form-input-group">
|
||||
<input ref="elUserName" @keyup.enter="login" type="text" class="form-input" placeholder="一统账号" v-model.number="userName" />
|
||||
</div>
|
||||
<div class="form-input-group">
|
||||
<input ref="elPassword" @keyup.enter="login" type="password" class="form-input" placeholder="一统密码" v-model="password" />
|
||||
</div>
|
||||
<div class="form-input-group">
|
||||
<a href="javascript:;" class="btn-login" @click="login">登录</a>
|
||||
<div id="app">
|
||||
<el-container>
|
||||
<el-header>Header</el-header>
|
||||
<el-main>Main</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script src="../assets/scripts/vue.min.js"></script>
|
||||
<script src="../assets/scripts/element2.13.min.js"></script>
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi()
|
||||
|
||||
const vscode = acquireVsCodeApi();
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
// userName: 18850985993,
|
||||
// password: 'HgbOBKoro1'
|
||||
userName: '',
|
||||
password: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.initListener()
|
||||
this.initListener();
|
||||
},
|
||||
methods: {
|
||||
// 登录
|
||||
login() {
|
||||
const { elUserName, elPassword } = this.$refs
|
||||
const { userName, password } = this.$data
|
||||
const { elUserName, elPassword } = this.$refs;
|
||||
const { userName, password } = this.$data;
|
||||
const formData = {
|
||||
username: String(userName),
|
||||
password: String(password)
|
||||
}
|
||||
};
|
||||
if (!userName) {
|
||||
this.postMessage('用户名不能为空')
|
||||
elUserName.focus()
|
||||
return
|
||||
this.postMessage('用户名不能为空');
|
||||
elUserName.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
this.postMessage('密码不能为空')
|
||||
elPassword.focus()
|
||||
return
|
||||
this.postMessage('密码不能为空');
|
||||
elPassword.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.postMessage('user-login-message', 'event', formData)
|
||||
this.postMessage('user-login-message', 'event', formData);
|
||||
},
|
||||
// 发送消息到插件
|
||||
postMessage(text, command = 'alert', params) {
|
||||
@ -79,23 +62,21 @@
|
||||
command,
|
||||
text,
|
||||
params
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
// 注册
|
||||
initListener() {
|
||||
window.addEventListener('message', event => {
|
||||
console.log('event', event)
|
||||
const { command, data } = event.data
|
||||
console.log('登录成功 addEventListener', event)
|
||||
console.log('event', event);
|
||||
const { command, data } = event.data;
|
||||
console.log('登录成功 addEventListener', event);
|
||||
if (command === 'success') {
|
||||
// 登录成功
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
}
|
||||
}).$mount('#xpLogin')
|
||||
}
|
||||
}).$mount('#xpLogin');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user