| | |
| | | import { mode } from 'crypto-js' |
| | | import JsZip from 'jszip' |
| | | |
| | | const noWmpl: string[] = ['Folder', 'Placemark', 'Point', 'coordinates'] |
| | | |
| | | /** |
| | | * @description: 读取kmz文件解析出kml文件 |
| | | * @param {string} filePath 文件地址 |
| | |
| | | .then((kmzZip) => { |
| | | // 通过文件名找到 KML 文件 |
| | | const kmlFile = kmzZip.file(/\.kml$/i)[0] |
| | | return kmlFile.async('text') |
| | | return { |
| | | file: kmzZip, |
| | | content: kmlFile.async('text') |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | if (Object.prototype.toString.call(settingParmas[key]) === '[object Object]') { |
| | | let parmaStr = '' |
| | | Object.keys(settingParmas[key]).forEach((v) => { |
| | | parmaStr += `<wpml:${v}>${settingParmas[key][v]}</wpml:${v}>` |
| | | const xml = noWmpl.includes(key) ? `<${v}>${settingParmas[key][v]}</${v}>` : `<wpml:${v}>${settingParmas[key][v]}</wpml:${v}>` |
| | | parmaStr += xml |
| | | }) |
| | | paramGroup += `<wpml:${key}>${parmaStr}</wpml:${key}>` |
| | | const xml = noWmpl.includes(key) ? `<${key}>${parmaStr}</${key}>` : `<wpml:${key}>${parmaStr}</wpml:${key}>` |
| | | paramGroup += xml |
| | | } else { |
| | | paramGroup += `<wpml:${key}>${settingParmas[key]}</wpml:${key}>` |
| | | const xml = noWmpl.includes(key) ? `<${key}>${settingParmas[key]}</${key}>` : `<wpml:${key}>${settingParmas[key]}</wpml:${key}>` |
| | | paramGroup += xml |
| | | } |
| | | }) |
| | | return paramGroup |