shareCheckInUndefined.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  6. <meta name="format-detection" content="telephone=no">
  7. <title>打卡分享</title>
  8. <style>
  9. :root {
  10. --orange: #F58220;
  11. --text: #333333;
  12. --text-secondary: #999999;
  13. --border: #EEEEEE;
  14. --bg: #FFFFFF;
  15. --safe-bottom: env(safe-area-inset-bottom, 0px);
  16. }
  17. * {
  18. margin: 0;
  19. padding: 0;
  20. box-sizing: border-box;
  21. }
  22. html {
  23. font-size: 16px;
  24. -webkit-tap-highlight-color: transparent;
  25. overflow-x: hidden;
  26. }
  27. body {
  28. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  29. background: var(--bg);
  30. color: var(--text);
  31. padding-bottom: calc(88px + var(--safe-bottom));
  32. min-height: 100vh;
  33. overflow-x: hidden;
  34. }
  35. .hero.hero--empty {
  36. display: flex;
  37. flex-direction: column;
  38. align-items: center;
  39. justify-content: center;
  40. padding: 48px 24px 56px;
  41. min-height: min(52vh, 440px);
  42. background: var(--bg);
  43. }
  44. .hero--empty__illustration {
  45. display: block;
  46. width: 100%;
  47. max-width: 280px;
  48. height: auto;
  49. object-fit: contain;
  50. }
  51. .hero--empty__tip {
  52. padding: 0 16px;
  53. margin-top: 12px;
  54. font-size: 15px;
  55. line-height: 1.5;
  56. color: var(--text-secondary);
  57. text-align: center;
  58. font-weight: 400;
  59. }
  60. .divider {
  61. height: 8px;
  62. background: #F7F7F7;
  63. margin: 0;
  64. }
  65. .more-title {
  66. padding: 8px 15px 12px;
  67. font-size: 16px;
  68. font-weight: 700;
  69. }
  70. .more-scroll {
  71. display: grid;
  72. grid-template-columns: repeat(2, 1fr);
  73. gap: 10px;
  74. padding: 0 15px 20px;
  75. }
  76. #recEmpty {
  77. grid-column: 1 / -1;
  78. }
  79. .rec-card {
  80. min-width: 0;
  81. background: #fff;
  82. border-radius: 10px;
  83. overflow: hidden;
  84. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  85. }
  86. .rec-card__img {
  87. aspect-ratio: 4 / 3;
  88. background: #eee;
  89. }
  90. .rec-card__img img {
  91. width: 100%;
  92. height: 100%;
  93. object-fit: cover;
  94. display: block;
  95. border-radius: 0;
  96. }
  97. .rec-card__body {
  98. padding: 10px;
  99. }
  100. .rec-card__top {
  101. display: flex;
  102. justify-content: space-between;
  103. align-items: baseline;
  104. gap: 8px;
  105. margin-bottom: 6px;
  106. }
  107. .rec-card__name {
  108. font-size: 15px;
  109. font-weight: 700;
  110. flex: 1;
  111. min-width: 0;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. white-space: nowrap;
  115. }
  116. .rec-card__dist {
  117. font-size: 12px;
  118. color: var(--text-secondary);
  119. flex-shrink: 0;
  120. }
  121. .rec-card__rating {
  122. display: flex;
  123. align-items: center;
  124. flex-wrap: wrap;
  125. gap: 4px 6px;
  126. }
  127. .rec-card__rating .stars {
  128. display: inline-flex;
  129. align-items: center;
  130. gap: 2px;
  131. }
  132. .rec-card__rating .rec-star {
  133. display: block;
  134. flex-shrink: 0;
  135. }
  136. .rec-card__rating .rating-num {
  137. font-size: 12px;
  138. font-weight: 600;
  139. color: var(--orange);
  140. }
  141. .rec-meta {
  142. font-size: 12px;
  143. color: var(--text-secondary);
  144. }
  145. .rec-card__footer {
  146. margin-top: 8px;
  147. font-size: 12px;
  148. color: var(--text-secondary);
  149. overflow: hidden;
  150. text-overflow: ellipsis;
  151. white-space: nowrap;
  152. }
  153. .fab-wrap {
  154. position: fixed;
  155. left: 0;
  156. right: 0;
  157. bottom: 0;
  158. z-index: 200;
  159. padding: 12px 24px calc(12px + var(--safe-bottom));
  160. background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
  161. pointer-events: none;
  162. }
  163. .fab-wrap .fab {
  164. pointer-events: auto;
  165. }
  166. .fab {
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. gap: 10px;
  171. width: 100%;
  172. max-width: 320px;
  173. margin: 0 auto;
  174. height: 48px;
  175. border: none;
  176. border-radius: 24px;
  177. background: var(--orange);
  178. color: #fff;
  179. font-size: 16px;
  180. font-weight: 600;
  181. box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
  182. cursor: pointer;
  183. }
  184. .fab img {
  185. flex-shrink: 0;
  186. }
  187. .home-indicator {
  188. height: 5px;
  189. background: #000;
  190. border-radius: 3px;
  191. width: 134px;
  192. margin: 8px auto 4px;
  193. opacity: 0.2;
  194. }
  195. </style>
  196. </head>
  197. <body>
  198. <div class="hero hero--empty" role="status" aria-live="polite">
  199. <img class="hero--empty__illustration" id="heroEmptyIllustration" src="images/empty.png" alt="" decoding="async">
  200. <p class="hero--empty__tip" id="heroEmptyTip">内容已删除</p>
  201. </div>
  202. <div class="divider"></div>
  203. <h3 class="more-title">更多推荐</h3>
  204. <div class="more-scroll" id="recList">
  205. <p id="recEmpty" style="padding:12px;color:#999;font-size:14px;display:none;">暂无推荐</p>
  206. </div>
  207. <div class="fab-wrap">
  208. <button type="button" class="fab" id="openApp">
  209. <img src="images/uBtn.png" alt="APP内打开" decoding="async">
  210. </button>
  211. <div class="home-indicator" aria-hidden="true"></div>
  212. </div>
  213. <script>
  214. (function () {
  215. 'use strict';
  216. /**
  217. * 更多推荐:POST …/dev-life-manager-ai/ai/multimodal-services/api/v1/search/global/store-recommend
  218. * 请求体:page、pageSize、storeId(字符串)、userCity、userLat、userLng;均可由 URL query 覆盖。
  219. *
  220. * businessStatus=99(关店,与 shareIndex.html 一致):点「APP内打开」深链为 shopro://pages/index/login?…,不再进打卡页。
  221. */
  222. var API_LIFE_AI_BASE = 'http://183.252.196.135:9100';
  223. var STORE_GLOBAL_RECOMMEND_PATH =
  224. '/ai/multimodal-services/api/v1/search/global/store-recommend';
  225. var DEFAULT_USER_LAT = 38.925747;
  226. var DEFAULT_USER_LNG = 121.662531;
  227. var DEFAULT_USER_CITY = '大连市';
  228. var DEFAULT_STORE_ID = '378';
  229. var APP_ANDROID_PACKAGE = 'com.alien.Udianzaizhe';
  230. var APP_IOS_URL_SCHEME = 'shopro://';
  231. var APP_UNI_STORE_PATH = 'pages/checkIn/index';
  232. function qs() {
  233. return new URLSearchParams(location.search || '');
  234. }
  235. function q(name) {
  236. var v = qs().get(name);
  237. return v == null ? '' : String(v);
  238. }
  239. function showDownloadTip() {
  240. var msg = '请到应用商店下载';
  241. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  242. uni.showToast({ title: msg, icon: 'none', duration: 2500 });
  243. } else {
  244. window.alert(msg);
  245. }
  246. }
  247. function mergeSearchAndHashParams() {
  248. var params = new URLSearchParams();
  249. function ingest(querySlice) {
  250. if (!querySlice) return;
  251. var p = new URLSearchParams(querySlice);
  252. p.forEach(function (val, key) {
  253. params.append(key, val);
  254. });
  255. }
  256. if (location.search && location.search.length > 1) {
  257. ingest(location.search.slice(1));
  258. }
  259. var hash = location.hash || '';
  260. var qi = hash.indexOf('?');
  261. if (qi >= 0) {
  262. ingest(hash.slice(qi + 1));
  263. }
  264. return params;
  265. }
  266. /**
  267. * 关店 businessStatus=99:URL(含 hash)带 businessStatus=99 时,唤起 App 进 pages/index/login(与 shareIndex.html isClosedMerchantForAppOpen)。
  268. */
  269. function isClosedMerchantForAppOpen() {
  270. try {
  271. var bs = String(mergeSearchAndHashParams().get('businessStatus') || '').trim();
  272. if (bs === '99' || Number(bs) === 99) return true;
  273. } catch (e0) {}
  274. var bs2 = String(q('businessStatus') || '').trim();
  275. return bs2 === '99' || Number(bs2) === 99;
  276. }
  277. function getAppUniPathForCheckInShare() {
  278. if (isClosedMerchantForAppOpen()) {
  279. return 'pages/index/login';
  280. }
  281. return String(APP_UNI_STORE_PATH || 'pages/checkIn/index').replace(/^\//, '');
  282. }
  283. /** businessStatus=99(商户关闭):插图与文案;否则为「内容已删除」 */
  284. function applyEmptyHeroState() {
  285. var merged = mergeSearchAndHashParams();
  286. var bsRaw = merged.get('businessStatus');
  287. if (bsRaw == null || bsRaw === '') bsRaw = q('businessStatus');
  288. var bs = bsRaw == null ? '' : String(bsRaw).trim();
  289. var isClosed = Number(bs) === 99 || bs === '99';
  290. var img = document.getElementById('heroEmptyIllustration');
  291. var tip = document.getElementById('heroEmptyTip');
  292. if (!img || !tip) return;
  293. if (isClosed) {
  294. img.src = 'images/storeNone.png';
  295. img.alt = '';
  296. tip.textContent = '抱歉商户已关闭,看看别的吧';
  297. } else {
  298. img.src = 'images/empty.png';
  299. img.alt = '';
  300. tip.textContent = '内容已删除';
  301. }
  302. img.onerror = function () {
  303. this.onerror = null;
  304. this.src = 'images/empty.png';
  305. };
  306. }
  307. function buildAppOpenQueryStringMerged() {
  308. var params = mergeSearchAndHashParams();
  309. var sid = params.get('storeId') || params.get('id') || '';
  310. if (sid && !params.has('storeId')) {
  311. params.set('storeId', sid);
  312. }
  313. return params.toString() ? ('?' + params.toString()) : '';
  314. }
  315. function buildAppDeepLink() {
  316. var path = getAppUniPathForCheckInShare().replace(/^\//, '');
  317. var s = buildAppOpenQueryStringMerged();
  318. var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
  319. if (!s) {
  320. return root + '/' + path;
  321. }
  322. return root + '/' + path + s;
  323. }
  324. function launchAppDeepLink(deepLink) {
  325. try {
  326. var a = document.createElement('a');
  327. a.href = deepLink;
  328. a.setAttribute('target', '_self');
  329. document.body.appendChild(a);
  330. a.click();
  331. document.body.removeChild(a);
  332. } catch (e1) {}
  333. try {
  334. window.location.href = deepLink;
  335. } catch (e2) {}
  336. }
  337. function tryOpenHBuilderApp() {
  338. var deepLink = buildAppDeepLink();
  339. if (typeof plus !== 'undefined' && plus.runtime) {
  340. var installed = null;
  341. try {
  342. if (typeof plus.runtime.isApplicationExist === 'function') {
  343. installed = plus.runtime.isApplicationExist({
  344. pname: APP_ANDROID_PACKAGE,
  345. action: APP_IOS_URL_SCHEME
  346. });
  347. }
  348. } catch (e) {
  349. console.warn(e);
  350. }
  351. if (installed === false) {
  352. showDownloadTip();
  353. return;
  354. }
  355. if (installed === true) {
  356. try {
  357. plus.runtime.openURL(deepLink);
  358. } catch (e2) {
  359. console.warn(e2);
  360. showDownloadTip();
  361. }
  362. return;
  363. }
  364. }
  365. var t0 = Date.now();
  366. var done = false;
  367. function finish() {
  368. if (done) return;
  369. done = true;
  370. document.removeEventListener('visibilitychange', onVis);
  371. window.removeEventListener('pagehide', onHide);
  372. }
  373. function onVis() {
  374. if (document.visibilityState === 'hidden') finish();
  375. }
  376. function onHide() {
  377. finish();
  378. }
  379. document.addEventListener('visibilitychange', onVis);
  380. window.addEventListener('pagehide', onHide);
  381. launchAppDeepLink(deepLink);
  382. window.setTimeout(function () {
  383. if (done) return;
  384. if (document.visibilityState === 'visible' && Date.now() - t0 < 3500) {
  385. showDownloadTip();
  386. }
  387. finish();
  388. }, 2600);
  389. }
  390. function isApiOk(res) {
  391. if (!res || typeof res !== 'object') return false;
  392. if (res.success === false) return false;
  393. var c = res.code;
  394. return c === 200 || c === '200' || Number(c) === 200;
  395. }
  396. function fetchStoreGlobalRecommend() {
  397. var latRaw = (q('userLat') || q('latitude') || q('lat') || q('weidu')).trim();
  398. var lngRaw = (q('userLng') || q('longitude') || q('lon') || q('jingdu')).trim();
  399. var userLat =
  400. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : DEFAULT_USER_LAT;
  401. var userLng =
  402. lngRaw !== '' && !isNaN(Number(lngRaw)) ? Number(lngRaw) : DEFAULT_USER_LNG;
  403. var page = parseInt(q('page') || '1', 10);
  404. var pageSize = parseInt(q('pageSize') || '10', 10);
  405. if (isNaN(page) || page < 1) page = 1;
  406. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  407. var storeIdRaw = (q('storeId') || q('id') || '').trim();
  408. var storeId = storeIdRaw !== '' ? storeIdRaw : DEFAULT_STORE_ID;
  409. var userCityRaw = (q('userCity') || q('city') || '').trim();
  410. var userCity = userCityRaw !== '' ? userCityRaw : DEFAULT_USER_CITY;
  411. var body = {
  412. page: page,
  413. pageSize: pageSize,
  414. storeId: String(storeId),
  415. userCity: userCity,
  416. userLat: userLat,
  417. userLng: userLng
  418. };
  419. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  420. method: 'POST',
  421. mode: 'cors',
  422. credentials: 'omit',
  423. headers: {
  424. Accept: 'application/json',
  425. 'Content-Type': 'application/json;charset=UTF-8'
  426. },
  427. body: JSON.stringify(body)
  428. }).then(function (res) {
  429. if (!res.ok) throw new Error('HTTP ' + res.status);
  430. return res.json();
  431. });
  432. }
  433. function normalizeStoreRecommendList(res) {
  434. if (!res || typeof res !== 'object') return [];
  435. var raw = res.data != null ? res.data : res.result;
  436. if (Array.isArray(raw)) return raw;
  437. if (raw && typeof raw === 'object') {
  438. if (Array.isArray(raw.list)) return raw.list;
  439. if (Array.isArray(raw.records)) return raw.records;
  440. if (Array.isArray(raw.rows)) return raw.rows;
  441. if (Array.isArray(raw.content)) return raw.content;
  442. if (Array.isArray(raw.stores)) return raw.stores;
  443. if (Array.isArray(raw.storeList)) return raw.storeList;
  444. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  445. if (Array.isArray(raw.items)) return raw.items;
  446. }
  447. if (Array.isArray(res.list)) return res.list;
  448. if (Array.isArray(res.records)) return res.records;
  449. return [];
  450. }
  451. function formatRecDistance(item) {
  452. /** 后端 distance 为千米,展示为米 */
  453. if (item.distance != null && item.distance !== '') {
  454. var km = Number(item.distance);
  455. if (!isNaN(km) && km >= 0) {
  456. return Math.round(km * 1000) + '米';
  457. }
  458. return String(item.distance).trim();
  459. }
  460. if (item.position != null && String(item.position).trim() !== '') {
  461. return String(item.position).trim();
  462. }
  463. if (item.dist != null && item.dist !== '') {
  464. var dn = Number(item.dist);
  465. if (!isNaN(dn)) {
  466. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  467. }
  468. }
  469. return '';
  470. }
  471. function escHtml(s) {
  472. return String(s == null ? '' : s)
  473. .replace(/&/g, '&amp;')
  474. .replace(/</g, '&lt;')
  475. .replace(/>/g, '&gt;')
  476. .replace(/"/g, '&quot;');
  477. }
  478. var STAR_PATH = 'M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z';
  479. function starsHtml(score) {
  480. var s = Number(score);
  481. if (isNaN(s)) s = 0;
  482. s = Math.max(0, Math.min(5, s));
  483. var rounded = Math.round(s);
  484. var parts = [];
  485. var i;
  486. for (i = 1; i <= 5; i++) {
  487. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  488. parts.push(
  489. '<svg class="rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  490. '<path fill="' + fill + '" d="' + STAR_PATH + '"/></svg>'
  491. );
  492. }
  493. return '<span class="stars">' + parts.join('') + '</span>';
  494. }
  495. function pickScore(item) {
  496. var x =
  497. item.scoreAvg != null ? Number(item.scoreAvg)
  498. : item.score != null ? Number(item.score)
  499. : item.rating != null ? Number(item.rating)
  500. : item.starScore != null ? Number(item.starScore)
  501. : NaN;
  502. return isNaN(x) ? null : x;
  503. }
  504. function pickReviewCount(item) {
  505. var n =
  506. item.commitCount != null ? Number(item.commitCount)
  507. : item.commentCount != null ? Number(item.commentCount)
  508. : item.reviewCount != null ? Number(item.reviewCount)
  509. : item.evaluateCount != null ? Number(item.evaluateCount)
  510. : NaN;
  511. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  512. }
  513. function renderRecommended(list) {
  514. var wrap = document.getElementById('recList');
  515. var empty = document.getElementById('recEmpty');
  516. wrap.querySelectorAll('.rec-card').forEach(function (n) {
  517. n.remove();
  518. });
  519. if (!list || !list.length) {
  520. empty.style.display = 'block';
  521. return;
  522. }
  523. empty.style.display = 'none';
  524. list.forEach(function (item) {
  525. if (!item || typeof item !== 'object') return;
  526. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  527. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  528. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  529. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  530. if (vf) home = vf;
  531. }
  532. var imgUrl =
  533. imgUrlField ||
  534. home ||
  535. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  536. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  537. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  538. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  539. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  540. (Array.isArray(item.imageList) && item.imageList[0]) ||
  541. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  542. '';
  543. var name = item.title != null && String(item.title).trim() !== ''
  544. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  545. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  546. var dist = formatRecDistance(item);
  547. var scoreVal = pickScore(item);
  548. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  549. var starScore = scoreVal != null ? scoreVal : 0;
  550. var rc = pickReviewCount(item);
  551. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  552. var seller =
  553. item.userName != null && String(item.userName).trim() !== ''
  554. ? String(item.userName).trim()
  555. : (item.nickName != null && String(item.nickName).trim() !== ''
  556. ? String(item.nickName).trim()
  557. : '');
  558. var card = document.createElement('article');
  559. card.className = 'rec-card';
  560. card.innerHTML =
  561. '<div class="rec-card__img"><img class="rec-card__cover" src="" alt="" decoding="async"></div>' +
  562. '<div class="rec-card__body">' +
  563. '<div class="rec-card__top">' +
  564. '<span class="rec-card__name">' + escHtml(name) + '</span>' +
  565. (dist ? '<span class="rec-card__dist">' + escHtml(dist) + '</span>' : '') +
  566. '</div>' +
  567. '<div class="rec-card__rating">' +
  568. starsHtml(starScore) +
  569. '<span class="rating-num">' + escHtml(displayScore) + '</span>' +
  570. (reviewLabel ? '<span class="rec-meta">' + escHtml(reviewLabel) + '</span>' : '') +
  571. '</div>' +
  572. (seller ? '<div class="rec-card__footer">' + escHtml(seller) + '</div>' : '') +
  573. '</div>';
  574. var coverIm = card.querySelector('img.rec-card__cover');
  575. if (coverIm) {
  576. coverIm.src = imgUrl;
  577. coverIm.onerror = function () {
  578. this.onerror = null;
  579. this.src = '';
  580. };
  581. }
  582. wrap.appendChild(card);
  583. });
  584. }
  585. function run() {
  586. fetchStoreGlobalRecommend()
  587. .then(function (res) {
  588. var list = normalizeStoreRecommendList(res);
  589. if (!list.length && res && res.msg) {
  590. console.warn('[store-recommend]', res.msg);
  591. }
  592. renderRecommended(list);
  593. })
  594. .catch(function (e) {
  595. console.error(e);
  596. renderRecommended([]);
  597. });
  598. }
  599. function boot() {
  600. applyEmptyHeroState();
  601. run();
  602. var openBtn = document.getElementById('openApp');
  603. if (openBtn) {
  604. openBtn.addEventListener('click', function () {
  605. tryOpenHBuilderApp();
  606. });
  607. }
  608. }
  609. if (document.readyState === 'complete') {
  610. boot();
  611. } else {
  612. window.onload = boot;
  613. }
  614. })();
  615. </script>
  616. </body>
  617. </html>