index.vue 2.7 KB
<template>
  <div class="client-index-page">
    <div class="cloud-bg" />
    <!-- TAG: animate 动画 -->
    <!-- <transition name="fade" enter-active-class="animated animate__swing" leave-active-class="animated animate__swing">
      <van-icon v-if="show" :name="icon_subscribed" size="5rem" style="position: absolute; top: 50%;" />
    </transition> -->
  </div>
  <div class="entry-wrapper">
    <div class="control">
      <div class="plain">
        <my-button type="custom" :custom-style="styleObject1" @on-click="goVisit">访客</my-button>
      </div>
      <div class="primary">
        <my-button type="custom" :custom-style="styleObject2" @on-click="goSchool">选择我的幼儿园</my-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import Cookies from 'js-cookie'
import 'animate.css';
import MyButton from '@/components/MyButton/index.vue'
import { onMounted } from 'vue'
import { useGo, useReplace } from '@/hooks/useGo'
// 自定义按钮颜色样式
import { styleObject1, styleObject2 } from '@/settings/designSetting.js'
import { addPages } from '@/hooks/useKeepAlive'

const go = useGo();
const replace = useReplace();

// TAG: keepAlive 缓存页面
addPages();

onMounted(() => {
  // 判断微信授权状态,进入页面时未授权需要授权跳转
  if (!Cookies.get('PHPSESSID')) {
    replace('/auth', { href: location.hash, prefixAPI: 'c' })
  }
  // 进入项目自动打开导航栏 微信浏览器 避免样式错位
  window.history.pushState({}, "title", "#")
})

const goVisit = () => { // 跳转爱心书籍页面
  go('/client/chooseBook')
  Cookies.set('userType', 'visitor'); // 访客标识
}
const goSchool = () => { // 跳转选择幼儿园页面
  go('/client/chooseSchool')
  Cookies.set('userType', 'client'); // 客户标识
}

// TEMP:临时测试动画效果
// const show = ref(true);
// const interval = setInterval(() => { // 图标动画效果
//   show.value = !show.value
// }, 1000);
// onBeforeRouteLeave(() => {
//   clearInterval(interval); // 清除调用
// })
</script>

<style lang="less" scoped>
.client-index-page {
  // 背景图 宽度100% 高度控制
  // background-image: url('@images/shouyedongtu.gif');
  background-image: url('http://gyzs.onwall.cn/shouyedongtu.gif');
  background-repeat: no-repeat;
  .width100();
  height: 100vh;
  background-size: 100% 85%;
  position: relative;
}

.entry-wrapper {
  position: absolute;
  bottom: 1rem;
  .width100();

  .text {
    color: #B8B8B8;
    margin: 1rem;
    margin-bottom: 0;
  }

  .control {
    margin: 1rem;
    margin-top: 0.5rem;
    overflow: auto;

    .plain {
      width: 28%;
      float: left;
      margin-right: 3%;
    }

    .primary {
      width: 69%;
      float: left;
    }
  }
}
</style>