标签 原创 下的文章

JS - MUI - PopPicker - 销毁 - 大坑

最近做了个需求:用到了2个选择器,逻辑是当第一个选择器选择好后,会根据第一个选中的值来对应加载第二个选择器的值,类似于省市区的效果,但是不能使用多级选择器来展示。
因此会发现,当第一个选择器多次点击后,会生成多次第二个选择器。


解决方法:

document.getElementById('hosptialMain').addEventListener("tap",function(){
    hospitalPicker.show(function(items){
        var text = items[0].text;
        var val = items[0].value;
        document.getElementById('hospital').value = text;
        document.getElementById('hospitalVal').value = val;
        /**********MUI大坑!去掉多余的************/
        var crr = $('.mui-poppicker');
        for(var j=0;j<crr.length;j++){
            var drr = crr[j];
            if(j != 0){
                drr.remove();
            }
        }
        /******************************************/
        //执行加载第二个选择器
        initDoctor();
    });
});

PHP - 调用 webservice 接口 - php 5.4 以上

requestWsdl.php

<?php
header('content-type:text/html;charset=utf-8');
$ip = $_RESQUEST['ip'];
$function = $_REQUEST['function'];
$param = $_REQUEST['param'];
$res = new WSDL();
$res->getData($ip, $function, $param);
class WSDL{
    public function __construct(){
    }
    public function getData($ip, $function, $param = array()){
        try {
            $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl',
array('encoding' => 'UTF-8'));
            $result = $client->{$function}($param);
            $result = get_object_vars($result);
            print_r($result);
        } catch (SoapFault $exception) {
            print_r($exception);
        }
    }
    public function getFunctions($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', 
array('encoding' => 'UTF-8'));
        $functions = $client->__getFunctions();
        print_r($functions);
    }
    public function getTypes($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', array('encoding' => 'UTF-8'));
        $types = $client->__getTypes();
        print_r($types);
    }
}

阅读全文

PHP - 钉钉 - 扫码 - 获取信息

引入 js

<script type="text/javascript" src="//g.alicdn.com/dingding/open-develop/0.8.4/dingtalk.js"></script>

内部代码如下,作用是实现二维码的展现。

<script>
        !function (window, document) {
            function d(a) {
                var e, c = document.createElement("iframe"),
                    d = "https://login.dingtalk.com/login/qrcode.htm?goto=" + a.goto ;
                //console.log(d);
                    d += a.style ? "&style=" + encodeURIComponent(a.style) : "",
                    d += a.href ? "&href=" + a.href : "",
                    c.src = d,
                    c.frameBorder = "0",
                    c.allowTransparency = "true",
                    c.scrolling = "no",
                    c.width =  a.width ? a.width + 'px' : "365px",
                    c.height = a.height ? a.height + 'px' : "400px",
                    e = document.getElementById(a.id),
                    e.innerHTML = "",
                    e.appendChild(c)
            }
            window.DDLogin = d
        }(window, document);
    </script>

阅读全文

Editor - 百度编辑器

实例化编辑器

var ue = UE.getEditor('editor2', {
    toolbars: [[
        'source', '|', 'undo', 'redo', '|',
        'bold', 'italic', 'underline', '|',
        'selectall', 'cleardoc', '|',
        'fontfamily', 'fontsize', '|',
        'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
        'simpleupload', '|',
        'removeformat', '|'
    ]],
    iframeCssUrl: '../ueditor/themes/editor2.css',
    initialFrameHeight:500,
    enableAutoSave: false,
    enableContextMenu: false,
    elementPathEnabled : false,
    focus:false,
    autoHeightEnabled:false
});

阅读全文

JS - 同一界面内实例化2个编辑器

js

//实例化编辑器editor
var ue = UE.getEditor('editor');
//实例化编辑器editor2
var ue2 = UE.getEditor('editor2');
function removeformat() {
    //全选
    ue.execCommand('selectall');
    //未格式化的内容
    var content1 = ue.getContent();
    //清除格式
    ue.execCommand('removeformat');
    //格式化后的内容
    var content2 = ue.getContent();
    //过滤掉&nbsp;
    content2 = content2.replace(/&nbsp;/g, "");
    //过滤掉<p><br/></p>
    content2 = content2.replace(/<p><br\/><\/p>/g, "");
    //保留原来的内容
    ue.setContent(content1, false);
    //将内容赋予编辑器2
    ue2.setContent(content2, false);
}

阅读全文

jQuery - ajax

jQuery

$.ajax({
            url: '/数据处理页面',
            type: 'POST',
            dataType: 'json',
            data: login,
            success: function (data) {
                if (data.code == 200) {
                    window.location.href = "/验证成功后的跳转页";
                } else {
                    errorDis(data.info);//返回错误提示
                    //alert(data.info);
                    return false;
                }
            }
        })

阅读全文