opt: 部分逻辑

This commit is contained in:
2025-09-11 10:05:05 +08:00
parent 55e721cd3e
commit c17e8e7e10
20 changed files with 422 additions and 263 deletions

View File

@@ -22,6 +22,12 @@ export const constantRouterMap = [
component: (resolve) => require(['@/views/features/401'], resolve),
hidden: true
},
{
path: '/999',
meta: { title: '无授权码', noCache: true },
component: (resolve) => require(['@/views/features/licenseTip'], resolve),
hidden: true
},
{
path: '/redirect',
component: Layout,

View File

@@ -22,6 +22,7 @@ service.interceptors.request.use(
}
config.headers['Content-Type'] = 'application/json'
config.headers['Accept-Language'] = window.localStorage.getItem('lang')
config.headers['cdk'] = window.localStorage.getItem('cdk')
return config
},
error => {
@@ -35,6 +36,7 @@ service.interceptors.response.use(
return response.data
},
error => {
console.log(error)
// 兼容blob下载出错json提示
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
const reader = new FileReader()
@@ -47,6 +49,7 @@ service.interceptors.response.use(
})
}
} else {
console.log('Error response:', error.response)
let code = 0
try {
code = error.response.status
@@ -68,6 +71,13 @@ service.interceptors.response.use(
})
} else if (code === 403) {
router.push({ path: '/401' })
} else if (code === 402) {
console.log('License expired or not activated, redirecting to license page.')
router.push({ path: '/999',
query: {
message: error.response.data.message
}
})
} else {
const errorMsg = error.response.data.message
if (errorMsg !== undefined) {

View File

@@ -0,0 +1,111 @@
<template>
<div class="activation-container">
<div class="activation-card">
<h1 class="title">请输入授权码激活</h1>
<p class="description">{{ tip ? tip + ',' : '' }}请输入您的授权码以激活功能</p>
<input
v-model="activationCode"
type="text"
placeholder="请输入授权码"
class="input-field"
>
<button class="activate-button" @click="handleActivate">激活</button>
</div>
</div>
</template>
<script>
export default {
name: 'LicenseTip',
data() {
return {
activationCode: '',
tip: ''
}
},
mounted() {
this.tip = this.$route.query.message
const savedCdk = localStorage.getItem('cdk')
if (savedCdk) {
this.activationCode = savedCdk
}
},
methods: {
handleActivate() {
if (this.activationCode.trim() === '') {
alert('请输入授权码')
return
}
// 暂时不对接API这里模拟激活成功
console.log('授权码:', this.activationCode)
localStorage.setItem('cdk', this.activationCode.trim())
this.$router.push({ path: '/' })
}
}
}
</script>
<style scoped>
.activation-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
font-family: 'Arial', sans-serif;
}
.activation-card {
background: white;
padding: 40px;
border-radius: 15px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
text-align: center;
width: 400px;
max-width: 90%;
}
.title {
font-size: 24px;
margin-bottom: 10px;
color: #333;
}
.description {
font-size: 16px;
margin-bottom: 20px;
color: #666;
}
.input-field {
width: 100%;
padding: 12px;
margin-bottom: 20px;
border: 1px solid #ddd;
border-radius: 8px;
font-size: 16px;
box-sizing: border-box;
transition: border-color 0.3s;
}
.input-field:focus {
border-color: #2575fc;
outline: none;
}
.activate-button {
width: 100%;
padding: 12px;
background: #2575fc;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: background 0.3s;
}
.activate-button:hover {
background: #1a5bb8;
}
</style>

View File

@@ -39,27 +39,27 @@
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<!-- <el-form-item label="物料规格">-->
<!-- <el-input-->
<!-- v-model="query.material_spec"-->
<!-- clearable-->
<!-- size="mini"-->
<!-- placeholder="物料名称"-->
<!-- @keyup.enter.native="crud.toQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料型号">-->
<!-- <el-input-->
<!-- v-model="query.material_model"-->
<!-- clearable-->
<!-- size="mini"-->
<!-- placeholder="物料名称"-->
<!-- @keyup.enter.native="crud.toQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item :label="queryInfo">-->
<!-- <el-button icon="el-icon-sort" circle @click="queryMaterials"></el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料规格">-->
<!-- <el-input-->
<!-- v-model="query.material_spec"-->
<!-- clearable-->
<!-- size="mini"-->
<!-- placeholder="物料名称"-->
<!-- @keyup.enter.native="crud.toQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料型号">-->
<!-- <el-input-->
<!-- v-model="query.material_model"-->
<!-- clearable-->
<!-- size="mini"-->
<!-- placeholder="物料名称"-->
<!-- @keyup.enter.native="crud.toQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item :label="queryInfo">-->
<!-- <el-button icon="el-icon-sort" circle @click="queryMaterials"></el-button>-->
<!-- </el-form-item>-->
<rrOperation />
</el-form>
@@ -90,13 +90,13 @@
<el-table-column prop="storagevehicle_code" label="载具编码" width="160" />
<el-table-column prop="qty_unit_name" label="单位" width="160" />
<el-table-column prop="supp_name" label="供应商" width="160" />
<!-- <el-table-column prop="raw_material_code" label="泥料编码" width="160" />-->
<!-- <el-table-column prop="material_spec" label="物料规格" width="140" />-->
<!-- <el-table-column prop="material_model" label="物料型号" width="140" />-->
<!-- <el-table-column prop="pack_method" label="包装方式" width="140" />-->
<!-- <el-table-column prop="pack_palletspec" label="包装规则" width="140" />-->
<!-- <el-table-column v-if="queryInfo === '库存顺序'" prop="total_material_qty" label="物料总数/块" width="140" />-->
<!-- <el-table-column prop="standing_time" label="静置时间(分钟)" width="130px" />-->
<!-- <el-table-column prop="raw_material_code" label="泥料编码" width="160" />-->
<el-table-column prop="material_spec" label="物料规格" width="140" />
<!-- <el-table-column prop="material_model" label="物料型号" width="140" />-->
<!-- <el-table-column prop="pack_method" label="包装方式" width="140" />-->
<!-- <el-table-column prop="pack_palletspec" label="包装规则" width="140" />-->
<!-- <el-table-column v-if="queryInfo === '库存顺序'" prop="total_material_qty" label="物料总数/块" width="140" />-->
<!-- <el-table-column prop="standing_time" label="静置时间(分钟)" width="130px" />-->
<el-table-column prop="update_name" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="135" />
</el-table>