123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- /**
- * 获取resource目录地址
- * @returns String
- */
- function GetResourcePath() {
- let e = document.location.toString()
- return e.match(/^(?<root>.*\/resource\/)/).groups.root
- }
- /**
- * 获取url请求参数
- * @returns Object
- */
- function getQueryParams() {
- if (location.search.indexOf('?') > -1) {
- var querys = location.search.substr(1).split('&')
- var obj = {}
- querys.forEach((element) => {
- var arr = element.split('=')
- obj[arr[0]] = decodeURIComponent(arr[1])
- })
- return obj
- }
- return {}
- }
- /**
- * 返回当前环境的路径间隔符
- * @returns String
- */
- function GetDirSpacer() {
- return IsWindows() ? '\\' : '/'
- }
- function IsWindows() {
- return window.navigator.platform.toLocaleLowerCase().indexOf('win') > -1
- }
- function mkdir(dir) {
- var dirs = dir.split(constStrEnum.DirSeparator)
- var current = ''
- for (var idx = 0; idx < dirs.length; idx++) {
- current += dirs[idx] + constStrEnum.DirSeparator
- if (!wps.FileSystem.Exists(current))
- if (!wps.FileSystem.Mkdir(current)) throw Error('无法创建目录' + current)
- }
- }
|