You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.6 KiB
112 lines
3.6 KiB
2 years ago
|
var ES = ""
|
||
|
function checkSocureData(posParam) {
|
||
|
let param = window.location.href.split('?')[1] || ''
|
||
|
if(param)
|
||
|
{
|
||
|
ES = ''
|
||
|
$.ajax({
|
||
|
url: config.API_URL+"/scan/code/"+encodeURIComponent(param),
|
||
|
type: "GET",
|
||
|
dataType: "json",
|
||
|
"Content-Type":"application/json",
|
||
|
success: function(res) {
|
||
|
if(res.code == 200)
|
||
|
{
|
||
|
|
||
|
$("#patch").show()
|
||
|
$("#aplayerBlock").show()
|
||
|
$("#gyhl_code").text(res.data.gyhl_code)
|
||
|
if(parseInt(res.data.scan_count) > 1)
|
||
|
{
|
||
|
$("#scan_count").text(res.data.scan_count)
|
||
|
let errInfo = '<span>(<span style="color:#C02932;">谨防假冒!</span>)</span>'
|
||
|
$("#scan_count").append(errInfo)
|
||
|
} else {
|
||
|
$("#scan_count").text(res.data.scan_count)
|
||
|
}
|
||
|
$("#first_scan").text(res.data.first_scan)
|
||
|
let url = config.API_URL + res.data.url
|
||
|
$('#play1').attr('src',url)
|
||
|
var fry_audio=$('#play1').get('0');
|
||
|
fry_audio.load()
|
||
|
if(res.data.es)
|
||
|
{
|
||
|
ES = res.data.es
|
||
|
getCurrentPosition()
|
||
|
}
|
||
|
} else {
|
||
|
$("#noFound").show()
|
||
|
}
|
||
|
},
|
||
|
error: function(err) {
|
||
|
console.log(err);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
function sendAddrData(posParam) {
|
||
|
if(posParam.lat&&posParam.lng&&posParam.address&&ES)
|
||
|
{
|
||
|
let paramData = {
|
||
|
"es":ES,
|
||
|
"lng":posParam.lng,
|
||
|
"lat":posParam.lat,
|
||
|
"address":posParam.address
|
||
|
}
|
||
|
$.ajax({
|
||
|
url: config.API_URL+"/scan/code/address",
|
||
|
type: "post",
|
||
|
dataType: "json",
|
||
|
headers:{
|
||
|
"Content-Type":"application/json"
|
||
|
},
|
||
|
data:JSON.stringify(paramData) ,
|
||
|
success: function(res) {
|
||
|
},
|
||
|
error: function(err) {
|
||
|
console.log(err);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
//获取地址信息,设置地址label
|
||
|
function getAddress(point){
|
||
|
let params = {}
|
||
|
params.lat = point.lat
|
||
|
params.lng = point.lng
|
||
|
var gc = new BMap.Geocoder();
|
||
|
gc.getLocation(point, function(rs){
|
||
|
var addComp = rs.addressComponents;
|
||
|
var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;//获取地址
|
||
|
params.address = address
|
||
|
sendAddrData(params)
|
||
|
});
|
||
|
}
|
||
|
//浏览器定位
|
||
|
function getCurrentPosition () {
|
||
|
var geolocation = new BMap.Geolocation();
|
||
|
geolocation.getCurrentPosition(function(r){
|
||
|
|
||
|
if(this.getStatus() == BMAP_STATUS_SUCCESS){
|
||
|
// mk = new BMap.Marker(r.point);
|
||
|
getAddress(r.point);
|
||
|
}else {
|
||
|
function myFun(result){
|
||
|
let params = {}
|
||
|
params.lat = result.center.lat
|
||
|
params.lng = result.center.lng
|
||
|
params.address = result.name;
|
||
|
sendAddrData(params)
|
||
|
}
|
||
|
var myCity = new BMap.LocalCity();
|
||
|
myCity.get(myFun);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
window.onload=function(){
|
||
|
checkSocureData()
|
||
|
}
|
||
|
|
||
|
|
||
|
uglifyjs m.js -o m.min.js
|