【修复】商品详情页,未登录状态下,需要登录的问题

pull/60/head
YunaiV 2024-07-17 23:35:39 +08:00
parent 508bd9cbd7
commit 2ea027a6e0
2 changed files with 13 additions and 16 deletions

View File

@ -99,14 +99,8 @@
</template>
<script setup>
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll
} from '@dcloudio/uni-app';
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import CouponApi from '@/sheep/api/promotion/coupon';
import ActivityApi from '@/sheep/api/promotion/activity';
@ -124,7 +118,8 @@
onPageScroll(() => {});
const state = reactive({
const isLogin = computed(() => sheep.$store('user').isLogin);
const state = reactive({
goodsId: 0,
skeletonLoading: true, // SPU
goodsInfo: {}, // SPU
@ -235,12 +230,14 @@
state.goodsInfo = res.data;
//
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
if (res.code !== 0) {
return;
}
state.goodsInfo.favorite = res.data;
});
if (isLogin.value) {
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
if (res.code !== 0) {
return;
}
state.goodsInfo.favorite = res.data;
});
}
});
// 2.

View File

@ -1,7 +1,7 @@
import request from '@/sheep/request';
const BrokerageApi = {
// 绑定推广员
// 绑定分销用户
bindBrokerageUser: (data)=>{
return request({
url: '/trade/brokerage-user/bind',