You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script>
import config from './config';
import store from '@/store';
import { getToken, getuserId, removeuserId } from '@/utils/auth';
// #ifdef APP-PLUS
import permision from '@/js_sdk/wa-permission/permission.js';
// #endif
export default {
onLaunch: function() {
// removeuserId();
// console.log(getuserId())
// //有userid才执行,就是说第一次没登录前本地没有userid就不会执行
// if (getuserId()) {
// console.log('shauxin');
// this.$store.dispatch('websocketInit', `${getuserId()}`);
// }
//隐藏tabber
uni.hideTabBar();
this.initApp();
},
onShow: function() {
// console.log('shauxin2');
uni.hideTabBar();
// #ifdef APP-PLUS
let that = this;
that.requestAndroidPermission('android.permission.READ_CALENDAR'); // 读取日历
that.requestAndroidPermission('android.permission.WRITE_CALENDAR'); // 写入日历
// #endif
},
methods: {
// 初始化应用
initApp() {
// 初始化应用配置
this.initConfig();
// 检查用户登录状态
},
initConfig() {
this.globalData.config = config;
},
// 网址的代码 copy
async requestAndroidPermission(permisionID) {
let result = await permision.requestAndroidPermission(permisionID);
let strStatus;
if (result == 1) {
strStatus = '已获得授权';
} else if (result == 0) {
strStatus = '未获得授权';
} else {
strStatus = '被永久拒绝权限';
}
// 测试代码
// uni.showModal({
// content: permisionID + strStatus,
// showCancel: false
// });
}
}
};
</script>
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import '@/uni_modules/uview-ui/index.scss';
@import '@/static/scss/index.scss';
//黑体
@font-face {
font-family: 'Source_Han_Sans_SC_Normal_Normal';
src: url('/static/fontSize/Source_Han_Sans_SC_Normal_Normal.otf');
}
html,
body {
font-family: 'Source_Han_Sans_SC_Normal_Normal';
}
page {
background-color: #f6f7fb;
}
</style>