第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:04:21 +08:00
commit 7a73b38bd5
764 changed files with 166417 additions and 0 deletions

17
websoft/api/article.js Normal file
View File

@@ -0,0 +1,17 @@
import http from './index.js';
// 分页查询文章
export const pageArticle = (params) => http.get('/cms/article/page', {params})
// 查询文章
export const getArticle = (articleId) => http.get('/cms/article/' + articleId)
// 添加文章
export const addArticle = (data) => http.post('/cms/article', data)
export default {
pageArticle,
getArticle,
addArticle
}

10
websoft/api/chatgpt.js Normal file
View File

@@ -0,0 +1,10 @@
import http from './index.js';
// 提交问题
export const chat = (data) => http.post('https://chatgpt.websoft.top/api/open/chat/chat', data)
// export const chat = (data) => http.post('/open/chat/chat', data)
export default {
chat
}

9
websoft/api/dict.js Normal file
View File

@@ -0,0 +1,9 @@
import http from './index.js';
// 读取字典数据
export const getDictionaryOptions = (params) => http.get('/system/dict-data', {params})
export default {
getDictionaryOptions
}

View File

@@ -0,0 +1,20 @@
import http from './index.js';
// 分页查询设备列表
export const pageEquipmentGoods = (params) => http.get('/apps/equipment-goods/page', {params})
// 查询设备
export const getEquipmentGoods = (goodsId) => http.get('/apps/equipment-goods/' + goodsId)
// 绑定设备
export const bindEquipment = (data) => http.post('/open/equipment/bind', data)
// 绑定设备
export const changeEquipment = (data) => http.post('/open/equipment/change', data)
export default {
pageEquipmentGoods,
getEquipmentGoods,
bindEquipment,
changeEquipment
}

24
websoft/api/equipment.js Normal file
View File

@@ -0,0 +1,24 @@
import http from './index.js';
// 分页查询设备列表
export const pageEquipment = (params) => http.get('/apps/equipment/page', {params})
// 查询设备
export const getEquipment = (equipmentId) => http.get('/apps/equipment/' + equipmentId)
// 绑定设备
export const bindEquipment = (data) => http.post('/open/equipment/bind', data)
// 绑定设备
export const changeEquipment = (data) => http.post('/open/equipment/change', data)
// 退租
export const rentingOut = (data) => http.post('/open/equipment/rentingOut',data)
export default {
pageEquipment,
getEquipment,
bindEquipment,
changeEquipment,
rentingOut
}

84
websoft/api/index.js Normal file
View File

@@ -0,0 +1,84 @@
import Request from 'luch-request'
import storage from '@/utils/storage'
import {
apiUrl,
tenantId,
appId,
appSecret
} from '@/config.js';
import {
getSign
} from '@/utils/util.js'
import {
ACCESS_TOKEN
} from '@/store/mutation-types'
const http = new Request();
const token = storage.get(ACCESS_TOKEN)
/**
* @description 修改全局默认配置
* @param {Function}
*/
http.setConfig((config) => {
/* config 为默认全局配置*/
config.baseURL = apiUrl; /* 根域名 */
if(token){
config.header = {
Authorization: token, // token
}
}
return config
})
// 拦截器(请求之前拦截)
http.interceptors.request.use((config) => { // 可使用async await 做异步操作
config.header = {
...config.header,
appId,
tenantId
}
if (config.data) {
config.data.tenantId = tenantId
}
if (!token) {
// 如果token不存在需要加签
config.params.tenantId = tenantId
config.params.sign = getSign(config.params,appSecret);
}
/**
/* 演示
if (!token) { // 如果token不存在return Promise.reject(config) 会取消本次请求
return Promise.reject(config)
}
**/
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
})
// 拦截器(请求之后拦截)
http.interceptors.response.use((response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data
// }
// token过期
if (response.data.code == 401) {
}
if (response.data.code == 1) {
return Promise.reject(response.data)
}
return response.data
}, (response) => {
/* 对响应错误做点什么 statusCode !== 200*/
console.log(response)
return Promise.reject(response)
})
export default http

31
websoft/api/login.js Normal file
View File

@@ -0,0 +1,31 @@
import http from './index.js';
// 获取图形验证码
export const getCaptcha = (params) => http.get('/captcha', {params})
// 发送短信验证码
export const sendSmsCaptcha = (params) => http.post('/open/sendSmsCaptcha', {params})
// 支付宝授权码换取userId
export const getAuthCode = (data) => http.post('/open/login-alipay/getAuthCode', data)
// 获取支付宝手机号码
export const getPhoneNumber = (data, config) => http.post('/shop/payment/getPhoneNumber', data, config)
// 支付宝登录
export const alipayLogin = (data) => http.post('/login-alipay/login', data)
// 支付宝用户注册
export const register = (data) => http.post('/login-alipay/register', data)
// 游客登录
export const login = (data) => http.post('/login', data)
export default {
getCaptcha,
sendSmsCaptcha,
getAuthCode,
getPhoneNumber,
alipayLogin,
login
}

16
websoft/api/merchant.js Normal file
View File

@@ -0,0 +1,16 @@
import http from './index.js';
// 分页查询商户列表
export const pageMerchant = (params) => http.get('/shop/merchant/page', {params})
// 查询全部商户
export const listMerchant = (params) => http.get('/shop/merchant', {params})
// 获取商户详情
export const getMerchant = (merchantId) => http.get('/shop/merchant/page', {merchantId})
export default {
pageMerchant,
listMerchant,
getMerchant
}

31
websoft/api/order.js Normal file
View File

@@ -0,0 +1,31 @@
import http from './index.js';
// 分页查询订单
export const pageOrder = (params) => http.get('/shop/order/page', {params})
// 分页查询订单
export const listOrder = (params) => http.get('/shop/order', {params})
// 查询订单
export const getOrder = (orderId) => http.get('/shop/order/' + orderId)
// 添加订单
export const addOrder = (data) => http.post('/shop/order', data)
// 添加订单
export const receiptOrder = (data) => http.post('/open/equipment/receipt', data)
// 删除订单
export const removeOrder = (id) => http.get('/open/order/remove/' + id)
export const setPayStatus = (data) => http.post('/shop/order/setPayStatus', data)
export default {
pageOrder,
listOrder,
getOrder,
addOrder,
receiptOrder,
removeOrder,
setPayStatus
}

32
websoft/api/payment.js Normal file
View File

@@ -0,0 +1,32 @@
import http from './index.js';
// 分页查询支付方式
export const pagePayment = (params) => http.get('/shop/payment/page', {params})
// 查询支付方式
export const getPayment = (paymentId) => http.get('/shop/payment/' + paymentId)
// 余额支付
export const balance = (orderId) => http.get('/shop/payment/balance/' + orderId)
// 支付宝支付
export const alipay = (orderId) => http.get('/shop/payment/mp-alipay/' + orderId)
export const alipayReLet = (data) => http.post('/shop/payment/mp-alipay-relet/', data)
export const test = (data) => http.post('/shop/payment/mp-alipay/test', data)
export const payQuery = (orderId) => http.get('/shop/payment/mp-alipay/query/' + orderId)
export const payQueryByRelet = (orderId) => http.get('/shop/payment/mp-alipay/query-relet/' + orderId)
export default {
pagePayment,
getPayment,
alipay,
alipayReLet,
payQuery,
payQueryByRelet,
balance,
test
}

8
websoft/api/setting.js Normal file
View File

@@ -0,0 +1,8 @@
import http from './index.js';
// 获取商户详情
export const getSetting = (settingKey) => http.get('/open/system/setting/' + settingKey)
export default {
getSetting
}

16
websoft/api/test.js Normal file
View File

@@ -0,0 +1,16 @@
import http from './index.js';
// 分页查询订单
export const pageTest = (params) => http.get('/shop/order/page', {params})
// 查询订单
export const getTest = (orderId) => http.get('/shop/order/' + orderId)
// 添加订单
export const testIndex = (params) => http.get('/shop/test', params)
export default {
pageTest,
getTest,
testIndex
}

8
websoft/api/upload.js Normal file
View File

@@ -0,0 +1,8 @@
import http from './index.js';
import { uploadUrl } from '@/config.js';
export const uploadFile = (file) => http.upload(uploadUrl + '/api/file/upload', file)
export default {
uploadFile
}

14
websoft/api/user.js Normal file
View File

@@ -0,0 +1,14 @@
import http from './index.js';
// 获取用户资料
export const getUser = (params) => http.get('/auth/user', {params})
// 修改用户资料
export const updateUser = (data) => http.post('/open/login-alipay/update', data)
export default {
getUser,
updateUser
}