接口嵌套

This commit is contained in:
2026-06-24 17:16:13 +08:00
parent 3da01972a3
commit d784e10bcf
15 changed files with 1600 additions and 18 deletions
+272
View File
@@ -0,0 +1,272 @@
<script setup>
import { ref,onMounted } from 'vue'
import router from '@/router'
import { useRoute } from 'vue-router'
import { showNotify } from 'vant'
import { detailsApi } from '@/api/apply';
const route = useRoute()
const loading = ref(false);
const params = ref(null)
const info = ref(null)
// 状态
const statusList = ref([
{text:'草稿',value:0},
{text:'申请中(安全员/技术员)',value:1},
{text:'申请中(车间主任)',value:2},
{text:'申请中(车间值班人员)',value:101},
{text:'各部门会签中',value:3},
{text:'审批中',value:4},
{text:'通过',value:5},
{text:'已关闭',value:97},
{text:'已撤回',value:98},
{text:'已驳回',value:99},
]);
// 匹配选项
const matchOptions = (arr,val) => {
const target = arr.find(item => item.value == val);
return target ? target.text : '';
}
// 路由跳转
const jumpTo = (val) => {
// 跳转已审批列表
if(val===0){
router.push({
path: '/applyList',
})
}
// 跳转待审批列表
if(val===1){
router.push({
path: '/waitList',
})
}
// 跳转联锁详情页
if(val===2){
router.push({
path: '/lockDetail',
query: { id: params.value.id, type: params.value.type },
})
}
}
// 同意
const agree = () => {
showNotify({ type: 'success', message: '同意成功' });
}
// 获取详情
const getDetail = async () => {
loading.value = true;
try {
const res = await detailsApi(params.value?.id);
info.value = res.data;
if(res.data?.status>=1 && res.data?.status<=4){
let allEmpty = res.data?.draft_apply_steps.every(item => item.draft_cosign_items.length === 0);
if(res.data?.draft_apply_steps?.length && !allEmpty){
info.value.steps = res.data?.draft_apply_steps;
}else{
info.value.steps = res.data?.apply_steps;
}
}else{
info.value.steps = res.data?.apply_steps;
}
} finally {
loading.value = false;
}
}
onMounted(() => {
if(route.query){
params.value = route.query;
getDetail();
}
})
</script>
<template>
<!-- 全屏加载遮罩层 -->
<div v-if="loading" class="global-loading-overlay">
<van-loading size="30px" color="#1989fa" vertical></van-loading>
</div>
<div class="main">
<div class="tab-box">
<p class="tab" :class="{'active':params?.type==='finish'}" @click="jumpTo(0)">已审批</p>
<p class="tab" :class="{'active':params?.type==='wait'}" @click="jumpTo(1)">待审批</p>
</div>
<template v-if="info">
<div class="detail">
<div class="row">
<div v-if="info.template_id==4">
<p v-if="info.status==1">申请中(车间值班人员)</p>
<p v-else>{{matchOptions(statusList,info.status)}}</p>
</div>
<div v-else>
<p v-if="info.status==5 || info.status==100">通过</p>
<p v-else>{{matchOptions(statusList,info.status)}}</p>
</div>
<p>申请摘除数量({{info.chain_count}})个</p>
</div>
<div class="row">
<p>岗位:{{info.chain_position}}</p>
<p>类型:{{info.template_name}}</p>
</div>
<div class="row">
<p>摘除理由:{{info.reasons}}</p>
</div>
<div class="row">
<p>计划摘除时间:{{info.plan_remove_time?.slice(0,16)}}</p>
</div>
<div class="row">
<p>计划恢复时间:{{info.plan_recover_time?.slice(0,16)}}</p>
</div>
<div class="row col">
<p class="blue-color">风险辨识</p>
<p>{{info.risk_description}}</p>
</div>
<div class="row col">
<p class="blue-color">安全措施</p>
<p>{{info.safety_measures}}</p>
</div>
<div class="row col">
<div class="timeline">
<div class="timeline-item" v-if="info.template_id==4">
<div class="left">
<p class="timeline-dot"></p>
<div class="txt">班长:</div>
<div class="txt">{{info?.apply_user?.realname}}</div>
</div>
</div>
<div class="timeline-item" v-if="info.template_id>=1 && info.template_id<=3">
<div class="left">
<p class="timeline-dot"></p>
<div class="txt">车间工程师:</div>
<div class="txt">{{info?.apply_user?.realname}}</div>
</div>
</div>
<template v-for="(item, index) in info?.steps || []" :key="index">
<template v-for="(sItem,sIndex) in (item.cosigns || item.cosign_items || item.draft_cosign_items)" :key="sIndex">
<div class="timeline-item">
<div class="left">
<p class="timeline-dot"></p>
<div class="txt">{{sItem.dept_name}}:</div>
<div class="txt">{{sItem.user_name}}</div>
</div>
<div class="txt" v-if="sItem.signed_at">{{(sItem.signed_at)?.slice(0,16)}}</div>
</div>
</template>
</template>
</div>
</div>
</div>
<div class="btns">
<p class="btn" @click="jumpTo(params?.type==='finish'?0:1)">返回列表</p>
<p class="btn" @click="jumpTo(2)">联锁详情</p>
<p class="btn" v-if="params?.type==='wait'" @click="agree">同意</p>
<p class="btn" v-if="params?.type==='wait'">驳回</p>
</div>
</template>
<template v-else>
<van-empty description="暂无数据" />
</template>
</div>
</template>
<style scoped>
.blue-color {
color: #1989fa;
}
.main {
height: 100vh;
padding: 12px;
overflow: hidden;
font-size: 14px;
}
/* tab切换 */
.tab-box {
display: flex;
border: 1px solid #1989fa;
}
.tab {
width: 50%;
padding: 5px 0;
text-align: center;
font-size: 16px;
color: #1989fa;
}
.tab.active {
background-color: #1989fa;
color: #fff;
}
/* 详情 */
.detail {
margin-top: 12px;
height: calc(100vh - 120px);
overflow-y: auto;
border: 1px solid #f1f1f1;
border-radius: 2px;
padding: 10px;
}
.detail .row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10px;
gap: 10px;
}
.detail .col {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 2px;
}
.detail .row:first-child {
margin-top: 0;
}
/* 底部按钮 */
.btns {
margin-top: 12px;
display: flex;
gap: 12px;
}
.btns .btn {
width: 100%;
text-align: center;
padding: 8px 0;
border: 1px solid #eee;
border-radius: 2px;
}
/* 时间线 */
.timeline {
width: 100%;
position: relative;
display: flex;
flex-direction: column;
gap: 12px;
}
.timeline:before {
content: '';
width: 1px;
height: calc(100% - 6px);
background: #1989fa;
position: absolute;
top: 3px;
left: 6px;
}
.timeline-item {
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.timeline-item .left {
display: flex;
align-items: center;
}
/* 圆点 */
.timeline-dot {
width: 12px;
height: 12px;
background: #1989fa;
border-radius: 50%;
margin-right: 10px;
}
</style>
+203 -2
View File
@@ -1,12 +1,213 @@
<script setup>
import { ref,onMounted } from 'vue'
import router from '@/router'
import { applyListApi } from '@/api/apply';
const loading = ref(false);
const isAll = ref('1');
const currentPage = ref(1);
const total = ref(0);
// 状态
const statusList = ref([
{text:'草稿',value:0},
{text:'申请中(安全员/技术员)',value:1},
{text:'申请中(车间主任)',value:2},
{text:'申请中(车间值班人员)',value:101},
{text:'各部门会签中',value:3},
{text:'审批中',value:4},
{text:'通过',value:5},
{text:'已关闭',value:97},
{text:'已撤回',value:98},
{text:'已驳回',value:99},
]);
const list = ref([])
// 匹配选项
const matchOptions = (arr,val) => {
const target = arr.find(item => item.value == val);
return target ? target.text : '';
}
// 单选框切换
const radioChange = (val) => {
isAll.value = val;
currentPage.value = 1;
getList();
}
// 跳转
const jumpTo = (type,item) => {
// 跳转待审批列表
if(type==='wait'){
router.push({
path: '/waitList',
})
}
// 跳转详情
if(type==='detail'){
router.push({
path: '/detail',
query: {id: item.id,type: 'finish'}
})
}
}
// 获取列表数据
const getList = async () => {
loading.value = true;
try {
const res = await applyListApi({
org_id: 1,
choice_status: Number(isAll.value),
remove_type: [],
status: [],
sort: JSON.stringify({'plan_remove_time':'','plan_recover_time':'','status_updated_at':''}),
page: currentPage.value,
per_page: 20
});
list.value = res.data.list;
total.value = res.data.meta.pagination.total;
} finally {
loading.value = false;
}
}
// 分页
const pageChange = (val) => {
currentPage.value = val;
getList();
}
onMounted(() => {
getList();
});
</script>
<template>
<div class="login">申请列表</div>
<!-- 全屏加载遮罩层 -->
<div v-if="loading" class="global-loading-overlay">
<van-loading size="30px" color="#1989fa" vertical></van-loading>
</div>
<div class="main">
<div class="tab-box">
<p class="tab active">已审批</p>
<p class="tab" @click="jumpTo('wait',null)">待审批</p>
</div>
<div class="radio-box">
<van-radio-group v-model="isAll" direction="horizontal" @change="radioChange">
<van-radio name="1">只显示未关闭</van-radio>
<van-radio name="0">显示全部</van-radio>
</van-radio-group>
</div>
<div class="list">
<template v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="row">
<p>类型:{{item.template_name}}</p>
<p>申请摘除数量({{item.chain_count}})个</p>
</div>
<div class="row">
<div class="blue-color bold">
<div v-if="item.template_id==4">
<p v-if="item.status==1">申请中(车间值班人员)</p>
<p v-else>{{matchOptions(statusList,item.status)}}</p>
</div>
<div v-else>
<p v-if="item.status==5 || item.status==100">通过</p>
<p v-else>{{matchOptions(statusList,item.status)}}</p>
</div>
</div>
<p>岗位:{{item.chain_position}}</p>
</div>
<div class="row">
<p>申请时间:{{item.created_at?.slice(0,16)}}</p>
<p>申请人:{{item?.apply_user?.realname}}</p>
</div>
<div class="row">
<p>计划摘除时间:{{item.plan_remove_time?.slice(0,16)}}</p>
<p class="btn" @click="jumpTo('detail',item)">查看</p>
</div>
</div>
</template>
<template v-else>
<van-empty description="暂无数据" />
</template>
</div>
<van-pagination
v-if="list.length"
v-model="currentPage"
:total-items="total"
:show-page-size="3"
:items-per-page="20"
force-ellipses
@change="pageChange"
/>
</div>
</template>
<style scoped>
.login {
:deep(.van-radio-group--horizontal) {
justify-content: space-around;
}
.blue-color {
color: #1989fa;
}
.bold {
font-weight: bold;
}
.main {
height: 100vh;
padding: 12px;
overflow: hidden;
font-size: 14px;
}
/* tab切换 */
.tab-box {
display: flex;
border: 1px solid #1989fa;
}
.tab {
width: 50%;
padding: 5px 0;
text-align: center;
font-size: 16px;
color: #1989fa;
}
.tab.active {
background-color: #1989fa;
color: #fff;
}
/* 单选框 */
.radio-box {
padding: 12px 0;
}
/* 列表 */
.list {
height: calc(100vh - 155px);
margin-bottom: 12px;
overflow-y: auto;
}
.list .item {
border: 1px solid #f1f1f1;
border-radius: 4px;
padding: 10px;
margin-top: 12px;
}
.list .item:first-child {
margin-top: 0;
}
.list .item .row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10px;
gap: 10px;
}
.list .item .row:first-child {
margin-top: 0;
}
.btn {
background-color: #1989fa;
color: #fff;
padding: 4px 15px;
border-radius: 2px;
}
</style>
+215
View File
@@ -0,0 +1,215 @@
<script setup>
import { ref, onMounted } from 'vue'
import router from '@/router'
import { useRoute } from 'vue-router'
import { showNotify } from 'vant'
import { detailsApi } from '@/api/apply';
const route = useRoute()
const loading = ref(false);
const params = ref(null)
const info = ref(null)
const list = ref([{}])
// 路由跳转
const jumpTo = (val) => {
// 跳转已审批列表
if(val===0){
router.push({
path: '/applyList',
})
}
// 跳转待审批列表
if(val===1){
router.push({
path: '/waitList',
})
}
// 跳转详情
if(val===3){
router.push({
path: '/detail',
query: { id: params.value.id, type: params.value.type },
})
}
}
// 层级处理
const getOrg = (data) => {
if(data && data.length){
let orgList = [];
for(let item of data){
orgList.push(item.label);
}
return orgList.join('/');
}
return '';
}
// 同意
const agree = () => {
showNotify({ type: 'success', message: '同意成功' });
}
// 获取详情
const getDetail = async () => {
loading.value = true;
try {
const res = await detailsApi(params.value?.id);
info.value = res.data;
console.log(info.value);
} finally {
loading.value = false;
}
}
onMounted(() => {
if(route.query){
params.value = route.query;
getDetail();
}
})
</script>
<template>
<!-- 全屏加载遮罩层 -->
<div v-if="loading" class="global-loading-overlay">
<van-loading size="30px" color="#1989fa" vertical></van-loading>
</div>
<div class="main">
<div class="tab-box">
<p class="tab" :class="{'active':params?.type==='finish'}" @click="jumpTo(0)">已审批</p>
<p class="tab" :class="{'active':params?.type==='wait'}" @click="jumpTo(1)">待审批</p>
</div>
<template v-if="list.length">
<div class="detail">
<div class="item" v-for="(item, index) in info?.items" :key="index">
<div class="row">
<p><span class="order">{{index+1}}</span>联锁名称:二甲苯蒸馏釜冷凝器下料温度高高联锁</p>
</div>
<div class="row">
<p>层级:{{getOrg(info?.organizations)}}</p>
<p>表决方式:{{ item?.chain?.condition_num || '' }} 选 {{ item?.chain?.choice_num || '' }}</p>
</div>
<div class="row">
<div class="node">
<p>仪表位号:</p>
<table class="table">
<tr>
<th style="width: 65px;">仪表位号</th>
<th>单位</th>
<th style="width: 70px;">联锁值(低)</th>
<th style="width: 70px;">联锁值(高)</th>
</tr>
<tr v-for="(node,nodeIndex) in item?.chain?.nodes" :key="nodeIndex">
<td class="td">{{node.real_time_node_name}}</td>
<td class="td">{{node?.node?.unit}}</td>
<td class="td">{{node?.l}}</td>
<td class="td">{{node?.h}}</td>
</tr>
</table>
</div>
</div>
<div class="row">
<p>联锁动作:{{item?.chain?.action.join(',')}}</p>
</div>
</div>
</div>
<div class="btns">
<p class="btn" @click="jumpTo(params?.type==='finish'?0:1)">返回列表</p>
<p class="btn" @click="jumpTo(3)">返回申请</p>
<p class="btn" v-if="params?.type==='wait'" @click="agree">同意</p>
<p class="btn" v-if="params?.type==='wait'">驳回</p>
</div>
</template>
<template v-else>
<van-empty description="暂无数据" />
</template>
</div>
</template>
<style scoped>
.main {
height: 100vh;
padding: 12px;
overflow: hidden;
font-size: 14px;
}
/* tab切换 */
.tab-box {
display: flex;
border: 1px solid #1989fa;
}
.tab {
width: 50%;
padding: 5px 0;
text-align: center;
font-size: 16px;
color: #1989fa;
}
.tab.active {
background-color: #1989fa;
color: #fff;
}
/* 详情 */
.detail {
margin-top: 12px;
height: calc(100vh - 120px);
overflow-y: auto;
}
.detail .item {
border: 1px solid #f1f1f1;
border-radius: 4px;
padding: 10px;
margin-top: 12px;
}
.detail .item:first-child {
margin-top: 0;
}
.detail .item .row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10px;
gap: 10px;
}
.detail .item .row:first-child {
margin-top: 0;
}
.detail .item .order {
margin-right: 10px;
}
.node {
width: 100%;
display: flex;
align-items: flex-start;
gap: 10px;
}
.table {
flex: 1;
margin-top: -3px;
}
.table td {
text-align: center;
font-size: 13px;
}
.table .td {
word-wrap: break-word;
overflow-wrap: break-word;
white-space: normal;
word-break: break-all;
}
/* 底部按钮 */
.btns {
margin-top: 12px;
display: flex;
gap: 12px;
}
.btns .btn {
width: 100%;
text-align: center;
padding: 8px 0;
border: 1px solid #eee;
border-radius: 2px;
}
</style>
+177
View File
@@ -0,0 +1,177 @@
<script setup>
import { ref,onMounted } from 'vue'
import router from '@/router'
import { waitListApi } from '@/api/apply';
const loading = ref(false);
// 状态
const statusList = ref([
{text:'草稿',value:0},
{text:'申请中(安全员/技术员)',value:1},
{text:'申请中(车间主任)',value:2},
{text:'申请中(车间值班人员)',value:101},
{text:'各部门会签中',value:3},
{text:'审批中',value:4},
{text:'通过',value:5},
{text:'已撤回',value:98},
{text:'已驳回',value:99},
]);
const list = ref([])
// 匹配选项
const matchOptions = (arr,val) => {
const target = arr.find(item => item.value == val);
return target ? target.text : '';
}
// 跳转
const jumpTo = (type,item) => {
// 跳转已审批列表
if(type==='finish'){
router.push({
path: '/applyList',
})
}
// 跳转详情
if(type==='detail'){
router.push({
path: '/detail',
query: {id: item.id,type: 'wait'}
})
}
}
// 获取列表数据
const getList = async () => {
loading.value = true;
try {
const res = await waitListApi({
org_id: 1,
remove_type: [],
status: [],
sort: JSON.stringify({'plan_remove_time':'','plan_recover_time':'','status_updated_at':''}),
page: 1,
per_page: 9999
});
res.data?.initiated.forEach((item) => { item.type = 'myself'; });
res.data?.pending.forEach((item) => { item.type = 'pending'; });
list.value = res.data?.initiated.concat(res.data?.pending);
} finally {
loading.value = false;
}
}
onMounted(() => {
getList();
});
</script>
<template>
<!-- 全屏加载遮罩层 -->
<div v-if="loading" class="global-loading-overlay">
<van-loading size="30px" color="#1989fa" vertical></van-loading>
</div>
<div class="main">
<div class="tab-box">
<p class="tab" @click="jumpTo('finish',null)">已审批</p>
<p class="tab active">待审批</p>
</div>
<div class="list">
<template v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="row">
<p>类型:{{item.template_name}}</p>
<p>申请摘除数量({{item.chain_count}})个</p>
</div>
<div class="row">
<div class="blue-color bold">
<div v-if="item.template_id==4">
<p v-if="item.status==1">申请中(车间值班人员)</p>
<p v-else>{{matchOptions(statusList,item.status)}}</p>
</div>
<div v-else>
<p v-if="item.status==5 || item.status==100">通过</p>
<p v-else>{{matchOptions(statusList,item.status)}}</p>
</div>
</div>
<p>岗位:{{item.chain_position}}</p>
</div>
<div class="row">
<p>申请时间:{{item.created_at?.slice(0,16)}}</p>
<p>申请人:{{item?.apply_user?.realname}}</p>
</div>
<div class="row">
<p>计划摘除时间:{{item.plan_remove_time?.slice(0,16)}}</p>
<p class="btn" @click="jumpTo('detail',item)">查看</p>
</div>
</div>
</template>
<template v-else>
<van-empty description="暂无数据" />
</template>
</div>
</div>
</template>
<style scoped>
.blue-color {
color: #1989fa;
}
.bold {
font-weight: bold;
}
.main {
height: 100vh;
padding: 12px;
overflow: hidden;
font-size: 14px;
}
/* tab切换 */
.tab-box {
display: flex;
border: 1px solid #1989fa;
}
.tab {
width: 50%;
padding: 5px 0;
text-align: center;
font-size: 16px;
color: #1989fa;
}
.tab.active {
background-color: #1989fa;
color: #fff;
}
/* 列表 */
.list {
height: calc(100vh - 70px);
overflow-y: auto;
margin-top: 12px;
}
.list .item {
border: 1px solid #f1f1f1;
border-radius: 4px;
padding: 10px;
margin-top: 12px;
}
.list .item:first-child {
margin-top: 0;
}
.list .item .row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10px;
gap: 10px;
}
.list .item .row:first-child {
margin-top: 0;
}
.btn {
background-color: #1989fa;
color: #fff;
padding: 4px 15px;
border-radius: 2px;
}
</style>
+304 -2
View File
@@ -1,3 +1,305 @@
<template>
<div>404</div>
</template>
<div class="not-found">
<!-- 背景装饰 -->
<div class="bg-decoration">
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
<div class="circle circle-3"></div>
<div class="circle circle-4"></div>
</div>
<!-- 主内容 -->
<div class="content">
<!-- 404 数字艺术字 -->
<div class="error-code">
<span class="digit digit-1">4</span>
<span class="digit digit-2">0</span>
<span class="digit digit-3">4</span>
</div>
<!-- 插画图标 -->
<div class="illustration">
<van-icon name="warning-o" size="51.2px" color="#ee0a24" />
<div class="illustration-line"></div>
</div>
<!-- 提示文字 -->
<div class="message">
<h1 class="title">哎呀!页面走丢了</h1>
<p class="desc">您访问的页面不存在或已被移除</p>
<p class="sub-desc">可能是链接有误,或页面已更新</p>
</div>
<!-- 操作按钮 -->
<div class="actions">
<van-button
type="danger"
round
block
size="normal"
@click="goBack"
>
返回上一页
</van-button>
</div>
</div>
</div>
</template>
<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
// 返回首页
const goHome = () => {
router.push('/')
}
// 返回上一页
const goBack = () => {
router.go(-1)
}
</script>
<style scoped>
/* ===== 容器 ===== */
.not-found {
position: relative;
min-height: 100vh;
min-height: 100dvh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(145deg, #f8f9fe 0%, #f0f2f8 100%);
padding: 24px 20px;
overflow: hidden;
box-sizing: border-box;
}
/* ===== 背景装饰 ===== */
.not-found .bg-decoration {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 0;
}
.not-found .circle {
position: absolute;
border-radius: 50%;
opacity: 0.4;
animation: float 8s ease-in-out infinite alternate;
}
.not-found .circle-1 {
width: 320px;
height: 320px;
top: -8%;
right: -10%;
background: radial-gradient(circle, rgba(238, 10, 36, 0.08), transparent);
animation-delay: 0s;
}
.not-found .circle-2 {
width: 224px;
height: 224px;
bottom: -5%;
left: -8%;
background: radial-gradient(circle, rgba(238, 10, 36, 0.06), transparent);
animation-delay: 2s;
}
.not-found .circle-3 {
width: 128px;
height: 128px;
top: 30%;
right: 5%;
background: radial-gradient(circle, rgba(238, 10, 36, 0.05), transparent);
animation-delay: 4s;
}
.not-found .circle-4 {
width: 160px;
height: 160px;
bottom: 20%;
left: 5%;
background: radial-gradient(circle, rgba(238, 10, 36, 0.04), transparent);
animation-delay: 1s;
}
@keyframes float {
0% {
transform: translate(0, 0) scale(1);
}
100% {
transform: translate(20px, -20px) scale(1.05);
}
}
/* ===== 内容区 ===== */
.not-found .content {
position: relative;
z-index: 1;
width: 100%;
max-width: 420px;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
/* ===== 404 数字 ===== */
.not-found .error-code {
display: flex;
align-items: center;
justify-content: center;
gap: 2.4px;
margin-bottom: 8px;
font-weight: 900;
line-height: 1;
user-select: none;
}
.not-found .error-code .digit {
font-size: 128px;
background: linear-gradient(135deg, #ee0a24 0%, #c41230 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-shadow: 0 12px 40px rgba(238, 10, 36, 0.2);
position: relative;
transition: transform 0.3s ease;
}
.not-found .error-code .digit-1 {
animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
.not-found .error-code .digit-2 {
animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}
.not-found .error-code .digit-3 {
animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}
@keyframes popIn {
0% {
opacity: 0;
transform: scale(0.5) translateY(30px);
}
100% {
opacity: 1;
transform: scale(1) translateY(0);
}
}
/* ===== 插画 ===== */
.not-found .illustration {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 24px;
opacity: 0;
animation: fadeUp 0.8s ease 0.7s both;
}
.not-found .illustration .van-icon {
filter: drop-shadow(0 4px 12px rgba(238, 10, 36, 0.2));
}
.not-found .illustration-line {
width: 40px;
height: 2px;
background: linear-gradient(90deg, rgba(238, 10, 36, 0.3), rgba(238, 10, 36, 0.05));
border-radius: 2px;
}
@keyframes fadeUp {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* ===== 提示文字 ===== */
.not-found .message {
margin-bottom: 32px;
opacity: 0;
animation: fadeUp 0.8s ease 0.9s both;
}
.not-found .message .title {
font-size: 24px;
font-weight: 700;
color: #1a1a2e;
margin: 0 0 8px 0;
letter-spacing: 0.02em;
}
.not-found .message .desc {
font-size: 16px;
color: #6b7280;
margin: 0 0 4px 0;
font-weight: 400;
line-height: 1.6;
}
.not-found .message .sub-desc {
font-size: 14px;
color: #9ca3af;
margin: 0;
font-weight: 300;
line-height: 1.6;
}
/* ===== 按钮 ===== */
.not-found .actions {
width: 100%;
}
/* ===== 移动端适配 ===== */
@media (max-width: 420px) {
.not-found .error-code .digit {
font-size: 96px;
}
.not-found .message .title {
font-size: 20px;
}
.not-found .message .desc {
font-size: 14.4px;
}
}
@media (max-width: 360px) {
.not-found .error-code .digit {
font-size: 76.8px;
}
.not-found .message .title {
font-size: 17.6px;
}
.not-found .content {
padding: 0 4px;
}
}
/* ===== 刘海屏 & 安全区适配 ===== */
@supports (padding: max(0px)) {
.not-found {
padding-top: max(24px, env(safe-area-inset-top));
padding-bottom: max(24px, env(safe-area-inset-bottom));
padding-left: max(20px, env(safe-area-inset-left));
padding-right: max(20px, env(safe-area-inset-right));
}
}
</style>
+15 -7
View File
@@ -1,6 +1,7 @@
<script setup>
import { ref } from 'vue'
import router from '@/router'
import { loginApi } from '@/api/login';
const btnLoading = ref(false)
const formData = ref({
@@ -9,13 +10,15 @@ const formData = ref({
})
// 登录提交
const onSubmit = (values) => {
const onSubmit = async (values) => {
btnLoading.value = true;
console.log(values);
setTimeout(() => {
btnLoading.value = false;
try {
const res = await loginApi(values);
localStorage.setItem('token', res.data.access_token);
router.push({ path: '/applyList' });
}, 1000);
} finally {
btnLoading.value = false;
}
}
</script>
@@ -26,12 +29,13 @@ const onSubmit = (values) => {
<img src="/public/logo.png" alt="">
<p class="login">登录</p>
</div>
<van-form @submit="onSubmit" size="small" label-width="1.2rem">
<van-form class="form" @submit="onSubmit" size="small" label-width="1.2rem">
<van-cell-group inset>
<van-field
v-model="formData.username"
name="username"
label="用户名"
clearable
placeholder="请输入用户名"
:rules="[{ required: true, message: '请输入用户名' }]"
/>
@@ -40,6 +44,7 @@ const onSubmit = (values) => {
type="password"
name="password"
label="密码"
clearable
placeholder="请输入密码"
:rules="[{ required: true, message: '请输入密码' }]"
/>
@@ -66,7 +71,7 @@ const onSubmit = (values) => {
padding: 10px;
}
.box {
width: 80%;
width: 90%;
background: #fff;
border-radius: 8px;
display: flex;
@@ -89,6 +94,9 @@ const onSubmit = (values) => {
.login {
font-size: 20px;
}
.form {
width: 100%;
}
.btn {
margin-top: 10px;
}