mirror of
https://gitee.com/bootx/dax-pay-h5.git
synced 2025-10-13 13:43:53 +00:00
feat 代码精简, 开发OpenId相关获取功能
This commit is contained in:
@@ -1,27 +1,17 @@
|
|||||||
# 端口号
|
# 端口号
|
||||||
VITE_PORT = 9100
|
VITE_PORT=9100
|
||||||
|
|
||||||
# 网站根目录
|
# 网站根目录
|
||||||
VITE_PUBLIC_PATH = /h5
|
VITE_PUBLIC_PATH=/
|
||||||
|
|
||||||
# 是否删除console
|
|
||||||
VITE_DROP_CONSOLE = true
|
|
||||||
|
|
||||||
# 跨域代理,可以配置多个,请注意不要换行
|
# 跨域代理,可以配置多个,请注意不要换行
|
||||||
VITE_PROXY=[["/server","http://localhost:9000"]]
|
VITE_PROXY=[["/server","http://localhost:9000"]]
|
||||||
|
|
||||||
# API 接口地址
|
# API 接口地址
|
||||||
# 如果没有跨域问题,直接在这里配置即可
|
VITE_GLOB_API_URL=
|
||||||
VITE_GLOB_API_URL =
|
|
||||||
|
|
||||||
# 图片上传地址
|
|
||||||
VITE_GLOB_UPLOAD_URL =
|
|
||||||
|
|
||||||
# 图片前缀地址
|
|
||||||
VITE_GLOB_IMG_URL =
|
|
||||||
|
|
||||||
# 接口前缀
|
# 接口前缀
|
||||||
VITE_GLOB_API_URL_PREFIX = /
|
VITE_GLOB_API_URL_PREFIX=/server
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,27 +1,18 @@
|
|||||||
# 网站根目录 和 接口 (api) 前缀 这个是嵌入式模式
|
# 独立部署模式
|
||||||
#VITE_PUBLIC_PATH = /h5
|
VITE_PUBLIC_PATH = /h5
|
||||||
#VITE_GLOB_API_URL_PREFIX = /
|
# API 接口前缀
|
||||||
|
VITE_GLOB_API_URL_PREFIX = /api
|
||||||
|
|
||||||
# 网站根目录(与PC部署在一起, 所以根目录不可以为 /) 和 接口 (server) 前缀 这个是独立部署模式
|
# 嵌入式模式 与网关部署在一起, 和 接口 (server) 前缀 这个是
|
||||||
VITE_PUBLIC_PATH=/h5
|
#VITE_PUBLIC_PATH=/h5
|
||||||
VITE_GLOB_API_URL_PREFIX=
|
## API 接口前缀
|
||||||
|
#VITE_GLOB_API_URL_PREFIX=
|
||||||
|
|
||||||
# 是否删除console
|
# 是否删除console
|
||||||
VITE_DROP_CONSOLE=true
|
VITE_DROP_CONSOLE=true
|
||||||
|
|
||||||
# API
|
# 是否启用gzip压缩或brotli压缩, 可选: gzip | brotli | none, 如果你需要多种形式,你可以用','来分隔
|
||||||
VITE_GLOB_API_URL=
|
VITE_BUILD_COMPRESS='none'
|
||||||
|
|
||||||
# 图片上传地址
|
|
||||||
VITE_GLOB_UPLOAD_URL=
|
|
||||||
|
|
||||||
# 图片前缀地址
|
|
||||||
VITE_GLOB_IMG_URL =
|
|
||||||
|
|
||||||
# 是否启用gzip压缩或brotli压缩
|
|
||||||
# 可选: gzip | brotli | none
|
|
||||||
# 如果你需要多种形式,你可以用','来分隔
|
|
||||||
VITE_BUILD_COMPRESS = 'none'
|
|
||||||
|
|
||||||
# 使用压缩时是否删除原始文件,默认为false
|
# 使用压缩时是否删除原始文件,默认为false
|
||||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE=false
|
||||||
|
@@ -83,16 +83,7 @@
|
|||||||
"vite-plugin-svg-icons": "^2.0.1",
|
"vite-plugin-svg-icons": "^2.0.1",
|
||||||
"vue-tsc": "^1.8.27"
|
"vue-tsc": "^1.8.27"
|
||||||
},
|
},
|
||||||
"simple-git-hooks": {
|
|
||||||
"pre-commit": "pnpm lint-staged",
|
|
||||||
"commit-msg": "npx --no-install commitlint --edit $1"
|
|
||||||
},
|
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*": "eslint --fix"
|
"*": "eslint --fix"
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"commitizen": {
|
|
||||||
"path": "node_modules/cz-git"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,60 +0,0 @@
|
|||||||
import { http } from '@/utils/http/axios'
|
|
||||||
import type { Result } from '#/axios'
|
|
||||||
|
|
||||||
export interface BasicResponseModel<T = any> {
|
|
||||||
code: number
|
|
||||||
message: string
|
|
||||||
result: T
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 用户登录
|
|
||||||
*/
|
|
||||||
export function login(params: any) {
|
|
||||||
return http.request<Result<string>>(
|
|
||||||
{
|
|
||||||
url: '/token/login',
|
|
||||||
method: 'POST',
|
|
||||||
params,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
isTransformResponse: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 获取用户信息
|
|
||||||
*/
|
|
||||||
export function getUserInfo() {
|
|
||||||
return http.request({
|
|
||||||
url: '/getUserInfo',
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 用户登出
|
|
||||||
*/
|
|
||||||
export function doLogout() {
|
|
||||||
return http.request({
|
|
||||||
url: '/token/logout',
|
|
||||||
method: 'POST',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 用户修改密码
|
|
||||||
*/
|
|
||||||
export function changePassword(params: any, uid: any) {
|
|
||||||
return http.request(
|
|
||||||
{
|
|
||||||
url: `/user/u${uid}/changepw`,
|
|
||||||
method: 'POST',
|
|
||||||
params,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
isTransformResponse: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@@ -9,8 +9,6 @@ export function useGlobSetting(): Readonly<GlobConfig> {
|
|||||||
VITE_GLOB_API_URL,
|
VITE_GLOB_API_URL,
|
||||||
VITE_GLOB_APP_SHORT_NAME,
|
VITE_GLOB_APP_SHORT_NAME,
|
||||||
VITE_GLOB_API_URL_PREFIX,
|
VITE_GLOB_API_URL_PREFIX,
|
||||||
VITE_GLOB_UPLOAD_URL,
|
|
||||||
VITE_GLOB_IMG_URL,
|
|
||||||
} = getAppEnvConfig()
|
} = getAppEnvConfig()
|
||||||
|
|
||||||
if (!/[a-z_]*/i.test(VITE_GLOB_APP_SHORT_NAME)) {
|
if (!/[a-z_]*/i.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||||
@@ -26,8 +24,6 @@ export function useGlobSetting(): Readonly<GlobConfig> {
|
|||||||
apiUrl: VITE_GLOB_API_URL,
|
apiUrl: VITE_GLOB_API_URL,
|
||||||
shortName: VITE_GLOB_APP_SHORT_NAME,
|
shortName: VITE_GLOB_APP_SHORT_NAME,
|
||||||
urlPrefix: VITE_GLOB_API_URL_PREFIX,
|
urlPrefix: VITE_GLOB_API_URL_PREFIX,
|
||||||
uploadUrl: VITE_GLOB_UPLOAD_URL,
|
|
||||||
imgUrl: VITE_GLOB_IMG_URL,
|
|
||||||
}
|
}
|
||||||
return glob as Readonly<GlobConfig>
|
return glob as Readonly<GlobConfig>
|
||||||
}
|
}
|
||||||
|
@@ -24,3 +24,29 @@ export const ErrorPageRoute: RouteRecordRaw = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主页面
|
||||||
|
*/
|
||||||
|
export const routeModuleList: Array<RouteRecordRaw> = [
|
||||||
|
{
|
||||||
|
path: '/dashboard',
|
||||||
|
name: 'Dashboard',
|
||||||
|
redirect: '/dashboard/index',
|
||||||
|
component: Layout,
|
||||||
|
meta: {
|
||||||
|
title: '主控台',
|
||||||
|
icon: 'wap-home',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'index',
|
||||||
|
name: 'DashboardPage',
|
||||||
|
meta: {
|
||||||
|
keepAlive: false,
|
||||||
|
},
|
||||||
|
component: () => import('@/views/dashboard/index.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
@@ -13,13 +13,11 @@ export const BusinessRoute: RouteRecordRaw = {
|
|||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/t',
|
path: '/t/:key',
|
||||||
name: 'DispatchRouter',
|
name: 'DispatchRouter',
|
||||||
component: () => import('@/views/system/dispatch/DispatchRouter.vue'),
|
component: () => import('@/views/system/dispatch/DispatchRouter.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '中转页',
|
title: '中转页',
|
||||||
ignoreAuth: true,
|
|
||||||
hiddenTabbar: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
30
src/router/daxpay.ts
Normal file
30
src/router/daxpay.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import type { RouteRecordRaw } from 'vue-router'
|
||||||
|
|
||||||
|
const Layout = () => import('@/layout/index.vue')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付模块路由
|
||||||
|
*/
|
||||||
|
export const DaxPayRoute: RouteRecordRaw = {
|
||||||
|
path: '/daxpay',
|
||||||
|
name: 'daxpay',
|
||||||
|
component: Layout,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/alipay/auth/:appId/:channel/:queryCode/:aliAppId',
|
||||||
|
name: 'AlipayAuth',
|
||||||
|
component: () => import('@/views/daxpay/channel/alipay/AlipayAuthCallback.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '支付宝信息获取',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/wechat/auth/:appId/:channel/:queryCode',
|
||||||
|
name: 'WechatAuth',
|
||||||
|
component: () => import('@/views/daxpay/channel/wechat/WechatAuthCallback.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '微信信息获取',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
@@ -2,16 +2,17 @@ import type { App } from 'vue'
|
|||||||
import type { RouteRecordRaw } from 'vue-router'
|
import type { RouteRecordRaw } from 'vue-router'
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||||
import { createRouterGuards } from './router-guards'
|
import { createRouterGuards } from './router-guards'
|
||||||
import routeModuleList from './modules'
|
import { ErrorPageRoute, routeModuleList } from '@/router/base'
|
||||||
import { ErrorPageRoute } from '@/router/base'
|
|
||||||
import { useRouteStoreWidthOut } from '@/store/modules/route'
|
import { useRouteStoreWidthOut } from '@/store/modules/route'
|
||||||
|
|
||||||
// 菜单
|
// 菜单
|
||||||
import { BusinessRoute } from '@/router/business'
|
import { BusinessRoute } from '@/router/business'
|
||||||
import { DemoRoute } from '@/router/demo'
|
import { DemoRoute } from '@/router/demo'
|
||||||
|
import { DaxPayRoute } from '@/router/daxpay'
|
||||||
|
|
||||||
// 普通路由
|
// 普通路由
|
||||||
export const constantRouter: RouteRecordRaw[] = [
|
export const constantRouter: RouteRecordRaw[] = [
|
||||||
|
DaxPayRoute,
|
||||||
DemoRoute,
|
DemoRoute,
|
||||||
ErrorPageRoute,
|
ErrorPageRoute,
|
||||||
BusinessRoute,
|
BusinessRoute,
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
import type { RouteRecordRaw } from 'vue-router'
|
|
||||||
|
|
||||||
const Layout = () => import('@/layout/index.vue')
|
|
||||||
|
|
||||||
const routeModuleList: Array<RouteRecordRaw> = [
|
|
||||||
{
|
|
||||||
path: '/dashboard',
|
|
||||||
name: 'Dashboard',
|
|
||||||
redirect: '/dashboard/index',
|
|
||||||
component: Layout,
|
|
||||||
meta: {
|
|
||||||
title: '主控台',
|
|
||||||
icon: 'wap-home',
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'index',
|
|
||||||
name: 'DashboardPage',
|
|
||||||
meta: {
|
|
||||||
keepAlive: false,
|
|
||||||
},
|
|
||||||
component: () => import('@/views/dashboard/index.vue'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default routeModuleList
|
|
@@ -1,15 +0,0 @@
|
|||||||
export default {
|
|
||||||
upload: {
|
|
||||||
// 考虑接口规范不同
|
|
||||||
apiSetting: {
|
|
||||||
// 集合字段名
|
|
||||||
infoField: 'result',
|
|
||||||
// 图片地址字段名
|
|
||||||
imgField: 'imagePath',
|
|
||||||
},
|
|
||||||
// 最大上传图片大小
|
|
||||||
maxSize: 1,
|
|
||||||
// 图片上传类型
|
|
||||||
fileType: ['image/png', 'image/jpg', 'image/jpeg', 'image/gif', 'image/svg+xml'],
|
|
||||||
},
|
|
||||||
}
|
|
@@ -1,115 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import { createStorage } from '@/utils/Storage'
|
|
||||||
import { store } from '@/store'
|
|
||||||
import { ACCESS_TOKEN, CURRENT_USER } from '@/store/mutation-types'
|
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
|
||||||
import { doLogout, getUserInfo, login } from '@/api/system/user'
|
|
||||||
import { PageEnum } from '@/enums/pageEnum'
|
|
||||||
import router from '@/router'
|
|
||||||
|
|
||||||
const Storage = createStorage({ storage: localStorage })
|
|
||||||
|
|
||||||
interface UserInfo {
|
|
||||||
userId: string | number
|
|
||||||
username: string
|
|
||||||
realname: string
|
|
||||||
nickname: string
|
|
||||||
avatar: string
|
|
||||||
cover: string
|
|
||||||
gender: number
|
|
||||||
phone: string
|
|
||||||
sign?: string
|
|
||||||
industry?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IUserState {
|
|
||||||
token?: string
|
|
||||||
userInfo: Nullable<UserInfo>
|
|
||||||
lastUpdateTime: number
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LoginParams {
|
|
||||||
username: string
|
|
||||||
password: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
|
||||||
id: 'app-user',
|
|
||||||
state: (): IUserState => ({
|
|
||||||
userInfo: null,
|
|
||||||
token: undefined,
|
|
||||||
lastUpdateTime: 0,
|
|
||||||
}),
|
|
||||||
getters: {
|
|
||||||
getUserInfo(): UserInfo {
|
|
||||||
return this.userInfo || Storage.get(CURRENT_USER, '') || {}
|
|
||||||
},
|
|
||||||
getToken(): string {
|
|
||||||
return this.token || Storage.get(ACCESS_TOKEN, '')
|
|
||||||
},
|
|
||||||
getLastUpdateTime(): number {
|
|
||||||
return this.lastUpdateTime
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
setToken(token: string | undefined) {
|
|
||||||
this.token = token || ''
|
|
||||||
Storage.set(ACCESS_TOKEN, token)
|
|
||||||
},
|
|
||||||
setUserInfo(info: UserInfo | null) {
|
|
||||||
this.userInfo = info
|
|
||||||
this.lastUpdateTime = new Date().getTime()
|
|
||||||
Storage.set(CURRENT_USER, info)
|
|
||||||
},
|
|
||||||
|
|
||||||
async Login(params: LoginParams) {
|
|
||||||
try {
|
|
||||||
const response = await login(params)
|
|
||||||
const { result, code } = response
|
|
||||||
if (code === ResultEnum.SUCCESS) {
|
|
||||||
// save token
|
|
||||||
this.setToken(result.token)
|
|
||||||
}
|
|
||||||
return Promise.resolve(response)
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async GetUserInfo() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
getUserInfo()
|
|
||||||
.then((res) => {
|
|
||||||
this.setUserInfo(res)
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async Logout() {
|
|
||||||
if (this.getToken) {
|
|
||||||
try {
|
|
||||||
await doLogout()
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
console.error('注销Token失败')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.setToken(undefined)
|
|
||||||
this.setUserInfo(null)
|
|
||||||
Storage.remove(ACCESS_TOKEN)
|
|
||||||
Storage.remove(CURRENT_USER)
|
|
||||||
router.push(PageEnum.BASE_LOGIN)
|
|
||||||
location.reload()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// Need to be used outside the setup
|
|
||||||
export function useUserStoreWidthOut() {
|
|
||||||
return useUserStore(store)
|
|
||||||
}
|
|
@@ -1,3 +1,2 @@
|
|||||||
export const ACCESS_TOKEN = 'ACCESS-TOKEN' // 用户token
|
export const ACCESS_TOKEN = 'ACCESS-TOKEN' // 用户token
|
||||||
export const CURRENT_USER = 'CURRENT-USER' // 当前用户信息
|
export const CURRENT_USER = 'CURRENT-USER' // 当前用户信息
|
||||||
export const DESIGN_SETTING = 'DESIGN-SETTING' // 当前用户主题信息
|
|
||||||
|
@@ -28,9 +28,6 @@ export function getAppEnvConfig() {
|
|||||||
VITE_GLOB_API_URL,
|
VITE_GLOB_API_URL,
|
||||||
VITE_GLOB_APP_SHORT_NAME,
|
VITE_GLOB_APP_SHORT_NAME,
|
||||||
VITE_GLOB_API_URL_PREFIX,
|
VITE_GLOB_API_URL_PREFIX,
|
||||||
VITE_GLOB_UPLOAD_URL,
|
|
||||||
VITE_GLOB_PROD_MOCK,
|
|
||||||
VITE_GLOB_IMG_URL,
|
|
||||||
} = ENV
|
} = ENV
|
||||||
|
|
||||||
if (!/^[a-z_]*$/i.test(VITE_GLOB_APP_SHORT_NAME)) {
|
if (!/^[a-z_]*$/i.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||||
@@ -45,9 +42,6 @@ export function getAppEnvConfig() {
|
|||||||
VITE_GLOB_API_URL,
|
VITE_GLOB_API_URL,
|
||||||
VITE_GLOB_APP_SHORT_NAME,
|
VITE_GLOB_APP_SHORT_NAME,
|
||||||
VITE_GLOB_API_URL_PREFIX,
|
VITE_GLOB_API_URL_PREFIX,
|
||||||
VITE_GLOB_UPLOAD_URL,
|
|
||||||
VITE_GLOB_PROD_MOCK,
|
|
||||||
VITE_GLOB_IMG_URL,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ import axios from 'axios'
|
|||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import { AxiosCanceler } from './axiosCancel'
|
import { AxiosCanceler } from './axiosCancel'
|
||||||
import type { CreateAxiosOptions, RequestOptions, UploadFileParams } from './types'
|
import type { CreateAxiosOptions, RequestOptions } from './types'
|
||||||
import { isFunction } from '@/utils/is'
|
import { isFunction } from '@/utils/is'
|
||||||
|
|
||||||
import { ContentTypeEnum, RequestEnum } from '@/enums/httpEnum'
|
import { ContentTypeEnum, RequestEnum } from '@/enums/httpEnum'
|
||||||
@@ -108,45 +108,6 @@ export class VAxios {
|
|||||||
return transform
|
return transform
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 文件上传
|
|
||||||
*/
|
|
||||||
uploadFile<T = any>(config: AxiosRequestConfig, params: UploadFileParams) {
|
|
||||||
const formData = new window.FormData()
|
|
||||||
const customFilename = params.name || 'file'
|
|
||||||
|
|
||||||
if (params.filename) {
|
|
||||||
formData.append(customFilename, params.file, params.filename)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
formData.append(customFilename, params.file)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.data) {
|
|
||||||
Object.keys(params.data).forEach((key) => {
|
|
||||||
const value = params.data![key]
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.forEach((item) => {
|
|
||||||
formData.append(`${key}[]`, item)
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
formData.append(key, params.data![key])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.axiosInstance.request<T>({
|
|
||||||
method: 'POST',
|
|
||||||
data: formData,
|
|
||||||
headers: {
|
|
||||||
'Content-type': ContentTypeEnum.FORM_DATA,
|
|
||||||
'ignoreCancelToken': true,
|
|
||||||
},
|
|
||||||
...config,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// support form-data
|
// support form-data
|
||||||
supportFormData(config: AxiosRequestConfig) {
|
supportFormData(config: AxiosRequestConfig) {
|
||||||
const headers = config.headers || this.options.headers
|
const headers = config.headers || this.options.headers
|
||||||
|
@@ -15,8 +15,6 @@ import { isString } from '@/utils/is/'
|
|||||||
import { deepMerge, isUrl } from '@/utils'
|
import { deepMerge, isUrl } from '@/utils'
|
||||||
import { setObjToUrlParams } from '@/utils/urlUtils'
|
import { setObjToUrlParams } from '@/utils/urlUtils'
|
||||||
|
|
||||||
import { useUserStoreWidthOut } from '@/store/modules/user'
|
|
||||||
|
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { storage } from '@/utils/Storage'
|
import { storage } from '@/utils/Storage'
|
||||||
import type { Result } from '#/axios'
|
import type { Result } from '#/axios'
|
||||||
@@ -31,6 +29,8 @@ const transform: AxiosTransform = {
|
|||||||
/**
|
/**
|
||||||
* @description: 处理请求数据
|
* @description: 处理请求数据
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line ts/ban-ts-comment
|
||||||
|
// @ts-expect-error
|
||||||
transformRequestData: (res: AxiosResponse<Result>, options: RequestOptions) => {
|
transformRequestData: (res: AxiosResponse<Result>, options: RequestOptions) => {
|
||||||
const {
|
const {
|
||||||
isShowMessage = true,
|
isShowMessage = true,
|
||||||
@@ -180,19 +180,6 @@ const transform: AxiosTransform = {
|
|||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 请求拦截器处理
|
|
||||||
*/
|
|
||||||
requestInterceptors: (config, options) => {
|
|
||||||
// 请求之前处理config
|
|
||||||
const userStore = useUserStoreWidthOut()
|
|
||||||
const token = userStore.getToken
|
|
||||||
if (token) {
|
|
||||||
;(config as Recordable).headers.Accesstoken = token
|
|
||||||
}
|
|
||||||
return config
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 响应错误处理
|
* @description: 响应错误处理
|
||||||
*/
|
*/
|
||||||
|
@@ -7,19 +7,6 @@ export interface CreateAxiosOptions extends AxiosRequestConfig {
|
|||||||
authenticationScheme?: string
|
authenticationScheme?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传文件
|
|
||||||
export interface UploadFileParams {
|
|
||||||
// 其他参数
|
|
||||||
data?: Recordable
|
|
||||||
// 文件参数接口字段名
|
|
||||||
name?: string
|
|
||||||
// 文件
|
|
||||||
file: File | Blob
|
|
||||||
// 文件名称
|
|
||||||
filename?: string
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RequestOptions {
|
export interface RequestOptions {
|
||||||
// 请求参数拼接到url
|
// 请求参数拼接到url
|
||||||
joinParamsToUrl?: boolean
|
joinParamsToUrl?: boolean
|
||||||
|
17
src/views/daxpay/channel/alipay/AlipayAuthCallback.vue
Normal file
17
src/views/daxpay/channel/alipay/AlipayAuthCallback.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const {appId, channel, queryCode, aliAppId} = route.params
|
||||||
|
|
||||||
|
console.log(appId, channel)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
|
||||||
|
</style>
|
13
src/views/daxpay/channel/wechat/WechatAuthCallback.vue
Normal file
13
src/views/daxpay/channel/wechat/WechatAuthCallback.vue
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
const {appId, channel,queryCode} = route.params
|
||||||
|
|
||||||
|
console.log(appId, channel)
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
|
||||||
|
</style>
|
@@ -2,18 +2,18 @@
|
|||||||
<div> 跳转中... </div>
|
<div> 跳转中... </div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="DispatchRouter">
|
<script setup lang="ts">
|
||||||
// 获取路由参数
|
// 获取路由参数
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { onMounted, unref } from 'vue'
|
import { onMounted } from 'vue'
|
||||||
import { getRouterByKey } from './Dispatch.api'
|
import { getRouterByKey } from './Dispatch.api'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
|
||||||
const { currentRoute } = useRouter()
|
const { currentRoute } = useRouter()
|
||||||
const { query } = unref(currentRoute)
|
const { params } = unref(currentRoute)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const key = query.key as string
|
const key = params.key as string
|
||||||
getRouterByKey(key).then(({ data }) => {
|
getRouterByKey(key).then(({ data }) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
router.push({
|
router.push({
|
||||||
|
8
types/config.d.ts
vendored
8
types/config.d.ts
vendored
@@ -4,8 +4,6 @@ export interface GlobConfig {
|
|||||||
apiUrl: string
|
apiUrl: string
|
||||||
shortName: string
|
shortName: string
|
||||||
urlPrefix?: string
|
urlPrefix?: string
|
||||||
uploadUrl?: string
|
|
||||||
imgUrl?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GlobEnvConfig {
|
export interface GlobEnvConfig {
|
||||||
@@ -17,10 +15,6 @@ export interface GlobEnvConfig {
|
|||||||
VITE_GLOB_API_URL: string
|
VITE_GLOB_API_URL: string
|
||||||
// 接口前缀
|
// 接口前缀
|
||||||
VITE_GLOB_API_URL_PREFIX?: string
|
VITE_GLOB_API_URL_PREFIX?: string
|
||||||
// Project abbreviation
|
//项目简称
|
||||||
VITE_GLOB_APP_SHORT_NAME: string
|
VITE_GLOB_APP_SHORT_NAME: string
|
||||||
// 图片上传地址
|
|
||||||
VITE_GLOB_UPLOAD_URL?: string
|
|
||||||
// 图片前缀地址
|
|
||||||
VITE_GLOB_IMG_URL?: string
|
|
||||||
}
|
}
|
||||||
|
1
types/global.d.ts
vendored
1
types/global.d.ts
vendored
@@ -61,7 +61,6 @@ declare global {
|
|||||||
VITE_GLOB_APP_TITLE: string
|
VITE_GLOB_APP_TITLE: string
|
||||||
VITE_GLOB_APP_SHORT_NAME: string
|
VITE_GLOB_APP_SHORT_NAME: string
|
||||||
VITE_DROP_CONSOLE: boolean
|
VITE_DROP_CONSOLE: boolean
|
||||||
VITE_GLOB_IMG_URL: string
|
|
||||||
VITE_PROXY: [string, string][]
|
VITE_PROXY: [string, string][]
|
||||||
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
|
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
|
||||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
|
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
|
||||||
|
Reference in New Issue
Block a user