shareIndex.html 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029
  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>U店在哪</title>
  8. <style>
  9. :root {
  10. --orange: #F58220;
  11. --orange-light: #FFF4E8;
  12. --red: #FF4D4F;
  13. --text: #333333;
  14. --text-secondary: #999999;
  15. --border: #EEEEEE;
  16. --bg: #FFFFFF;
  17. --safe-bottom: env(safe-area-inset-bottom, 0px);
  18. }
  19. * {
  20. margin: 0;
  21. padding: 0;
  22. box-sizing: border-box;
  23. }
  24. html {
  25. font-size: 16px;
  26. -webkit-tap-highlight-color: transparent;
  27. overflow-x: hidden;
  28. }
  29. body {
  30. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  31. background: var(--bg);
  32. color: var(--text);
  33. padding-bottom: calc(88px + var(--safe-bottom));
  34. min-height: 100vh;
  35. overflow-x: hidden;
  36. }
  37. /* Header */
  38. .header {
  39. position: sticky;
  40. top: 0;
  41. z-index: 100;
  42. display: flex;
  43. align-items: center;
  44. justify-content: center;
  45. height: 44px;
  46. padding: 0 15px;
  47. background: var(--bg);
  48. border-bottom: 1px solid var(--border);
  49. }
  50. .header__back {
  51. position: absolute;
  52. left: 15px;
  53. width: 24px;
  54. height: 24px;
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. color: var(--text);
  59. text-decoration: none;
  60. }
  61. .header__title {
  62. font-size: 17px;
  63. font-weight: 600;
  64. color: var(--text);
  65. }
  66. /* Hero carousel */
  67. .hero {
  68. position: relative;
  69. margin: 0 15px;
  70. margin-top: 10px;
  71. border-radius: 0 0 12px 12px;
  72. overflow: hidden;
  73. }
  74. .hero__track {
  75. display: flex;
  76. transition: transform 0.35s ease;
  77. }
  78. .hero__slide {
  79. flex: 0 0 100%;
  80. aspect-ratio: 16 / 10;
  81. background: #f0f0f0;
  82. }
  83. .hero__slide img {
  84. width: 100%;
  85. height: 100%;
  86. object-fit: cover;
  87. display: block;
  88. vertical-align: middle;
  89. }
  90. .hero__dots {
  91. position: absolute;
  92. bottom: 12px;
  93. left: 0;
  94. right: 0;
  95. display: flex;
  96. justify-content: center;
  97. align-items: center;
  98. gap: 6px;
  99. }
  100. .hero__dot {
  101. width: 6px;
  102. height: 6px;
  103. border-radius: 3px;
  104. background: rgba(255, 255, 255, 0.45);
  105. transition: width 0.25s ease, background 0.25s ease;
  106. }
  107. .hero__dot.is-active {
  108. width: 16px;
  109. background: #fff;
  110. }
  111. /* Store block */
  112. .section {
  113. padding: 16px 15px 0;
  114. }
  115. .store-name {
  116. font-size: 20px;
  117. font-weight: 700;
  118. line-height: 1.35;
  119. margin-bottom: 12px;
  120. }
  121. .row {
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. gap: 10px;
  126. }
  127. .rating-row {
  128. margin-bottom: 12px;
  129. }
  130. .stars {
  131. display: inline-flex;
  132. align-items: center;
  133. gap: 2px;
  134. }
  135. .star {
  136. width: 14px;
  137. height: 14px;
  138. color: var(--orange);
  139. }
  140. .rating-num {
  141. font-size: 14px;
  142. font-weight: 600;
  143. color: var(--orange);
  144. }
  145. .store-evaluate-row {
  146. display: none;
  147. flex-direction: row;
  148. flex-wrap: wrap;
  149. align-items: center;
  150. gap: 6px 6px;
  151. margin: 0 0 12px;
  152. padding: 0;
  153. font-size: 13px;
  154. line-height: 1.4;
  155. color: var(--text-secondary);
  156. }
  157. .store-evaluate-row.is-visible {
  158. display: flex;
  159. }
  160. .store-evaluate__item {
  161. white-space: nowrap;
  162. }
  163. .link-muted {
  164. display: inline-flex;
  165. align-items: center;
  166. gap: 2px;
  167. font-size: 13px;
  168. color: var(--text-secondary);
  169. text-decoration: none;
  170. }
  171. .chevron {
  172. width: 14px;
  173. height: 14px;
  174. opacity: 0.6;
  175. }
  176. .hours-row {
  177. /* margin-bottom: 16px; */
  178. align-items: flex-start;
  179. border-bottom:1px solid #eee;
  180. padding-bottom: 20px;
  181. }
  182. .hours-left {
  183. flex: 1;
  184. min-width: 0;
  185. }
  186. .status {
  187. font-size: 14px;
  188. color: var(--red);
  189. margin-right: 8px;
  190. }
  191. .status.is-open {
  192. color: var(--orange);
  193. }
  194. .hours-text {
  195. font-size: 14px;
  196. color: var(--text-secondary);
  197. }
  198. .divider {
  199. height: 8px;
  200. background: #F7F7F7;
  201. margin: 0;
  202. }
  203. /* Location */
  204. .loc-wrap {
  205. display: flex;
  206. padding: 16px 15px;
  207. gap: 12px;
  208. }
  209. .loc-main {
  210. flex: 1;
  211. min-width: 0;
  212. padding-right: 12px;
  213. }
  214. .addr {
  215. font-size: 15px;
  216. font-weight: 600;
  217. line-height: 1.45;
  218. margin-bottom: 10px;
  219. }
  220. .meta-line {
  221. display: flex;
  222. align-items: flex-start;
  223. gap: 6px;
  224. font-size: 13px;
  225. color: var(--text-secondary);
  226. line-height: 1.45;
  227. margin-top: 6px;
  228. }
  229. .meta-line svg,
  230. .meta-line img {
  231. flex-shrink: 0;
  232. margin-top: 2px;
  233. opacity: 0.75;
  234. display: block;
  235. }
  236. .loc-actions {
  237. display: flex;
  238. flex-direction: row;
  239. align-items: center;
  240. justify-content: center;
  241. gap: 18px;
  242. flex-shrink: 0;
  243. }
  244. .act-btn {
  245. display: flex;
  246. flex-direction: column;
  247. align-items: center;
  248. gap: 4px;
  249. background: none;
  250. border: none;
  251. padding: 0;
  252. cursor: pointer;
  253. font-size: 12px;
  254. color: var(--text);
  255. }
  256. .act-btn__icon {
  257. width: 44px;
  258. height: 44px;
  259. border-radius: 10px;
  260. background: #F5F5F5;
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. color: var(--orange);
  265. }
  266. .act-btn__icon img {
  267. width: 22px;
  268. height: 22px;
  269. object-fit: contain;
  270. display: block;
  271. }
  272. /* businessStatus===99 时仅展示关店提示并隐藏 .share-content;底部 FAB 仍在 #shareBelowContentEl */
  273. .closed-rec-wrap {
  274. display: none;
  275. }
  276. .closed-rec-divider {
  277. height: 8px;
  278. background: #F7F7F7;
  279. margin: 0;
  280. }
  281. .closed-rec-title {
  282. padding: 8px 15px 12px;
  283. font-size: 16px;
  284. font-weight: 700;
  285. }
  286. .closed-rec-grid {
  287. display: grid;
  288. grid-template-columns: repeat(2, 1fr);
  289. gap: 10px;
  290. padding: 0 15px 20px;
  291. }
  292. #shareClosedRecEmpty {
  293. grid-column: 1 / -1;
  294. }
  295. .closed-rec-empty {
  296. padding: 12px;
  297. color: var(--text-secondary);
  298. font-size: 14px;
  299. }
  300. .closed-rec-card {
  301. min-width: 0;
  302. background: #fff;
  303. border-radius: 10px;
  304. overflow: hidden;
  305. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  306. }
  307. .closed-rec-card__img {
  308. aspect-ratio: 4 / 3;
  309. background: #eee;
  310. }
  311. .closed-rec-card__img img {
  312. width: 100%;
  313. height: 100%;
  314. object-fit: cover;
  315. display: block;
  316. border-radius: 0;
  317. }
  318. .closed-rec-card__body {
  319. padding: 10px;
  320. }
  321. .closed-rec-card__top {
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: baseline;
  325. gap: 8px;
  326. margin-bottom: 6px;
  327. }
  328. .closed-rec-card__name {
  329. font-size: 15px;
  330. font-weight: 700;
  331. flex: 1;
  332. min-width: 0;
  333. overflow: hidden;
  334. text-overflow: ellipsis;
  335. white-space: nowrap;
  336. }
  337. .closed-rec-card__dist {
  338. font-size: 12px;
  339. color: var(--text-secondary);
  340. flex-shrink: 0;
  341. }
  342. .closed-rec-card__rating {
  343. display: flex;
  344. align-items: center;
  345. flex-wrap: wrap;
  346. gap: 4px 6px;
  347. }
  348. .closed-rec-card__rating .closed-rec-stars {
  349. display: inline-flex;
  350. align-items: center;
  351. gap: 2px;
  352. }
  353. .closed-rec-card__rating .closed-rec-star {
  354. display: block;
  355. flex-shrink: 0;
  356. }
  357. .closed-rec-card__rating .closed-rec-rating-num {
  358. font-size: 12px;
  359. font-weight: 600;
  360. color: var(--orange);
  361. }
  362. .closed-rec-meta {
  363. font-size: 12px;
  364. color: var(--text-secondary);
  365. }
  366. .closed-rec-card__footer {
  367. margin-top: 8px;
  368. font-size: 12px;
  369. color: var(--text-secondary);
  370. overflow: hidden;
  371. text-overflow: ellipsis;
  372. white-space: nowrap;
  373. }
  374. .share-none {
  375. display: none;
  376. text-align: center;
  377. padding: 28px 20px 16px;
  378. color: var(--text-muted);
  379. font-size: 15px;
  380. line-height: 1.5;
  381. }
  382. .share-none img {
  383. width: 240px;
  384. height: 240px;
  385. margin-bottom: 12px;
  386. display: inline-block;
  387. }
  388. .share-none p {
  389. margin: 0;
  390. padding:0 0 60px 0;
  391. color:#999;
  392. }
  393. /* FAB */
  394. .fab-wrap {
  395. position: fixed;
  396. left: 0;
  397. right: 0;
  398. bottom: 0;
  399. z-index: 200;
  400. padding: 12px 24px calc(12px + var(--safe-bottom));
  401. background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
  402. pointer-events: none;
  403. }
  404. #fabDock,
  405. .fab-dock__slot,
  406. #fabDock .fab,
  407. .fab-wx-hit {
  408. pointer-events: auto;
  409. }
  410. #fabDock {
  411. display: block;
  412. }
  413. .fab-dock__slot {
  414. position: relative;
  415. width: 100%;
  416. max-width: 320px;
  417. height: 48px;
  418. margin: 0 auto;
  419. -webkit-tap-highlight-color: transparent;
  420. }
  421. #openApp {
  422. position: relative;
  423. z-index: 1;
  424. touch-action: manipulation;
  425. }
  426. #openApp img {
  427. pointer-events: none;
  428. }
  429. .fab-wx-hit {
  430. display: none;
  431. width: 100%;
  432. height: 48px;
  433. }
  434. /* wx.config 成功后:隐藏普通按钮,只显示开放标签(真机必须直接点开放标签) */
  435. #fabDock.wx-open-enabled #openApp {
  436. display: none !important;
  437. }
  438. #fabDock.wx-open-enabled .fab-wx-hit {
  439. display: block;
  440. position: relative;
  441. left: auto;
  442. right: auto;
  443. top: auto;
  444. z-index: 3;
  445. }
  446. #launch-btn {
  447. display: block;
  448. width: 100%;
  449. height: 48px;
  450. min-height: 48px;
  451. line-height: 48px;
  452. }
  453. #openAppToast {
  454. display: none;
  455. position: fixed;
  456. left: 16px;
  457. right: 16px;
  458. bottom: calc(72px + var(--safe-bottom));
  459. z-index: 10001;
  460. padding: 10px 14px;
  461. font-size: 13px;
  462. line-height: 1.45;
  463. color: #fff;
  464. text-align: center;
  465. background: rgba(0, 0, 0, 0.78);
  466. border-radius: 8px;
  467. pointer-events: none;
  468. word-break: break-all;
  469. }
  470. .fab {
  471. display: flex;
  472. align-items: center;
  473. justify-content: center;
  474. gap: 10px;
  475. width: 100%;
  476. max-width: 320px;
  477. margin: 0 auto;
  478. height: 48px;
  479. border: none;
  480. border-radius: 24px;
  481. background: var(--orange);
  482. color: #fff;
  483. font-size: 16px;
  484. font-weight: 600;
  485. box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
  486. cursor: pointer;
  487. background:#F47D1F;
  488. }
  489. .fab__logo {
  490. width: 28px;
  491. height: 28px;
  492. flex-shrink: 0;
  493. }
  494. .home-indicator {
  495. height: 5px;
  496. background: #000;
  497. border-radius: 3px;
  498. width: 134px;
  499. margin: 8px auto 4px;
  500. opacity: 0.2;
  501. }
  502. /* 营销活动(getStoreCouponList.marketingList) */
  503. .marketing-section {
  504. padding: 4px 15px 20px;
  505. }
  506. .marketing-section__title {
  507. font-size: 16px;
  508. font-weight: 700;
  509. color: var(--text);
  510. margin: 0 0 12px;
  511. }
  512. .marketing-section__list {
  513. display: flex;
  514. flex-direction: column;
  515. gap: 12px;
  516. }
  517. .marketing-card {
  518. border-radius: 12px;
  519. overflow: hidden;
  520. background: #f0f0f0;
  521. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  522. }
  523. .marketing-card__media img,
  524. .marketing-card__media video {
  525. width: 100%;
  526. display: block;
  527. aspect-ratio: 16 / 9;
  528. object-fit: cover;
  529. vertical-align: middle;
  530. }
  531. .marketing-card__media video {
  532. background: #000;
  533. }
  534. .marketing-card--more {
  535. display: none;
  536. }
  537. .marketing-section.is-expanded .marketing-card--more {
  538. display: block;
  539. }
  540. .marketing-section__more {
  541. display: flex;
  542. align-items: center;
  543. justify-content: center;
  544. gap: 4px;
  545. width: 100%;
  546. margin-top: 14px;
  547. padding: 8px 0;
  548. border: none;
  549. background: none;
  550. font-size: 14px;
  551. color: var(--text-secondary);
  552. cursor: pointer;
  553. -webkit-tap-highlight-color: transparent;
  554. }
  555. .marketing-section__more-chevron {
  556. width: 16px;
  557. height: 16px;
  558. flex-shrink: 0;
  559. transition: transform 0.2s ease;
  560. }
  561. .marketing-section.is-expanded .marketing-section__more-chevron {
  562. transform: rotate(180deg);
  563. }
  564. .marketing-section__empty {
  565. display: flex;
  566. flex-direction: column;
  567. justify-content: center;
  568. align-items: center;
  569. padding: 10px 0 8px;
  570. }
  571. .marketing-section__empty img {
  572. width: 200px;
  573. height: 200px;
  574. display: block;
  575. object-fit: contain;
  576. }
  577. .marketing-section__empty-label {
  578. margin: 12px 0 0;
  579. font-size: 14px;
  580. color: var(--text-secondary);
  581. text-align: center;
  582. }
  583. /* 演出安排 performance/list/query */
  584. .performance-section {
  585. padding: 8px 0 20px;
  586. border-top: 1px solid var(--border);
  587. margin-top: 4px;
  588. }
  589. .performance-section__title {
  590. font-size: 16px;
  591. font-weight: 700;
  592. color: var(--text);
  593. margin: 0 15px 12px;
  594. }
  595. .performance-strip {
  596. display: flex;
  597. flex-direction: row;
  598. flex-wrap: nowrap;
  599. gap: 12px;
  600. overflow-x: auto;
  601. overflow-y: hidden;
  602. padding: 0 15px 4px;
  603. -webkit-overflow-scrolling: touch;
  604. scrollbar-width: none;
  605. }
  606. .performance-strip::-webkit-scrollbar {
  607. display: none;
  608. }
  609. .performance-card {
  610. flex: 0 0 auto;
  611. display: flex;
  612. flex-direction: row;
  613. align-items: stretch;
  614. gap: 10px;
  615. width: 272px;
  616. min-width: 272px;
  617. padding: 0;
  618. background: #fff;
  619. border-radius: 12px;
  620. overflow: hidden;
  621. }
  622. .performance-card__poster {
  623. flex: 0 0 76px;
  624. width: 76px;
  625. min-height: 102px;
  626. background: #eee;
  627. align-self: stretch;
  628. }
  629. .performance-card__poster img {
  630. width: 100%;
  631. height: 100%;
  632. min-height: 102px;
  633. object-fit: cover;
  634. display: block;
  635. vertical-align: middle;
  636. }
  637. .performance-card__body {
  638. flex: 1;
  639. min-width: 0;
  640. display: flex;
  641. flex-direction: column;
  642. justify-content: center;
  643. gap: 4px;
  644. padding: 10px 12px 10px 0;
  645. }
  646. .performance-card__name {
  647. font-size: 15px;
  648. font-weight: 700;
  649. color: var(--text);
  650. line-height: 1.3;
  651. overflow: hidden;
  652. text-overflow: ellipsis;
  653. display: -webkit-box;
  654. -webkit-line-clamp: 2;
  655. -webkit-box-orient: vertical;
  656. }
  657. .performance-card__meta {
  658. font-size: 12px;
  659. color: var(--text-secondary);
  660. line-height: 1.35;
  661. overflow: hidden;
  662. text-overflow: ellipsis;
  663. white-space: nowrap;
  664. }
  665. /* 人员阵容 queryStaffListByTitle */
  666. .staff-section {
  667. padding: 8px 0 24px;
  668. border-top: 1px solid var(--border);
  669. margin-top: 4px;
  670. }
  671. .staff-section__head {
  672. display: flex;
  673. align-items: center;
  674. justify-content: space-between;
  675. gap: 12px;
  676. padding: 0 15px;
  677. margin-bottom: 12px;
  678. }
  679. .staff-section__page-title {
  680. font-size: 16px;
  681. font-weight: 700;
  682. color: var(--text);
  683. margin: 0;
  684. flex: 1;
  685. min-width: 0;
  686. }
  687. .staff-section__all {
  688. flex-shrink: 0;
  689. display: inline-flex;
  690. align-items: center;
  691. gap: 2px;
  692. font-size: 13px;
  693. color: #151515;
  694. text-decoration: none;
  695. background: none;
  696. border: none;
  697. padding: 0;
  698. cursor: pointer;
  699. -webkit-tap-highlight-color: transparent;
  700. }
  701. .staff-section__all-chevron {
  702. width: 14px;
  703. height: 14px;
  704. opacity: 0.7;
  705. }
  706. .staff-group {
  707. margin-bottom: 20px;
  708. }
  709. .staff-group:last-child {
  710. margin-bottom: 0;
  711. }
  712. .staff-strip {
  713. display: flex;
  714. flex-direction: row;
  715. flex-wrap: nowrap;
  716. gap: 10px;
  717. overflow-x: auto;
  718. overflow-y: hidden;
  719. padding: 0 15px 4px;
  720. -webkit-overflow-scrolling: touch;
  721. scrollbar-width: none;
  722. }
  723. .staff-strip::-webkit-scrollbar {
  724. display: none;
  725. }
  726. .staff-card {
  727. flex: 0 0 112px;
  728. width: 112px;
  729. min-width: 112px;
  730. }
  731. .staff-card__img-wrap {
  732. position: relative;
  733. border-radius: 10px;
  734. overflow: hidden;
  735. background: #eee;
  736. aspect-ratio: 3 / 4;
  737. }
  738. .staff-card__img-wrap img {
  739. width: 100%;
  740. height: 100%;
  741. object-fit: cover;
  742. display: block;
  743. vertical-align: middle;
  744. }
  745. .staff-card__likes {
  746. position: absolute;
  747. left: 0;
  748. right: 0;
  749. bottom: 0;
  750. padding: 6px 8px;
  751. font-size: 11px;
  752. color: #fff;
  753. line-height: 1.2;
  754. background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  755. }
  756. .staff-card__name-row {
  757. display: flex;
  758. align-items: center;
  759. gap: 4px;
  760. margin-top: 8px;
  761. min-width: 0;
  762. }
  763. .staff-card__name {
  764. font-size: 14px;
  765. font-weight: 700;
  766. color: var(--text);
  767. overflow: hidden;
  768. text-overflow: ellipsis;
  769. white-space: nowrap;
  770. flex: 1;
  771. min-width: 0;
  772. }
  773. .staff-card__badge {
  774. flex-shrink: 0;
  775. font-size: 10px;
  776. font-weight: 600;
  777. color: #fff;
  778. background: #ff9d4d;
  779. padding: 2px 5px;
  780. border-radius: 3px;
  781. line-height: 1.2;
  782. white-space: nowrap;
  783. }
  784. .staff-card__meta {
  785. display: flex;
  786. align-items: center;
  787. flex-wrap: wrap;
  788. gap: 0 4px;
  789. margin-top: 4px;
  790. font-size: 12px;
  791. color: var(--text-secondary);
  792. line-height: 1.35;
  793. }
  794. .staff-card__position {
  795. overflow: hidden;
  796. text-overflow: ellipsis;
  797. white-space: nowrap;
  798. max-width: 100%;
  799. }
  800. .staff-card__reviews {
  801. display: inline-flex;
  802. align-items: center;
  803. gap: 4px;
  804. }
  805. .staff-card__sep {
  806. color: #ddd;
  807. font-weight: 300;
  808. }
  809. </style>
  810. </head>
  811. <body>
  812. <div class="share-none" id="shareClosedBanner" aria-hidden="true">
  813. <img src="images/storeNone.png" alt="">
  814. <p>抱歉,商户已关闭,看看别的吧</p>
  815. </div>
  816. <div class="closed-rec-wrap" id="shareClosedRecommendWrap" aria-hidden="true">
  817. <div class="closed-rec-divider"></div>
  818. <h3 class="closed-rec-title">更多推荐</h3>
  819. <div class="closed-rec-grid" id="shareClosedRecList">
  820. <p id="shareClosedRecEmpty" class="closed-rec-empty" style="display:none;">暂无推荐</p>
  821. </div>
  822. </div>
  823. <div class="share-content" id="shareContentEl">
  824. <div class="hero" id="hero">
  825. <div class="hero__track" id="heroTrack">
  826. <div class="hero__slide"><img id="heroFallbackImg" src="images/hero.png" alt="店铺图"></div>
  827. </div>
  828. <div class="hero__dots" id="heroDots" aria-hidden="true"></div>
  829. </div>
  830. <!-- 数据由 getClientStoreDetail(id,userId,jingdu,weidu)填充,见 renderDetail -->
  831. <section class="section" id="mainSection">
  832. <p id="pageError" class="page-error" style="display:none;color:#ff4d4f;padding:12px 0;font-size:14px;"></p>
  833. <h2 class="store-name" id="storeName">加载中…</h2>
  834. <div class="row rating-row">
  835. <div class="row" style="flex:1; justify-content:flex-start;">
  836. <span class="stars" aria-label="5.0 分">
  837. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  838. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  839. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  840. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  841. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  842. </span>
  843. <span class="rating-num" id="scoreAvg">—</span>
  844. <span id="commitCount" style="font-size: 14px;">0</span>
  845. </div>
  846. <!-- <a href="#" class="link-muted"><span id="commitCount">0</span>条评价
  847. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  848. </a> -->
  849. </div>
  850. <div class="store-evaluate-row" id="storeEvaluateRow" aria-hidden="true">
  851. <span class="store-evaluate__item">酒水:<span id="storeEvaluateScoreOne">—</span></span>
  852. <span class="store-evaluate__item">氛围:<span id="storeEvaluateScoreTwo">—</span></span>
  853. <span class="store-evaluate__item">服务:<span id="storeEvaluateScoreThree">—</span></span>
  854. </div>
  855. <div class="row hours-row">
  856. <div class="hours-left">
  857. <span class="status" id="bizStatus">—</span>
  858. <span class="hours-text" id="hoursText">—</span>
  859. </div>
  860. <a href="#" class="link-muted">详情
  861. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  862. </a>
  863. </div>
  864. </section>
  865. <div class="loc-wrap">
  866. <div class="loc-main">
  867. <p class="addr" id="storeAddr">—</p>
  868. <div class="meta-line" id="metaDistance" style="display:none;">
  869. <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#999" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
  870. <span id="distanceText">—</span>
  871. </div>
  872. <div class="meta-line" id="metaSubway" style="display:none;">
  873. <img src="images/iconn.png" alt="" width="12" height="12" decoding="async">
  874. <span id="subwayText">—</span>
  875. </div>
  876. </div>
  877. <div class="loc-actions">
  878. <button type="button" class="act-btn" aria-label="导航">
  879. <span class="act-btn__icon">
  880. <img src="images/loc1.png" alt="" width="22" height="22" decoding="async">
  881. </span>
  882. 导航
  883. </button>
  884. <button type="button" class="act-btn" aria-label="电话">
  885. <span class="act-btn__icon">
  886. <img src="images/loc2.png" alt="" width="22" height="22" decoding="async">
  887. </span>
  888. 电话
  889. </button>
  890. </div>
  891. </div>
  892. <section class="marketing-section" id="shareMarketingSection" style="display:none;" aria-hidden="true">
  893. <h3 class="marketing-section__title">营销活动</h3>
  894. <div class="marketing-section__list" id="marketingListEl"></div>
  895. <button type="button" class="marketing-section__more" id="marketingMoreBtn" style="display:none;">
  896. <span id="marketingMoreText"></span>
  897. <svg class="marketing-section__more-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
  898. </button>
  899. </section>
  900. <section class="performance-section" id="sharePerformanceSection" style="display:none;" aria-hidden="true">
  901. <h3 class="performance-section__title" id="performanceSectionTitle">演出安排(0)</h3>
  902. <div class="performance-strip" id="performanceStripEl"></div>
  903. </section>
  904. <section class="staff-section" id="shareStaffSection" style="display:none;" aria-hidden="true">
  905. <div class="staff-section__head">
  906. <h3 class="staff-section__page-title">人员阵容(<span id="staffSectionCountEl">0</span>)</h3>
  907. <button type="button" class="staff-section__all" id="staffSectionAllBtn" aria-label="查看全部">
  908. 查看全部
  909. <svg class="staff-section__all-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="9 6 15 12 9 18"/></svg>
  910. </button>
  911. </div>
  912. <div id="staffGroupsMount"></div>
  913. </section>
  914. </div>
  915. <pre id="wxDebugBar" style="display:none;position:fixed;left:8px;right:8px;top:8px;z-index:9999;max-height:40vh;overflow:auto;margin:0;padding:8px;font-size:11px;line-height:1.35;background:rgba(0,0,0,.82);color:#0f0;white-space:pre-wrap;word-break:break-all;border-radius:6px;pointer-events:none;"></pre>
  916. <div id="openAppToast" role="status" aria-live="polite"></div>
  917. <div id="fabDock" class="fab-wrap">
  918. <div class="fab-dock__slot">
  919. <button type="button" class="fab" id="openApp">
  920. <img src="images/uBtn.png" alt="APP内打开" decoding="async">
  921. </button>
  922. <div id="fabWxHit" class="fab-wx-hit" aria-hidden="true">
  923. <wx-open-launch-app id="launch-btn" appid="wx5598889b28511717">
  924. <script type="text/wxtag-template">
  925. <style>
  926. .wx-open-app-btn {
  927. display: block;
  928. width: 100%;
  929. height: 48px;
  930. margin: 0;
  931. padding: 0;
  932. border: none;
  933. background: transparent;
  934. }
  935. .wx-open-app-btn img {
  936. display: block;
  937. width: 100%;
  938. height: 48px;
  939. object-fit: contain;
  940. }
  941. </style>
  942. <button class="wx-open-app-btn" aria-label="APP内打开">
  943. <img src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.png" alt="APP内打开" />
  944. </button>
  945. </script>
  946. </wx-open-launch-app>
  947. </div>
  948. </div>
  949. <div class="home-indicator" aria-hidden="true"></div>
  950. </div>
  951. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  952. <script>
  953. (function () {
  954. 'use strict';
  955. /**
  956. * 与 group_user sharePopup 复制链接时携带的 query 一致,例如:
  957. * ?id=436&storeId=436&userId=628&businessSection=3&lat=...&lon=...&jingdu=...&weidu=...&storeName=...&coverUrl=...&desc=...
  958. *
  959. * 进入页先 GET .../store/info/getOne?id=(与 shareDynamic.html 一致);data.businessStatus===99 时先展示关店区(#shareClosedBanner、#shareClosedRecommendWrap)。
  960. * 关店时点「APP内打开」:深链为 shopro://pages/index/login?…(与 group_user pages/index/login),不再进八区详情。
  961. * 店铺头图/名称/评分/地址等(#mainSection、.loc-wrap):GET .../store/info/getClientStoreDetail?id=&userId=&jingdu=&weidu=
  962. * 经纬度:URL 可用 jingdu/weidu;若无则用 lon/lng、lat(与分享链一致)
  963. * 营销活动: GET .../store/info/getStoreCouponList?storeId= → data.marketingList
  964. * 演出安排: GET .../performance/list/query?storeId=&page=&size= → data.records, data.total(仅 URL businessSection=2 时展示与请求)
  965. * 人员阵容: GET .../storeStaffConfig/queryStaffListByTitle?storeId= → data[]
  966. *
  967. * 注意:用 file:// 打开本页时,浏览器可能因 CORS 拦截跨域请求。
  968. * 请用本地 HTTP 打开(如 VS Code Live Server、npx serve)或让后端为 H5 域名配置 Access-Control-Allow-Origin。
  969. */
  970. var API_BASE = 'https://test.ailien.shop/alienStore';
  971. /** wx-open-launch-app 的 appid(开放平台移动应用;若与公众号不同,只改这里和标签 appid) */
  972. var WECHAT_OPEN_APP_ID = 'wx5598889b28511717';
  973. /** 可选:强制 wx.config 使用的公众号 appId;默认用 getWxConfig 返回的 data.appId */
  974. var WECHAT_MP_APP_ID = '';
  975. /**
  976. * 进入页 GET {API_BASE}/wx/getWxConfig?url={当前页完整 URL,含 ? 参数,不含 #}
  977. * 微信校验签名与 location.href.split('#')[0] 必须一致,不能只签 shareIndex.html 无参数
  978. * 可用 ?wxSignPath= 或 ?wxSignUrl= 覆盖。
  979. */
  980. var WECHAT_GET_WX_CONFIG_PATH = '/wx/getWxConfig';
  981. var H5_PAGE_BASE_FALLBACK = 'https://test.ailien.shop/h5/HBuilderProjects/';
  982. /** 本地 file:// 预览时传给 getWxConfig 的默认 url(无 query) */
  983. var WX_GET_CONFIG_SIGN_URL = 'https://test.ailien.shop/h5/HBuilderProjects/shareIndex.html';
  984. /** wx.config 已成功(开放标签可展示);与「用户已成功唤起 App」不是同一回事 */
  985. var weChatJssdkConfigured = false;
  986. var wxConfigSignRetriedBaseUrl = false;
  987. var wxSignUrlFullBeforeStrip = '';
  988. var wxDebugLastStatus = '';
  989. function isWxDebugOn() {
  990. return String(q('wxDebug') || '') === '1';
  991. }
  992. function stringifyWxDebugPayload(obj) {
  993. try {
  994. return JSON.stringify(obj, null, 2);
  995. } catch (eJson) {
  996. return String(obj && obj.errMsg ? obj.errMsg : obj);
  997. }
  998. }
  999. /** ?wxDebug=1 时弹窗 + 页内条展示完整 errMsg(微信 debug 弹窗有时信息不全) */
  1000. function reportWxDebug(stage, payload, extraLines) {
  1001. var lines = ['【' + stage + '】'];
  1002. if (extraLines && extraLines.length) {
  1003. for (var i = 0; i < extraLines.length; i++) lines.push(extraLines[i]);
  1004. }
  1005. if (payload != null) {
  1006. lines.push(stringifyWxDebugPayload(payload));
  1007. }
  1008. var text = lines.join('\n');
  1009. wxDebugLastStatus = text;
  1010. console.log('[wxDebug]', text);
  1011. if (!isWxDebugOn()) return;
  1012. var bar = document.getElementById('wxDebugBar');
  1013. if (bar) {
  1014. bar.style.display = 'block';
  1015. bar.textContent = text;
  1016. }
  1017. if (isWeChatInAppBrowser()) {
  1018. window.alert(text.slice(0, 900));
  1019. }
  1020. }
  1021. /**
  1022. * 关店(businessStatus=99)更多推荐:POST …/ai/multimodal-services/api/v1/search/global/store-recommend
  1023. * 与 shareCheckInUndefined.html 一致;请求体 page、pageSize、storeId、userCity、userLat、userLng 可由 URL 覆盖。
  1024. */
  1025. var API_LIFE_AI_BASE = 'http://183.252.196.135:9100';
  1026. var STORE_GLOBAL_RECOMMEND_PATH =
  1027. '/ai/multimodal-services/api/v1/search/global/store-recommend';
  1028. var DEFAULT_REC_USER_LAT = 38.925747;
  1029. var DEFAULT_REC_USER_LNG = 121.662531;
  1030. var DEFAULT_REC_USER_CITY = '大连市';
  1031. /**
  1032. * 与 group_user 一致:
  1033. * - manifest:app-plus.distribute.android.schemes、ios.urltypes → shopro(即 shopro://)
  1034. * - Android 包名:manifest 未写 packagename 时与 App.vue 升级配置 androidPackageName 一致(云打包以 HBuilderX 为准)
  1035. */
  1036. var APP_ANDROID_PACKAGE = 'com.alien.Udianzaina';
  1037. var APP_IOS_URL_SCHEME = 'shopro://';
  1038. /** businessSection 未传或其它值时的默认落地页(与 1 相同) */
  1039. var APP_UNI_STORE_PATH = 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  1040. function showDownloadTip() {
  1041. var msg = '请到应用商店下载';
  1042. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1043. uni.showToast({ title: msg, icon: 'none', duration: 2500 });
  1044. } else {
  1045. window.alert(msg);
  1046. }
  1047. }
  1048. function showFabToast(msg, ms) {
  1049. var tip = String(msg || '').trim();
  1050. if (!tip) return;
  1051. var el = document.getElementById('openAppToast');
  1052. if (el) {
  1053. el.textContent = tip;
  1054. el.style.display = 'block';
  1055. if (showFabToast._timer) clearTimeout(showFabToast._timer);
  1056. showFabToast._timer = setTimeout(function () {
  1057. el.style.display = 'none';
  1058. }, ms || 3200);
  1059. }
  1060. console.log('[openApp]', tip);
  1061. }
  1062. function showAppOpenFailTip(msg) {
  1063. var tip =
  1064. msg ||
  1065. '未能打开 App,请确认已安装最新版「U店在哪」;微信内请使用页面底部按钮打开。';
  1066. showFabToast(tip, 4000);
  1067. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1068. uni.showToast({ title: tip, icon: 'none', duration: 2800 });
  1069. } else if (isWeChatInAppBrowser() && isWxDebugOn()) {
  1070. window.alert(tip);
  1071. }
  1072. }
  1073. /** 与公众平台「JS接口安全域名」一致;分享页实际打开的 host 必须在此列表中 */
  1074. var WECHAT_JS_SAFE_HOSTS = ['uat.ailien.shop', 'test.ailien.shop'];
  1075. function checkWxJsSafeDomainHint() {
  1076. var host = String(location.hostname || '').toLowerCase();
  1077. if (!host || host === 'localhost' || host === '127.0.0.1') return '';
  1078. if (WECHAT_JS_SAFE_HOSTS.indexOf(host) >= 0) return '';
  1079. return (
  1080. '当前页面域名为「' +
  1081. host +
  1082. '」,未在 WECHAT_JS_SAFE_HOSTS 中;请在公众号后台「JS接口安全域名」添加该域名(不含 https:// 与路径)。'
  1083. );
  1084. }
  1085. /** 详情页 onLoad 使用 storeId;分享链常为 id,补全 storeId 避免 App 内参数为空 */
  1086. function buildAppOpenQueryString() {
  1087. var raw = (location.search && location.search.charAt(0) === '?') ? location.search.slice(1) : (location.search || '');
  1088. var params = new URLSearchParams(raw);
  1089. var sid = params.get('storeId') || params.get('id') || '';
  1090. if (sid && !params.get('storeId')) params.set('storeId', sid);
  1091. var qs = params.toString();
  1092. return qs ? ('?' + qs) : '';
  1093. }
  1094. /**
  1095. * 按 URL 参数 businessSection 打开对应 App 页:
  1096. * 1 → delicacyDetails,2 → barDetails,3 → lifeDetails
  1097. * 关店 businessStatus=99 时进 pages/index/login(见 isClosedMerchantForAppOpen)。
  1098. */
  1099. function getAppUniPathForBusinessSection() {
  1100. if (isClosedMerchantForAppOpen()) {
  1101. return 'pages/index/login';
  1102. }
  1103. var bs = String(q('businessSection') || '').trim();
  1104. if (bs === '1') {
  1105. return 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  1106. }
  1107. if (bs === '2') {
  1108. return 'pages/ieisureEntertainment/eightTypeList/barDetails';
  1109. }
  1110. if (bs === '3') {
  1111. return 'pages/ieisureEntertainment/eightTypeList/lifeDetails';
  1112. }
  1113. return String(APP_UNI_STORE_PATH || 'pages/ieisureEntertainment/eightTypeList/delicacyDetails').replace(/^\//, '');
  1114. }
  1115. function buildAppDeepLink() {
  1116. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1117. var s = buildAppOpenQueryString();
  1118. var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
  1119. if (!s) return root + '/' + path;
  1120. return root + '/' + path + s;
  1121. }
  1122. function isWeChatInAppBrowser() {
  1123. return /MicroMessenger/i.test(navigator.userAgent || '');
  1124. }
  1125. function getWeChatJssdkSignRequestUrl() {
  1126. var custom = String(q('wxSignPath') || q('wxSignUrl') || '').trim();
  1127. if (!custom) return '';
  1128. if (/^https?:\/\//i.test(custom)) return custom;
  1129. return API_BASE.replace(/\/$/, '') + (custom.charAt(0) === '/' ? custom : '/' + custom);
  1130. }
  1131. /** 微信 JSSDK 参与签名的 url:完整链(含 ?),不含 # */
  1132. function getWxSignUrlFull() {
  1133. var forced = String(q('wxSignUrl') || '').trim();
  1134. if (forced) return forced.split('#')[0];
  1135. if (location.origin && /^https?:/i.test(location.origin)) {
  1136. return (
  1137. location.origin +
  1138. (location.pathname || '/h5/HBuilderProjects/shareIndex.html') +
  1139. (location.search || '')
  1140. );
  1141. }
  1142. var href = String(location.href || '').split('#')[0];
  1143. if (href && href.indexOf('file:') !== 0) return href;
  1144. return WX_GET_CONFIG_SIGN_URL;
  1145. }
  1146. /** 无 query 的页面地址(后端若只签该地址,须配合 syncBrowserUrlForWxSign) */
  1147. function getWxSignUrlBase() {
  1148. if (location.origin && /^https?:/i.test(location.origin)) {
  1149. return location.origin + (location.pathname || '/h5/HBuilderProjects/shareIndex.html');
  1150. }
  1151. return WX_GET_CONFIG_SIGN_URL;
  1152. }
  1153. function getWxConfigSignUrl() {
  1154. if (String(q('wxSignBaseOnly') || '') === '1') return getWxSignUrlBase();
  1155. return getWxSignUrlFull();
  1156. }
  1157. /**
  1158. * 微信校验签名用的是地址栏当前 url(不含#)。
  1159. * 若后端只签了无参地址,须先把地址栏 sync 成与签名 url 一致再 wx.config。
  1160. */
  1161. function syncBrowserUrlForWxSign(signUrl) {
  1162. var target = String(signUrl || '').split('#')[0];
  1163. if (!target) return;
  1164. var hash = location.hash || '';
  1165. var current = String(location.href || '').split('#')[0];
  1166. if (current !== target) {
  1167. history.replaceState(history.state, document.title, target + hash);
  1168. }
  1169. }
  1170. /** 唤起 App 的 extinfo:保留完整分享链 */
  1171. function getPageUrlForWxSign() {
  1172. return getWxSignUrlFull();
  1173. }
  1174. function buildWxGetConfigRequestUrl(signPageUrl) {
  1175. var base = API_BASE.replace(/\/$/, '');
  1176. return (
  1177. base +
  1178. WECHAT_GET_WX_CONFIG_PATH +
  1179. '?url=' +
  1180. encodeURIComponent(signPageUrl || getWxConfigSignUrl())
  1181. );
  1182. }
  1183. /**
  1184. * 微信开放标签 extinfo:优先传当前 H5 分享链(与 App 解析分享 URL 一致);
  1185. * 超长时再传 path+query JSON,最后才用 shopro://。
  1186. */
  1187. function buildWeChatLaunchExtinfo() {
  1188. var pageUrl = getPageUrlForWxSign();
  1189. if (pageUrl && pageUrl.length <= 1024) return pageUrl;
  1190. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1191. var qs = buildAppOpenQueryString().replace(/^\?/, '');
  1192. try {
  1193. var pack = JSON.stringify({
  1194. path: path,
  1195. query: qs,
  1196. h5: pageUrl
  1197. });
  1198. if (pack.length <= 1024) return pack;
  1199. } catch (eJson) {}
  1200. var deep = buildAppDeepLink();
  1201. if (deep && deep.length <= 1024) return deep;
  1202. return pageUrl ? pageUrl.slice(0, 1024) : deep.slice(0, 1024);
  1203. }
  1204. function absH5AssetUrl(rel) {
  1205. rel = String(rel || '').replace(/^\//, '');
  1206. var origin = location.origin;
  1207. if (origin && origin !== 'null' && /^https?:/i.test(origin)) {
  1208. var dir = location.pathname.replace(/[^/]*$/, '');
  1209. return origin + dir + rel;
  1210. }
  1211. return H5_PAGE_BASE_FALLBACK + rel;
  1212. }
  1213. function resolveWxConfigAppIdFromSignData(d) {
  1214. if (!d || typeof d !== 'object') return '';
  1215. var mp =
  1216. d.mpAppId ||
  1217. d.mpAppid ||
  1218. d.officialAppId ||
  1219. d.officialAccountAppId ||
  1220. d.gzhAppId ||
  1221. d.serviceAppId;
  1222. if (mp != null && String(mp).trim() !== '') return String(mp).trim();
  1223. var fromQuery = String(q('wxMpAppId') || WECHAT_MP_APP_ID || '').trim();
  1224. if (fromQuery) return fromQuery;
  1225. var raw = d.appId || d.appid || d.wxAppId;
  1226. if (raw == null || String(raw).trim() === '') return '';
  1227. return String(raw).trim();
  1228. }
  1229. function normalizeWxJssdkSignPayload(res, signUrlUsed) {
  1230. if (!res || typeof res !== 'object') return null;
  1231. var d = res.data != null && typeof res.data === 'object' ? res.data : res;
  1232. if (!d || typeof d !== 'object') return null;
  1233. var appId = resolveWxConfigAppIdFromSignData(d);
  1234. var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
  1235. var nonceStr = d.nonceStr || d.noncestr || d.nonce;
  1236. var signature = d.signature || d.sign;
  1237. if (!appId || timestamp == null || !nonceStr || !signature) return null;
  1238. var signedUrl =
  1239. d.signUrl != null && String(d.signUrl).trim() !== ''
  1240. ? String(d.signUrl).trim().split('#')[0]
  1241. : signUrlUsed != null && String(signUrlUsed).trim() !== ''
  1242. ? String(signUrlUsed).trim().split('#')[0]
  1243. : '';
  1244. return {
  1245. appId: String(appId),
  1246. timestamp: Number(timestamp),
  1247. nonceStr: String(nonceStr),
  1248. signature: String(signature),
  1249. signUrl: signedUrl
  1250. };
  1251. }
  1252. function getWxErrMsg(err) {
  1253. if (!err) return '';
  1254. if (err.errMsg) return String(err.errMsg);
  1255. if (typeof err === 'string') return err;
  1256. try {
  1257. return JSON.stringify(err);
  1258. } catch (e) {
  1259. return String(err);
  1260. }
  1261. }
  1262. function formatWxConfigErrorTip(err, signPageUrl) {
  1263. var errMsg = getWxErrMsg(err);
  1264. var tip = '微信 JSSDK 配置失败';
  1265. if (/require\s*subscribe/i.test(errMsg)) {
  1266. return (
  1267. tip +
  1268. ':' +
  1269. errMsg +
  1270. '。测试号须用当前微信号在 mp.weixin.qq.com/debug.cgi 关注后再打开本页。'
  1271. );
  1272. }
  1273. if (/invalid signature/i.test(errMsg)) {
  1274. var signUrl = signPageUrl || getWxSignUrlFull();
  1275. var pageNow = String(location.href || '').split('#')[0];
  1276. return (
  1277. tip +
  1278. ':签名无效。请让后端用与地址栏完全相同的 url 参与签名(不含#)。当前地址栏:' +
  1279. pageNow +
  1280. ';本次请求签名 url:' +
  1281. signUrl
  1282. );
  1283. }
  1284. if (/invalid appid/i.test(errMsg)) {
  1285. return tip + ':appId 无效,请使用已认证服务号的公众号 AppID。';
  1286. }
  1287. if (/invalid url/i.test(errMsg)) {
  1288. return tip + ':域名未在公众号 JS 接口安全域名中,或未在开放平台绑定域名与移动应用。';
  1289. }
  1290. if (errMsg) return tip + ':' + errMsg;
  1291. return tip + ',开放标签不可用。';
  1292. }
  1293. function fetchWeChatJssdkSign(signPageUrl) {
  1294. signPageUrl = signPageUrl || getWxConfigSignUrl();
  1295. var urls = [];
  1296. var custom = getWeChatJssdkSignRequestUrl();
  1297. if (custom) {
  1298. var sep0 = custom.indexOf('?') >= 0 ? '&' : '?';
  1299. urls.push(custom + sep0 + 'url=' + encodeURIComponent(signPageUrl));
  1300. } else {
  1301. urls.push(buildWxGetConfigRequestUrl(signPageUrl));
  1302. }
  1303. function tryUrl(idx) {
  1304. if (idx >= urls.length) return Promise.resolve(null);
  1305. return fetch(urls[idx], {
  1306. method: 'GET',
  1307. mode: 'cors',
  1308. credentials: 'omit',
  1309. headers: { Accept: 'application/json' }
  1310. })
  1311. .then(function (r) {
  1312. if (!r.ok) throw new Error('HTTP ' + r.status);
  1313. return r.json();
  1314. })
  1315. .then(function (res) {
  1316. if (res && res.code != null) {
  1317. var c = Number(res.code);
  1318. if (c !== 200 && c !== 0 && res.success !== true) {
  1319. throw new Error(res.msg || 'sign rejected');
  1320. }
  1321. }
  1322. var pack = normalizeWxJssdkSignPayload(res, signPageUrl);
  1323. if (!pack) throw new Error('empty sign payload');
  1324. return pack;
  1325. })
  1326. .catch(function () {
  1327. return tryUrl(idx + 1);
  1328. });
  1329. }
  1330. return tryUrl(0);
  1331. }
  1332. function applyWxConfig(sign, signPageUrl) {
  1333. var urlForWx =
  1334. sign.signUrl && String(sign.signUrl).trim() !== ''
  1335. ? String(sign.signUrl).trim()
  1336. : signPageUrl;
  1337. syncBrowserUrlForWxSign(urlForWx);
  1338. console.log('[wx.config] appId=', sign.appId, 'signUrl=', urlForWx, 'page=', location.href.split('#')[0]);
  1339. return new Promise(function (resolve) {
  1340. wx.config({
  1341. debug: String(q('wxDebug') || '') === '1',
  1342. appId: sign.appId,
  1343. timestamp: sign.timestamp,
  1344. nonceStr: sign.nonceStr,
  1345. signature: sign.signature,
  1346. jsApiList: ['checkJsApi'],
  1347. openTagList: ['wx-open-launch-app']
  1348. });
  1349. wx.ready(function () {
  1350. weChatJssdkConfigured = true;
  1351. reportWxDebug('wx.ready / config:ok', { errMsg: 'config:ok' }, [
  1352. 'appId(config)=' + sign.appId,
  1353. 'openTag appid=' + WECHAT_OPEN_APP_ID,
  1354. 'signUrl=' + urlForWx,
  1355. 'page=' + location.href.split('#')[0],
  1356. '开放标签层=' + (isWeChatInAppBrowser() ? '已启用' : '非微信')
  1357. ]);
  1358. if (wxSignUrlFullBeforeStrip) {
  1359. var restore = wxSignUrlFullBeforeStrip + (location.hash || '');
  1360. history.replaceState(history.state, document.title, restore);
  1361. wxSignUrlFullBeforeStrip = '';
  1362. }
  1363. scheduleWxOpenTagRefresh();
  1364. showFabToast('请点击底部 APP内打开(微信开放标签)');
  1365. resolve(true);
  1366. });
  1367. wx.error(function (err) {
  1368. var errMsg = getWxErrMsg(err);
  1369. console.warn('[wx.config]', err, 'signUrl=', urlForWx);
  1370. reportWxDebug('wx.error / config:fail', err, [
  1371. '完整 errMsg=' + errMsg,
  1372. 'appId(config)=' + sign.appId,
  1373. 'signUrl=' + urlForWx,
  1374. 'page=' + location.href.split('#')[0]
  1375. ]);
  1376. var baseUrl = getWxSignUrlBase();
  1377. var fullUrl = getWxSignUrlFull();
  1378. if (
  1379. !/invalid signature/i.test(errMsg) ||
  1380. wxConfigSignRetriedBaseUrl ||
  1381. baseUrl === fullUrl ||
  1382. urlForWx === baseUrl
  1383. ) {
  1384. weChatJssdkConfigured = false;
  1385. updateFabOpenLayer();
  1386. showAppOpenFailTip(formatWxConfigErrorTip(err, urlForWx));
  1387. resolve(false);
  1388. return;
  1389. }
  1390. wxConfigSignRetriedBaseUrl = true;
  1391. wxSignUrlFullBeforeStrip = fullUrl;
  1392. console.warn('[wx.config] retry with base url (no query):', baseUrl);
  1393. fetchWeChatJssdkSign(baseUrl)
  1394. .then(function (sign2) {
  1395. if (!sign2) {
  1396. weChatJssdkConfigured = false;
  1397. updateFabOpenLayer();
  1398. showAppOpenFailTip(formatWxConfigErrorTip(err, urlForWx));
  1399. resolve(false);
  1400. return;
  1401. }
  1402. applyWxConfig(sign2, baseUrl).then(resolve);
  1403. })
  1404. .catch(function () {
  1405. weChatJssdkConfigured = false;
  1406. updateFabOpenLayer();
  1407. showAppOpenFailTip(formatWxConfigErrorTip(err, urlForWx));
  1408. resolve(false);
  1409. });
  1410. });
  1411. });
  1412. }
  1413. function refreshWxLaunchTagAttrs() {
  1414. var tag = document.getElementById('launch-btn');
  1415. if (!tag) return;
  1416. try {
  1417. if (WECHAT_OPEN_APP_ID) tag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  1418. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1419. } catch (eAttr) {
  1420. console.warn('[wx-open-launch-app] set attrs', eAttr);
  1421. }
  1422. }
  1423. /** wx.config 成功后即切换为开放标签按钮(不再依赖 offsetHeight 检测) */
  1424. function updateFabOpenLayer() {
  1425. var dock = document.getElementById('fabDock');
  1426. var hit = document.getElementById('fabWxHit');
  1427. var useWx = isWeChatInAppBrowser() && weChatJssdkConfigured;
  1428. if (dock) {
  1429. if (useWx) dock.classList.add('wx-open-enabled');
  1430. else dock.classList.remove('wx-open-enabled');
  1431. }
  1432. if (hit) hit.setAttribute('aria-hidden', useWx ? 'false' : 'true');
  1433. if (useWx) refreshWxLaunchTagAttrs();
  1434. }
  1435. function scheduleWxOpenTagRefresh() {
  1436. refreshWxLaunchTagAttrs();
  1437. updateFabOpenLayer();
  1438. var delays = [100, 400, 1000, 2000];
  1439. for (var i = 0; i < delays.length; i++) {
  1440. (function (ms) {
  1441. window.setTimeout(function () {
  1442. if (!weChatJssdkConfigured) return;
  1443. refreshWxLaunchTagAttrs();
  1444. updateFabOpenLayer();
  1445. }, ms);
  1446. })(delays[i]);
  1447. }
  1448. window.setTimeout(function () {
  1449. if (!weChatJssdkConfigured) return;
  1450. var tag = document.getElementById('launch-btn');
  1451. var h = tag ? tag.offsetHeight || 0 : 0;
  1452. if (h >= 20) return;
  1453. var dock = document.getElementById('fabDock');
  1454. if (dock) dock.classList.remove('wx-open-enabled');
  1455. showAppOpenFailTip(
  1456. '开放标签未渲染(高度为 0)。请检查:移动应用 AppID、开放平台绑定、测试号 JS 域名;链接加 wxDebug=1 查看 config。'
  1457. );
  1458. }, 2800);
  1459. }
  1460. var openAppFabClickLock = 0;
  1461. function handleOpenAppFabClick() {
  1462. var now = Date.now();
  1463. if (now - openAppFabClickLock < 500) return;
  1464. openAppFabClickLock = now;
  1465. var dock = document.getElementById('fabDock');
  1466. if (
  1467. isWeChatInAppBrowser() &&
  1468. weChatJssdkConfigured &&
  1469. dock &&
  1470. dock.classList.contains('wx-open-enabled')
  1471. ) {
  1472. showFabToast('请点 APP内打开 按钮(由微信开放标签唤起,非普通链接)');
  1473. return;
  1474. }
  1475. tryOpenHBuilderApp();
  1476. }
  1477. function bindOpenAppFabClick() {
  1478. var btn = document.getElementById('openApp');
  1479. if (btn) {
  1480. btn.addEventListener('click', function (e) {
  1481. if (e && e.cancelable) e.preventDefault();
  1482. handleOpenAppFabClick();
  1483. });
  1484. }
  1485. }
  1486. function bindWeChatLaunchTagEvents() {
  1487. var tag = document.getElementById('launch-btn');
  1488. if (!tag) return;
  1489. refreshWxLaunchTagAttrs();
  1490. tag.addEventListener('launch', function (e) {
  1491. console.log('[wx-open-launch-app] launch ok', e && e.detail);
  1492. reportWxDebug('wx-open-launch-app launch', e && e.detail ? e.detail : { errMsg: 'launch:ok' }, [
  1493. 'extinfo=' + (tag.getAttribute('extinfo') || '').slice(0, 200)
  1494. ]);
  1495. });
  1496. tag.addEventListener('error', function (e) {
  1497. var detail = e && e.detail;
  1498. console.warn('[wx-open-launch-app]', detail);
  1499. reportWxDebug('wx-open-launch-app error', detail, [
  1500. 'openTag appid=' + WECHAT_OPEN_APP_ID,
  1501. '完整 errMsg=' +
  1502. (detail && detail.errMsg
  1503. ? String(detail.errMsg)
  1504. : detail && detail.errmsg
  1505. ? String(detail.errmsg)
  1506. : '(无)')
  1507. ]);
  1508. var errMsg =
  1509. detail && detail.errMsg
  1510. ? String(detail.errMsg)
  1511. : detail && detail.errmsg
  1512. ? String(detail.errmsg)
  1513. : '';
  1514. if (/launch:fail/i.test(errMsg)) {
  1515. showAppOpenFailTip(
  1516. '微信未能唤起 App(' +
  1517. errMsg +
  1518. ')。请确认:①已安装 U店在哪;②开放标签 appid 为移动应用 ID;③开放平台已绑定域名与 App。'
  1519. );
  1520. } else {
  1521. showAppOpenFailTip(
  1522. errMsg
  1523. ? '开放标签错误:' + errMsg
  1524. : '开放标签唤起失败,请用 wxDebug=1 查看详情。'
  1525. );
  1526. }
  1527. });
  1528. }
  1529. /**
  1530. * 进入页即 GET /wx/getWxConfig(任意浏览器都会请求,便于联调);
  1531. * 仅微信内且签名成功后再 wx.config + 展示开放标签按钮。
  1532. */
  1533. function initWeChatOpenLaunchApp() {
  1534. var inWx = isWeChatInAppBrowser();
  1535. wxConfigSignRetriedBaseUrl = false;
  1536. var signPageUrl = getWxConfigSignUrl();
  1537. var reqUrl = buildWxGetConfigRequestUrl(signPageUrl);
  1538. if (inWx) {
  1539. var domainHint = checkWxJsSafeDomainHint();
  1540. if (domainHint) {
  1541. console.warn('[wx]', domainHint);
  1542. showAppOpenFailTip(domainHint);
  1543. }
  1544. }
  1545. console.log('[wx] GET', reqUrl);
  1546. return fetchWeChatJssdkSign(signPageUrl)
  1547. .then(function (sign) {
  1548. if (!inWx) {
  1549. if (!sign) {
  1550. console.warn('[wx] getWxConfig empty (non-wechat preview)');
  1551. }
  1552. return false;
  1553. }
  1554. if (typeof wx === 'undefined') {
  1555. console.warn('[wx] jweixin not loaded');
  1556. return false;
  1557. }
  1558. bindWeChatLaunchTagEvents();
  1559. if (!sign) {
  1560. console.warn('[wx] GET ' + WECHAT_GET_WX_CONFIG_PATH + ' — empty or invalid sign payload');
  1561. showAppOpenFailTip(
  1562. '微信 JSSDK:getWxConfig 未返回可用的 appId/timestamp/nonceStr/signature。'
  1563. );
  1564. return false;
  1565. }
  1566. return applyWxConfig(sign, signPageUrl);
  1567. })
  1568. .catch(function (e) {
  1569. console.warn('[wx] init failed', e);
  1570. return false;
  1571. });
  1572. }
  1573. function isCustomAppSchemeUrl(url) {
  1574. var s = String(url || '').trim();
  1575. if (!s) return false;
  1576. if (/^https?:/i.test(s)) return false;
  1577. return /^[a-z][a-z0-9+.-]*:/i.test(s);
  1578. }
  1579. function launchAppDeepLink(deepLink) {
  1580. deepLink = String(deepLink || '').trim();
  1581. if (!deepLink) return;
  1582. if (isCustomAppSchemeUrl(deepLink)) {
  1583. var anchor = document.getElementById('appDeepLinkAnchor');
  1584. if (!anchor) {
  1585. anchor = document.createElement('a');
  1586. anchor.id = 'appDeepLinkAnchor';
  1587. anchor.setAttribute('aria-hidden', 'true');
  1588. anchor.style.cssText =
  1589. 'position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;';
  1590. document.body.appendChild(anchor);
  1591. }
  1592. anchor.setAttribute('href', deepLink);
  1593. anchor.click();
  1594. return;
  1595. }
  1596. try {
  1597. window.location.href = deepLink;
  1598. } catch (eHref) {}
  1599. }
  1600. /**
  1601. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  1602. * 系统浏览器:scheme 唤起;微信内优先 wx-open-launch-app,失败再 scheme(不再弹「在浏览器中打开」)。
  1603. */
  1604. function tryOpenHBuilderApp() {
  1605. var inWx = isWeChatInAppBrowser();
  1606. showFabToast('正在尝试打开 U店在哪…');
  1607. if (inWx && !weChatJssdkConfigured) {
  1608. showAppOpenFailTip(
  1609. '微信 JSSDK 未就绪:请先关注测试号并确保 wx.config 成功。链接可加 wxDebug=1 查看 config 报错。'
  1610. );
  1611. launchAppDeepLink(buildAppDeepLink());
  1612. return;
  1613. }
  1614. if (inWx && weChatJssdkConfigured) {
  1615. showFabToast('请使用底部 APP内打开 按钮(微信开放标签)');
  1616. return;
  1617. }
  1618. var deepLink = buildAppDeepLink();
  1619. if (typeof plus !== 'undefined' && plus.runtime) {
  1620. var installed = null;
  1621. try {
  1622. if (typeof plus.runtime.isApplicationExist === 'function') {
  1623. installed = plus.runtime.isApplicationExist({
  1624. pname: APP_ANDROID_PACKAGE,
  1625. action: APP_IOS_URL_SCHEME
  1626. });
  1627. }
  1628. } catch (e) {
  1629. console.warn(e);
  1630. }
  1631. try {
  1632. plus.runtime.openURL(deepLink);
  1633. } catch (e2) {
  1634. console.warn(e2);
  1635. if (installed === false) {
  1636. showDownloadTip();
  1637. } else if (!inWx) {
  1638. showAppOpenFailTip();
  1639. }
  1640. }
  1641. return;
  1642. }
  1643. var done = false;
  1644. function finish() {
  1645. if (done) return;
  1646. done = true;
  1647. document.removeEventListener('visibilitychange', onVis);
  1648. window.removeEventListener('pagehide', onHide);
  1649. }
  1650. function onVis() {
  1651. if (document.visibilityState === 'hidden') finish();
  1652. }
  1653. function onHide() {
  1654. finish();
  1655. }
  1656. document.addEventListener('visibilitychange', onVis);
  1657. window.addEventListener('pagehide', onHide);
  1658. try {
  1659. launchAppDeepLink(deepLink);
  1660. } catch (e3) {
  1661. finish();
  1662. if (!inWx) showAppOpenFailTip();
  1663. return;
  1664. }
  1665. /**
  1666. * 微信内 scheme 常被拦截且页面仍 visible,原 2.6s 后 showDownloadTip 会误报「请到应用商店下载」。
  1667. * 与 shareDynamic 一致:超时仅收尾,不弹下载提示。
  1668. */
  1669. window.setTimeout(function () {
  1670. finish();
  1671. }, 3200);
  1672. }
  1673. function qs() {
  1674. return new URLSearchParams(location.search || '');
  1675. }
  1676. function q(name) {
  1677. var v = qs().get(name);
  1678. return v == null ? '' : String(v);
  1679. }
  1680. function showErr(msg) {
  1681. var el = document.getElementById('pageError');
  1682. el.textContent = msg;
  1683. el.style.display = 'block';
  1684. }
  1685. function getStoreId() {
  1686. return q('id') || q('storeId');
  1687. }
  1688. function shouldShowPerformanceSection() {
  1689. return String(q('businessSection') || '').trim() === '2';
  1690. }
  1691. function apiFetch(path) {
  1692. return fetch(API_BASE + path, {
  1693. method: 'GET',
  1694. mode: 'cors',
  1695. credentials: 'omit',
  1696. headers: { Accept: 'application/json' }
  1697. }).then(function (res) {
  1698. if (!res.ok) throw new Error('HTTP ' + res.status);
  1699. return res.json();
  1700. });
  1701. }
  1702. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1703. function fetchStoreInfoGetOne(storeId) {
  1704. if (!storeId) return Promise.resolve(null);
  1705. var qs = new URLSearchParams();
  1706. qs.set('id', String(storeId).trim());
  1707. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1708. console.warn('[store/info/getOne]', e);
  1709. return null;
  1710. });
  1711. }
  1712. function isGetOneBusinessStatus99(res) {
  1713. if (!res || typeof res !== 'object') return false;
  1714. var d = res.data;
  1715. if (d && typeof d === 'object') {
  1716. var bs = d.businessStatus;
  1717. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1718. }
  1719. return false;
  1720. }
  1721. var MARKETING_PREVIEW_COUNT = 3;
  1722. var closedMerchantFlag = false;
  1723. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1724. function isClosedMerchantForAppOpen() {
  1725. if (closedMerchantFlag) return true;
  1726. var bs = String(q('businessStatus') || '').trim();
  1727. if (bs === '99' || Number(bs) === 99) return true;
  1728. return false;
  1729. }
  1730. var marketingListCache = [];
  1731. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1732. var marketingCouponLoaded = false;
  1733. var staffGroupsCache = [];
  1734. var performanceListCache = { records: [], total: 0 };
  1735. function isMp4VideoUrl(url) {
  1736. if (!url || typeof url !== 'string') return false;
  1737. var path = url.split(/[?#]/)[0].toLowerCase();
  1738. return path.length >= 4 && path.slice(-4) === '.mp4';
  1739. }
  1740. function getMp4PlaybackUrl(url) {
  1741. var u = String(url || '').trim();
  1742. if (!u) return '';
  1743. var q = u.indexOf('?');
  1744. var h = u.indexOf('#');
  1745. var cut = u.length;
  1746. if (q >= 0) cut = Math.min(cut, q);
  1747. if (h >= 0) cut = Math.min(cut, h);
  1748. var base = u.slice(0, cut);
  1749. if (/\.mp4$/i.test(base)) return base;
  1750. return u;
  1751. }
  1752. function mp4UrlToJpgUrl(u) {
  1753. var q = u.indexOf('?');
  1754. var h = u.indexOf('#');
  1755. var cut = u.length;
  1756. if (q >= 0) cut = Math.min(cut, q);
  1757. if (h >= 0) cut = Math.min(cut, h);
  1758. var pathPart = u.slice(0, cut);
  1759. var rest = u.slice(cut);
  1760. if (!/\.mp4$/i.test(pathPart)) return '';
  1761. return pathPart.slice(0, -4) + '.jpg' + rest;
  1762. }
  1763. function createMarketingMedia(url) {
  1764. var wrap = document.createElement('div');
  1765. wrap.className = 'marketing-card__media';
  1766. var full = String(url == null ? '' : url).trim();
  1767. if (!full) return wrap;
  1768. if (isMp4VideoUrl(full)) {
  1769. var playUrl = getMp4PlaybackUrl(full);
  1770. var vid = document.createElement('video');
  1771. vid.src = playUrl;
  1772. vid.setAttribute('controls', '');
  1773. vid.setAttribute('playsinline', '');
  1774. vid.setAttribute('webkit-playsinline', '');
  1775. vid.muted = true;
  1776. vid.setAttribute('muted', '');
  1777. vid.setAttribute('autoplay', '');
  1778. vid.preload = 'auto';
  1779. var poster = '';
  1780. if (full.length > playUrl.length) poster = full;
  1781. else poster = mp4UrlToJpgUrl(playUrl);
  1782. if (poster) vid.setAttribute('poster', poster);
  1783. vid.addEventListener('canplay', function onCap() {
  1784. vid.removeEventListener('canplay', onCap);
  1785. var p = vid.play();
  1786. if (p && typeof p.catch === 'function') p.catch(function () {});
  1787. });
  1788. wrap.appendChild(vid);
  1789. } else {
  1790. var img = document.createElement('img');
  1791. img.src = full;
  1792. img.alt = '';
  1793. img.decoding = 'async';
  1794. wrap.appendChild(img);
  1795. }
  1796. return wrap;
  1797. }
  1798. function renderMarketingList(rawList) {
  1799. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1800. var section = document.getElementById('shareMarketingSection');
  1801. var listEl = document.getElementById('marketingListEl');
  1802. var moreBtn = document.getElementById('marketingMoreBtn');
  1803. var moreText = document.getElementById('marketingMoreText');
  1804. if (!section || !listEl) return;
  1805. listEl.innerHTML = '';
  1806. section.classList.remove('is-expanded');
  1807. if (moreBtn) {
  1808. moreBtn.style.display = 'none';
  1809. moreBtn.setAttribute('aria-expanded', 'false');
  1810. }
  1811. if (closedMerchantFlag) {
  1812. section.style.display = 'none';
  1813. section.setAttribute('aria-hidden', 'true');
  1814. return;
  1815. }
  1816. var items = marketingListCache.filter(function (x) {
  1817. return x && x.imgUrl && String(x.imgUrl).trim();
  1818. }).filter(function (x) {
  1819. var t = x.activityType;
  1820. if (t == null || t === '') return true;
  1821. return String(t).toUpperCase() === 'MARKETING';
  1822. });
  1823. items.sort(function (a, b) {
  1824. var sa = Number(a.imgSort);
  1825. var sb = Number(b.imgSort);
  1826. if (isNaN(sa)) sa = 0;
  1827. if (isNaN(sb)) sb = 0;
  1828. return sa - sb;
  1829. });
  1830. if (!items.length) {
  1831. if (!marketingCouponLoaded) {
  1832. section.style.display = 'none';
  1833. section.setAttribute('aria-hidden', 'true');
  1834. return;
  1835. }
  1836. section.style.display = 'block';
  1837. section.setAttribute('aria-hidden', 'false');
  1838. var emptyWrap = document.createElement('div');
  1839. emptyWrap.className = 'marketing-section__empty';
  1840. emptyWrap.setAttribute('role', 'status');
  1841. var emptyImg = document.createElement('img');
  1842. emptyImg.src = 'images/empty.png';
  1843. emptyImg.alt = '';
  1844. emptyImg.decoding = 'async';
  1845. var emptyLabel = document.createElement('p');
  1846. emptyLabel.className = 'marketing-section__empty-label';
  1847. emptyLabel.textContent = '暂无活动';
  1848. emptyWrap.appendChild(emptyImg);
  1849. emptyWrap.appendChild(emptyLabel);
  1850. listEl.appendChild(emptyWrap);
  1851. return;
  1852. }
  1853. section.style.display = 'block';
  1854. section.setAttribute('aria-hidden', 'false');
  1855. items.forEach(function (item, idx) {
  1856. var card = document.createElement('article');
  1857. card.className = 'marketing-card';
  1858. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1859. card.appendChild(createMarketingMedia(item.imgUrl));
  1860. listEl.appendChild(card);
  1861. });
  1862. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1863. if (extra > 0 && moreBtn && moreText) {
  1864. moreText.textContent = '查看剩余' + extra + '个活动';
  1865. moreBtn.style.display = 'flex';
  1866. }
  1867. }
  1868. function bindMarketingMore() {
  1869. var section = document.getElementById('shareMarketingSection');
  1870. var moreBtn = document.getElementById('marketingMoreBtn');
  1871. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1872. moreBtn.dataset.bound = '1';
  1873. moreBtn.addEventListener('click', function () {
  1874. section.classList.add('is-expanded');
  1875. moreBtn.style.display = 'none';
  1876. moreBtn.setAttribute('aria-expanded', 'true');
  1877. });
  1878. }
  1879. function createStaffCardElement(staff) {
  1880. var card = document.createElement('article');
  1881. card.className = 'staff-card';
  1882. var imgWrap = document.createElement('div');
  1883. imgWrap.className = 'staff-card__img-wrap';
  1884. var imgUrl = String(staff.staffImage || '').trim();
  1885. if (imgUrl) {
  1886. var img = document.createElement('img');
  1887. img.src = imgUrl;
  1888. img.alt = String(staff.name || '');
  1889. img.decoding = 'async';
  1890. img.loading = 'lazy';
  1891. imgWrap.appendChild(img);
  1892. }
  1893. var likes = document.createElement('div');
  1894. likes.className = 'staff-card__likes';
  1895. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1896. if (isNaN(lc)) lc = 0;
  1897. likes.textContent = lc + '人喜欢';
  1898. imgWrap.appendChild(likes);
  1899. var nameRow = document.createElement('div');
  1900. nameRow.className = 'staff-card__name-row';
  1901. var nameEl = document.createElement('span');
  1902. nameEl.className = 'staff-card__name';
  1903. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1904. nameRow.appendChild(nameEl);
  1905. var perf = staff.hasPerformanceToday;
  1906. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1907. var badge = document.createElement('span');
  1908. badge.className = 'staff-card__badge';
  1909. badge.textContent = '今日演出';
  1910. nameRow.appendChild(badge);
  1911. }
  1912. card.appendChild(imgWrap);
  1913. card.appendChild(nameRow);
  1914. var meta = document.createElement('div');
  1915. meta.className = 'staff-card__meta';
  1916. var pos = document.createElement('span');
  1917. pos.className = 'staff-card__position';
  1918. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1919. meta.appendChild(pos);
  1920. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1921. if (!isNaN(pc) && pc > 0) {
  1922. var sep = document.createElement('span');
  1923. sep.className = 'staff-card__sep';
  1924. sep.textContent = '|';
  1925. var rev = document.createElement('span');
  1926. rev.className = 'staff-card__reviews';
  1927. rev.textContent = '好评' + pc + '次';
  1928. meta.appendChild(sep);
  1929. meta.appendChild(rev);
  1930. }
  1931. card.appendChild(meta);
  1932. return card;
  1933. }
  1934. function createPerformanceCardElement(row) {
  1935. var card = document.createElement('article');
  1936. card.className = 'performance-card';
  1937. var posterWrap = document.createElement('div');
  1938. posterWrap.className = 'performance-card__poster';
  1939. var posterUrl = String(row.performancePoster || '').trim();
  1940. if (posterUrl) {
  1941. var img = document.createElement('img');
  1942. img.src = posterUrl;
  1943. img.alt = String(row.performanceName || '');
  1944. img.decoding = 'async';
  1945. img.loading = 'lazy';
  1946. posterWrap.appendChild(img);
  1947. }
  1948. var body = document.createElement('div');
  1949. body.className = 'performance-card__body';
  1950. var nameEl = document.createElement('div');
  1951. nameEl.className = 'performance-card__name';
  1952. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1953. body.appendChild(nameEl);
  1954. var dr = String(row.dateRange || '').trim();
  1955. if (dr) {
  1956. var line1 = document.createElement('div');
  1957. line1.className = 'performance-card__meta';
  1958. line1.textContent = dr;
  1959. body.appendChild(line1);
  1960. }
  1961. var si = String(row.scheduleInfo || '').trim();
  1962. if (si) {
  1963. var line2 = document.createElement('div');
  1964. line2.className = 'performance-card__meta';
  1965. line2.textContent = si;
  1966. line2.title = si;
  1967. body.appendChild(line2);
  1968. }
  1969. card.appendChild(posterWrap);
  1970. card.appendChild(body);
  1971. return card;
  1972. }
  1973. function renderPerformanceList() {
  1974. var section = document.getElementById('sharePerformanceSection');
  1975. var titleEl = document.getElementById('performanceSectionTitle');
  1976. var strip = document.getElementById('performanceStripEl');
  1977. if (!section || !titleEl || !strip) return;
  1978. strip.innerHTML = '';
  1979. if (!shouldShowPerformanceSection()) {
  1980. section.style.display = 'none';
  1981. section.setAttribute('aria-hidden', 'true');
  1982. return;
  1983. }
  1984. if (closedMerchantFlag) {
  1985. section.style.display = 'none';
  1986. section.setAttribute('aria-hidden', 'true');
  1987. return;
  1988. }
  1989. var records = performanceListCache.records;
  1990. var total = performanceListCache.total;
  1991. if (isNaN(total)) total = records.length;
  1992. titleEl.textContent = '演出安排(' + total + ')';
  1993. if (!records.length) {
  1994. section.style.display = 'none';
  1995. section.setAttribute('aria-hidden', 'true');
  1996. return;
  1997. }
  1998. section.style.display = 'block';
  1999. section.setAttribute('aria-hidden', 'false');
  2000. records.forEach(function (row) {
  2001. if (!row) return;
  2002. strip.appendChild(createPerformanceCardElement(row));
  2003. });
  2004. }
  2005. function renderStaffGroups(raw) {
  2006. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  2007. var section = document.getElementById('shareStaffSection');
  2008. var mount = document.getElementById('staffGroupsMount');
  2009. if (!section || !mount) return;
  2010. var totalStaff = 0;
  2011. staffGroupsCache.forEach(function (g) {
  2012. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  2013. });
  2014. var countEl = document.getElementById('staffSectionCountEl');
  2015. if (countEl) countEl.textContent = String(totalStaff);
  2016. mount.innerHTML = '';
  2017. if (closedMerchantFlag) {
  2018. section.style.display = 'none';
  2019. section.setAttribute('aria-hidden', 'true');
  2020. return;
  2021. }
  2022. var groups = staffGroupsCache.filter(function (g) {
  2023. return g && Array.isArray(g.staffList) && g.staffList.length;
  2024. });
  2025. if (!groups.length) {
  2026. section.style.display = 'none';
  2027. section.setAttribute('aria-hidden', 'true');
  2028. return;
  2029. }
  2030. section.style.display = 'block';
  2031. section.setAttribute('aria-hidden', 'false');
  2032. groups.forEach(function (group) {
  2033. var wrap = document.createElement('div');
  2034. wrap.className = 'staff-group';
  2035. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  2036. var strip = document.createElement('div');
  2037. strip.className = 'staff-strip';
  2038. group.staffList.forEach(function (staff) {
  2039. if (!staff) return;
  2040. strip.appendChild(createStaffCardElement(staff));
  2041. });
  2042. wrap.appendChild(strip);
  2043. mount.appendChild(wrap);
  2044. });
  2045. }
  2046. function bindStaffSection() {
  2047. var btn = document.getElementById('staffSectionAllBtn');
  2048. if (!btn || btn.dataset.bound) return;
  2049. btn.dataset.bound = '1';
  2050. btn.addEventListener('click', function (e) {
  2051. e.preventDefault();
  2052. tryOpenHBuilderApp();
  2053. });
  2054. }
  2055. function buildHeroSlides(urls) {
  2056. var track = document.getElementById('heroTrack');
  2057. var dotsWrap = document.getElementById('heroDots');
  2058. track.innerHTML = '';
  2059. dotsWrap.innerHTML = '';
  2060. var list = (urls || []).filter(Boolean);
  2061. if (!list.length) {
  2062. var slide = document.createElement('div');
  2063. slide.className = 'hero__slide';
  2064. var img = document.createElement('img');
  2065. img.src = 'images/hero.png';
  2066. img.alt = '店铺';
  2067. slide.appendChild(img);
  2068. track.appendChild(slide);
  2069. var dot = document.createElement('span');
  2070. dot.className = 'hero__dot is-active';
  2071. dotsWrap.appendChild(dot);
  2072. return initHeroCarousel(1);
  2073. }
  2074. list.forEach(function (url, d) {
  2075. var slide = document.createElement('div');
  2076. slide.className = 'hero__slide';
  2077. var img = document.createElement('img');
  2078. img.src = url;
  2079. img.alt = '店铺图';
  2080. slide.appendChild(img);
  2081. track.appendChild(slide);
  2082. var dot = document.createElement('span');
  2083. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  2084. dotsWrap.appendChild(dot);
  2085. });
  2086. initHeroCarousel(list.length);
  2087. }
  2088. var heroI = 0;
  2089. var heroTimer = null;
  2090. function initHeroCarousel(slides) {
  2091. var track = document.getElementById('heroTrack');
  2092. var dotsWrap = document.getElementById('heroDots');
  2093. var dots = dotsWrap.querySelectorAll('.hero__dot');
  2094. if (slides < 2) return;
  2095. function go(n) {
  2096. heroI = (n + slides) % slides;
  2097. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  2098. dots.forEach(function (el, idx) {
  2099. el.classList.toggle('is-active', idx === heroI);
  2100. });
  2101. }
  2102. if (heroTimer) clearInterval(heroTimer);
  2103. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  2104. var hero = document.getElementById('hero');
  2105. var startX = 0;
  2106. hero.addEventListener('touchstart', function (e) {
  2107. startX = e.changedTouches[0].clientX;
  2108. }, { passive: true });
  2109. hero.addEventListener('touchend', function (e) {
  2110. var dx = e.changedTouches[0].clientX - startX;
  2111. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  2112. }, { passive: true });
  2113. }
  2114. function timeToMinutes(t) {
  2115. var parts = String(t || '').trim().split(':');
  2116. var h = parseInt(parts[0], 10) || 0;
  2117. var m = parseInt(parts[1], 10) || 0;
  2118. return h * 60 + m;
  2119. }
  2120. function isTimeInRange(startTime, endTime) {
  2121. var s = String(startTime || '').trim();
  2122. var e = String(endTime || '').trim();
  2123. if (s === '00:00' && e === '00:00') return true;
  2124. if (s === '00:00' && e === '23:59') return true;
  2125. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  2126. var sm = timeToMinutes(s);
  2127. var em = timeToMinutes(e);
  2128. if (em < sm) {
  2129. return cur >= sm || cur <= em;
  2130. }
  2131. return cur >= sm && cur <= em;
  2132. }
  2133. function parseHolidayDate(str) {
  2134. if (!str) return null;
  2135. var d = new Date(String(str).trim().replace(/-/g, '/'));
  2136. return isNaN(d.getTime()) ? null : d;
  2137. }
  2138. function isTodayInHolidayRange(holidayInfo) {
  2139. if (!holidayInfo) return false;
  2140. var hi = holidayInfo;
  2141. if (typeof hi === 'string') {
  2142. try {
  2143. hi = JSON.parse(hi);
  2144. } catch (err) {
  2145. return false;
  2146. }
  2147. }
  2148. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  2149. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  2150. if (!start || !end) return false;
  2151. var startD = parseHolidayDate(start);
  2152. var endD = parseHolidayDate(end);
  2153. if (!startD || !endD) return false;
  2154. var today = new Date();
  2155. today.setHours(0, 0, 0, 0);
  2156. startD.setHours(0, 0, 0, 0);
  2157. endD.setHours(0, 0, 0, 0);
  2158. return today >= startD && today <= endD;
  2159. }
  2160. function findNormalBusinessInfo(list) {
  2161. var wdJs = new Date().getDay();
  2162. var i;
  2163. var x;
  2164. var w;
  2165. for (i = 0; i < list.length; i++) {
  2166. x = list[i];
  2167. if (!x || x.holidayInfo) continue;
  2168. w = x.weekDay != null ? x.weekDay : x.week;
  2169. if (w === undefined || w === null) continue;
  2170. if (Number(w) === wdJs) return x;
  2171. }
  2172. var wdMap = wdJs === 0 ? 7 : wdJs;
  2173. for (i = 0; i < list.length; i++) {
  2174. x = list[i];
  2175. if (!x || x.holidayInfo) continue;
  2176. w = x.weekDay != null ? x.weekDay : x.week;
  2177. if (w === undefined || w === null) continue;
  2178. if (Number(w) === wdMap) return x;
  2179. }
  2180. for (i = 0; i < list.length; i++) {
  2181. x = list[i];
  2182. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  2183. }
  2184. return null;
  2185. }
  2186. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  2187. function computeBusinessStatusDisplay(d) {
  2188. if (!d) return { text: '—', isOpen: false };
  2189. if (Number(d.businessStatus) === 99) {
  2190. return { text: '商户已关闭', isOpen: false };
  2191. }
  2192. if (Number(d.businessStatus) === 1) {
  2193. return { text: '暂停营业', isOpen: false };
  2194. }
  2195. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  2196. if (!list.length) {
  2197. return { text: '商家暂未配置营业时间', isOpen: false };
  2198. }
  2199. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  2200. ? d.holidayBusinessInfoList
  2201. : list.filter(function (item) { return item && item.holidayInfo; });
  2202. var todayHolidayItem = holidayList.find(function (item) {
  2203. return isTodayInHolidayRange(item.holidayInfo);
  2204. });
  2205. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  2206. var isOpen = false;
  2207. var currentItem = null;
  2208. if (todayHolidayItem) {
  2209. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  2210. currentItem = todayHolidayItem;
  2211. } else if (normal) {
  2212. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  2213. currentItem = normal;
  2214. }
  2215. if (!currentItem) return { text: '休息中', isOpen: false };
  2216. if (!isOpen) return { text: '休息中', isOpen: false };
  2217. var st = String(currentItem.startTime || '').trim();
  2218. var et = String(currentItem.endTime || '').trim();
  2219. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  2220. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  2221. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  2222. var suffix = (needNextDay ? '次日' : '') + et;
  2223. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  2224. }
  2225. /**
  2226. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  2227. */
  2228. function parseStoreEvaluateRaw(raw) {
  2229. if (raw == null || raw === '') return null;
  2230. if (typeof raw === 'string') {
  2231. var t = raw.trim();
  2232. if (!t) return null;
  2233. try {
  2234. raw = JSON.parse(t);
  2235. } catch (e) {
  2236. return null;
  2237. }
  2238. }
  2239. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  2240. raw = raw[0];
  2241. }
  2242. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  2243. return null;
  2244. }
  2245. function getStoreEvaluateScores(d) {
  2246. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  2247. || parseStoreEvaluateRaw(d.evaluate)
  2248. || parseStoreEvaluateRaw(d.evaluateInfo);
  2249. function lane(key, snake) {
  2250. var v;
  2251. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  2252. else if (d[key] != null && d[key] !== '') v = d[key];
  2253. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  2254. else return null;
  2255. var n = Number(v);
  2256. return !isNaN(n) ? n : null;
  2257. }
  2258. return {
  2259. scoreOne: lane('scoreOne', 'score_one'),
  2260. scoreTwo: lane('scoreTwo', 'score_two'),
  2261. scoreThree: lane('scoreThree', 'score_three')
  2262. };
  2263. }
  2264. function fmtEvalScore(n) {
  2265. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  2266. }
  2267. var CLOSED_REC_STAR_PATH =
  2268. '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';
  2269. function closedRecEscHtml(s) {
  2270. return String(s == null ? '' : s)
  2271. .replace(/&/g, '&amp;')
  2272. .replace(/</g, '&lt;')
  2273. .replace(/>/g, '&gt;')
  2274. .replace(/"/g, '&quot;');
  2275. }
  2276. function closedRecStarsHtml(score) {
  2277. var s = Number(score);
  2278. if (isNaN(s)) s = 0;
  2279. s = Math.max(0, Math.min(5, s));
  2280. var rounded = Math.round(s);
  2281. var parts = [];
  2282. var i;
  2283. for (i = 1; i <= 5; i++) {
  2284. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  2285. parts.push(
  2286. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  2287. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  2288. );
  2289. }
  2290. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  2291. }
  2292. function closedRecFormatDistance(item) {
  2293. if (item.distance != null && item.distance !== '') {
  2294. var km = Number(item.distance);
  2295. if (!isNaN(km) && km >= 0) {
  2296. return Math.round(km * 1000) + '米';
  2297. }
  2298. return String(item.distance).trim();
  2299. }
  2300. if (item.position != null && String(item.position).trim() !== '') {
  2301. return String(item.position).trim();
  2302. }
  2303. if (item.dist != null && item.dist !== '') {
  2304. var dn = Number(item.dist);
  2305. if (!isNaN(dn)) {
  2306. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  2307. }
  2308. }
  2309. return '';
  2310. }
  2311. function closedRecPickScore(item) {
  2312. var x =
  2313. item.scoreAvg != null ? Number(item.scoreAvg)
  2314. : item.score != null ? Number(item.score)
  2315. : item.rating != null ? Number(item.rating)
  2316. : item.starScore != null ? Number(item.starScore)
  2317. : NaN;
  2318. return isNaN(x) ? null : x;
  2319. }
  2320. function closedRecPickReviewCount(item) {
  2321. var n =
  2322. item.commitCount != null ? Number(item.commitCount)
  2323. : item.commentCount != null ? Number(item.commentCount)
  2324. : item.reviewCount != null ? Number(item.reviewCount)
  2325. : item.evaluateCount != null ? Number(item.evaluateCount)
  2326. : NaN;
  2327. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  2328. }
  2329. function normalizeClosedStoreRecommendList(res) {
  2330. if (!res || typeof res !== 'object') return [];
  2331. var raw = res.data != null ? res.data : res.result;
  2332. if (Array.isArray(raw)) return raw;
  2333. if (raw && typeof raw === 'object') {
  2334. if (Array.isArray(raw.list)) return raw.list;
  2335. if (Array.isArray(raw.records)) return raw.records;
  2336. if (Array.isArray(raw.rows)) return raw.rows;
  2337. if (Array.isArray(raw.content)) return raw.content;
  2338. if (Array.isArray(raw.stores)) return raw.stores;
  2339. if (Array.isArray(raw.storeList)) return raw.storeList;
  2340. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  2341. if (Array.isArray(raw.items)) return raw.items;
  2342. }
  2343. if (Array.isArray(res.list)) return res.list;
  2344. if (Array.isArray(res.records)) return res.records;
  2345. return [];
  2346. }
  2347. function fetchShareClosedStoreRecommend(storeIdStr) {
  2348. var latRaw = (q('userLat') || q('latitude') || q('lat') || q('weidu')).trim();
  2349. var lngRaw = (q('userLng') || q('longitude') || q('lon') || q('jingdu')).trim();
  2350. var userLat =
  2351. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : DEFAULT_REC_USER_LAT;
  2352. var userLng =
  2353. lngRaw !== '' && !isNaN(Number(lngRaw)) ? Number(lngRaw) : DEFAULT_REC_USER_LNG;
  2354. var page = parseInt(q('page') || '1', 10);
  2355. var pageSize = parseInt(q('pageSize') || '10', 10);
  2356. if (isNaN(page) || page < 1) page = 1;
  2357. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  2358. var userCityRaw = (q('userCity') || q('city') || '').trim();
  2359. var userCity = userCityRaw !== '' ? userCityRaw : DEFAULT_REC_USER_CITY;
  2360. var body = {
  2361. page: page,
  2362. pageSize: pageSize,
  2363. storeId: String(storeIdStr || ''),
  2364. userCity: userCity,
  2365. userLat: userLat,
  2366. userLng: userLng
  2367. };
  2368. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  2369. method: 'POST',
  2370. mode: 'cors',
  2371. credentials: 'omit',
  2372. headers: {
  2373. Accept: 'application/json',
  2374. 'Content-Type': 'application/json;charset=UTF-8'
  2375. },
  2376. body: JSON.stringify(body)
  2377. }).then(function (res) {
  2378. if (!res.ok) throw new Error('HTTP ' + res.status);
  2379. return res.json();
  2380. });
  2381. }
  2382. function renderShareClosedRecommended(list) {
  2383. var wrap = document.getElementById('shareClosedRecList');
  2384. var empty = document.getElementById('shareClosedRecEmpty');
  2385. if (!wrap || !empty) return;
  2386. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  2387. n.remove();
  2388. });
  2389. if (!list || !list.length) {
  2390. empty.style.display = 'block';
  2391. return;
  2392. }
  2393. empty.style.display = 'none';
  2394. list.forEach(function (item) {
  2395. if (!item || typeof item !== 'object') return;
  2396. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  2397. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  2398. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  2399. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  2400. if (vf) home = vf;
  2401. }
  2402. var imgUrl =
  2403. imgUrlField ||
  2404. home ||
  2405. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  2406. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  2407. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  2408. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  2409. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  2410. (Array.isArray(item.imageList) && item.imageList[0]) ||
  2411. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  2412. '';
  2413. var name = item.title != null && String(item.title).trim() !== ''
  2414. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  2415. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  2416. var dist = closedRecFormatDistance(item);
  2417. var scoreVal = closedRecPickScore(item);
  2418. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  2419. var starScore = scoreVal != null ? scoreVal : 0;
  2420. var rc = closedRecPickReviewCount(item);
  2421. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  2422. var seller =
  2423. item.userName != null && String(item.userName).trim() !== ''
  2424. ? String(item.userName).trim()
  2425. : (item.nickName != null && String(item.nickName).trim() !== ''
  2426. ? String(item.nickName).trim()
  2427. : '');
  2428. var card = document.createElement('article');
  2429. card.className = 'closed-rec-card';
  2430. card.innerHTML =
  2431. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  2432. '<div class="closed-rec-card__body">' +
  2433. '<div class="closed-rec-card__top">' +
  2434. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  2435. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  2436. '</div>' +
  2437. '<div class="closed-rec-card__rating">' +
  2438. closedRecStarsHtml(starScore) +
  2439. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  2440. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  2441. '</div>' +
  2442. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  2443. '</div>';
  2444. var coverIm = card.querySelector('img.closed-rec-card__cover');
  2445. if (coverIm) {
  2446. coverIm.src = imgUrl;
  2447. coverIm.onerror = function () {
  2448. this.onerror = null;
  2449. this.src = '';
  2450. };
  2451. }
  2452. wrap.appendChild(card);
  2453. });
  2454. }
  2455. function loadShareClosedRecommendations() {
  2456. var sid = getStoreId();
  2457. if (!sid) {
  2458. renderShareClosedRecommended([]);
  2459. return;
  2460. }
  2461. fetchShareClosedStoreRecommend(sid)
  2462. .then(function (res) {
  2463. var list = normalizeClosedStoreRecommendList(res);
  2464. if (!list.length && res && res.msg) {
  2465. console.warn('[store-recommend]', res.msg);
  2466. }
  2467. renderShareClosedRecommended(list);
  2468. })
  2469. .catch(function (e) {
  2470. console.error(e);
  2471. renderShareClosedRecommended([]);
  2472. });
  2473. }
  2474. function applyShareIndexClosedMerchantUi(closed) {
  2475. var wasClosed = closedMerchantFlag;
  2476. closedMerchantFlag = closed;
  2477. var banner = document.getElementById('shareClosedBanner');
  2478. var contentEl = document.getElementById('shareContentEl');
  2479. var belowEl = document.getElementById('shareBelowContentEl');
  2480. var recWrap = document.getElementById('shareClosedRecommendWrap');
  2481. if (banner) {
  2482. banner.style.display = closed ? 'block' : 'none';
  2483. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  2484. }
  2485. if (contentEl) {
  2486. contentEl.style.display = closed ? 'none' : '';
  2487. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  2488. }
  2489. if (belowEl) {
  2490. belowEl.style.display = '';
  2491. belowEl.setAttribute('aria-hidden', 'false');
  2492. }
  2493. if (recWrap) {
  2494. if (closed) {
  2495. recWrap.style.display = 'block';
  2496. recWrap.setAttribute('aria-hidden', 'false');
  2497. if (!wasClosed) {
  2498. loadShareClosedRecommendations();
  2499. }
  2500. } else {
  2501. recWrap.style.display = 'none';
  2502. recWrap.setAttribute('aria-hidden', 'true');
  2503. renderShareClosedRecommended([]);
  2504. }
  2505. }
  2506. }
  2507. function renderDetail(d) {
  2508. if (!d) return;
  2509. document.getElementById('storeName').textContent = d.storeName || '—';
  2510. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  2511. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  2512. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  2513. var evRow = document.getElementById('storeEvaluateRow');
  2514. var evOne = document.getElementById('storeEvaluateScoreOne');
  2515. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  2516. var evThree = document.getElementById('storeEvaluateScoreThree');
  2517. if (evRow && evOne && evTwo && evThree) {
  2518. evRow.classList.remove('is-visible');
  2519. evRow.setAttribute('aria-hidden', 'true');
  2520. var es = getStoreEvaluateScores(d);
  2521. var a = fmtEvalScore(es.scoreOne);
  2522. var b = fmtEvalScore(es.scoreTwo);
  2523. var c = fmtEvalScore(es.scoreThree);
  2524. if (a !== null || b !== null || c !== null) {
  2525. evOne.textContent = a !== null ? a : '—';
  2526. evTwo.textContent = b !== null ? b : '—';
  2527. evThree.textContent = c !== null ? c : '—';
  2528. evRow.classList.add('is-visible');
  2529. evRow.setAttribute('aria-hidden', 'false');
  2530. }
  2531. }
  2532. var bizDisp = computeBusinessStatusDisplay(d);
  2533. var bizEl = document.getElementById('bizStatus');
  2534. bizEl.textContent = bizDisp.text;
  2535. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  2536. document.getElementById('hoursText').textContent = '';
  2537. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  2538. if (d.distance != null) {
  2539. document.getElementById('metaDistance').style.display = 'flex';
  2540. document.getElementById('distanceText').textContent =
  2541. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  2542. }
  2543. if (d.subwayName && d.distance2 != null) {
  2544. document.getElementById('metaSubway').style.display = 'flex';
  2545. document.getElementById('subwayText').textContent =
  2546. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  2547. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  2548. : Math.round(Number(d.distance2)) + 'm');
  2549. }
  2550. var imgs = [];
  2551. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  2552. else if (d.entranceImage) imgs = [d.entranceImage];
  2553. buildHeroSlides(imgs);
  2554. var closedMerchant = Number(d.businessStatus) === 99;
  2555. applyShareIndexClosedMerchantUi(closedMerchant);
  2556. renderMarketingList(marketingListCache);
  2557. renderPerformanceList();
  2558. renderStaffGroups(staffGroupsCache);
  2559. }
  2560. function getLngForApi() {
  2561. var v = q('jingdu');
  2562. if (v) return v;
  2563. return q('lon') || q('lng') || q('longitude');
  2564. }
  2565. function getLatForApi() {
  2566. var v = q('weidu');
  2567. if (v) return v;
  2568. return q('lat') || q('latitude');
  2569. }
  2570. function mergeSearchAndHashParamsForRedirect() {
  2571. var params = new URLSearchParams();
  2572. function ingest(slice) {
  2573. if (!slice) return;
  2574. var p = new URLSearchParams(slice);
  2575. p.forEach(function (val, key) {
  2576. params.set(key, val);
  2577. });
  2578. }
  2579. if (location.search && location.search.length > 1) {
  2580. ingest(location.search.slice(1));
  2581. }
  2582. var hash = location.hash || '';
  2583. var qi = hash.indexOf('?');
  2584. if (qi >= 0) {
  2585. ingest(hash.slice(qi + 1));
  2586. }
  2587. return params;
  2588. }
  2589. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  2590. function buildShareCheckInUndefinedRedirectHref() {
  2591. var p = mergeSearchAndHashParamsForRedirect();
  2592. p.set('businessStatus', '99');
  2593. var sid = getStoreId();
  2594. if (sid && !p.has('storeId')) {
  2595. p.set('storeId', sid);
  2596. }
  2597. var j = getLngForApi();
  2598. var w = getLatForApi();
  2599. if (j && !p.has('userLng')) {
  2600. p.set('userLng', j);
  2601. }
  2602. if (w && !p.has('userLat')) {
  2603. p.set('userLat', w);
  2604. }
  2605. var qs = p.toString();
  2606. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  2607. }
  2608. function run() {
  2609. var sid = getStoreId();
  2610. var userId = q('userId');
  2611. var jingdu = getLngForApi();
  2612. var weidu = getLatForApi();
  2613. if (!sid) {
  2614. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  2615. document.getElementById('storeName').textContent = '参数错误';
  2616. return;
  2617. }
  2618. var detailPath = '/store/info/getClientStoreDetail?' +
  2619. 'id=' + encodeURIComponent(sid) +
  2620. '&userId=' + encodeURIComponent(userId) +
  2621. '&jingdu=' + encodeURIComponent(jingdu) +
  2622. '&weidu=' + encodeURIComponent(weidu);
  2623. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  2624. if (isGetOneBusinessStatus99(getOneRes)) {
  2625. applyShareIndexClosedMerchantUi(true);
  2626. }
  2627. apiFetch(detailPath)
  2628. .then(function (res) {
  2629. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  2630. if (tip === '暂无承载数据') {
  2631. if (closedMerchantFlag) {
  2632. return;
  2633. }
  2634. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  2635. return;
  2636. }
  2637. if (res.code !== 200 || !res.data) {
  2638. showErr(res.msg || '店铺详情加载失败');
  2639. return;
  2640. }
  2641. renderDetail(res.data);
  2642. })
  2643. .catch(function (e) {
  2644. console.error(e);
  2645. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  2646. });
  2647. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  2648. marketingCouponLoaded = false;
  2649. apiFetch(couponPath)
  2650. .then(function (res) {
  2651. marketingCouponLoaded = true;
  2652. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2653. if (!Array.isArray(list)) list = [];
  2654. renderMarketingList(list);
  2655. })
  2656. .catch(function (e) {
  2657. marketingCouponLoaded = true;
  2658. console.warn('[getStoreCouponList]', e);
  2659. renderMarketingList([]);
  2660. });
  2661. if (shouldShowPerformanceSection()) {
  2662. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2663. apiFetch(perfPath)
  2664. .then(function (res) {
  2665. var d = (res && res.code === 200 && res.data) || null;
  2666. if (!d || typeof d !== 'object') {
  2667. performanceListCache.records = [];
  2668. performanceListCache.total = 0;
  2669. } else {
  2670. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2671. var pt = d.total;
  2672. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2673. ? Number(pt)
  2674. : performanceListCache.records.length;
  2675. }
  2676. renderPerformanceList();
  2677. })
  2678. .catch(function (e) {
  2679. console.warn('[performance/list/query]', e);
  2680. performanceListCache.records = [];
  2681. performanceListCache.total = 0;
  2682. renderPerformanceList();
  2683. });
  2684. } else {
  2685. performanceListCache.records = [];
  2686. performanceListCache.total = 0;
  2687. renderPerformanceList();
  2688. }
  2689. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2690. apiFetch(staffPath)
  2691. .then(function (res) {
  2692. var arr = (res && res.code === 200 && res.data) || [];
  2693. if (!Array.isArray(arr)) arr = [];
  2694. renderStaffGroups(arr);
  2695. })
  2696. .catch(function (e) {
  2697. console.warn('[queryStaffListByTitle]', e);
  2698. renderStaffGroups([]);
  2699. });
  2700. });
  2701. }
  2702. function boot() {
  2703. run();
  2704. bindMarketingMore();
  2705. bindStaffSection();
  2706. var launchTag = document.getElementById('launch-btn');
  2707. if (launchTag && WECHAT_OPEN_APP_ID) {
  2708. launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  2709. }
  2710. bindOpenAppFabClick();
  2711. updateFabOpenLayer();
  2712. if (isWxDebugOn()) {
  2713. reportWxDebug('page load', { errMsg: 'wxDebug=1 已开启' }, [
  2714. 'UA=' + (navigator.userAgent || '').slice(0, 120),
  2715. 'page=' + location.href.split('#')[0]
  2716. ]);
  2717. }
  2718. initWeChatOpenLaunchApp();
  2719. }
  2720. if (document.readyState === 'complete') {
  2721. boot();
  2722. } else {
  2723. window.onload = boot;
  2724. }
  2725. })();
  2726. </script>
  2727. </body>
  2728. </html>