threeD.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { exhibitsDetails } from "../../../api/index"
  2. // const THREE = require('../../../../style/three/three.min.js');
  3. // import { MTLLoader } from '../../../../style/three/MTLLoader.js';
  4. const App = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. navTop:App.globalData.navTop,
  11. title:"",
  12. url:'',
  13. timestamp:0,
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. let exhibits_id = wx.getStorageSync('exhibits_id');
  20. exhibitsDetails(exhibits_id).then(res =>{
  21. // console.log(res.data.data,"data")
  22. this.setData({
  23. imgList:res.data.data.imgUrl,
  24. url:res.data.data.modelUrl[0].url,
  25. timestamp:Date.now()
  26. })
  27. })
  28. },
  29. navigateBack () {
  30. wx.navigateBack()
  31. },
  32. onShow(){
  33. const canvas = wx.createCanvasContext('#modelCanvas');
  34. // 创建并设置场景、相机和渲染器
  35. // const scene = new THREE.Scene();
  36. // const camera = new THREE.PerspectiveCamera(60, App.globalData.screenWidth / App.globalData.screenHeight, 0.1, 10000)
  37. // const renderer = new THREE.WebGLRenderer({ canvas: canvas });
  38. // console.log(renderer,"THREE")
  39. },
  40. })