| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <script>
- import {
- onBackPress
- } from "@dcloudio/uni-app"
- import {
- toast,
- getUserIdentity
- } from "@/utils/common";
- import {
- banbenImpinfo
- } from "@/api/login.js"
- import cacheManager from "@/utils/cacheManager.js";
- import {
- useIsCanBack
- } from "@/store/isCanBack.js"
- export default {
- // creat by wgy 0619 生命周期 钩子
- onLaunch: function() {
- // #ifdef APP-PLUS
- // 有auth
- if (cacheManager.get('auth')) {
- // 有内容缓存 跳到学习页面
- if (cacheManager.get('contentInfo')) {
- uni.switchTab({
- url: `/pages/chanpinneirong/index`,
- success() {
- plus.navigator.closeSplashscreen();
- }
- })
- } else {
- //没有内容缓存 请求接口
- uni.switchTab({
- url: `/pages/chanpinXuanze/index`,
- success() {
- plus.navigator.closeSplashscreen();
- }
- })
- }
- } else {
- cacheManager.clearAll()
- uni.reLaunch({
- url: '/pages/login/index',
- success() {
- plus.navigator.closeSplashscreen();
- }
- });
- }
- // #endif
- },
- onShow: function() {
- // #ifdef APP-PLUS
- const webview = plus.webview.currentWebview();
- plus.key.addEventListener('backbutton', () => {
- const store = useIsCanBack();
- if (!store.isCanBack) {
- event.preventDefault();
- return false
- } else {
- return true
- }
- });
- // #endif
- },
- onHide: function() {
- }
- }
- </script>
- <style lang="scss">
- /* 公共样式 */
- @import '/common/styles/index.scss';
- // 小米字体、思源黑体、苹果平方、数字字体、通用无衬线字体
- body,
- html,
- #app {
- font-family: "MiSans", "PingFang SC", sans-serif;
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- </style>
|