| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <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')) {
- banbenImpinfo({}).then(res => {
- if (res.code == 0) {
- //学过 增加customType = 1 是App级别的
- if (res.data.chanpinId != 0) {
- uni.reLaunch({
- url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&chanpinId=${res.data.chanpinId}&dengjiId=${res.data.dengjiId}&customType=1`,
- success() {
- plus.navigator.closeSplashscreen();
- }
- })
- } else {
- // 没学过
- uni.reLaunch({
- url: `/pages/chanpinXuanze/index`,
- success() {
- plus.navigator.closeSplashscreen();
- }
- })
- }
- }
- }).catch(() => {
- toast("App.vue,banbenImpinfo接口错误")
- cacheManager.clearAll()
- return false
- })
- } 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: "Helvetica Neue", "Microsoft YaHei", "SimHei", "SimSun", "Arial", sans-serif;
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- </style>
|