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,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 | 1. 在根目录执行 sh deploy/prod.sh | 18 | 1. 在根目录执行 sh deploy/prod.sh |
16 | -2. 登录112服务器,,将镜像拷贝到生产的47服务器 | 19 | +1. 登录112服务器,,将镜像拷贝到生产的47服务器 |
17 | 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 | 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,7 +4,7 @@ | ||
4 | </template> | 4 | </template> |
5 | 5 | ||
6 | <script setup lang="ts"> | 6 | <script setup lang="ts"> |
7 | -import {onMounted} from 'vue' | 7 | +import { onMounted } from 'vue' |
8 | import ProductDetail from '~/components/ProductDetail.vue' | 8 | import ProductDetail from '~/components/ProductDetail.vue' |
9 | import MobileProductDetail from '~/components/MobileProductDetail.vue' | 9 | import MobileProductDetail from '~/components/MobileProductDetail.vue' |
10 | import type { Product, ProductImage } from '~/type' | 10 | import type { Product, ProductImage } from '~/type' |
@@ -20,11 +20,10 @@ const info = ref<Partial<Product>>({ | @@ -20,11 +20,10 @@ const info = ref<Partial<Product>>({ | ||
20 | }) | 20 | }) |
21 | 21 | ||
22 | let { data: resData } = await useAsyncData('detail', () => $fetch('/shop/product/detail', { | 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 | server: true // 仅在服务器端获取数据 | 28 | server: true // 仅在服务器端获取数据 |
30 | }) | 29 | }) |
stores/category.ts
@@ -15,11 +15,7 @@ export const useCategoryStore = defineStore('category', () => { | @@ -15,11 +15,7 @@ export const useCategoryStore = defineStore('category', () => { | ||
15 | const config = useRuntimeConfig() | 15 | const config = useRuntimeConfig() |
16 | // 在SSR中,数据仅在服务器端获取并传递到客户端。 | 16 | // 在SSR中,数据仅在服务器端获取并传递到客户端。 |
17 | const { data } = await useAsyncData('category', () => $fetch('/shop/product/category', { | 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 | server: true // 仅在服务器端获取数据 | 20 | server: true // 仅在服务器端获取数据 |
25 | }) | 21 | }) |
stores/product_list.ts
@@ -15,18 +15,14 @@ export const useProductListStore = defineStore('productList', () => { | @@ -15,18 +15,14 @@ export const useProductListStore = defineStore('productList', () => { | ||
15 | const getList = async (params: ProductListQuery) => { | 15 | const getList = async (params: ProductListQuery) => { |
16 | if (params.productCategoryId || params.keyword) { | 16 | if (params.productCategoryId || params.keyword) { |
17 | const { data } = await useAsyncData('product', () => $fetch('/shop/product/list', { | 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 | ...params, | 20 | ...params, |
24 | pageNo: pageNo.value, | 21 | pageNo: pageNo.value, |
25 | pageSize: pageSize.value | 22 | pageSize: pageSize.value |
26 | - }) | ||
27 | - })) | ||
28 | - | ||
29 | - // const data = res.data?.data || {} | 23 | + } |
24 | + })); | ||
25 | + | ||
30 | list.value = | 26 | list.value = |
31 | (data.value?.data?.records || []).map((record: Product) => ({ | 27 | (data.value?.data?.records || []).map((record: Product) => ({ |
32 | ...record, | 28 | ...record, |