|
@@ -1,13 +1,15 @@
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
-import { Button, Cell, Icon, Image, Popup, Toast } from 'vant'
|
|
|
+import { Button, Cell, Dialog, Icon, Image, Popup, Toast } from 'vant'
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
|
import shareBanner from '../images/share-banner.png'
|
|
|
import wxImage from '../images/wx_bg.png'
|
|
|
-import { shareCall } from '../share'
|
|
|
+import { shareCall, initJumpNativePage } from '../share'
|
|
|
import { browser } from '@/helpers/utils'
|
|
|
+import { postMessage } from '@/helpers/native-message'
|
|
|
+import qs from 'query-string'
|
|
|
|
|
|
export const getAssetsHomeFile = (fileName: string) => {
|
|
|
const path = `../../../views/member-center/images/${fileName}`
|
|
@@ -19,11 +21,16 @@ export default defineComponent({
|
|
|
name: 'MemberCenter',
|
|
|
data() {
|
|
|
const query = this.$route.query
|
|
|
+ const tmpUrl = `${location.origin}/student/#/memberCenter?${qs.stringify(
|
|
|
+ query
|
|
|
+ )}`
|
|
|
return {
|
|
|
activityId: query.activityId,
|
|
|
recomUserId: query.recomUserId,
|
|
|
+ discount: 0,
|
|
|
functionList: [],
|
|
|
- wxStatus: false
|
|
|
+ wxStatus: false,
|
|
|
+ jumpUrl: tmpUrl
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -40,6 +47,9 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ initJumpNativePage(this.jumpUrl)
|
|
|
+ },
|
|
|
async mounted() {
|
|
|
try {
|
|
|
const res = await request.post(
|
|
@@ -52,24 +62,24 @@ export default defineComponent({
|
|
|
icon: getAssetsHomeFile(`${item.paramValue}.png`)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ const active = await request.post(
|
|
|
+ `/api-teacher/open/activity/state/${this.activityId}`
|
|
|
+ )
|
|
|
+ this.discount = active.data.check || 0
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- reCall() {
|
|
|
- const { origin } = location
|
|
|
- let str = origin + '/student/#/memberCenter'
|
|
|
- const params = this.$route.query
|
|
|
- str += `?recomUserId=${this.recomUserId}&activityId=${params.activityId}`
|
|
|
- shareCall(str, {})
|
|
|
- },
|
|
|
onShare() {
|
|
|
if (browser().weixin) {
|
|
|
this.wxStatus = true
|
|
|
return
|
|
|
}
|
|
|
- this.reCall()
|
|
|
+ // 尝试拉起app
|
|
|
+ shareCall(this.jumpUrl)
|
|
|
+ // 不管有没有拉起app则都跳转到下载app
|
|
|
setTimeout(() => {
|
|
|
window.location.href = location.origin + '/student/#/download'
|
|
|
}, 3000)
|
|
@@ -102,7 +112,13 @@ export default defineComponent({
|
|
|
</div>
|
|
|
)}
|
|
|
</div>
|
|
|
- <div class={['btnGroup']} style={{ paddingTop: '12px' }}>
|
|
|
+ <div
|
|
|
+ class={['btnGroup']}
|
|
|
+ style={{ paddingTop: '12px', position: 'relative' }}
|
|
|
+ >
|
|
|
+ {this.discount === 1 && (
|
|
|
+ <div class={styles.tagDiscount}>专属优惠</div>
|
|
|
+ )}
|
|
|
<Button
|
|
|
block
|
|
|
round
|