邃芒智像大屏项目
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

199 lignes
4.8 KiB

  1. <template>
  2. <view class="page">
  3. <!-- <image src="../../assets/img/homeImg.jpg" mode="scaleToFill" /> -->
  4. <video id="myVideo"
  5. ref="myVideo"
  6. src='https://video.metavatar.cc/sv/30f2d513-18c4739c509/30f2d513-18c4739c509.mp4'
  7. autoplay
  8. muted
  9. loop
  10. :controls="false">
  11. </video>
  12. <view class="bottomBox">
  13. <view class="orangeBtn" @click="toChooseStyle">拍摄数码写真</view>
  14. <view class="IMEI" @click="Imei"
  15. >1.0.10<text @click="reFresh">i</text>
  16. </view>
  17. <!-- <view style="margin-top: 20rpx" @click="reFresh">刷新</view> -->
  18. <!-- <view style="margin-top: 20rpx" @click="runGetAndroidId()">获取</view> -->
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. //#region 导入
  24. import { getCurrentInstance, ref,nextTick } from "vue";
  25. import { isPlainObject, onLoad, onUnload } from "@dcloudio/uni-app";
  26. import { userInfoModules } from "@/store/modules/userInfo";
  27. const myVideo = ref(null);
  28. const userInfoModulesPinia = userInfoModules();
  29. //#endregion ----------------------------------
  30. function toChooseStyle() {
  31. uni.navigateTo({ url: "/pages/chooseStyle/index" });
  32. }
  33. function fileReaderTest() {
  34. try {
  35. plus.io.resolveLocalFileSystemURL(
  36. "file:///storage/Documents",
  37. function (entry) {
  38. /* 获取文件目录 */
  39. var directoryReader = entry.createReader(); //获取读取对象
  40. directoryReader.readEntries(
  41. function (entries) {
  42. //历遍子目录即可
  43. for (var i = 0; i < entries.length; i++) {
  44. console.log("文件信息:" + entries[i].name);
  45. uni.showToast({
  46. // title: uni.getStorageSync("androidId"),
  47. title: "文件信息:" + entries[i].name,
  48. icon: "success",
  49. });
  50. }
  51. },
  52. function (err) {
  53. console.log("访问目录失败");
  54. uni.showToast({
  55. title: err,
  56. icon: "error",
  57. });
  58. }
  59. );
  60. },
  61. function (err) {
  62. console.log("访问指定目录失败:" + err.message);
  63. uni.showToast({
  64. title: err,
  65. icon: "error",
  66. });
  67. }
  68. );
  69. } catch (error) {
  70. console.log(error, "error");
  71. }
  72. }
  73. // // 播放
  74. // const handelPlay = () => {
  75. // const video = document.querySelector("video.uni-video-video");
  76. // video.play();
  77. // }
  78. //#region 初始化
  79. onLoad(() => {
  80. nextTick(()=>{
  81. const video = document.querySelector("video.uni-video-video");
  82. video.muted = false
  83. video.play()
  84. })
  85. runGetAndroidId();
  86. // fileReaderTest();
  87. userInfoModulesPinia.clearStorage();
  88. });
  89. //#endregion ----------------------------------
  90. //#region app交互
  91. const IMEI = ref(null);
  92. function Imei() {
  93. try {
  94. runGetAndroidId();
  95. // window.webview.raiseEvent("getSerial", "test_params");
  96. // window.webview.raiseEvent("getTestStr", "test_params");
  97. // const IMEI = window.android.getIMEI();
  98. // const IMEI = window.android.getSerial();
  99. // const IMEI = window.android.getTestStr();
  100. uni.showToast({
  101. // title: uni.getStorageSync("androidId"),
  102. title: window.localStorage.getItem("androidIdByWindow"),
  103. icon: "success",
  104. });
  105. } catch (error) {
  106. uni.showToast({
  107. title: "Error",
  108. icon: "error",
  109. });
  110. }
  111. // cordova.exec(
  112. // function (imei) {
  113. // console.log("IMEI:", imei);
  114. // },
  115. // function (error) {
  116. // console.error("Failed to get IMEI:", error);
  117. // },
  118. // "MyPlugin",
  119. // "getIMEI",
  120. // []
  121. // );
  122. }
  123. function runGetAndroidId() {
  124. window.webview.raiseEvent("getAndroidId", "test_params");
  125. // alert("获取成功");
  126. }
  127. // function androidCallback(name, result_str) {
  128. // IMEI.value = result_str;
  129. // alert(result_str);
  130. // alert("callBack " + name + " : " + result_str + "\n");
  131. // // document.getElementById("text").value +=
  132. // }
  133. function reFresh() {
  134. console.log("刷新");
  135. window.webview.raiseEvent("pageRefresh", "test_params"); //刷新页面
  136. // alert("刷新成功");
  137. }
  138. //#endregion ----------------------------------
  139. //#region 登录
  140. //#endregion ----------------------------------
  141. </script>
  142. <style lang="scss" scoped>
  143. .page {
  144. padding: 0;
  145. position: relative;
  146. width: 100vw;
  147. height: 100vh;
  148. // uni-video{
  149. // width:100%;
  150. // height:100%;
  151. // }
  152. #myVideo{
  153. width: 100%;
  154. height: 100%;
  155. }
  156. image {
  157. position: absolute;
  158. width: 100%;
  159. height: 100%;
  160. }
  161. .bottomBox {
  162. position: absolute;
  163. bottom: 0;
  164. display: flex;
  165. flex-direction: column;
  166. align-items: center;
  167. padding: 100rpx 0;
  168. width: 100%;
  169. height: 300rpx;
  170. background-color: rgba($color: #000000, $alpha: 0.5);
  171. .IMEI {
  172. position: absolute;
  173. bottom: 20rpx;
  174. right: 30rpx;
  175. width: 40rpx;
  176. height: 40rpx;
  177. line-height: 40rpx;
  178. text-align: center;
  179. }
  180. }
  181. }
  182. </style>