<template>
  <view class="container">
    <view class="content">
      <view class='title'>温馨提示：请选择对应的院区进行挂号操作，祝您早日康复。</view>
      <view class="title">请选择您要就诊的院区</view>
      <view class="list">
        <view class="item" @click="itemClick(item)" v-for="(item, index) in pageConfig.districtList" :key="index">
          <view class="itemImg">
            <image class="img" :src="item.districImg" mode="aspectFill"></image>
          </view>
          <view class="itemTit">{{item.districtName}}</view>
          <view class="itemTit">{{item.districtAddr}}</view>
        </view>
      </view>
      <richTextModal :modalData="modalData" v-if="modalData.showModal" @cancel="modalCancel" @confirm="modalConfirm" @noData="modalNoData"></richTextModal>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import common from '@/utils/common';
import richTextModal from '@/pages/st1/components/richTextModal/richTextModal.vue';

const app = getApp();
const pageConfig = ref<any>({});
const modalData = ref<any>({});
const tipIsShow = ref(false);

onLoad((options) => {
  /**页面配置 */
  let config = common.deepCopy(app.globalData.config.pageConfiguration.hospitalDistrict_config);
  pageConfig.value = config;
  modalData.value = config.modalData;
  main();
});

const main = async () => {
  // Original main was empty
};

/**
 * 院区点击
 */
const itemClick = (item: any) => {
  app.globalData.districtId = item.districtId;
  const isSlb = uni.getStorageSync('wx_Slb');
  const path = `/${isSlb ? 'pagesSlb' : 'pagesPatient'}/st1/business/yygh/yyghDeptList/yyghDeptList`;
  common.goToUrl(path);
};

/**
 * 提示框按钮点击
 * Note: This function was in the original JS but seemingly unused in WXML.
 * Keeping it for completeness as requested.
 */
const tipChick = (e: any) => {
  tipIsShow.value = !tipIsShow.value;
  setBarTitle();
};

const setBarTitle = () => {
  // Implementation missing in original JS, assuming it sets title based on state
};

// Handlers for richTextModal events (implied by WXML)
const modalCancel = (e: any) => {
  console.log('modalCancel', e);
  // Implement close logic if needed, usually modalData.showModal = false
};

const modalConfirm = (e: any) => {
  console.log('modalConfirm', e);
};

const modalNoData = (e: any) => {
  console.log('modalNoData', e);
};
</script>

<style lang="scss" scoped>
.content {
  padding: 0 30upx;
}

.title {
  font-size: 34upx;
  font-weight: 500;
  color: rgba(0, 0, 0, 1);
  margin: 36upx 0;
  text-align: center;
}

.item {
  overflow: hidden;
  margin-bottom: 30upx;
}

.itemImg {
  height: 356upx;
  margin: 0 auto 10upx;
  overflow: hidden;
}

.itemTit {
  line-height: 50upx;
  font-size: 30upx;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: rgba(0, 0, 0, 1);
  padding: 0 30upx;
  text-align: center;
}
</style>
