WARNING

工具函数为自定义公共方法,通过工程目录/src/common/vue-install.js文件中安装后,全局挂载,方法仅做示例操作。自定义公共方法源码提供,可在工程目录/src/common文件夹下对不同类型的自定义公共方法自定义扩展修改。

# hasLogin() 判断是否登录

判断是否登录, 根据存储字段状态判断

示例

this.$app.hasLogin()
    .then(res => {
        console.log('app/hasLogin====', JSON.stringify(res)) 
    })
    .catch(err => {
        console.log('err===', err);
        // 调用失败回调
    });

# checkLogin() 检查当前页面入口是否登录

主动检查当前页面入口是否登录,并跳转到登录页面

示例

this.$app
            .checkLogin()
            .then(res => {
              // 调用成功回调
              console.log('app/checkLogin====', JSON.stringify(res));
            })
            .catch(err => {
              console.log('err===', err);
              // 调用失败回调
            });

# toLogin() 打开登录页面

打开登录页面,关闭当前模块, 登录成功后,打开指定的模块和传递重定向参数

示例

this.$app
    .toLogin({
      redirectUrl: 'index'
    })
   

# logonAfterEach() 登录成功后的处理

登录成功后的处理逻辑

示例

this.$app.logonAfterEach(response, callback);  

# toErrorPage() 跳转到超时页面

跳转到超时页面

示例

this.$app.toErrorPage(errPath, errMsg); 
   

# getMessageNum() 获取消息条数

获取消息条数

示例

this.$app.getMessageNum();
   

# setMessageNum() 设置消息条数

设置消息条数

示例

this.$app.setMessageNum();
   

Last Updated: 4/28/2023, 11:24:52 AM