import {getImageUrl} from "../../../utils/publicMethods.js"

export default {
    data(){
        return{
          
            activeCoin:"nexa",
            activeItem:{
                path:"nexaAccess",
                value: "nexa",
                label: "nexa",
                imgUrl: `${this.$baseApi}img/nexa.png`,
                show:true,
                name:"course.NEXAcourse",
                amount:10000,
                tcp:"stratum+tcp://nexa.m2pool.com:33333",
                ssl:"stratum+ssl://nexa.m2pool.com:33335",
                Step1:"course.Step1",
                accountContent1:"course.accountContent1",
                accountContent2:"course.accountContent2",
                Step2:"course.Step2",
                bindWalletText1:"course.bindWalletText1",
                bindWalletText2:"course.bindWalletText2",
                walletAddr:"https://nexa.org/",
                bindWalletText3:"course.bindWalletText3",
                bindWalletText4:"course.bindWalletText4",                
                exchangeAddr1:"https://www.mxc.com/",
                exchangeAddr1Label:"MEXC",
                exchangeAddr2:"https://www.coinex.com/zh-hans/",
                exchangeAddr2Label:"CoinEx",
                bindWalletText5:"course.bindWalletText5",
                bindWalletText6:"course.bindWalletText6",
                bindWalletText7:"course.bindWalletText7",
                bindWalletText8:"course.bindWalletText8",
                Step3:"course.Step3",
                miningIncome1:"course.miningIncome1",
                miningIncome2:"course.miningIncome2",
                GPU:"bzminer、lolminer、Rigel、WildRig",
                ASIC:"course.dragonBall",
                Step4:"course.Step4",
                parameter:"course.parameter",
                parameter2:"course.parameter2",
                parameter3:"course.parameter3",
                parameter4:"course.parameter4",
                parameter5:"course.parameter5",
                parameter6:"course.parameter6",
                parameter7:"course.parameter7",
                parameter8:"course.parameter8",
              



            },
            activeName:"1",
        
       
        }
    },
    mounted(){
        
        // if (this.$route.query.coin) {
        //     this.activeCoin = this.$route.query.coin
        //     // this.currencyPath = this.$route.query.imgUrl
        //     this.imgUrl = this.$route.query.imgUrl
        //     this.currencyPath= this.$route.query.imgUrl
        //     this.params.coin = this.$route.query.coin
        //     this.$addStorageEvent(1,`activeCoin`,JSON.stringify(this.activeCoin))
        //     this.activeItem = this.currencyList.find(item=>{return item.value==this.params.coin})
        // }



        // let activeCoin=localStorage.getItem("activeCoin")
        // this.activeCoin= JSON.parse(activeCoin)
        // window.addEventListener("setItem", () => {
        //     let activeCoin=localStorage.getItem("activeCoin")
        //     this.activeCoin= JSON.parse(activeCoin)
        // });

        // console.log(this.activeCoin,"鸡脚低端局");
        

        // if ( !this.activeCoin ) {
        //     this.activeCoin ="nexa"
        //     this.imgUrl = `https://test.m2pool.com/img/nexa.png`
        //     this.currencyPath= `https://test.m2pool.com/img/nexa.png`
        //     this.params.coin ="nexa"
        //     this.$addStorageEvent(1,`activeCoin`,JSON.stringify(this.activeCoin))
        // }else if(this.activeCoin==`nexa` || this.activeCoin==`rxd`){

        //    try {
        //     this.pageTitle = this.currencyList.find(item => item.value == this.activeCoin).name
        //     this.imgUrl = this.currencyList.find(item => item.value == this.activeCoin).imgUrl
        //    } catch (error) {
        //         console.log(error);
                
        //    }
          
        // }
   

        

        
    },
    methods:{
        getImageUrl(path) {
            return getImageUrl(path);
        },
        clickJump(item){ 
           
            this.activeCoin=item.value
            this.pageTitle = item.name
            this.imgUrl = item.imgUrl
            this.$addStorageEvent(1,`activeCoin`,JSON.stringify(item.value))
            // this.$router.push(item.url)
            console.log(this.activeCoin);
        },
        clickCopy(value){
            navigator.clipboard.writeText(value).then(() => {
                this.$message({
                    showClose: true,
                    message: this.$t(`personal.copySuccessful`),
                    type: 'success',
                
                });
              }).catch(err => {
                console.log('复制失败', err);
                this.$message({
                    showClose: true,
                    message: this.$t(`personal.copyFailed`),
                    type: 'error',
                   
                });
              });
        },
        clickCurrency(item) {
        
            
            this.currencyPath = item.imgUrl
            this.params.coin = item.value
            this.activeItem = item
           
            
            
         
        },
        handelCurrencyLabel(coin){
            let obj =  this.currencyList.find(item => item.value == coin)
              if (obj) {
                  return obj.label
              }else{
                  return ""
              }
  
  
          }
    },
    

}