init
This commit is contained in:
@@ -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'
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user