跳转移动端或PC端
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>跳转中...</title>
</head>
<body>
<script src="./dingtalk.js"></script>
<script type="text/javascript">
function isMobile() {
var userAgentInfo = navigator.userAgent;
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var mobile_flag = false;
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
}
}
return mobile_flag;
}
dd.runtime.permission.requestAuthCode({
corpId: "填写钉钉的Id",
onSuccess: function (res) {
let code = res.result.code
if (isMobile()) {
window.location.href = `http://117.139.103.7:1280/xfjgwx/?zxcode=${code}`
} else {
window.location.href = `http://117.139.103.7:1280/dingdingGoPage?zxcode=${code}`
}
},
onFail: function (err) {
let str = JSON.stringify(err)
alert(str)
}
});
</script>
</body>
</html>