You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB

xlsx = require('node-xlsx')
const { validMorphAttribs } = require("XrFrame/loader/glTF/geometry/primitives/targets/GLTFTargetsNode")
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
function read_exl(){
var path_url = ''
var file_name = ''
var data = null
wx.chooseMessageFile({
count: 1,
type: 'file',
success (res) {
// tempFilePath可以作为img标签的src属性显示图片
path_url = res.tempFiles[0].path
file_name = res.tempFiles[0].name
console.log(path_url)
console.log(file_name)
}
})
data = xlsx.parse(fs.readFileSync(`${path_url}`));
return data
}
module.exports = {
read_exl: read_exl
}