Unify frontend config, fix marketing tracking field mismatch, expose customer notes in API

Centralizes all hardcoded page paths, storage keys, external URLs, and branding into a single uni-app/src/config.js. Fixes trackMarketingEffect sending wrong field names (action/content_preview -> event_type/content) that silently dropped tracking data. Adds notes, estimated_value, next_followup_at to Customer response. Removes '翻译' from bottom tab nav (5 tabs now), adds quick translate card on home page. Makes profile page header color consistent with app theme (#1890ff).
This commit is contained in:
TradeMate Dev
2026-05-20 14:30:50 +08:00
parent f8a23855d2
commit a60aac4638
12 changed files with 689 additions and 67 deletions
+10 -6
View File
@@ -1,7 +1,9 @@
import { STORAGE_KEYS, PAGES } from '@/config.js'
export const BASE_URL = '/api/v1'
const getAuthHeader = () => {
const token = uni.getStorageSync('token')
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
return token ? { Authorization: `Bearer ${token}` } : {}
}
@@ -19,8 +21,8 @@ const request = (url, method = 'GET', data = {}) => {
if (res.statusCode === 200) {
resolve(res.data)
} else if (res.statusCode === 401) {
uni.removeStorageSync('token')
uni.reLaunch({ url: '/pages/login/login' })
uni.removeStorageSync(STORAGE_KEYS.TOKEN)
uni.reLaunch({ url: PAGES.LOGIN })
reject(new Error('Unauthorized'))
} else {
reject(new Error(res.data?.detail || 'Request failed'))
@@ -60,6 +62,8 @@ export const authApi = {
login: (phone, password) => request('/auth/login', 'POST', { username: phone, password }),
register: (phone, password, username) => request('/auth/register', 'POST', { phone, password, username }),
getUserInfo: () => request('/auth/me'),
updateProfile: (data) => request('/auth/me', 'PUT', data),
changePassword: (oldPassword, newPassword) => request('/auth/password', 'PUT', { old_password: oldPassword, new_password: newPassword }),
wechatLogin: (code) => request('/auth/wechat-login', 'POST', { code }),
wechatConfig: () => request('/auth/wechat/config'),
guestLogin: () => requestWithoutAuth('/auth/login/guest', 'POST'),
@@ -103,7 +107,7 @@ export const quotationApi = {
request('/quotations/generate-from-inquiry', 'POST', { inquiry_text: inquiryText, customer_id: customerId }),
importQuotations: (file) => {
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token')
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
uni.uploadFile({
url: `${BASE_URL}/quotations/import`,
filePath: file,
@@ -132,7 +136,7 @@ export const productApi = {
exportXlsx: () => `${BASE_URL}/products/export/xlsx`,
importProducts: (file) => {
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token')
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
uni.uploadFile({
url: `${BASE_URL}/products/import`,
filePath: file,
@@ -310,7 +314,7 @@ export const customerApi = {
exportXlsx: () => `${BASE_URL}/customers/export/xlsx`,
importCustomers: (file) => {
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token')
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
uni.uploadFile({
url: `${BASE_URL}/customers/import`,
filePath: file,