|
@@ -1,5 +1,5 @@
|
|
import ColHeader from '@/components/col-header'
|
|
import ColHeader from '@/components/col-header'
|
|
-import { Button, Cell, Icon, Image, Toast } from 'vant'
|
|
|
|
|
|
+import { Button, Cell, Icon, Image, Popup, Toast } from 'vant'
|
|
import { defineComponent } from 'vue'
|
|
import { defineComponent } from 'vue'
|
|
import styles from './index.module.less'
|
|
import styles from './index.module.less'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
@@ -7,11 +7,14 @@ import { setLogin, state } from '@/state'
|
|
import iconStudent from '@common/images/icon_student.png'
|
|
import iconStudent from '@common/images/icon_student.png'
|
|
import iconTeacher from '@common/images/icon_teacher.png'
|
|
import iconTeacher from '@common/images/icon_teacher.png'
|
|
import iconGift from './images/icon_gift.png'
|
|
import iconGift from './images/icon_gift.png'
|
|
|
|
+import iconShare from '../music/album/icon_share2.svg'
|
|
import iconDiscount from './images/icon_discount.png'
|
|
import iconDiscount from './images/icon_discount.png'
|
|
|
|
+import iconMemberLogo from './images/member_logo.png'
|
|
import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
import { memberType } from '@/constant'
|
|
import { memberType } from '@/constant'
|
|
import { moneyFormat } from '@/helpers/utils'
|
|
import { moneyFormat } from '@/helpers/utils'
|
|
|
|
+import ColShare from '@/components/col-share'
|
|
|
|
|
|
export const getAssetsHomeFile = (fileName: string) => {
|
|
export const getAssetsHomeFile = (fileName: string) => {
|
|
const path = `./images/${fileName}`
|
|
const path = `./images/${fileName}`
|
|
@@ -40,7 +43,10 @@ export default defineComponent({
|
|
avatar: '',
|
|
avatar: '',
|
|
discount: 0,
|
|
discount: 0,
|
|
username: ''
|
|
username: ''
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ shareStatus: false,
|
|
|
|
+ shareUrl: '',
|
|
|
|
+ shareDiscount: 0 // 是否有优惠活动
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -50,6 +56,7 @@ export default defineComponent({
|
|
username: users?.username,
|
|
username: users?.username,
|
|
phone: users?.phone,
|
|
phone: users?.phone,
|
|
avatar: users?.heardUrl,
|
|
avatar: users?.heardUrl,
|
|
|
|
+ id: users?.userId,
|
|
memberRankSettingId: users?.memberRankSettingId,
|
|
memberRankSettingId: users?.memberRankSettingId,
|
|
membershipDays: users?.membershipDays,
|
|
membershipDays: users?.membershipDays,
|
|
membershipEndTime: users?.membershipEndTime
|
|
membershipEndTime: users?.membershipEndTime
|
|
@@ -58,9 +65,11 @@ export default defineComponent({
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
try {
|
|
try {
|
|
- const userInfo = await request.get('/api-student/student/queryUserInfo', {
|
|
|
|
- initRequest: true // 初始化接口
|
|
|
|
- })
|
|
|
|
|
|
+ const userInfo = await request.get(
|
|
|
|
+ state.platformType === 'TEACHER'
|
|
|
|
+ ? '/api-teacher/teacher/queryUserInfo'
|
|
|
|
+ : '/api-student/student/queryUserInfo'
|
|
|
|
+ )
|
|
setLogin(userInfo.data)
|
|
setLogin(userInfo.data)
|
|
|
|
|
|
const res = await request.post(
|
|
const res = await request.post(
|
|
@@ -115,9 +124,34 @@ export default defineComponent({
|
|
} catch {}
|
|
} catch {}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ async onShare() {
|
|
|
|
+ try {
|
|
|
|
+ const res = await request.post('/api-teacher/open/vipProfit', {
|
|
|
|
+ data: {
|
|
|
|
+ userId: this.userInfo.id
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // 只有老师端才会有分享功能
|
|
|
|
+ this.shareUrl = `${location.origin}/teacher#/shareVip?recomUserId=${this.userInfo.id}&activityId=${res.data.activityId}`
|
|
|
|
+ this.shareStatus = true
|
|
|
|
+ this.shareDiscount = res.data.discount || 0
|
|
|
|
+ // let url =
|
|
|
|
+ // location.origin +
|
|
|
|
+ // `/accompany/colexiu-share.html?id=${moreData.value.id}&recomUserId=${state.user.data?.userId}`
|
|
|
|
+ // // 判断是否有活动
|
|
|
|
+ // if (res.data.discount === 1) {
|
|
|
|
+ // url += `&activityId=${res.data.activityId}`
|
|
|
|
+ // }
|
|
|
|
+ // shareDiscount.value = res.data.discount || 0
|
|
|
|
+ // shareUrl.value = url
|
|
|
|
+ // isMore.value = false
|
|
|
|
+ // shareStatus.value = true
|
|
|
|
+ return
|
|
|
|
+ } catch {}
|
|
|
|
+ },
|
|
calcSalePrice(item: any) {
|
|
calcSalePrice(item: any) {
|
|
// discount
|
|
// discount
|
|
-
|
|
|
|
if (item.discount === 1) {
|
|
if (item.discount === 1) {
|
|
const tempPrice = Number(
|
|
const tempPrice = Number(
|
|
(item.salePrice - item.discountPrice).toFixed(2)
|
|
(item.salePrice - item.discountPrice).toFixed(2)
|
|
@@ -173,7 +207,18 @@ export default defineComponent({
|
|
render() {
|
|
render() {
|
|
return (
|
|
return (
|
|
<div class={styles['member-center']}>
|
|
<div class={styles['member-center']}>
|
|
- <ColHeader background="#ffe5cc" />
|
|
|
|
|
|
+ <ColHeader
|
|
|
|
+ background="#ffe5cc"
|
|
|
|
+ v-slots={{
|
|
|
|
+ right: () =>
|
|
|
|
+ state.platformType === 'TEACHER' && (
|
|
|
|
+ <div class={styles.shareBtn} onClick={this.onShare}>
|
|
|
|
+ <Image src={iconShare} />
|
|
|
|
+ 分享
|
|
|
|
+ </div>
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
<div class={styles.member_container}>
|
|
<div class={styles.member_container}>
|
|
<Cell
|
|
<Cell
|
|
class={styles.userMember}
|
|
class={styles.userMember}
|
|
@@ -328,6 +373,30 @@ export default defineComponent({
|
|
立即支付
|
|
立即支付
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <Popup
|
|
|
|
+ v-model:show={this.shareStatus}
|
|
|
|
+ style={{ background: 'transparent' }}
|
|
|
|
+ >
|
|
|
|
+ <ColShare
|
|
|
|
+ teacherId={this.userInfo.id}
|
|
|
|
+ shareUrl={this.shareUrl}
|
|
|
|
+ shareType="vip"
|
|
|
|
+ shareLength={2}
|
|
|
|
+ >
|
|
|
|
+ <div class={styles.shareVip}>
|
|
|
|
+ {this.shareDiscount === 1 && (
|
|
|
|
+ <div class={styles.tagDiscount}>专属优惠</div>
|
|
|
|
+ )}
|
|
|
|
+
|
|
|
|
+ <img class={styles.icon} src={iconMemberLogo} />
|
|
|
|
+ <div class={styles.info}>
|
|
|
|
+ <h4 class="van-multi-ellipsis--l2">小酷Ai会员</h4>
|
|
|
|
+ <p>海量曲谱、智能评测,专为器乐学习者量身打造</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </ColShare>
|
|
|
|
+ </Popup>
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|