1
This commit is contained in:
@@ -56,8 +56,18 @@
|
||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button size="medium" type="warning" plain class="license-button" @click.native.prevent="openLicenseDialog">激活授权码</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-dialog title="激活授权码" :visible.sync="licenseDialogVisible" width="420px" append-to-body>
|
||||
<el-input v-model="licenseCode" type="textarea" :rows="4" placeholder="请输入授权码" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="licenseDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="licenseLoading" @click="handleActiveLicense">激 活</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>{{ $t('login.bottom') }}</span>
|
||||
@@ -70,6 +80,7 @@ import LangSelect from '@/components/LangSelect'
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import { activeLicense } from '@/api/license'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
@@ -98,7 +109,10 @@ export default {
|
||||
captchaEnabled: true,
|
||||
// 注册开关
|
||||
register: false,
|
||||
redirect: undefined
|
||||
redirect: undefined,
|
||||
licenseDialogVisible: false,
|
||||
licenseCode: '',
|
||||
licenseLoading: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -156,6 +170,30 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
openLicenseDialog() {
|
||||
this.licenseCode = ''
|
||||
this.licenseDialogVisible = true
|
||||
},
|
||||
handleActiveLicense() {
|
||||
const licenseCode = this.licenseCode.trim()
|
||||
if (!licenseCode) {
|
||||
this.$message.warning('请输入授权码')
|
||||
return
|
||||
}
|
||||
this.licenseLoading = true
|
||||
activeLicense(licenseCode).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$message.success(response.msg || '授权码激活成功')
|
||||
this.licenseDialogVisible = false
|
||||
} else {
|
||||
this.$message.error(response.msg || '授权码激活失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error('授权码激活失败')
|
||||
}).finally(() => {
|
||||
this.licenseLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -177,7 +215,13 @@ export default {
|
||||
padding: 40px;
|
||||
padding-top: 50px;
|
||||
width: 480px;
|
||||
height: 500px;
|
||||
min-height: 560px;
|
||||
}
|
||||
|
||||
.license-button {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
||||
Reference in New Issue
Block a user