commit bec8d97242d38e8ea9aeafa1677b0267935e9e72 Author: jiang <2500238435@qq.com> Date: Fri Jan 3 17:32:02 2025 +0800 init diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..897b0d7 --- /dev/null +++ b/App.vue @@ -0,0 +1,66 @@ + + + diff --git a/config/help.js b/config/help.js new file mode 100644 index 0000000..18c272a --- /dev/null +++ b/config/help.js @@ -0,0 +1,28 @@ +export const helpConfig = { + faqList: [ + { + question: '如何租借风扇?', + answer: '点击首页"扫码租借"按钮,使用微信扫描设备上的二维码,按提示完成支付即可使用。' + }, + { + question: '收费标准是怎样的?', + answer: '使用费用为2元/小时,不足1小时按1小时计算。押金99元,归还后自动退还。' + }, + { + question: '如何归还风扇?', + answer: '将风扇带到任意归还点,点击首页"扫码归还"按钮,扫描归还点二维码即可完成归还。' + }, + { + question: '押金多久能退还?', + answer: '归还设备后押金将自动发起退款,预计0-7个工作日到账。' + }, + { + question: '设备无法正常使用怎么办?', + answer: '您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。' + } + ], + contactInfo: { + phone: '400-888-8888', + serviceTime: '周一至周日 09:00-22:00' + } +} \ No newline at end of file diff --git a/config/http.js b/config/http.js new file mode 100644 index 0000000..2ca6480 --- /dev/null +++ b/config/http.js @@ -0,0 +1,66 @@ +import axios from 'axios' +import { UniAdapter } from 'uniapp-axios-adapter' + +// 创建axios实例 +const service = axios.create({ + baseURL: process.env.VUE_APP_BASE_API || '/api', // api的base_url + timeout: 15000, // 请求超时时间 + adapter: UniAdapter, // 使用uni-app的适配器 + headers: { + 'Content-Type': 'application/json;charset=utf-8' + } +}) + +// 请求拦截器 +service.interceptors.request.use( + config => { + // 在发送请求之前做些什么 + const token = uni.getStorageSync('token') + if (token) { + config.headers['Authorization'] = `Bearer ${token}` + } + return config + }, + error => { + // 对请求错误做些什么 + console.error('请求错误:', error) + return Promise.reject(error) + } +) + +// 响应拦截器 +service.interceptors.response.use( + response => { + const res = response.data + // 这里可以根据后端返回的状态码做相应的处理 + if (res.code !== 200) { + uni.showToast({ + title: res.message || '错误', + icon: 'none', + duration: 2000 + }) + + // 401: 未登录或token过期 + if (res.code === 401) { + uni.removeStorageSync('token') + // 跳转登录页 + uni.reLaunch({ + url: '/pages/login/login' + }) + } + return Promise.reject(res) + } + return res + }, + error => { + console.error('响应错误:', error) + uni.showToast({ + title: error.message || '网络异常', + icon: 'none', + duration: 2000 + }) + return Promise.reject(error) + } +) + +export default service \ No newline at end of file diff --git a/config/user.js b/config/user.js new file mode 100644 index 0000000..60fe59b --- /dev/null +++ b/config/user.js @@ -0,0 +1,28 @@ +import request from './http' + +// 密码登录方法 +export const passwordLogin = (data) => { + return request({ + method: 'post', + url: `/token/login`, + params: { + client: 'dax-pay', + account: data.account, + password: data.password, + loginType: 'password', + captchaKey: '', + captcha: '' + } + }) +} + +// 微信小程序登录方法 +export const wxLogin = (code) => { + return request({ + method: 'post', + url: '/user/wx/login', + data: { + code + } + }) +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..c3ff205 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + +
+ + + API-first authentication, authorization, and fraud prevention + | We’re bound by one common purpose: to give you the financial tools, resources and information you ne... + | Hi, we're Descope! We are building something in the authentication space for app developers and... + |
At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate... + | At Famety, you can grow your social media following quickly, safely, and easily with just a few clic... + | Buy Instagram Likes + |
| 💜 Become a sponsor + | 💜 Become a sponsor + | 💜 Become a sponsor + |
Promise based HTTP client for the browser and node.js
+ ++ Website • + Documentation +
+ +