|
@@ -15,7 +15,7 @@
|
|
|
<!-- 学习天数 -->
|
|
|
<div class="learn-day" v-if="posterShowState" >
|
|
|
<div class="user-ava" >
|
|
|
- <img :src="staticImg.learnReportBg" alt="">
|
|
|
+ <img :src="state.report?.profilePhoto" alt="">
|
|
|
</div>
|
|
|
<div class="user-name" >{{state.report?.userNickName}}</div>
|
|
|
<div class="learn-day-desc" >
|
|
@@ -59,7 +59,7 @@
|
|
|
<div class="decator" >
|
|
|
<img :src="staticImg.decator" alt="">
|
|
|
</div>
|
|
|
- <div class="audio-play-container"
|
|
|
+ <div class="audio-play-container"
|
|
|
:style="{backgroundImage: `url(${state.report?.task3Image}`}"
|
|
|
>
|
|
|
<div v-if="!fco.playing" class="audio-time-total" >
|
|
@@ -109,7 +109,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<!-- 家园共育策略 -->
|
|
|
<div class="home-strategy learn-modle" >
|
|
|
<div class="learn-modle-title" >
|
|
@@ -168,7 +168,7 @@
|
|
|
<span>保存海报</span>
|
|
|
</div>
|
|
|
<div class="share-item" @click.stop="shareWx">
|
|
|
- <img :src="staticImg.wechat" alt="">
|
|
|
+ <img :src="staticImg.wechat" alt="">
|
|
|
<span>微信好友</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -185,14 +185,14 @@
|
|
|
import { ref, nextTick, onMounted, reactive, getCurrentInstance } from 'vue'
|
|
|
import { useAudioManager, useSchedulerOnce } from '@/hook/index'
|
|
|
import AbleChart from '../../components/AbleChart.vue'
|
|
|
-import { screenShot, createQrcode } from '@/utils/utils'
|
|
|
-import { getReportByUser, shareUserReport } from "@/api/learnPlan"
|
|
|
+import { screenShot, createQrcode, registerWxopenButton } from '@/utils/utils'
|
|
|
+import { getReportByUser, shareUserReport } from '@/api/learnPlan'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import { useAppRouter, useAppFunc } from '@/hook/appHook'
|
|
|
import { Overlay, ActionSheet, showToast, Popover } from 'vant'
|
|
|
import { useClickAway } from '@vant/use'
|
|
|
import OpenApp from '@/components/OpenApp/index.vue'
|
|
|
-import { registerWxopenButton } from '@/utils/utils'
|
|
|
+
|
|
|
export interface QueryParams {
|
|
|
i: string,
|
|
|
u?: string,
|
|
@@ -211,7 +211,7 @@ const staticImg = {
|
|
|
photo: require('@/assets/component/common/photo.png'),
|
|
|
wechat: require('@/assets/component/common/wechat.png'),
|
|
|
quesIcon: require('@LP/assets/ques.png'),
|
|
|
- tip: require('@LP/assets/tip.png'),
|
|
|
+ tip: require('@LP/assets/tip.png')
|
|
|
}
|
|
|
|
|
|
const [fco, atx] = useAudioManager({
|
|
@@ -222,7 +222,6 @@ const [fco, atx] = useAudioManager({
|
|
|
const queryParams = useRoute().query as unknown as QueryParams
|
|
|
const quesImgRef = ref()
|
|
|
|
|
|
-
|
|
|
useClickAway(quesImgRef, () => quesTipState.value = false)
|
|
|
|
|
|
// queryParams.i = "1630466274125459458"
|
|
@@ -238,8 +237,6 @@ const appFunc = useAppFunc()
|
|
|
|
|
|
const qrcode = ref('')
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const posterShowState = ref(false)
|
|
|
|
|
|
const shareShowState = ref(false)
|
|
@@ -259,41 +256,36 @@ const playAudio = () => {
|
|
|
const state = reactive<Partial<API.LearnPlan.Task>>({})
|
|
|
|
|
|
const closeModal = () => {
|
|
|
-
|
|
|
posterShowState.value = false
|
|
|
-
|
|
|
}
|
|
|
|
|
|
const initAudioDragEvent = () => {
|
|
|
- let element = Array.from(document.getElementsByClassName('van-progress__pivot'))[0]
|
|
|
+ const element = Array.from(document.getElementsByClassName('van-progress__pivot'))[0]
|
|
|
|
|
|
- let start = 0;
|
|
|
+ let start = 0
|
|
|
|
|
|
- let distance = 0;
|
|
|
+ let distance = 0
|
|
|
|
|
|
- element.addEventListener("touchstart", function(event) {
|
|
|
- start = event.touches[0].clientX;
|
|
|
+ element.addEventListener('touchstart', function (event) {
|
|
|
+ start = event.touches[0].clientX
|
|
|
fco.pause()
|
|
|
- });
|
|
|
+ })
|
|
|
|
|
|
- element.addEventListener("touchmove", function(event) {
|
|
|
- distance = event.touches[0].clientX - start + 11;
|
|
|
- console.log(distance);
|
|
|
+ element.addEventListener('touchmove', function (event) {
|
|
|
+ distance = event.touches[0].clientX - start + 11
|
|
|
+ console.log(distance)
|
|
|
if (distance < 0) {
|
|
|
fco.setPercentage(0)
|
|
|
- } else if (distance > playProcessRef.value.clientWidth) {
|
|
|
- fco.setPercentage( 1)
|
|
|
+ } else if (distance > playProcessRef.value.clientWidth) {
|
|
|
+ fco.setPercentage(1)
|
|
|
} else {
|
|
|
- fco.setPercentage( distance / playProcessRef.value.clientWidth)
|
|
|
+ fco.setPercentage(distance / playProcessRef.value.clientWidth)
|
|
|
}
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
+ })
|
|
|
|
|
|
- element.addEventListener('touchend', function(e) {
|
|
|
+ element.addEventListener('touchend', function (e) {
|
|
|
fco.play()
|
|
|
- }, false);
|
|
|
-
|
|
|
+ }, false)
|
|
|
}
|
|
|
|
|
|
const openModal = () => {
|
|
@@ -306,37 +298,34 @@ const savePoster = async () => {
|
|
|
useSchedulerOnce({
|
|
|
cb: () => appFunc.savePoster(posterblob.value),
|
|
|
delay: 500
|
|
|
- })
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const _shareUserReport = async () => {
|
|
|
- const { data } = await shareUserReport({ "itemId": queryParams.i, "userId": queryParams.u! })
|
|
|
+ const { data } = await shareUserReport({ itemId: queryParams.i, userId: queryParams.u! })
|
|
|
if (data.state !== 0) {
|
|
|
showToast(`分享成功, 获得${data.winWisdomCoin}个智慧币`)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const updatePercentage = (e) => {
|
|
|
-
|
|
|
const percentage = (e.layerX / playProcessRef.value.clientWidth)
|
|
|
|
|
|
fco.setPercentage(percentage)
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 分享海报到微信
|
|
|
const shareWx = async () => {
|
|
|
await _shareUserReport()
|
|
|
useSchedulerOnce({
|
|
|
- cb: () => appFunc.shareWx(posterblob.value),
|
|
|
+ cb: () => appFunc.shareWx(posterblob.value),
|
|
|
delay: 500
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 获取用户报告信息
|
|
|
const _getReportByUser = async () => {
|
|
|
-
|
|
|
- const { data } = await getReportByUser({ "itemId": queryParams.i, "userId": queryParams.u! })
|
|
|
+ const { data } = await getReportByUser({ itemId: queryParams.i, userId: queryParams.u! })
|
|
|
|
|
|
fco.src = data.report.userLearnShareAudio
|
|
|
state.report = data.report
|
|
@@ -356,28 +345,24 @@ const createPoster = async () => {
|
|
|
target.append(posterEl)
|
|
|
state.shared = 1
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const getQrcodeUrl = async () => {
|
|
|
-
|
|
|
- qrcode.value = await createQrcode(queryParams.u ? window.location.href + `&share=1` : `${window.location.href}&u=${userId.value}&share=1`)
|
|
|
+ qrcode.value = await createQrcode(queryParams.u ? window.location.href + '&share=1' : `${window.location.href}&u=${userId.value}&share=1`)
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
|
-
|
|
|
if (queryParams.u) {
|
|
|
- _getReportByUser()
|
|
|
+ _getReportByUser()
|
|
|
} else {
|
|
|
await appRouter.getToken()
|
|
|
- _getReportByUser()
|
|
|
+ _getReportByUser()
|
|
|
}
|
|
|
|
|
|
registerWxopenButton()
|
|
|
|
|
|
initAudioDragEvent()
|
|
|
-
|
|
|
})
|
|
|
|
|
|
</script>
|
|
@@ -854,6 +839,6 @@ onMounted(async () => {
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
</style>
|