后端:公告√

注意数据库新建notice表
This commit is contained in:
2025-09-16 20:03:17 +08:00
parent 158b3e65b6
commit 562ec4abf9
26 changed files with 1468 additions and 35 deletions

26
frontend/common/http.js Normal file
View File

@@ -0,0 +1,26 @@
import { API_BASE_URL, SHOP_ID } from './config.js'
function buildUrl(path) {
if (!path) return API_BASE_URL
if (path.startsWith('http')) return path
return API_BASE_URL + (path.startsWith('/') ? path : '/' + path)
}
export function get(path, params = {}) {
return new Promise((resolve, reject) => {
uni.request({
url: buildUrl(path),
method: 'GET',
data: params,
header: { 'X-Shop-Id': SHOP_ID },
success: (res) => {
const { statusCode, data } = res
if (statusCode >= 200 && statusCode < 300) return resolve(data)
reject(new Error('HTTP ' + statusCode))
},
fail: (err) => reject(err)
})
})
}