|
|
@@ -40,12 +40,14 @@
|
|
|
:src="isCollected ? collectActiveImg : collectImg"
|
|
|
alt=""
|
|
|
/>
|
|
|
- <div>{{ isCollected ? '已追剧' : '追剧' }}</div>
|
|
|
+ <div>{{ isCollected ? $t('collected') : $t('collect') }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="view-bottom flex justify-between z-20 items-center van-safe-area-bottom px-[18px]">
|
|
|
- <span class="text-base text-white">{{ seriesInfo.title }}-第{{ curEpInfo.episodeNum }}集</span>
|
|
|
+ <span class="text-base text-white"
|
|
|
+ >{{ seriesInfo.title }}-{{ $t('video.number', { num: curEpInfo.episodeNum }) }}</span
|
|
|
+ >
|
|
|
<van-button
|
|
|
type="primary"
|
|
|
class="btn"
|
|
|
@@ -54,7 +56,7 @@
|
|
|
size="mini"
|
|
|
round
|
|
|
@click="showVideoHistory"
|
|
|
- >选集</van-button
|
|
|
+ >{{ $t('video.choose') }}</van-button
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
@@ -91,7 +93,9 @@ import resolveUrl from 'resolve-url'
|
|
|
import { nextTick } from 'vue'
|
|
|
import toast from '@/utils/toast'
|
|
|
import VideoPlayer from '@/components/VideoPlayer.vue'
|
|
|
+import { useI18n } from 'vue-i18n'
|
|
|
|
|
|
+const { t } = useI18n()
|
|
|
const poster = ref('')
|
|
|
|
|
|
const router = useRouter()
|
|
|
@@ -150,21 +154,28 @@ async function getEpisodes(episodeNum = 1, duration = 0, episodeId = 0) {
|
|
|
const buyEpInfo = ref({})
|
|
|
const videoBuyRef = ref(null)
|
|
|
async function play(curEpId = 0, duration = 0) {
|
|
|
- await http.get('/api/episodes/' + curEpId).then(res => {
|
|
|
- if (Number(res.price) > 0 && !res.playUrl) {
|
|
|
- buyEpInfo.value = res
|
|
|
- videoBuyRef.value.init()
|
|
|
- } else {
|
|
|
- curEpInfo.value = res
|
|
|
- nextTick(() => {
|
|
|
- videoRef.value.setCurrent(duration)
|
|
|
- videoRef.value.play()
|
|
|
- videoRef.value.changeMuted()
|
|
|
- })
|
|
|
- }
|
|
|
+ toast.loading(t('loading'))
|
|
|
+ await http
|
|
|
+ .get('/api/episodes/' + curEpId)
|
|
|
+ .then(res => {
|
|
|
+ toast.dismiss()
|
|
|
+ if (Number(res.price) > 0 && !res.playUrl) {
|
|
|
+ buyEpInfo.value = res
|
|
|
+ videoBuyRef.value.init()
|
|
|
+ } else {
|
|
|
+ curEpInfo.value = res
|
|
|
+ nextTick(() => {
|
|
|
+ videoRef.value.setCurrent(duration)
|
|
|
+ videoRef.value.play()
|
|
|
+ videoRef.value.changeMuted()
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- // poster.value = resolveUrl(fileURL, res.cover)
|
|
|
- })
|
|
|
+ // poster.value = resolveUrl(fileURL, res.cover)
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ toast.dismiss()
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function videopause(pause = true) {
|
|
|
@@ -182,6 +193,7 @@ http.get('/api/collections/' + seriesId.value).then(res => {
|
|
|
const isCollected = ref(false)
|
|
|
const collectImgRef = ref(null)
|
|
|
function collect() {
|
|
|
+ toast.loading(t('loading'))
|
|
|
collectImgRef.value.className = collectImgRef.value.className + ' animate__pulse'
|
|
|
setTimeout(() => {
|
|
|
collectImgRef.value.className = collectImgRef.value.className.replace(/ animate__pulse/, '')
|
|
|
@@ -189,7 +201,7 @@ function collect() {
|
|
|
|
|
|
if (isCollected.value) {
|
|
|
http.delete('/api/collections/' + seriesId.value).then(res => {
|
|
|
- toast.success('取消成功')
|
|
|
+ toast.success(t('cancelSuc'))
|
|
|
isCollected.value = false
|
|
|
})
|
|
|
} else {
|
|
|
@@ -203,7 +215,7 @@ function collect() {
|
|
|
body: 'json'
|
|
|
}
|
|
|
).then(res => {
|
|
|
- toast.success('追剧成功')
|
|
|
+ toast.success(t('collectSuc'))
|
|
|
isCollected.value = true
|
|
|
})
|
|
|
}
|