index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view :class="[AppTheme]" class="all_box">
  3. <themes1 :thflag="thflag" :primary2="primary" ref="themes1"></themes1>
  4. <themes2 :thflag="thflag" :primary2="primary" ref="themes2"></themes2>
  5. <!-- #ifdef MP-WEIXIN -->
  6. <button class="btn1" open-type="contact" v-if="ischar">
  7. <u-icon name="server-man" :color="primary" size="60"></u-icon>
  8. </button>
  9. <!-- #endif -->
  10. <!-- #ifdef APP-PLUS -->
  11. <updatepage class='updatepage' :isUpdate="isUpdate"></updatepage>
  12. <!-- #endif -->
  13. <!-- 广告 -->
  14. <admyself :opshow="true"></admyself>
  15. <!-- 底部tabbar -->
  16. <tabbar :primary="primary"></tabbar>
  17. <!-- 分享 -->
  18. <sharebox ref="sbox" v-if="sharedata" :data="sharedata"></sharebox>
  19. </view>
  20. </template>
  21. <script>
  22. // 组件加载主体
  23. import themes1 from '@/components/systhemes/themes1.vue';
  24. import themes2 from '@/components/systhemes/themes2.vue';
  25. export default {
  26. components: {
  27. themes1,
  28. themes2
  29. },
  30. data() {
  31. return {
  32. thflag: 1,
  33. ischar: false,
  34. sharedata: null,
  35. primary: this.$theme.primary,
  36. isUpdate: true
  37. }
  38. },
  39. onLoad(options) {
  40. let that = this
  41. that.$bindid.getbindid(options, that.$store);
  42. that.$init_config(1, function(res) {
  43. that.ischar = res.app.ischar
  44. that.thflag = res.thflag
  45. that.sharedata = res.sharedata
  46. if (that.thflag == 1) {
  47. that.$refs.themes1.init()
  48. } else if (that.thflag == 2) {
  49. that.$refs.themes2.init()
  50. }
  51. })
  52. },
  53. onPullDownRefresh() {
  54. let that = this
  55. if (that.thflag == 1) {
  56. that.$refs.themes1.toBottom(1)
  57. } else if (that.thflag == 2) {
  58. that.$refs.themes2.toBottom(1)
  59. }
  60. },
  61. onReachBottom() {
  62. let that = this
  63. if (that.thflag == 1) {
  64. that.$refs.themes1.toBottom()
  65. } else if (that.thflag == 2) {
  66. that.$refs.themes2.toBottom()
  67. }
  68. },
  69. onShareAppMessage(res) {
  70. let that = this
  71. let uinfo = uni.getStorageSync("userInfo")
  72. let path = 'pages/index/index?a=1'
  73. if (uinfo) {
  74. path = path + '&pid=' + uinfo.id;
  75. }
  76. return {
  77. title: that.sharedata.title,
  78. imageUrl: that.sharedata.imageUrl,
  79. path: path
  80. }
  81. },
  82. onShareTimeline(res) {
  83. let that = this
  84. let uinfo = uni.getStorageSync("userInfo")
  85. let path = 'pages/index/index?a=1'
  86. if (uinfo) {
  87. path = path + '&pid=' + uinfo.id;
  88. }
  89. return {
  90. title: that.sharedata.title,
  91. imageUrl: that.sharedata.imageUrl,
  92. path: path
  93. }
  94. },
  95. onShow: function() {
  96. let that = this;
  97. let config = that.$until.myCache(that.$cache_config_info_key);
  98. if (!config) {
  99. that.$init_config(1);
  100. }
  101. if (that.thflag == 1 && that.$refs.themes1) {
  102. that.$refs.themes1.init()
  103. }
  104. },
  105. methods: {
  106. getcar() {
  107. let uid = uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').id : ''
  108. if (uid) {
  109. homeApi.getcar().then(res => {
  110. if (res.status == 200) {
  111. this.carnum = res.sdata;
  112. }
  113. });
  114. }
  115. },
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. .all_box {
  121. background-color: #f5f5f5;
  122. }
  123. .btn1 {
  124. background-color: transparent;
  125. position: fixed;
  126. right: 0;
  127. top: 77.5%;
  128. z-index: 11;
  129. width: 200rpx;
  130. height: 100rpx;
  131. outline: none;
  132. border: none;
  133. }
  134. .btnImg {
  135. width: 100%;
  136. height: 100%;
  137. }
  138. .btn1::after {
  139. outline: none;
  140. border: none;
  141. }
  142. </style>