Browse Source

优化

master
科技小王子 9 months ago
parent
commit
340fd3dec1
  1. 2
      components/AppFooter.vue
  2. 8
      composables/useClientRequest.ts
  3. 2
      composables/useRequest.ts
  4. 88
      pages/article/[categoryId].vue
  5. 143
      pages/article/[id].vue
  6. 70
      pages/article/detail/[id].vue
  7. 133
      pages/demo/[name].vue
  8. 54
      pages/product/[name].vue
  9. BIN
      public/favicon.ico
  10. 5
      utils/request.ts

2
components/AppFooter.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="h-[100px]"></div> <div class="h-[100px]"></div>
<div class="text-center text-red-7 py-10">
<div class="text-center bg-white text-red-7 py-10">
本网站为小象CMS演示站提供的电视剧和电影资源均系收集于各大视频网站<br /> 本网站为小象CMS演示站提供的电视剧和电影资源均系收集于各大视频网站<br />
若本站收录的节目无意侵犯了贵司版权,请给我们留言,我们会及时逐步删除和规避程序自动搜索采集到的不提供分享的版权影视<br /> 若本站收录的节目无意侵犯了贵司版权,请给我们留言,我们会及时逐步删除和规避程序自动搜索采集到的不提供分享的版权影视<br />
本站仅供测试和学习交流请大家支持正版 本站仅供测试和学习交流请大家支持正版

8
composables/useClientRequest.ts

@ -1,4 +1,4 @@
import { isArray } from '~/utils/tool';
import {getBaseUrl, isArray} from '~/utils/tool';
import {MODULES_API_URL, TENANT_ID} from "~/config"; import {MODULES_API_URL, TENANT_ID} from "~/config";
type FetchType = typeof $fetch; type FetchType = typeof $fetch;
@ -9,13 +9,13 @@ export const useClientRequest = <T = unknown>(url: string, opts?: FetchOptions)
const runtimeConfig = useRuntimeConfig(); const runtimeConfig = useRuntimeConfig();
const defaultOptions: FetchOptions = { const defaultOptions: FetchOptions = {
baseURL: MODULES_API_URL,
baseURL: getBaseUrl(),
onRequest({ options }) { onRequest({ options }) {
options.headers = (options.headers || {}) as { [key: string]: string }; options.headers = (options.headers || {}) as { [key: string]: string };
if (token.value) { if (token.value) {
options.headers.Authorization = token.value; options.headers.Authorization = token.value;
options.headers.Tenantd = '5';
} }
options.headers.Tenantd = '5';
}, },
onResponse({ response }) { onResponse({ response }) {
if (+response.status === 0 && +response._data.code !== 0) { if (+response.status === 0 && +response._data.code !== 0) {
@ -27,5 +27,5 @@ export const useClientRequest = <T = unknown>(url: string, opts?: FetchOptions)
} }
}; };
return $fetch<T>(MODULES_API_URL + url, { ...defaultOptions, ...opts });
return $fetch<T>(getBaseUrl() + url, { ...defaultOptions, ...opts });
}; };

2
composables/useRequest.ts

@ -6,7 +6,6 @@
import { useFetch } from '#app'; import { useFetch } from '#app';
import type { UseFetchOptions } from '#app'; import type { UseFetchOptions } from '#app';
import {getBaseUrl, isArray} from '~/utils/tool'; import {getBaseUrl, isArray} from '~/utils/tool';
import {TENANT_ID} from "~/config";
export const useRequest = <T>(url: string, opts?: UseFetchOptions<T, unknown>) => { export const useRequest = <T>(url: string, opts?: UseFetchOptions<T, unknown>) => {
// 获取 Cookie // 获取 Cookie
@ -28,6 +27,7 @@ export const useRequest = <T>(url: string, opts?: UseFetchOptions<T, unknown>) =
if(+response.status === 500){ if(+response.status === 500){
ElMessage.error('网络请求错误') ElMessage.error('网络请求错误')
} }
return response._data.data;
}, },
onResponseError({ response }) { onResponseError({ response }) {
process.client && process.client &&

88
pages/article/[categoryId].vue

@ -1,88 +0,0 @@
<template>
<!-- <div class="banner" v-if="list">-->
<!-- <el-image :src="list.photo"></el-image>-->
<!-- </div>-->
<div v-if="list" class="container flex flex-col w-[1280px] m-auto my-3">
<el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item v-if="categoryName" :to="{ path: `/article/${categoryId}` }">{{ categoryName }}</el-breadcrumb-item>
<!-- <el-breadcrumb-item>{{ list.count }}</el-breadcrumb-item>-->
</el-breadcrumb>
<el-card :title="`标题`" class="w-7xl m-auto mt-10">
<template v-for="(item,index) in list">
<a :href="`/article/detail/${item.articleId}`" target="_blank" class="title text-3xl text-center">{{ item.title }}</a>
<div v-html="item.content">
</div>
</template>
</el-card>
<div class="flex flex-wrap justify-between w-[1280px] m-auto my-3">
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
</div>
</div>
<div v-if="!list">
<el-empty description="404 页面不存在"></el-empty>
</div>
</template>
<script setup lang="ts">
import type {ApiResult, PageResult} from "~/api";
import type {Article} from "~/api/cms/article/model";
import {useRequest} from "~/composables/useRequest";
const route = useRoute();
const { query, params } = route;
const { categoryId } = params;
console.log(categoryId,'categoryId')
//
const list = ref<Article[] | any>();
const title = ref();
const categoryName = ref();
const count = ref()
//
const { data: articleList } = await useRequest<ApiResult<PageResult<Article>>>('/cms/article/page',{
params: {
categoryId
}
})
console.log(articleList);
if (articleList.value) {
count.value = articleList.value.data?.count;
list.value = articleList.value.data?.list.map((d,i)=>{
if(i === 0){
categoryName.value = d.categoryName;
useHead({
title: `${d.categoryName} - 网宿软件`,
meta: [{ name: "keywords", content: d.title }],
bodyAttrs: {
class: "page-container",
},
script: [
{
children: "console.log('Hello World')",
},
],
});
}
return d;
});
}
</script>
<style scoped lang="scss">
</style>

143
pages/article/[id].vue

@ -0,0 +1,143 @@
<template>
<div class="banner h-[60px]">
<el-image :src="form?.photo"></el-image>
</div>
<div class="flex flex-col w-full md:w-3/4 m-auto my-3">
<el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item v-if="form?.parentName">{{ form.parentName }}</el-breadcrumb-item>
<el-breadcrumb-item v-if="form?.categoryName">{{ form.categoryName }}</el-breadcrumb-item>
</el-breadcrumb>
<el-row :gutter="20" class="mt-3">
<el-col :span="18">
<div class="news-list p-4 bg-white">
<ul class="infinite-list" v-infinite-scroll="load" :infinite-scroll-disabled="disabled" style="overflow:auto">
<li v-for="item in list">
<div class="item flex gap-xl mb-5 h-[120px] w-full hover:bg-gray-50">
<div class="item-image">
<el-image :src="item.image" class="w-[180px] h-[120px] bg-gray-50 cursor-pointer" fit="contain" />
</div>
<div class="item-info py-2 flex flex-col justify-between">
<a :href="`/article/detail/${item.articleId}`" target="_blank" class="text-xl">{{ item.title }}</a>
<div class="desc text-gray-5" v-html="item.comments"></div>
<div class="actions text-gray-4 text-sm flex gap-2xl">
<span href="#">{{ item.updateTime }}</span>
<span href="#">浏览{{ item.actualViews }}</span>
</div>
</div>
</div>
</li>
</ul>
<div class="text-center text-gray-4">
<text v-if="disabled">没有更多了</text>
<text @click="load" v-else>加载更多</text>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="hot-new bg-white p-1">
<div class="title bg-gray-50 p-2 flex items-center gap-xs"><el-icon><ElIconLink/></el-icon></div>
<div class="news-list p-3">
<a class="item py-1 block cursor-pointer" v-for="(item,index) in list">
{{item.title}}
</a>
</div>
</div>
<div class="view-rank bg-white p-1 mt-5">
<div class="title bg-gray-50 p-2 flex items-center gap-xs"><el-icon><ElIconLink/></el-icon></div>
<div class="news-list p-3">
<a class="item py-1 block cursor-pointer" v-for="(item,index) in list">
{{item.title}}
</a>
</div>
</div>
</el-col>
</el-row>
</div>
<el-divider />
<div v-if="!list">
<el-empty description="404 页面不存在"></el-empty>
</div>
</template>
<script setup lang="ts">
import type {ApiResult, PageResult} from "~/api";
import type {Article} from "~/api/cms/article/model";
import {useRequest} from "~/composables/useRequest";
import type {Design} from "~/api/cms/design/model";
import {useClientRequest} from "~/composables/useClientRequest";
import {pageArticle} from "~/api/cms/article";
const route = useRoute();
const { query, params } = route;
const { id } = params;
//
const list = ref<Article[]>([]);
const title = ref();
const categoryName = ref();
const count = ref()
const page = ref<number>(1);
const disabled = ref<boolean>(false);
const newList = ref<Article[]>();
//
const form = ref<Design | any>();
const load = () => {
if(!disabled.value){
page.value++;
reload();
}
}
//
const reload = async () => {
await useRequest<ApiResult<PageResult<Article>>>('/cms/article/page',{
params: {
page: page.value,
categoryId: id
}
}).then(res => {
const data = res.data.value?.data;
count.value = data?.count;
if (data?.list.length == 0) {
disabled.value = true;
return false;
}
if (page.value == 0) {
list.value = data?.list;
}else {
list.value = list.value.concat(data?.list);
}
// list.value = articleList.value.data?.list;
list.value.map((d,i)=>{
if(i === 0){
categoryName.value = d.categoryName;
form.value = d;
useHead({
title: `${d.categoryName} - 网宿软件`,
meta: [{ name: "keywords", content: d.title }],
bodyAttrs: {
class: "page-container",
},
script: [
{
children: "console.log('Hello World')",
},
],
});
}
});
})
}
reload();
</script>
<style scoped lang="scss">
</style>

70
pages/article/detail/[id].vue

@ -1,29 +1,25 @@
<template> <template>
<div class="banner" v-if="form.photo">
<div class="banner h-[60px]" v-if="form">
<el-image :src="form.photo"></el-image> <el-image :src="form.photo"></el-image>
</div> </div>
<div v-if="form" class="container flex flex-col w-[1280px] m-auto my-3">
<div v-if="form" class="flex flex-col w-full md:w-3/4 m-auto my-3">
<el-breadcrumb class="py-2" separator="/"> <el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: `/article/${form.categoryId}` }">{{ form.categoryName }}</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.title }}</el-breadcrumb-item>
<el-breadcrumb-item v-if="form.parentName" :to="{ path: '/article/' + form.categoryId}">{{ form.parentName }}</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/article/' + form.categoryId}">{{ form.categoryName }}</el-breadcrumb-item>
<el-breadcrumb-item>文章详情</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
<div :title="`标题${form.name}`" class="w-7xl m-auto mt-10">
<div class="title text-3xl text-center">{{ form.name }}</div>
<div v-html="form.content">
</div>
</div>
<div class="flex flex-wrap justify-between w-[1280px] m-auto my-3">
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="w-[155px] h-[218px] bg-gray-300"></div>
<div class="bg-white p-4 mt-4 flex flex-col gap-xl">
<div class="article-title-box p-4">
<div class="text-3xl">{{ form.title }}</div>
<div class="text-sm pt-3 text-gray-4 flex gap-xl">
<span>{{ form.createTime }}</span>
<span>浏览{{ form.actualViews }}</span>
</div>
<el-divider style="height: 1px " />
</div>
<div class="content leading-8 text-xl p-3 text-gray-8" v-html="form.content"></div>
</div> </div>
</div> </div>
<div v-if="!form"> <div v-if="!form">
@ -32,36 +28,34 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type {ApiResult} from "~/api"; import type {ApiResult} from "~/api";
import type {Article} from "~/api/cms/article/model";
import {useRequest} from "~/composables/useRequest"; import {useRequest} from "~/composables/useRequest";
import type {Goods} from "~/api/shop/goods/model";
import type {Article} from "~/api/cms/article/model";
const route = useRoute(); const route = useRoute();
const { query, params } = route; const { query, params } = route;
const { id} = params;
const { id } = params;
const activeName = ref('parameter');
const rate = ref(4);
// //
const form = ref<Article | any>(); const form = ref<Article | any>();
// //
const { data: article } = await useRequest<ApiResult<Article>>('/cms/article/' + id)
if (article.value) {
form.value = article.value.data;
useHead({
title: `${form.value.title} - 网宿软件`,
meta: [{ name: "keywords", content: "Nuxt Vue SSR Typescript" }],
bodyAttrs: {
class: "page-container",
},
script: [
{
children: "console.log('Hello World')",
},
],
});
const { data: info } = await useRequest<ApiResult<Article>>('/cms/article/' + id)
form.value = info.value?.data;
// form.value.files = JSON.parse(form.value.files);
form.value.num = 1;
form.value.radio = '0'
const handleClick = (tab, event) => {
console.log(tab, event);
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.content *{
max-width: 100%;
}
</style> </style>

133
pages/demo/[name].vue

@ -0,0 +1,133 @@
<template>
<div class="banner h-[60px]" v-if="form">
<el-image :src="form.photo"></el-image>
</div>
<div v-if="form" class="flex flex-col w-full md:w-3/4 m-auto my-3">
<el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.categoryParent }}</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.goodsName }}</el-breadcrumb-item>
</el-breadcrumb>
<div class="bg-white p-3 mt-3 flex items-center justify-between">
<div class="left flex gap-xs items-center">
<el-avatar shape="square" :size="55" />
<div class="shop-name flex flex-col">
<div class="shop-name cursor-pointer">
<div class="flex items-center">
<text class="text-xl">南宁市网宿信息科技有限公司</text>
<el-tag type="success" size="small" class="ml-2">官网</el-tag>
</div>
</div>
<el-rate
v-model="rate"
show-score
text-color="#ff9900"
score-template="{value}">
</el-rate>
</div>
</div>
<el-button>进入店铺</el-button>
</div>
<div class="bg-white p-4 mt-4 flex gap-xl">
<div class="goods-image flex gap-xl">
<div class="gap-xs flex flex-col">
<el-avatar v-for="item in form.files" :src="item.url" size="large" shape="square" />
</div>
<el-image :src="form.image" fit="contain" class="w-2xl h-2xl bg-gray-100 border-radius:30px"></el-image>
</div>
<div class="goods-info flex flex-col gap-xs">
<div class="goods-name text-2xl">{{ form.goodsName }}</div>
<div class="goods-price text-2xl red">{{ form.salePrice * form.num }}</div>
<div class="text-green-7">购买得积分</div>
<div class="text-gray-4">配送无需配送</div>
<div class="text-gray-4">保障假一赔四 退货包运费 极速退款</div>
<div class="text-gray-4">销量 {{ form.sales }}</div>
<template v-for="spec in form.goodsSpecValue">
<div class="flex items-center">
<div class="text-gray-4">{{ spec.value }}</div>
<el-radio-group v-model="form.radio">
<el-radio v-for="(specValue,specIndex) in spec.detail" :label="specIndex" border>{{ specValue }}</el-radio>
</el-radio-group>
</div>
</template>
<div class="text-gray-4">
已选中{{ form.radio }}
</div>
<div class="text-gray-4">
数量
<el-input-number v-model="form.num" @change="handleChange" :min="1" :max="10" label="描述文字"></el-input-number>
</div>
<div class="py-5">
<el-button-group size="large">
<el-button type="danger">立即购买</el-button>
<el-button type="warning">加入购物车</el-button>
</el-button-group>
<el-button size="large" class="ml-3">收藏</el-button>
</div>
</div>
</div>
<div class="content p-4 bg-white">
<el-tabs v-model="activeName" :lazy="true" @tab-click="handleClick">
<el-tab-pane label="参数信息" name="parameter">
<el-descriptions class="margin-top" title="参数信息" :column="1" border>
<el-descriptions-item label="品牌">websoft</el-descriptions-item>
<el-descriptions-item label="版本">2.0</el-descriptions-item>
<el-descriptions-item label="开发语言">JavaVue3Nuxt</el-descriptions-item>
<el-descriptions-item label="版本">
<el-tag size="small">授权版</el-tag>
</el-descriptions-item>
<el-descriptions-item label="备注">江苏省苏州市吴中区吴中大道 1188 </el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="图文详情" name="content">
<div class="files flex flex-col w-3/4">
<el-image v-for="item in form.files" :src="item.url" />
</div>
</el-tab-pane>
<el-tab-pane label="用户评价" name="reviews">用户评价</el-tab-pane>
</el-tabs>
</div>
</div>
<div v-if="!form">
<el-empty description="404 页面不存在"></el-empty>
</div>
<div title="调试数据" class="p-8 text-center">
页面ID {{ productName }}
页面数据{{ form }}
</div>
</template>
<script setup lang="ts">
import type {ApiResult} from "~/api";
import {useRequest} from "~/composables/useRequest";
import type {Goods} from "~/api/shop/goods/model";
const route = useRoute();
const { query, params } = route;
const { name: productName } = params;
const activeName = ref('parameter');
const rate = ref(4);
//
const form = ref<Goods | any>();
//
const { data: info } = await useRequest<ApiResult<Goods>>('/shop/goods/' + productName)
form.value = info.value?.data;
form.value.files = JSON.parse(form.value.files);
form.value.num = 1;
form.value.radio = '0'
const handleClick = (tab, event) => {
console.log(tab, event);
}
</script>
<style scoped lang="scss">
</style>

54
pages/product/[name].vue

@ -2,14 +2,35 @@
<div class="banner h-[60px]" v-if="form"> <div class="banner h-[60px]" v-if="form">
<el-image :src="form.photo"></el-image> <el-image :src="form.photo"></el-image>
</div> </div>
<div v-if="form" class="container flex flex-col m-auto my-3">
<div v-if="form" class="flex flex-col w-full md:w-3/4 m-auto my-3">
<el-breadcrumb class="py-2" separator="/"> <el-breadcrumb class="py-2" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.categoryParent }}</el-breadcrumb-item> <el-breadcrumb-item>{{ form.categoryParent }}</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.goodsName }}</el-breadcrumb-item> <el-breadcrumb-item>{{ form.goodsName }}</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
<div class="goods-box bg-white p-4 m-auto mt-3 flex gap-xl">
<div class="bg-white p-3 mt-3 flex items-center justify-between">
<div class="left flex gap-xs items-center">
<el-avatar shape="square" :size="55" />
<div class="shop-name flex flex-col">
<div class="shop-name cursor-pointer">
<div class="flex items-center">
<text class="text-xl">南宁市网宿信息科技有限公司</text>
<el-tag type="success" size="small" class="ml-2">官网</el-tag>
</div>
</div>
<el-rate
v-model="rate"
show-score
text-color="#ff9900"
score-template="{value}">
</el-rate>
</div>
</div>
<el-button>进入店铺</el-button>
</div>
<div class="bg-white p-4 mt-4 flex gap-xl">
<div class="goods-image flex gap-xl"> <div class="goods-image flex gap-xl">
<div class="gap-xs flex flex-col"> <div class="gap-xs flex flex-col">
<el-avatar v-for="item in form.files" :src="item.url" size="large" shape="square" /> <el-avatar v-for="item in form.files" :src="item.url" size="large" shape="square" />
@ -40,43 +61,38 @@
</div> </div>
<div class="py-5"> <div class="py-5">
<el-button-group size="large"> <el-button-group size="large">
<el-button type="primary">立即购买</el-button>
<el-button type="primary">加入购物车</el-button>
<el-button type="danger">立即购买</el-button>
<el-button type="warning">加入购物车</el-button>
</el-button-group> </el-button-group>
<el-button size="large" class="ml-3">收藏</el-button> <el-button size="large" class="ml-3">收藏</el-button>
</div> </div>
</div> </div>
</div> </div>
<div class="content w-7xl m-auto p-4 bg-white">
<div class="content p-4 bg-white">
<el-tabs v-model="activeName" :lazy="true" @tab-click="handleClick"> <el-tabs v-model="activeName" :lazy="true" @tab-click="handleClick">
<el-tab-pane label="参数信息" name="parameter"> <el-tab-pane label="参数信息" name="parameter">
<el-descriptions class="margin-top" title="参数信息" :column="3" border>
<el-descriptions-item label="用户名">kooriookami</el-descriptions-item>
<el-descriptions-item label="手机号">18100000000</el-descriptions-item>
<el-descriptions-item label="居住地">苏州市</el-descriptions-item>
<el-descriptions-item label="备注">
<el-tag size="small">学校</el-tag>
<el-descriptions class="margin-top" title="参数信息" :column="1" border>
<el-descriptions-item label="品牌">websoft</el-descriptions-item>
<el-descriptions-item label="版本">2.0</el-descriptions-item>
<el-descriptions-item label="开发语言">JavaVue3Nuxt</el-descriptions-item>
<el-descriptions-item label="版本">
<el-tag size="small">授权版</el-tag>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 </el-descriptions-item>
<el-descriptions-item label="备注">江苏省苏州市吴中区吴中大道 1188 </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="图文详情" name="content"> <el-tab-pane label="图文详情" name="content">
<div class="files flex flex-col">
<div class="files flex flex-col w-3/4">
<el-image v-for="item in form.files" :src="item.url" /> <el-image v-for="item in form.files" :src="item.url" />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="用户评价" name="reviews">用户评价</el-tab-pane> <el-tab-pane label="用户评价" name="reviews">用户评价</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</div> </div>
<div v-if="!form"> <div v-if="!form">
<el-empty description="404 页面不存在"></el-empty> <el-empty description="404 页面不存在"></el-empty>
</div> </div>
<div title="调试数据" class="p-8 text-center">
页面ID {{ productName }}
页面数据{{ form }}
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type {ApiResult} from "~/api"; import type {ApiResult} from "~/api";
@ -87,7 +103,7 @@ const route = useRoute();
const { query, params } = route; const { query, params } = route;
const { name: productName } = params; const { name: productName } = params;
const activeName = ref('parameter'); const activeName = ref('parameter');
console.log(productName,'productName..')
const rate = ref(4);
// //

BIN
public/favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

5
utils/request.ts

@ -17,7 +17,7 @@ const service = axios.create({
*/ */
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
const tid = localStorage.getItem('TenantId');
const tid = TENANT_ID;
const token = getToken(); const token = getToken();
// 添加 token 到 header // 添加 token 到 header
if (token && config.headers) { if (token && config.headers) {
@ -41,7 +41,8 @@ service.interceptors.request.use(
// return config; // return config;
// } // }
if (TENANT_ID) { if (TENANT_ID) {
config.headers.common['TenantId'] = TENANT_ID;
console.log(tid,TENANT_ID);
config.headers['TenantId'] = TENANT_ID;
return config; return config;
} }
} }

Loading…
Cancel
Save