App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-23 7b76391180904d58156aef13abcac0256ff7fcc1
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);