feat 打包配置优化和一些功能修改

This commit is contained in:
bootx
2024-10-06 17:24:34 +08:00
parent a96441949a
commit eba5d77b45
10 changed files with 25 additions and 58 deletions

4
.env
View File

@@ -7,6 +7,6 @@ VITE_GLOB_APP_TITLE = DaxPay
# 系统中文名称
VITE_GLOB_APP_TITLE_CN=DaxPay支付系统
# spa shortname 不可出现空格数字等特殊字符
VITE_GLOB_APP_SHORT_NAME = vantMobile
# spa shortname 不可出现空格数字连接线等特殊字符
VITE_GLOB_APP_SHORT_NAME=DaxPay

View File

@@ -2,7 +2,7 @@
VITE_PORT=9100
# 网站根目录
VITE_PUBLIC_PATH=/
VITE_PUBLIC_PATH=/h5
# 跨域代理,可以配置多个,请注意不要换行
VITE_PROXY=[["/server","http://localhost:10880"]]

View File

@@ -1,12 +1,12 @@
# 独立部署模式
VITE_PUBLIC_PATH = /
# API 接口前缀
VITE_GLOB_API_URL_PREFIX = /api
# 嵌入式模式 与网关部署在一起, 和 接口 (server) 前缀 这个是
#VITE_PUBLIC_PATH=/h5
#VITE_PUBLIC_PATH = /
## API 接口前缀
#VITE_GLOB_API_URL_PREFIX=
#VITE_GLOB_API_URL_PREFIX=/api
# 嵌入式模式 与网关部署在一起
VITE_PUBLIC_PATH=/h5
# API 接口前缀
VITE_GLOB_API_URL_PREFIX=
# 是否删除console
VITE_DROP_CONSOLE=true

1
components.d.ts vendored
View File

@@ -16,6 +16,7 @@ declare module 'vue' {
VanField: typeof import('vant/es')['Field']
VanLoading: typeof import('vant/es')['Loading']
VanNumberKeyboard: typeof import('vant/es')['NumberKeyboard']
VanOverlay: typeof import('vant/es')['Overlay']
VanTextEllipsis: typeof import('vant/es')['TextEllipsis']
}
}

View File

@@ -27,7 +27,7 @@ export const DaxPayRoute: RouteRecordRaw = {
},
},
{
path: '/channel/cashier/:mchNo/:appId',
path: '/channel/cashier/:appId',
name: 'ChannelCashier',
component: () => import('@/views/daxpay/channel/ChannelCashier.vue'),
meta: {
@@ -35,7 +35,7 @@ export const DaxPayRoute: RouteRecordRaw = {
},
},
{
path: '/alipay/cashier/:mchNo/:appId',
path: '/alipay/cashier/:appId',
name: 'AlipayCashier',
component: () => import('@/views/daxpay/channel/alipay/cashier/AlipayCashier.vue'),
meta: {
@@ -43,7 +43,7 @@ export const DaxPayRoute: RouteRecordRaw = {
},
},
{
path: '/wechat/cashier/:mchNo/:appId',
path: '/wechat/cashier/:appId',
name: 'WechatCashier',
component: () => import('@/views/daxpay/channel/wechat/cashier/WechatCashier.vue'),
meta: {

View File

@@ -23,7 +23,7 @@ routeStore.setRouters(constantRouter.concat(routeModuleList))
const router = createRouter({
// 重定向时hash模式有场景无法跳转需要使用history模式
history: createWebHistory(''),
history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH),
routes: constantRouter.concat(...routeModuleList),
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),

View File

@@ -2,16 +2,6 @@ import type { AuthResult } from './ChannelAuth.api'
import { http } from '@/utils/http/axios'
import type { Result } from '#/axios'
/**
* 获取商户名称
*/
export function getMchName(mchNo: string) {
return http.request<Result<string>>({
url: '/unipay/ext/channel/cashier/getMchName',
method: 'GET',
params: { mchNo },
})
}
/**
* 获取收银台信息
@@ -61,8 +51,6 @@ export function cashierPay(param: CashierPayParam) {
* 通道认证参数
*/
export interface CashierAuthParam {
// 商户号
mchNo?: string
// 应用号
appId?: string
// 收银台类型
@@ -75,9 +63,6 @@ export interface CashierAuthParam {
* 通道收银支付参数
*/
export interface CashierPayParam {
// 商户号
mchNo?: string
// 应用号
appId?: string
// 收银台类型
@@ -127,8 +112,6 @@ export interface WxJsapiSignResult {
* 收银台配置信息
*/
export interface ChannelCashierConfigResult {
// 商户号
mchNo?: string
// 应用号
appId?: string
// 收银台类型

View File

@@ -6,14 +6,14 @@ import { useRoute } from 'vue-router'
import router from '@/router'
const route = useRoute()
const { mchNo, appId } = route.params
const { appId } = route.params
const ua = navigator.userAgent
if (ua.includes('MicroMessenger')) {
router.push({ path: `/wechat/cashier/${mchNo}/${appId}`, replace: true })
router.push({ path: `/wechat/cashier/${appId}`, replace: true })
}
else if (ua.includes('Alipay')) {
router.push({ path: `/alipay/cashier/${mchNo}/${appId}`, replace: true })
router.push({ path: `/alipay/cashier/${appId}`, replace: true })
}
else {
router.push({ name: 'ErrorResult', query: { msg: '请使用支付宝、微信等支付程序进行扫码支付' }, replace: true })

View File

@@ -6,7 +6,7 @@
</div>
<div class="amount-display">
<p style="font-size: 20px">
付款{{ mchName }}
付款金额
</p>
<p style="font-size: 32px;">
¥ {{ amount }}
@@ -70,7 +70,6 @@ import type {
import {
cashierPay,
getCashierInfo,
getMchName,
} from '@/views/daxpay/channel/ChannelCashier.api'
import { CashierTypeEnum } from '@/enums/daxpay/DaxPayEnum'
@@ -78,14 +77,13 @@ import router from '@/router'
import { useKeyboard } from '@/hooks/daxpay/useKeyboard'
const route = useRoute()
const { mchNo, appId } = route.params
const { appId } = route.params
const showRemark = ref<boolean>(false)
const loading = ref<boolean>(false)
const cashierInfo = ref<ChannelCashierConfigResult>({})
const amount = ref<string>('0')
const description = ref<string>('')
const mchName = ref<string>('')
const { input, del } = useKeyboard(amount)
@@ -102,11 +100,6 @@ function initData() {
}).catch((res) => {
router.push({ name: 'ErrorResult', query: { msg: res.message } })
})
getMchName(mchNo as string).then(({ data }) => {
mchName.value = data
}).catch((res) => {
router.push({ name: 'ErrorResult', query: { msg: res.message } })
})
}
/**
@@ -124,7 +117,6 @@ function pay() {
appId,
cashierType: CashierTypeEnum.ALIPAY,
description: description.value,
mchNo,
} as CashierPayParam
cashierPay(from)
.then(({ data }) => {

View File

@@ -6,7 +6,7 @@
</div>
<div class="amount-display">
<p style="font-size: 20px">
付款{{ mchName }}
付款金额
</p>
<p style="font-size: 32px;">
¥ {{ amount }}
@@ -74,7 +74,6 @@ import {
, cashierPay,
generateAuthUrl,
getCashierInfo,
getMchName,
} from '@/views/daxpay/channel/ChannelCashier.api'
import { CashierTypeEnum } from '@/enums/daxpay/DaxPayEnum'
@@ -82,7 +81,7 @@ import router from '@/router'
import { useKeyboard } from '@/hooks/daxpay/useKeyboard'
const route = useRoute()
const { mchNo, appId } = route.params
const { appId } = route.params
const { code } = route.query
const show = ref<boolean>(false)
@@ -91,12 +90,10 @@ const loading = ref<boolean>(false)
const cashierInfo = ref<ChannelCashierConfigResult>({})
const amount = ref<string>('0')
const description = ref<string>('')
const mchName = ref<string>('')
const openId = ref<string>('')
// 认证参数
const authParam = ref<CashierAuthParam>({
mchNo: mchNo as string,
appId: appId as string,
cashierType: CashierTypeEnum.WECHAT_PAY,
})
@@ -138,11 +135,6 @@ function initData() {
}).catch((res) => {
router.push({ name: 'ErrorResult', query: { msg: res.message } })
})
getMchName(mchNo as string).then(({ data }) => {
mchName.value = data
}).catch((res) => {
router.push({ name: 'ErrorResult', query: { msg: res.message } })
})
auth(authParam.value).then(({ data }) => {
openId.value = data.openId as string
}).catch((res) => {
@@ -167,7 +159,6 @@ function pay() {
openId: openId.value,
cashierType: CashierTypeEnum.WECHAT_PAY,
description: description.value,
mchNo,
} as CashierPayParam
cashierPay(from)
.then(({ data }) => {