index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <template>
  2. <view>
  3. <view :class="((plugins_mourning_data || 0) == 1 ? ' grayscale' : '')+(is_single_page == 1 ? ' single-page-top' : '')">
  4. <!-- 顶部内容 -->
  5. <view v-if="load_status == 1" class="home-top-nav-content" :style="top_content_style">
  6. <!-- logo/标题 -->
  7. <!-- #ifndef MP-TOUTIAO -->
  8. <view class="home-top-nav-logo">
  9. <block v-if="is_logo_use_text == 0 && (application_logo || null) != null">
  10. <image :src="application_logo" mode="aspectFit" class="home-top-nav-logo-image"></image>
  11. </block>
  12. <block v-else>
  13. <view class="home-top-nav-logo-title cr-white single-text">{{application_title}}</view>
  14. </block>
  15. </view>
  16. <!-- #endif -->
  17. <!-- 搜索 -->
  18. <view v-if="search_is_fixed == 1" class="search-fixed-seat"></view>
  19. <view v-if="load_status == 1" :class="'pr '+(search_is_fixed == 1 ? 'search-content-fixed bg-main' : '')" :style="search_is_fixed == 1 ? top_content_style : ''">
  20. <view v-if="common_app_is_enable_search == 1" :style="search_style">
  21. <view class="margin-horizontal-main">
  22. <component-search propPlaceholder="输入商品名称搜索" propBgColor="#fff"></component-search>
  23. </view>
  24. </view>
  25. <!-- #ifdef H5 || MP-TOUTIAO || APP -->
  26. <!-- 右上角icon列表 -->
  27. <view v-if="(right_icon_list || null) != null && right_icon_list.length > 0" class="nav-top-right-icon pa">
  28. <block v-for="(item,index) in right_icon_list">
  29. <view class="item dis-inline-block cp" :data-value="item.url || ''" @tap="url_event">
  30. <uni-icons :type="item.icon" size="32rpx" color="#f1f1f1"></uni-icons>
  31. <view v-if="(item.badge || null) != null" class="badge-icon pa">
  32. <component-badge :propNumber="item.badge"></component-badge>
  33. </view>
  34. </view>
  35. </block>
  36. </view>
  37. <!-- #endif -->
  38. </view>
  39. <!-- 轮播 -->
  40. <view class="banner-content padding-horizontal-main" v-if="banner_list.length > 0">
  41. <component-banner :propData="banner_list"></component-banner>
  42. </view>
  43. </view>
  44. <!-- 内容 -->
  45. <view class="content padding-horizontal-main">
  46. <!-- 导航 -->
  47. <view v-if="navigation.length > 0">
  48. <component-icon-nav :propData="navigation"></component-icon-nav>
  49. </view>
  50. <!-- 商城公告 -->
  51. <view class="notice-content spacing-mb" v-if="load_status == 1 && (common_shop_notice || null) != null">{{common_shop_notice}}</view>
  52. <!-- 推荐文章 -->
  53. <view v-if="article_list.length > 0" class="article-list padding-main border-radius-main oh bg-white spacing-mb">
  54. <image :src="static_url+'new-icon.png'" mode="aspectFit" class="new-icon va-m fl cp" data-value="/pages/article-category/article-category" @tap="url_event"></image>
  55. <view class="right-content fr va-m">
  56. <swiper :vertical="true" :autoplay="true" :circular="true" display-multiple-items="1" interval="3000">
  57. <block v-for="(item, index) in article_list" :key="index">
  58. <swiper-item class="single-text">
  59. <text class="cr-base text-size-sm cp" :data-value="item.category_url" @tap="url_event">[{{item.article_category_name}}]</text>
  60. <text class="cr-base text-size-sm margin-left-xs cp" :style="(item.title_color || null) != null ? 'color:'+item.title_color+' !important;' : ''" :data-value="item.url" @tap="url_event">{{item.title}}</text>
  61. </swiper-item>
  62. </block>
  63. </swiper>
  64. </view>
  65. </view>
  66. <!-- 按照插件顺序渲染插件数据 -->
  67. <block v-if="plugins_sort_list.length > 0">
  68. <block v-for="(pv, pi) in plugins_sort_list" :key="pi">
  69. <!-- 首页中间广告 - 插件 -->
  70. <view v-if="pv.plugins == 'homemiddleadv' && (plugins_homemiddleadv_data || null) != null && plugins_homemiddleadv_data.length > 0" class="plugins-homemiddleadv oh">
  71. <view v-for="(item, index) in plugins_homemiddleadv_data" :key="index" class="item border-radius-main oh cp spacing-mb" :data-value="item.url || ''" @tap="url_event">
  72. <image class="dis-block wh-auto border-radius-main" :src="item.images" mode="widthFix"></image>
  73. </view>
  74. </view>
  75. <!-- 限时秒杀 - 插件 -->
  76. <view v-if="pv.plugins == 'seckill' && plugins_seckill_is_valid == 1 && plugins_seckill_data.goods.length > 0" class="seckill border-radius-main padding-horizontal-main spacing-mb" :style="plugins_seckill_bg">
  77. <view class="spacing-nav-title">
  78. <text class="text-wrapper va-m">限时秒杀</text>
  79. <view class="dis-inline-block va-m margin-left-sm">
  80. <component-countdown :propHour="plugins_seckill_data.time.hours" :propMinute="plugins_seckill_data.time.minutes" :propSecond="plugins_seckill_data.time.seconds"></component-countdown>
  81. </view>
  82. <navigator url="/pages/plugins/seckill/index/index" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
  83. </view>
  84. <component-goods-list :propData="{style_type: 2, goods_list: plugins_seckill_data.goods}" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-goods-list>
  85. </view>
  86. <!-- 活动配置-楼层顶部 - 插件 -->
  87. <block v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
  88. <component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="0" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-activity-list>
  89. </block>
  90. <!-- 门店 - 插件 -->
  91. <block v-if="pv.plugins == 'realstore' && (plugins_realstore_data || null) != null">
  92. <view class="spacing-nav-title">
  93. <text class="text-wrapper">{{plugins_realstore_data.base.home_data_list_title || '最新门店'}}</text>
  94. <navigator url="/pages/plugins/realstore/search/search" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
  95. </view>
  96. <component-realstore-list :propDataList="plugins_realstore_data.data" :propFavorUser="plugins_realstore_data.favor_user"></component-realstore-list>
  97. </block>
  98. <!-- 多商户 - 插件 -->
  99. <block v-if="pv.plugins == 'shop' && (plugins_shop_data || null) != null">
  100. <view class="spacing-nav-title">
  101. <text class="text-wrapper">{{plugins_shop_data.base.home_data_list_title || '最新商家'}}</text>
  102. <navigator url="/pages/plugins/shop/index/index" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
  103. </view>
  104. <component-shop-list :propConfig="plugins_shop_data.base" :propDataList="plugins_shop_data.data"></component-shop-list>
  105. </block>
  106. <!-- 博客-楼层顶部 - 插件 -->
  107. <block v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
  108. <component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="0"></component-blog-list>
  109. </block>
  110. </block>
  111. </block>
  112. <!-- 楼层数据 -->
  113. <block v-if="(data_list || null) != null && data_list.length > 0">
  114. <!-- 数据模式0,1自动+手动、2拖拽 -->
  115. <block v-if="home_index_floor_data_type == 2">
  116. <!-- 引入拖拽数据模块 -->
  117. <component-layout :propData="data_list"></component-layout>
  118. </block>
  119. <block v-else>
  120. <!-- 自动+手动 -->
  121. <view v-for="(floor, index) in data_list" :key="index" class="floor">
  122. <view class="spacing-nav-title">
  123. <text class="text-wrapper" :style="'color:'+(floor.bg_color || '#333')+';'">{{floor.name}}</text>
  124. <text v-if="(floor.describe || null) != null" class="vice-name margin-left-lg cr-gray">{{floor.describe}}</text>
  125. <navigator :url="'/pages/goods-search/goods-search?category_id=' + floor.id" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
  126. </view>
  127. <view class="floor-list wh-auto oh pr">
  128. <view v-if="floor.items.length > 0" class="word-list scroll-view-horizontal margin-bottom-lg">
  129. <scroll-view :scroll-x="true">
  130. <block v-for="(icv, icx) in floor.items" :key="icx">
  131. <navigator :url="'/pages/goods-search/goods-search?category_id=' + icv.id" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{icv.name}}</navigator>
  132. </block>
  133. </scroll-view>
  134. </view>
  135. <block v-if="floor.goods.length > 0">
  136. <component-goods-list :propData="{style_type: 1, goods_list: floor.goods}" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true"></component-goods-list>
  137. </block>
  138. </view>
  139. </view>
  140. </block>
  141. </block>
  142. <!-- 按照插件顺序渲染插件数据 -->
  143. <block v-if="plugins_sort_list.length > 0">
  144. <block v-for="(pv, pi) in plugins_sort_list" :key="pi">
  145. <!-- 活动配置-楼层底部 - 插件 -->
  146. <block v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
  147. <component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="1" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol"></component-activity-list>
  148. </block>
  149. <!-- 博客-楼层底部 - 插件 -->
  150. <block v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
  151. <component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="1"></component-blog-list>
  152. </block>
  153. <!--- 底部购买记录 - 插件 -->
  154. <view v-if="pv.plugins == 'salerecords' && (plugins_salerecords_data || null) != null && (plugins_salerecords_data.data || null) != null && plugins_salerecords_data.data.length > 0" class="spacing-mb plugins-salerecords">
  155. <view class="spacing-nav-title">
  156. <text class="text-wrapper">{{plugins_salerecords_data.base.home_bottom_title || '最新购买'}}</text>
  157. <text v-if="(plugins_salerecords_data.base || null) != null && (plugins_salerecords_data.base.home_bottom_desc || null) != null" class="vice-name margin-left-lg cr-gray">{{plugins_salerecords_data.base.home_bottom_desc}}</text>
  158. </view>
  159. <view class="bg-white padding-horizontal-main border-radius-main oh">
  160. <swiper :vertical="true" :autoplay="true" :circular="true" :display-multiple-items="plugins_salerecords_data.data.length < 6 ? plugins_salerecords_data.data.length : 6" interval="3000" :style="plugins_salerecords_data.data.length < 6 ? 'height:'+(plugins_salerecords_data.data.length*84.33)+'rpx;' : ''">
  161. <block v-for="(item, index) in plugins_salerecords_data.data" :key="index">
  162. <swiper-item>
  163. <view class="item oh padding-vertical-main">
  164. <view class="item-content single-text fl">
  165. <image mode="widthFix" :src="item.user.avatar" class="va-m br"></image>
  166. <text class="margin-left-sm">{{item.user.user_name_view}}</text>
  167. <text v-if="(item.user.province || null) != null"><text class="padding-left-xs padding-right-xs">-</text>{{item.user.province}}</text>
  168. </view>
  169. <view class="item-content fl">
  170. <navigator :url="item.goods_url" hover-class="none" class="single-text">
  171. <image mode="widthFix" :src="item.images" class="va-m br"></image>
  172. <text class="margin-left-sm single-text">{{item.title}}</text>
  173. </navigator>
  174. </view>
  175. <view class="item-content single-text fr tr cr-gray padding-top-xs">{{item.add_time}}</view>
  176. </view>
  177. </swiper-item>
  178. </block>
  179. </swiper>
  180. </view>
  181. </view>
  182. </block>
  183. </block>
  184. <!-- 弹屏广告 - 插件 -->
  185. <view v-if="(plugins_popupscreen_data || null) != null && plugins_popupscreen_status == 1" class="plugins-popupscreen wh-auto ht-auto">
  186. <view class="content pr">
  187. <icon type="clear" size="20" class="close pa cp" @tap.stop="plugins_popupscreen_close_event"></icon>
  188. <image class="dis-block auto" :src="plugins_popupscreen_data.images" mode="widthFix" :data-value="plugins_popupscreen_data.images_url || ''" @tap="url_event"></image>
  189. </view>
  190. </view>
  191. <!-- 留言 -->
  192. <view v-if="load_status == 1 && common_app_is_enable_answer == 1" class="bg-white border-radius-main oh spacing-mt">
  193. <navigator url="/pages/answer-form/answer-form" hover-class="none">
  194. <image mode="widthFix" :src="static_url+'answer-form.jpg'" class="wh-auto border-radius-main"></image>
  195. </navigator>
  196. </view>
  197. </view>
  198. <!-- 提示信息 -->
  199. <block v-if="load_status == 0">
  200. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  201. </block>
  202. <!-- 结尾 -->
  203. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  204. <!-- 版权信息 -->
  205. <view v-if="load_status == 1">
  206. <component-copyright></component-copyright>
  207. </view>
  208. </view>
  209. <!-- 在线客服 -->
  210. <component-online-service :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data || 0"></component-online-service>
  211. <!-- 快捷导航 -->
  212. <component-quick-nav :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data || 0"></component-quick-nav>
  213. </view>
  214. </template>
  215. <script>
  216. const app = getApp();
  217. import componentSearch from "../../components/search/search";
  218. import componentQuickNav from "../../components/quick-nav/quick-nav";
  219. import componentIconNav from "../../components/icon-nav/icon-nav";
  220. import componentBanner from "../../components/slider/slider";
  221. import componentCountdown from "../../components/countdown/countdown";
  222. import componentLayout from "../../components/layout/layout";
  223. import componentBadge from "../../components/badge/badge";
  224. import componentNoData from "../../components/no-data/no-data";
  225. import componentBottomLine from "../../components/bottom-line/bottom-line";
  226. import componentCopyright from "../../components/copyright/copyright";
  227. import componentOnlineService from "../../components/online-service/online-service";
  228. import componentActivityList from "../../components/activity-list/activity-list";
  229. import componentBlogList from "../../components/blog-list/blog-list";
  230. import componentRealstoreList from "../../components/realstore-list/realstore-list";
  231. import componentShopList from "../../components/shop-list/shop-list";
  232. import componentGoodsList from "../../components/goods-list/goods-list";
  233. var common_static_url = app.globalData.get_static_url('common');
  234. var static_url = app.globalData.get_static_url('home');
  235. var seckill_static_url = app.globalData.get_static_url('seckill', true);
  236. // 状态栏高度
  237. var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
  238. // #ifdef MP-TOUTIAO
  239. bar_height = 0;
  240. // #endif
  241. export default {
  242. data() {
  243. return {
  244. common_static_url: common_static_url,
  245. static_url: static_url,
  246. data_list_loding_status: 1,
  247. data_list_loding_msg: '',
  248. data_bottom_line_status: false,
  249. load_status: 0,
  250. currency_symbol: app.globalData.data.currency_symbol,
  251. data_list: [],
  252. banner_list: [],
  253. navigation: [],
  254. article_list: [],
  255. cart_total: 0,
  256. message_total: 0,
  257. right_icon_list: [],
  258. // 基础配置
  259. common_shop_notice: null,
  260. home_index_floor_data_type: 0,
  261. common_app_is_enable_search: 0,
  262. common_app_is_enable_answer: 0,
  263. common_app_is_header_nav_fixed: 0,
  264. common_app_is_online_service: 0,
  265. // 名称
  266. application_title: app.globalData.data.application_title,
  267. application_logo: app.globalData.data.application_logo,
  268. is_logo_use_text: app.globalData.data.is_logo_use_text || 0,
  269. // 顶部+搜索样式配置
  270. top_content_style: 'background-image: url("'+static_url+'nav-top.png");'+'padding-top:'+(bar_height+8)+'px;',
  271. search_style: '',
  272. search_is_fixed: 0,
  273. // 是否单页预览
  274. is_single_page: app.globalData.is_current_single_page() || 0,
  275. // 插件顺序列表
  276. plugins_sort_list: [],
  277. // 限时秒杀插件
  278. plugins_seckill_bg: 'background: url('+seckill_static_url+'home-bg.png) top/100% no-repeat;',
  279. plugins_seckill_is_valid: 0,
  280. plugins_seckill_data: null,
  281. // 购买记录插件
  282. plugins_salerecords_data: null,
  283. // 活动配置插件
  284. plugins_activity_data: null,
  285. // 标签插件
  286. plugins_label_data: null,
  287. // 首页中间广告插件
  288. plugins_homemiddleadv_data: null,
  289. // 弹屏广告、这里设置一天后可以再次显示
  290. plugins_popupscreen_data: null,
  291. plugins_popupscreen_status: 0,
  292. plugins_popupscreen_cache_key: 'plugins_popupscreen_cache_key',
  293. plugins_popupscreen_timer: null,
  294. // 哀悼灰度插件
  295. plugins_mourning_data: 0,
  296. // 标签插件
  297. plugins_blog_data: null,
  298. // 门店插件
  299. plugins_realstore_data: null,
  300. // 多商户插件
  301. plugins_shop_data: null
  302. };
  303. },
  304. components: {
  305. componentSearch,
  306. componentQuickNav,
  307. componentIconNav,
  308. componentBanner,
  309. componentCountdown,
  310. componentLayout,
  311. componentBadge,
  312. componentNoData,
  313. componentBottomLine,
  314. componentCopyright,
  315. componentOnlineService,
  316. componentActivityList,
  317. componentBlogList,
  318. componentRealstoreList,
  319. componentShopList,
  320. componentGoodsList
  321. },
  322. props: {},
  323. onShow() {
  324. // 数据加载
  325. this.init();
  326. // 初始化配置
  327. this.init_config();
  328. },
  329. // 下拉刷新
  330. onPullDownRefresh() {
  331. this.init();
  332. },
  333. methods: {
  334. // 初始化配置
  335. init_config(status) {
  336. if ((status || false) == true) {
  337. this.setData({
  338. currency_symbol: app.globalData.get_config('currency_symbol'),
  339. common_shop_notice: app.globalData.get_config('config.common_shop_notice'),
  340. home_index_floor_data_type: app.globalData.get_config('config.home_index_floor_data_type'),
  341. common_app_is_enable_search: app.globalData.get_config('config.common_app_is_enable_search'),
  342. common_app_is_enable_answer: app.globalData.get_config('config.common_app_is_enable_answer'),
  343. common_app_is_header_nav_fixed: app.globalData.get_config('config.common_app_is_header_nav_fixed'),
  344. common_app_is_online_service: app.globalData.get_config('config.common_app_is_online_service'),
  345. application_title: app.globalData.get_application_title(),
  346. application_logo: app.globalData.get_application_logo()
  347. });
  348. } else {
  349. app.globalData.is_config(this, 'init_config');
  350. }
  351. },
  352. // 获取数据
  353. init() {
  354. this.setData({
  355. data_list_loding_status: 1
  356. });
  357. uni.request({
  358. url: app.globalData.get_request_url("index", "index"),
  359. method: 'POST',
  360. data: {},
  361. dataType: 'json',
  362. success: res => {
  363. uni.stopPullDownRefresh();
  364. // 获取最新缓存
  365. if (this.load_status == 0) {
  366. this.init_config(true);
  367. }
  368. // 设置首次加载状态
  369. this.setData({
  370. load_status: 1
  371. });
  372. if (res.data.code == 0) {
  373. var data = res.data.data;
  374. this.setData({
  375. data_bottom_line_status: true,
  376. banner_list: data.banner_list || [],
  377. navigation: data.navigation || [],
  378. article_list: data.article_list || [],
  379. data_list: data.data_list,
  380. cart_total: data.cart_total.buy_number || 0,
  381. message_total: parseInt(data.message_total || 0),
  382. right_icon_list: data.right_icon_list || [],
  383. data_list_loding_status: data.data_list.length == 0 ? 0 : 3,
  384. plugins_sort_list: data.plugins_sort_list || [],
  385. plugins_seckill_data: data.plugins_seckill_data || null,
  386. plugins_seckill_is_valid: (data.plugins_seckill_data || null) != null && (data.plugins_seckill_data.is_valid || 0) == 1 ? 1 : 0,
  387. plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data,
  388. plugins_activity_data: (data.plugins_activity_data || null) == null || data.plugins_activity_data.length <= 0 ? null : data.plugins_activity_data,
  389. plugins_label_data: (data.plugins_label_data || null) == null || (data.plugins_label_data.base || null) == null || (data.plugins_label_data.data || null) == null || data.plugins_label_data.data.length <= 0 ? null : data.plugins_label_data,
  390. plugins_homemiddleadv_data: (data.plugins_homemiddleadv_data || null) == null || data.plugins_homemiddleadv_data.length <= 0 ? null : data.plugins_homemiddleadv_data,
  391. plugins_popupscreen_data: data.plugins_popupscreen_data || null,
  392. plugins_mourning_data: data.plugins_mourning_data || 0,
  393. plugins_blog_data: data.plugins_blog_data || null,
  394. plugins_realstore_data: data.plugins_realstore_data || null,
  395. plugins_shop_data: data.plugins_shop_data || null
  396. });
  397. // 弹屏广告插件处理
  398. this.plugins_popupscreen_handle();
  399. // 导航购物车处理
  400. if (this.cart_total <= 0) {
  401. app.globalData.set_tab_bar_badge(2, 0);
  402. } else {
  403. app.globalData.set_tab_bar_badge(2, 1, this.cart_total);
  404. }
  405. // 搜索框宽度处理
  406. // #ifdef MP-TOUTIAO
  407. var len = (this.right_icon_list || []).length;
  408. var val = (len <= 0) ? 0 : 66*len;
  409. this.setData({
  410. search_style: 'width: calc(100% - '+val+'rpx);',
  411. });
  412. // #endif
  413. } else {
  414. this.setData({
  415. data_list_loding_status: 0,
  416. data_list_loding_msg: res.data.msg,
  417. data_bottom_line_status: true
  418. });
  419. app.globalData.showToast(res.data.msg);
  420. }
  421. // 分享菜单处理、延时执行,确保基础数据已加载完成
  422. setTimeout(function() {
  423. app.globalData.page_share_handle();
  424. }, 3000);
  425. },
  426. fail: () => {
  427. uni.stopPullDownRefresh();
  428. this.setData({
  429. data_list_loding_status: 2,
  430. data_list_loding_msg: '服务器请求出错',
  431. data_bottom_line_status: true,
  432. load_status: 1
  433. });
  434. app.globalData.showToast('服务器请求出错');
  435. }
  436. });
  437. },
  438. // 页面滚动监听
  439. onPageScroll(e) {
  440. if(this.common_app_is_header_nav_fixed == 1 && this.common_app_is_enable_search == 1) {
  441. var top = e.scrollTop > 35 ? 35 : e.scrollTop;
  442. var num = top*7;
  443. var base = 230;
  444. // #ifdef MP-ALIPAY
  445. base = 235
  446. // #endif
  447. // #ifdef H5 || MP-TOUTIAO || APP
  448. var len = (this.right_icon_list || []).length;
  449. base = (len <= 0) ? 0 : 66*len;
  450. // #endif
  451. // 开启哀悼插件的时候不需要浮动导航并且搜索框也不需要缩短、开启站点灰度会导致浮动失效
  452. if((this.plugins_mourning_data || 0) != 1) {
  453. var top_val = 35;
  454. var val = (num > base) ? base : num;
  455. // #ifdef MP-TOUTIAO
  456. top_val = 0;
  457. val = base
  458. // #endif
  459. this.setData({
  460. search_style: 'width: calc(100% - '+(val < 0 ? 0 : val)+'rpx);',
  461. search_is_fixed: (top >= top_val) ? 1 : 0,
  462. });
  463. }
  464. }
  465. },
  466. // url事件
  467. url_event(e) {
  468. app.globalData.url_event(e);
  469. },
  470. // 弹屏广告插件处理
  471. plugins_popupscreen_handle() {
  472. if(this.plugins_popupscreen_data != null) {
  473. // 不存在关闭缓存或者超过间隔时间则显示
  474. var cv = parseInt(uni.getStorageSync(this.plugins_popupscreen_cache_key)) || 0;
  475. var pv = parseInt(this.plugins_popupscreen_data.interval_time) || 86400;
  476. if(cv == 0 || cv+pv < app.globalData.get_timestamp()) {
  477. // 是否开启自动关闭
  478. var timer = null;
  479. var ct = parseInt(this.plugins_popupscreen_data.close_time) || 0;
  480. if(ct > 0) {
  481. var self = this;
  482. timer = setTimeout(function() {
  483. self.setData({
  484. plugins_popupscreen_status: 0
  485. });
  486. uni.setStorage({
  487. key: self.plugins_popupscreen_cache_key,
  488. data: app.globalData.get_timestamp()
  489. });
  490. }, ct*1000);
  491. }
  492. this.setData({
  493. plugins_popupscreen_status: 1,
  494. plugins_popupscreen_timer: timer
  495. });
  496. }
  497. }
  498. },
  499. // 弹屏广告 - 插件 关闭事件
  500. plugins_popupscreen_close_event(e) {
  501. this.setData({
  502. plugins_popupscreen_status: 0,
  503. });
  504. uni.setStorage({
  505. key: this.plugins_popupscreen_cache_key,
  506. data: app.globalData.get_timestamp()
  507. });
  508. clearInterval(this.plugins_popupscreen_timer);
  509. }
  510. }
  511. };
  512. </script>
  513. <style>
  514. @import './index.css';
  515. </style>