OSDN Git Service

change readme
[bytom/Byone.git] / src / popup / login / components / form-addon.vue
1
2 <style scoped>
3 </style>
4
5 <template>
6     <div class="warp bg-gray">
7         <section class="login-header bg-green">
8             <img src="../../../assets/logo.png">
9         </section>
10         <section class="login-content">
11             <h4>创建账户</h4>
12             <div class="form">
13                 <div class="form-item">
14                     <label class="form-item-label">选择网络</label>
15                     <div class="form-item-content" style="margin-left: 60px;">
16                         <select name="" id="">
17                             <!-- <option value="BYTOM主网络">BYTOM主网络</option> -->
18                             <option value="BYTOM测试网络">BYTOM测试网络</option>
19                         </select>
20                     </div>
21                 </div>
22                 <div class="form-item">
23                     <label class="form-item-label">账户别名</label>
24                     <div class="form-item-content" style="margin-left: 60px;">
25                         <input type="text" v-model="formItem.accAlias" autofocus>
26                     </div>
27                 </div>
28                 <div class="form-item">
29                     <label class="form-item-label">密钥别名</label>
30                     <div class="form-item-content" style="margin-left: 60px;">
31                         <input type="text" v-model="formItem.keyAlias">
32                     </div>
33                 </div>
34                 <div class="form-item">
35                     <label class="form-item-label">密钥密码</label>
36                     <div class="form-item-content" style="margin-left: 60px;">
37                         <input type="password" v-model="formItem.passwd1">
38                     </div>
39                 </div>
40                 <div class="form-item">
41                     <label class="form-item-label">重复密码</label>
42                     <div class="form-item-content" style="margin-left: 60px;">
43                         <input type="password" v-model="formItem.passwd2">
44                     </div>
45                 </div>
46                 <div class="btn-group">
47                     <div class="btn bg-green" @click="create">创建账户</div>
48                     <div class="btn bg-green" @click="recover">从种子导入</div>
49                 </div>
50             </div>
51         </section>
52     </div>
53 </template>
54
55 <script>
56 import bytom from "../../script/bytom";
57 export default {
58   name: "",
59   data() {
60     return {
61       formItem: {}
62     };
63   },
64   methods: {
65     create: function() {
66       if (this.formItem.passwd1 != this.formItem.passwd2) {
67         this.tips = "两次密码不一致,请检查后再试。";
68         return;
69       }
70
71       bytom.Account.create(
72         this.formItem.accAlias,
73         this.formItem.keyAlias,
74         this.formItem.passwd1
75       )
76         .then(res => {
77           console.log(111, res);
78
79         //   this.$emit("success");
80           window.location.reload();
81           this.formItem = {};
82         })
83         .catch(err => {
84           console.log(err);
85           alert(err);
86         });
87     },
88     recover: function() {
89       this.$emit("next");
90     }
91   },
92   mounted() {
93     console.log(21);
94   }
95 };
96 </script>