he wei
2025-04-23 b9bd29a1a81f6f7de479e3cc3fdfe3d85fc660bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
  <div class="params-container">
    <el-steps :active="active" finish-status="success" simple>
      <el-step title="插入ukey">123</el-step>
      <el-step title="ukey验证"></el-step>
      <el-step title="用户验证"></el-step>
      <el-step title="绑定状态"></el-step>
    </el-steps>
    <div class="el-step" v-if="active == 1">
      <div class="el-step-text-content">未插入ukey,请插入ukey</div>
    </div>
    <bind-step2 :id="id" @next="next" v-if="active == 2"></bind-step2>
    <bind-step3 :id="id" @next="next" v-if="active == 3"></bind-step3>
    <div class="params-dialog" v-if="active == 4">
      <div class="el-step-text-content">已完成绑定</div>
      <div class="form-footer">
        <el-button type="primary" @click="close">关闭</el-button>
      </div>
    </div>
  </div>
</template>
 
<script setup name="UkeyBind">
import BindStep2 from "./BindStep2";
import BindStep3 from "./BindStep3";
 import {ref, watch} from "vue";
import { useUKeyStore } from '@/store/ukey';
import { storeToRefs } from 'pinia';
 const ukeyStore = useUKeyStore();
 const { id, isIn } = storeToRefs(ukeyStore);
 const props = defineProps({
   visible: {
     type: Boolean,
     default: false
   }
 });
 
 const active = ref(isIn.value ? 2 : 1);
 const emit = defineEmits(["update:visible"]);
 
 watch(
   () => id.value,
   () => {
     if (id.value) {
       active.value = 2;
     } else {
       active.value = 1;
     }
   },
   { immediate: true }
 );
 
 function next() {
   active.value++;
 }
 
 function close() {
   emit("update:visible", false);
 }
 
</script>
 
<style scoped>
.params-container {
  padding: 8px 8px 0 8px;
  background-color: #ececec;
}
.form-footer {
  text-align: right;
}
.el-step-text-content {
  padding: 8px;
  text-align: center;
  font-size: 16px;
}
</style>