App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-23 7b76391180904d58156aef13abcac0256ff7fcc1
1.登出接口接入
已修改4个文件
70 ■■■■ 文件已修改
js/global.js 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/index.html 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/sbgl/rcdj.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/xtsy/index.html 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
js/global.js
@@ -1,14 +1,36 @@
(function(w) {
     // 格式化地址栏参数    将对象自动拼接成地址栏传参形式
     w.formatParams = function() {
            const data = {
                userid: 33,
                usercode: '002',
                username: '张三',
                usertype: 'APP'
            }
        return data;
    w.formatParams = function(data) {
        let temp = ''
        Object.keys(data).map((key, index) => {
            temp += '&' + key + '=' + data[key]
        })
        let firstCharAt = temp.charAt(0)
        temp = temp.replace(firstCharAt, '?')
        return temp;
    }
    
    w.topPopoverClick = function(type) {
        if (type === '操作指导') {
            console.log('操作指导')
        } else if (type === '成品追溯') {
            console.log('成品追溯')
        } else if (type === '退出登录') {
            const data = {
                userid: localStorage.getItem('userid'),
                usercode: localStorage.getItem('usercode'),
                username: localStorage.getItem('username'),
                usertype: localStorage.getItem('usertype')
            }
            post('Login/LoginAppOut' + formatParams(data)).then(res => {
                if (res.code === '200') {
                    window.location.href = '../login/index.html'
                }
            })
        }
        // return 1
    }
    
})(window);
pages/login/index.html
@@ -50,7 +50,8 @@
                        </van-field>
                    </div>
                    <div style="margin-top:30px;">
                        <van-button type="info" style="border-radius: 10px;" @click='loginClick' size="large">立即登录
                        <van-button type="info" style="border-radius: 10px;" :disabled="username===''||password===''"
                            @click='loginClick' size="large">立即登录
                        </van-button>
                    </div>
                </div>
@@ -73,7 +74,7 @@
            },
            mounted() {
                console.log(formatParams(),1)
            },
            methods: {
                loginClick() {
@@ -105,18 +106,12 @@
                                username: res.data.username,
                                usertype: res.data.usertype
                            }
                            post('Login/ForcedOffline?userid=' + res.data.userid + '&usercode=' + res.data
                                .usercode + '&username=' + res.data.username + '&usertype=' + res.data
                                .usertype).then(res2 => {
                            post('Login/ForcedOffline' + formatParams(data2)).then(res2 => {
                                if (res2.code === '200') {
                                    this.loginClick()
                                }
                            })
                        }
                    }).catch(err => {
                        console.log(err);
                    });
pages/sbgl/rcdj.html
@@ -19,6 +19,8 @@
        <script type="text/javascript" src="../../js/common.js"></script>
        <script type="text/javascript" src="../../js/global.js"></script>
        <!-- <link rel="stylesheet" href="../../css/global.css" type="text/css" charset="utf-8" /> -->
        <script type="text/javascript">
@@ -518,7 +520,13 @@
                    this.overlayShow = true
                },
                onSelect(action) {
                    vant.Toast(action.text);
                    if(action.text==='操作指导'){
                        topPopoverClick('操作指导')
                    }else if(action.text==='成品追溯'){
                        topPopoverClick('成品追溯')
                    }else if(action.text==='退出登录'){
                        topPopoverClick('退出登录')
                    }
                    this.overlayShow = false
                },
            }
pages/xtsy/index.html
@@ -21,6 +21,7 @@
        <link rel="stylesheet" href="../css/global.css" type="text/css" charset="utf-8" />
        <script type="text/javascript" src="../../js/global.js"></script>
    </head>
    <body>
@@ -150,7 +151,13 @@
                },
                // 顶部右图标下拉选择
                onSelect(action) {
                    vant.Toast(action.text);
                    if(action.text==='操作指导'){
                        topPopoverClick('操作指导')
                    }else if(action.text==='成品追溯'){
                        topPopoverClick('成品追溯')
                    }else if(action.text==='退出登录'){
                        topPopoverClick('退出登录')
                    }
                    this.overlayShow = false
                },
            }