You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.3 KiB
TypeScript
79 lines
1.3 KiB
TypeScript
/*
|
|
* @Author: zhou lei
|
|
* @Date: 2021-11-08 17:12:53
|
|
* @LastEditTime: 2022-01-20 11:57:05
|
|
* @LastEditors: zhou lei
|
|
* @Description:
|
|
* @FilePath: /wms_haiwai_app/src/components/base/page.ts
|
|
* 联系方式:910592680@qq.com 18669792120 科海达信息技术有限公司
|
|
*/
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
import { page } from '@/utils/page';
|
|
import { session } from '@/store/modules/session';
|
|
import { image } from '@/utils/image';
|
|
|
|
@Component
|
|
export class BasePage extends Vue {
|
|
/**
|
|
* 全局uni变量
|
|
*/
|
|
uni = uni;
|
|
|
|
/**
|
|
* 当前会话信息
|
|
*/
|
|
session = session;
|
|
|
|
/**
|
|
* 页面索引
|
|
*/
|
|
page = page;
|
|
|
|
/**
|
|
* 图片
|
|
*/
|
|
image = image;
|
|
|
|
/**
|
|
* 页面滚动高度
|
|
*/
|
|
scrollTop = 0;
|
|
|
|
/**
|
|
* 未登录是否可以访问本页面
|
|
*/
|
|
get guest(): boolean {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 每次显示页面时调用
|
|
*/
|
|
onShow() {
|
|
// 检查登录状态
|
|
if (!this.guest && !session.isUserLoggedIn) {
|
|
uni.reLaunch({
|
|
url: page.login.login,
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 页面跳转
|
|
* @param url
|
|
*/
|
|
toPage(url: string) {
|
|
uni.navigateTo({ url });
|
|
}
|
|
redirectTo(url: string) {
|
|
uni.redirectTo({ url });
|
|
}
|
|
/**
|
|
* 页面滚动
|
|
* @param e
|
|
*/
|
|
onPageScroll(e: any) {
|
|
this.scrollTop = e.scrollTop;
|
|
}
|
|
}
|