opt: 授权码

This commit is contained in:
2025-09-23 15:04:48 +08:00
parent a20dc34f0a
commit 70317a77aa
2 changed files with 23 additions and 3 deletions

View File

@@ -15,12 +15,15 @@
</template>
<script>
import request from '@/utils/request'
export default {
name: 'LicenseTip',
data() {
return {
activationCode: '',
tip: ''
tip: '',
redirect: '/dashboard'
}
},
mounted() {
@@ -38,8 +41,25 @@ export default {
}
// 暂时不对接API这里模拟激活成功
console.log('授权码:', this.activationCode)
localStorage.setItem('cdk', this.activationCode.trim())
this.$router.push({ path: '/' })
request({
url: 'api/verify/activity',
method: 'post',
data: {
code: this.activationCode.trim()
}
}).then(res => {
console.log('激活成功:', res)
if (res.result) {
localStorage.setItem('cdk', this.activationCode.trim())
window.location.href = this.redirect
this.$message(res.message || '激活成功')
// this.$router.push({ path: '/' })
} else {
this.$message.error(res.message || '激活失败,请检查授权码')
}
}).catch(error => {
console.error('API错误:', error)
})
}
}
}