<?php

/* ========================================================================
 * $Id: index.php 1750 2020-07-07 14:35:19Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# 在线安装首页
# index
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $blocks=array();
    $blocks[]=array(
      'name'=>'阅读注册协议',
      'token'=>'agreement',
    );
    if(!defined('ONEZ_PRODUCT_PTOKEN')){
      $blocks[]=array(
        'name'=>'选择产品',
        'token'=>'product',
      );
    }
    $blocks[]=array(
      'name'=>'运行环境检测',
      'token'=>'env',
    );
    $blocks[]=array(
      'name'=>'填写数据库信息',
      'token'=>'mysql',
    );
    $blocks[]=array(
      'name'=>'设置超级管理员',
      'token'=>'admin',
    );
    $blocks[]=array(
      'name'=>'初始化数据',
      'token'=>'data',
    );
    $blocks[]=array(
      'name'=>'安装完成',
      'token'=>'done',
    );
    $step=onez()->gp('step');
    !$step && $step='agreement';
    $active=0;
    foreach($blocks as $k=>$v){
      if($v['token']==$step){
        $active=$k;
        break;
      }
    }
    $A['pagedata']['active']=$active;
    $A['pagedata']['blocks']=$blocks;
    $A['pagedata']['block']=$step;
    $A['pagedata']['ready']=true;
    $A['pagedata']['title']='佳蓝应用安装向导';
    if(defined('ONEZ_PRODUCT_TITLE')){
      $A['pagedata']['title']=ONEZ_PRODUCT_TITLE;
    }
  }
  return;
}
?>
<template v-if="$pagedata && $pagedata.ready">
<div class="head">
  <h1>{{pagedata.title}}</h1>
</div>
<div class="mainBox">
  <van-steps :active="pagedata.active" active-icon="success" active-color="#38f">
    <van-step v-for="item in $pagedata.blocks">{{item.name}}</van-step>
  </van-steps>
  <component :is="'onez-install-'+pagedata.block" @prev="prev" @next="next" />
</div>
</template>