113 lines
3.3 KiB
HTML
113 lines
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title></title>
|
|
<script type="text/javascript" src="https://saas.eshangtech.com/goaliPay/uniTools.js"></script>
|
|
<script>
|
|
window.onload = function() {
|
|
// 获取按钮元素
|
|
const userMessageButton = document.getElementById('userMessage');
|
|
const positionButton = document.getElementById('position');
|
|
const scanButton = document.getElementById('scanCode');
|
|
const openLocationButton = document.getElementById('openLocation');
|
|
const openNewPageButton = document.getElementById('openNewPage');
|
|
const openNewPageWXButton = document.getElementById('openNewPageWX');
|
|
const backPageButton = document.getElementById('backPage');
|
|
|
|
|
|
userMessageButton.addEventListener('click', function() {
|
|
UNI_TOOLS.uniApi({
|
|
apiName: 'getStorageSync',
|
|
params: 'userInfo',
|
|
success: (res) => {
|
|
console.log('USER_INFO', JSON.stringify(res) )
|
|
const contentBox = document.getElementById('content')
|
|
contentBox.innerText = res
|
|
}
|
|
})
|
|
})
|
|
|
|
positionButton.addEventListener('click', function() {
|
|
// 获取位置
|
|
UNI_TOOLS.uniApi({
|
|
apiName: 'getLocation',
|
|
params: {
|
|
type: 'wgs84',
|
|
success: (res) => {
|
|
console.log('当前位置的经度:' + res.longitude);
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
|
|
scanButton.addEventListener('click', function() {
|
|
// 扫码
|
|
UNI_TOOLS.uniApi({
|
|
apiName: 'scanCode',
|
|
params: {
|
|
success: (res) => {
|
|
console.log('条码类型:' + res.scanType);
|
|
console.log('条码内容:' + res.result);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
|
|
openLocationButton.addEventListener('click', function() {
|
|
// 打开位置
|
|
UNI_TOOLS.uniApi({
|
|
apiName: 'openLocation',
|
|
params: {
|
|
latitude:'31.920213',
|
|
longitude:'116.894166',
|
|
name:"新桥服务区",
|
|
}
|
|
})
|
|
});
|
|
|
|
openNewPageButton.addEventListener('click', function() {
|
|
// 打开新页面
|
|
UNI_TOOLS.uniApi({
|
|
apiName: 'navigateTo',
|
|
params: {
|
|
url:"https://ahyd.eshangtech.com/robot/",
|
|
title:'新页面'
|
|
}
|
|
})
|
|
});
|
|
|
|
backPageButton.addEventListener('click', function() {
|
|
// 返回
|
|
uni.navigateBack();
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="content">
|
|
|
|
</div>
|
|
|
|
<button id="userMessage">获取用户信息</button>
|
|
<button id="position">获取经纬度</button>
|
|
<button id="scanCode">扫码</button>
|
|
<button id="openLocation">打开第三方导航</button>
|
|
<button id="openNewPage">打开新页面</button>
|
|
<button id="backPage">返回上一页面</button>
|
|
|
|
</body>
|
|
<!-- <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> -->
|
|
<!-- <script type="text/javascript" src="https://saas.eshangtech.com/goaliPay/wanmeiyizhanwx.js"></script> -->
|
|
<!-- <script type="text/javascript" src="https://saas.eshangtech.com/goaliPay/uniapp.js"></script> -->
|
|
<style>
|
|
</style>
|
|
</html>
|