refactor: update icon system, fix login and add temp auth
refactor all icon map references from zniconsMap to iconsMap across the codebase standardize icon import paths and add complete src/assets/fonts/znicons.ts definition file fix login page query selector typo and replace hardcoded client ID with environment variable add temporary auth token injection in request utility using env var update ZnIcon documentation and development environment config
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export const zniconsMap = {
|
||||
export const iconsMap = {
|
||||
"zn-wifi": "\ue681",
|
||||
"zn-bath": "\ue69a",
|
||||
"zn-frame": "\ue683",
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<div v-else class="w-full h-full flex flex-items-center flex-justify-center" @click="handleChooseImage">
|
||||
<uni-icons fontFamily="znicons" size="24" color="#6A717F">
|
||||
{{ zniconsMap["zn-camera"] }}
|
||||
{{ iconsMap["zn-camera"] }}
|
||||
</uni-icons>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,7 +74,7 @@ import { ref, computed, onMounted, nextTick, defineProps, watch } from "vue";
|
||||
import { SCROLL_TO_BOTTOM } from "@/constants/constant";
|
||||
import { createWorkOrder } from "@/api/workOrder";
|
||||
import { uploadFile } from "@/api/upload";
|
||||
import { zniconsMap } from "@/assets/fonts/znicons";
|
||||
import { iconsMap } from "@/assets/fonts/znicons";
|
||||
|
||||
const props = defineProps({
|
||||
toolCall: {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
}">
|
||||
<div class="flex flex-items-center flex-row flex-shrink-0 mr-8">
|
||||
<van-icon fontFamily="znicons" size="20" color="#333">
|
||||
{{ zniconsMap[moduleItem.moduleIcon] }}
|
||||
{{ iconsMap[moduleItem.moduleIcon] }}
|
||||
</van-icon>
|
||||
<span class="ml-4 font-size-14 color-171717 line-height-20">
|
||||
{{ moduleItem.moduleTitle }}
|
||||
@@ -33,7 +33,7 @@
|
||||
import { defineProps } from "vue";
|
||||
import Vue3MarkdownIt from 'vue3-markdown-it';
|
||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||
import { zniconsMap } from "@/assets/fonts/znicons";
|
||||
import { iconsMap } from "@/assets/fonts/znicons";
|
||||
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="border-box rounded-12 bg-white p-12 ml-12 mr-12 mb-40">
|
||||
<div class="flex flex-items-center mb-8">
|
||||
<uni-icons fontFamily="znicons" size="20" color="#333">
|
||||
{{ zniconsMap["zn-refund"] }}
|
||||
{{ iconsMap["zn-refund"] }}
|
||||
</uni-icons>
|
||||
<span class="font-size-14 font-600 color-171717 ml-8">
|
||||
{{ refundTitle }}
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { zniconsMap } from "@/static/fonts/znicons";
|
||||
import { iconsMap } from "@/static/fonts/znicons";
|
||||
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { zniconsMap } from "@/assets/fonts/znicons.js";
|
||||
import { iconsMap } from "@/assets/fonts/znicons";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -22,7 +22,7 @@ const props = withDefaults(
|
||||
);
|
||||
|
||||
const glyph = computed(() => {
|
||||
const value = (zniconsMap as Record<string, string>)[props.name];
|
||||
const value = (iconsMap as Record<string, string>)[props.name];
|
||||
return value ?? "";
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { zniconsMap } from "@/assets/fonts/znicons";
|
||||
import { iconsMap } from "@/assets/fonts/znicons";
|
||||
import { defineProps } from "vue";
|
||||
|
||||
// Props定义
|
||||
|
||||
@@ -33,7 +33,7 @@ function loadGoogleIdentityServices(): Promise<void> {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const src = "https://accounts.google.com/gsi/client";
|
||||
const existing = document.querySelector < HTMLScriptElement > (
|
||||
const existing = document.querySelector<HTMLScriptElement>(
|
||||
`script[src="${src}"]`,
|
||||
);
|
||||
|
||||
@@ -84,7 +84,7 @@ onMounted(() => {
|
||||
// 【后续业务】:你可以将这串 idToken 通过 axios 发送给你自己的后端接口
|
||||
// 或者是直接利用第三方平台(如 Firebase / Supabase)完成纯前端鉴权
|
||||
console.log("拿到的 ID Token 是:", idToken);
|
||||
oauthToken({ clientId: '6', openIdCode: [idToken], grant_type: 'google' })
|
||||
oauthToken({ clientId: import.meta.env.VITE_CLIENT_ID, openIdCode: [idToken], grant_type: 'google' })
|
||||
.then((res) => {
|
||||
console.log("获取到的 oauth token:", res)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="tab-item-inner flex flex-items-center">
|
||||
<uni-icons :class="['icon mr-4', activeIndex === index && 'icon-active']" fontFamily="znicons" size="20"
|
||||
color="opacity">
|
||||
{{ zniconsMap[item.iconCode] }}
|
||||
{{ iconsMap[item.iconCode] }}
|
||||
</uni-icons>
|
||||
|
||||
<span :class="[
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { zniconsMap } from "@/static/fonts/znicons";
|
||||
import { iconsMap } from "@/static/fonts/znicons";
|
||||
import { commodityTypePageList } from "@/api/goods";
|
||||
|
||||
// Props
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export { zniconsMap } from "@/assets/fonts/znicons.js";
|
||||
|
||||
@@ -99,6 +99,9 @@ function resolveRequestLanguage(): string | null {
|
||||
function buildContextHeaders(options?: RequestOptions): Record<string, string> {
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
// 临时token,后续需要从登录获取token
|
||||
setAuthToken(import.meta.env.VITE_TOKEN);
|
||||
|
||||
if (!options?.skipAuth && context.token) {
|
||||
headers.Authorization = `Bearer ${context.token}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user