123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <view class="pages">
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
-
- }
- },
- onShow() {
- // console.log('config',this.$getimg);
- },
- onLoad() {
- // 从本地缓存中同步获取指定 key 对应的内容,用于判断是否是第一次打开应用
- const launch = uni.getStorageSync('launchFlag');
- const haslogin = uni.getStorageSync('hasLogin');
- const version = uni.getStorageSync('version');
-
- if(!version){
- uni.setStorage({
- key: 'version',
- data: this.config.version
- });
- }
- if (launch&&version==this.config.version&&haslogin) {
- // 如果已经有,直接去首页
- this.goIndex();
- // this.goLogin();//有问题先每次登录
- } else if(launch&&version==this.config.version&&!haslogin){
- // this.goLogin();
- this.goIndex();
- } else {
- // 没有值,跳到引导页,并存储,下次打开就不会进去引导页
- this.goGuide();
- // this.lxfEndtime();
- };
- //
- uni.removeStorage({
- key:'beforeLoginPage'
- });
- },
- onReady() {
-
-
- },
- methods: {
- goIndex(){
- uni.setStorage({
- key: 'version',
- data: this.config.version
- });
- uni.switchTab({
- url: '/pages/index/index',
- fail(err) {
- // console.log(err)
- }
- });
- },
- goGuide(){
- uni.setStorage({
- key: 'version',
- data: this.config.version
- });
- uni.redirectTo({
- url: '/pages/index/guide',
- fail(err) {
- // console.log(err)
- }
- });
- },
- goLogin(){
- uni.redirectTo({
- url: '/pages/login/loginType',
- fail(err) {
- // console.log(err)
- }
- });
- },
- }
- }
- </script>
- <style scoped>
- </style>
|