<template>
  <div class="content">
    <div v-for="(otherAppeal, index) in otherAppealList" :key="index">
      <appealCard
        :otherAppeal="otherAppeal"
        @tap="toDetail(otherAppeal.id)"
      ></appealCard>
    </div>
  </div>
</template>
<script>
import md5 from "@/common/md5.js";	
import appealCard from "./appealCard.vue";
export default {
  components: {
    appealCard,
  },
  data() {
    return {
      otherAppealList: [
        {
          title: "航投大厦餐厅服务建议",
          state: 0,
          image: "/static/appeal/avator.png",
          msg: "正在处理中",
        },
        {
          title: "拉土车夜间噪音问题整改诉求",
          name: "市场服务与监督管理局",
          state: 1,
          msg: "尊敬的市民您好！收到您的留言，我们十分重视！正平大街开展拉土作业的车辆为西安（咸阳）机场三期扩建工程建设项目运输……",
          image: "/static/appeal/avator.png",
        },
      ],
    };
  },
  onLoad() {
  	this.getMyList();
  },
  methods: {
    toDetail(infoId) {
      uni.navigateTo({
        url: "/pages/appeal/appeal_detail?id="+infoId,
      });
    },
	getMyList(){
		  let md5Sign = md5(
			"method=" +
			  "consult" +
			  "&timestamp=" +
			  getApp().globalData.globalTimestamp +
			  "&secret=" +
			  getApp().globalData.secret
		  );
		  let url =
			getApp().globalData.shareUrl +
			"api/api.php" +
			"?method=consult&source=consult&action=my_list&timestamp=" +
			getApp().globalData.globalTimestamp +
			"&sign=" +
			md5Sign;
		  uni.request({
			url: url,
			method: "POST",
			header: {
			  "content-type": "application/x-www-form-urlencoded",
			},
			data: {
				openId:getApp().globalData.open_id,
			},
			success: (res) => {
			  console.log(res)
			  if (res.data.code === 200) {
			}
			},
			fail: () => {
			  console.log("连接失败");
			},
		  });
	}
  },
};
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100vh;
}
</style>