提交 9018d4d4 authored 作者: matian's avatar matian

课程包默认一直显示立即购买

上级 f130878d
......@@ -2,9 +2,9 @@
import { useWindowScroll } from '@vueuse/core'
import { useUserStore } from '@/stores/user'
import AppNav from './Nav.vue'
import { ElMessage } from 'element-plus'
// import { ElMessage } from 'element-plus'
import { useDevice } from '@/composables/useDevice'
const courseStore = useUserStore()
// const courseStore = useUserStore()
interface Props {
fixed?: boolean
......@@ -12,12 +12,8 @@ interface Props {
const props = defineProps<Props>()
const user = useUserStore()
const LOGIN_URL = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(
location.href
)}`
const REGISTER_URL = `${
import.meta.env.VITE_REGISTER_URL
}?rd=${encodeURIComponent(location.href)}`
const LOGIN_URL = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
const REGISTER_URL = `${import.meta.env.VITE_REGISTER_URL}?rd=${encodeURIComponent(location.href)}`
user.getUser()
const classNames = computed(() => {
......@@ -67,24 +63,14 @@ function handleUser() {
</div>
<AppNav></AppNav>
<div class="app-header-right" v-if="!mobile">
<div
class="study"
@click="handleStudy"
v-if="user.isLogin && user.courses.length > 0"
>
立即学习
</div>
<div class="study" @click="handleStudy" v-if="user.isLogin && user.courses.length > 0">立即学习</div>
<template v-if="user.isLogin">
<div @click="handleOrder" style="cursor: pointer">
你好,{{ user.userName }}
</div>
<div @click="handleOrder" style="cursor: pointer">你好,{{ user.userName }}</div>
<div class="app-header-logout" @click="handleLogout">退出</div>
</template>
<template v-else>
<a :href="LOGIN_URL" class="button-default">登录</a>
<a class="button-primary" :href="REGISTER_URL" target="_blank"
>注册</a
>
<a class="button-primary" :href="REGISTER_URL" target="_blank">注册</a>
</template>
</div>
<div class="app-header-right" v-else>
......@@ -109,18 +95,13 @@ function handleUser() {
left: 0;
right: 0;
color: #fff;
background: linear-gradient(
0deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.5) 100%
);
background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
.logo {
background: url('@/assets/images/logo_white.png') no-repeat;
background-size: contain;
}
.app-header-logout {
background: url('https://webapp-pub.ezijing.com/project_online/fi/logout_white.png')
no-repeat left center;
background: url('https://webapp-pub.ezijing.com/project_online/fi/logout_white.png') no-repeat left center;
background-size: 18px;
}
.button-default {
......@@ -162,8 +143,7 @@ function handleUser() {
}
.app-header-logout {
background: url('https://webapp-pub.ezijing.com/project/saas/logout.png')
no-repeat left center;
background: url('https://webapp-pub.ezijing.com/project/saas/logout.png') no-repeat left center;
background-size: 18px;
padding-left: 32px;
margin-left: 40px;
......
......@@ -17,7 +17,7 @@ const buyDialogVisible = ref(false)
const handleBuyCourse = () => {
if (user.isLogin) {
if (props.payStatus === '4' || props.shopItem?.isBuy === true) {
if ((props.payStatus === '4' || props.shopItem?.isBuy === true) && props.shopItem?.type === '课程') {
window.open('https://paa-learning.ezijing.com')
} else {
if (props.shopItem?.type === '课程包') {
......@@ -27,18 +27,13 @@ const handleBuyCourse = () => {
}
}
} else {
window.location.href = `${
import.meta.env.VITE_LOGIN_URL
}?rd=${encodeURIComponent(location.href)}`
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
}
}
</script>
<template>
<div class="detail_footer" v-if="!mobile">
<div
class="left_status"
v-if="payStatus === '4' || shopItem?.isBuy === true"
>
<div class="left_status" v-if="(payStatus === '4' || shopItem?.isBuy === true) && shopItem?.type === '课程'">
已购买
</div>
<template v-else>
......@@ -53,16 +48,11 @@ const handleBuyCourse = () => {
</template>
<div class="footer_btn" @click="handleBuyCourse">
{{
payStatus === '4' || shopItem?.isBuy === true ? '立即学习' : '立即购买'
}}
{{ (payStatus === '4' || shopItem?.isBuy === true) && shopItem?.type === '课程' ? '立即学习' : '立即购买' }}
</div>
</div>
<div class="detail_footer" v-else>
<div
class="left_status"
v-if="payStatus === '4' || shopItem?.isBuy === true"
>
<div class="left_status" v-if="(payStatus === '4' || shopItem?.isBuy === true) && shopItem?.type === '课程'">
已购买
</div>
<template v-else>
......@@ -79,7 +69,7 @@ const handleBuyCourse = () => {
<div
class="footer_btn"
@click="handleBuyCourse"
v-if="payStatus === '4' || shopItem?.isBuy === true"
v-if="(payStatus === '4' || shopItem?.isBuy === true) && shopItem?.type === '课程'"
>
<div class="btn_buy">立即学习</div>
</div>
......@@ -94,8 +84,6 @@ const handleBuyCourse = () => {
<ContactDialog v-model:buyDialogVisible="buyDialogVisible" />
</template>
<style lang="scss" scoped>
.is-pc {
.detail_footer {
......@@ -223,4 +211,4 @@ const handleBuyCourse = () => {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -21,7 +21,7 @@ const handleDatail = (item: any) => {
}
const handleBuy = (courseItem: any) => {
if (user.isLogin) {
if (courseItem?.isBuy === true) {
if (courseItem?.isBuy === true && courseItem?.type === '课程') {
window.open('https://paa-learning.ezijing.com')
} else {
if (courseItem.type === '课程包') {
......@@ -31,9 +31,7 @@ const handleBuy = (courseItem: any) => {
}
}
} else {
window.location.href = `${
import.meta.env.VITE_LOGIN_URL
}?rd=${encodeURIComponent(location.href)}`
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
}
}
</script>
......@@ -70,15 +68,9 @@ const handleBuy = (courseItem: any) => {
<div class="price_num">{{ courseItem?.price }}</div>
</div>
<div class="bottom_btn">
<div
class="btn_detail"
v-if="!mobile"
@click="handleDatail(courseItem?.id)"
>
查看详情
</div>
<div class="btn_detail" v-if="!mobile" @click="handleDatail(courseItem?.id)">查看详情</div>
<div class="btn_buy" @click="handleBuy(courseItem)">
{{ courseItem?.isBuy === true ? '立即学习' : '立即购买' }}
{{ courseItem?.isBuy === true && courseItem?.type === '课程' ? '立即学习' : '立即购买' }}
</div>
</div>
</div>
......
......@@ -32,7 +32,7 @@ const shareTit = computed(() => {
// 购买课程
const handleBuyCourse = () => {
if (user.isLogin) {
if (props.payStatus === '4' || props.shopItem?.isBuy === true) {
if ((props.payStatus === '4' || props.shopItem?.isBuy === true) && props.shopItem?.type === '课程') {
window.open('https://paa-learning.ezijing.com')
} else {
if (props.shopItem?.type === '课程包') {
......@@ -42,9 +42,7 @@ const handleBuyCourse = () => {
}
}
} else {
window.location.href = `${
import.meta.env.VITE_LOGIN_URL
}?rd=${encodeURIComponent(location.href)}`
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
}
}
// 控制复制弹窗显示
......@@ -60,8 +58,8 @@ const onCopy = (val: any) => {
if (navigator.clipboard) {
return navigator.clipboard
.writeText(val)
.then((text) => {})
.catch((err) => {
.then(text => {})
.catch(err => {
onExecCommand(val)
})
} else {
......@@ -118,10 +116,7 @@ const handleCopyLink = () => {
</div>
<div class="con_share">
<div class="share_btn" @click="handleShare">
<img
src="https://webapp-pub.ezijing.com/project_online/fi/icon_share.png"
alt=""
/>
<img src="https://webapp-pub.ezijing.com/project_online/fi/icon_share.png" alt="" />
分享
</div>
</div>
......@@ -130,10 +125,7 @@ const handleCopyLink = () => {
</div>
<div class="detail_buy">
<div class="buy_left">
<div
class="left_status"
v-if="payStatus === '4' || shopItem?.isBuy === true"
>
<div class="left_status" v-if="payStatus === '4' || (shopItem?.isBuy === true && shopItem?.type === '课程')">
已购买
</div>
<div class="left_price" v-else>
......@@ -146,9 +138,7 @@ const handleCopyLink = () => {
</div>
</div>
<div class="buy_right" @click="handleBuyCourse" v-if="!mobile">
{{
payStatus === '4' || shopItem?.isBuy === true ? '立即学习' : '立即购买'
}}
{{ (payStatus === '4' || shopItem?.isBuy === true) && shopItem?.type === '课程' ? '立即学习' : '立即购买' }}
</div>
</div>
<div class="detail_info" v-if="mobile">
......@@ -160,9 +150,7 @@ const handleCopyLink = () => {
<div style="display: flex; justify-content: space-between">
<div class="info_tips">{{ shopItem?.course_card }}</div>
<div class="info_share" @click="show = true">
<img
src="https://webapp-pub.ezijing.com/project_online/fi/share_h5.png"
/>
<img src="https://webapp-pub.ezijing.com/project_online/fi/share_h5.png" />
</div>
</div>
......@@ -185,34 +173,20 @@ const handleCopyLink = () => {
</div>
</div>
<div>
<van-action-sheet
v-model:show="show"
:title="shareTit"
@close="handleCancel"
@click-overlay="handleCancel"
>
<van-action-sheet v-model:show="show" :title="shareTit" @close="handleCancel" @click-overlay="handleCancel">
<div class="content" v-if="isShowShare === '1'">
<div class="content_con" @click="handleCopy">
<img
src="https://webapp-pub.ezijing.com/project_online/fi/wechat_share.png"
alt=""
/>
<img src="https://webapp-pub.ezijing.com/project_online/fi/wechat_share.png" alt="" />
<div class="con_txt">微信</div>
</div>
<div class="content_con" @click="handleCopyLink">
<img
src="https://webapp-pub.ezijing.com/project_online/fi/link_share.png"
alt=""
/>
<img src="https://webapp-pub.ezijing.com/project_online/fi/link_share.png" alt="" />
<div class="con_txt">复制链接</div>
</div>
</div>
<div class="content1" v-if="isShowShare === '3'">
<div class="content_con">
<img
src="https://webapp-pub.ezijing.com/project_online/fi/copy_success.png"
alt=""
/>
<img src="https://webapp-pub.ezijing.com/project_online/fi/copy_success.png" alt="" />
<div class="con_tit">已复制链接</div>
<div class="con_desc con_desc1">快去分享给好友吧!</div>
</div>
......@@ -236,8 +210,8 @@ const handleCopyLink = () => {
.detail_banner {
width: 100%;
height: 370px;
background: url('https://webapp-pub.ezijing.com/project_online/fi/course_detail_banner.jpg')
no-repeat center / 100% 100%;
background: url('https://webapp-pub.ezijing.com/project_online/fi/course_detail_banner.jpg') no-repeat center / 100%
100%;
.banner_con {
width: 1200px;
......@@ -555,4 +529,4 @@ const handleCopyLink = () => {
:deep(.van-action-sheet__header) {
height: 1rem;
}
</style>
\ No newline at end of file
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论