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

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

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