diff --git a/components/header_common.vue b/components/header_common.vue
deleted file mode 100644
index f9ae805..0000000
--- a/components/header_common.vue
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 841ce0a..71caf1c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -10,6 +10,10 @@
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
+ "permissions": [
+ "camera",
+ "album"
+ ],
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
@@ -68,7 +72,13 @@
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于获取周边服务"
- }
+ },
+ "scope.album": {
+ "desc": "需要您的相册权限以便选择图片"
+ },
+ "scope.camera": {
+ "desc": "需要您的相机权限以便拍照"
+ }
}
},
"mp-alipay" : {
diff --git a/pages.json b/pages.json
index 24850f5..30eba4d 100644
--- a/pages.json
+++ b/pages.json
@@ -44,7 +44,9 @@
"path": "pages/serviceTickets/index",
"style": {
"navigationBarTitleText": "近山社区",
- "navigationStyle": "default",
+ "navigationStyle": "default",
+ "enableShareAppMessage": false, // 禁用该页面的转发
+ "enableShareTimeline": false, // 禁用该页面的朋友圈分享
"usingComponents": {}
}
},
diff --git a/pages/activeDetail/index.vue b/pages/activeDetail/index.vue
index 21b3144..047d044 100644
--- a/pages/activeDetail/index.vue
+++ b/pages/activeDetail/index.vue
@@ -34,7 +34,7 @@
- 活动时间:{{ activityInfo.openAt }}
+ 开始时间:{{formatTime(activityInfo.startAt,"YYYY-MM-DD HH:mm:ss") }}
diff --git a/pages/helpInfo/index.vue b/pages/helpInfo/index.vue
index 320db85..acb7f77 100644
--- a/pages/helpInfo/index.vue
+++ b/pages/helpInfo/index.vue
@@ -1,282 +1,371 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 0426f69..fe81b13 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -47,7 +47,7 @@
最高温 {{weather.highest}}°
- 最高温 {{weather.lowest}}°
+ 最低温 {{weather.lowest}}°
- 工作地点
+ 维修地点
@@ -151,6 +154,19 @@ export default {
this.getOrderTypeList();
},
methods: {
+ // 新增手机号验证方法
+ validatePhone() {
+ if (!this.customerPhone) return true;
+ const phoneReg = /^1[3-9]\d{9}$/;
+ if (!phoneReg.test(this.customerPhone)) {
+ uni.showToast({
+ title: '请输入正确的手机号码',
+ icon: 'none'
+ });
+ return false;
+ }
+ return true;
+ },
// 显示上传选项
showUploadAction() {
uni.showActionSheet({
@@ -350,8 +366,11 @@ export default {
this.fileList.splice(index, 1);
},
- // 其他原有方法保持不变...
async handleSubmit() {
+ // 在提交前验证手机号
+ if (!this.validatePhone()) {
+ return;
+ }
if (!this.workOrderContent) {
uni.showToast({
title: '请填写工单内容',
diff --git a/static/imgs/footer/ai.png b/static/imgs/footer/ai.png
index 5cd4c2e..db3653e 100644
Binary files a/static/imgs/footer/ai.png and b/static/imgs/footer/ai.png differ
diff --git a/static/imgs/footer/home.png b/static/imgs/footer/home.png
index 521679c..dc8dcdd 100644
Binary files a/static/imgs/footer/home.png and b/static/imgs/footer/home.png differ
diff --git a/static/imgs/footer/mine.png b/static/imgs/footer/mine.png
index 844cf97..732842a 100644
Binary files a/static/imgs/footer/mine.png and b/static/imgs/footer/mine.png differ
diff --git a/static/imgs/index/bangzhu.png b/static/imgs/index/bangzhu.png
index a426026..f2fa99f 100644
Binary files a/static/imgs/index/bangzhu.png and b/static/imgs/index/bangzhu.png differ
diff --git a/static/imgs/index/gonggao.png b/static/imgs/index/gonggao.png
index 1c99054..8ccefbf 100644
Binary files a/static/imgs/index/gonggao.png and b/static/imgs/index/gonggao.png differ
diff --git a/static/imgs/index/linli.png b/static/imgs/index/linli.png
index f4ea933..c2a2916 100644
Binary files a/static/imgs/index/linli.png and b/static/imgs/index/linli.png differ
diff --git a/static/imgs/index/redian.png b/static/imgs/index/redian.png
index 866730b..37e3306 100644
Binary files a/static/imgs/index/redian.png and b/static/imgs/index/redian.png differ
diff --git a/static/imgs/index/weixiu.png b/static/imgs/index/weixiu.png
index 99358e7..a276ecc 100644
Binary files a/static/imgs/index/weixiu.png and b/static/imgs/index/weixiu.png differ
diff --git a/static/imgs/service/service_friend.png b/static/imgs/service/service_friend.png
index 370367a..e2c513f 100644
Binary files a/static/imgs/service/service_friend.png and b/static/imgs/service/service_friend.png differ
diff --git a/static/imgs/service/service_help.png b/static/imgs/service/service_help.png
index 3921c97..71beca1 100644
Binary files a/static/imgs/service/service_help.png and b/static/imgs/service/service_help.png differ
diff --git a/static/imgs/service/service_list.png b/static/imgs/service/service_list.png
index f36feb6..59c3673 100644
Binary files a/static/imgs/service/service_list.png and b/static/imgs/service/service_list.png differ
diff --git a/static/imgs/service/service_notice.png b/static/imgs/service/service_notice.png
index cd94fec..041acb0 100644
Binary files a/static/imgs/service/service_notice.png and b/static/imgs/service/service_notice.png differ
diff --git a/static/imgs/service/service_phone.png b/static/imgs/service/service_phone.png
index 78001be..f427744 100644
Binary files a/static/imgs/service/service_phone.png and b/static/imgs/service/service_phone.png differ
diff --git a/static/imgs/service/service_service.png b/static/imgs/service/service_service.png
index 52ccd67..c2a2916 100644
Binary files a/static/imgs/service/service_service.png and b/static/imgs/service/service_service.png differ
diff --git a/utils/request.js b/utils/request.js
index c13826f..20bf918 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -1,13 +1,17 @@
import { BASE_URL } from "./config";
-// 获取本地Token的同步方法
+
+// 获取本地 Token 的同步方法
const getToken = () => {
try {
- return uni.getStorageSync('token') || null
+ return uni.getStorageSync('token') || null;
} catch (e) {
- console.error('获取本地Token失败:', e)
- return null
+ console.error('获取本地Token失败:', e);
+ return null;
}
-}
+};
+
+// 是否正在跳转登录页,防止重复弹窗
+let isRedirectingToLogin = false;
// 统一请求方法
export const request = (options) => {
@@ -15,54 +19,106 @@ export const request = (options) => {
// 合并请求头
const header = {
'Content-Type': 'application/json',
- ...(options.header || {}), // 允许覆盖默认header
- Authorization: getToken() ? `Bearer ${getToken()}` : undefined
- }
+ ...(options.header || {}), // 允许覆盖默认 header
+ Authorization: getToken() ? `Bearer ${getToken()}` : undefined,
+ };
- // 过滤掉undefined的header项
+ // 过滤掉 undefined 的 header 项
const filteredHeader = Object.fromEntries(
Object.entries(header).filter(([_, v]) => v !== undefined)
- )
+ );
uni.request({
url: `${BASE_URL}${options.url}`,
method: options.method || 'GET',
data: options.data || {},
header: filteredHeader,
+ timeout: options.timeout || 10000, // 建议设置超时时间
success: (res) => {
- // 处理401未授权
- if (res.statusCode === 401) {
- uni.removeStorageSync('token')
- // uni.showToast({ title: '请前往"个人中心页"登录', icon: 'none' })
- // uni.navigateTo({ url: '/pages/mine/index' })
- return reject(new Error('登录状态已过期'))
+ const { statusCode } = res;
+
+ // 处理 401 未授权(登录过期/未登录)
+ if (statusCode === 401) {
+ // 防止多次弹窗和重复跳转
+ if (!isRedirectingToLogin) {
+ isRedirectingToLogin = true;
+
+ uni.removeStorageSync('token');
+
+ // 友好提示 + 延迟跳转
+ uni.showToast({
+ title: '暂未登录,请登录后使用',
+ icon: 'none',
+ duration: 1500,
+ });
+
+ setTimeout(() => {
+ isRedirectingToLogin = false;
+ uni.navigateTo({
+ url: '/pages/mine/index',
+ fail: () => {
+ uni.reLaunch({ url: '/pages/mine/index' });
+ }
+ });
+ }, 1500);
+ }
+
+ return reject(new Error('未登录或登录已过期'));
}
- // 处理其他错误状态码
- if (res.statusCode < 200 || res.statusCode >= 300) {
- const errorMsg = res.data?.message || `请求失败 (${res.statusCode})`
- uni.showToast({ title: errorMsg, icon: 'none' })
- return reject(new Error(errorMsg))
+ // 处理其他非 2xx 状态码
+ if (statusCode < 200 || statusCode >= 300) {
+ const errorMsg = res.data?.message || `请求失败 (HTTP ${statusCode})`;
+ uni.showToast({ title: errorMsg, icon: 'none', duration: 2000 });
+ return reject(new Error(errorMsg));
}
- resolve(res.data)
+ const responseData = res.data;
+
+ if (responseData && typeof responseData === 'object' && 'code' in responseData) {
+ if (responseData.code !== 0) {
+ const bizMsg = responseData.message || '请求异常';
+ uni.showToast({ title: bizMsg, icon: 'none' });
+ return reject(new Error(bizMsg));
+ }
+ // 成功:返回 data 字段
+ resolve(responseData.data);
+ } else {
+ // 兼容没有统一响应格式的接口
+ resolve(responseData);
+ }
},
fail: (err) => {
- const errorMsg = err.errMsg.includes('timeout')
- ? '网络请求超时'
- : '网络连接失败'
- uni.showToast({ title: errorMsg, icon: 'none' })
- reject(new Error(errorMsg))
- }
- })
- })
-}
+ const errMsg = err.errMsg || '';
+ let errorMsg = '网络连接失败';
-// 封装常用方法
-export const get = (url, data, header) => request({ url, method: 'GET', data, header })
+ if (errMsg.includes('timeout')) {
+ errorMsg = '网络请求超时,请检查网络';
+ } else if (errMsg.includes('Network Error')) {
+ errorMsg = '网络异常,请检查网络设置';
+ }
-export const post = (url, data, header) => request({ url, method: 'POST', data, header })
+ uni.showToast({
+ title: errorMsg,
+ icon: 'none',
+ duration: 2000,
+ });
-export const put = (url, data, header) => request({ url, method: 'PUT', data, header })
+ reject(new Error(errorMsg));
+ },
+ });
+ });
+};
-export const del = (url, data, header) => request({ url, method: 'DELETE', data, header })
\ No newline at end of file
+// 封装常用方法(支持传入额外配置,比如 timeout、skipAuth 等)
+export const get = (url, data, header, options = {}) =>
+ request({ url, method: 'GET', data, header, ...options });
+
+export const post = (url, data, header, options = {}) =>
+ request({ url, method: 'POST', data, header, ...options });
+
+export const put = (url, data, header, options = {}) =>
+ request({ url, method: 'PUT', data, header, ...options });
+
+export const del = (url, data, header, options = {}) =>
+ request({ url, method: 'DELETE', data, header, ...options });
\ No newline at end of file