<template>
  <div class="long-text-detail-page flex flex-col">
    <TopNavBar title="景点故事" background="#E5EFE9" />

    <div class="long-text-detail-scroll" scroll-y>
      <div class="long-text-detail-content">
        <div class="long-text-detail-card">
          <div class="long-text-detail-header">
            <div class="long-text-detail-title">小七孔古桥 · 走了三百年的石拱</div>
            <div class="long-text-detail-badge is-emerald">景点故事</div>
          </div>

          <div class="long-text-detail-body">
            <div class="detail-paragraph">
              小七孔古桥静静卧在响水河上，七个石拱挨着排开，桥身爬满青苔藤蔓。它建于清道光年间，
              <text class="detail-highlight">三百多岁</text>
              了。整个景区的名字，就是从这座桥来的。
            </div>

            <img class="detail-main-image"
              src="https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/comp2.jpg" mode="aspectFill" />

            <div class="detail-section-title">站在这儿，看什么</div>
            <div class="detail-tip-block">
              ① 桥拱与水面倒影合成完整的圆，这是古桥最经典的一眼<br />
              ② 桥身的青苔和藤蔓，是三百年时间慢慢长出来的<br />
              ③ 桥下水浅处清澈见底，能看见鹅卵石和游鱼
            </div>

            <div class="detail-paragraph">
              小七的建议：别急着走过去。先在桥侧站一会儿，古桥不是用来打卡的，是用来
              <span class="detail-highlight">慢慢看</span>
              的。光线斜下来的时候，石桥、绿水、倒影会一起把你框进画里。
            </div>

            <div class="detail-section-title">顺带一提</div>
            <div class="detail-tip-block is-warn">
              桥面是三百年的老石头，雨后偏滑，慢点走；别翻护栏到桥下浅滩，既危险也伤桥。
            </div>
          </div>

          <div class="detail-action-zone">
            <div class="detail-action-label">查看景点详情</div>
            <div class="detail-action-card is-raised" @click="showToast('跳转 H5 景点详情页：小七孔古桥')">
              <div class="poi-mini-tag">核心地标</div>
              <div class="poi-mini-body">
                <div class="poi-mini-title">小七孔古桥</div>
                <div class="poi-mini-desc">
                  清道光年间建的七孔石桥，响水河上的镇景之宝，小七孔之名由此而来，桥畔可观涵碧潭。
                </div>
                <button class="detail-solid-button" @click.stop="openMap">
                  带我去
                </button>
              </div>
            </div>

            <div class="detail-action-label">继续追问</div>
            <div class="detail-faq-wrap">
              <div v-for="question in faq" :key="question" class="detail-faq-chip" @click="sendReply(question)">
                {{ question }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import TopNavBar from "@/components/TopNavBar/index.vue";
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant";

const faq = ["古桥有什么传说", "最佳观赏时间", "旁边还有什么景点"];

const showToast = (title) => {
  uni.showToast({
    title,
    icon: "none",
  });
};

// 打开地图
const openMap = () => {
  const address = '小七孔古桥';
  const latitude = 25.248714;
  const longitude = 107.745735;

  uni.getLocation({
    type: "gcj02", //返回可以用于uni.openLocation的经纬度
    success: (res) => {
      console.log("当前经纬度", latitude, longitude);

      uni.openLocation({
        latitude: latitude,
        longitude: longitude,
        address: address,
        success: () => {
          console.log("success");
        },
      });
    },
  });
};

const sendReply = (item) => {
  uni.navigateBack();
  uni.$emit(SEND_MESSAGE_CONTENT_TEXT, item);
};

</script>

<style scoped lang="scss">
@import "./styles/detail.scss";
</style>
