Compare commits
No commits in common. "1db19bafdd6d777e875828cce6b38ff866c480b6" and "f68c1fd30118b194c07de1c17f8baa5b49de0054" have entirely different histories.
1db19bafdd
...
f68c1fd301
@ -469,53 +469,11 @@ export function settingWarehouseSaveFrontCert(
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 当前仓库已授权的微信小程序信息(setting.warehouse.getweChatApp 响应;字段名以后端为准,前端做多形态兼容) */
|
|
||||||
export type SettingWarehouseWeChatApp = {
|
|
||||||
warehouse_id?: number
|
|
||||||
/** 小程序 AppID */
|
|
||||||
app_id?: string
|
|
||||||
/** 小程序 AppSecret */
|
|
||||||
app_secret?: string
|
|
||||||
/** 小程序名称 */
|
|
||||||
nick_name?: string
|
|
||||||
/** 小程序原始ID(gh_ 开头) */
|
|
||||||
original_id?: string
|
|
||||||
/** 第三方平台授权码 */
|
|
||||||
authorization_code?: string
|
|
||||||
/** 授权时间 */
|
|
||||||
authorized_at?: string | null
|
|
||||||
updated_at?: string | null
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询当前仓库已授权的微信小程序信息(微信小程序配置页使用)。
|
|
||||||
* 未授权时返回空配置(无小程序相关字段),前端据此提示「需要授权」并展示「去授权」入口。
|
|
||||||
*/
|
|
||||||
export function settingWarehouseGetWeChatApp(
|
|
||||||
data: Record<string, unknown> = {}
|
|
||||||
): Promise<
|
|
||||||
{ code?: number; message?: string; data?: SettingWarehouseWeChatApp } & Record<string, unknown>
|
|
||||||
> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'setting.warehouse.getweChatApp',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const settingWarehouse = {
|
export const settingWarehouse = {
|
||||||
getSettings: settingWarehouseGetSettings,
|
getSettings: settingWarehouseGetSettings,
|
||||||
getFieldMeta: settingWarehouseGetFieldMeta,
|
getFieldMeta: settingWarehouseGetFieldMeta,
|
||||||
saveSettings: settingWarehouseSaveSettings,
|
saveSettings: settingWarehouseSaveSettings,
|
||||||
getFrontConfig: settingWarehouseGetFrontConfig,
|
getFrontConfig: settingWarehouseGetFrontConfig,
|
||||||
saveFrontConfig: settingWarehouseSaveFrontConfig,
|
saveFrontConfig: settingWarehouseSaveFrontConfig,
|
||||||
saveFrontCert: settingWarehouseSaveFrontCert,
|
saveFrontCert: settingWarehouseSaveFrontCert
|
||||||
getWeChatApp: settingWarehouseGetWeChatApp
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
const v = '1.0'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信授权相关接口(module wechat)
|
|
||||||
*
|
|
||||||
* wechat.getAuthUrl —— 获取微信授权链接:前端拿到链接后在**新小窗口**中打开,
|
|
||||||
* 用户完成授权后由后端接收微信回调并落库,前端再调用业务侧查询接口刷新。
|
|
||||||
*/
|
|
||||||
export type WeChatAuthUrlPayload = {
|
|
||||||
/** 授权链接(后端返回的字段名可能是 url / auth_url / authorize_url 等,取值时做兼容) */
|
|
||||||
url?: string
|
|
||||||
auth_url?: string
|
|
||||||
authorize_url?: string
|
|
||||||
/** 授权状态校验串 */
|
|
||||||
state?: string
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取微信授权链接(由用户点击「去授权」时调用,避免页面加载即跳转/弹窗被拦截)。
|
|
||||||
* 返回值中链接字段名做多形态兼容,取值见页面 pickUrl()。
|
|
||||||
*/
|
|
||||||
export function wechatGetAuthUrl(
|
|
||||||
data: Record<string, unknown> = {}
|
|
||||||
): Promise<{ code?: number; message?: string; data?: WeChatAuthUrlPayload } & Record<string, unknown>> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'wechat.getAuthUrl',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取「代注册小程序」链接(第三方平台快速创建小程序):
|
|
||||||
* 同样由用户点击按钮后才请求,并在新小窗口中打开;注册完成后调用业务侧查询接口刷新。
|
|
||||||
* 若后端方法名不同,仅需改此处 method。
|
|
||||||
*/
|
|
||||||
export function wechatGetRegisterUrl(
|
|
||||||
data: Record<string, unknown> = {}
|
|
||||||
): Promise<{ code?: number; message?: string; data?: WeChatAuthUrlPayload } & Record<string, unknown>> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'wechat.getRegisterUrl',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const wechat = {
|
|
||||||
getAuthUrl: wechatGetAuthUrl,
|
|
||||||
getRegisterUrl: wechatGetRegisterUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
export default wechat
|
|
||||||
@ -51,9 +51,6 @@ export const componentMap: Record<string, any> = {
|
|||||||
/** 与后端菜单 component 字段兼容:部分环境为老路径 system/setting/basicManagement/index → 强制指向 newview(含投递计划/报表定义) */
|
/** 与后端菜单 component 字段兼容:部分环境为老路径 system/setting/basicManagement/index → 强制指向 newview(含投递计划/报表定义) */
|
||||||
'system/setting/basicManagement/index': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
'system/setting/basicManagement/index': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
||||||
'system/setting/basicManagement': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
'system/setting/basicManagement': () => import('@/views/system/setting/basicManagement/newview/index.vue'),
|
||||||
/** 微信小程序配置(备用独立页;与基础管理内「微信小程序」标签页共用表单组件) */
|
|
||||||
'system/setting/miniprogram/index': () => import('@/views/system/setting/miniprogram/index.vue'),
|
|
||||||
'system/setting/miniprogram': () => import('@/views/system/setting/miniprogram/index.vue'),
|
|
||||||
'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||||
// 'role/index': () => import('@/views/system/setting/role/index.vue'),
|
// 'role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||||
// 'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
// 'system/setting/role/index': () => import('@/views/system/setting/role/index.vue'),
|
||||||
|
|||||||
@ -32,7 +32,7 @@ function resolveFrontBrandExemptHosts(): Set<string> {
|
|||||||
const FRONT_BRAND_EXEMPT_HOSTS = resolveFrontBrandExemptHosts()
|
const FRONT_BRAND_EXEMPT_HOSTS = resolveFrontBrandExemptHosts()
|
||||||
|
|
||||||
/** 归一化访问域名:去协议/路径/端口、转小写,用于豁免判定与请求域名 */
|
/** 归一化访问域名:去协议/路径/端口、转小写,用于豁免判定与请求域名 */
|
||||||
export function normalizeFrontHost(raw?: string): string {
|
function normalizeFrontHost(raw?: string): string {
|
||||||
let host = (raw || '').trim().replace(/^https?:\/\//, '')
|
let host = (raw || '').trim().replace(/^https?:\/\//, '')
|
||||||
const slashIdx = host.indexOf('/')
|
const slashIdx = host.indexOf('/')
|
||||||
if (slashIdx >= 0) host = host.slice(0, slashIdx)
|
if (slashIdx >= 0) host = host.slice(0, slashIdx)
|
||||||
@ -41,21 +41,6 @@ export function normalizeFrontHost(raw?: string): string {
|
|||||||
return host.toLowerCase()
|
return host.toLowerCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 主域名(豁免域名)清单:与品牌豁免同源,供其它「仅主域名可用」能力复用 */
|
|
||||||
export function getMainDomainHosts(): string[] {
|
|
||||||
return Array.from(FRONT_BRAND_EXEMPT_HOSTS)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前访问域名是否为主域名(= 品牌豁免域名,来源 VITE_FRONT_CONFIG_EXEMPT_HOSTS)。
|
|
||||||
* 用途:微信小程序授权页只能从主域名进入(自持域名下微信授权回调无法回到本系统),
|
|
||||||
* 非主域名时前端禁用「去授权」入口并提示。
|
|
||||||
*/
|
|
||||||
export function isMainDomainHost(raw?: string): boolean {
|
|
||||||
const host = normalizeFrontHost(raw ?? window.location.hostname)
|
|
||||||
return Boolean(host) && FRONT_BRAND_EXEMPT_HOSTS.has(host)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端独立部署品牌(frontConfig.getByDomain 消费端)
|
* 前端独立部署品牌(frontConfig.getByDomain 消费端)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import DetailPanel from './components/DetailPanel.vue'
|
|||||||
import LogPanel from './components/LogPanel.vue'
|
import LogPanel from './components/LogPanel.vue'
|
||||||
import WarehouseSettingsForm from '../pages/WarehouseSettingsForm.vue'
|
import WarehouseSettingsForm from '../pages/WarehouseSettingsForm.vue'
|
||||||
import FrontConfigForm from '../pages/FrontConfigForm.vue'
|
import FrontConfigForm from '../pages/FrontConfigForm.vue'
|
||||||
import MiniProgramConfigForm from '../pages/MiniProgramConfigForm.vue'
|
|
||||||
import ApiAppFormDialog from '../pages/ApiAppFormDialog.vue'
|
import ApiAppFormDialog from '../pages/ApiAppFormDialog.vue'
|
||||||
import DeliveryPlanFormDialog from '../pages/DeliveryPlanFormDialog.vue'
|
import DeliveryPlanFormDialog from '../pages/DeliveryPlanFormDialog.vue'
|
||||||
import DefinitionFormDialog from '../pages/DefinitionFormDialog.vue'
|
import DefinitionFormDialog from '../pages/DefinitionFormDialog.vue'
|
||||||
@ -58,7 +57,6 @@ export const COMPONENT_REGISTRY: Record<string, Component> = {
|
|||||||
LogPanel,
|
LogPanel,
|
||||||
WarehouseSettingsForm,
|
WarehouseSettingsForm,
|
||||||
FrontConfigForm,
|
FrontConfigForm,
|
||||||
MiniProgramConfigForm,
|
|
||||||
ApiAppFormDialog,
|
ApiAppFormDialog,
|
||||||
DeliveryPlanFormDialog,
|
DeliveryPlanFormDialog,
|
||||||
DeliveryPlanCopyDialog,
|
DeliveryPlanCopyDialog,
|
||||||
@ -1646,22 +1644,6 @@ export const tabPages: TabPageRawConfig[] = [
|
|||||||
confirmButtonText: '删除'
|
confirmButtonText: '删除'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
|
|
||||||
// ===== 标签页六:微信小程序配置(备用,表单项页面;独立页入口见 views/system/setting/miniprogram/index.vue) =====
|
|
||||||
{
|
|
||||||
name: 'miniProgram',
|
|
||||||
label: '微信小程序',
|
|
||||||
viewType: 'form',
|
|
||||||
formPage: MiniProgramConfigForm,
|
|
||||||
scanBoxCacheKey: 'basic-settings-miniprogram',
|
|
||||||
scanBoxFieldKeys: [],
|
|
||||||
tableColumnKeys: [],
|
|
||||||
upperTableDefaults: {
|
|
||||||
title: '',
|
|
||||||
showSelection: false
|
|
||||||
},
|
|
||||||
detailSections: []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,48 +0,0 @@
|
|||||||
<!--
|
|
||||||
微信小程序配置 — 独立页面(备用)
|
|
||||||
说明:
|
|
||||||
1) 与「系统设置 → 基础管理 → 微信小程序」标签页共用同一套组件
|
|
||||||
(basicManagement/newview/pages/MiniProgramConfigForm.vue),避免双份维护。
|
|
||||||
2) 本页作为独立菜单/路由入口备用:后端菜单配置 component 为
|
|
||||||
system/setting/miniprogram/index(或 system/setting/miniprogram)时即可访问,
|
|
||||||
见 src/router/map.ts 的 componentMap。
|
|
||||||
3) 数据来源:setting.warehouse.getweChatApp(拉取已授权的小程序配置);
|
|
||||||
未配置时提示需要授权,点击「去授权」后由 wechat.getAuthUrl 取链接并在新小窗打开。
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div class="miniprogram-page" :style="{ height: containerHeight }">
|
|
||||||
<div class="miniprogram-page__body">
|
|
||||||
<MiniProgramConfigForm />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue'
|
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
|
||||||
import MiniProgramConfigForm from '@/views/system/setting/basicManagement/newview/pages/MiniProgramConfigForm.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'MiniProgramSetting' })
|
|
||||||
|
|
||||||
const settingsStore = useSettingsStore()
|
|
||||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
|
||||||
const containerHeight = computed(() =>
|
|
||||||
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.miniprogram-page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background: #fff;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.miniprogram-page__body {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user