design.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <view v-if="(data || null) != null">
  4. <!-- 搜索 -->
  5. <block v-if="(data.is_header || 0) == 1">
  6. <!-- 搜索框 -->
  7. <view class="padding-main bg-white">
  8. <component-search propPlaceholder="输入商品名称搜索"></component-search>
  9. </view>
  10. </block>
  11. <!-- 拖拽模式、引入拖拽数据模块 -->
  12. <component-layout :propData="layout_data"></component-layout>
  13. <!-- 结尾 -->
  14. <block v-if="(data.is_footer || 0) == 1">
  15. <!-- 结尾 -->
  16. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  17. </block>
  18. </view>
  19. <view v-else>
  20. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. const app = getApp();
  26. import componentLayout from "../../components/layout/layout";
  27. import componentSearch from "../../components/search/search";
  28. import componentNoData from "../../components/no-data/no-data";
  29. import componentBottomLine from "../../components/bottom-line/bottom-line";
  30. export default {
  31. data() {
  32. return {
  33. data_bottom_line_status: false,
  34. data_list_loding_status: 1,
  35. data_list_loding_msg: '',
  36. params: null,
  37. data: null,
  38. layout_data: [],
  39. // 自定义分享信息
  40. share_info: {}
  41. };
  42. },
  43. components: {
  44. componentLayout,
  45. componentSearch,
  46. componentNoData,
  47. componentBottomLine
  48. },
  49. props: {},
  50. onLoad(params) {
  51. this.setData({
  52. params: params
  53. });
  54. },
  55. onShow() {
  56. this.get_data();
  57. },
  58. // 下拉刷新
  59. onPullDownRefresh() {
  60. this.get_data();
  61. },
  62. methods: {
  63. // 获取数据
  64. get_data() {
  65. uni.request({
  66. url: app.globalData.get_request_url("index", "design"),
  67. method: 'POST',
  68. data: {
  69. "id": this.params.id || 0
  70. },
  71. dataType: 'json',
  72. success: res => {
  73. uni.stopPullDownRefresh();
  74. if (res.data.code == 0) {
  75. var data = res.data.data;
  76. this.setData({
  77. data: (data.data || null) != null && data.data.length != 0 ? data.data : null,
  78. layout_data: data.layout_data || [],
  79. data_list_loding_msg: '',
  80. data_list_loding_status: 0,
  81. data_bottom_line_status: true
  82. });
  83. if ((this.data || null) != null) {
  84. // 基础自定义分享
  85. this.setData({
  86. share_info: {
  87. title: this.data.seo_title || this.data.name,
  88. desc: this.data.seo_desc,
  89. path: '/pages/design/design',
  90. query: 'id='+this.data.id,
  91. img: this.data.logo
  92. }
  93. });
  94. // 标题名称
  95. uni.setNavigationBarTitle({
  96. title: this.data.name
  97. });
  98. }
  99. // 分享菜单处理
  100. app.globalData.page_share_handle(this.share_info);
  101. } else {
  102. this.setData({
  103. data_bottom_line_status: false,
  104. data_list_loding_status: 2,
  105. data_list_loding_msg: res.data.msg
  106. });
  107. }
  108. },
  109. fail: () => {
  110. uni.stopPullDownRefresh();
  111. this.setData({
  112. data_bottom_line_status: false,
  113. data_list_loding_status: 2,
  114. data_list_loding_msg: '服务器请求出错'
  115. });
  116. app.globalData.showToast('服务器请求出错');
  117. }
  118. });
  119. }
  120. }
  121. };
  122. </script>
  123. <style>
  124. </style>