AutoCommit/src/views/autoCommit.html
2019-12-27 17:05:55 +08:00

107 lines
3.1 KiB
HTML

<!DOCTYPE html>
<html>
<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>
<body>
<div id="app">
<div class="form-title">Github自动提交commit工具</div>
<el-container>
<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>
</el-container>
</div>
</div>
</body>
<script src="../assets/scripts/vue.min.js"></script>
<script src="../assets/scripts/element2.13.min.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
form: {
// itemSrc: '/Users/koro/work/web_my/testCommit',
itemSrc: '点击选择要commit的项目文件夹',
timeArr: [
],
commitNumber: 1,
},
rules: {
itemSrc: [
{
required: true
}
]
}
};
},
mounted() {
// this.initListener();
},
methods: {
// 登录
login() {
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;
}
if (!password) {
this.postMessage('密码不能为空');
elPassword.focus();
return;
}
this.postMessage('user-login-message', 'event', formData);
},
// 发送消息到插件
postMessage(text, command = 'alert', params) {
vscode.postMessage({
command,
text,
params
});
},
// 注册
initListener() {
window.addEventListener('message', event => {
console.log('event', event);
const { command, data } = event.data;
console.log('登录成功 addEventListener', event);
if (command === 'success') {
// 登录成功
}
});
}
}
}).$mount('#xpLogin');
</script>
</html>