topic.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="container">
  3. <!-- #ifdef H5||APP-PLUS -->
  4. <home-deco :deco_info="deco_data" :topicNotExit='topicNotExit' :is_show_top="false" :topic_name="topic_name" :is_from_found="false"></home-deco>
  5. <!-- #endif -->
  6. <!-- #ifdef MP-WEIXIN -->
  7. <home-deco :deco_info="deco_data" :topicNotExit='topicNotExit' :is_show_top="false" :topic_name="topic_name" :is_from_found="true"></home-deco>
  8. <!-- #endif -->
  9. </view>
  10. </template>
  11. <script>
  12. import HomeDeco from '@/components/home_deco.vue'
  13. export default {
  14. data() {
  15. return {
  16. deco_data:[],
  17. topic_id:'', //专题id
  18. topic_name:'', //专题名称
  19. client:'', //客户端类型
  20. topicNotExit:false
  21. };
  22. },
  23. components: {
  24. HomeDeco
  25. },
  26. onLoad(option) {
  27. this.topic_id = option.id
  28. this.loadData(this.topic_id);
  29. },
  30. methods: {
  31. /**
  32. * 请求静态数据只是为了代码不那么乱
  33. * 分次请求未作整合
  34. */
  35. async loadData(id) {
  36. uni.showLoading({
  37. title:'加载中...'
  38. })
  39. let param = {}
  40. param.url = 'v3/system/front/deco/special?decoId='+id+'&type=topic'
  41. param.method = 'GET'
  42. this.$request(param).then(res => {
  43. if (res.state == 200) {
  44. uni.hideLoading()
  45. if(res.data==null){
  46. this.topicNotExit=true
  47. this.deco_data = []
  48. return
  49. }
  50. if(res.data.data != ''){
  51. this.deco_data = JSON.parse(res.data.data)
  52. }else{
  53. this.deco_data = []
  54. }
  55. this.topic_name = res.data.name
  56. uni.hideLoading()
  57. }
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. </style>