App.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script>
  2. const uat_URL = 'http://md.test.zyucgj.com/saas/clz/' // 预发布
  3. // const uat_URL = 'http://192.168.16.103:9110/saas/clz/' // 本地
  4. const pro_URL = 'https://car.zyucgj.com/saas/clz/' // 生产
  5. const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
  6. const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
  7. const envText = ['预发布环境','生产环境']
  8. const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]
  9. export default {
  10. globalData: {
  11. baseUrl: process.env.NODE_ENV == 'development' ? uat_URL : buildURL,
  12. token: '',
  13. version: '', // 当前版本号
  14. buildType: buildType,
  15. envTips: envTips
  16. },
  17. mounted() {
  18. // 非V3模式
  19. if(this.$scope){
  20. this.$scope.globalData.token = this.$store.state.vuex_token
  21. }else{
  22. // V3模式
  23. getApp({allowDefault: true}).globalData.token = this.$store.state.vuex_token
  24. }
  25. },
  26. onLaunch: function() {
  27. console.log('App onLaunch')
  28. },
  29. onShow: function() {
  30. console.log('App Show')
  31. },
  32. onHide: function() {
  33. console.log('App Hide')
  34. }
  35. }
  36. </script>
  37. <style>
  38. /*每个页面公共css */
  39. page {
  40. min-height: 100%;
  41. display: flex;
  42. background: #fff;
  43. }
  44. /* #ifdef MP-BAIDU */
  45. page {
  46. width: 100%;
  47. height: 100%;
  48. display: block;
  49. }
  50. /* #endif */
  51. /* #ifdef MP-ALIPAY */
  52. page {
  53. min-height: 100vh;
  54. }
  55. /* #endif */
  56. /* 原生组件模式下需要注意组件外部样式 */
  57. m-input {
  58. width: 100%;
  59. min-height: 100%;
  60. display: flex;
  61. }
  62. .content {
  63. display: flex;
  64. flex: 1;
  65. flex-direction: column;
  66. background-color: #fff;
  67. padding: 20upx;
  68. }
  69. </style>