fuchengshen
2022-07-27 fc138d928dc7fe32b40afb1f6b0a0b10bb033409
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use script"; //开发环境建议开启严格模式
 
//判断webgl支持
if (!mars3d.Util.webglreport()) {
  mars3d.Util.webglerror();
}
//读取 config.json 配置文件
let configUrl = "config/config.json";
mars3d.Resource.fetchJson({ url: configUrl })
  .then(function (json) {
    //构建地图
    window.initMap(json.map3d);
 
    //移除遮罩
    setTimeout(removeMask, 3000);
  })
  .otherwise(function (error) {
    console.log("加载JSON出错", error);
    removeMask();
    haoutil.alert(error && error.message, "出错了");
  });
 
// fetch(configUrl)
//   .then(function (response) {
//     if (!response.ok) {
//       var error = new Error(response.statusText)
//       error.response = response
//       throw error
//     } else {
//       return response.json()
//     }
//   })
//   .then((json) => {
//     //构建地图
//     window.initMap(json.map3d)
//     //移除遮罩
//     setTimeout(removeMask, 3000)
//   })
//   .catch(function (error) {
//     console.log('加载JSON出错', error)
 
//     removeMask()
//     haoutil.alert(error?.message, '出错了')
//   })
 
//移除遮罩
function removeMask() {
  $("#mask").remove();
}
 
function openTipView(content, title) {
  window.layer.open({
    type: 1,
    title: title || "功能 和 已知问题 提示",
    offset: "rt",
    shade: false,
    skin: "layer-mars-dialog animation-scale-up",
    content: content,
  });
}
 
if ($("#tipView").length > 0) {
  openTipView($("#tipView"));
}