| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <!DOCTYPE html>
- <html lang="ch-zh">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon">
- <link rel="stylesheet" href="./index.css">
- <head>
- <title>模型</title>
- <script src="./4dage.js"></script>
- <style>
- html {
- overflow: hidden;
- }
- .outerImg {
- transition: all 1s;
- opacity: 1;
- position: absolute;
- z-index: 998;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: #1a1b20;
- }
- .outerImg img {
- position: absolute;
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- </style>
- </head>
- <body>
- <div class="outerImg">
- <img src="./bg.jpg" alt="">
- </div>
- <div id="ui">
- </div>
- <script>
- const baseUrl = window.location.origin
- // const baseUrl = 'https://bengbubwg.4dage.com'
- const url = window.location.search
- // 获取地址栏参数
- const urlParameter = (data) => {
- if (data) {
- const query = data.substring(data.indexOf("?") + 1);
- const arr = query.split("&");
- const params = {};
- arr.forEach((v) => {
- const key = v.substring(0, v.indexOf("="));
- const val = v.substring(v.indexOf("=") + 1);
- params[key] = val;
- });
- return params;
- } else return {};
- };
- const urlObj = urlParameter(url)
- if (urlObj.id) {
- fetch(`${baseUrl}/api/show/goods/detail/${urlObj.id}`)
- .then(response => response.json())
- .then(res => {
- const thumb = res.data.entity.thumb
- let modelUrl = ''
- res.data.file.forEach(v => {
- if (v.type === 'model') {
- modelUrl = v.filePath
- }
- })
- // 设置背景封面
- document.querySelector('.outerImg img').setAttribute('src', thumb)
- // 加载模型
- if (urlObj.r) window.autoRotate = true;
- fdage.embed(modelUrl, {
- width: 800,
- height: 600,
- autoStart: true,
- fullFrame: true,
- pagePreset: false
- });
- // console.log(res)
- });
- } else alert('id is null!')
- </script>
- </body>
- </html>
|