canvas.html 6.8 KB
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->

<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,viewport-fit=cover">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta charset="utf-8">
    <title>项目审核</title>
    <link rel="stylesheet" href="http://i.gtimg.cn/vipstyle/frozenui/2.0.0/css/frozen.css">

    <style>
        [v-cloak] {
            display: none;
        }

        canvas{
            width: 100vh;
        }

        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            text-align: center;
            background-color: #FFFFFF;
        }

        canvas {
            max-width: 100%;
            border: 2px dotted #ccc;
        }

        .opinion {
            width: 100%;
            height: 235px;
            font-size: 16px;
            border: 1px solid #000;
        }

        .opinion::-webkit-input-placeholder {
            line-height: 235px;
            text-align: center;
        }

        /* 使用webkit内核的浏览器 */
        .opinion:-moz-placeholder {
            line-height: 235px;
            text-align: center;
        }

        /* Firefox版本4-18 */
        .opinion::-moz-placeholder {
            line-height: 235px;
            text-align: center;
        }

        /* Firefox版本19+ */
        .opinion:-ms-input-placeholder {
            line-height: 235px;
            text-align: center;
        }

        /*elmeentui文本   textarea字体*/
        .is-disabled .el-input__inner {
            font-weight: bold !important;
            font-size: 14px !important;
            color: #4A5560 !important;
        }
        .is-disabled .el-textarea__inner {
            font-weight: bold !important;
            font-size: 14px !important;
            color: #4A5560 !important;
        }
        .el-form-item__label {
            color: black !important;
            font-weight: bold !important;
        }
    </style>

</head>
<body>
<script src="__CDN__/assets/js/jquery-3.4.1.min.js"></script>
<script src="/assets/js/index.js"></script>
<script src="/assets/ele/vue.js"></script>

<link rel="stylesheet" href="__CDN__/assets/ele/element/element.css">
<script src="__CDN__/assets/ele/element/element.js"></script>
<script src="__CDN__/assets/ele/Sortable.min.js"></script>
<script src="__CDN__/assets/ele/vuedraggable.js"></script>
<script src="__CDN__/assets/ele/moment.js"></script>

<div id="app">

    <input type="hidden" name="id" id="id" value="{$id}">
    <div v-if="step==1" style="padding:0 15px;margin-top: 25px;">
        <el-form size="mini">
            <div>
                <el-form-item label="审核状态">
                    <div>
                        <el-radio v-model="v_status" label="1" border>通过</el-radio>
                        <el-radio v-model="v_status" label="2" border>退回</el-radio>
                    </div>
                </el-form-item>
            </div>
            <div>
                <el-form-item label="审核意见">
                    <el-input type="textarea" rows="8" v-model="option"></el-input>
                </el-form-item>
            </div>
        </el-form>
        <button @click="draw" class="ui-btn-lg ui-btn-primary">确认</button>
    </div>

    <div v-if="step==3" class="buttons" style="position: absolute;left:15px;bottom:100px;">
        <button type="button" style="width:40px;height:130px;background-color:#C2C7CC;" @click="clear" class="ui-btn clear">重签</button>
        <button type="button" @click="toDetail" style="width:40px;height:130px;margin-top:8px" class="ui-btn ui-btn-primary ouput back">项目详情</button>
        <button type="button" @click="pass" style="width:40px;height:130px;margin-top:10px" class="ui-btn ui-btn-primary ouput pass">确认签名</button>
    </div>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            step: 1,
            sign : null,
            id : "{$id}",
            option:'',
            v_status:'1',
        },
        mounted(){
            var _this = this;

        },
        methods:{
            clear:function(){
                this.sign.clear();
            },
            draw :function(){
                this.step = 3;
                //初始化
                this.sign =  sign = new Draw({
                    lineWidth: 10, // 线条宽度
                    width: 400, // canvas 宽
                    height: window.screen.height, //canvas 高
                    strokeStyle: '#333333' // 线条颜色
                });
            },
            toDetail(){
                var _this = this;
                _this.sign.destroyed();
                $('canvas').remove();
                window.location.href = '/teacher/container/container_detail/detail_view?id=' + _this.id;
            },
            pass:function(){
                var img = new Image();
                img.style.width = '200px';
                img.src = this.sign.ouput();
                this.sureWriteCallback(this.sign.ouput(), 1);
            },
            sureWriteCallback:function(imageBase64, type) {
                // 签名完成后的的逻辑代码

                if(this.sign.state.undopath.length <= 0){
                    alert("还没有签名");
                    return false;
                }
                var _this = this;
                $.ajax({
                    type: "POST", //提交方式
                    url: "canvas", //路径
                    data: {
                        "imgbase64": imageBase64,
                        'type': _this.v_status,
                        'id': _this.id,
                        'opinion': _this.option,
                        'status':_this.v_status
                    }, //数据,这里使用的是Json格式进行传输
                    success: function(data) {
                        alert(data.msg)
                        window.location.href = '/teacher/container/container_detail/detail_view?id=' + _this.id;
                    },
                    error: function(data) {
                        alert(data.msg)
                    }
                })

            }
        }
    })

</script>

</body>

</html>