var jsVersion = +new Date() // '?v=202106091751';
var contextPath = '.'
if (getPageN() === 'index') {
  contextPath = '.'
} else {
  contextPath = '..'
}
// css
document.write('<link rel="icon" href="' + contextPath + '/image/favicon.ico">')
document.write(
  '<link rel="stylesheet" type="text/css" href="' +
    contextPath +
    '/css/normalize.css" />'
)
document.write(
  '<link rel="stylesheet" type="text/css" href="' +
    contextPath +
    '/css/vant.css" />'
)
document.write(
  '<link rel="stylesheet" type="text/css" href="' +
    contextPath +
    '/css/common.css?rev=' +
    jsVersion +
    '" />'
)

/**
 * 爱山东 jssdk相关引用
 */
document.write(
  '<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/jssdk2/aes.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/jssdk2/sm2/build/SM.js"></script>'
)

// 移动端 debugger 调试
document.write(
  '<script type="text/javascript" src="//cdn.bootcdn.net/ajax/libs/eruda/2.4.1/eruda.js"></script>\
				<script>eruda.init();</script>'
)

/**
 * 项目业务相关 js
 */
// <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/vant/2.12.54/vant.min.js"></script>\
// <script type="text/javascript" src="' + contextPath + '/sdk/vant.min.js"></script>\
// <script type="text/javascript" src="' + contextPath + '/sdk/axios.min.js"></script>\
document.write(
  '<script type="text/javascript" src="' +
    contextPath +
    '/sdk/vue.min.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/vant.min.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/flexible.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/util.js?rev=' +
    jsVersion +
    '"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/jssdk2/apiKeyMap.js?rev=' +
    jsVersion +
    '"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/axios.min.js"></script>\
				<script type="text/javascript" src="' +
    contextPath +
    '/sdk/axios_http.js"></script>'
)
// <script type="text/javascript" src="' + contextPath + '/sdk/http.js?rev=' + jsVersion + '"></script>');

if (getPageN()) {
  // 加载同名js
  document.write(
    '<script type="text/javascript" src="./' +
      getPageN() +
      '.js?rev=' +
      jsVersion +
      '"></script>'
  )
  document.write(
    '<link rel="stylesheet" type="text/css" href="./' +
      getPageN() +
      '.css?rev=' +
      jsVersion +
      '" />'
  )
}

function getPageN() {
  var pageN = window.location.pathname
  pageN = pageN.substring(pageN.lastIndexOf('/') + 1, pageN.indexOf('.'))
  return pageN
}
