config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // 配置信息
  2. var config = {}
  3. const accountInfo = uni.getAccountInfoSync();
  4. const envVersion = accountInfo.miniProgram.envVersion;
  5. console.log(accountInfo, envVersion, 'envVersionenvVersionenvVersion')
  6. uni.getSystemInfo({
  7. success: function(res) {
  8. console.log(res, 'getSystemInfogetSystemInfogetSystemInfogetSystemInfo')
  9. if (res.uniPlatform === 'mp-weixin') {
  10. console.log(accountInfo, envVersion, '当前在微信开中运行当前在微信开中运行当前在微信开中运行当前在微信开中运行')
  11. // 在微信小程序中运行的逻辑
  12. if (envVersion === 'develop') {
  13. // 开发版本
  14. config = {
  15. apiUrl: "https://api.duanju.dududus.com",
  16. staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com
  17. zystaticUrl: "",
  18. TabbarIndex: 2
  19. }
  20. } else if (envVersion === 'trial') {
  21. //体验版
  22. config = {
  23. apiUrl: "https://api.duanju.dududus.com",
  24. staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com
  25. zystaticUrl: "",
  26. TabbarIndex: 2
  27. }
  28. } else if (envVersion === 'release') {
  29. //正式版
  30. config = {
  31. apiUrl: "https://api.zhiyupa.com",
  32. staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com
  33. zystaticUrl: "",
  34. TabbarIndex: 2
  35. }
  36. }
  37. } else if (res.uniPlatform === 'web') {
  38. // 在H5环境中运行的逻辑
  39. console.log('当前在H5环境中运行');
  40. }
  41. }
  42. });
  43. export default config