var content = { 'cn': { nav1: "关于CWG", nav2: "立即参赛", headers1: 'CWG交易之星', headers2: '(中国·新疆)特邀巅峰赛', headers3: '总奖池:', headers4: '美金', headers5: '报名截止:', headers6: '报名截止时间:', headers7: '比赛时间:', headers8: '*本次邀请赛的参赛者限定为中国新疆地区客户', headers9: '年', headers10: '月', headers11: '日', headers12: '时', headers13: '分', headers14: '秒', table1: '参加比赛并瓜分总奖金池', table2: '活跃参与者有机会参加每个交易日的每日幸运星抽奖活动', table3: '排名', table4: '账户昵称', table5: 'CWG账号', table6: '账户净值', table7: '最大回撤', table8: '盈利率', table9: '综合分', table10: '暂无数据', table11: '*排行版更新时间为每日平台时间(夏令时GMT+3,冬令时GMT+2)00:00', step1: '如何参赛', step2: '收到邀请的CWG真实客户登录CWG客户专区', step3: '在客户专区活动中心找到实盘特邀交易大赛活动入口', step4: '点击报名按钮选择参赛账户并填写完信息提交即为报名成功', footer1: '每日幸运星', footer2: 'CWG会在每个交易日从活跃参赛者中抽取一名幸运星,将得到CWG定制大赛礼盒一份。', footer3: '(*活跃参赛者即当日有任意交易或账户有持仓)', footer4: '*幸运星精品礼盒奖励将在10个工作日内按照您的报名地址寄出,如需更换地址,请在获奖后3个工作日内联系CWG官网在线客服进行处理。', }, 'en': { nav1: "About CWG", nav2: "Join Now", headers1: "CWG Africa's Top Trader Challenge", headers2: 'For each new trader, we will add $10 into the prize pool, no limits!', headers3: 'Total Prize Pool:', headers4: 'USD', headers5: 'Registration Deadline:', headers6: 'Registration Deadline:', headers7: 'Competition Period:', headers8: '*Participants in this competition include all customers from the African region.', headers9: 'Year', headers10: 'Month', headers11: 'Day', headers12: 'Hour', headers13: 'Minute', headers14: 'Second', table1: 'Join now and win from our traders prize pool', table2: 'Active participants have the chance to win the daily trader prize every trading day', table3: 'Rank', table4: 'Nickname', table5: 'CWG Account', table6: 'Account Net Value', table7: 'Maximum Drawdown', table8: 'Profitability', table9: 'Overall Score', table10: 'No data available', table11: '*Rankings are updated daily at 00:00 platform time (GMT+3 during daylight saving time, GMT+2 during standard time)', step1: 'How to Participate', step2: 'Click "Join Now," fill in the registration information, and successfully create an instant account (if you already have a CWG account, please contact our customer service for registration)', step3: 'After successfully submitting, wait for dedicated customer service to contact you and open the competition channel for your account.', step4: "click on 'Sign Up for the Competition' in the client zone's activity center to successfully register and wait for the competition to start.", footer1: 'Daily Trader Prize', footer2: 'For each trading day of the challenge, CWG will randomly select one lucky trader from the pool of active participants who will receive a reward of $5 CASH!', footer3: '(Active participants refer to those who have made any trades or have open positions on that day)', footer4: "*Rewards will be credited to your customer's wallet immediately", box1item4: 'Welcome To CWG Markets', box1item4_1: 'Please fill out this field', box1item5: 'Country / Region', box1item6: 'Phone Number', box1item7: 'Email Address', box1item8: 'Email Varification Code', box1item9: 'Set Password', box1item10: 'I declared and confirmed that I am not a citizen or resident of the United States.', box1item11: 'Register', box1item12: 'Already have an account', code: 'Generate', country: "Please select your country", email: "Email Address Format Error", phone: "Phone Format Error", password: "Must be between 8 to 15 characters,Contain both uppercase and lowercase letter,Use a combination of numbers and letters", codeInput: "Please enter the Email verification code", agree: "Please agree to the declaration", CodeSuccess: "Verification code has been successfully obtained ", emailempty: "Email Address cannot be empty", waitCode1: "Please wait ", waitCode2: "s ", registerSuc: "Registration successful, log in now...", SystemError: "System Error, please try again.", LoginSuccess: "Login Successful", st1: "Must be between 8 to 15 characters", nd2: "Contain both uppercase and lowercase letter", rd3: "Use a combination of numbers and letters", }, } let vm = new Vue({ el: "#active1", data: { //多语言 langList: { en: "ENGLISH", cn: "中文简体" }, language: "en", lang: {}, flag: false, loading: false, mock_options: { time:'', list:[] }, mock_optionsC: [], // img_logo: logo, timer: 59, intervalCode:null, interval: null, getCodeString: "", notCountry:[ 'AF','AI','AG','BS','BY', 'BZ','BA','BI','CF','CD','CU', 'ET','FJ','PS','GN','GW','HT', 'IR','IQ','LB','LY','ML','MM', 'NI','KP','PW','RU','SO','SS', 'SD','SY','UA','US','VE','YE','ZW','MY' ], // 表单参数 params: { agentId: null, comPoint: null, sourceCode:null, subId: "", email: "", password: "", country: "", emailCode: "", phone: "", w: "", agree: false, linkValue: null, }, dialogFormVisible:false, clientWidth:'', pagerInfo: {row: 10, current: 1, pageTotal: 0, rowTotal: 0},//分页 pictLoading:false, // 验证规则 rules: { country: [ { validator: (rule, value, callback) => { if (value != "" && value != null) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].country)); } }, trigger: "blur", }, ], email: [ { validator: (rule, value, callback) => { if (/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(value)) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].email)); } }, trigger: "blur", }, ], emailCode: [ { validator: (rule, value, callback) => { if ( value != "" && value != null ) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].codeInput)); } }, trigger: "blur", }, ], password: [ { validator: (rule, value, callback) => { if (/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/.test(value)) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].password)); } }, trigger: "blur", }, ], agree: [ { validator: (rule, value, callback) => { if (value) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].agree)); } }, trigger: "change", }, ], phone: [ { validator: (rule, value, callback) => { if (/^[0-9]\d*$/.test(value)) { callback(); } else { callback(new Error(content[sessionStorage.getItem('lang')].phone)); } }, trigger: "blur", }, ], }, notRegisterMsg:"", notRegisterMsgOpen:false, imgUrl: '', ho: '', isPc:null, centerDialogVisible:false, CompetitionData:{},//基础信息 rankingList:{},//排名列表 Countdown:{ d:'0', h:'0', m:'0', s:'0', }, CountdownFlag:true, infoCode:'', }, computed: { rule1: function () { if (!this.params.password) { return false; } return /^.{8,16}$/.test(this.params.password); }, rule2: function () { return /^(?=.*?[a-z])(?=.*?[A-Z]).*$/.test(this.params.password); }, rule3: function () { return /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/.test( this.params.password ); }, }, methods: { // 语言切换函数 chooseLang(key) { this.lang = content[key]; this.language = key; sessionStorage.setItem("lang", this.language); location.reload(); }, //分页返回数据 handleSizeChange (val) { this.pagerInfo.row = val; this.searchFunc(); }, handleCurrentChange (val) { this.pagerInfo.current = val; this.searchFunc(); }, //获取列表数据 async searchFunc () { this.pictLoading = true; axios.post(this.imgUrl + '/follow/cpt/result/search/list', { "infoCode": this.infoCode, page: { current: this.pagerInfo.current, row: this.pagerInfo.row } //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { if (res.data.data && res.data.data.length) { this.mock_options.list = res.data.data; } if (res.data.page != null) { this.pagerInfo.rowTotal = res.data.page.rowTotal; this.pagerInfo.pageTotal = res.data.page.pageTotal; } else { this.pagerInfo.rowTotal = 0; } this.pictLoading = false; } else { this.$message.error(res.data.msg); this.pictLoading = false; } }).catch(err => {//请求失败后的处理函数 this.pictLoading = false; }) }, //获取基础数据 async searchCompetition () { this.pictLoading = true; axios.post(this.imgUrl + '/follow/cpt/info/front', { "infoCode": this.infoCode //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.CompetitionData = res.data.data; this.CompetitionData.luckyLogins = this.CompetitionData.luckyLogins||[]; this.CompetitionData.startDate = res.data.data.startDate.split(' ')[0]; this.CompetitionData.endDate = res.data.data.endDate.split(' ')[0]; // this.CompetitionData.startDate = '2023-9-7' // let that = this; // let startTime = new Date(that.CompetitionData.signEndDate.replace(/-/g, '/')).getTime(); // that.interval = setInterval(() => { // let timezone = 3; //目标时区时间,东3区 东时区正数 西市区负数 // let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟 // let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数 // let nowTime = new Date(nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000); // let sec = 1000, min = 60 * sec, hour = min * 60, day = 24 * hour; // let time = startTime - nowTime; // if (time>0) { // that.CountdownFlag = true; // that.Countdown.d = that.getzero(Math.floor(time / day)); // that.Countdown.h = that.getzero(Math.floor((time % day) / hour)); // that.Countdown.m = that.getzero(Math.floor((time % hour) / min)); // that.Countdown.s = that.getzero(Math.floor((time % min) / sec)); // } else { // that.CountdownFlag = false; // this.CompetitionData.signStartDate = res.data.data.signStartDate.split(' ')[0]; // this.CompetitionData.signEndDate = res.data.data.signEndDate.split(' ')[0]; // } // //时间归零,重新获取数据 // if (nowTime >= startTime) { // clearInterval(that.interval); // } // }, 1000); this.pictLoading = false; } else { this.$message.error(res.data.msg); this.pictLoading = false; } }).catch(err => {//请求失败后的处理函数 this.pictLoading = false; }) }, //时间补0 getzero(time){ return time > '9' ? time : '0' + time }, //获取国家列表 async getCountry() { axios.post(this.imgUrl + '/country/get', { ...this.params //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.mock_optionsC = res.data.data; } else { this.$message.error(res.data.msg); } }).catch(err => {//请求失败后的处理函数 }) }, //获取当前国家编码 async getCountryMsg() { axios.get(this.imgUrl + '/country/get', { //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.notRegisterMsg = res.data.msg if ((res.data.msg == "GB"||res.data.msg == "IE")&&res.data.data.indexOf('//195.224.141.218') == -1) { window.location.href = 'https://www.cwgmarkets.co.uk'; } else { document.getElementById("pre").style.display = 'none' } } else { document.getElementById("pre").style.display = 'none' this.$message.error(res.data.msg); } }).catch(err => {//请求失败后的处理函数 }) }, //获取当前国家编码 async getCountryCode() { axios.post(this.imgUrl + '/country/getCodeByIp', { //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { if (this.notCountry.indexOf(res.data.msg)==-1) { this.params.country = res.data.msg; } if (!sessionStorage.getItem("timer")) { let lang = sessionStorage.getItem("lang") ? sessionStorage.getItem("lang") : this.params.country == "CN" ? "cn" : "en"; sessionStorage.clear(); sessionStorage.setItem("lang", lang); } else { let timer = sessionStorage.getItem("timer"); let lang = sessionStorage.getItem("lang") ? sessionStorage.getItem("lang") : this.params.country == "CN" ? "cn" : "en"; sessionStorage.clear(); sessionStorage.setItem("lang", lang); sessionStorage.setItem("timer", timer); } this.language = sessionStorage.getItem("lang"); this.lang = content[this.language]; this.initTimer(); } else { this.$message.error(res.data.msg); } }).catch(err => {//请求失败后的处理函数 }) }, // 注册 register: async function () { if (this.notRegisterMsg == 'MY') { this.notRegisterMsgOpen = true; return } this.$refs["params"].validate(async (valid) => { if (valid) { if (this.flag) { return; } else { this.flag = true; } axios.post(this.imgUrl + '/custom/register', { ...this.params //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.loading = true; this.$message({ message: this.lang.registerSuc, type: 'success' }); this.login(); this.flag = false; } else { this.$message.error(res.data.msg); this.flag = false; } }).catch(err => {//请求失败后的处理函数 }) } else { return false; } }); }, // 登陆 login: async function () { axios.post(this.imgUrl + '/custom/login', { loginName: this.params.email, password: this.params.password, //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { sessionStorage.setItem("access_token", res.data.data); axios.defaults.headers.common["Access-Token"] = res.data.data; this.getLoginInfo(); } else { this.$message.error(res.data.msg); } }).catch(err => {//请求失败后的处理函数 }) }, //获取登录信息 async getLoginInfo() { axios.post(this.imgUrl + '/custom/info', { //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.loading = true; // this.$store.commit("InitInfo", res.data.data); this.$message({ message: this.lang.LoginSuccess, type: 'success' }); setTimeout(() => { this.loading = false; Session.Set("user", JSON.stringify(res.data.data), true) window.location.href = this.imgUrl + '/#/customer/index'; }, 1000); } else { this.$message.error(this.lang.SystemError); } }).catch(err => {//请求失败后的处理函数 }) }, // 获取验证码 getCode: async function (val) { if (val) { if (!this.params.country) { this.$message.error(content[sessionStorage.getItem("lang")].country); return; } if (!this.params.email) { this.$message.error(content[sessionStorage.getItem("lang")].emailempty); return; } if (!/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(this.params.email)) { this.$message.error(content[sessionStorage.getItem("lang")].email); return; } } this.getCodeString = content[sessionStorage.getItem("lang")].waitCode1 + this.timer + content[sessionStorage.getItem("lang")].waitCode2; let that = this; if (!this.intervalCode) { this.getCode1(val); this.intervalCode = setInterval(() => { that.timer--; sessionStorage.setItem("timer", that.timer); that.getCodeString = content[sessionStorage.getItem("lang")].waitCode1 + that.timer + content[sessionStorage.getItem("lang")].waitCode2; if (that.timer == 0) { this.getCodeString = content[sessionStorage.getItem("lang")].code; clearInterval(that.intervalCode); that.intervalCode = null; that.timer = 59; sessionStorage.setItem("timer", that.timer); } }, 1000); } }, //验证码 async getCode1(val) { if (val) { axios.post(this.imgUrl + '/custom/register/send/code', { ...this.params //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.$message({ message: this.lang.CodeSuccess, type: 'success' }); } else { this.$message.error(res.data.msg); } }).catch(err => {//请求失败后的处理函数 }) } }, // 初始化定时器 initTimer: function () { let t = sessionStorage.getItem("timer") || this.timer; if (t == 59) { this.getCodeString = content[sessionStorage.getItem("lang")].code; } else { this.timer = sessionStorage.getItem("timer"); this.getCode(0); } }, getQueryStringRegExp(name){ var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i"); if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return ""; }, getCodeQuery(){ // this.token = decodeURIComponent(this.getQueryStringRegExp('token')); this.params.sourceCode = this.getQueryStringRegExp('ex') this.params.w = this.getQueryStringRegExp('w') this.params.subId = this.getQueryStringRegExp('SUBID') this.infoCode = this.getQueryStringRegExp('code')||'AFRICAN_FOREX_TRADING_CHALLENGE_2025'; this.params.agentId = Number(this.getQueryStringRegExp('mmdi')) || null; this.params.linkValue = this.getQueryStringRegExp('mmF') switch (this.getQueryStringRegExp('mmF')) { case "F0": this.params.comPoint = 0; break; case "F1": this.params.comPoint = 10; break; case "F2": this.params.comPoint = 20; break; case "F3": this.params.comPoint = 30; break; } switch (this.getQueryStringRegExp('mmB')) { case "B0": this.params.ibInvalid = 0; break; case "B1": this.params.ibInvalid = 1; break; } }, }, watch:{ }, mounted() { this.ho = window.location.host.split('.')[1]; this.imgUrl = window.location.origin; this.getCodeQuery(); // this.imgUrl = 'https://secure.cwgmarkets.com/'; // this.imgUrl = 'http://193.134.208.230:8000' this.getCountryMsg() if (sessionStorage.getItem("lang")) { this.language = sessionStorage.getItem("lang"), this.lang = content[sessionStorage.getItem("lang")]; } else { // var jsSrc =(navigator.language || navigator.browserLanguage).toLowerCase(); // if(jsSrc.indexOf('zh') >= 0){ // this.language = 'cn' // this.lang = content['cn']; // }else{ // this.language = 'en' // this.lang = content['en']; // } this.language = 'en' this.lang = content['en']; sessionStorage.setItem("lang", this.language); } this.searchFunc();//获取列表数据 this.searchCompetition(); this.getCountryCode(); this.getCountry(); }, destroyed() { clearInterval(this.interval); clearInterval(this.intervalCode) }, });