|
@@ -1,271 +0,0 @@
|
|
-<template>
|
|
|
|
- <div>
|
|
|
|
- <div class="tw-bg-white tw-p-5 tw-rounded-xl">
|
|
|
|
- <h3 class="section-title">授权信息</h3>
|
|
|
|
- <div>
|
|
|
|
- <a-form :labelCol="{ span: 4 }">
|
|
|
|
- <a-form-item label="当前信息">
|
|
|
|
- <span>{{ info.activation }}</span>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item label="人数限制">
|
|
|
|
- <span>{{ info.maxCount }}</span>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item label="当前人数">
|
|
|
|
- <span>{{ info.onlineCount }}</span>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item label="过期时间">
|
|
|
|
- <span>{{ info.expire }}</span>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item label="授权模式">
|
|
|
|
- <span>{{ info.type }}</span>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-form>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <div class="tw-bg-white tw-p-5 tw-rounded-xl">
|
|
|
|
- <a-form
|
|
|
|
- ref="form"
|
|
|
|
- class="padding-tb-20 form-tight"
|
|
|
|
- :rules="rules"
|
|
|
|
- :model="form"
|
|
|
|
- label-width="150px"
|
|
|
|
- >
|
|
|
|
- <a-form-item label="授权模式">
|
|
|
|
- <a-select v-model="form.type" class="input">
|
|
|
|
- <a-select-option label="在线激活" value="ONLINE"></a-select-option>
|
|
|
|
- <a-select-option label="离线激活" value="OFFLINE"></a-select-option>
|
|
|
|
- </a-select>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item
|
|
|
|
- v-show="form.type == 'ONLINE'"
|
|
|
|
- label="密匙"
|
|
|
|
- class="input"
|
|
|
|
- maxlength="255"
|
|
|
|
- prop="accessKey"
|
|
|
|
- >
|
|
|
|
- <a-input v-model="form.accessKey" maxlength="255" />
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item
|
|
|
|
- v-show="form.type == 'ONLINE'"
|
|
|
|
- label="密钥"
|
|
|
|
- maxlength="255"
|
|
|
|
- class="input"
|
|
|
|
- prop="accessSecret"
|
|
|
|
- >
|
|
|
|
- <a-input v-model="form.accessSecret" maxlength="255" />
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item v-show="form.type == 'OFFLINE'" label="导入授权文件">
|
|
|
|
- <a-upload
|
|
|
|
- ref="upload"
|
|
|
|
- class="form_left"
|
|
|
|
- accept=".lic"
|
|
|
|
- :action="uploadAction"
|
|
|
|
- :headers="uploadHeaders"
|
|
|
|
- :data="uploadData"
|
|
|
|
- :on-success="uploadSuccess"
|
|
|
|
- :on-error="uploadError"
|
|
|
|
- :file-list="fileList"
|
|
|
|
- :auto-upload="false"
|
|
|
|
- :multiple="false"
|
|
|
|
- >
|
|
|
|
- <a-button
|
|
|
|
- slot="trigger"
|
|
|
|
- size="small"
|
|
|
|
- type="primary"
|
|
|
|
- icon="icon icon-search-white"
|
|
|
|
- >
|
|
|
|
- 选择文件
|
|
|
|
- </a-button>
|
|
|
|
- </a-upload>
|
|
|
|
- </a-form-item>
|
|
|
|
- <a-form-item label=" ">
|
|
|
|
- <el-button
|
|
|
|
- v-show="form.type == 'OFFLINE'"
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- @click="exportFile"
|
|
|
|
- >导出硬件信息</el-button
|
|
|
|
- >
|
|
|
|
- <el-button type="primary" size="small" @click="submitForm"
|
|
|
|
- >保存</el-button
|
|
|
|
- >
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-form>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
-export default {
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- uploadAction: QUESTION_API + "/system/auth/offline",
|
|
|
|
- uploadHeaders: {},
|
|
|
|
- uploadData: {},
|
|
|
|
- fileList: [],
|
|
|
|
- info: {
|
|
|
|
- activation: "",
|
|
|
|
- expire: "",
|
|
|
|
- type: "",
|
|
|
|
- maxCount: "",
|
|
|
|
- onlineCount: 0,
|
|
|
|
- },
|
|
|
|
- form: {
|
|
|
|
- type: "ONLINE",
|
|
|
|
- accessKey: "",
|
|
|
|
- accessSecret: "",
|
|
|
|
- },
|
|
|
|
- rules: {
|
|
|
|
- accessKey: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: "请输入密匙",
|
|
|
|
- trigger: ["blur", "change"],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- accessSecret: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: "请输入密钥",
|
|
|
|
- trigger: ["blur", "change"],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- setForm: {
|
|
|
|
- properties: {
|
|
|
|
- LOGIN_CODE_CHECK: "false",
|
|
|
|
- LOGIN_UD_CHECK: "false",
|
|
|
|
- LOGIN_UD_CHECK_ONECE: "",
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- ...mapState({ user: (state) => state.user }),
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- this.init();
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- init() {
|
|
|
|
- this.uploadHeaders = {
|
|
|
|
- key: this.user.key,
|
|
|
|
- token: this.user.token,
|
|
|
|
- };
|
|
|
|
- this.searchForm();
|
|
|
|
- },
|
|
|
|
- searchForm() {
|
|
|
|
- var url = QUESTION_API + "/system/auth/info";
|
|
|
|
- this.$httpWithMsg.get(url).then((response) => {
|
|
|
|
- if (response.data.auth == true) {
|
|
|
|
- this.info.activation = "已授权";
|
|
|
|
- if (this.info.activation == "已授权" && !response.data.expireTime) {
|
|
|
|
- this.info.expire = "不限制";
|
|
|
|
- } else {
|
|
|
|
- this.info.expire = response.data.expireTime;
|
|
|
|
- }
|
|
|
|
- if (
|
|
|
|
- this.info.activation == "已授权" &&
|
|
|
|
- !response.data.maxOnlineUserCount
|
|
|
|
- ) {
|
|
|
|
- this.info.maxCount = "不限制";
|
|
|
|
- } else {
|
|
|
|
- this.info.maxCount = response.data.maxOnlineUserCount;
|
|
|
|
- }
|
|
|
|
- this.info.onlineCount = response.data.onlineUserCount;
|
|
|
|
- this.info.type =
|
|
|
|
- response.data.type == "ONLINE" ? "在线激活" : "离线激活";
|
|
|
|
- } else {
|
|
|
|
- this.info.activation = "未授权";
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- this.initForm();
|
|
|
|
- },
|
|
|
|
- initForm() {
|
|
|
|
- var url = QUESTION_API + "/org/all-sys-properties";
|
|
|
|
- this.$httpWithMsg.get(url).then((response) => {
|
|
|
|
- if (response.data) {
|
|
|
|
- this.setForm.properties = response.data;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- //提交
|
|
|
|
- submitForm() {
|
|
|
|
- if (this.form.type == "OFFLINE") {
|
|
|
|
- this.submitUpload();
|
|
|
|
- } else {
|
|
|
|
- var url = QUESTION_API + "/system/auth/online";
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- this.$httpWithMsg.post(url, this.form).then(() => {
|
|
|
|
- this.$notify({
|
|
|
|
- type: "success",
|
|
|
|
- message: "授权成功",
|
|
|
|
- });
|
|
|
|
- this.searchForm();
|
|
|
|
- this.addingDialog = false;
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- submitSetForm() {
|
|
|
|
- let url = QUESTION_API + "/org/save-sys-properties";
|
|
|
|
- this.$httpWithMsg.put(url, this.setForm).then(() => {
|
|
|
|
- this.$notify({
|
|
|
|
- type: "success",
|
|
|
|
- message: "保存成功!",
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- exportFile() {
|
|
|
|
- window.open(
|
|
|
|
- QUESTION_API +
|
|
|
|
- "/system/auth/device/info?$key=" +
|
|
|
|
- this.user.key +
|
|
|
|
- "&$token=" +
|
|
|
|
- this.user.token
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- submitUpload() {
|
|
|
|
- var fileList = this.$refs.upload.uploadFiles;
|
|
|
|
- if (fileList.length == 0) {
|
|
|
|
- this.$notify({
|
|
|
|
- message: "请选择授权文件",
|
|
|
|
- type: "error",
|
|
|
|
- });
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- if (fileList.length > 1) {
|
|
|
|
- this.$notify({
|
|
|
|
- message: "每次只能上传一个文件",
|
|
|
|
- type: "error",
|
|
|
|
- });
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- this.$refs.upload.submit();
|
|
|
|
- },
|
|
|
|
- uploadSuccess(response) {
|
|
|
|
- if (!response.hasError) {
|
|
|
|
- this.$notify({
|
|
|
|
- message: "授权成功",
|
|
|
|
- type: "success",
|
|
|
|
- });
|
|
|
|
- this.searchForm();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- uploadError(response) {
|
|
|
|
- var json = JSON.parse(response.message);
|
|
|
|
- if (response.status == 500) {
|
|
|
|
- this.$notify({
|
|
|
|
- message: json.desc,
|
|
|
|
- type: "error",
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
-};
|
|
|
|
-</script>
|
|
|