<template>
  <div class="webFooter">
    <div class="wrap">
      <el-row>
        <el-col :span="4" v-for="(item, index) in state.list" :key="index">
          <div class="tit">{{ item.title }}</div>
          <p v-for="(item2, index2) in item.children" :key="index2">
            <a :href="item2.link" target="_black">{{ item2.title }}</a>
          </p>
        </el-col>
        <el-col :span="8">
          <div class="tit">联系我们</div>
          <p>
            <a href="">客服电话：{{ state.mobile }}</a>
          </p>
          <p>
            <a href="">邮箱：{{ state.email }}</a>
          </p>
          <p>
            <a href="">地址：{{ state.address }}</a>
          </p>
        </el-col>
        <!-- <el-col :span="4" style="text-align: center;">
                    <div class="tit">二维码</div>
                    <p><img class="qrcode" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F01%2F39%2F53%2F71573cc4a35de96.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1643849770&t=80c12feeca42dad377bbdde1d6e78f33" alt=""></p>
                </el-col>
                <el-col :span="4" style="text-align: center;">
                    <div class="tit">二维码</div>
                    <p><img class="qrcode" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F01%2F39%2F53%2F71573cc4a35de96.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1643849770&t=80c12feeca42dad377bbdde1d6e78f33" alt=""></p>
                </el-col> -->
      </el-row>
      <div class="icp-beian">
        <el-link type="primary" href="https://beian.miit.gov.cn/"
          >皖ICP备18001784号</el-link
        >
      </div>
    </div>
  </div>
</template>

<script setup>
import request from "@/utils/request";
import { onMounted, reactive, watch } from "vue";

function navigation() {
  return request({
    url: "/v1/sys/navigation",
  });
}
function config(params) {
  return request({
    url: "/v1/config",
    params,
  });
}
const state = reactive({
  list: [],
  mobile: "",
  email: "",
  address: "",
});
function getNavigation() {
  // navigation().then((res) => {
  //   if (200 == res.code) {
  //     state.list = res.data;
  //   }
  // });
  const res = {
    code: 200,
    message: "ok",
    data: [
      {
        title: "解决方案",
        link: "/",
        is_target: false,
        children: [
          {
            title: "大型企业方服务",
            link: "/",
            is_target: false,
            children: [],
          },
          { title: "科研院所服务", link: "/", is_target: false, children: [] },
          { title: "政府区域服务", link: "/", is_target: false, children: [] },
        ],
      },
      {
        title: "创新服务",
        link: "/",
        is_target: false,
        children: [
          {
            title: "中科院设备共享平台",
            link: "http://samp.cas.cn",
            is_target: false,
            children: [],
          },
          {
            title: "中科院文献情报中心",
            link: "https://www.las.ac.cn",
            is_target: false,
            children: [],
          },
          {
            title: "中科院重庆院",
            link: "http://www.cigit.cas.cn/loading",
            is_target: false,
            children: [],
          },
          {
            title: "中国科学院",
            link: "https://www.cas.cn",
            is_target: false,
            children: [],
          },
          {
            title: "中科院重庆院合肥分院",
            link: "http://www.caszl.cn",
            is_target: false,
            children: [],
          },
        ],
      },
    ],
  };
  state.list = res.data;
}
async function getConfig() {
  // const mobileData = await config({ key: "mobile" });
  const mobileData = {
    code: 200,
    message: "ok",
    data: { mobile: { name: "联系电话", value: "18156053255" } },
  };
  state.mobile = mobileData.data.mobile.value;
  // const emailData = await config({ key: "email" });
  const emailData = {
    code: 200,
    message: "ok",
    data: { email: { name: "网站邮箱", value: "zky@gmail.com" } },
  };
  state.email = emailData.data.email.value;
  // const addressData = await config({ key: "address" });
  const addressData = {
    code: 200,
    message: "ok",
    data: {
      address: { name: "地址", value: "安徽省合肥市高新区创新产业园D1南楼" },
    },
  };
  state.address = addressData.data.address.value;

  // 无法同时传多个key

  // config({ key: "mobile,email,address" }).then((res) => {
  //   console.log(res);

  //   state.mobile = res.data.mobile.value;
  //   state.email = res.data.email.value;
  //   state.address = res.data.address.value;
  // });
}
getNavigation();
getConfig();
</script>

<style lang="scss" scoped>
.webFooter {
  background: #dee9ff;
}

.wrap {
  width: 1000px;
  margin: 0 auto;
  padding: 100px 0;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #333333;
  .tit {
    font-size: 16px;
    font-family: Source Han Sans CN;
    font-weight: 500;
    color: #333333;
  }
  .qrcode {
    width: 88px;
    height: 88px;
  }
  .icp-beian {
    text-align: center;
  }
}
</style>
