App.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <script>
  2. const uat_URL = 'https://carwash.test.zyucgj.com/cw-wechat/' // 预发布
  3. // const uat_URL = 'http://192.168.16.103:8103/cw-wechat/' // 本地
  4. const pro_URL = 'https://carwash.zyucgj.com/cw-wechat/' // 生产
  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 lang="scss">
  38. @import "uview-ui/index.scss";
  39. /*每个页面公共css */
  40. page {
  41. min-height: 100%;
  42. display: flex;
  43. background: #fff;
  44. }
  45. /* #ifdef MP-BAIDU */
  46. page {
  47. width: 100%;
  48. height: 100%;
  49. display: block;
  50. }
  51. /* #endif */
  52. /* #ifdef MP-ALIPAY */
  53. page {
  54. min-height: 100vh;
  55. }
  56. /* #endif */
  57. /* 原生组件模式下需要注意组件外部样式 */
  58. m-input {
  59. width: 100%;
  60. min-height: 100%;
  61. display: flex;
  62. }
  63. .content {
  64. display: flex;
  65. flex: 1;
  66. flex-direction: column;
  67. background-color: #fff;
  68. padding: 20upx;
  69. }
  70. </style>