index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view>
  3. <t-i-navbar></t-i-navbar>
  4. <!-- notice -->
  5. <t-i-notice :base_url="base_url"></t-i-notice>
  6. <!-- banner -->
  7. <t-i-banner :base_url="base_url"></t-i-banner>
  8. <!-- 固定入口 -->
  9. <t-i-icon :base_url="base_url"></t-i-icon>
  10. <!-- 常用功能 -->
  11. <t-i-common></t-i-common>
  12. <!-- 新闻列表 -->
  13. <t-i-news :base_url="base_url"></t-i-news>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. // 当前煤矿编码
  21. mine_code: "",
  22. // 首页接口的基础请求路径 默认为当前矿编码的基础路径
  23. base_url: " "
  24. }
  25. },
  26. onLoad() {
  27. // 初始化当前煤矿编码
  28. this.mine_code = uni.getStorageSync('mine_code')
  29. // 根据矿编码切换首页接口不同的请求基础路径
  30. switch (this.mine_code) {
  31. case 'ningdongyunying':
  32. this.base_url = "http://ningdongyunying.nxjiewei.com:8011/api"
  33. break;
  34. case 'meihuajing':
  35. this.base_url = "http://meihuajing.nxjiewei.com:8011/api"
  36. break;
  37. default:
  38. this.base_url = ""
  39. }
  40. }
  41. }
  42. </script>
  43. <style lang="scss">
  44. page {
  45. background-color: #F6FAF6;
  46. }
  47. </style>