Commit 7f5d6165 authored by niguangyjf's avatar niguangyjf

综合首页

parent 38185fe1
<script setup lang="ts">
import { onHide, onLaunch, onLoad, onShow } from '@dcloudio/uni-app';
import clog from './utils/clog';
import router from '@/router';
onLaunch(() => {
clog.info('App Launch')
const Authorization = uni.getStorageSync('Authorization');
console.log(`33333333333333333`, Authorization)
if(Authorization) {
router.clear('/service/home')
console.log(`33333333333333344444333`, Authorization)
} else {
uni.reLaunch({
url: '/login'
})
}
})
onShow(() => {
const Authorization = uni.getStorageSync('Authorization');
if(Authorization) {
router.clear('/service/home')
} else {
uni.reLaunch({
url: '/login'
})
}
clog.info('App Show')
})
onHide(() => {
const Authorization = uni.getStorageSync('Authorization');
if(Authorization) {
router.clear('/service/home')
} else {
uni.reLaunch({
url: '/login'
})
}
clog.info('App Hide')
})
onLoad(() => {
const Authorization = uni.getStorageSync('Authorization');
if(Authorization) {
router.clear('/service/home')
} else {
uni.reLaunch({
url: '/login'
})
}
clog.info('App Load')
})
</script>
......
declare namespace API {
export type loginMsg = {
access_token?: string;
areaId?: number;
id?: number;
menus?: string;
name?: string;
platformType?: number;
projectId?: number;
success?: boolean;
message?: string;
}
export type CurrentUser = {
avatarUrl: string;
id: number,
mobile: string;
areaId: number;
name: string;
platformType: number;
projectId: number;
roleId: number;
roleName: string;
username: string;
currentPlatformType: number;
currentProjectId: number
menuTemplateId?: string | number
department?: any
};
export type Store = {
[name: string]: any;
}
}
......@@ -5,6 +5,6 @@ import {
http
} from '@/api/service.js'
export const fetchCurrentUserInfo = () => {
export const fetchCurrentUserInfo: API.CurrentUser = () => {
return http.get(`/account-service/user/myInfo`)
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ const handleError = (response) => {
const errorText = response?.data?.message || codeMessage[response.statusCode];
const { statusCode } = response;
if (statusCode === 401) {
router.push('/prolist');
router.push('/login');
return false;
}
uni.showToast({
......
......@@ -2,9 +2,9 @@
<div @click="switchTab(0)" :class="conf.class">
<div class="tab-bar-border"></div>
<view v-for="(item, index) in conf.list" :key="index" @click="switchTab(item)" class="tab-bar-item">
<img :src="router.item.item.pagePath === item.pagePath ? item.selectedIconPath : item.iconPath"
<img :src="router?.item?.item?.pagePath === item?.pagePath ? item?.selectedIconPath : item?.iconPath"
class="tab-bar-icon" />
<div :style="{ color: router.item.item.pagePath === item.pagePath ? conf.selectedColor : conf.color }"
<div :style="{ color: router?.item?.item?.pagePath === item?.pagePath ? conf.selectedColor : conf.color }"
class="tab-bar-text">{{
item.tabsText
}}</div>
......
......@@ -23,6 +23,7 @@ const props = defineProps({
backText: { default: '' },
backShow: { default: true },
backFun: { default: null as any as Function },
// show: { default: true }
})
const conf = reactive({
......@@ -78,7 +79,7 @@ const back = () => {
&-centent {
flex: 1;
text-align: center;
font-size: 16px;
font-size: 14px;
}
&-right {
......
......@@ -2,17 +2,17 @@
<div class="content row flex-center">
<div class="box column flex-center no-wrap">
<img src="/static/image/logo.png" class="logo" />
<u--form labelPosition="left" :rules="conf.rules" :model="conf.model1" ref="loginForm" style="width: 100%;">
<u-form-item prop="model1.username" :borderBottom="false"
style="margin-top:77rpx;width: 95%;">
<u--input v-model="conf.model1.username" placeholder="请输入账号" border="bottom" clearable />
<u--form labelPosition="left" errorType="toast" :rules="conf.rules" :model="conf" ref="loginForm"
style="width: 100%;margin-top:77rpx">
<u-form-item prop="username" :borderBottom="false" style="margin-top:77rpx;">
<u--input v-model="conf.username" placeholder="请输入账号" border="bottom" clearable />
</u-form-item>
<u-form-item prop="model1.password" :borderBottom="false"
style="margin-top:50rpx;width: 95%;">
<u--input v-model="conf.model1.password" placeholder="请输入密码" border="bottom" clearable />
<u-form-item prop="password" :borderBottom="false" style="margin-top:50rpx;">
<u--input v-model="conf.password" type="password" placeholder="请输入密码" border="bottom" clearable />
</u-form-item>
</u--form>
<div style="margin-top:64rpx" class="wty-btn column flex-center wty-btn-wh" @click="loginAction">登录</div>
<u-button style="margin-top:64rpx;width: 100%;" @click="handleSubmit" type="primary" text="登录"
color="#0052D9" />
<!-- <div class="bottom-text" @click="changeMode">切换主题</div> -->
</div>
</div>
......@@ -24,7 +24,8 @@
import {
reactive,
onMounted,
getCurrentInstance
getCurrentInstance,
onBeforeMount
} from 'vue';
import {
login
......@@ -39,22 +40,22 @@
fetchCurrentUserInfo
} from '@/api/account.ts';
const { ctx } = getCurrentInstance()
const {
ctx
} = getCurrentInstance()
const conf = reactive({
model1: {
username: '',
password: ''
},
username: '',
password: '',
theme: store.theme.theme,
rules: {
'username': {
type: 'string',
// type: 'string',
required: true,
message: '请输入账号',
trigger: ['blur', 'change']
trigger: ['change']
},
'password': {
type: 'string',
// type: 'string',
required: true,
message: '请输入密码',
trigger: ['blur', 'change']
......@@ -62,7 +63,7 @@
},
})
const loginAction = async () => {
const handleSubmit = async () => {
// 获取用户列表
// http
// .get('/api/user/list')
......@@ -74,11 +75,30 @@
// console.log('局部http 获取用户列表 get fail----');
// console.log(err);
// });
const data = await fetchLoginToken(conf.model1)
if (data.data.access_token) {
uni.setStorageSync('Authorization', data.data.access_token)
const payload = {
username: conf.username,
password: conf.password
}
// uni.$u.toast('校验失败')
if (payload.password && payload.username) {
const data = await fetchLoginToken(payload);
console.log(data, `!!!!!`)
if (data.data.access_token) {
uni.setStorageSync('Authorization', data.data.access_token);
const userInfo = await fetchCurrentUserInfo({});
console.log(userInfo, `*******`)
store.user.currentUser = userInfo.data || {};
uni.showToast({
title: "登录成功!",
mask: true,
success: () => {
router.push('/service/home')
}
})
}
} else {
uni.$u.toast('账号或密码错误!')
}
console.log(data, `!!!!!`)
}
const formSubmit = () => {
......@@ -91,13 +111,24 @@
// const theme = conf.theme === 'light' ? 'dark' : 'light'
// store.theme.setTheme(theme)
// conf.theme = theme
const data = await fetchCurrentUserInfo({})
// const data = await fetchCurrentUserInfo({})
// https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
}
// onMounted(() => {
// console.log(ctx, `))))))))))`, ctx.$refs.loginForm)
// ctx.$refs.loginForm.setRules(conf.rules)
// })
onBeforeMount(() => {
const Authorization = uni.getStorageSync('Authorization');
if(Authorization) {
router.clear('/service/home')
} else {
uni.reLaunch({
url: '/login'
})
}
})
</script>
<style lang="scss" scoped>
......
......@@ -21,7 +21,7 @@
</div>
</div>
</div>
<global-bottom :show="router.item.item.showTabs"></global-bottom>
<global-bottom :show="router?.item?.item?.showTabs"></global-bottom>
<log v-if="conf.debug" />
<mask v-if="conf.mask" />
<!-- <fps :show="conf.fps" /> -->
......@@ -36,6 +36,8 @@ import ctimer from '@/utils/ctimer';
import { onMounted, reactive, watch } from 'vue';
import box from './box.vue';
console.log(router, `***************`)
const conf = reactive({
debug: false,
mask: false,
......@@ -111,7 +113,8 @@ onMounted(() => {
})
//第一个页面
router.clear('/load')
router.clear('/login')
// router.clear('/load')
})
const beforeleave = () => {
......
.home_com_content {
position: relative;
.com_search {
padding: 0 12px 0px;
width: 100%;
box-sizing: border-box;
margin-top: 12px;
position: relative;
.search_input {
flex: 1;
margin-right: 12px;
::v-deep input {
height: 16px;
}
}
.collection_content, .com_project {
padding: 5px;
background-color: #fff;
display: flex;
border-radius: 3px;
}
.collection_content {
image {
width: 19px;
height: 19px;
}
// box-sizing: border-box;
}
.com_project {
text-align: right;
position: absolute;
right: 12px;
top: 42px;
image {
width: 19px;
height: 19px;
}
}
}
.device_card {
position: fixed;
bottom: 82px;
left: 0px;
width: 100%;
padding: 0px 12px;
box-sizing: border-box;
.card_content_line {
height: 3px;
flex: 1;
background-color: #0052D9;
margin: 3px;
box-sizing: border-box;
}
.card_content_body {
background-color: #fff;
padding: 10px 14px;
border-radius: 5px;
color: #989898;
&.active {
background-color: #0052D9;
color: #fff;
.value {
color: #fff;
}
}
.value {
color: #323232;
}
.title {
image {
width: 14px;
height: 14px;
}
.title_card {
margin-left: 5px;
}
}
}
}
}
\ No newline at end of file
<template>
<div class="home_com_content" :style="{width: '100%', height: 'calc(100% - 114px)'}">
<!-- :latitude="latitude" :longitude="longitude" :markers="covers" -->
<!-- <map style="width: 100%; height: 100%;">
<cover-view style="width: 100%;">
<cover-view style="display: flex;justify-content: space-between;align-items: center;padding: 16px 16px 0px;width: 100%;">
<u--input class="search_input" customStyle="background-color: #fff; height: 16px;flex: 1" v-model="conf.searchValue" placeholder="请输入账号" clearable />
<div>
<img src="/static/image/collection.png" style="width: 19px;" />
</div>
</cover-view>
</cover-view>
</map> -->
<div class="com_search pos_btw">
<u--input class="search_input" customStyle="background-color: #fff; height: 16px;flex: 1"
v-model="conf.searchValue" placeholder="请输入搜索内容" clearable prefixIcon="scan" />
<div class="collection_content">
<image src="/static/image/collection.png" />
</div>
<div class="com_project">
<image src="/static/image/project_icon.png" />
</div>
</div>
<u-row class="device_card" gutter="12" align="bottom">
<u-col span="4" v-for="item in conf.totalList" :data-id="item.id" @touchstart="touchstart" :key="item.id"
@touchend="touchend" @click="() => cardChange(item.id)">
<div>
<div class="card_content_line"
:style="{backgroundColor: conf.cardCurrent === item.id ? '#0052D9' : 'transparent'}" />
<div @click="() => totalChange(item.list[0].id)">
<div :class="`card_content_body ${conf.current === item.list[0].id ? 'active' : ''}`">
<div class="value">{{item.list[0].value}}</div>
<div class=".pos_start title">
<image
:src="`/static/image/${conf.show && `${item.list[0].icon?.split('_')?.[0] || ''}_all` || conf.current === item.list[0].id ? `${item.list[0].icon}-active` : item.list[0].icon}.png`" />
<div class="title_card">{{item.list[0].label}}</div>
</div>
</div>
</div>
<div v-for="(child, index) in item.list?.filter(ele => ele?.id !== item.list[0].id)" :key="item.id"
@click="() => totalChange(child.id)" v-if="conf.show && conf.cardCurrent === item?.id"
:style="{transition: '2s', height: conf.show && conf.cardCurrent === item?.id ? 'auto' : 0}">
<div :class="`card_content_body ${conf.current === child.id ? 'active' : ''}`">
<div class="value">{{child.value}}</div>
<div class=".pos_start title">
<image
:src="`/static/image/${conf.show && `${child.icon?.split('_')?.[0] || ''}_all` || conf.current === child.id ? `${child.icon}-active` : child.icon}.png`" />
<div class="title_card">{{child.label}}</div>
</div>
</div>
</div>
</div>
</u-col>
</u-row>
</div>
</template>
<script setup lang="ts">
import {
reactive,
} from 'vue';
import {
debounce
} from '@/utils';
const conf = reactive({
searchValue: '',
cardCurrent: 'gateway',
current: 'gateway_total',
show: false,
touchData: {},
totalList: [{
id: 'gateway',
list: [{
label: '网关总数',
id: 'gateway_total',
value: 23322,
icon: 'gateway_total'
}, {
label: '在线数量',
id: 'gateway_online',
value: 23322,
icon: 'gateway_online'
}, {
label: '离线数量',
id: 'gateway_outline',
value: 23322,
icon: 'gateway_outline'
}, {
label: '停用数量',
id: 'gateway_stop',
value: 23322,
icon: 'gateway_stop'
}, {
label: '已激活数',
id: 'gateway_active',
value: 23322,
icon: 'gateway_active'
}, {
label: '未激活数',
id: 'gateway_unactive',
value: 23322,
icon: 'gateway_unactive'
}]
},
{
id: 'device',
list: [{
label: '设备总数',
id: 'device_total',
value: 23322,
icon: 'device_total'
}, {
label: '正常',
id: 'device_normal',
value: 23322,
icon: 'device_normal'
}, {
label: '在线',
id: 'device_online',
value: 23322,
icon: 'device_online'
}, {
label: '离线',
id: 'device_outline',
value: 23322,
icon: 'device_outline'
}, {
label: '报警',
id: 'device_alarm',
value: 23322,
icon: 'device_alarm'
}, {
label: '故障',
id: 'device_fault',
value: 23322,
icon: 'device_fault'
}]
},
{
id: 'alarm',
list: [{
label: '今日报警',
id: 'alarm_total',
value: 23322,
icon: 'alarm_total'
},
{
label: '待处理',
id: 'alarm_nodeal',
value: 23322,
icon: 'alarm_nodeal'
},
{
label: '已转工单',
id: 'alarm_transfer',
value: 23322,
icon: 'alarm_transfer'
},
{
label: '已处理',
id: 'alarm_dealed',
value: 23322,
icon: 'alarm_dealed'
},
]
},
]
})
const cardChange = (value: string) => {
conf.cardCurrent = value;
}
const totalChange = (value: string) => {
conf.current = value;
}
const touchstart = (e) => {
conf.touchData.clientX = e?.changedTouches[0].clientX;
conf.touchData.clientY = e.changedTouches[0].clientY;
}
const touchend = (e) => {
const subX = e.changedTouches[0].clientX - conf.touchData.clientX;
const subY = e.changedTouches[0].clientY - conf.touchData.clientY;
if (subY > 50 && e?.currentTarget?.dataset?.id === conf.cardCurrent && conf.show) {
console.log('下滑')
conf.show = false;
}
if (subY < -50 && e?.currentTarget?.dataset?.id === conf.cardCurrent && !conf.show) {
console.log('上滑')
conf.show = true;
}
if (subX > 50) {
console.log('右滑')
}
if (subX > -50) {
console.log('左滑')
}
console.log(e, `************`, conf.show)
}
</script>
<style lang="scss" scoped>
@import 'index.scss'
</style>
.home {
.title {
&-bar {
width: 100vw;
}
&-box {
display: flex;
height: 44px;
padding: 0 10px;
justify-content: flex-start;
align-items: center;
color: #000;
}
&-left {
width: 60px;
height: 100%;
position: relative;
display: flex;
align-items: center;
&-icon {
display: inline-flex;
align-items: center;
color: rgb(51, 51, 51);
}
}
&-centent {
flex: 1;
text-align: center;
font-size: 14px;
}
&-right {
width: 80px;
}
&-logo {
width: 40%;
height: 50rpx;
}
}
}
\ No newline at end of file
<template>
<div class="absolute fit column">
<!-- <uni-swiper-dot :info="conf.info" :current="conf.current" field="content" :mode="conf.mode"
:dots-styles="conf.dotsStyles" style="margin-bottom:10rpx;">
<swiper class="swiper-box" @change="change" circular style="height:400rpx">
<swiper-item>
<img class="fit" src="@/static/image/pro.png" />
</swiper-item>
<swiper-item>
<view class="fit flex flex-center">
B
</view>
</swiper-item>
<swiper-item>
<view class="fit flex flex-center">
C
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
<div class="bottom-text" :style="{color: conf.color}" @click="clickAction">按钮</div>
<div class="col scroll-y">
<div class="row" style="gap:30rpx;padding: 30rpx;">
<div @click="clickAction" class="val-item column flex-center no-wrap" v-for="l in 20" :key="l">
<div class="val-item-text1">0.00</div>
<div class="val-item-text2">KW</div>
<div class="val-item-text3">运动距离</div>
<div class="fit column home">
<div class="title-bar">
<div class="title-box" :style="{ marginTop: `${store.system.statusBarHeight}px` }">
<div class="title-left"></div>
<div class="title-centent ellipsis">
<img src="/static/image/logo.png" class="title-logo" />
</div>
<div class="title-right"></div>
</div>
</div> -->
<!-- :latitude="latitude" :longitude="longitude" :markers="covers" -->
<map style="width: 100%; height: 300px;"></map>
</div>
<u-sticky bgColor="#fff">
<u-tabs :current="conf.tab" lineColor="#0052D9" lineWidth="106" :list="conf.tabList" @change="tabChange" itemStyle="padding: 15px 23px;" />
</u-sticky>
<com-home v-if="conf.tab === 0" />
</div>
</template>
......@@ -40,6 +23,9 @@
reactive,
getCurrentInstance
} from 'vue';
import ComHome from './ComHome/index.vue'
const internalInstance = getCurrentInstance();
const login = internalInstance.appContext.config.globalProperties.login;
const conf = reactive({
......@@ -54,9 +40,26 @@
selectedBackgroundColor: 'rgba(66,66,66,0.4)',
selectedBorder: '1px rgba(66,66,66,0) solid'
},
searchValue: '',
tab: 0,
tabList: [{
name: '综合首页',
value: 1
}, {
name: '能源管理',
value: 2
}, {
name: '智慧教室',
value: 3
}]
})
router.item.item.title = store.user.proinfo.name
const tabChange = (e) => {
conf.tab = e?.index
console.log(e, `###########`)
}
const change = (e: any) => {
console.log(e)
......@@ -69,29 +72,6 @@
}
</script>
<style lang="scss">
.val-item {
width: 210rpx;
height: 156rpx;
border-radius: 20rpx;
background: rgba(0, 0, 0, 0.03);
&-text1 {
font-size: 44rpx;
line-height: 44rpx;
color: #3EB958;
}
&-text2 {
font-size: 20rpx;
margin: 10rpx 0rpx 5rpx 0rpx;
color: rgba(66, 66, 66, 0.5);
}
&-text3 {
font-size: 22rpx;
color: rgba(66, 66, 66, 0.6);
}
}
<style lang="scss" scoped>
@import 'index.scss';
</style>
<template>
<error v-if="show('/error')" />
<load v-else-if="show('/load')" />
<!-- <load v-else-if="show('/load')" /> -->
<login v-else-if="show('/login')" />
<prolist v-else-if="show('/prolist')" />
......@@ -13,7 +13,7 @@
<script lang="ts" setup>
import error from '@/pages/error/index.vue';
import load from '@/pages/load/index.vue';
// import load from '@/pages/load/index.vue';
import login from '@/pages/login/index.vue';
import prolist from '@/pages/prolist/index.vue';
import shome from '@/pages/service/home/index.vue';
......
......@@ -3,13 +3,14 @@ import router from "."
const tasObj = {
// iconPath: "/static/image/logo.png",
// selectedIconPath: "/static/image/logo.png",
showTitle: true,
titleBackText: '退出',
titleBackFun: () => {
router.clear('/login')
},
showTitle: false,
backShow: false,
// titleBackText: '退出',
// titleBackFun: () => {
// router.clear('/login')
// },
titleStyles: {
background: '#ffffff00',
background: '#ffffff',
color: '#0052D9'
},
showTabs: true,
......@@ -56,9 +57,9 @@ export const routerList = [
{
pagePath: "/error",
},
{
pagePath: "/load",
},
// {
// pagePath: "/load",
// },
{
pagePath: "/login",
param: {
......
......@@ -105,9 +105,9 @@ const jumpItem = (pagePath: string, param: any): routerHistory => {
}
const getItem = (pagePath: string) => {
if (pagePath.indexOf('?') != -1) pagePath = pagePath.split('?')[0]
const arr = router.list.filter(item => item.pagePath === pagePath)
if (arr.length > 0) return arr[0]
if (pagePath?.indexOf('?') != -1) pagePath = pagePath?.split('?')[0]
const arr = router?.list?.filter(item => item?.pagePath === pagePath)
if (arr?.length > 0) return arr[0]
return null
}
......
......@@ -4,7 +4,8 @@ const user = reactive({
proinfo: {
id: 0,
name: ''
}
},
currentUser: {}
})
export default user
\ No newline at end of file
@font-face {
font-family: 'bsfont';
font-size: 14px;
src: url('@/static/font/font.ttf') format('truetype');
}
\ No newline at end of file
@import 'font';
@import 'common';
@import 'core';
\ No newline at end of file
@import 'core';
@import 'position'
\ No newline at end of file
.wrap_page {
position: relative;
width: 100%;
height: 100%;
}
//flex布局全局样式
.pos_aline {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
}
.pos_aline_start {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: flex-start;
}
.pos_aline_start_wrap {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
padding-top: 12px;
}
.pos_start {
display: flex;
align-items: center;
justify-content: flex-start;
}
.pos_start_column {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.pos_start_wrap {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
}
.pos_btw {
display: flex;
align-items: center;
justify-content: space-between;
}
.pos_btw_start {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
}
.pos_btw_stretch {
display: flex;
align-items: stretch;
justify-content: space-between;
}
.pos_btw_column {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.pos_center {
display: flex;
align-items: center;
justify-content: center;
}
.pos_center_wrap {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
.pos_center_no_wrap {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
}
.pos_center_column {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.pos_end {
display: flex;
align-items: center;
justify-content: flex-end;
}
.pos_around {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
.pos_aline_center {
display: flex;
flex-direction: row;
align-items: center;
}
.pos_aline_no_wrap {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
}
.pos_aline_stretch {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: stretch;
}
.form_search {
display: flex;
flex-flow: row wrap;
align-content: space-around;
align-items: center;
justify-content: flex-start;
}
.pos_full_page {
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
}
.pos_column {
display: flex;
flex-direction: column;
}
.pos_column_center {
display: flex !important;
flex-direction: column;
align-items: center;
justify-content: center;
}
.pos_space {
flex: 1;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
}
.pos_column_start {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
.pos_column_end {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
}
.pos_column_btw {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.dark {
--primary: #007bff;
font-size: 14px;
}
\ No newline at end of file
.light {
--primary: #6EDB85;
--primary: #0052D9;
font-size: 14px;
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-primary: #0052D9;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
......@@ -75,4 +75,11 @@ $uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30rpx;
\ No newline at end of file
$uni-font-size-paragraph:30rpx;
page {
box-sizing: border-box;
}
.primary-color {
color: var(--primary);
}
\ No newline at end of file
// -防抖
export function debounce(fn: any, wait: number) {
let delay = wait || 500
let timer
return function() {
let args = arguments;
if (timer) {
clearTimeout(timer)
}
let callNow = !timer
timer = setTimeout(() => {
timer = null
}, delay)
if (callNow) fn.apply(this, args)
}
}
// -节流
export function throttle(fn: any, wait: number) {
let delay = wait || 500
let timer = null
return function() {
if (timer) {
return
}
timer = setTimeout(() => {
fn.apply(this, arguments)
timer = null
}, delay)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment