AutoCommit/src/views/autoCommit.html

107 lines
3.1 KiB
HTML
Raw Normal View History

2019-12-26 17:47:37 +08:00
<!DOCTYPE html>
<html>
2019-12-27 16:02:37 +08:00
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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/autoCommit.css" rel="stylesheet" />
</head>
2019-12-26 17:47:37 +08:00
2019-12-27 16:02:37 +08:00
<body>
<div id="app">
2019-12-27 17:05:55 +08:00
<div class="form-title">Github自动提交commit工具</div>
2019-12-27 16:02:37 +08:00
<el-container>
2019-12-27 17:05:55 +08:00
<el-main>
<!-- TODO: tip -->
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="项目地址" class="form_item" prop="itemSrc">
<div>{{ form.itemSrc }}</div>
</el-form-item>
</el-form>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="commit次数" class="form_item" prop="commitNumber">
<el-input-number v-model="form.commitNumber" :min="1" :max="100" size="mini" ></el-input-number>
</el-form-item>
</el-form>
</el-main>
2019-12-27 16:02:37 +08:00
</el-container>
2019-12-26 17:47:37 +08:00
</div>
</div>
2019-12-27 16:02:37 +08:00
</body>
2019-12-26 17:47:37 +08:00
<script src="../assets/scripts/vue.min.js"></script>
2019-12-27 16:02:37 +08:00
<script src="../assets/scripts/element2.13.min.js"></script>
2019-12-26 17:47:37 +08:00
<script>
new Vue({
2019-12-27 16:02:37 +08:00
el: '#app',
2019-12-26 17:47:37 +08:00
data() {
return {
2019-12-27 17:05:55 +08:00
form: {
// itemSrc: '/Users/koro/work/web_my/testCommit',
itemSrc: '点击选择要commit的项目文件夹',
timeArr: [
],
commitNumber: 1,
},
rules: {
itemSrc: [
{
required: true
}
]
}
2019-12-27 16:02:37 +08:00
};
2019-12-26 17:47:37 +08:00
},
mounted() {
2019-12-27 17:05:55 +08:00
// this.initListener();
2019-12-26 17:47:37 +08:00
},
methods: {
// 登录
login() {
2019-12-27 16:02:37 +08:00
const { elUserName, elPassword } = this.$refs;
const { userName, password } = this.$data;
2019-12-26 17:47:37 +08:00
const formData = {
username: String(userName),
password: String(password)
2019-12-27 16:02:37 +08:00
};
2019-12-26 17:47:37 +08:00
if (!userName) {
2019-12-27 16:02:37 +08:00
this.postMessage('用户名不能为空');
elUserName.focus();
return;
2019-12-26 17:47:37 +08:00
}
if (!password) {
2019-12-27 16:02:37 +08:00
this.postMessage('密码不能为空');
elPassword.focus();
return;
2019-12-26 17:47:37 +08:00
}
2019-12-27 16:02:37 +08:00
this.postMessage('user-login-message', 'event', formData);
2019-12-26 17:47:37 +08:00
},
// 发送消息到插件
postMessage(text, command = 'alert', params) {
vscode.postMessage({
command,
text,
params
2019-12-27 16:02:37 +08:00
});
2019-12-26 17:47:37 +08:00
},
// 注册
initListener() {
window.addEventListener('message', event => {
2019-12-27 16:02:37 +08:00
console.log('event', event);
const { command, data } = event.data;
console.log('登录成功 addEventListener', event);
2019-12-26 17:47:37 +08:00
if (command === 'success') {
// 登录成功
}
2019-12-27 16:02:37 +08:00
});
}
2019-12-26 17:47:37 +08:00
}
2019-12-27 16:02:37 +08:00
}).$mount('#xpLogin');
2019-12-26 17:47:37 +08:00
</script>
2019-12-27 16:02:37 +08:00
</html>