Add admin-frontend and user-frontend standalone projects, certification/invoice/discovery features, fix auth header and theme consistency
This commit is contained in:
@@ -136,6 +136,10 @@
|
||||
<text class="more-icon">🔤</text>
|
||||
<text class="more-text">翻译</text>
|
||||
</view>
|
||||
<view class="more-item" @click="goToPage(PAGES.DISCOVERY)">
|
||||
<text class="more-icon">🔍</text>
|
||||
<text class="more-text">挖掘新客</text>
|
||||
</view>
|
||||
<view class="more-item" @click="hasLogin ? goToPage(PAGES.PRODUCT) : goToLogin()">
|
||||
<text class="more-icon">📦</text>
|
||||
<text class="more-text">产品库</text>
|
||||
@@ -166,10 +170,6 @@
|
||||
<text class="more-icon">👨👩👧👦</text>
|
||||
<text class="more-text">团队</text>
|
||||
</view>
|
||||
<view class="more-item" v-if="isAdmin" @click="goToPage(PAGES.ADMIN)">
|
||||
<text class="more-icon">⚙️</text>
|
||||
<text class="more-text">管理</text>
|
||||
</view>
|
||||
<view class="more-item" @click="showWechatModal = true">
|
||||
<text class="more-icon">💁</text>
|
||||
<text class="more-text">联系客服</text>
|
||||
@@ -277,7 +277,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { ref, onUnmounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { authApi, customerApi, analyticsApi, onboardingApi, notificationApi, followupApi, translateApi, BASE_URL } from '@/utils/api.js'
|
||||
import AiAssistant from '@/components/ai-assistant.vue'
|
||||
@@ -292,14 +292,12 @@ const announcements = [
|
||||
]
|
||||
let announcementTimer = null
|
||||
|
||||
const hasLogin = computed(() => {
|
||||
const token = uni.getStorageSync('token')
|
||||
const isGuest = uni.getStorageSync('isGuest')
|
||||
return !!token && !isGuest
|
||||
})
|
||||
const isAdmin = computed(() => {
|
||||
return hasLogin.value && userInfo.value?.role === 'admin'
|
||||
})
|
||||
const hasLogin = ref(false)
|
||||
function checkLogin() {
|
||||
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
|
||||
const isGuest = uni.getStorageSync(STORAGE_KEYS.IS_GUEST)
|
||||
hasLogin.value = !!token && !isGuest
|
||||
}
|
||||
const userInfo = ref(null)
|
||||
const stats = ref({
|
||||
customers: 0,
|
||||
@@ -331,9 +329,8 @@ onShow(() => {
|
||||
currentAnnouncement.value = (currentAnnouncement.value + 1) % announcements.length
|
||||
}, 4000)
|
||||
|
||||
const token = uni.getStorageSync('token')
|
||||
const isGuest = uni.getStorageSync('isGuest')
|
||||
if (token && !isGuest) {
|
||||
checkLogin()
|
||||
if (hasLogin.value) {
|
||||
uni.setStorageSync(STORAGE_KEYS.IS_GUEST, false)
|
||||
loadData()
|
||||
checkOnboarding()
|
||||
@@ -449,6 +446,24 @@ const goToLogin = () => {
|
||||
})
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
uni.showModal({
|
||||
title: '退出登录',
|
||||
content: '确定退出当前账号?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.removeStorageSync(STORAGE_KEYS.TOKEN)
|
||||
uni.removeStorageSync(STORAGE_KEYS.REFRESH_TOKEN)
|
||||
uni.removeStorageSync(STORAGE_KEYS.USER_INFO)
|
||||
uni.removeStorageSync(STORAGE_KEYS.HAS_LOGIN)
|
||||
uni.removeStorageSync(STORAGE_KEYS.IS_GUEST)
|
||||
hasLogin.value = false
|
||||
uni.switchTab({ url: PAGES.INDEX })
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const doQuickTranslate = async () => {
|
||||
if (!quickTranslateText.value.trim()) return
|
||||
try {
|
||||
@@ -1237,4 +1252,11 @@ const playTryResult = () => {
|
||||
color: #bbb;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* On desktop, hide the feature matrix section (items are in the sidebar) */
|
||||
@media (min-width: 1024px) {
|
||||
.more-section {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user