Blame view

app/pages/index.html 1.2 KB
7820380e   “wangming”   1
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
  <!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
      <script src="../../../node_modules/jquery/dist/jquery.js"></script>
  </head>
  <body>
      
  </body>
  <script>
      let urlStr = window.location.href
      console.log('地址',urlStr)
      $.get('http://www.ccdcdf.com:6080/api/index/index',function(res){
          console.log('返回国家代码',res)
          if(res.data.code == 'en'){
              let str = urlStr.replace('pages/','pages/English/')
              window.location.href = str
              console.log('更新后地址',str)
          }else if(res.data.code == 'ru'){
              let str = urlStr.replace('pages/','pages/Russian/')
              window.location.href = str
          }else if(res.data.code == 'es'){
              let str = urlStr.replace('pages/','pages/Spain/')
              window.location.href = str
          }else if(res.data.code == 'cn'){
              let str = urlStr.replace('pages/','pages/Chinese/')
              window.location.href = str
          }else{
              let str = urlStr.replace('pages/','pages/English/')
              window.location.href = str
          }
      })
  </script>
  </html>