<template>
  <div class="game-maintenance-container">
    <el-card shadow="hover">
      <div class="game-order-search mb15" >
        <el-form    label-position="right"
                    :model="formLabelAlign"
                    >

            <el-form-item label="类型：">
              <el-radio-group v-model="tableData.param.popType">
                <el-radio :label=1>强制退出</el-radio>
                <el-radio :label=0>普通弹窗</el-radio>
              </el-radio-group>
          </el-form-item>
          <el-form-item label="uids：">
            <el-input  v-model="tableData.param.uids" placeholder=""  class="w-50 m-2"   clearable/>
          </el-form-item>
          <el-form-item label="内容：">
            <el-input  v-model="tableData.param.content" placeholder="" type="textarea" class="w-50 m-2"  rows="5" clearable/>
          </el-form-item>
          <el-form-item>
            <el-button size="large" type="primary" class="ml10" @click="noticePop">
              弹窗公告发送
            </el-button>
          </el-form-item>
        </el-form>

      </div>

    </el-card>
  </div>


</template>

<script lang="ts">
import {toRefs, reactive, onMounted,  defineComponent, } from 'vue';
//import { ElMessageBox, ElMessage } from 'element-plus';
import {gameNoticePop} from "/@/api/game";

import {ElMessage} from "element-plus/es";


interface TableDataState {
  tableData: {
    param: {
      content:string
      timeType:number
      popType:number
      uids : string
    };

  };

}

export default defineComponent({
  name: 'apiV1GameOrderOrderList',
  setup() {
    // const {proxy} = getCurrentInstance() as any;

    const state = reactive<TableDataState>({
      tableData: {
        param: {
          content: "",
          timeType: 0,
          uids:"",
          popType:0
        },
      }

    });
    const noticePop=()=>{
      gameNoticePop(state.tableData.param).then(()=>{
        ElMessage.success('发送成功');
      }).finally(()=>{
        // state.loading = false;
      })
    }



    // function GetStateStr(s:number){
    //   if (s==2){
    //     return "成功"
    //   }
    //   return "失败(错误id="+s+")"
    // }

    // // 分页改变
    // const onHandleSizeChange = (val: number) => {
    // 	state.tableData.param.pageSize = val;
    // };
    // // 分页改变
    // const onHandleCurrentChange = (val: number) => {
    // 	state.tableData.param.pageNum = val;
    // };
    // 页面加载时
    onMounted(() => {
      //	initTableData();
    });
    return {
      noticePop,
      ...toRefs(state),
    };
  },
});
</script>
