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:
@@ -5,7 +5,7 @@ VITE_PORT=9100
|
|||||||
VITE_PUBLIC_PATH=/
|
VITE_PUBLIC_PATH=/
|
||||||
|
|
||||||
# 跨域代理,可以配置多个,请注意不要换行
|
# 跨域代理,可以配置多个,请注意不要换行
|
||||||
VITE_PROXY=[["/server","http://localhost:9000"]]
|
VITE_PROXY=[["/server","http://localhost:10880"]]
|
||||||
|
|
||||||
# API 接口地址
|
# API 接口地址
|
||||||
VITE_GLOB_API_URL=
|
VITE_GLOB_API_URL=
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# 独立部署模式
|
# 独立部署模式
|
||||||
VITE_PUBLIC_PATH = /h5
|
VITE_PUBLIC_PATH = /
|
||||||
# API 接口前缀
|
# API 接口前缀
|
||||||
VITE_GLOB_API_URL_PREFIX = /api
|
VITE_GLOB_API_URL_PREFIX = /api
|
||||||
|
|
||||||
|
@@ -57,5 +57,13 @@ export default antfu({
|
|||||||
'node/prefer-global/process': 'off',
|
'node/prefer-global/process': 'off',
|
||||||
// 对所有控制语句强制执行一致的大括号样式,(只有一行的时候eslint默认是不需要大括号的,这样会降低代码清晰度)
|
// 对所有控制语句强制执行一致的大括号样式,(只有一行的时候eslint默认是不需要大括号的,这样会降低代码清晰度)
|
||||||
'curly': ['error', 'all'],
|
'curly': ['error', 'all'],
|
||||||
|
// 'indent': 'off',
|
||||||
|
// 'vue/script-indent': [
|
||||||
|
// 'error',
|
||||||
|
// 2,
|
||||||
|
// {
|
||||||
|
// baseIndent: 1,
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { App } from 'vue'
|
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, createWebHistory } from "vue-router";
|
||||||
import { createRouterGuards } from './router-guards'
|
import { createRouterGuards } from './router-guards'
|
||||||
import { ErrorPageRoute, routeModuleList } from '@/router/base'
|
import { ErrorPageRoute, routeModuleList } from '@/router/base'
|
||||||
import { useRouteStoreWidthOut } from '@/store/modules/route'
|
import { useRouteStoreWidthOut } from '@/store/modules/route'
|
||||||
@@ -24,7 +24,8 @@ routeStore.setMenus(routeModuleList)
|
|||||||
routeStore.setRouters(constantRouter.concat(routeModuleList))
|
routeStore.setRouters(constantRouter.concat(routeModuleList))
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(''),
|
// 重定向时hash模式可能无法跳转,需要使用history模式
|
||||||
|
history: createWebHistory(''),
|
||||||
routes: constantRouter.concat(...routeModuleList),
|
routes: constantRouter.concat(...routeModuleList),
|
||||||
strict: true,
|
strict: true,
|
||||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||||
|
28
src/views/daxpay/channel/ChannelAuth.api.ts
Normal file
28
src/views/daxpay/channel/ChannelAuth.api.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { http } from '@/utils/http/axios'
|
||||||
|
import type { Result } from '#/axios'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过AuthCode获取并设置认证结果
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
export function authAndSet(param: AuthCodeParam) {
|
||||||
|
return http.request<Result>({
|
||||||
|
url: '/unipay/assist/channel/auth/authAndSet',
|
||||||
|
method: 'POST',
|
||||||
|
data: param,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道认证参数
|
||||||
|
*/
|
||||||
|
export interface AuthCodeParam {
|
||||||
|
// 通道
|
||||||
|
channel?: string
|
||||||
|
// 标识码
|
||||||
|
authCode?: string
|
||||||
|
// 查询Code
|
||||||
|
queryCode?: string
|
||||||
|
// 应用号
|
||||||
|
appId?: string
|
||||||
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
获取中
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const {appId, channel, queryCode, aliAppId} = route.params
|
const {appId, channel, queryCode, aliAppId} = route.params
|
||||||
|
|
||||||
console.log(appId, channel)
|
console.log(appId, channel)
|
||||||
|
@@ -1,13 +1,37 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
const {appId, channel,queryCode} = route.params
|
<div />
|
||||||
|
|
||||||
console.log(appId, channel)
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import type { AuthCodeParam } from '@/views/daxpay/channel/ChannelAuth.api'
|
||||||
|
import { authAndSet } from '@/views/daxpay/channel/ChannelAuth.api'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const { appId, channel, queryCode } = route.params
|
||||||
|
const { code } = route.query
|
||||||
|
const param = ref<AuthCodeParam>({
|
||||||
|
appId: appId as string,
|
||||||
|
queryCode: queryCode as string,
|
||||||
|
authCode: code as string,
|
||||||
|
channel: channel as string,
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面初始化
|
||||||
|
*/
|
||||||
|
async function init() {
|
||||||
|
authAndSet(param.value).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user