feat: feadback

This commit is contained in:
zzc
2026-01-26 11:18:24 +08:00
parent 87877d147d
commit 3226b35c4f
7 changed files with 411 additions and 5 deletions

View File

@@ -4,3 +4,32 @@ export const generateObjectId = (
h = 16,
s = (s) => m.floor(s).toString(h),
) => s(d.now() / 1000) + " ".repeat(h).replace(/./g, () => s(m.random() * h));
export const uploadImage = (filePath) => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: "https://api.ai-meng.com/api/common/upload",
filePath: filePath,
name: "file",
header: {
"x-app-id": "69665538a49b8ae3be50fe5d",
},
success: (res) => {
if (res.statusCode < 400) {
try {
const keyJson = JSON.parse(res.data);
const url = `https://file.lihailezzc.com/${keyJson?.data.key}`;
resolve(url);
} catch (e) {
reject(e);
}
} else {
reject(new Error("Upload failed"));
}
},
fail: (err) => {
reject(err);
},
});
});
};

View File

@@ -1,6 +1,6 @@
// const BASE_URL = 'https://apis.lihailezzc.com'
const BASE_URL = 'http://127.0.0.1:3999'
// const BASE_URL = "http://192.168.1.3:3999";
// const BASE_URL = 'http://127.0.0.1:3999'
const BASE_URL = "http://192.168.1.3:3999";
// const BASE_URL = "http://192.168.31.253:3999";
import { useUserStore } from "@/stores/user";