加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
App.vue 5.25 KB
一键复制 编辑 原始数据 按行查看 历史
dvadmin 提交于 2023-03-27 01:35 . 手机号登录优化完成
<script>
import {mapActions} from 'vuex';
import Env from '@/env.js'
export default {
async onLaunch() {
console.log('App Launch');
// #ifdef APP-NVUE || APP-PLUS-NVUE
//at.alicdn.com/t/font_2660213_naog46qr7c.ttf?t=1636788566991
var domModule = weex.requireModule('dom');
//../../tm-vuetify/scss/iconfonts/iconfont.ttf\
domModule.addRule('fontFace', {
fontFamily: 'iconfontTM', //注意这里必须是驼峰命名,跟上面的css样式对照
src: "url(\'https://at.alicdn.com/t/font_2660213_naog46qr7c.ttf?t=1636788566991\')"
});
// #endif
this.getPcaCode() //获取区域信息
this.appInit() //初始化配置
//获取字典
this.getDict() //获取字典
// 获取个人信息
if (uni.getStorageSync('accessToken')) {
// 校验是否是品牌商,如果不是则跳转到选择品牌商页面
if (Env.MODE === 'saas' && !this.$dvadminStore.getters.tenantId) {
uni.redirectTo({
url: $mRoutesConfig.selectTenant.path
});
} else {
await this.$dvadminStore.dispatch('getUserInfo')
}
}
},
onShow: function() {
console.log('App Show');
// 全局判断是否有token
if (!uni.getStorageSync('accessToken')) {
uni.redirectTo({
url: '/pages/login/index'
});
}
// #ifdef MP
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,确认重启应用?',
showCancel: false,
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function(res) {
// 新的版本下载失败
uni.showModal({
title: '更新提示',
content: '新版本更新失败,确认重试',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
// #endif
},
onHide: function() {
console.log('App Hide');
},
methods:{
...mapActions(['getPcaCode', 'appInit','getDict']),
}
};
</script>
<style>
/*每个页面公共css */
@import './tm-vuetify/mian.min.css';
@import './tm-vuetify/scss/theme.css';
@font-face {
font-family: 'myicon';
/* Project id 2948283 */
src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAXQAAsAAAAADEgAAAWCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDOAqLXIllATYCJAMYCw4ABCAFhE8HTxuACiMRtntQQpH91QFvKH30d2AQLmoMihKDOaHMZrQqnnG92d0NlvE5F+EQ7vPeBwG9V311d9LZ8YLZg5GDODMHGX/kI+P3btZW40comlvslubKnQ/wA32S/riay72ZqJx9FA5JGURJFtgm9gHbKiC2IXCy93/zz92YlGjCvQQS6fRfAzZYOg+A/38/V+dYGoTIuQ1tjRS/2J3528dUo/aFQqSZWMlmKVJKYynPw4Rj4dQpuFd3FgTgpQiVkNVr1m9OsE90SD9sDMR4AWF10adn9ygxVydGgV4QY9FV1zQQCzBBzpR3gPnuy4uvFBMxIDEVYl+Nu9XowoUP+UNmNcFFUM+YiNeKzi0BE1BAgZG5RZ9iuRvKxwKu0QuVNSgHxEgiAbUg7UNm1/U1KfysmEKjn/3LkygMTBAaYfRTc31eaMKHkI6CgA8pUZDwIdWOepnSqB2DmjLTFpgAaMS8rCA1dXVCWAvgBxt8RqNqrgznfscoliPQIxRRnXAxXsV8sxRlrKq0rk80LX0csWmSm6s7v3SVLakkKOYbhBm9QBRk7FzPZF5t2XIVR4bOWGLNj3yDdPGCK75dIQ6/ufExWfpp8BfYmJOtli9wxJkx3mLpCno7NNS3nANx10P3imt5YL1RMUafdO8GeYnmlgS/BOv2EY27veN1lb25Zlrv6Yp10RodpATAmTTDDzuK+Pwf0iC1x+/TfiIJZ9iL/4Q+A6igXMYTqDUFevSBTMezZGjMWSNODSbBhlouDksEVbl3jNqbvsG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FNoYaE6i3l9d36cve3rw4Joj6rjBcfQN+DNBgAA') format('woff2');
}
/* 下方是自定义图标演示 */
.myicon {
font-family: 'myicon' !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.myicon-camera:before {
content: '\e60f';
}
.myicon-music:before {
content: '\e617';
}
.myicon-news:before {
content: '\e618';
}
.myicon-phone:before {
content: '\e619';
}
.myicon-video:before {
content: '\e61f';
}
/* #ifndef APP-NVUE || APP-PLUS-NVUE */
body::-webkit-scrollbar,
div::-webkit-scrollbar,
*::-webkit-scrollbar {
display: none;
}
body.pages-index-index uni-page-body,
body {
padding-bottom: 0 !important;
}
/* #endif */
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化