update at 2026-02-08 18:28:39

This commit is contained in:
douboer
2026-02-08 18:28:39 +08:00
parent e2a46e413a
commit 0f5a7f0d85
97 changed files with 22029 additions and 59 deletions

View File

@@ -0,0 +1,110 @@
function request(options) {
return new Promise((resolve, reject) => {
wx.request({
...options,
success: resolve,
fail: reject,
})
})
}
function downloadFile(options) {
return new Promise((resolve, reject) => {
wx.downloadFile({
...options,
success: resolve,
fail: reject,
})
})
}
function saveImageToPhotosAlbum(filePath) {
return new Promise((resolve, reject) => {
wx.saveImageToPhotosAlbum({
filePath,
success: resolve,
fail: reject,
})
})
}
function canvasToTempFilePath(options, component) {
return new Promise((resolve, reject) => {
wx.canvasToTempFilePath(
{
...options,
success: resolve,
fail: reject,
},
component
)
})
}
function readFile(filePath, encoding) {
return new Promise((resolve, reject) => {
const fs = wx.getFileSystemManager()
fs.readFile({
filePath,
encoding,
success: resolve,
fail: reject,
})
})
}
function writeFile(filePath, data, encoding) {
return new Promise((resolve, reject) => {
const fs = wx.getFileSystemManager()
fs.writeFile({
filePath,
data,
encoding,
success: resolve,
fail: reject,
})
})
}
function saveFile(tempFilePath, filePath) {
return new Promise((resolve, reject) => {
const fs = wx.getFileSystemManager()
fs.saveFile({
tempFilePath,
filePath,
success: resolve,
fail: reject,
})
})
}
function openSetting() {
return new Promise((resolve, reject) => {
wx.openSetting({
success: resolve,
fail: reject,
})
})
}
function showModal(options) {
return new Promise((resolve, reject) => {
wx.showModal({
...options,
success: resolve,
fail: reject,
})
})
}
module.exports = {
request,
downloadFile,
saveImageToPhotosAlbum,
canvasToTempFilePath,
readFile,
writeFile,
saveFile,
openSetting,
showModal,
}