chutingting 1 год назад
Родитель
Сommit
3acb35297e
2 измененных файлов: 23 добавлений и 18 удалений
  1. +1
    -1
      src/api/login.js
  2. +22
    -17
      src/pages/login/index.vue

+ 1
- 1
src/api/login.js Просмотреть файл

@@ -46,7 +46,7 @@ export function loginByCodeApi(data) {
*/ */
export function getVideoApi(data) { export function getVideoApi(data) {
return request({ return request({
url: `https://formall.oss-accelerate.aliyuncs.com/zx_apk/H5_config.json`,
url: `/api/home/videoUrl`,
method: 'get' method: 'get'
}) })
} }

+ 22
- 17
src/pages/login/index.vue Просмотреть файл

@@ -2,8 +2,8 @@
<view class="page"> <view class="page">
<!-- <image src="../../assets/img/homeImg.jpg" mode="scaleToFill" /> --> <!-- <image src="../../assets/img/homeImg.jpg" mode="scaleToFill" /> -->
<video id="myVideo" <video id="myVideo"
ref="myVideo"
src='https://video.metavatar.cc/sv/30f2d513-18c4739c509/30f2d513-18c4739c509.mp4'
ref="myVideo"
:src='videoUrl'
autoplay autoplay
muted muted
loop loop
@@ -23,12 +23,11 @@


<script setup> <script setup>
//#region 导入 //#region 导入
import { getCurrentInstance, ref,nextTick } from "vue";
import { getCurrentInstance, ref,nextTick, onMounted } from "vue";
import { isPlainObject, onLoad, onUnload, onShow } from "@dcloudio/uni-app"; import { isPlainObject, onLoad, onUnload, onShow } from "@dcloudio/uni-app";
import { userInfoModules } from "@/store/modules/userInfo"; import { userInfoModules } from "@/store/modules/userInfo";
import { getVideoApi } from "@/api/login.js"; import { getVideoApi } from "@/api/login.js";


const myVideo = ref(null);


const userInfoModulesPinia = userInfoModules(); const userInfoModulesPinia = userInfoModules();
//#endregion ---------------------------------- //#endregion ----------------------------------
@@ -78,29 +77,35 @@ function fileReaderTest() {
} }
} }


// // 播放
// const handelPlay = () => {
// const video = document.querySelector("video.uni-video-video");
// video.play();
// }


const videoUrl = ref('')
function getVideoFn() { function getVideoFn() {
// getVideoApi().then(res => {
// debugger
// })
nextTick(()=>{
const video = document.querySelector("video.uni-video-video");
video.muted = false
video.play()
getVideoApi().then(res => {
videoUrl.value = res.data
}) })
} }


onShow(() => { onShow(() => {
getVideoFn() getVideoFn()
}) })
//#region 初始化 //#region 初始化
// const myVideo = ref(null);
const { proxy } = getCurrentInstance();
onMounted(() => {
// nextTick(()=>{
// proxy.$refs.myVideomuted = false
// proxy.$refs.myVideo.play();
// })
})

onLoad(() => { onLoad(() => {
getVideoFn()
nextTick(()=>{
// const video = document.querySelector("video.uni-video-video");
// video.muted = false
// video.play()
})
getVideoFn()
runGetAndroidId(); runGetAndroidId();
// fileReaderTest(); // fileReaderTest();
userInfoModulesPinia.clearStorage(); userInfoModulesPinia.clearStorage();


Загрузка…
Отмена
Сохранить