index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. // 自定义组件
  3. import '../../xr-custom/components/AutoRotate';
  4. import '../../xr-custom/components/Particle/SystemProperty/BasicParticle';
  5. import '../../xr-custom/components/Particle/index';
  6. import '../../xr-custom/elements/xr-auto-rotate-touchable-gltf';
  7. import '../../xr-custom/elements/xr-custom-particle';
  8. // 自定义Geometry
  9. import '../../xr-custom/assets/geometry-star';
  10. import '../../xr-custom/assets/geometry-specialCylinder';
  11. // 自定义材质
  12. import '../../xr-custom/elements/xr-shining-star';
  13. // 自定义effect
  14. import '../../xr-custom/assets/effect-shining';
  15. import '../../xr-custom/assets/effect-last-record-final';
  16. */
  17. import list from './data/index';
  18. let lastOpened = false;
  19. let lastCount = 0;
  20. let first = true;
  21. Page({
  22. data: {
  23. list,
  24. root: ''
  25. },
  26. onLoad() {
  27. if (first) {
  28. console.log('Entry xr-frame index page');
  29. wx.reportEvent("xr_frame", {
  30. "xr_page_path": '/pages/index/index'
  31. });
  32. first = false;
  33. }
  34. },
  35. onShareAppMessage() {
  36. return {
  37. title: 'XR-FRAME官方示例'
  38. }
  39. },
  40. onShareTimeline() {
  41. return {
  42. title: 'XR-FRAME官方示例'
  43. }
  44. },
  45. clickHandle(e) {
  46. wx.navigateTo({
  47. url: '/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker',
  48. // url: '/pages/ar-classic/scene-classic-video/index',
  49. success: () => {
  50. },
  51. fail: () => {
  52. },
  53. });
  54. return;
  55. if (!path) {
  56. return;
  57. }
  58. if (path === '/pages/scene-last-record/index') {
  59. this.handleLastRecord();
  60. return;
  61. }
  62. if (path) {
  63. wx.navigateTo({
  64. url: root + path + `?path=${path}`,
  65. success: () => {
  66. },
  67. fail: () => {
  68. },
  69. });
  70. }
  71. },
  72. handleLastRecord: async function () {
  73. if (lastOpened) {
  74. return;
  75. }
  76. lastCount += 1;
  77. // if (Math.random() >= (0.34 + lastCount * 0.1)) {
  78. // return;
  79. // }
  80. let root = this.data.root;
  81. lastOpened = true;
  82. wx.request({
  83. url: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-gate.txt',
  84. success: function (res) {
  85. wx.showModal({
  86. title: '一把钥匙',
  87. content: res.data,
  88. confirmText: '探寻真实',
  89. cancelText: '放下钥匙',
  90. success: function(res) {
  91. if (res.cancel) {
  92. wx.onAppShow((result) => {
  93. lastOpened = false;
  94. });
  95. return;
  96. }
  97. wx.navigateTo({
  98. url: root + '/pages/scene-last-record/index',
  99. success: () => {
  100. wx.onAppShow((result) => {
  101. lastOpened = false;
  102. });
  103. }
  104. });
  105. }
  106. });
  107. },
  108. fail: function (err) {
  109. lastOpened = false;
  110. }
  111. });
  112. }
  113. });