Commit 9016b5f7ad39f68ba675012de7362b281b0f959e
1 parent
58bcdc8e
feat: 将post修改为get
Showing
4 changed files
with
20 additions
and
25 deletions
README.md
... | ... | @@ -12,11 +12,15 @@ docker run -d -p 8088:3000 --name canrud-outside-front canrud-outside-front:dev |
12 | 12 | ``` |
13 | 13 | |
14 | 14 | # 生产部署 |
15 | +生产环境部署一定要更新tag,这样有问题可以快速回滚。 | |
16 | + | |
17 | +1. 修改 deploy/prod.sh的 TAG 将版本号+1,默认改动小版本,如1.0.0->1.0.1 | |
15 | 18 | 1. 在根目录执行 sh deploy/prod.sh |
16 | -2. 登录112服务器,,将镜像拷贝到生产的47服务器 | |
19 | +1. 登录112服务器,,将镜像拷贝到生产的47服务器 | |
17 | 20 | scp /root/web/canrud-outside-nuxt-front/canrud-outside-front_1.0.0.tar root@47.89.254.121:/root/web/canrud-outside-nuxt-front |
18 | -3. 登录47服务器,进入到 /root/web/canrud-outside-nuxt-front 目录 | |
19 | -4. 启动服务 | |
20 | -docker run -d -p 3000:3000 -e BASE_URL=http://localhost:8002 --name canrud-outside-front canrud-outside-front:beta | |
21 | +1. 登录47服务器,进入到 /root/web/canrud-outside-nuxt-front 目录 | |
22 | +1. 加载镜像 docker load -i canrud-outside-front_1.0.0.tar (1.0.0对应你的tag) | |
23 | +1. 修改 docker-compose.yaml 的镜像版本号 | |
24 | +1. 启动服务 docker-compose up -d | |
25 | + | |
21 | 26 | |
22 | -docker run -d -p 8088:3000 -e BASE_URL=http://localhost:8002 --name canrud-outside-front canrud-outside-front:1.0.0 | ... | ... |
pages/products/detail/[id]/index.vue
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | </template> |
5 | 5 | |
6 | 6 | <script setup lang="ts"> |
7 | -import {onMounted} from 'vue' | |
7 | +import { onMounted } from 'vue' | |
8 | 8 | import ProductDetail from '~/components/ProductDetail.vue' |
9 | 9 | import MobileProductDetail from '~/components/MobileProductDetail.vue' |
10 | 10 | import type { Product, ProductImage } from '~/type' |
... | ... | @@ -20,11 +20,10 @@ const info = ref<Partial<Product>>({ |
20 | 20 | }) |
21 | 21 | |
22 | 22 | let { data: resData } = await useAsyncData('detail', () => $fetch('/shop/product/detail', { |
23 | - method: 'POST', | |
24 | - headers: { | |
25 | - 'Content-Type': 'application/json' | |
26 | - }, | |
27 | - body: JSON.stringify({ id: route.params.id }) | |
23 | + method: 'GET', | |
24 | + params: { | |
25 | + id: route.params.id | |
26 | + } | |
28 | 27 | }), { |
29 | 28 | server: true // 仅在服务器端获取数据 |
30 | 29 | }) | ... | ... |
stores/category.ts
... | ... | @@ -15,11 +15,7 @@ export const useCategoryStore = defineStore('category', () => { |
15 | 15 | const config = useRuntimeConfig() |
16 | 16 | // 在SSR中,数据仅在服务器端获取并传递到客户端。 |
17 | 17 | const { data } = await useAsyncData('category', () => $fetch('/shop/product/category', { |
18 | - method: 'POST', | |
19 | - headers: { | |
20 | - 'Content-Type': 'application/json' | |
21 | - }, | |
22 | - body: JSON.stringify({}) | |
18 | + method: 'GET', | |
23 | 19 | }), { |
24 | 20 | server: true // 仅在服务器端获取数据 |
25 | 21 | }) | ... | ... |
stores/product_list.ts
... | ... | @@ -15,18 +15,14 @@ export const useProductListStore = defineStore('productList', () => { |
15 | 15 | const getList = async (params: ProductListQuery) => { |
16 | 16 | if (params.productCategoryId || params.keyword) { |
17 | 17 | const { data } = await useAsyncData('product', () => $fetch('/shop/product/list', { |
18 | - method: 'POST', | |
19 | - headers: { | |
20 | - 'Content-Type': 'application/json' | |
21 | - }, | |
22 | - body: JSON.stringify({ | |
18 | + method: 'GET', | |
19 | + params: { | |
23 | 20 | ...params, |
24 | 21 | pageNo: pageNo.value, |
25 | 22 | pageSize: pageSize.value |
26 | - }) | |
27 | - })) | |
28 | - | |
29 | - // const data = res.data?.data || {} | |
23 | + } | |
24 | + })); | |
25 | + | |
30 | 26 | list.value = |
31 | 27 | (data.value?.data?.records || []).map((record: Product) => ({ |
32 | 28 | ...record, | ... | ... |