c293da23
刘淇
新园林init
|
1
|
<script setup>
|
a2702f6d
刘淇
巡查计划
|
2
|
import { onLaunch, onShow } from '@dcloudio/uni-app';
|
c293da23
刘淇
新园林init
|
3
|
|
a2702f6d
刘淇
巡查计划
|
4
|
// 应用启动时初始化
|
c293da23
刘淇
新园林init
|
5
6
|
onLaunch(() => {
console.log('App Launch');
|
a2702f6d
刘淇
巡查计划
|
7
8
|
// 清空登录重定向残留(可选)
uni.removeStorageSync('loginRedirectPath');
|
c293da23
刘淇
新园林init
|
9
|
});
|
a2702f6d
刘淇
巡查计划
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// 监听所有页面显示(核心:检测登录状态)
onShow(() => {
checkLoginStatus();
});
// 登录检测核心函数
const checkLoginStatus = () => {
// 1. 获取当前页面信息(避免登录页循环跳转)
const pages = getCurrentPages();
if (pages.length === 0) return; // 无页面时跳过
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route; // 当前页面路径(如:pages/plan/index)
// // 2. 白名单:无需登录的页面(登录页必须加,其他按需加)
// const whiteList = ['pages/login/index', 'pages/register/index']; // 可追加首页等
// if (whiteList.includes(currentPath)) return;
// 3. 检测登录状态(仅判断token是否存在,极简版)
const token = uni.getStorageSync('jcss_token'); // 登录成功后需存token
if (!token) {
// 记录当前页面(登录后可返回)
uni.setStorageSync('loginRedirectPath', currentPath);
// 跳转到登录页(用redirectTo避免返回栈残留)
uni.redirectTo({
url: '/pages/login/index'
});
}
};
|
c293da23
刘淇
新园林init
|
39
40
41
42
43
44
45
46
47
48
49
|
</script>
<style lang="scss">
/* 注意要写在第一行,注意不能引入至uni.scss,同时给style标签加入lang="scss"属性 */
@import "@/uni_modules/uview-plus/index.scss";
/* 你的全局样式 */
page {
background-color: #f8f8f8;
height: 100%;
}
|
993d98fa
刘淇
工作台
|
50
|
|
fb13622a
刘淇
养护计划列表 样式 差去一个卡片的头部
|
51
52
|
// 卡片列表样式
.common-card-list {
|
54955fb5
刘淇
巡查和养护 。 失效状态的判断
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
.card-header{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
.common-name{
flex: 1; // 占满剩余空间,挤压标签到右侧
font-size: 28rpx;
font-weight: 500;
color: #333;
// 关键:单行文本溢出省略
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
// 与标签保持间距
margin-right: 16rpx;
}
// 已失效标签样式
.common-invalid-tag {
color: #f56c6c;
font-size: 24rpx;
flex-shrink: 0; // 禁止标签被压缩
}
.common-finish-tag{
color: #5ac725;
font-size: 24rpx;
flex-shrink: 0; // 禁止标签被压缩
}
}
|
fb13622a
刘淇
养护计划列表 样式 差去一个卡片的头部
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
.common-card-title {
}
.u-body-item {
margin-bottom: 16rpx;
&:last-child {
margin-bottom: 0;
}
}
.u-body-value {
flex: 1
}
}
// 通用样式
.common-item-center {
align-items: center;
}
.common-justify-between {
justify-content: space-between;
}
|
993d98fa
刘淇
工作台
|
109
110
111
112
113
114
115
116
117
118
119
120
121
|
// 底部按钮样式
.fixed-bottom-btn-wrap {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 999;
padding: 0;
/* #ifdef MP-WEIXIN */
//padding-bottom: constant(safe-area-inset-bottom);
//padding-bottom: env(safe-area-inset-bottom);
/* #endif */
}
|
9b30ab8c
刘淇
新增快速工单,原版
|
122
123
124
125
|
.commonPageLRpadding{
padding-left: 15px;
padding-right: 15px;
}
|
c7df828a
刘淇
快速工单 样式优化
|
126
127
128
129
130
|
.common-text-color{
font-size: 14px;
color: #606266
}
|
3d474e84
刘淇
快速工单 加上业务线
|
131
|
|
5b5a4862
刘淇
按钮放大
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
// 通用按钮样式(支持任意top值,无需批量生成类名)
.common-custom-btn {
position: absolute;
// 核心:用CSS变量接收动态top值,默认100px
top: var(--btn-top, 100px);
right: 15px;
//transform: translateX(-50%);
background-color: #3c9cff;
color: #ffffff;
border: none;
border-radius: 4px;
padding: 4px 10px;
font-size: 14px;
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
z-index: 99;
// 点击态
&:active {
background-color: #2b88ee;
opacity: 0.9;
}
// 禁用态
&.disabled {
background-color: #a0c8f5;
cursor: not-allowed;
opacity: 0.7;
}
}
|
3d474e84
刘淇
快速工单 加上业务线
|
168
|
|
c293da23
刘淇
新园林init
|
169
|
</style>
|