<template>
    <div class="page-cell">
        <co-header title="设备">
            <a @click="goBack()" slot="left">
                <co-button icon="back"></co-button>
            </a>
        </co-header>
        <div class="wrapper">
            <co-cell @click.native="call()" title="拨打电话"></co-cell>
            <co-cell @click.native="sms()" title="发短信"></co-cell>
            <co-cell @click.native="mail()" title="发邮件"></co-cell>
            <co-cell @click.native="screenShot()" title="截图"></co-cell>
        </div>
    </div>
</template>
<style>
</style>
<script>
  export default {
    data() {
      return {
        nativeList: []
      };
    },
    methods: {
      goBack: function() {
        history.go(-1);
      },
      // 打电话
      call: function() {
        // 入参
        let params = {
          number: '13813813800'
        };
        // 执行
        corNative.call(params);
      },
      // 发短信
      sms: function() {
        // 入参
        let params = {
          numbers: [
            '13813813800',
            '15012772690'
          ],
          content: '测试短信内容'
        };
        // 执行
        corNative.sms(params);
      },
      // 发邮件
      mail: function() {
        // 入参
        let params = {
          recipients: ['zhkj@coracle.com', 'liy@coracle.com'],
          subject: '测试邮件主题',
          content: '这里是邮件内容！！！',
          attachment: '/var/tmp/合同文件.doc'
        };
        // 执行
        corNative.mail(params);
      },
      // 截图
      screenShot: function() {
        corNative.screenShot(function(error, data) {
          if (error === 0) {
            console.log(JSON.stringify(data));
          } else {
            alert('error');
          }
        });
      }
    }
  };
</script>

