| | |
| | | (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); |
| | |
| | | </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> |
| | |
| | | |
| | | }, |
| | | mounted() { |
| | | console.log(formatParams(),1) |
| | | |
| | | }, |
| | | methods: { |
| | | loginClick() { |
| | |
| | | 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); |
| | | }); |
| | |
| | | |
| | | <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"> |
| | |
| | | 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 |
| | | }, |
| | | } |
| | |
| | | |
| | | |
| | | <link rel="stylesheet" href="../css/global.css" type="text/css" charset="utf-8" /> |
| | | <script type="text/javascript" src="../../js/global.js"></script> |
| | | |
| | | </head> |
| | | <body> |
| | |
| | | }, |
| | | // 顶部右图标下拉选择 |
| | | onSelect(action) { |
| | | vant.Toast(action.text); |
| | | if(action.text==='操作指导'){ |
| | | topPopoverClick('操作指导') |
| | | }else if(action.text==='成品追溯'){ |
| | | topPopoverClick('成品追溯') |
| | | }else if(action.text==='退出登录'){ |
| | | topPopoverClick('退出登录') |
| | | } |
| | | this.overlayShow = false |
| | | }, |
| | | } |