feat: 切换城市

This commit is contained in:
2025-10-15 20:34:08 +08:00
parent f63295db13
commit fcd9cc7d4c
13 changed files with 472 additions and 118 deletions

View File

@@ -9,3 +9,4 @@ export * from './orderActions';
export * from './routeUtil';
export * from './share'
export * from './genPoster'
export * from './wx_helper'

35
src/utils/wx_helper.ts Normal file
View File

@@ -0,0 +1,35 @@
import Taro from "@tarojs/taro";
export function saveImage(url) {
Taro.getSetting().then(async (res) => {
if (!res.authSetting["scope.writePhotosAlbum"]) {
Taro.authorize({
scope: "scope.writePhotosAlbum",
success: async () => {
try {
Taro.saveImageToPhotosAlbum({ filePath: url });
Taro.showToast({ title: "保存成功" });
} catch (e) {
Taro.showToast({ title: "图片保存失败", icon: "none" });
}
},
fail: () => {
Taro.showModal({
title: "提示",
content: "需要开启相册权限才能保存图片",
success: (r) => {
if (r.confirm) Taro.openSetting();
},
});
},
});
} else {
try {
Taro.saveImageToPhotosAlbum({ filePath: url });
Taro.showToast({ title: "保存成功" });
} catch (e) {
Taro.showToast({ title: "图片保存失败", icon: "none" });
}
}
});
}