| | |
| | | import md5 from 'js-md5' |
| | | import axios from 'axios' |
| | | |
| | | const geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq"); |
| | | |
| | | const getLocationData = (userId) => { |
| | | var positionNum = 0; |
| | | var options = { |
| | | timeout: 8000 |
| | | }; |
| | | |
| | | function showPosition(position) { |
| | | var adCode = position.adCode; //邮政编码 |
| | | var nation = position.nation; //中国 |
| | | var city = position.city; //城市 |
| | | var addr = position.addr; //详细地址 |
| | | |
| | | axios.post("http://223.82.109.183:2080/api/liveLocation/saveLiveLocationAndLocus", { |
| | | type: 1, |
| | | workerId: userId, |
| | | longitude: position.lng, |
| | | latitude: position.lat, |
| | | location: addr == '' ? position.province + position.city : position.province + position.city + |
| | | addr |
| | | }).then((res) => { |
| | | |
| | | }) |
| | | |
| | | }; |
| | | |
| | | function showErr() { |
| | | //TODO 如果出错了调用此方法 |
| | | }; |
| | | |
| | | geolocation.getLocation(showPosition, showErr, options); |
| | | |
| | | }; |
| | | |
| | | const actions = { |
| | | loging(store, data) { |
| | | var user = [{ |
| | |
| | | }, |
| | | ], |
| | | pasw = md5(data.pass), |
| | | // url = 'http://223.82.109.183:2080/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | // url = this.$store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | url = store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | ' &password=' + pasw + '&grant_type=password&scope=all&type=account'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token'; |
| | |
| | | method: "post", |
| | | // // dataType: 'JSON', |
| | | success: (res) => { |
| | | |
| | | if (res.statusCode == 200) { |
| | | console.log(res) |
| | | if (res.data.error_code == "400") { |
| | | uni.showToast({ |
| | | title: '密码错误,请重试', |
| | |
| | | // data.userPhon = res.user_id; |
| | | |
| | | |
| | | |
| | | |
| | | // 实时定位获取得方法 |
| | | |
| | | uni.getLocation({ |
| | | type: 'gcj02', |
| | | geocode: true, |
| | | success: function(wzres) { |
| | | uni.request({ |
| | | url: "http://61.131.136.25:2080/api/liveLocation/saveLiveLocationAndLocus", |
| | | method: "post", |
| | | data: { |
| | | type: 1, |
| | | workerId: res.data.user_id, |
| | | longitude: wzres.longitude, |
| | | latitude: wzres.latitude, |
| | | location: wzres.address.country + |
| | | wzres.address.province + wzres |
| | | .address.city + wzres.address |
| | | .district + wzres.address |
| | | .street + wzres.address |
| | | .streetNum |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | |
| | | setInterval(function() { |
| | | getLocationData(res.data.user_id); |
| | | }, |
| | | 30000) |
| | | |
| | | uni.getLocation({ |
| | | type: 'gcj02', |
| | | geocode: true, |
| | | success: function(wzres) { |
| | | uni.request({ |
| | | url: "http://61.131.136.25:2080/api/liveLocation/saveLiveLocationAndLocus", |
| | | method: "post", |
| | | data: { |
| | | type: 1, |
| | | workerId: res.data.user_id, |
| | | longitude: wzres.longitude, |
| | | latitude: wzres.latitude, |
| | | location: wzres.address.country + |
| | | wzres.address.province + wzres |
| | | .address.city + wzres.address |
| | | .district + wzres.address |
| | | .street + wzres.address |
| | | .streetNum |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | |
| | | }, 30000) |
| | | |
| | | uni.request({ |
| | | url: "http://223.82.109.183:2080/api/blade-system/dept/detail?id=" + res |
| | | url: store.state.piAPI + "/blade-system/dept/detail?id=" + res |
| | | .data.dept_id, |
| | | method: "get", |
| | | data: { |