Card.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. <template>
  2. <div class="track">
  3. <div class="reveal" v-show="flag">
  4. <img :src="image" alt />
  5. </div>
  6. <div class="img">
  7. <div class="img-top">
  8. <div class="icon-left"></div>
  9. <div
  10. class="student"
  11. style="color: #fff; font-size: 20px; margin-left: 5px"
  12. >
  13. 学生日常轨迹
  14. </div>
  15. <div
  16. class="iconMap"
  17. style="width:22px;height:22px;margin-left:60px;"
  18. @click="openMap"
  19. >
  20. <img
  21. src="../../assets/maps.png"
  22. style="width:22px;cursor: pointer;"
  23. alt
  24. />
  25. </div>
  26. </div>
  27. </div>
  28. <div class="card">
  29. <div class="scroll">
  30. <div class="circle">
  31. <ul v-for="(item, index) in data" :key="index">
  32. <li :class="index % 2 == 1 ? 'top' : 'bottom'">
  33. <div class="yh"></div>
  34. <div class="flag">
  35. <div class="date">
  36. <div class="dot">
  37. <div class="calendar"></div>
  38. <div class="title">{{ item.dateTime }}</div>
  39. </div>
  40. </div>
  41. <div class="txt">
  42. <div
  43. class="icon"
  44. v-if="
  45. item.name == '早餐' ||
  46. item.name == '午餐' ||
  47. item.name == '晚餐' ||
  48. item.name == '夜宵'
  49. "
  50. >
  51. <div class="iconimg">
  52. <img src="../../assets/eat.png" alt />
  53. </div>
  54. <div class="content">{{ item.name }}</div>
  55. </div>
  56. <div class="icon" v-else-if="item.name == '洗浴用水'">
  57. <div class="iconimg">
  58. <img src="../../assets/bath.png" alt />
  59. </div>
  60. <div class="content">沐浴</div>
  61. </div>
  62. <div class="icon" v-else-if="item.name == '签到'">
  63. <div class="iconimg">
  64. <img src="../../assets/sign.png" alt />
  65. </div>
  66. <div class="content">{{ item.name }}</div>
  67. </div>
  68. <div class="icon" v-else-if="item.name == '外卖'">
  69. <div class="iconimg">
  70. <img src="../../assets/takeout.png" alt />
  71. </div>
  72. <div class="content">{{ item.name }}</div>
  73. </div>
  74. <div class="icon" v-else-if="item.name == '扫码'">
  75. <div class="iconimg">
  76. <img src="../../assets/code.png" alt />
  77. </div>
  78. <div class="content">{{ item.name }}</div>
  79. </div>
  80. <div
  81. class="icon"
  82. v-else-if="item.name == '借书' || item.name == '还书'"
  83. >
  84. <div class="iconimg">
  85. <img src="../../assets/book.png" alt />
  86. </div>
  87. <div class="content">{{ item.name }}</div>
  88. </div>
  89. <div class="icon" v-else>
  90. <div
  91. class="iconImg"
  92. @mouseenter="enter(item)"
  93. @mouseleave="leave(item)"
  94. >
  95. <img :src="item.image ? item.image : ''" alt />
  96. </div>
  97. </div>
  98. <div class="location">
  99. <div class="location-top">
  100. <span>地址 :</span>
  101. <img
  102. v-if="
  103. item.name == '早餐' ||
  104. item.name == '午餐' ||
  105. item.name == '晚餐' ||
  106. item.name == '夜宵'
  107. "
  108. src="../../assets/card.png"
  109. alt
  110. />
  111. <img
  112. v-else-if="item.name == '洗浴用水'"
  113. src="../../assets/card.png"
  114. alt
  115. />
  116. <img
  117. v-else-if="item.name == '扫码'"
  118. src="../../assets/rke.png"
  119. alt
  120. />
  121. <img
  122. v-else-if="item.name == '借书' || item.name == '还书'"
  123. src="../../assets/books.png"
  124. alt
  125. />
  126. <img
  127. v-else-if="item.image"
  128. src="../../assets/camera.png"
  129. alt
  130. />
  131. </div>
  132. <div class="location-bottom">{{ item.affair }}</div>
  133. </div>
  134. <!-- <div class="loca">
  135. 地址 :<br />
  136. {{ item.affair }}
  137. </div>-->
  138. </div>
  139. </div>
  140. </li>
  141. <li></li>
  142. <li></li>
  143. <li></li>
  144. <li></li>
  145. </ul>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="img-bottom"></div>
  150. </div>
  151. </template>
  152. <script>
  153. import dayjs from "dayjs";
  154. import AMapLoader from "@amap/amap-jsapi-loader";
  155. export default {
  156. name: "Card",
  157. data() {
  158. return {
  159. data: [],
  160. image: "",
  161. flag: false,
  162. map: null,
  163. lnglats: [
  164. [113.922282, 35.332887],
  165. [113.963101, 35.318516],
  166. [113.960801, 35.306263],
  167. [113.926809, 35.301255]
  168. ]
  169. };
  170. },
  171. mounted() {
  172. // this.carGPSIP();
  173. this.getData();
  174. },
  175. methods: {
  176. carGPSIP() {
  177. var map = new AMap.Map("container", {
  178. resizeEnable: true,
  179. mapStyle: "amap://styles/normal"
  180. }); //初始化地图
  181. //信息窗口实例
  182. var infoWindow = new AMap.InfoWindow({ offset: new AMap.Pixel(0, -30) });
  183. //遍历生成多个标记点
  184. for (var i = 0, marker; i < this.lnglats.length; i++) {
  185. var marker = new AMap.Marker({
  186. position: this.lnglats[i], //不同标记点的经纬度
  187. map: map
  188. });
  189. marker.content = "我是第" + (i + 1) + "个Marker";
  190. marker.on("click", markerClick);
  191. marker.emit("click", { target: marker }); //默认初始化不出现信息窗体,打开初始化就出现信息窗体
  192. }
  193. function markerClick(e) {
  194. infoWindow.setContent(e.target.content);
  195. infoWindow.open(map, e.target.getPosition());
  196. }
  197. map.setFitView();
  198. },
  199. // 初始化地图
  200. // initMap() {
  201. // let arr = [
  202. // [117.517694, 32.414674],
  203. // [111.145623, 27.583686],
  204. // [113.474725, 30.692175],
  205. // ];
  206. // // window._AMapSecurityConfig = {
  207. // // securityJsCode: "958ba58ef78d37e0e79f0d373b414b50",
  208. // // };
  209. // AMapLoader.load({
  210. // key: " 9ebd4553cf26bbd879781e299f9c8e22", // 申请好的Web端开发者Key,首次调用 load 时必填
  211. // version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
  212. // plugins: [""], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
  213. // })
  214. // .then((AMap) => {
  215. // this.map = new AMap.Map("container", {
  216. // //设置地图容器id
  217. // // mapStyle: "amap://styles/dd5c4e6b3df2392c1ab874991beef6de",
  218. // viewMode: "3D", //是否为3D地图模式
  219. // zoom: [10, 15], //初始化地图级别
  220. // center: [117.517694, 32.41467], //初始化地图中心点位置
  221. // });
  222. // // 循环所有的标记点;
  223. // for (let i = 0; i < arr.length; i++) {
  224. // var marker = new AMap.Marker({
  225. // position: arr[i], // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
  226. // map: this.map,
  227. // content: `
  228. // <div class="my_marker">
  229. // <div class="marker" style="color:red">
  230. // ${this.winBox}所
  231. // </div>
  232. // </div>`,
  233. // offset: new AMap.Pixel(-15, -20),
  234. // });
  235. // // 将创建的点标记添加到已有的地图实例:
  236. // this.map.add([marker]);
  237. // }
  238. // //矩形
  239. // // var circle = new AMap.Circle({
  240. // // center: new AMap.LngLat("113.934497", "22.540517"), // 圆心位置
  241. // // radius: 10, //半径
  242. // // strokeColor: "#1aec1a", //线颜色
  243. // // strokeOpacity: 1, //线透明度
  244. // // strokeWeight: 1, //线粗细度
  245. // // fillColor: "#1aec1a", //填充颜色
  246. // // fillOpacity: 0.35 //填充透明度
  247. // // });
  248. // })
  249. // .catch((e) => {
  250. // console.log(e);
  251. // });
  252. // },
  253. getData() {
  254. let params = { id: sessionStorage.getItem("id") };
  255. this.API.personal
  256. .track(params)
  257. .then(res => {
  258. // console.log(res.data.length);
  259. if (res.data.length !== 0) {
  260. res.data.forEach(item => {
  261. let data = dayjs(item.dateTime).format("M.DD HH:mm:ss");
  262. item.dateTime = data;
  263. this.data = res.data;
  264. });
  265. }
  266. })
  267. .catch(error => {
  268. console.log(error);
  269. });
  270. },
  271. openMap() {
  272. this.$router.push({ path: "personal/map" });
  273. },
  274. enter(item) {
  275. // console.log(item);
  276. this.image = item.image;
  277. this.flag = true;
  278. },
  279. leave() {
  280. this.flag = false;
  281. }
  282. }
  283. };
  284. </script>
  285. <style lang="less" scoped>
  286. .track {
  287. width: 853px;
  288. height: 393px;
  289. margin: 0 auto;
  290. user-select: none;
  291. transform: translateY(55px);
  292. background: rgba(37, 53, 52, 0.5);
  293. .reveal {
  294. position: absolute;
  295. left: 1px;
  296. bottom: 400px;
  297. width: 849px;
  298. height: 478px;
  299. border: 1px solid #04eeff;
  300. z-index: 9999;
  301. // box-sizing: border-box;
  302. img {
  303. width: 849px;
  304. height: 478px;
  305. }
  306. #container {
  307. width: 100%;
  308. height: 100%;
  309. }
  310. }
  311. .img {
  312. transform: translate(12px, 11px);
  313. .img-top {
  314. width: 831px;
  315. height: 39px;
  316. background: url(../../assets/track-top.png) no-repeat;
  317. background-size: 100% 100%;
  318. display: flex;
  319. align-items: center;
  320. .icon-left {
  321. width: 26px;
  322. height: 26px;
  323. background: url(../../assets/title-left.png) no-repeat;
  324. background-size: 100%;
  325. margin-left: 22px;
  326. }
  327. }
  328. }
  329. @keyframes move {
  330. /* 开始状态 */
  331. 0% {
  332. transform: translateX(0);
  333. }
  334. 5% {
  335. transform: translateX(0);
  336. }
  337. /* 结束状态 */
  338. 95% {
  339. transform: translateX(-400px);
  340. }
  341. 100% {
  342. transform: translateX(-400px);
  343. }
  344. }
  345. .card {
  346. overflow: hidden;
  347. .scroll {
  348. width: 96%;
  349. margin: 0 auto;
  350. overflow-y: hidden;
  351. overflow-x: scroll;
  352. &::-webkit-scrollbar {
  353. display: block;
  354. /* Chrome Safari */
  355. // width: 1px;
  356. height: 8px;
  357. }
  358. &::-webkit-scrollbar-thumb {
  359. border-radius: 10px;
  360. // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  361. background: rgba(4, 238, 255, 0.5);
  362. }
  363. &::-webkit-scrollbar-track {
  364. // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  365. border-radius: 0;
  366. background: rgba(60, 108, 254, 0.1);
  367. }
  368. }
  369. .circle {
  370. height: 340px;
  371. display: flex;
  372. align-items: center;
  373. margin-left: 1px;
  374. // animation: move 16s infinite linear; // 动画
  375. ul {
  376. margin-left: 2.5px;
  377. padding: 0;
  378. display: flex;
  379. align-items: center;
  380. }
  381. li {
  382. width: 16px;
  383. height: 16px;
  384. background: rgba(4, 238, 255, 0.5);
  385. border-radius: 50%;
  386. list-style: none;
  387. margin-right: 15px;
  388. }
  389. .top {
  390. width: 20px;
  391. height: 20px;
  392. border-radius: 50%;
  393. background: rgba(4, 238, 255, 1);
  394. position: relative;
  395. .yh {
  396. position: absolute;
  397. width: 24px;
  398. height: 24px;
  399. background: transparent;
  400. border: 1px solid #04eeff;
  401. border-radius: 50%;
  402. position: absolute;
  403. top: -3px;
  404. left: -3px;
  405. }
  406. .flag {
  407. width: 155px;
  408. height: 115px;
  409. border-left: 3px solid rgba(0, 255, 255, 1);
  410. position: absolute;
  411. left: 8px;
  412. box-sizing: border-box;
  413. top: -105px;
  414. .date {
  415. width: 169px;
  416. height: 26px;
  417. background-color: rgba(0, 255, 255, 0.2);
  418. border-top-left-radius: 13px;
  419. border-bottom-left-radius: 13px;
  420. position: absolute;
  421. top: -26px;
  422. left: -14px;
  423. .dot {
  424. width: 18px;
  425. height: 18px;
  426. background-color: rgba(37, 53, 52, 0.5);
  427. border-radius: 50%;
  428. transform: translate(4px, 4px);
  429. }
  430. .calendar {
  431. width: 14px;
  432. height: 14px;
  433. background-image: url(../../assets/calendar.png);
  434. background-size: 100% 100%;
  435. position: absolute;
  436. left: 25px;
  437. top: 2px;
  438. }
  439. .title {
  440. color: #fff;
  441. position: absolute;
  442. font-size: 16px;
  443. white-space: nowrap;
  444. left: 45px;
  445. top: -1px;
  446. }
  447. }
  448. .txt {
  449. background: rgba(0, 255, 255, 0.2);
  450. width: 155px;
  451. height: 75px;
  452. font-weight: 400;
  453. color: #ffffff;
  454. position: absolute;
  455. display: flex;
  456. font-size: 12px;
  457. top: 4px;
  458. .icon {
  459. width: 42px;
  460. height: 57px;
  461. border-radius: 2px;
  462. margin: 8px;
  463. .iconimg {
  464. width: 100%;
  465. height: 36px;
  466. background-color: rgba(0, 255, 255, 0.2);
  467. display: flex;
  468. justify-content: center;
  469. align-items: center;
  470. img {
  471. width: 26px;
  472. height: 26px;
  473. // margin: 6px 0 0 10px;
  474. }
  475. }
  476. .iconImg {
  477. width: 100%;
  478. height: 100%;
  479. background-color: rgba(0, 255, 255, 0.2);
  480. img {
  481. width: 42px;
  482. height: 57px;
  483. // &:hover {
  484. // position: absolute;
  485. // width: 400px;
  486. // height: 300px;
  487. // z-index: 9999;
  488. // }
  489. // margin: 6px 0 0 10px;
  490. }
  491. }
  492. .content {
  493. height: 21px;
  494. background-color: rgba(6, 228, 243, 1);
  495. text-align: center;
  496. color: #000;
  497. line-height: 21px;
  498. }
  499. }
  500. .location {
  501. margin: 8px;
  502. width: 88px;
  503. .location-top {
  504. display: flex;
  505. justify-content: space-between;
  506. align-items: center;
  507. img {
  508. width: 22px;
  509. height: 22px;
  510. }
  511. }
  512. .location-bottom {
  513. margin: 6px 0 0 0;
  514. vertical-align: middle;
  515. text-overflow: -o-ellipsis-lastline;
  516. overflow: hidden;
  517. text-overflow: ellipsis;
  518. display: -webkit-box;
  519. -webkit-line-clamp: 2;
  520. -webkit-box-orient: vertical;
  521. }
  522. }
  523. .loca {
  524. width: 155px;
  525. height: 75px;
  526. font-size: 14px;
  527. padding: 5px;
  528. color: transparent;
  529. box-sizing: border-box;
  530. position: absolute;
  531. left: 0;
  532. z-index: 9999;
  533. &:hover {
  534. background-color: rgba(0, 0, 0, 0.8);
  535. color: #fff;
  536. }
  537. }
  538. // span {
  539. // width: 90%;
  540. // margin: 0 auto;
  541. // vertical-align: middle;
  542. // font-size: 16px;
  543. // text-overflow: -o-ellipsis-lastline;
  544. // overflow: hidden;
  545. // text-overflow: ellipsis;
  546. // display: -webkit-box;
  547. // -webkit-line-clamp: 2;
  548. // -webkit-box-orient: vertical;
  549. // }
  550. }
  551. }
  552. }
  553. .bottom {
  554. width: 20px;
  555. height: 20px;
  556. border-radius: 50%;
  557. transform: translateY(2px);
  558. background: rgba(4, 238, 255, 1);
  559. position: relative;
  560. .yh {
  561. position: absolute;
  562. width: 24px;
  563. height: 24px;
  564. background: transparent;
  565. border: 1px solid #04eeff;
  566. border-radius: 50%;
  567. position: absolute;
  568. top: -3px;
  569. left: -3px;
  570. // transform: translate(-50%, -50%);
  571. }
  572. .flag {
  573. width: 155px;
  574. height: 115px;
  575. border-left: 3px solid rgba(0, 255, 255, 1);
  576. position: absolute;
  577. left: 50%;
  578. box-sizing: border-box;
  579. top: 50%;
  580. .date {
  581. width: 169px;
  582. height: 26px;
  583. background-color: rgba(0, 255, 255, 0.2);
  584. border-top-left-radius: 13px;
  585. border-bottom-left-radius: 13px;
  586. position: absolute;
  587. bottom: -26px;
  588. left: -14px;
  589. .dot {
  590. width: 18px;
  591. height: 18px;
  592. background-color: rgba(37, 53, 52, 0.5);
  593. border-radius: 50%;
  594. transform: translate(4px, 4px);
  595. }
  596. .calendar {
  597. width: 14px;
  598. height: 14px;
  599. background-image: url(../../assets/calendar.png);
  600. background-size: 100% 100%;
  601. position: absolute;
  602. left: 25px;
  603. top: 2px;
  604. }
  605. .title {
  606. color: #fff;
  607. position: absolute;
  608. font-size: 16px;
  609. white-space: nowrap;
  610. left: 45px;
  611. top: -2px;
  612. }
  613. }
  614. .txt {
  615. background: rgba(0, 255, 255, 0.2);
  616. width: 155px;
  617. height: 75px;
  618. font-weight: 400;
  619. color: #ffffff;
  620. position: absolute;
  621. display: flex;
  622. top: -8px;
  623. transform: translateY(44px);
  624. font-size: 12px;
  625. .icon {
  626. width: 42px;
  627. height: 57px;
  628. border-radius: 2px;
  629. margin: 8px;
  630. .iconimg {
  631. width: 100%;
  632. height: 36px;
  633. background-color: rgba(0, 255, 255, 0.2);
  634. display: flex;
  635. justify-content: center;
  636. align-items: center;
  637. img {
  638. width: 26px;
  639. height: 26px;
  640. // margin: 6px 0 0 10px;
  641. }
  642. }
  643. .iconImg {
  644. width: 100%;
  645. height: 100%;
  646. background-color: rgba(0, 255, 255, 0.2);
  647. img {
  648. width: 42px;
  649. height: 57px;
  650. // margin: 6px 0 0 10px;
  651. }
  652. }
  653. .content {
  654. height: 21px;
  655. background-color: rgba(6, 228, 243, 1);
  656. text-align: center;
  657. color: #000;
  658. line-height: 21px;
  659. }
  660. }
  661. .location {
  662. margin: 8px;
  663. width: 88px;
  664. .location-top {
  665. display: flex;
  666. justify-content: space-between;
  667. align-items: center;
  668. img {
  669. width: 22px;
  670. height: 22px;
  671. }
  672. }
  673. .location-bottom {
  674. margin: 6px 0 0 0;
  675. overflow: hidden;
  676. // text-overflow: ellipsis;
  677. display: -webkit-box;
  678. -webkit-line-clamp: 2;
  679. -webkit-box-orient: vertical;
  680. }
  681. }
  682. .loca {
  683. width: 155px;
  684. height: 75px;
  685. font-size: 14px;
  686. padding: 5px;
  687. color: transparent;
  688. box-sizing: border-box;
  689. position: absolute;
  690. left: 0;
  691. z-index: 9999;
  692. &:hover {
  693. background-color: rgba(0, 0, 0, 0.8);
  694. color: #fff;
  695. }
  696. }
  697. // span {
  698. // width: 90%;
  699. // margin: 0 auto;
  700. // vertical-align: middle;
  701. // font-size: 16px;
  702. // text-overflow: -o-ellipsis-lastline;
  703. // overflow: hidden;
  704. // text-overflow: ellipsis;
  705. // display: -webkit-box;
  706. // -webkit-line-clamp: 2;
  707. // -webkit-box-orient: vertical;
  708. // }
  709. }
  710. }
  711. }
  712. }
  713. .circle:hover {
  714. animation-play-state: paused;
  715. }
  716. }
  717. .img-bottom {
  718. width: 820px;
  719. height: 1px;
  720. background: url(../../assets/track-bottom.png) no-repeat;
  721. background-size: 100% 100%;
  722. position: absolute;
  723. left: 17px;
  724. // border-bottom: 1px solid #58a2a8;
  725. top: 370px;
  726. }
  727. }
  728. </style>