index.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <title data-i18n="home.title">首页</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <meta name="theme-color" content="#ff4c3b" />
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  11. <meta name="apple-mobile-web-app-title" content="">
  12. <meta name="msapplication-TileImage" content="#">
  13. <meta name="msapplication-TileColor" content="#FFFFFF">
  14. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  15. <link rel="icon" href="#" type="image/x-icon" />
  16. <link rel="apple-touch-icon" href="#">
  17. <link rel="stylesheet" id="rtl-link" type="text/css" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/vendors/bootstrap.css">
  18. <link rel="stylesheet" type="text/css" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/vendors/slick-theme.css">
  19. <link rel="stylesheet" type="text/css" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/vendors/slick.css">
  20. <link rel="stylesheet" type="text/css" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/vendors/iconly.css">
  21. <link rel="stylesheet" id="change-link" type="text/css" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/style.css">
  22. <link rel="stylesheet" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/font-awesome.min.css">
  23. <link rel="stylesheet" href="https://txbj.assets.youyanen.com/student/browsers/assets/css/cropper.min.css">
  24. <link rel="stylesheet" href="https://txbj.assets.youyanen.com/browser/css/bootstrap-icons.min.css">
  25. <style>
  26. body.home2-page {
  27. background: #f5f5f5;
  28. padding-bottom: 72px;
  29. }
  30. body.home2-page header {
  31. position: relative;
  32. left: 0 !important;
  33. top: 0;
  34. transform: none !important;
  35. display: flex;
  36. align-items: center;
  37. justify-content: flex-start;
  38. width: 100%;
  39. max-width: 100% !important;
  40. margin: 0;
  41. padding: 12px 15px 0;
  42. background: #f5f5f5;
  43. box-shadow: none;
  44. z-index: 1;
  45. }
  46. body.home2-page header .brand-logo {
  47. display: block;
  48. line-height: 0;
  49. }
  50. body.home2-page header .brand-logo img {
  51. width: auto;
  52. max-width: 140px;
  53. max-height: 36px;
  54. height: auto;
  55. object-fit: contain;
  56. display: block;
  57. }
  58. .home2-page .loader {
  59. display: none !important;
  60. }
  61. .home2-wrap {
  62. background: #f5f5f5;
  63. }
  64. /* Nav icons */
  65. .home2-nav {
  66. display: flex;
  67. justify-content: space-between;
  68. padding: 18px 16px 8px;
  69. background: #f5f5f5;
  70. }
  71. .home2-nav-item {
  72. flex: 1;
  73. text-align: center;
  74. text-decoration: none;
  75. color: #444;
  76. }
  77. .home2-nav-icon {
  78. width: 52px;
  79. height: 52px;
  80. margin: 0 auto 8px;
  81. border-radius: 16px;
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. color: #fff;
  86. font-size: 22px;
  87. box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
  88. }
  89. .home2-nav-icon.orange { background: #ff4c3b; }
  90. .home2-nav-icon.purple { background: #9b59b6; }
  91. .home2-nav-icon.green { background: #2ecc71; }
  92. .home2-nav-icon.blue { background: #3498db; }
  93. .home2-nav-icon.pink { background: #ff6b9d; }
  94. .home2-nav-label {
  95. font-size: 12px;
  96. font-weight: 500;
  97. }
  98. /* Promo banner */
  99. .home2-promo {
  100. margin: 8px 15px 0;
  101. border-radius: 16px;
  102. overflow: hidden;
  103. background: linear-gradient(135deg, #ff7a6a 0%, #ff4c3b 55%, #e53e30 100%);
  104. min-height: 96px;
  105. display: flex;
  106. align-items: center;
  107. text-decoration: none;
  108. color: #fff;
  109. box-shadow: 0 6px 18px rgba(255, 143, 0, .28);
  110. }
  111. .home2-promo-img {
  112. width: 110px;
  113. height: 96px;
  114. object-fit: contain;
  115. flex-shrink: 0;
  116. margin-left: 4px;
  117. }
  118. .home2-promo-text {
  119. flex: 1;
  120. padding: 12px 14px 12px 0;
  121. }
  122. .home2-promo-title {
  123. margin: 0 0 6px;
  124. font-size: 22px;
  125. font-weight: 800;
  126. letter-spacing: 1px;
  127. }
  128. .home2-promo-sub {
  129. margin: 0;
  130. font-size: 13px;
  131. font-weight: 600;
  132. opacity: .95;
  133. }
  134. .home2-promo-sub .yellow {
  135. color: #ffe066;
  136. }
  137. /* Section */
  138. .home2-section {
  139. padding: 22px 15px 0;
  140. }
  141. .home2-section-head {
  142. display: flex;
  143. align-items: flex-start;
  144. justify-content: space-between;
  145. gap: 12px;
  146. margin-bottom: 14px;
  147. }
  148. .home2-section-title {
  149. margin: 0;
  150. font-size: 20px;
  151. font-weight: 800;
  152. color: #222;
  153. line-height: 1.3;
  154. }
  155. .home2-section-sub {
  156. margin: 4px 0 0;
  157. font-size: 13px;
  158. color: #999;
  159. font-weight: 400;
  160. }
  161. .home2-more-btn {
  162. flex-shrink: 0;
  163. padding: 4px 12px;
  164. border: 1px solid #ddd;
  165. border-radius: 999px;
  166. background: #fff;
  167. color: #666;
  168. font-size: 12px;
  169. text-decoration: none;
  170. white-space: nowrap;
  171. line-height: 1.6;
  172. }
  173. /* Video scroll */
  174. .home2-video-scroll {
  175. display: flex;
  176. gap: 12px;
  177. overflow-x: auto;
  178. padding-bottom: 6px;
  179. scroll-snap-type: x mandatory;
  180. -webkit-overflow-scrolling: touch;
  181. }
  182. .home2-video-scroll::-webkit-scrollbar {
  183. display: none;
  184. }
  185. .home2-video-card {
  186. flex: 0 0 68%;
  187. max-width: 280px;
  188. scroll-snap-align: start;
  189. border-radius: 14px;
  190. overflow: hidden;
  191. background: #fff;
  192. box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
  193. text-decoration: none;
  194. color: inherit;
  195. position: relative;
  196. }
  197. .home2-video-thumb {
  198. position: relative;
  199. width: 100%;
  200. aspect-ratio: 16 / 10;
  201. background: linear-gradient(135deg, #e8f4fc 0%, #d4e8f7 100%);
  202. overflow: hidden;
  203. }
  204. .home2-video-thumb img,
  205. .home2-video-preview {
  206. width: 100%;
  207. height: 100%;
  208. object-fit: cover;
  209. }
  210. .home2-video-preview {
  211. display: block;
  212. pointer-events: none;
  213. }
  214. .home2-video-thumb img {
  215. width: 100%;
  216. height: 100%;
  217. object-fit: cover;
  218. }
  219. .home2-video-play {
  220. position: absolute;
  221. inset: 0;
  222. display: flex;
  223. align-items: center;
  224. justify-content: center;
  225. background: rgba(0, 0, 0, .12);
  226. }
  227. .home2-video-play span {
  228. width: 44px;
  229. height: 44px;
  230. border-radius: 50%;
  231. background: rgba(255, 255, 255, .88);
  232. display: flex;
  233. align-items: center;
  234. justify-content: center;
  235. color: #ff4c3b;
  236. font-size: 18px;
  237. padding-left: 3px;
  238. box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  239. }
  240. .home2-video-avatar {
  241. position: absolute;
  242. right: 8px;
  243. bottom: 8px;
  244. width: 36px;
  245. height: 36px;
  246. border-radius: 50%;
  247. border: 2px solid #fff;
  248. object-fit: cover;
  249. box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  250. }
  251. .home2-video-empty {
  252. padding: 28px 16px;
  253. text-align: center;
  254. color: #999;
  255. font-size: 14px;
  256. background: #fff;
  257. border-radius: 14px;
  258. }
  259. .home2-nav-item:hover {
  260. color: #444;
  261. }
  262. .home2-promo:hover {
  263. color: #fff;
  264. }
  265. /* Teacher recommend */
  266. .home2-teacher-list {
  267. display: flex;
  268. flex-direction: column;
  269. gap: 12px;
  270. }
  271. .home2-tr-card {
  272. position: relative;
  273. background: #fff;
  274. border-radius: 14px;
  275. box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  276. overflow: hidden;
  277. cursor: pointer;
  278. }
  279. .home2-tr-card-link {
  280. position: absolute;
  281. inset: 0;
  282. z-index: 1;
  283. }
  284. .home2-tr-card-link:focus {
  285. outline: none;
  286. }
  287. .home2-tr-card-link:focus-visible {
  288. outline: 2px solid #ff4c3b;
  289. outline-offset: 2px;
  290. }
  291. .home2-tr-hot {
  292. position: absolute;
  293. top: 0;
  294. left: 0;
  295. z-index: 1;
  296. display: inline-flex;
  297. align-items: center;
  298. gap: 4px;
  299. padding: 5px 8px 5px 10px;
  300. background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
  301. color: #7a4f00;
  302. font-size: 11px;
  303. font-weight: 700;
  304. border-radius: 14px 0 12px 0;
  305. line-height: 1.2;
  306. }
  307. .home2-tr-inner {
  308. display: flex;
  309. gap: 12px;
  310. padding: 12px;
  311. align-items: stretch;
  312. }
  313. .home2-tr-thumb {
  314. position: relative;
  315. flex: 0 0 118px;
  316. width: 118px;
  317. height: 118px;
  318. border-radius: 12px;
  319. overflow: hidden;
  320. display: block;
  321. background: #eee;
  322. }
  323. .home2-tr-thumb img,
  324. .home2-tr-thumb video {
  325. width: 100%;
  326. height: 100%;
  327. object-fit: cover;
  328. display: block;
  329. }
  330. .home2-tr-thumb video {
  331. pointer-events: none;
  332. }
  333. .home2-tr-play {
  334. position: absolute;
  335. left: 50%;
  336. top: 50%;
  337. transform: translate(-50%, -50%);
  338. width: 36px;
  339. height: 36px;
  340. border-radius: 50%;
  341. background: rgba(255, 255, 255, .92);
  342. color: #ff4c3b;
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. font-size: 14px;
  347. padding-left: 2px;
  348. box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  349. }
  350. .home2-tr-thumb-label {
  351. position: absolute;
  352. left: 0;
  353. right: 0;
  354. bottom: 0;
  355. padding: 18px 6px 6px;
  356. background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  357. color: #fff;
  358. font-size: 10px;
  359. line-height: 1.35;
  360. word-break: break-word;
  361. }
  362. .home2-tr-info {
  363. flex: 1;
  364. min-width: 0;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: space-between;
  368. padding-top: 2px;
  369. }
  370. .home2-tr-name-row {
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. gap: 8px;
  375. margin-bottom: 8px;
  376. }
  377. .home2-tr-name-main {
  378. flex: 1;
  379. min-width: 0;
  380. display: flex;
  381. align-items: baseline;
  382. flex-wrap: wrap;
  383. gap: 6px;
  384. }
  385. .home2-tr-software {
  386. display: flex;
  387. flex-wrap: wrap;
  388. align-items: center;
  389. justify-content: flex-end;
  390. gap: 6px;
  391. flex-shrink: 0;
  392. }
  393. .home2-tr-software-icon {
  394. width: 20px;
  395. height: 20px;
  396. object-fit: contain;
  397. display: block;
  398. }
  399. .home2-tr-name {
  400. font-family: Georgia, "Times New Roman", "Songti SC", serif;
  401. font-size: 20px;
  402. font-weight: 700;
  403. color: #111;
  404. line-height: 1.1;
  405. }
  406. .home2-tr-loc {
  407. font-size: 13px;
  408. color: #999;
  409. }
  410. .home2-tr-tags {
  411. display: flex;
  412. flex-wrap: wrap;
  413. gap: 6px;
  414. margin-bottom: 10px;
  415. }
  416. .home2-tr-tag {
  417. display: inline-block;
  418. padding: 3px 10px;
  419. border-radius: 999px;
  420. background: #fff5f4;
  421. color: #ff4c3b;
  422. border: 1px solid rgba(255, 76, 59, .35);
  423. font-size: 12px;
  424. font-weight: 600;
  425. line-height: 1.4;
  426. white-space: nowrap;
  427. }
  428. .home2-tr-tag-primary {
  429. background: linear-gradient(135deg, #ff6a5a 0%, #ff4c3b 100%);
  430. color: #fff;
  431. border-color: transparent;
  432. box-shadow: 0 2px 6px rgba(255, 76, 59, .28);
  433. }
  434. .home2-tr-bottom {
  435. display: flex;
  436. align-items: center;
  437. justify-content: flex-end;
  438. gap: 8px;
  439. }
  440. .home2-tr-book-btn {
  441. position: relative;
  442. z-index: 1;
  443. flex-shrink: 0;
  444. padding: 6px 14px;
  445. border: 1px solid #ff4c3b;
  446. border-radius: 999px;
  447. color: #ff4c3b;
  448. font-size: 14px;
  449. font-weight: 600;
  450. text-decoration: none;
  451. background: #fff;
  452. white-space: nowrap;
  453. }
  454. .home2-tr-book-btn:hover {
  455. color: #ff4c3b;
  456. background: #fff5f4;
  457. }
  458. .home2-teacher-empty {
  459. padding: 28px 16px;
  460. text-align: center;
  461. color: #999;
  462. font-size: 14px;
  463. background: #fff;
  464. border-radius: 14px;
  465. }
  466. @media (max-width: 360px) {
  467. .home2-nav-icon { width: 46px; height: 46px; font-size: 19px; }
  468. .home2-nav-label { font-size: 11px; }
  469. .home2-tr-thumb { flex-basis: 104px; width: 104px; height: 104px; }
  470. .home2-tr-name { font-size: 18px; }
  471. }
  472. </style>
  473. </head>
  474. <body class="home2-page ">
  475. <!-- loader strat -->
  476. <div class="loader">
  477. <span></span>
  478. <span></span>
  479. </div>
  480. <!-- loader end -->
  481. <style>
  482. header .brand-logo img.brand-logo-img {
  483. border: none;
  484. outline: none;
  485. box-shadow: none;
  486. background: transparent;
  487. opacity: 0;
  488. transition: opacity .12s ease;
  489. }
  490. header .brand-logo img.brand-logo-img.is-ready {
  491. opacity: 1;
  492. }
  493. </style>
  494. <header style="background-color: transparent;">
  495. <a href="/public/open/index.html" class="brand-logo">
  496. <img class="img-fluid brand-logo-img" alt="" id="img-logo-dark" width="179" height="34">
  497. </a>
  498. </header>
  499. <div class="home2-wrap">
  500. <!-- Nav icons -->
  501. <nav class="home2-nav">
  502. <a href="/public/open/teacher.html" class="home2-nav-item">
  503. <div class="home2-nav-icon orange"><i class="fa fa-users"></i></div>
  504. <div class="home2-nav-label" data-i18n="home.nav_teacher">教师列表</div>
  505. </a>
  506. <a href="/public/open/book.html" class="home2-nav-item">
  507. <div class="home2-nav-icon purple"><i class="fa fa-book"></i></div>
  508. <div class="home2-nav-label" data-i18n="home.nav_book">教材库</div>
  509. </a>
  510. <a href="/public/user/course.html" class="home2-nav-item">
  511. <div class="home2-nav-icon green"><i class="fa fa-calendar"></i></div>
  512. <div class="home2-nav-label" data-i18n="home.nav_course">我的课程</div>
  513. </a>
  514. <a href="/public/open/teacher.html" class="home2-nav-item">
  515. <div class="home2-nav-icon pink"><i class="fa fa-play-circle"></i></div>
  516. <div class="home2-nav-label" data-i18n="home.nav_free">免费课</div>
  517. </a>
  518. </nav>
  519. <!-- Promo banner -->
  520. <!-- <a href="/public/open/book.html" class="home2-promo">
  521. <img class="home2-promo-img" src="/public/assets/images/index2/promo-boy.svg" alt="">
  522. <div class="home2-promo-text">
  523. <h2 class="home2-promo-title" data-i18n="home.promo_title">经典教材介绍</h2>
  524. <p class="home2-promo-sub"><span class="yellow">KID's BOX</span> / POWER UP</p>
  525. </div>
  526. </a> -->
  527. <!-- Video clips -->
  528. <section class="home2-section" style="display:none;padding-bottom: 24px;">
  529. <div class="home2-section-head">
  530. <div>
  531. <h2 class="home2-section-title" data-i18n="home.clips_title">来看精彩切片吧</h2>
  532. <p class="home2-section-sub" data-i18n="home.clips_sub">外教课堂切片</p>
  533. </div>
  534. <a href="/public/open/teacher.html" class="home2-more-btn" data-i18n="home.more">更多 &gt;</a>
  535. </div>
  536. <div class="home2-video-scroll" id="home2_video_list"></div>
  537. </section>
  538. <!-- Teacher recommend -->
  539. <section class="home2-section" style="padding-bottom: 24px;">
  540. <div class="home2-section-head">
  541. <div>
  542. <h2 class="home2-section-title" data-i18n="home.teacher_title">外教推荐</h2>
  543. <p class="home2-section-sub" data-i18n="home.teacher_sub">启蒙 / 绘本 / 儿歌 / 自然拼读</p>
  544. </div>
  545. <a href="/public/open/teacher.html" class="home2-more-btn" data-i18n="home.all">全部 &gt;</a>
  546. </div>
  547. <div class="home2-teacher-list" id="home2_teacher_list"></div>
  548. </section>
  549. </div>
  550. <div class="bottom-panel">
  551. <ul>
  552. <li>
  553. <a href="/public/open/index.html">
  554. <div class="icon">
  555. <i class="iconly-Home icli"></i>
  556. <i class="iconly-Home icbo"></i>
  557. </div>
  558. <span data-i18n="nav.home">首页</span>
  559. </a>
  560. </li>
  561. <!-- <li>
  562. <a href="/public/open/teacher.html">
  563. <div class="icon">
  564. <i class="iconly-Category icli"></i>
  565. <i class="iconly-Category icbo"></i>
  566. </div>
  567. <span data-i18n="nav.teacher">教师</span>
  568. </a>
  569. </li>
  570. <li>
  571. <a href="/public/open/book.html">
  572. <div class="icon">
  573. <i class="iconly-Document icli"></i>
  574. <i class="iconly-Document icbo"></i>
  575. </div>
  576. <span data-i18n="nav.book">教材库</span>
  577. </a>
  578. </li> -->
  579. <li>
  580. <a href="/public/user/course.html">
  581. <div class="icon">
  582. <i class="iconly-Calendar icli"></i>
  583. <i class="iconly-Calendar icbo"></i>
  584. <span class="bottom-homework-badge" id="bottom_homework_pending" hidden></span>
  585. </div>
  586. <span data-i18n="nav.course">课程</span>
  587. </a>
  588. </li>
  589. <li>
  590. <a href="/public/user/chatlist.html">
  591. <div class="icon">
  592. <i class="iconly-Chat icli"></i>
  593. <i class="iconly-Chat icbo"></i>
  594. <span class="bottom-im-badge" id="bottom_im_unread" hidden></span>
  595. </div>
  596. <span data-i18n="nav.message">消息</span>
  597. </a>
  598. </li>
  599. <li>
  600. <a href="/public/user/profile.html">
  601. <div class="icon">
  602. <i class="iconly-Profile icli"></i>
  603. <i class="iconly-Profile icbo"></i>
  604. </div>
  605. <span data-i18n="nav.profile">个人中心</span>
  606. </a>
  607. </li>
  608. </ul>
  609. <style>
  610. .bottom-panel ul li .icon {
  611. position: relative;
  612. }
  613. /* 覆盖 .bottom-panel ul li a span 的菜单文字样式,避免角标把图标撑开 */
  614. .bottom-panel ul li a .icon .bottom-im-badge,
  615. .bottom-panel ul li a .icon .bottom-homework-badge {
  616. position: absolute;
  617. top: -4px;
  618. right: -10px;
  619. min-width: 16px;
  620. height: 16px;
  621. margin: 0;
  622. padding: 0 4px;
  623. border-radius: 999px;
  624. background: #ff4c3b;
  625. color: #fff;
  626. font-size: 10px;
  627. font-weight: 700;
  628. line-height: 16px;
  629. text-align: center;
  630. text-transform: none;
  631. display: block;
  632. box-sizing: border-box;
  633. pointer-events: none;
  634. white-space: nowrap;
  635. z-index: 1;
  636. }
  637. .bottom-panel ul li a .icon .bottom-homework-badge {
  638. right: -28px;
  639. }
  640. .bottom-panel ul li a .icon .bottom-im-badge[hidden],
  641. .bottom-panel ul li a .icon .bottom-homework-badge[hidden] {
  642. display: none !important;
  643. }
  644. </style>
  645. <script src="/public/assets/js/im-unread-badge.js"></script>
  646. <script src="/public/assets/js/homework-pending-badge.js"></script>
  647. <script>
  648. document.addEventListener("DOMContentLoaded", function() {
  649. if (typeof I18n !== 'undefined') I18n.apply();
  650. // 基础路径(/public)请确保与页面中使用的一致
  651. const basePath = "/public";
  652. // 当前页面路径(不含域名)
  653. const currentPath = window.location.pathname;
  654. // 仅选择 .bottom-panel 内的导航链接
  655. const navLinks = document.querySelectorAll(".bottom-panel ul li a");
  656. navLinks.forEach(function(link) {
  657. const href = link.getAttribute("href");
  658. // 如果链接以 basePath 开头,则取其后面的部分
  659. const relativePath = href.startsWith(basePath) ? href.substring(basePath.length) : href;
  660. // 判断当前路径中是否包含该相对路径
  661. if (currentPath.includes(relativePath)) {
  662. link.parentElement.classList.add("active");
  663. } else {
  664. link.parentElement.classList.remove("active");
  665. }
  666. });
  667. });
  668. </script>
  669. </div>
  670. <script src="https://txbj.assets.youyanen.com/student/browsers/assets/js/jquery-3.3.1.min.js"></script>
  671. <script src="https://txbj.assets.youyanen.com/student/browsers/assets/js/bootstrap.bundle.min.js"></script>
  672. <script src="https://txbj.assets.youyanen.com/student/browsers/assets/js/slick.js"></script>
  673. <script src="https://txbj.assets.youyanen.com/student/browsers/assets/js/filter.js"></script>
  674. <script src="/public/assets/js/script.js"></script>
  675. <script src="https://txbj.assets.youyanen.com/student/browsers/assets/js/sweetalert2.js"></script>
  676. <script src="/public/assets/js/i18n.js"></script>
  677. <script src="/public/assets/js/user.js"></script>
  678. <script src="/public/assets/js/customer_service.js"></script>
  679. <script src="/public/assets/js/utils.js"></script>
  680. <script src="/public/assets/js/home2_teacher.js"></script>
  681. <script>
  682. $(document).ready(function () {
  683. I18n.apply();
  684. loadHome2TeacherList();
  685. initCustomerServiceFab();
  686. });
  687. function getTeacherCountryLabel(country) {
  688. if (String(country) === '3') return I18n.t('home.country_ph');
  689. if (String(country) === '2') return I18n.t('home.country_us');
  690. if (String(country) === '1') return I18n.t('home.country_cn');
  691. return '';
  692. }
  693. function parseTeachingObjects(teacher) {
  694. try {
  695. return JSON.parse(teacher.teaching_objects || '[]');
  696. } catch (e) {
  697. return [];
  698. }
  699. }
  700. function buildTeacherThumbLabel(teacher) {
  701. var objects = parseTeachingObjects(teacher);
  702. var parts = [];
  703. for (var i = 0; i < objects.length; i++) {
  704. if (String(objects[i]) === '1') parts.push(I18n.t('home.object_kids'));
  705. if (String(objects[i]) === '2') parts.push(I18n.t('home.object_adult'));
  706. if (String(objects[i]) === '3') parts.push(I18n.t('home.object_ielts'));
  707. }
  708. if (parts.length) return parts.join(' / ');
  709. return I18n.t('home.teacher_intro');
  710. }
  711. function renderHome2TeacherCard(teacher, index) {
  712. var detailUrl = '/public/open/teacher_details.html?id=' + teacher.id;
  713. var avatarUrl = teacher.avatar
  714. ? 'https://txbj.assets.youyanen.com/' + teacher.avatar
  715. : '/public/assets/images/avatar/default.png';
  716. var thumbMedia = '<img src="' + avatarUrl + '" alt="' + teacher.nickname + '" loading="lazy">';
  717. var hotHtml = Number(teacher.level) === 2
  718. ? '<span class="home2-tr-hot">' + I18n.t('home.gold') + '</span>'
  719. : '';
  720. var cardClass = hotHtml ? 'home2-tr-card has-hot' : 'home2-tr-card';
  721. var tagsHtml = Home2TeacherEva.buildCardTagsHtml(teacher.id, teacher);
  722. return '' +
  723. '<div class="' + cardClass + '">' +
  724. hotHtml +
  725. '<a class="home2-tr-card-link" href="' + detailUrl + '" aria-label="' + I18n.t('home.view_teacher', {name: teacher.nickname}) + '"></a>' +
  726. '<div class="home2-tr-inner">' +
  727. '<div class="home2-tr-thumb">' +
  728. thumbMedia +
  729. '<span class="home2-tr-thumb-label">' + buildTeacherThumbLabel(teacher) + '</span>' +
  730. '</div>' +
  731. '<div class="home2-tr-info">' +
  732. '<div class="home2-tr-name-row">' +
  733. '<div class="home2-tr-name-main">' +
  734. '<span class="home2-tr-name">' + teacher.nickname + '</span>' +
  735. '<span class="home2-tr-loc">' + getTeacherCountryLabel(teacher.country) + '</span>' +
  736. '</div>' +
  737. Home2TeacherEva.buildTeachingSoftwareHtml(teacher) +
  738. '</div>' +
  739. tagsHtml +
  740. '<div class="home2-tr-bottom">' +
  741. '<a class="home2-tr-book-btn" href="' + detailUrl + '">' + I18n.t('home.book') + '</a>' +
  742. '</div>' +
  743. '</div>' +
  744. '</div>' +
  745. '</div>';
  746. }
  747. function loadHome2TeacherList() {
  748. user.newTeacherList(function (code, msg, data) {
  749. var $list = $('#home2_teacher_list');
  750. $list.empty();
  751. if (code !== 200 || !data || !data.data || !data.data.length) {
  752. $list.html('<div class="home2-teacher-empty">' + I18n.t('home.no_teacher') + '</div>');
  753. return;
  754. }
  755. var teachers = data.data;
  756. for (var i = 0; i < teachers.length; i++) {
  757. $list.append(renderHome2TeacherCard(teachers[i], i));
  758. }
  759. });
  760. }
  761. function loadHome2VideoClips() {
  762. var teachers = user.getTeacherList({});
  763. var $list = $('#home2_video_list');
  764. $list.empty();
  765. var clips = [];
  766. if (teachers && teachers.length) {
  767. for (var i = 0; i < teachers.length; i++) {
  768. var teacher = teachers[i];
  769. if (!teacher.course_video) continue;
  770. var videos = [];
  771. try {
  772. videos = JSON.parse(teacher.course_video);
  773. } catch (e) {
  774. continue;
  775. }
  776. for (var j = 0; j < videos.length; j++) {
  777. clips.push({
  778. teacher: teacher,
  779. video: videos[j]
  780. });
  781. if (clips.length >= 6) break;
  782. }
  783. if (clips.length >= 6) break;
  784. }
  785. }
  786. if (!clips.length) {
  787. $list.html('<div class="home2-video-empty">' + I18n.t('home.no_clips') + '</div>');
  788. return;
  789. }
  790. for (var k = 0; k < clips.length; k++) {
  791. var item = clips[k];
  792. var teacher = item.teacher;
  793. var videoUrl = 'https://txbj.assets.youyanen.com/' + item.video;
  794. var avatar = teacher.avatar
  795. ? 'https://txbj.assets.youyanen.com/' + teacher.avatar
  796. : '/public/assets/images/avatar/default.png';
  797. var cardHtml =
  798. '<a class="home2-video-card" href="/public/open/teacher_details.html?id=' + teacher.id + '">' +
  799. '<div class="home2-video-thumb">' +
  800. '<video class="home2-video-preview" muted playsinline preload="metadata" src="' + videoUrl + '"></video>' +
  801. '<div class="home2-video-play"><span><i class="fa fa-play"></i></span></div>' +
  802. '<img class="home2-video-avatar" src="' + avatar + '" alt="">' +
  803. '</div>' +
  804. '</a>';
  805. $list.append(cardHtml);
  806. }
  807. }
  808. </script>
  809. </body>
  810. </html>