Files
klp-mono/apps/hand-factory/pages/easycode/easycode.vue
砂糖 42d858bc6b feat(用户认证): 实现基于角色的页面跳转和登录状态检查
- 在App.vue中添加登录状态检查和用户信息获取
- 修改index.vue实现根据用户角色跳转到不同页面
- 更新pages.json调整底部导航栏和页面配置
- 优化user.js中的用户信息存储逻辑
2025-11-03 14:52:41 +08:00

138 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container">
<!-- 标题区域 -->
<view class="page-title">操作类型选择</view>
<!-- 操作类型按钮区域 -->
<view class="btn-grid">
<button
v-for='item in types'
:key="item.dictValue"
@click="handleScan(item.dictValue)"
class="type-btn"
>
{{ item.dictLabel }}
</button>
</view>
<!-- 退出登录按钮固定在底部 -->
<view class="logout-container">
<button @click='handleLogout' class="logout-btn">
退出登录
</button>
</view>
</view>
</template>
<script>
import { getDicts } from '@/api/system/dict/data.js'
import { getGenerateRecord } from '@/api/wms/code.js'
export default {
data() {
return {
types: []
}
},
methods: {
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {}).finally(() => {
this.$tab.reLaunch('/pages/login')
})
})
},
handleScan(type) {
uni.scanCode({
success(res) {
const result = res.result;
}
})
}
},
mounted() {
getDicts('action_type').then(res => {
this.types = res.data
})
}
}
</script>
<style scoped>
.container {
padding: 20rpx;
min-height: 100vh;
background-color: #f5f7fa;
display: flex;
flex-direction: column;
align-items: center;
}
/* 页面标题 */
.page-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
padding: 20rpx 0;
margin-bottom: 30rpx;
text-align: center;
}
/* 按钮网格布局 */
.btn-grid {
display: grid;
grid-template-columns: 200rpx 200rpx; /* 固定按钮宽度 */
grid-template-rows: repeat(2, 1fr);
gap: 40rpx; /* 按钮间距 */
margin-bottom: 60rpx;
}
/* 操作类型按钮样式 */
.type-btn {
width: 200rpx;
height: 150rpx;
line-height: 150rpx; /* 文字竖直居中 */
font-size: 28rpx;
color: #333;
background-color: #fff;
border-radius: 12rpx;
border: none;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
transition: all 0.2s ease;
}
.type-btn:active {
background-color: #f0f0f0;
box-shadow: 0 2rpx 5rpx rgba(0, 0, 0, 0.1);
transform: scale(0.98);
}
/* 退出登录按钮容器 */
.logout-container {
width: 100%;
position: fixed;
bottom: 30rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
}
/* 退出登录按钮样式 */
.logout-btn {
width: 100%;
height: 90rpx;
line-height: 90rpx; /* 文字竖直居中 */
font-size: 30rpx;
color: #fff;
background-color: #ff4d4f;
border-radius: 16rpx;
border: none;
box-shadow: 0 4rpx 10rpx rgba(255, 77, 79, 0.2);
transition: all 0.2s ease;
}
.logout-btn:active {
background-color: #f5222d;
transform: scale(0.98);
}
</style>