

<template>
    <div></div>
</template>

<script>

import dayjs from '~/plugins/day';
var setting = {};

export default {
    init(Vue){
        if(Vue.copy && Vue.extend) return;
        //转换金币倍数
        Vue.prototype.tranGold = function(gold=0){
            try{
                var bet = this.$store.state.envCfg.goldBet || 1;
                if(isNaN(gold) || bet==1) return gold;
                var newgold = (gold * bet).toFixed(4)*1;
                if(isNaN(newgold)){
                    return gold
                }else{
                    return newgold
                }
            }catch(ex){
                console.info(`tranGold金币倍数转换错误 参数:${gold} 异常:${ex.message}`)
            }
            return gold;
        }
        //还原金币倍数
        Vue.prototype.reTranGold = function(gold=0){
            try{
                var bet = this.$store.state.envCfg.goldBet || 1;
                if(isNaN(gold) || bet==1) return gold;
                var newgold =(gold / bet).toFixed(4)*1;
                if(isNaN(newgold)){
                    return gold
                }else{
                    return newgold
                }
            }catch(ex){
                console.info(`reTranGold金币倍数转换错误 参数:${gold} 异常:${ex.message}`)
            }
            return gold;
        }
        Vue.prototype.getSetting = function(){
            var param = {};
            var cb;
            for(var i=0;i<arguments.length;i++){
                if(i==arguments.length-1){
                    cb = arguments[i]
                }else{
                    switch(i){
                        case 0: param.groupKey = arguments[i];break;
                        case 1: param.keyName = arguments[i];break;
                        case 2: param.key1 = arguments[i];break;
                        case 3: param.key2 = arguments[i];break;
                        case 4: param.remark = arguments[i];break;
                    }
                }
            }
          this.$axios.post(`${this.$config.api}/sys/fjtxSysSetting/getFjtxSysSetting`,param)
          .then((res) => {
              if (res.data.code == 200) {
                  if(cb){
                      cb(res.data.data);
                  }
              }else {
                  console.log("commonutil Vue.prototype.getSetting error: "+res.data.message)
                  if(cb){
                      cb([]);
                  }
              }
          })
        }
        Vue.prototype.saveSetting = function(obj,cb){
          this.$axios.post(`${this.$config.api}/sys/fjtxSysSetting/setFjtxSysSetting`,obj)
          .then((res) => {
              if (res.data.code == 200) {
                  if(cb){
                      cb(res.data.data);
                  }else{
                    this.$message.success("提交成功");
                  }
              }else {
                  this.$message.error(res.data.message);
              }
          })
        }
        Vue.prototype.tranCfgItem = function(dict,list){
            dict.cfgMap = dict.cfgMap || {};
            try{
                list.map(item=>{
                    var desc = [];
                    switch(item.keyName){
                        case "busi_integralRate" :
                        let arr = item.content.split(",");
                        desc.push("钥匙换算金币比率,");
                        arr.map(subitem=>{
                            let subarr = subitem.split(":");
                            if(subarr[0]=="0"){
                                desc.push("初始值为:")
                            }else{
                                desc.push(subarr[0]+"之后为:")
                            }
                            desc.push(subarr[1]+";\n");
                        })
                        break;
                        default :
                            desc.push(item.content);
                    }
                    dict.cfgMap[item.keyName] = desc.join("");
                })
                
                if(dict.cfgMap.busi_coin_multiple){
                    if(dict.cfgMap.busi_coin_multiple!=this.$store.state.envCfg.goldBet){
                        this.$message.error(`金币倍率前后端配置不一致,后端: ${dict.cfgMap.busi_coin_multiple},前端: ${this.$store.state.envCfg.goldBet}`);
                    }
                }

                //支付费率
                dict.cfgMap.busi_pay_rate_default =  dict.cfgMap.busi_pay_rate_default || 0.01;
                dict.cfgMap.busi_pay_rate_default_ = 1-dict.cfgMap.busi_pay_rate_default;
                
            }catch(ex){
                console.log("Vue.prototype.tranCfgItem error: " + ex.message)
                console.log(ex);
            }
        }
        Vue.prototype.getCfgItem = function(key,def){
            def = def || "";
            try{
                return this.$dict.cfgMap[key] || def;
            }catch(ex){
            }
            return def;
        }
        Vue.prototype.isEnv = function(envlist){
            var envFlag = this.$store.state.envCfg.envFlag;
            if(typeof(envlist) === "string"){
                envlist = envlist.split(",")
            }
            if(!envlist.find((item)=> item==envFlag )){
                return false;
            }
            return true;
        }
        Vue.prototype.copy = (cont)=>{
            var copyText=document.getElementById("public_copy_teatarea");
            if(!copyText) return;
            copyText.value=cont;
            copyText.select();
            copyText.setSelectionRange(0, copyText.value.length);
            document.execCommand("copy");
        }
        Vue.prototype.extend = function () {
            var length = arguments.length
            var target = arguments[0] || {}
            if (typeof target !== 'object' && typeof target !== 'function') {
                target = {}
            }
            var i = 1
            if (length === 1) {
                target = this
                i--
            }
            for (i; i < length; i++) {
                var source = arguments[i]
                for (var key in source) {
                    // 使用for in会遍历数组所有的可枚举属性，包括原型。
                    if (Object.prototype.hasOwnProperty.call(source, key)) {
                        target[key] = source[key]
                    }
                }
            }
            return target
        }
        
        Vue.prototype.objToUrl = (obj)=>{
            var args = "&";
            for (var key in obj) {
                // 使用for in会遍历数组所有的可枚举属性，包括原型。
                if (Object.prototype.hasOwnProperty.call(obj, key)) {
                    args += key+"="+obj[key]+"&"
                }
            }
            return args;
        }
        Vue.prototype.urlToObj = (url)=>{
            var args = {};
            if(!url) return args;
            var pos = url.indexOf("?");
            if(pos!=-1){
                var simpleurl = url.substring(0,pos)
                url = url.substring(pos+1,url.length)
                var arr = url.split("&");
                arr.map(param=>{
                    var arr2 = param.split("=");
                    args[arr2[0]]=arr2[1]
                })
                return {url:simpleurl,urlparam:args};
            }else{
                return {url:url,urlparam:null}
            }
        }
        
        Vue.prototype.download = (url)=>{
            var frameel=document.getElementById("public_download_iframe");
            frameel.src=url;
        }
        
        Vue.prototype.getMaxDialogHeight = (cont)=>{
            var clientheight = document.documentElement.clientHeight;
            return (clientheight - 300)+"px";
        }
        
        
        Vue.prototype.getTableHeight = (tableEl,diff)=>{
            if(!diff && diff!==0) diff=10;
            var height = 0;
            var clientheight = document.documentElement.clientHeight;
            var tabletop = tableEl.getBoundingClientRect().top;
            if(tabletop<10) height= clientheight;
            else height = clientheight - tabletop -diff;
            if(height<300) height = 300;
            return height;
        }
        
        Vue.prototype.moneyFormat = (value)=>{
            var val = moneyformat(value);
            return val*1;
        }
        Vue.prototype.moneyFixed = (value,unit)=>{
            var val = moneyFixed(value,unit);
            return val;
        }
        Vue.prototype.moneyFixedFormat = (row,col,val,idx)=>{
            var val = moneyFixed(val,"");
            return val;
        }
        
        var moneyformat = (value)=>{
            if(isNaN(value)){
                return value;
            }
            var money = value.toFixed(1);
            money = (money+"").replace(".0","")
            return money
        }
        var moneyFixed = (value,defUnit)=>{
            if(isNaN(value)){
                return value;
            }
            var money = value;
            var unit = "元";
            if(defUnit || defUnit===""){
                unit = defUnit;
            }
            var absmoney = Math.abs(money)
            if(absmoney>=1000000000000){
                money = money/1000000000000;
                unit = "万亿";
            }else if(absmoney>=100000000){
                money = money/100000000;
                unit = "亿";
            }else if(absmoney>=10000){
                money = money/10000;
                unit = "万";
            }
            money = money.toFixed(1);
            money = (money+"").replace(".0","")
            return money+unit;
        }

        
        Vue.filter('moneyFormat', function(value) {
            return moneyformat(value)
        })
        Vue.filter('moneyFixed', function(value) {
            return moneyFixed(value)
        })
        Vue.filter('fenToYuan', function(value) {
            return fenToYuan(value)
        })
        Vue.filter('yuanToFen', function(value) {
            return yuanToFen(value)
        })
        Vue.filter('fenToYuanFormat', function(value) {
            return bigMoneyFormat(fenToYuan(value))
        })
        Vue.filter('yuanToFenFormat', function(value) {
            return bigMoneyFormat(yuanToFen(value))
        })

        
        
        var fenToYuan = (value,fixlen=2)=>{
            if(isNaN(value)){
                return value;
            }
            var money = (value/100).toFixed(fixlen);
            return money*1;
        }
        Vue.prototype.wanToYuan=(val,var2,val3)=>{
            if(!isNaN(val)){
                return fenToYuan(val/100)
            }
            return fenToYuan(val3/100)
        }
        Vue.prototype.wanToYuanFormat=(val,var2,val3)=>{
            if(!isNaN(val)){
                return bigMoneyFormat(fenToYuan(val/100))
            }
            return bigMoneyFormat(fenToYuan(val3/100))
        }
        Vue.prototype.fenToYuan=(val,var2,val3)=>{
            if(!isNaN(val)){
                return fenToYuan(val)
            }
            return fenToYuan(val3)
        }
        Vue.prototype.fenToYuanFormat=(val,var2,val3)=>{
            if(!isNaN(val)){
                return bigMoneyFormat(fenToYuan(val))
            }
            return bigMoneyFormat(fenToYuan(val3))
        }
        Vue.prototype.fenToYuanFormat0=(val,var2,val3)=>{
            if(!isNaN(val)){
                return bigMoneyFormat(fenToYuan(val,0))
            }
            return bigMoneyFormat(fenToYuan(val3,0))
        }
        
        var yuanToFen = (value)=>{
            if(isNaN(value)){
                return value;
            }
            var money = (value*100).toFixed(0);
            return money*1;
        }
        Vue.prototype.yuanToFen=(val,var2,val3)=>{
            if(!isNaN(val)){
                return yuanToFen(val)
            }
            return yuanToFen(val3)
        }

        var defBigMoneyFormatLen = 4;
        if(Vue.prototype && Vue.prototype.globalLyExFnCfg && Vue.prototype.globalLyExFnCfg.fnCfg && Vue.prototype.globalLyExFnCfg.fnCfg.bigMoneyFormatLen){
            defBigMoneyFormatLen = Vue.prototype.globalLyExFnCfg.fnCfg.bigMoneyFormatLen;
        }
        
        var bigMoneyFormat=function(money,len){
            if(!len){
                len = defBigMoneyFormatLen;
            }
            money = money+"";
            var v, j, sj, rv = "";
            v = money.split(".");
            j = v[0].length % len;
            sj = v[0].substr(j).toString();
            for (var i = 0; i < sj.length; i++)
            {
              rv = (i % len == 0) ? rv + "," + sj.substr(i, 1): rv + sj.substr(i, 1);
            }
            var rvalue = (v[1] == undefined) ? v[0].substr(0, j) + rv: v[0].substr(0, j) + rv + "." + v[1];
            rvalue = rvalue.replace("-,","-");
            if (rvalue.charCodeAt(0) == 44)
            {
              rvalue = rvalue.substr(1);
            }
            return rvalue;
        }
        
        Vue.filter('bigMoneyFormat', function(money) {
            if(money==undefined) return "";
            return bigMoneyFormat(money)
        })

        var bigMoneyFixFormat = function(val,var2,val3){
            // 从表格的formatter里直接穿过来的参数在第三个
            if(!isNaN(val3)){
                val3 = numberFixFormat(val3,2);
                return bigMoneyFormat(val3);
            }else if(!isNaN(val)){
                val = numberFixFormat(val,2);
                return bigMoneyFormat(val);
            }
        }

        var floatFormat = function(val,len=2){
            if(!val) return val;
            val+="";

            var tmparr = val.split(".");
            var pointlen = 0;
            if(tmparr.length==1){
                if(len>0) val+=".";
            }else{
                pointlen = tmparr[1].length;
            }
            pointlen = len - pointlen;
            switch(pointlen){
                case 1: val+="0"; break;
                case 2: val+="00"; break;
                case 3: val+="000"; break;
                case 4: val+="0000"; break;
            }
            return val;
        }
        
        Vue.prototype.bigMoneyFixFormat_=(val,val2,val3)=>{
            var show = bigMoneyFixFormat(val,val2,val3)
            return floatFormat(show);
        }
        
        Vue.prototype.bigMoneyFixFormat=(val,val2,val3)=>{
            return bigMoneyFixFormat(val,val2,val3)
        }
        Vue.prototype.bigMoneyFixFormat0=(val,var2,val3)=>{
            // 从表格的formatter里直接穿过来的参数在第三个
            if(!isNaN(val3)){
                val3 = numberFixFormat(val3,0);
                return bigMoneyFormat(val3);
            }else if(!isNaN(val)){
                val = numberFixFormat(val,0);
                return bigMoneyFormat(val);
            }
        }
        Vue.prototype.bigMoneyFixFormat4=(val,var2,val3)=>{
            // 从表格的formatter里直接穿过来的参数在第三个
            if(!isNaN(val3)){
                val3 = numberFixFormat(val3,4);
                return bigMoneyFormat(val3);
            }else if(!isNaN(val)){
                val = numberFixFormat(val,4);
                return bigMoneyFormat(val);
            }
        }
        Vue.prototype.bigMoneyFormatWithRate=(row,column,val3)=>{
            // 从表格的formatter里直接穿过来的参数在第三个
            if(!isNaN(val3)){
                var value = bigMoneyFormat(val3);
                if(val3 && column && column.label) value += rateFormatWithWraper(val3,row[column.columnKey],1);
                return value;
            }
        }
        
        Vue.prototype.bigMoneyFormat=(val,fixlen,val3)=>{
            // 从表格的formatter里直接穿过来的参数在第三个
            if(!isNaN(val3)){
                return bigMoneyFormat(val3);
            }
            if(isNaN(val)){
                if(typeof(val)=="object") return "";
                return val;
            }else{
                if(!isNaN(fixlen)){
                    val = numberFixFormat(val,fixlen);
                }
                return bigMoneyFormat(val);
            }
        }
        Vue.prototype.bigMoneyFormatFen=(val,fixlen,val3)=>{
            if(!isNaN(val3)){
                val3 = val3/100
                if(isNaN(fixlen) && (val3+"").indexOf(".")!=-1){
                    val3 = numberFixFormat(val3,2);
                }
                return bigMoneyFormat(val3);
            }
            if(isNaN(val)){
                return val;
            }else{
                val = val/100
                if(!isNaN(fixlen)){
                    val = numberFixFormat(val,fixlen);
                }
                return bigMoneyFormat(val);
            }
        }
        var numberFixFormat = function(money,len){
            if(isNaN(money) || money === ""){
                return money;
            }else{
                if(!len && len!==0) len =2;
                try {
                    return (money*1).toFixed(len)*1;
                }catch(ex){
                    console.info("Number format exception : "+ money)
                }
            }
        }
        Vue.filter('fixed', function(money) {
            return numberFixFormat(money,0)
        })
        Vue.filter('fixed1', function(money) {
            return numberFixFormat(money,1)
        })
        Vue.filter('fixed2', function(money) {
            return numberFixFormat(money,2)
        })
        Vue.prototype.fixed=(val,len)=>{
            return numberFixFormat(val,len)
        }
        Vue.prototype.fixed0=(row, column, cellValue, index)=>{
            return numberFixFormat(cellValue,0)
        }
        Vue.prototype.fixed1=(row, column, cellValue, index)=>{
            return numberFixFormat(cellValue,1)
        }
        Vue.prototype.fixed2=(row, column, cellValue, index)=>{
            return numberFixFormat(cellValue,2)
        }
        
        var numberRateFormat = function(a,len,nosign){
            var sign = "";
            if(!nosign) sign = "%";
            if(a===0){
                return "0" +sign;
            }else if(isNaN(a) || a===""){
                return a;
            }else{
                if(!len && len!==0) len =2;
                try {
                    const res = (a*1).toFixed(len);
                    if (res > 100000 && !nosign) {
                        return "999999.99%";
                    }
                    return res +sign;
                }catch(ex){
                    console.info("Number format exception : "+ a +"  "+ex.message)
                    return "";
                }
            }
        }
        var rateCount=function(a,b,baseNum,len){
            if(a===0){
                return 0;
            }else if(b===0){
                return "";
            }else if(isNaN(a) || isNaN(b)){
                return "";
            }
            if(!baseNum && baseNum!==0) baseNum =100;
            var val = a*baseNum/b;
            if(!isNaN(len)){
                val = val.toFixed(len)*1;
            }
            return val;
        }
        Vue.prototype.rateCount=(a,b,baseNum,len)=>{
            return rateCount(a,b,baseNum,len)
        }
        Vue.prototype.rateFormat=(a,b,len,baseNum,isAbs)=>{
            var rate = rateCount(a,b,baseNum);
            if(isAbs) rate= Math.abs(rate);
            return numberRateFormat(rate,len)
        }
        var rateFormatWithWraper = function(a,b,len,baseNum){
            if(!b) return " (0%)";
            var rate = rateCount(a,b,baseNum);
            return " ("+numberRateFormat(rate,len)+")";
        }
        Vue.prototype.rateFormatWithWraper=(a,b,len,baseNum)=>{
            return rateFormatWithWraper(a,b,len,baseNum);
        }
        Vue.prototype.rateFormat0=(row, column, cellValue, index)=>{
            return numberRateFormat(cellValue,0)
        }
        Vue.prototype.rateFormat1=(row, column, cellValue, index)=>{
            return numberRateFormat(cellValue,1)
        }
        Vue.prototype.rateFormat2=(row, column, cellValue, index)=>{
            return numberRateFormat(cellValue,2)
        }
        Vue.prototype.rateFormat3=(row, column, cellValue, index)=>{
            return numberRateFormat(cellValue,3)
        }
        Vue.prototype.avgFormat=(a,b,len)=>{
            var rate = rateCount(a,b,1);
            return numberRateFormat(rate,len,true)
        }
        
        
        function getFileSize(fileByte) {
            if(isNaN(fileByte)) return fileByte;
            var fileSizeByte = fileByte;
            var fileSizeMsg = "";
            if (fileSizeByte < 1048576) fileSizeMsg = (fileSizeByte / 1024).toFixed(2) + "KB";
            else if (fileSizeByte == 1048576) fileSizeMsg = "1MB";
            else if (fileSizeByte > 1048576 && fileSizeByte < 1073741824) fileSizeMsg = (fileSizeByte / (1024 * 1024)).toFixed(2) + "MB";
            else if (fileSizeByte > 1048576 && fileSizeByte == 1073741824) fileSizeMsg = "1GB";
            else if (fileSizeByte > 1073741824 && fileSizeByte < 1099511627776) fileSizeMsg = (fileSizeByte / (1024 * 1024 * 1024)).toFixed(2) + "GB";
            else fileSizeMsg = "文件超过1TB";
            return fileSizeMsg;
        }
        Vue.filter('fileSize', function(fileByte) {
            return getFileSize(fileByte);
        })
        Vue.prototype.fileSize=(row, column, cellValue, index)=>{
            if(cellValue || cellValue===0){
                return getFileSize(cellValue);
            }
            return getFileSize(row);
        }
        
        Vue.prototype.isMoney=(val)=>{
            if(!isNaN(val) && val>0){
                return true;
            }else{
                return false;
            }
        }
        
        Vue.prototype.isTrue=(val)=>{
            if(val===true || val==="true"){
                return true;
            }else{
                return false;
            }
        }
        
        Array.prototype.contains = function (obj) {
            var i = this.length;
            while (i--) {
                if (this[i] == obj) {
                    return true;
                }
            }
            return false;
        }
        
        
        Vue.prototype.getDefSummaries=(tableparam,param)=>{
            param = param || { };
            const { columns, data } = tableparam;
            const sums = [];
            var totalinfo = {};
            columns.forEach((column, index) => {
                if (index === 0) {
                    return;
                }
                totalinfo[column.property] = 0;
            });
            for(var i=0;i<data.length;i++){
                var row = data[i];
                for(var key in totalinfo){
                    totalinfo[key] += row[key];
                }
            }
            columns.forEach((column, index) => {
                if (index === 0) {
                    sums[index] = '合计';
                    return;
                }
                if(param.noSum && param.noSum[column.property]){
                    sums[index] = "";
                    return;
                }
                if(param.bigMoneyFormat){
                    sums[index] = bigMoneyFormat(totalinfo[column.property]);
                }
                if(param.rateCount && column.columnKey){
                    sums[index]+= rateFormatWithWraper(totalinfo[column.property],totalinfo[column.columnKey],1);
                }
            });
            return sums;
        }
        
        
        Vue.prototype.getCmJsonOption= ()=>{
            return {
                mode:"application/json",
                indentUnit : 2,  // 缩进单位，默认2
                smartIndent : true,  // 是否智能缩进
                //显示行号
                styleActiveLine: true,
                lineNumbers:true,
                lineWrapping:true,
                //设置主题
                theme:"eclipse",
                //代码折叠
                lineWrapping:true,
                foldGutter: true,
                gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter","CodeMirror-lint-markers"],
                //CodeMirror-lint-markers是实现语法报错功能
                lint: true,
                //全屏模式
                fullScreen:false,
                //括号匹配
                matchBrackets:true,
                //extraKeys: { "Ctrl": "autocomplete" },
                extraKeys: {
                    "F11": function(cm) {
                        cm.setOption("fullScreen", !cm.getOption("fullScreen"));
                    },
                    "Esc": function(cm) {
                        if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
                    }
                }
            }
        }
        
        Vue.prototype.jsonmini=(json)=>{
            var tmp = JSON.parse(json);
            var text = JSON.stringify(tmp);
            return text;
        }
        
        Vue.prototype.formatJson=(json, options)=>{
            var reg = null,
            formatted = '',
            pad = 0,
            PADDING = '  ';
            options = options || {};
            options.newlineAfterColonIfBeforeBraceOrBracket = (options.newlineAfterColonIfBeforeBraceOrBracket === true) ? true : false;
            options.spaceAfterColon = (options.spaceAfterColon === false) ? false : true;
            if (typeof json !== 'string') {
                json = JSON.stringify(json);
            } else {
                //json = JSON.parse(json);
                //json = JSON.stringify(json);
            }
            json = json.replace('\r\n\r\n',"\r\n");
            reg = /([\{\}])/g;
            json = json.replace(reg, '\r\n$1\r\n');
            reg = /([\[\]])/g;
            json = json.replace(reg, '\r\n$1\r\n');
            reg = /(\,)/g;
            json = json.replace(reg, '$1\r\n');
            reg = /(\r\n\r\n)/g;
            json = json.replace(reg, '\r\n');
            reg = /\r\n\,/g;
            json = json.replace(reg, ',');
            if (!options.newlineAfterColonIfBeforeBraceOrBracket) {
                reg = /\:\r\n\{/g;
                json = json.replace(reg, ':{');
                reg = /\:\r\n\[/g;
                json = json.replace(reg, ':[');
            }
            if (options.spaceAfterColon) {
                reg = /\:/g;
                json = json.replace(reg, ':');
            }
            (json.split('\r\n')).forEach(function (node, index) {
                    var i = 0,
                        indent = 0,
                        padding = '';
        
                    if (node.match(/\{$/) || node.match(/\[$/)) {
                        indent = 1;
                    } else if (node.match(/\}/) || node.match(/\]/)) {
                        if (pad !== 0) {
                            pad -= 1;
                        }
                    } else {
                        indent = 0;
                    }
        
                    for (i = 0; i < pad; i++) {
                        padding += PADDING;
                    }
        
                    formatted += padding + node + '\r\n';
                    pad += indent;
                }
            );
            return formatted;
        }
        
        
        Vue.prototype.toHump=(name)=> { // 下划线转换驼峰
            return name.replace(/\_(\w)/g, function(all, letter){
                return letter.toUpperCase();
            });
        };
        Vue.prototype.toLine=(name)=> { // 驼峰转换下划线
            return name.replace(/([A-Z])/g,"_$1").toLowerCase();
        };
        
        
        Vue.prototype.unixTimeFormat = function(row, column,value){
            if(row && !isNaN(row)) value=row;
            if(!value || value==0) return value;
            if(this.timeZone){
                return dayjs(value).tz(this.timeZone).format("YYYY-MM-DD HH:mm:ss");
            }else{
                return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
            }
            
        }
        Vue.prototype.timeToTzStr = function(value){
            if(!value || value==0) return value;
            if(this.timeZone){
                return dayjs(value).tz(this.timeZone).format("YYYY-MM-DD HH:mm:ss");
            }else{
                return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
            }
            
        }
        Vue.prototype.tzStrToTime = function(value){
            if(!value || value==0) return value;
            if(this.diffTimeZone){
                return dayjs(value).subtract(this.diffTimeZone, 'hour').valueOf();
            }else{
                return dayjs(value).valueOf();
            }
            
        }
        Vue.prototype.getTimeZoneTime = function(){
            if(this.timeZone){
                return dayjs().tz(this.timeZone).format("YYYY-MM-DD HH:mm:ss");
            }else{
                return dayjs().format("YYYY-MM-DD HH:mm:ss");
            }
            
        }

        
        Vue.prototype.isNum = function(val){
            if(!isNaN(val) && val!==""){
                return true;
            }
            return false;
        }
        Vue.prototype.setSceneType = function(list,field="sceneId"){
            if(!list) return;
            list.map(item=>{
                var sid = item[field];
                if(!sid)return;
                sid = Number(sid);
                if((sid>=31 && sid<=36) || sid==49){
                    item.__type=-1;
                    item.__ptype=-100; //自营
                    item.__typename="巴西小游戏";
                }else if((sid>=21 && sid<=28) || (sid>=37 && sid<=64)){
                    item.__type=-2;
                    item.__ptype=-100; //自营
                    item.__typename="自研slot";
                }else if(sid>=12000 && sid<13000){
                    item.__type=2;
                    item.__ptype=-200; //外部
                    item.__typename="PGSOFT";
                }else if(sid>=13000 && sid<14000){
                    item.__type=3;
                    item.__ptype=-200; //外部
                    item.__typename="JDB";
                }else if(sid>=14000 && sid<15000){
                    item.__type=4;
                    item.__ptype=-200; //外部
                    item.__typename="bggaming";
                }else if(sid>=15000 && sid<16000){
                    item.__type=5;
                    item.__ptype=-200; //外部
                    item.__typename="hacksaw";
                }else if(sid>=16000 && sid<17000){
                    item.__type=6;
                    item.__ptype=-200; //外部
                    item.__typename="PPGAMING";
                }else if(sid>=17000 && sid<18000){
                    item.__type=7;
                    item.__ptype=-200; //外部
                    item.__typename="YESBINGO";
                }else if(sid>=18000 && sid<19000){
                    item.__type=8;
                    item.__ptype=-200; //外部
                    item.__typename="EVOPLAY_LIVE";
                }else if(sid>=19000 && sid<20000){
                    item.__type=9;
                    item.__ptype=-200; //外部
                    item.__typename="EVOPLAY_SLOT";
                }else if(sid>=110000 && sid<111000){
                    item.__type=10;
                    item.__ptype=-200; //外部
                    item.__typename="CP_GAMES";
                }else if(sid>=111000 && sid<112000){
                    item.__type=11;
                    item.__ptype=-200; //外部
                    item.__typename="JI_LI";
                }else if(sid>=112000 && sid<113000){
                    item.__type=12;
                    item.__ptype=-200; //外部
                    item.__typename="WICKETS9";
                }else if(sid>=113000 && sid<114000){
                    item.__type=13;
                    item.__ptype=-200; //外部
                    item.__typename="MUMBAI_GAME";
                }else if(sid>=114000 && sid<115000){
                    item.__type=15;
                    item.__ptype=-200; //外部
                    item.__typename="Spribe";
                }

            })
        }
    }

    
}


</script>