behavior.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // 此处如果为jpeg,则后缀名也需要改成对应后缀
  2. // const filePath = `${wx.env.USER_DATA_PATH}/marker-ar1.jpg`
  3. // const mapfilePath = `${wx.env.USER_DATA_PATH}/marker-ar.jpg`
  4. export default function getBehavior() {
  5. return Behavior({
  6. data: {
  7. width: 1,
  8. height: 1,
  9. fps: 0,
  10. memory: 0,
  11. cpu: 0,
  12. markerId: [],
  13. imgList: [],
  14. },
  15. methods: {
  16. onReady() { // 初始化 threejs
  17. this.session = wx.createVKSession({
  18. track: {
  19. plane: {
  20. mode:3
  21. },
  22. marker: true,
  23. },
  24. version: 'v2'
  25. })
  26. const session = this.session
  27. session.start(err => {
  28. if (err) {
  29. wx.redirectTo({
  30. // url: '/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker',
  31. url: '/pages/ar-classic/scene-classic-show/index',
  32. success: () => {
  33. },
  34. fail: () => {
  35. },
  36. });
  37. // return console.error('VK error: ', err)
  38. }
  39. else
  40. {
  41. wx.redirectTo({
  42. // url: '/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker',
  43. url: '/pages/ar-classic/scene-classic-showsix/index',
  44. // url: '/pages/ar-classic/scene-classic-show/index',
  45. success: () => {
  46. },
  47. fail: () => {
  48. },
  49. });
  50. // return console.error('VK error: ', err)
  51. }
  52. })
  53. }
  54. },
  55. })
  56. }