App.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script>
  2. const uat_domain = 'https://gather.test.sxzxyj.net' // 预发布
  3. // const uat_domain = 'http://192.168.16.214:8305' // 本地
  4. const pro_domain = 'https://gather.zyucgj.cn' // 生产
  5. const uat_URL = uat_domain+'/gc-gather/' // 预发布
  6. const pro_URL = pro_domain+'/gc-gather/' // 生产
  7. const buildType = 1 // 打包环境对应类型,1 生产 0 预发布
  8. const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
  9. const envText = ['预发布环境','生产环境']
  10. const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]
  11. console.log(process.env.NODE_ENV)
  12. export default {
  13. globalData: {
  14. baseDomain: process.env.NODE_ENV == 'development' ? uat_domain : pro_domain,
  15. baseUrl: process.env.NODE_ENV == 'development' ? uat_URL : buildURL,
  16. token: '',
  17. version: '', // 当前版本号
  18. buildType: buildType,
  19. envTips: envTips
  20. },
  21. mounted() {
  22. // 非V3模式
  23. if(this.$scope){
  24. this.$scope.globalData.token = this.$store.state.vuex_token
  25. }else{
  26. // V3模式
  27. getApp({allowDefault: true}).globalData.token = this.$store.state.vuex_token
  28. }
  29. },
  30. onLaunch: function() {
  31. console.log('App onLaunch')
  32. },
  33. onShow: function() {
  34. console.log('App Show')
  35. },
  36. onHide: function() {
  37. console.log('App Hide')
  38. },
  39. }
  40. </script>
  41. <style lang="scss">
  42. @import "uview-ui/index.scss";
  43. /*每个页面公共css */
  44. page {
  45. min-height: 100%;
  46. display: flex;
  47. background-color: #F8F8F8;
  48. }
  49. .content {
  50. padding: 20upx;
  51. }
  52. </style>