521
This commit is contained in:
parent
b7b9bd8d42
commit
bbad73400b
168
info/basicinfo.txt
Normal file
168
info/basicinfo.txt
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
user.info接口返回数据:
|
||||||
|
{
|
||||||
|
"flag": "success",
|
||||||
|
"code": 200,
|
||||||
|
"message": "获取成功{\"device\":\"workerstation\",\"project\":\"warehouse\"}",
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"id": 3,
|
||||||
|
"status": 1,
|
||||||
|
"employees": [
|
||||||
|
{
|
||||||
|
"id": 34,
|
||||||
|
"store_id": 1000028,
|
||||||
|
"store_name": "天豹云仓",
|
||||||
|
"is_primary": 1,
|
||||||
|
"real_name": "殷建铭",
|
||||||
|
"auth_end": "2099-12-26",
|
||||||
|
"role_type": "warehouse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 31,
|
||||||
|
"store_id": 100000,
|
||||||
|
"store_name": "测试仓",
|
||||||
|
"is_primary": 0,
|
||||||
|
"real_name": "殷建铭",
|
||||||
|
"auth_end": "2099-11-08",
|
||||||
|
"role_type": "warehouse"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"auth_end": "2099-12-26",
|
||||||
|
"employees_id": 34,
|
||||||
|
"employees_name": "殷建铭",
|
||||||
|
"loginIp": "58.63.152.206",
|
||||||
|
"store_id": 1000028,
|
||||||
|
"store_name": "天豹云仓",
|
||||||
|
"store_type": "warehouse",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"path": "/order",
|
||||||
|
"component": "",
|
||||||
|
"name": "Workorder",
|
||||||
|
"redirect": "",
|
||||||
|
"meta": {
|
||||||
|
"title": "订单复核1",
|
||||||
|
"icon": ""
|
||||||
|
},
|
||||||
|
"hidden": false,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/catchWeight",
|
||||||
|
"component": "",
|
||||||
|
"name": "CatchWeight",
|
||||||
|
"redirect": null,
|
||||||
|
"meta": {
|
||||||
|
"title": "称重",
|
||||||
|
"icon": ""
|
||||||
|
},
|
||||||
|
"hidden": false,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/returns",
|
||||||
|
"component": "",
|
||||||
|
"name": "Returns",
|
||||||
|
"redirect": null,
|
||||||
|
"meta": {
|
||||||
|
"title": "退件",
|
||||||
|
"icon": ""
|
||||||
|
},
|
||||||
|
"hidden": false,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"children": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
"dashboard.hotOrderRank",
|
||||||
|
"dashboard.orderTrend",
|
||||||
|
"dashboard.platformDist",
|
||||||
|
"dashboard.expressRatio",
|
||||||
|
"dashboard.storeBaseData",
|
||||||
|
"dashboard.auth",
|
||||||
|
"store.getStoreRoles",
|
||||||
|
"store.auditApply",
|
||||||
|
"warehouse.getWarehouseZones",
|
||||||
|
"warehouse.create",
|
||||||
|
"warehouse.getWarehouseTree",
|
||||||
|
"warehouse.detail",
|
||||||
|
"warehouse.update",
|
||||||
|
"warehouse.delete",
|
||||||
|
"warehouse.updateSpaceInfo",
|
||||||
|
"stock.saveWarehouseStock",
|
||||||
|
"stock.saveWarehouseStockBarcode",
|
||||||
|
"stock.bindItem",
|
||||||
|
"stock.unbindItem",
|
||||||
|
"index.ReferenceFile",
|
||||||
|
"warehouseExport",
|
||||||
|
"warehouseRecycle",
|
||||||
|
"stock.createWarehouseStock",
|
||||||
|
"stock.handleBatchDelete",
|
||||||
|
"stock.handleBatchChange",
|
||||||
|
"storage.receiving.create",
|
||||||
|
"storage.receiving.getReceivingDetail",
|
||||||
|
"storage.receiving.batchCancelReceiving",
|
||||||
|
"index.getCOSUploadConfig",
|
||||||
|
"index.getExpressList",
|
||||||
|
"index.tryAutoTranslateNewKeys",
|
||||||
|
"index.uploadSuccessNotify",
|
||||||
|
"order.getOrderModels",
|
||||||
|
"stock.warehouse.bindItem",
|
||||||
|
"stock.warehouse.createProhibited",
|
||||||
|
"stock.warehouse.createUnit",
|
||||||
|
"stock.warehouse.createWarehouseStock",
|
||||||
|
"stock.warehouse.deleteProhibited",
|
||||||
|
"stock.warehouse.deleteUnit",
|
||||||
|
"stock.warehouse.handleBatchChange",
|
||||||
|
"stock.warehouse.handleBatchDelete",
|
||||||
|
"stock.warehouse.saveWarehouseStock",
|
||||||
|
"stock.warehouse.saveWarehouseStockBarcode",
|
||||||
|
"stock.warehouse.unbindItem",
|
||||||
|
"storage.receiving.addItem",
|
||||||
|
"storage.receiving.removeItem",
|
||||||
|
"storage.receiving.saveReceiving",
|
||||||
|
"warehouse.createRack",
|
||||||
|
"warehouse.createRackWithSpaces",
|
||||||
|
"warehouse.recalculatePickPath",
|
||||||
|
"warehouse.updateNeighbors",
|
||||||
|
"warehouse.updateRackPosition",
|
||||||
|
"stock.getInfo",
|
||||||
|
"printer.bind",
|
||||||
|
"setting.permission.add",
|
||||||
|
"setting.permission.delete",
|
||||||
|
"setting.permission.update",
|
||||||
|
"order.base.getOrderModels",
|
||||||
|
"warehouse.getAreaRacks",
|
||||||
|
"storeWarehouse.store.adjustPrintQuantity",
|
||||||
|
"storage.inventory.quickPutaway",
|
||||||
|
"storage.inventory.transferLocation",
|
||||||
|
"storage.inventory.transferByProduct",
|
||||||
|
"order.reviewOrder.detail",
|
||||||
|
"order.pendingOrder.detail",
|
||||||
|
"order.outboundOrder.detail",
|
||||||
|
"order.expectionOrder.detail",
|
||||||
|
"order.entrustOrder.detail",
|
||||||
|
"order.deliveryOrder.detail",
|
||||||
|
"order.deliveryExpectionOrder.detail",
|
||||||
|
"order.archiveOrder.detail",
|
||||||
|
"warehouse.batchUpdateSpaceInfo",
|
||||||
|
"warehouse.exportRackSpaces",
|
||||||
|
"warehouse.getChildren",
|
||||||
|
"warehouse.toggleActive",
|
||||||
|
"warehouse.getPath",
|
||||||
|
"warehouse.getPickPath",
|
||||||
|
"storage.receiving.save",
|
||||||
|
"order.wave.waveStrategyUpdate",
|
||||||
|
"order.wave.waveStrategyCreate",
|
||||||
|
"\r\norder.wave.wavePickTaskCancel",
|
||||||
|
"\r\nstock.warehouse.import",
|
||||||
|
"storeWarehouse.store.queryPrintQuantityLogs"
|
||||||
|
],
|
||||||
|
"userRole": "customer",
|
||||||
|
"platform_code": "workerstation",
|
||||||
|
"avatar": ""
|
||||||
|
},
|
||||||
|
"timestamp": 1779333004
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
"name": "uni-preset-vue",
|
"name": "uni-preset-vue",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"dev": "uni",
|
||||||
"dev:custom": "uni -p",
|
"dev:custom": "uni -p",
|
||||||
"dev:h5": "uni",
|
"dev:h5": "uni",
|
||||||
"dev:h5:electron": "uni --mode electron",
|
"dev:h5:electron": "uni --mode electron",
|
||||||
|
|||||||
52
src/api/index.ts
Normal file
52
src/api/index.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { request, type ApiBody, type RequestOptions } from './request'
|
||||||
|
|
||||||
|
export { request, type ApiBody, type RequestOptions } from './request'
|
||||||
|
// export * from './order'
|
||||||
|
|
||||||
|
const workerPayload = {
|
||||||
|
device: 'workerstation',
|
||||||
|
project: 'warehouse',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 微信扫码登录:获取客户端码 / 二维码信息 */
|
||||||
|
export function getLoginWechatCode(
|
||||||
|
data: Record<string, unknown> = {},
|
||||||
|
options?: RequestOptions
|
||||||
|
) {
|
||||||
|
return request<ApiBody>('user.getLoginWechatCode', data, {
|
||||||
|
skipAuth: true,
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 工牌 / 条码码登录 */
|
||||||
|
export function loginByCode(code: string) {
|
||||||
|
return request<ApiBody>('user.loginByCode', { code }, { skipAuth: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 账号密码登录 */
|
||||||
|
export function loginByAccount(username: string, password: string) {
|
||||||
|
return request<ApiBody>(
|
||||||
|
'user.login',
|
||||||
|
{ username, password },
|
||||||
|
{ skipAuth: true }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 当前登录用户信息 */
|
||||||
|
export function fetchUserInfo() {
|
||||||
|
return request<ApiBody>('user.info', { ...workerPayload })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 切换角色 / 门店身份 */
|
||||||
|
export function changeUserRole(roleId: string | number) {
|
||||||
|
return request<ApiBody>('user.changeRole', {
|
||||||
|
roleId,
|
||||||
|
...workerPayload,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 退出登录 */
|
||||||
|
export function logout() {
|
||||||
|
return request<ApiBody>('user.logout', {})
|
||||||
|
}
|
||||||
31
src/api/order.ts
Normal file
31
src/api/order.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { request, type ApiBody, type RequestOptions } from './request'
|
||||||
|
|
||||||
|
const workerPayload = {
|
||||||
|
device: 'workerstation',
|
||||||
|
project: 'warehouse',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单相关接口集中在此文件,按页面/功能拆分方法。
|
||||||
|
* method 名请与后端约定一致后修改下列字符串。
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** 复核台等:订单关键词搜索(method 占位,对接后端时改名) */
|
||||||
|
export function searchOrdersForReview(
|
||||||
|
params: { keyword?: string } = {},
|
||||||
|
options?: RequestOptions
|
||||||
|
) {
|
||||||
|
return request<ApiBody>(
|
||||||
|
'order.review.search',
|
||||||
|
{
|
||||||
|
...workerPayload,
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
options
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 当前波次待处理订单列表(method 占位) */
|
||||||
|
export function fetchCurrentWavePendingOrders(options?: RequestOptions) {
|
||||||
|
return request<ApiBody>('order.review.currentWave', { ...workerPayload }, options)
|
||||||
|
}
|
||||||
87
src/api/request.ts
Normal file
87
src/api/request.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { API_URL } from '@/config/api'
|
||||||
|
|
||||||
|
/** 与后端约定的通用响应结构(字段名因接口可能略有差异) */
|
||||||
|
export type ApiBody<T = unknown> = {
|
||||||
|
code?: number
|
||||||
|
success?: boolean
|
||||||
|
status?: number
|
||||||
|
msg?: string
|
||||||
|
message?: string
|
||||||
|
data?: T
|
||||||
|
result?: T
|
||||||
|
token?: string
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RequestOptions = {
|
||||||
|
/** 传给 uni.request */
|
||||||
|
timeout?: number
|
||||||
|
/** 不携带本地 token(登录、取码等未鉴权接口) */
|
||||||
|
skipAuth?: boolean
|
||||||
|
/** 额外或覆盖请求头 */
|
||||||
|
header?: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_HEADERS: Record<string, string> = {
|
||||||
|
accept: 'application/json, text/plain, */*',
|
||||||
|
'content-type': 'application/json',
|
||||||
|
platform: 'workerstation',
|
||||||
|
project: 'warehouse',
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAuthHeader(): Record<string, string> {
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
if (!token) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
token: String(token),
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildRequestUrl(method: string): string {
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
method,
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: String(Date.now()),
|
||||||
|
})
|
||||||
|
return `${API_URL}?${params.toString()}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一走 `/system?method=xxx` 的 POST 请求
|
||||||
|
*/
|
||||||
|
export function request<T = ApiBody>(
|
||||||
|
method: string,
|
||||||
|
data?: Record<string, unknown>,
|
||||||
|
options?: RequestOptions
|
||||||
|
): Promise<T> {
|
||||||
|
const url = buildRequestUrl(method)
|
||||||
|
const authHeader = options?.skipAuth ? {} : getAuthHeader()
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const requestOptions: UniApp.RequestOptions = {
|
||||||
|
url,
|
||||||
|
method: 'POST',
|
||||||
|
header: {
|
||||||
|
...DEFAULT_HEADERS,
|
||||||
|
...authHeader,
|
||||||
|
...options?.header,
|
||||||
|
},
|
||||||
|
data: data ?? {},
|
||||||
|
success: (res) => {
|
||||||
|
resolve(res.data as T)
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
reject(err)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options?.timeout != null) {
|
||||||
|
requestOptions.timeout = options.timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.request(requestOptions)
|
||||||
|
})
|
||||||
|
}
|
||||||
3
src/config/api.ts
Normal file
3
src/config/api.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { API_URL, BASE_URL, IMG_URL } from '../../env.js'
|
||||||
|
|
||||||
|
export { BASE_URL, API_URL, IMG_URL }
|
||||||
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page" @click="closeMinePopup">
|
<view class="layout-page" @click="closeMinePopup">
|
||||||
<view class="top-nav" @click.stop>
|
<view class="top-nav" @click.stop>
|
||||||
<image class="top-nav-logo" src="http://192.168.11.56:5174/public/logo/1.png" mode="heightFix"></image>
|
<image class="top-nav-logo" src="http://192.168.11.56:5174/public/logo/1.png" mode="heightFix"></image>
|
||||||
<view class="top-nav-menu-wrap" v-if="getTopMenus().length">
|
<view class="top-nav-menu-wrap" v-if="topMenus.length">
|
||||||
<view
|
<view
|
||||||
v-for="menu in getTopMenus()"
|
v-for="menu in topMenus"
|
||||||
:key="menu.path || menu.name"
|
:key="menu.path || menu.name"
|
||||||
:class="['top-nav-menu-item', isMenuActive(menu) ? 'top-nav-menu-item--active' : '']"
|
:class="['top-nav-menu-item', isMenuActive(menu) ? 'top-nav-menu-item--active' : '']"
|
||||||
@click="handleMenuClick(menu)"
|
@click="handleMenuClick(menu)"
|
||||||
@ -37,23 +37,26 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="content-wrap">
|
<view class="layout-main">
|
||||||
<order-review-one v-if="activeMenuPath === '/order'" compact-top />
|
<component
|
||||||
|
v-if="activeViewComponent"
|
||||||
|
:is="activeViewComponent"
|
||||||
|
:key="activeMenuPath"
|
||||||
|
compact-top
|
||||||
|
/>
|
||||||
<view v-else class="module-placeholder">
|
<view v-else class="module-placeholder">
|
||||||
<text class="module-placeholder-title">{{ getActiveMenuTitle() || '请选择功能菜单' }}</text>
|
<text class="module-placeholder-title">{{ getActiveMenuTitle() || '请选择功能菜单' }}</text>
|
||||||
|
<text v-if="activeMenuPath" class="module-placeholder-desc">该菜单页面尚未配置({{ activeMenuPath }})</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OrderReviewOne from '@/components/order-review-one/index.vue'
|
import { changeUserRole, fetchUserInfo, logout } from '@/api/index'
|
||||||
|
import { hasMenuView, normalizeMenuPath, resolveMenuView } from '@/router/menuRoutes'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
|
||||||
OrderReviewOne,
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
if (!token) {
|
if (!token) {
|
||||||
@ -63,9 +66,8 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activeMenuPath = this.normalizeRawPath(options?.menu)
|
this.activeMenuPath = normalizeMenuPath(options?.menu)
|
||||||
|
this.loadCurrentUserInfo()
|
||||||
this.loadCurrentUserInfo(token)
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -74,64 +76,74 @@ export default {
|
|||||||
activeMenuPath: '',
|
activeMenuPath: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
computed: {
|
||||||
getTopMenus() {
|
topMenus() {
|
||||||
const menus = this.currentUser?.menus
|
const menus = this.currentUser?.menus
|
||||||
if (!Array.isArray(menus)) {
|
if (!Array.isArray(menus)) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
return menus.filter((menu) => !menu?.hidden)
|
return menus.filter((menu) => !menu?.hidden)
|
||||||
},
|
},
|
||||||
|
activeViewComponent() {
|
||||||
|
return resolveMenuView(this.activeMenuPath)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
getMenuTitle(menu) {
|
getMenuTitle(menu) {
|
||||||
return menu?.meta?.title || menu?.name || '未命名菜单'
|
return menu?.meta?.title || menu?.name || '未命名菜单'
|
||||||
},
|
},
|
||||||
normalizeMenuPath(menu) {
|
|
||||||
const rawPath = (menu?.path || '').trim()
|
|
||||||
if (!rawPath) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
return rawPath.startsWith('/') ? rawPath : `/${rawPath}`
|
|
||||||
},
|
|
||||||
normalizeRawPath(rawPath) {
|
|
||||||
const raw = String(rawPath || '').trim()
|
|
||||||
if (!raw) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
return raw.startsWith('/') ? raw : `/${raw}`
|
|
||||||
},
|
|
||||||
isMenuActive(menu) {
|
isMenuActive(menu) {
|
||||||
const path = this.normalizeMenuPath(menu)
|
const path = normalizeMenuPath(menu?.path)
|
||||||
return !!path && this.activeMenuPath === path
|
return !!path && this.activeMenuPath === path
|
||||||
},
|
},
|
||||||
getActiveMenuTitle() {
|
getActiveMenu() {
|
||||||
const activeMenu = this.getTopMenus().find((menu) => this.normalizeMenuPath(menu) === this.activeMenuPath)
|
return this.topMenus.find((menu) => normalizeMenuPath(menu?.path) === this.activeMenuPath)
|
||||||
return this.getMenuTitle(activeMenu)
|
|
||||||
},
|
},
|
||||||
updateUrlByActiveMenu(menuPath) {
|
getActiveMenuTitle() {
|
||||||
const normalizedPath = this.normalizeRawPath(menuPath)
|
return this.getMenuTitle(this.getActiveMenu())
|
||||||
const pages = getCurrentPages()
|
},
|
||||||
const currentPage = pages[pages.length - 1]
|
syncMenuToUrl(menuPath) {
|
||||||
const currentMenu = this.normalizeRawPath(currentPage?.options?.menu)
|
const normalizedPath = normalizeMenuPath(menuPath)
|
||||||
|
|
||||||
if (currentPage?.route !== 'pages/index/index' || currentMenu !== normalizedPath) {
|
// #ifdef H5
|
||||||
|
if (typeof window !== 'undefined' && window.history?.replaceState) {
|
||||||
const query = normalizedPath ? `?menu=${encodeURIComponent(normalizedPath)}` : ''
|
const query = normalizedPath ? `?menu=${encodeURIComponent(normalizedPath)}` : ''
|
||||||
uni.redirectTo({
|
const base = window.location.pathname || '/'
|
||||||
url: `/pages/index/index${query}`,
|
window.history.replaceState(null, '', `${base}${query}`)
|
||||||
fail: () => {
|
}
|
||||||
uni.showToast({
|
// #endif
|
||||||
title: '页面切换失败',
|
},
|
||||||
icon: 'none',
|
setActiveMenu(menuPath, options = {}) {
|
||||||
})
|
const { syncUrl = true } = options
|
||||||
},
|
const normalizedPath = normalizeMenuPath(menuPath)
|
||||||
})
|
if (!normalizedPath) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeMenuPath = normalizedPath
|
||||||
|
if (syncUrl) {
|
||||||
|
this.syncMenuToUrl(normalizedPath)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ensureActiveMenuValid() {
|
||||||
|
const menus = this.topMenus
|
||||||
|
if (!menus.length) {
|
||||||
|
this.activeMenuPath = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const matched = menus.find((menu) => normalizeMenuPath(menu?.path) === this.activeMenuPath)
|
||||||
|
if (matched) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstPath = normalizeMenuPath(menus[0]?.path)
|
||||||
|
if (firstPath) {
|
||||||
|
this.setActiveMenu(firstPath)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleMenuClick(menu) {
|
handleMenuClick(menu) {
|
||||||
const rawPath = (menu?.path || '').trim()
|
const rawPath = (menu?.path || '').trim()
|
||||||
|
|
||||||
if (!rawPath) {
|
if (!rawPath) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '菜单路径为空',
|
title: '菜单路径为空',
|
||||||
@ -140,20 +152,21 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizedPath = this.normalizeMenuPath(menu)
|
const normalizedPath = normalizeMenuPath(rawPath)
|
||||||
if (!normalizedPath) {
|
this.setActiveMenu(normalizedPath)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.activeMenuPath = normalizedPath
|
if (!hasMenuView(normalizedPath)) {
|
||||||
this.updateUrlByActiveMenu(normalizedPath)
|
uni.showToast({
|
||||||
|
title: '该功能页面暂未开放',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getTopNavRealName() {
|
getTopNavRealName() {
|
||||||
const employees = this.currentUser?.employees || []
|
const employees = this.currentUser?.employees || []
|
||||||
if (employees.length && employees[0]?.real_name) {
|
if (employees.length && employees[0]?.real_name) {
|
||||||
return employees[0].real_name
|
return employees[0].real_name
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.currentUser?.real_name || '未命名用户'
|
return this.currentUser?.real_name || '未命名用户'
|
||||||
},
|
},
|
||||||
isCurrentRole(employee) {
|
isCurrentRole(employee) {
|
||||||
@ -162,31 +175,13 @@ export default {
|
|||||||
handleChangeRole(employee) {
|
handleChangeRole(employee) {
|
||||||
const employeeId = employee?.id
|
const employeeId = employee?.id
|
||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
|
|
||||||
if (!employeeId || !token) {
|
if (!employeeId || !token) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.request({
|
changeUserRole(employeeId)
|
||||||
url: `http://192.168.11.56:6060/system?method=user.changeRole&v=1.0×tamp=${Date.now()}`,
|
.then((body) => {
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
'content-type': 'application/json',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
token,
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
roleId: employeeId,
|
|
||||||
device: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const body = res?.data || {}
|
|
||||||
const isSuccess = body?.code === 0 || body?.success === true || body?.status === 1
|
const isSuccess = body?.code === 0 || body?.success === true || body?.status === 1
|
||||||
|
|
||||||
if (!isSuccess && (body?.msg || body?.message)) {
|
if (!isSuccess && (body?.msg || body?.message)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: body?.msg || body?.message,
|
title: body?.msg || body?.message,
|
||||||
@ -195,19 +190,18 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadCurrentUserInfo(token)
|
this.loadCurrentUserInfo()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '角色切换成功',
|
title: '角色切换成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
fail: () => {
|
.catch(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '角色切换失败',
|
title: '角色切换失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
openMinePopup() {
|
openMinePopup() {
|
||||||
this.showMinePopup = true
|
this.showMinePopup = true
|
||||||
@ -215,34 +209,22 @@ export default {
|
|||||||
closeMinePopup() {
|
closeMinePopup() {
|
||||||
this.showMinePopup = false
|
this.showMinePopup = false
|
||||||
},
|
},
|
||||||
loadCurrentUserInfo(token) {
|
loadCurrentUserInfo() {
|
||||||
uni.request({
|
fetchUserInfo()
|
||||||
url: `http://192.168.11.56:6060/system?method=user.info&v=1.0×tamp=${Date.now()}`,
|
.then((body) => {
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
token,
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
device: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const body = res?.data || {}
|
|
||||||
this.currentUser = body?.data || body?.result || body || null
|
this.currentUser = body?.data || body?.result || body || null
|
||||||
|
this.ensureActiveMenuValid()
|
||||||
|
|
||||||
if (!this.activeMenuPath) {
|
if (!this.activeMenuPath && this.topMenus.length) {
|
||||||
const firstMenuPath = this.normalizeMenuPath(this.getTopMenus()[0])
|
const firstPath = normalizeMenuPath(this.topMenus[0]?.path)
|
||||||
this.activeMenuPath = firstMenuPath
|
if (firstPath) {
|
||||||
if (firstMenuPath) {
|
this.setActiveMenu(firstPath)
|
||||||
this.updateUrlByActiveMenu(firstMenuPath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
})
|
.catch(() => {
|
||||||
|
/* 静默失败,避免打断主导航 */
|
||||||
|
})
|
||||||
},
|
},
|
||||||
finishLogout() {
|
finishLogout() {
|
||||||
uni.removeStorageSync('token')
|
uni.removeStorageSync('token')
|
||||||
@ -258,26 +240,13 @@ export default {
|
|||||||
},
|
},
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
this.finishLogout()
|
this.finishLogout()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.request({
|
logout().finally(() => {
|
||||||
url: `http://192.168.11.56:6060/system?method=user.logout&v=1.0×tamp=${Date.now()}`,
|
this.finishLogout()
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
token,
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
data: {},
|
|
||||||
complete: () => {
|
|
||||||
this.finishLogout()
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -285,7 +254,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.page {
|
.layout-page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
min-width: 960px;
|
min-width: 960px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -294,11 +263,12 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
align-self: stretch;
|
flex-shrink: 0;
|
||||||
margin: 0 0 24rpx;
|
margin: 0 0 24rpx;
|
||||||
padding: 18rpx 28rpx;
|
padding: 18rpx 28rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -328,6 +298,7 @@ export default {
|
|||||||
|
|
||||||
.top-nav-menu-item {
|
.top-nav-menu-item {
|
||||||
padding: 10rpx 18rpx;
|
padding: 10rpx 18rpx;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav-menu-item--active {
|
.top-nav-menu-item--active {
|
||||||
@ -344,6 +315,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10rpx;
|
gap: 10rpx;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav-mine-icon {
|
.top-nav-mine-icon {
|
||||||
@ -376,12 +348,6 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav-mine-icon,
|
|
||||||
.top-nav-mine-icon-head,
|
|
||||||
.top-nav-mine-icon-body {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav-mine-name {
|
.top-nav-mine-name {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@ -454,64 +420,11 @@ export default {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrap {
|
.layout-main {
|
||||||
padding: 0 28rpx 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-module {
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
padding: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-search-bar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12rpx;
|
|
||||||
margin-bottom: 18rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-search-input {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 72rpx;
|
min-height: 0;
|
||||||
border: 1rpx solid #e5e5e5;
|
padding: 0 28rpx 24rpx;
|
||||||
border-radius: 10rpx;
|
box-sizing: border-box;
|
||||||
padding: 0 18rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-search-btn {
|
|
||||||
width: 150rpx;
|
|
||||||
height: 72rpx;
|
|
||||||
line-height: 72rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-result-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-item {
|
|
||||||
background-color: #fafbfe;
|
|
||||||
border: 1rpx solid #edf0f5;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
padding: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-item-text {
|
|
||||||
display: block;
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-empty {
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: 26rpx;
|
|
||||||
padding: 20rpx 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-placeholder {
|
.module-placeholder {
|
||||||
@ -526,10 +439,16 @@ export default {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.module-placeholder-desc {
|
||||||
|
display: block;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
.page {
|
.layout-page {
|
||||||
min-width: 760px;
|
min-width: 760px;
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
@ -567,7 +486,7 @@ export default {
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrap {
|
.layout-main {
|
||||||
padding: 0 20rpx 18rpx;
|
padding: 0 20rpx 18rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,6 +79,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getLoginWechatCode, loginByCode, loginByAccount } from '@/api/index'
|
||||||
|
|
||||||
const qrBaseUrl = 'https://ye4s.wms.gztbyc.com/grcode/build?text='
|
const qrBaseUrl = 'https://ye4s.wms.gztbyc.com/grcode/build?text='
|
||||||
const qrFallbackBaseUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data='
|
const qrFallbackBaseUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data='
|
||||||
const loginLinkTemplate = 'https://ye4s.wms.gztbyc.com/mini/?spm=0.4.${code}.1.4'
|
const loginLinkTemplate = 'https://ye4s.wms.gztbyc.com/mini/?spm=0.4.${code}.1.4'
|
||||||
@ -284,22 +286,10 @@ export default {
|
|||||||
this.scanStatus = '正在获取二维码...'
|
this.scanStatus = '正在获取二维码...'
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = [`method=user.getLoginWechatCode`, `v=1.0`, `timestamp=${Date.now()}`]
|
|
||||||
const requestData = this.scanClientCode ? { clientCode: this.scanClientCode } : {}
|
const requestData = this.scanClientCode ? { clientCode: this.scanClientCode } : {}
|
||||||
|
|
||||||
uni.request({
|
getLoginWechatCode(requestData, { timeout: this.scanRequestTimeout })
|
||||||
url: `http://192.168.11.56:6060/system?${query.join('&')}`,
|
.then((body) => {
|
||||||
method: 'POST',
|
|
||||||
timeout: this.scanRequestTimeout,
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
'content-type': 'application/json',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
},
|
|
||||||
data: requestData,
|
|
||||||
success: (res) => {
|
|
||||||
const body = res?.data || {}
|
|
||||||
const payload = body?.data || body?.result || body
|
const payload = body?.data || body?.result || body
|
||||||
|
|
||||||
const clientCode =
|
const clientCode =
|
||||||
@ -327,8 +317,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.scanStatus = body?.message || body?.msg || '二维码获取失败'
|
this.scanStatus = body?.message || body?.msg || '二维码获取失败'
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
fail: (err) => {
|
.catch((err) => {
|
||||||
const errMsg = err?.errMsg || ''
|
const errMsg = err?.errMsg || ''
|
||||||
if (errMsg.includes('timeout') || errMsg.includes('abort') || errMsg.includes('cancel')) {
|
if (errMsg.includes('timeout') || errMsg.includes('abort') || errMsg.includes('cancel')) {
|
||||||
this.scanStatus = '请求超时,正在继续轮询...'
|
this.scanStatus = '请求超时,正在继续轮询...'
|
||||||
@ -336,14 +326,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.scanStatus = '网络异常,请稍后重试'
|
this.scanStatus = '网络异常,请稍后重试'
|
||||||
},
|
})
|
||||||
complete: () => {
|
.finally(() => {
|
||||||
this.scanLoading = false
|
this.scanLoading = false
|
||||||
if (this.loginMode === 'scan' && this.scanClientCode) {
|
if (this.loginMode === 'scan' && this.scanClientCode) {
|
||||||
this.startScanLongPolling()
|
this.startScanLongPolling()
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handleScanBadgeLogin(codeParam = '') {
|
handleScanBadgeLogin(codeParam = '') {
|
||||||
const code = (codeParam || '').trim()
|
const code = (codeParam || '').trim()
|
||||||
@ -363,20 +352,8 @@ export default {
|
|||||||
this.scanBadgeLastSubmittedCode = code
|
this.scanBadgeLastSubmittedCode = code
|
||||||
this.scanBadgeLastSubmittedAt = now
|
this.scanBadgeLastSubmittedAt = now
|
||||||
|
|
||||||
uni.request({
|
loginByCode(code)
|
||||||
url: `http://192.168.11.56:6060/system?method=user.loginByCode&v=1.0×tamp=${Date.now()}`,
|
.then((body) => {
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
'content-type': 'application/json',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
code,
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const body = res?.data || {}
|
|
||||||
const token = body?.token || body?.data?.token || body?.result?.token
|
const token = body?.token || body?.data?.token || body?.result?.token
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
@ -398,18 +375,17 @@ export default {
|
|||||||
title: body?.msg || body?.message || '工牌登录失败',
|
title: body?.msg || body?.message || '工牌登录失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
fail: () => {
|
.catch(() => {
|
||||||
this.focusScanInput()
|
this.focusScanInput()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '网络异常,请稍后重试',
|
title: '网络异常,请稍后重试',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
complete: () => {
|
.finally(() => {
|
||||||
this.scanBadgeSubmitting = false
|
this.scanBadgeSubmitting = false
|
||||||
},
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handleAccountLogin() {
|
handleAccountLogin() {
|
||||||
if (!this.form.username || !this.form.password) {
|
if (!this.form.username || !this.form.password) {
|
||||||
@ -420,20 +396,8 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.request({
|
loginByAccount(this.form.username, this.form.password)
|
||||||
url: `http://192.168.11.56:6060/system?method=user.login&v=1.0×tamp=${Date.now()}`,
|
.then((body) => {
|
||||||
method: 'POST',
|
|
||||||
header: {
|
|
||||||
accept: 'application/json, text/plain, */*',
|
|
||||||
platform: 'workerstation',
|
|
||||||
project: 'warehouse'
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
username: this.form.username,
|
|
||||||
password: this.form.password,
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const body = res?.data || {}
|
|
||||||
const token = body?.token || body?.data?.token || body?.result?.token
|
const token = body?.token || body?.data?.token || body?.result?.token
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
@ -454,14 +418,13 @@ export default {
|
|||||||
title: body?.msg || body?.message || '登录失败',
|
title: body?.msg || body?.message || '登录失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
fail: () => {
|
.catch(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '网络异常,请稍后重试',
|
title: '网络异常,请稍后重试',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OrderReviewOne from '@/components/order-review-one/index.vue'
|
import OrderReviewOne from '@/components/order-review-one/index.vue'
|
||||||
|
/**
|
||||||
|
* 订单相关 HTTP 请使用 `@/api/order`(如 searchOrdersForReview、fetchCurrentWavePendingOrders),
|
||||||
|
* 将 method 与入参与后端对齐后再在组件中调用。
|
||||||
|
*/
|
||||||
export default {
|
export default {
|
||||||
name: 'OrderReviewOnePage',
|
name: 'OrderReviewOnePage',
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
36
src/router/menuRoutes.js
Normal file
36
src/router/menuRoutes.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import OrderView from '@/views/order/index.vue'
|
||||||
|
import CatchWeightView from '@/views/catch-weight/index.vue'
|
||||||
|
import ReturnsView from '@/views/returns/index.vue'
|
||||||
|
|
||||||
|
/** 将 user.info 中 menus[].path 规范为以 / 开头的路径 */
|
||||||
|
export function normalizeMenuPath(path) {
|
||||||
|
const raw = String(path || '').trim()
|
||||||
|
if (!raw) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return raw.startsWith('/') ? raw : `/${raw}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端动态菜单 path -> 本地页面组件
|
||||||
|
* 新增菜单时在此注册对应 views 组件
|
||||||
|
*/
|
||||||
|
const menuRouteMap = {
|
||||||
|
'/order': OrderView,
|
||||||
|
'/catchWeight': CatchWeightView,
|
||||||
|
'/returns': ReturnsView,
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据菜单 path 解析要渲染的页面组件 */
|
||||||
|
export function resolveMenuView(path) {
|
||||||
|
const normalized = normalizeMenuPath(path)
|
||||||
|
if (!normalized) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return menuRouteMap[normalized] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 是否已在本地注册该动态路由页面 */
|
||||||
|
export function hasMenuView(path) {
|
||||||
|
return !!resolveMenuView(path)
|
||||||
|
}
|
||||||
16
src/shime-uni.d.ts
vendored
16
src/shime-uni.d.ts
vendored
@ -1,6 +1,14 @@
|
|||||||
export {};
|
/// <reference types="@dcloudio/types" />
|
||||||
|
|
||||||
declare module "vue" {
|
export {}
|
||||||
type Hooks = App.AppInstance & Page.PageInstance;
|
|
||||||
|
declare module 'vue' {
|
||||||
|
type Hooks = App.AppInstance & Page.PageInstance
|
||||||
interface ComponentCustomOptions extends Hooks {}
|
interface ComponentCustomOptions extends Hooks {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module '../../env.js' {
|
||||||
|
export const BASE_URL: string
|
||||||
|
export const API_URL: string
|
||||||
|
export const IMG_URL: string
|
||||||
|
}
|
||||||
|
|||||||
48
src/views/catch-weight/index.vue
Normal file
48
src/views/catch-weight/index.vue
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<view class="dynamic-view dynamic-view--catch-weight">
|
||||||
|
<view class="module-card">
|
||||||
|
<text class="module-card-title">称重</text>
|
||||||
|
<text class="module-card-desc">称重模块页面(待对接业务接口)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'CatchWeightMenuView',
|
||||||
|
props: {
|
||||||
|
compactTop: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dynamic-view--catch-weight {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card-desc {
|
||||||
|
display: block;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #888;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
28
src/views/order/index.vue
Normal file
28
src/views/order/index.vue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<view class="dynamic-view dynamic-view--order">
|
||||||
|
<order-review-one :compact-top="compactTop" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import OrderReviewOne from '@/components/order-review-one/index.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'OrderMenuView',
|
||||||
|
components: {
|
||||||
|
OrderReviewOne,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
compactTop: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dynamic-view--order {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
48
src/views/returns/index.vue
Normal file
48
src/views/returns/index.vue
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<view class="dynamic-view dynamic-view--returns">
|
||||||
|
<view class="module-card">
|
||||||
|
<text class="module-card-title">退件</text>
|
||||||
|
<text class="module-card-desc">退件模块页面(待对接业务接口)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'ReturnsMenuView',
|
||||||
|
props: {
|
||||||
|
compactTop: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dynamic-view--returns {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-card-desc {
|
||||||
|
display: block;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #888;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
19
tsconfig.json
Normal file
19
tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": false,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"types": ["@dcloudio/types"],
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "env.js"]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user