index.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 { sup } from '../behavior-scene/scene-ready';
  18. import list from './data/index';
  19. let lastOpened = false;
  20. let lastCount = 0;
  21. let first = true;
  22. Page({
  23. data: {
  24. list,
  25. root: '',
  26. imgUrls:[
  27. 'https://gss0.baidu.com/9fo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D600%2C800/sign=8b20fba45e6034a829b7b087fb23656c/14ce36d3d539b60028f67d12eb50352ac65cb75e.jpg',
  28. 'https://gss0.baidu.com/9vo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D600%2C800/sign=3386e39a49fbfbeddc0c3e7948c0db0e/32fa828ba61ea8d3943606a1950a304e251f587a.jpg',
  29. 'http://img04.sogoucdn.com/app/a/100520093/ca86e620b9e623ff-d72d635343d5bade-dcf2acda7a45cb44f172db138bdf8d2d.jpg',
  30. ],
  31. sysheight:600,
  32. listShowModelDes:[
  33. {ModelName:'禺强',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(禺强)',ModelPrice:'¥1.99'},
  34. {ModelName:'AAA',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(AAA)',ModelPrice:'¥2.99'},
  35. {ModelName:'BBB',ModelIntroduce:'北海之渚中,有神,人面鸟身,珥两青蛇,践两赤蛇,名曰禺彊(BBB)',ModelPrice:'¥3.99'},
  36. ],
  37. products:[],
  38. },
  39. toupper:function(){
  40. console.log("触发了toupper");
  41. },
  42. onShow(){
  43. },
  44. /*onLoad() {
  45. // const scene = this.scene = detail.value;
  46. wx.getSystemInfo({//获取设备屏幕真实高度
  47. success: (result) => {
  48. var height = result.windowHeight;
  49. this.setData({
  50. sysheight:height
  51. });
  52. },
  53. });
  54. const that = this;
  55. wx.request({
  56. url: 'https://api-fat1.ghz-tech.com/miniprogram-shanhaijing/v1/product/listInfo',
  57. method:'POST',
  58. header:{
  59. 'Content-Type':'application/json'
  60. },
  61. data:{
  62. topic:1
  63. },
  64. success:(res)=>{
  65. console.log('POST 请求成功', res.data);
  66. var products2 = res.data.data.products;
  67. console.log(' 商品列表 ',products2[0].desc);
  68. const newArray = [1, 2, 3, 4, 5];
  69. that.setData({products:products2});
  70. console.log(' 商品列表 ',this.data.products[0]);
  71. },
  72. fail:function(err){
  73. console.error('POST 请求失败', err);
  74. }
  75. });
  76. wx.login({
  77. success: (res) => {
  78. if (res.code) {
  79. // 获取到用户的临时登录凭证 code,可以发送给服务器
  80. console.log('用户登录成功,code:', res.code);
  81. wx.request({
  82. url: 'https://api-fat1.ghz-tech.com/miniprogram-shanhaijing/v1/order/prepay',
  83. method:'POST',
  84. header:{
  85. 'Content-Type':'application/json'
  86. },
  87. data:{
  88. shop_cart:[{
  89. id:1,
  90. count:1
  91. }],
  92. js_code:res.code
  93. },
  94. success:function(res){
  95. console.log('POST 请求成功', res.data.data);
  96. var paySignStr = res.data.data.pay_Sign;
  97. console.log('即将调取微信支付',res.data.data.pay_Sign);
  98. wx.requestPayment({
  99. nonceStr: res.data.data.nonce_str,
  100. package: res.data.data.package,
  101. paySign: res.data.data.pay_sign,
  102. timeStamp: res.data.data.time_stamp,
  103. signType:res.data.data.sign_type,
  104. success(res){
  105. console.log( '微信支付请求成功',res );
  106. // 付款成功回调
  107. },
  108. fail(err){
  109. console.log('微信支付请求失败',err);
  110. }
  111. })
  112. },
  113. fail:function(err){
  114. console.error('POST 请求失败', err);
  115. }
  116. });
  117. } else {
  118. console.log('登录失败!' + res.errMsg);
  119. }
  120. },
  121. });
  122. },*/
  123. onShareAppMessage() {
  124. return {
  125. title: 'XR-FRAME官方示例'
  126. }
  127. },
  128. onShareTimeline() {
  129. return {
  130. title: 'XR-FRAME官方示例'
  131. }
  132. },
  133. clickHandle(e) {
  134. wx.navigateTo({
  135. // url: '/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker',
  136. url: '/pages/ar-classic/scene-classic-saomiao/index',
  137. success: () => {
  138. },
  139. fail: () => {
  140. },
  141. });
  142. return;
  143. if (!path) {
  144. return;
  145. }
  146. if (path === '/pages/scene-last-record/index') {
  147. this.handleLastRecord();
  148. return;
  149. }
  150. if (path) {
  151. wx.navigateTo({
  152. url: root + path + `?path=${path}`,
  153. success: () => {
  154. },
  155. fail: () => {
  156. },
  157. });
  158. }
  159. },
  160. clickTuJian(e){
  161. console.log('clickTuJianAAAAAAAAAA');
  162. wx.navigateTo({
  163. url: '/pages/ar-classic/scene-classic-tujian/index',
  164. // url: 'pages/ar-classic/scene-classic-portal/index',
  165. success: () => {
  166. },
  167. fail: (err) => {
  168. console.log(' 跳转失败 ',err);
  169. },
  170. });
  171. },
  172. handleLastRecord: async function () {
  173. return;
  174. if (lastOpened) {
  175. return;
  176. }
  177. lastCount += 1;
  178. // if (Math.random() >= (0.34 + lastCount * 0.1)) {
  179. // return;
  180. // }
  181. let root = this.data.root;
  182. lastOpened = true;
  183. wx.request({
  184. url: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-gate.txt',
  185. success: function (res) {
  186. wx.showModal({
  187. title: '一把钥匙',
  188. content: res.data,
  189. confirmText: '探寻真实',
  190. cancelText: '放下钥匙',
  191. success: function(res) {
  192. if (res.cancel) {
  193. wx.onAppShow((result) => {
  194. lastOpened = false;
  195. });
  196. return;
  197. }
  198. wx.navigateTo({
  199. url: root + '/pages/scene-last-record/index',
  200. success: () => {
  201. wx.onAppShow((result) => {
  202. lastOpened = false;
  203. });
  204. }
  205. });
  206. }
  207. });
  208. },
  209. fail: function (err) {
  210. lastOpened = false;
  211. }
  212. });
  213. },
  214. });