157 lines
3.3 KiB
Vue
157 lines
3.3 KiB
Vue
<script lang="ts">
|
||
import { onLaunch, onShow } from '@dcloudio/uni-app'
|
||
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
|
||
import { beforEach } from '@/router/index'
|
||
import { jurisdictionApi } from '@/api/system';
|
||
import { useAppStore } from '@/store'
|
||
import { getLocation, useUpdateApp } from '@/utils';
|
||
export default {
|
||
onLaunch: function (options) {
|
||
console.log(options)
|
||
// 检查更新
|
||
useUpdateApp().checkAppUpdate()
|
||
// 定位
|
||
getLocation()
|
||
// 处理外部唤醒逻辑 min
|
||
if (options.path && options.query) {
|
||
const path = options.path; // 获取路径,如 "pages/home/index"
|
||
const query = options.query; // 获取参数,如 {id: 123}
|
||
uni.navigateTo({
|
||
url: `/${path}?${Object.keys(query).map(k => `${k}=${query[k]}`).join('&')}`
|
||
});
|
||
}
|
||
},
|
||
onShow: function (options) {
|
||
|
||
var args= plus.runtime.arguments;
|
||
if(args){
|
||
// 处理args参数,如直达到某新页面等
|
||
}
|
||
console.log(args)
|
||
|
||
//改造了一下,加了白名单验证
|
||
//为了实现实流检定的证书验证页面
|
||
//jiang 20250605
|
||
// 定义白名单页面
|
||
const publicPages = [
|
||
'/pages/sljd/index',
|
||
'/pages/linktoapp/index'
|
||
]
|
||
|
||
// 检查当前页面是否在白名单中
|
||
const isPublicPage = publicPages.includes(`/${options.path}`)
|
||
|
||
// 非白名单页面才执行登录检查
|
||
if (!isPublicPage) {
|
||
if (uni.getStorageSync('logintime') && uni.getStorageSync('logintime') + 1800000 <= Date.now()) {
|
||
uni.removeStorageSync('logintime')
|
||
uni.navigateTo({
|
||
url: '/pages/login/login'
|
||
})
|
||
return
|
||
}
|
||
}
|
||
|
||
// 路由拦截(白名单页面跳过)
|
||
setTimeout(() => {
|
||
const currentPage = options.path
|
||
if (!isPublicPage) {
|
||
beforEach({ path: '/' }, { path: currentPage, fullPath: currentPage }, (data) => {
|
||
if (data?.path) {
|
||
uni.redirectTo({ url: data.path })
|
||
}
|
||
})
|
||
}
|
||
}, 100)
|
||
|
||
// 权限检查(非白名单页面执行)
|
||
if (!isPublicPage) {
|
||
jurisdictionApi("1827997127165677570").then((res : any) => {
|
||
if (res.success) {
|
||
const appStore = useAppStore()
|
||
appStore.setIsGray(res.result.value)
|
||
}
|
||
})
|
||
}
|
||
},
|
||
|
||
// 全局变量
|
||
globalData: {
|
||
isLocalConfig: true,
|
||
systemInfo: uni.getSystemInfoSync(),
|
||
navHeight: 44,
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.gray {
|
||
filter: grayscale(1);
|
||
}
|
||
|
||
body {
|
||
font-size: 14px;
|
||
color: #333333;
|
||
font-family:
|
||
Helvetica Neue,
|
||
Helvetica,
|
||
sans-serif;
|
||
}
|
||
|
||
uni-page-body {
|
||
height: 100%;
|
||
|
||
&>uni-view {
|
||
height: 100%;
|
||
}
|
||
}
|
||
|
||
.shadow-warp {
|
||
position: relative;
|
||
box-shadow: 0 0 5px rgba(168, 92, 92, 0.1);
|
||
}
|
||
|
||
/* stylelint-disable selector-type-no-unknown */
|
||
button::after {
|
||
border: none;
|
||
}
|
||
|
||
swiper,
|
||
scroll-view {
|
||
flex: 1;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
image {
|
||
width: 100%;
|
||
height: 100%;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
// 单行省略,优先使用 unocss: text-ellipsis
|
||
.ellipsis {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
// 两行省略
|
||
.ellipsis-2 {
|
||
display: -webkit-box;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
-webkit-line-clamp: 2;
|
||
-webkit-box-orient: vertical;
|
||
word-break: break-all;
|
||
}
|
||
|
||
// 三行省略
|
||
.ellipsis-3 {
|
||
display: -webkit-box;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
-webkit-line-clamp: 3;
|
||
-webkit-box-orient: vertical;
|
||
}
|
||
</style> |