/*
 * @Description: 
 * @Author: imyanglan
 * @Date: 2023-02-22 09:53:36
 * @LastEditors: imyanglan
 * @LastEditTime: 2023-02-22 14:27:34
 */
//创建测试用的按钮
export function createButton(name, left, top, right, bottom, parent) {
    let btn = document.createElement('button');
    btn.innerHTML = name;
    btn.style.position = 'absolute';
    btn.style.background = 'white';
    if (left) btn.style.left = left;
    if (right) btn.style.right = right;
    if (top) btn.style.top = top;
    if (bottom) btn.style.bottom = bottom;
    btn.style.width = '180px';
    btn.style.height = '25px';
    if (parent)
        parent.appendChild(btn)
    else
        document.body.appendChild(btn);
    return btn;
}

//创建测试用的input
export function createInput(left, top, right, bottom, parent) {
    let input = document.createElement('input');
    //btn.innerHTML = name;
    input.style.position = 'absolute';
    if (left) input.style.left = left;
    if (right) input.style.right = right;
    if (top) input.style.top = top;
    if (bottom) input.style.bottom = bottom;
    input.style.width = '100px';
    input.style.height = '25px';
    if (parent)
        parent.appendChild(input)
    else
        document.body.appendChild(input);
    return input;
}


//创建测试用的标签
export function createDivTag(name, parent = null) {
    let div = document.createElement('div');
    div.style.background = "rgba( 0, 0, 0, .7 )";
    div.style.position = 'absolute';
    div.style.left = '0px';
    div.style.top = '0px';
    div.style.pointerEvents = 'none';
    div.style.color = 'white'
    div.style.fontSize = '16px';
    div.style.fontWeight = '700'
    div.innerHTML = name;
    if (!parent) document.body.appendChild(div);
    else parent.appendChild(div);
    return div;
}

// 创建测试用新按钮
export function createNewButton(name, left, top, right, bottom, parent) {
    let btn = document.createElement('button');
    btn.innerHTML = name;
    btn.style.position = 'absolute';
    btn.style.color = '#ffffff';
    btn.style.fontWeight = '700';
    btn.style.background = 'linear-gradient(360deg,  rgba(80, 215, 133) 0%, rgba(49, 144, 183) 100%)';
    btn.style.borderImage = 'linear-gradient(314deg, rgba(192, 255, 251, 0), rgba(61, 205, 88, 1), rgba(61, 205, 88, 0)) 2 2';
    if (left) btn.style.left = left;
    if (right) btn.style.right = right;
    if (top) btn.style.top = top;
    if (bottom) btn.style.bottom = bottom;
    btn.style.width = '180px';
    btn.style.height = '30px';
    btn.style.margin = '10px';
    if (parent)
        parent.appendChild(btn)
    else
        document.body.appendChild(btn);
    return btn;
}

// 创建品牌logo
export function createBrandLogo(left, top, parent) {
    let div = document.createElement('div');
    div.style.background = "rgba( 0, 0, 0, .7 )";
    div.style.position = 'absolute';
    div.style.left = left;
    div.style.top = top;
    div.style.pointerEvents = 'none';
    div.style.background = 'url(../img/logo.png)';
    div.style.backgroundSize = 'cover';
    div.innerHTML = '';
    div.style.width = '80px';
    div.style.height = '80px';
    if (parent)
        parent.appendChild(div)
    else
        document.body.appendChild(div);
    return div;
}
