index.vue
3.71 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<div class="app-container authorize">
<el-card class="box-card" style="width: 30vw">
<div slot="header" class="clearfix">
<span>授权信息</span>
</div>
<el-descriptions :column="1" border>
<el-descriptions-item
label-class-name="descriptions-label"
label="公司软件"
>{{ customName }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
label="授权版本"
>{{ customRole }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
label="到期时间"
>{{ expireTime }}
</el-descriptions-item>
<el-descriptions-item
label-class-name="descriptions-label"
label="许可证"
><el-tag :type="isValid ? 'success' : 'danger'">{{
isValid ? "有效" : "无效"
}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label-class-name="descriptions-label" label=""
><el-button type="primary" size="mini" @click="btnOpenAuthorize"
>更新授权</el-button
>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card
v-show="isShow"
class="box-card"
style="width: 30vw; margin-top: 10px"
>
<div slot="header" class="clearfix">
<span>导入授权</span>
</div>
<el-descriptions :column="1" border>
<el-descriptions-item
label-class-name="descriptions-label"
label="授权录入"
><el-input type="textarea" v-model="authorize"></el-input>
</el-descriptions-item>
<el-descriptions-item label-class-name="descriptions-label" label=""
><el-button type="primary" size="mini" @click="btnUpdAuthorize"
>更新</el-button
><el-button type="primary" size="mini" plain @click="btnCancel"
>取消</el-button
>
</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
</template>
<script>
import { getLicense, importLicense } from "@/api/user";
import { formatTime, showMsg } from "@/utils/index.js";
export default {
data() {
return {
customName: "",
customRole: "",
expireTime: "",
isValid: false,
authorize: "",
isShow: false,
};
},
mounted() {
this.loadLicense();
},
methods: {
loadLicense() {
getLicense().then((response) => {
this.customName = response.data.customName;
this.customRole = response.data.customRole;
this.expireTime = formatTime(
new Date(response.data.expireTime),
"{y}-{m}-{d} {h}:{i}:{s}"
);
this.isValid = response.code === "Success";
});
},
btnOpenAuthorize() {
this.isShow = true;
},
btnUpdAuthorize() {
if (this.authorize.trim() == "") {
showMsg("授权信息不能为空,请录入!", false);
return;
}
importLicense(this.authorize).then((response) => {
if (response.code === "Success") {
showMsg("授权成功!");
this.authorize = "";
this.isShow = false;
} else {
showMsg("授权失败,请检查授权信息!");
}
});
},
btnCancel() {
this.authorize = "";
this.isShow = false;
},
},
};
</script>
<style scoped>
.grid-content {
padding-top: 40px;
color: #333333;
}
.el-col {
line-height: 36px;
}
.el-tag {
font-size: 14px;
}
</style>
<style>
.authorize {
.descriptions-label {
text-align: right !important;
/* color:black !important; */
}
.el-textarea__inner {
min-height: 200px !important;
}
}
</style>