功能:完善 YumiNail 全栈修复与打包
This commit is contained in:
@@ -3,6 +3,7 @@ import { message } from 'ant-design-vue'
|
||||
import { ADMIN_API_BASE_URL } from '../config/api'
|
||||
import type { IdType } from '@/utils/id'
|
||||
import { clearAdminSessionStorage } from '@/utils/admin-session'
|
||||
import { attachRequestSignature } from '@/utils/request-signature'
|
||||
|
||||
let lastErrorTime = 0
|
||||
let lastErrorMessage = ''
|
||||
@@ -43,7 +44,7 @@ const showError = (msg: string) => {
|
||||
}
|
||||
|
||||
const isAuthFreePath = (url?: string) => {
|
||||
return Boolean(url?.includes('/auth/login') || url?.includes('/auth/refresh'))
|
||||
return Boolean(url?.includes('/auth/login') || url?.includes('/auth/login-shops/') || url?.includes('/auth/refresh'))
|
||||
}
|
||||
|
||||
const handleAdminTokenExpired = () => {
|
||||
@@ -59,9 +60,10 @@ const handleAdminTokenExpired = () => {
|
||||
}
|
||||
|
||||
adminApi.interceptors.request.use(
|
||||
config => {
|
||||
async config => {
|
||||
let token: string | null = null
|
||||
if (!isAuthFreePath(config.url)) {
|
||||
let token = localStorage.getItem('adminAccessToken')
|
||||
token = localStorage.getItem('adminAccessToken')
|
||||
if (!token) {
|
||||
token = sessionStorage.getItem('adminAccessToken')
|
||||
}
|
||||
@@ -69,7 +71,9 @@ adminApi.interceptors.request.use(
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
return config
|
||||
return attachRequestSignature(config, token, {
|
||||
authFree: isAuthFreePath(config.url)
|
||||
})
|
||||
},
|
||||
error => Promise.reject(error)
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ import { message } from 'ant-design-vue'
|
||||
import { API_BASE_URL } from '../config/api'
|
||||
import type { IdType } from '@/utils/id'
|
||||
import { clearAdminSessionStorage } from '@/utils/admin-session'
|
||||
import { attachRequestSignature } from '@/utils/request-signature'
|
||||
|
||||
// 防重复提示标志
|
||||
let lastErrorTime = 0
|
||||
@@ -47,6 +48,29 @@ const showError = (msg: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isAuthFreePath = (url?: string) => {
|
||||
return [
|
||||
'/user/login',
|
||||
'/user/register',
|
||||
'/user/check/',
|
||||
'/user/refresh-token',
|
||||
'/user/send-verification-code',
|
||||
'/user/phone-login',
|
||||
'/user/wechat-mini/',
|
||||
'/user/reset-password-by-phone',
|
||||
'/product/get/',
|
||||
'/product/list/',
|
||||
'/shop/get/',
|
||||
'/shop/list/public',
|
||||
'/shop/list/simple',
|
||||
'/tag/list/all',
|
||||
'/file/get-signed-url/',
|
||||
'/admin/auth/login',
|
||||
'/admin/auth/login-shops/',
|
||||
'/admin/auth/refresh'
|
||||
].some(path => String(url || '').includes(path))
|
||||
}
|
||||
|
||||
const handleTokenExpired = (isAdmin = false) => {
|
||||
// 清理token和用户信息
|
||||
if (isAdmin) {
|
||||
@@ -76,7 +100,7 @@ const handleTokenExpired = (isAdmin = false) => {
|
||||
}
|
||||
|
||||
api.interceptors.request.use(
|
||||
config => {
|
||||
async config => {
|
||||
let token = localStorage.getItem('accessToken')
|
||||
if (!token) {
|
||||
token = sessionStorage.getItem('accessToken')
|
||||
@@ -93,7 +117,9 @@ api.interceptors.request.use(
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
return config
|
||||
return attachRequestSignature(config, token, {
|
||||
authFree: isAuthFreePath(config.url)
|
||||
})
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error)
|
||||
|
||||
@@ -79,11 +79,11 @@ export const productApi = {
|
||||
},
|
||||
|
||||
likeProduct: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.post<boolean>(`/product/like/${productId}`) as unknown as boolean
|
||||
return await api.post<boolean>(`/product-like/like/${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
unlikeProduct: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.post<boolean>(`/product/unlike/${productId}`) as unknown as boolean
|
||||
return await api.post<boolean>(`/product-like/unlike/${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
searchProducts: async (keyword: string): Promise<ProductVO[]> => {
|
||||
|
||||
-1
@@ -83,7 +83,6 @@ declare module 'vue' {
|
||||
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
|
||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
TableEllipsisText: typeof import('./components/TableEllipsisText.vue')['default']
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
defineProps<{ msg: string }>()
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<div class="card">
|
||||
<button type="button" @click="count++">count is {{ count }}</button>
|
||||
<p>
|
||||
Edit
|
||||
<code>components/HelloWorld.vue</code> to test HMR
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Check out
|
||||
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
||||
>create-vue</a
|
||||
>, the official Vue + Vite starter
|
||||
</p>
|
||||
<p>
|
||||
Learn more about IDE Support for Vue in the
|
||||
<a
|
||||
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
||||
target="_blank"
|
||||
>Vue Docs Scaling up Guide</a
|
||||
>.
|
||||
</p>
|
||||
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
</style>
|
||||
@@ -1,3 +1,3 @@
|
||||
export const DEFAULT_AVATAR = 'https://api.dicebear.com/7.x/avataaars/svg?seed=default'
|
||||
export const DEFAULT_PRODUCT_IMAGE = 'https://via.placeholder.com/200x200?text=Product'
|
||||
export const DEFAULT_SHOP_IMAGE = 'https://via.placeholder.com/200x200?text=Shop'
|
||||
export const DEFAULT_PRODUCT_IMAGE = '/assets/images/default-product.png'
|
||||
export const DEFAULT_SHOP_IMAGE = '/assets/images/default-shop.png'
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import Antd from 'ant-design-vue'
|
||||
import 'ant-design-vue/dist/reset.css'
|
||||
import './styles/admin-mobile.css'
|
||||
import App from './App.vue'
|
||||
@@ -13,7 +10,5 @@ const pinia = createPinia()
|
||||
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
app.use(Antd)
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ElLoading, type LoadingInstance } from 'element-plus'
|
||||
import 'element-plus/es/components/loading/style/css'
|
||||
|
||||
export interface GlobalLoadingOptions {
|
||||
text?: string
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
import type { InternalAxiosRequestConfig } from 'axios'
|
||||
|
||||
const HEADER_TIMESTAMP = 'X-Timestamp'
|
||||
const HEADER_NONCE = 'X-Nonce'
|
||||
const HEADER_SIGNATURE = 'X-Signature'
|
||||
const HEADER_SIGNATURE_VERSION = 'X-Sign-Version'
|
||||
const DEVICE_ID_HEADER = 'X-Device-Id'
|
||||
const DEVICE_ID_STORAGE_KEY = 'yuminail-device-id'
|
||||
const SIGNATURE_VERSION = 'v1'
|
||||
|
||||
type HeaderContainer = Record<string, unknown> & {
|
||||
set?: (name: string, value: string) => void
|
||||
get?: (name: string) => unknown
|
||||
}
|
||||
|
||||
interface RequestSignatureOptions {
|
||||
authFree?: boolean
|
||||
}
|
||||
|
||||
function isSafeMethod(method?: string) {
|
||||
return ['GET', 'HEAD', 'OPTIONS'].includes(String(method || 'GET').toUpperCase())
|
||||
}
|
||||
|
||||
function toHex(bytes: ArrayBuffer) {
|
||||
return Array.from(new Uint8Array(bytes))
|
||||
.map(byte => byte.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
|
||||
async function sha256Hex(text: string) {
|
||||
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
|
||||
return toHex(digest)
|
||||
}
|
||||
|
||||
async function hmacSha256Hex(secret: string, message: string) {
|
||||
const key = await crypto.subtle.importKey(
|
||||
'raw',
|
||||
new TextEncoder().encode(secret),
|
||||
{ name: 'HMAC', hash: 'SHA-256' },
|
||||
false,
|
||||
['sign']
|
||||
)
|
||||
const signature = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(message))
|
||||
return toHex(signature)
|
||||
}
|
||||
|
||||
function randomNonce() {
|
||||
if (typeof crypto.randomUUID === 'function') {
|
||||
return `${Date.now()}-${crypto.randomUUID()}`
|
||||
}
|
||||
return `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`
|
||||
}
|
||||
|
||||
export function getDeviceId() {
|
||||
try {
|
||||
const stored = localStorage.getItem(DEVICE_ID_STORAGE_KEY)
|
||||
if (stored) {
|
||||
return stored
|
||||
}
|
||||
const next = `web-${randomNonce()}`
|
||||
localStorage.setItem(DEVICE_ID_STORAGE_KEY, next)
|
||||
return next
|
||||
} catch {
|
||||
return `web-${randomNonce()}`
|
||||
}
|
||||
}
|
||||
|
||||
function setHeader(config: InternalAxiosRequestConfig, name: string, value: string) {
|
||||
const headers = config.headers as HeaderContainer | undefined
|
||||
if (headers && typeof headers.set === 'function') {
|
||||
headers.set(name, value)
|
||||
return
|
||||
}
|
||||
config.headers = {
|
||||
...(headers || {}),
|
||||
[name]: value
|
||||
} as InternalAxiosRequestConfig['headers']
|
||||
}
|
||||
|
||||
function getHeader(config: InternalAxiosRequestConfig, name: string) {
|
||||
const headers = config.headers as HeaderContainer | undefined
|
||||
if (!headers) {
|
||||
return ''
|
||||
}
|
||||
if (typeof headers.get === 'function') {
|
||||
const value = headers.get(name)
|
||||
if (value !== undefined && value !== null) {
|
||||
return String(value)
|
||||
}
|
||||
}
|
||||
return String(headers[name] || headers[name.toLowerCase()] || '')
|
||||
}
|
||||
|
||||
function extractPath(value?: string) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
try {
|
||||
return new URL(value, window.location.origin).pathname
|
||||
} catch {
|
||||
return value.split('?')[0] || ''
|
||||
}
|
||||
}
|
||||
|
||||
function joinAxiosPath(baseUrl?: string, requestUrl?: string) {
|
||||
if (requestUrl && /^[a-z][a-z\d+\-.]*:\/\//i.test(requestUrl)) {
|
||||
return extractPath(requestUrl)
|
||||
}
|
||||
|
||||
const basePath = extractPath(baseUrl).replace(/^\/+|\/+$/g, '')
|
||||
const requestPath = extractPath(requestUrl).replace(/^\/+|\/+$/g, '')
|
||||
const joined = [basePath, requestPath].filter(Boolean).join('/')
|
||||
return joined ? `/${joined}` : '/'
|
||||
}
|
||||
|
||||
function toBackendRequestPath(baseUrl?: string, requestUrl?: string) {
|
||||
const path = joinAxiosPath(baseUrl, requestUrl)
|
||||
if (path === '/admin/api') {
|
||||
return '/admin'
|
||||
}
|
||||
if (path.startsWith('/admin/api/')) {
|
||||
return `/admin/${path.slice('/admin/api/'.length)}`
|
||||
}
|
||||
if (path === '/api/admin') {
|
||||
return '/admin'
|
||||
}
|
||||
if (path.startsWith('/api/admin/')) {
|
||||
return `/admin/${path.slice('/api/admin/'.length)}`
|
||||
}
|
||||
if (path === '/api') {
|
||||
return '/'
|
||||
}
|
||||
if (path.startsWith('/api/')) {
|
||||
return `/${path.slice('/api/'.length)}`
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
function appendParam(target: Record<string, unknown[]>, key: string, value: unknown) {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return
|
||||
}
|
||||
if (!target[key]) {
|
||||
target[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(item => appendParam(target, key, item))
|
||||
return
|
||||
}
|
||||
target[key].push(value)
|
||||
}
|
||||
|
||||
function collectParams(source: unknown, target: Record<string, unknown[]>) {
|
||||
if (!source) {
|
||||
return
|
||||
}
|
||||
if (source instanceof URLSearchParams) {
|
||||
source.forEach((value, key) => appendParam(target, key, value))
|
||||
return
|
||||
}
|
||||
if (source instanceof FormData) {
|
||||
source.forEach((value, key) => {
|
||||
if (!(value instanceof Blob)) {
|
||||
appendParam(target, key, value)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof source === 'object') {
|
||||
Object.entries(source as Record<string, unknown>).forEach(([key, value]) => appendParam(target, key, value))
|
||||
}
|
||||
}
|
||||
|
||||
function buildCanonicalParams(...sources: unknown[]) {
|
||||
const params: Record<string, unknown[]> = {}
|
||||
sources.forEach(source => collectParams(source, params))
|
||||
return Object.keys(params)
|
||||
.sort()
|
||||
.map(key => {
|
||||
const normalized = params[key]
|
||||
?.map(value => String(value))
|
||||
.sort()
|
||||
.join(',') || ''
|
||||
return `${key}=${normalized}`
|
||||
})
|
||||
.join('&')
|
||||
}
|
||||
|
||||
function buildJsonPayload(data: unknown) {
|
||||
if (data === undefined || data === null || data === '') {
|
||||
return ''
|
||||
}
|
||||
if (typeof data === 'string') {
|
||||
return data
|
||||
}
|
||||
return JSON.stringify(data)
|
||||
}
|
||||
|
||||
function resolvePayload(config: InternalAxiosRequestConfig) {
|
||||
const contentType = getHeader(config, 'Content-Type').toLowerCase()
|
||||
const jsonPayload = contentType.includes('application/json') ? buildJsonPayload(config.data) : ''
|
||||
if (jsonPayload) {
|
||||
return jsonPayload
|
||||
}
|
||||
return buildCanonicalParams(config.params, config.data)
|
||||
}
|
||||
|
||||
export async function attachRequestSignature(
|
||||
config: InternalAxiosRequestConfig,
|
||||
accessToken?: string | null,
|
||||
options: RequestSignatureOptions = {}
|
||||
) {
|
||||
setHeader(config, DEVICE_ID_HEADER, getDeviceId())
|
||||
|
||||
const method = String(config.method || 'GET').toUpperCase()
|
||||
if (!accessToken || options.authFree || isSafeMethod(method)) {
|
||||
return config
|
||||
}
|
||||
|
||||
const timestamp = String(Date.now())
|
||||
const nonce = randomNonce()
|
||||
const payloadHash = await sha256Hex(resolvePayload(config))
|
||||
const canonical = [
|
||||
method,
|
||||
toBackendRequestPath(config.baseURL, config.url),
|
||||
timestamp,
|
||||
nonce,
|
||||
payloadHash
|
||||
].join('\n')
|
||||
|
||||
setHeader(config, HEADER_TIMESTAMP, timestamp)
|
||||
setHeader(config, HEADER_NONCE, nonce)
|
||||
setHeader(config, HEADER_SIGNATURE, await hmacSha256Hex(accessToken, canonical))
|
||||
setHeader(config, HEADER_SIGNATURE_VERSION, SIGNATURE_VERSION)
|
||||
return config
|
||||
}
|
||||
@@ -290,22 +290,10 @@
|
||||
|
||||
<div class="social-login">
|
||||
<div class="divider">
|
||||
<span>其他登录方式</span>
|
||||
<span>微信手机号登录</span>
|
||||
</div>
|
||||
<div class="social-hint">
|
||||
网页端暂未开放第三方登录,微信手机号一键登录仅支持小程序。
|
||||
</div>
|
||||
<div class="social-buttons">
|
||||
<a-button shape="circle" size="large" class="social-circle-btn" @click="handleWeChatLogin">
|
||||
<WechatOutlined />
|
||||
</a-button>
|
||||
<a-button shape="circle" size="large" class="social-circle-btn" @click="handleQQLogin">
|
||||
<QqOutlined />
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="social-button-captions">
|
||||
<span>微信登录(仅小程序)</span>
|
||||
<span>QQ 登录(暂未开放)</span>
|
||||
微信手机号授权登录请在小程序中使用;网页端可使用账号密码或验证码登录。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -398,7 +386,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { InfoCircleOutlined, LockOutlined, QqOutlined, UserOutlined, WechatOutlined } from '@ant-design/icons-vue'
|
||||
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import type { Rule } from 'ant-design-vue/es/form'
|
||||
import { authApi } from '@/api/auth'
|
||||
@@ -454,7 +442,7 @@ let loginPhoneShopCheckTimer: number | undefined
|
||||
|
||||
const phoneRegex = /^1[3-9]\d{9}$/
|
||||
const verificationCodeRegex = /^\d{6}$/
|
||||
const loginShopUnsupportedMessage = '当前环境暂未开放登录前门店预加载,可直接登录;如账号绑定多家门店,登录后可在个人中心切换当前门店。'
|
||||
const loginShopUnsupportedMessage = '可直接登录;如账号绑定多家门店,登录后可在个人中心切换当前门店。'
|
||||
const loginShopPlaceholder = computed(() => {
|
||||
if (allowLoginShopless.value) {
|
||||
return '当前暂无启用店铺,可直接登录'
|
||||
@@ -926,14 +914,6 @@ const handleResetPassword = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleWeChatLogin = () => {
|
||||
message.info('网页端暂未开放微信登录,请使用账号密码、验证码登录,或前往小程序使用微信手机号一键登录')
|
||||
}
|
||||
|
||||
const handleQQLogin = () => {
|
||||
message.info('网页端暂未开放 QQ 登录,敬请期待')
|
||||
}
|
||||
|
||||
const handleRegisterAccountBlur = async () => {
|
||||
if (activeTab.value !== 'register' || !formData.account.trim()) {
|
||||
registerAccountStatus.value = null
|
||||
|
||||
@@ -193,10 +193,8 @@
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
BellOutlined,
|
||||
CreditCardOutlined,
|
||||
HeartOutlined,
|
||||
QuestionCircleOutlined,
|
||||
RightOutlined,
|
||||
SettingOutlined,
|
||||
ShopOutlined,
|
||||
@@ -307,46 +305,6 @@ const shopSwitchTip = computed(() => {
|
||||
return '当前暂无可用门店'
|
||||
})
|
||||
|
||||
const menuItems = [
|
||||
{
|
||||
key: 'orders',
|
||||
title: '我的订单',
|
||||
desc: '查看预约状态、取消订单',
|
||||
icon: ShoppingOutlined,
|
||||
bgColor: '#e6f7ff'
|
||||
},
|
||||
{
|
||||
key: 'wishlist',
|
||||
title: '我的收藏',
|
||||
desc: '快速回到喜欢的作品',
|
||||
icon: HeartOutlined,
|
||||
bgColor: '#fff1f0'
|
||||
},
|
||||
{
|
||||
key: 'coupons',
|
||||
title: '我的优惠券',
|
||||
desc: '查看可用优惠和 VIP 折扣',
|
||||
icon: CreditCardOutlined,
|
||||
bgColor: '#fff7e6'
|
||||
},
|
||||
{
|
||||
key: 'notifications',
|
||||
title: '消息通知',
|
||||
desc: '消息中心功能开发中',
|
||||
icon: BellOutlined,
|
||||
bgColor: '#f9f0ff'
|
||||
},
|
||||
{
|
||||
key: 'help',
|
||||
title: '帮助与支持',
|
||||
desc: '常见问题功能开发中',
|
||||
icon: QuestionCircleOutlined,
|
||||
bgColor: '#eef9ff'
|
||||
}
|
||||
]
|
||||
|
||||
void menuItems
|
||||
|
||||
const coreMenuItems = [
|
||||
{
|
||||
key: 'orders',
|
||||
@@ -595,10 +553,6 @@ const handleMenuClick = (key: string) => {
|
||||
router.push('/coupons')
|
||||
} else if (key === 'settings') {
|
||||
router.push('/settings')
|
||||
} else if (key === 'notifications') {
|
||||
message.info('消息通知功能开发中')
|
||||
} else if (key === 'help') {
|
||||
message.info('帮助中心功能开发中')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,23 +49,13 @@
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
BellOutlined,
|
||||
ClearOutlined,
|
||||
InfoCircleOutlined,
|
||||
LeftOutlined,
|
||||
LockOutlined,
|
||||
MessageOutlined,
|
||||
QuestionCircleOutlined,
|
||||
RightOutlined,
|
||||
SafetyOutlined,
|
||||
SoundOutlined
|
||||
} from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const comingSoonDesc = '暂未开放,敬请期待'
|
||||
|
||||
const settingsSections = ref([
|
||||
{
|
||||
type: 'title',
|
||||
@@ -74,69 +64,12 @@ const settingsSections = ref([
|
||||
{
|
||||
key: 'account',
|
||||
title: '账号设置',
|
||||
desc: '修改密码、绑定手机号、管理账号安全项',
|
||||
desc: '管理手机号、登录密码和账号安全',
|
||||
icon: LockOutlined,
|
||||
bgColor: '#e6f7ff'
|
||||
},
|
||||
{
|
||||
type: 'title',
|
||||
title: '更多功能'
|
||||
},
|
||||
{
|
||||
key: 'notifications',
|
||||
title: '消息通知',
|
||||
desc: comingSoonDesc,
|
||||
icon: BellOutlined,
|
||||
bgColor: '#f6ffed'
|
||||
},
|
||||
{
|
||||
key: 'message-push',
|
||||
title: '消息推送',
|
||||
desc: comingSoonDesc,
|
||||
icon: MessageOutlined,
|
||||
bgColor: '#fffbe6'
|
||||
},
|
||||
{
|
||||
key: 'theme',
|
||||
title: '主题设置',
|
||||
desc: comingSoonDesc,
|
||||
icon: SoundOutlined,
|
||||
bgColor: '#f9f0ff'
|
||||
},
|
||||
{
|
||||
key: 'clear-cache',
|
||||
title: '缓存清理',
|
||||
desc: comingSoonDesc,
|
||||
icon: ClearOutlined,
|
||||
bgColor: '#fff2e8'
|
||||
},
|
||||
{
|
||||
key: 'privacy',
|
||||
title: '隐私政策',
|
||||
desc: comingSoonDesc,
|
||||
icon: SafetyOutlined,
|
||||
bgColor: '#e6f7ff'
|
||||
},
|
||||
{
|
||||
key: 'about',
|
||||
title: '关于我们',
|
||||
desc: comingSoonDesc,
|
||||
icon: InfoCircleOutlined,
|
||||
bgColor: '#f6ffed'
|
||||
},
|
||||
{
|
||||
key: 'help',
|
||||
title: '帮助中心',
|
||||
desc: comingSoonDesc,
|
||||
icon: QuestionCircleOutlined,
|
||||
bgColor: '#eef9ff'
|
||||
}
|
||||
])
|
||||
|
||||
const showComingSoon = () => {
|
||||
message.info('该功能暂未开放,敬请期待')
|
||||
}
|
||||
|
||||
const handleBackClick = () => {
|
||||
router.back()
|
||||
}
|
||||
@@ -146,8 +79,6 @@ const handleSettingClick = (key: string) => {
|
||||
router.push('/settings/account')
|
||||
return
|
||||
}
|
||||
|
||||
showComingSoon()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import { ref, onMounted, inject } from 'vue'
|
||||
import { ArrowLeft, Delete, StarFilled } from '@element-plus/icons-vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import 'element-plus/es/components/message/style/css'
|
||||
import { wishlistApi, type WishlistItem } from '@/api/wishlist'
|
||||
import { cartApi } from '@/api/cart'
|
||||
import { fileApi } from '@/api/file'
|
||||
|
||||
@@ -228,7 +228,7 @@ const loadLoginShops = async (account = formState.account) => {
|
||||
if (isLoginShopPrefetchUnsupported(error)) {
|
||||
applyLoginShopSelection({
|
||||
allowShoplessLogin: true,
|
||||
message: '当前环境暂未开放登录前店铺预加载,可直接登录。',
|
||||
message: '可直接登录;如账号绑定多家门店,登录后可在个人中心切换当前门店。',
|
||||
shops: []
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -153,7 +153,7 @@ const insightItems = computed(() => {
|
||||
if (stats.totalProducts === 0) {
|
||||
items.push({
|
||||
title: '还没有可售作品',
|
||||
description: '可以先补充几款基础作品,首页和前台作品页会更完整,也更方便测试完整下单流程。'
|
||||
description: '先补充基础作品,首页和作品页会更完整,顾客也能更顺畅地下单。'
|
||||
})
|
||||
} else {
|
||||
items.push({
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
|
||||
<AdminMobileFab
|
||||
:visible="isMobile && activeTab === 'permissions' && hasPermission('permission:create') && !permissionModalVisible"
|
||||
label="鏂板鏉冮檺"
|
||||
label="新增权限"
|
||||
@click="showAddPermissionModal"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<div class="admin-mobile-card__rows">
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>预计时长</span>
|
||||
<strong>{{ item.approximateDuration || '--' }} 分钟</strong>
|
||||
<strong>{{ formatDuration(item.approximateDuration) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>互动数据</span>
|
||||
@@ -550,6 +550,14 @@ const nextRequestToken = (key: keyof typeof requestTokens) => {
|
||||
|
||||
const isLatestRequestToken = (key: keyof typeof requestTokens, token: number) => requestTokens[key] === token
|
||||
|
||||
const formatDuration = (value?: string | number | null) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return '--'
|
||||
}
|
||||
const text = String(value).trim()
|
||||
return text.includes('分钟') ? text : `${text}分钟`
|
||||
}
|
||||
|
||||
const viewFormState = reactive({
|
||||
shopId: undefined,
|
||||
title: '',
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
|
||||
<AdminMobileFab
|
||||
:visible="isMobile && hasPermission('shop:create') && !modalVisible && !viewModalVisible"
|
||||
label="鏂板搴楅摵"
|
||||
label="新增店铺"
|
||||
@click="showAddModal"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user