var content = { 'cn': { headers1: '登陆', headers2: '在线客服', headers3: '创建账户', box1item1: '与全球150多国家的交易者一起在CWG开启您的交易之旅', box1item2: '一键交易全球外汇、股票、贵金属、指数、期货,享受低成本、极速执行和多重优惠', box1item3: '*活动受条款约束。请在我们的网站上查看优惠活动详情。', box1item4: '注册!', box1item5: '国家地区', box1item6: '联系电话', box1item7: '电子邮箱', box1item8: '邮箱验证码', box1item9: '设置密码', box1item10: '本人声明并确认本人并非美国公民或居民。', box1item11: '确认', box2item1: '最低入金', box2item2: '最高杠杆', box2item3: '点差低至', box2item4: '交易产品', box3: '为什么选择CWG?', box3item1: '产品丰富 交易全球', box3item2: 'CWG为全球交易者提供外汇、股票、贵金属、指数、期货等多达500多种金融衍生品交易', box3item3: '全面账户 极速交易', box3item4: '四种账户类型,极致交易速度,点差低至0,满足不同客户的多种选择', box3item5: '交易平台 全球领先', box3item6: 'CWG采用全球领先的MT4/5交易平台,适应于多种终端设备,随时随地开启交易', box3item7: '分析培训 交易护航', box3item8: 'CWG拥有雄厚的师资团队及专业的策略分析,为您的交易保驾护航', box3item9: '科技创新 技术领先', box3item10: 'CWG拥有MAM/PAMM/API技术支持,满足交易员跨平台多账号管理系统需求', box3item11: '顶级流动 透明交易', box3item12: 'CWG作为用户与顶级银行报价的中介,直接接入顶级流动性的全球外汇交易市场', box4: '福利三部曲,奖励金拿到手软,交易保障亏损无忧', box4item1: '获取$50交易金', box4item2: '免费领取$50礼遇账户,无需入金', box4item3: '享受100%高额赠金', box4item4: '您的每一笔入金都可以享受100%的可提取赠金', box4item5: '加入LP300计划', box4item6: '每月高达$900亏损补偿,为您的交易保驾护航', box5: '在CWG进行交易您能获得', box5item1: '多种账户类型满足不同交易需求', box5item2: '平均订单执行速度低于40毫秒', box5item3: '严格监管保障资金安全无忧', box5item4: '专业的分析研究和交易工具', box6item1: '立即领取$50礼遇金', box6item2: '开启您的无风险交易之旅!', box6item3: '立即领取', box7item1: 'CWG Markets是CWG集团的商标。', box7item2: 'Cwgvu.com由CWG集团所有并运营。CWG集团包括:', box7item3: 'CWG Markets Ltd(UK),在英格兰和威尔士注册,公司编号为08888720。该公司是一家730K投资公司,由英国金融行为监管局(FCA)完全授权和监管,公司监管编号 FRN 785129 。', box7item4: 'CWG Markets Ltd(VU),是一家证券及金融衍生品交易商,接受瓦努阿图金融服务委员会(VFSC)监管,监管编号为41694,获得授权从事证券交易业务。', box7item5: '客户必须年满18周岁才能使用CWG Markets的服务。', box7item6: '外汇和杠杆化金融产品是复杂的工具,并且由于杠杆而有快速亏损的风险。您应该考虑是否了解差价合约是如何运作的,以及您是否有能力承担损失资金的风险。您应该了解与差价合约(CFD)相关的所有风险,如果您有任何疑问,请寻求独立顾问的建议。请仔细阅读我们的', box7item7: '风险披露', box7item8: '。', box7item9: '受限地区: CWG Markets Ltd无法为特定国家/地区提供服务,例如:美国,以色列和伊朗。如果此类分发或使用违反当地法律或法规,则本网站上的信息不是分发或用于此类国家或地区的任何人。', box7item10: '本网站使用cookies为您提供最佳体验并更好地了解您。通过访问我们的网站并将您的浏览器设置为允许cookie,即表示您同意我们使用我们的隐私政策中所述的cookie。', box7item11: '© 2020 CWG MARKETS', box7item12: 'cookies政策', box7item13: '和', box7item14: ' 隐私政策', box7item15: '.', code: '获取验证码', country: "请选择您所在国家", email: "邮箱格式错误", phone: "电话格式错误", password: "使用8到15个字符,同时使用大写和小写字母,使用数字和英文字母的组合", codeInput: "请输入验证码", agree: "请同意声明", CodeSuccess: "验证码获取成功", emailempty: "邮箱不能为空", waitCode1: "等待 ", waitCode2: "s ", registerSuc: "注册成功,正在登录...", SystemError: "系统错误,请稍后再试。", LoginSuccess: "登录成功,马上进入系统。", }, 'en': { headers1: '登陆', headers2: '在线客服', headers3: '创建账户', box1item1: '与全球150多国家的交易者一起在CWG开启您的交易之旅', box1item2: '一键交易全球外汇、股票、贵金属、指数、期货,享受低成本、极速执行和多重优惠', box1item3: '*活动受条款约束。请在我们的网站上查看优惠活动详情。', box1item4: '注册!', box1item5: '国家地区', box1item6: '联系电话', box1item7: '电子邮箱', box1item8: '邮箱验证码', box1item9: '设置密码', box1item10: '本人声明并确认本人并非美国公民或居民。', box1item11: '确认', box2item1: '最低入金', box2item2: '最高杠杆', box2item3: '点差低至', box2item4: '交易产品', box3: '为什么选择CWG?', box3item1: '产品丰富 交易全球', box3item2: 'CWG为全球交易者提供外汇、股票、贵金属、指数、期货等多达500多种金融衍生品交易', box3item3: '全面账户 极速交易', box3item4: '四种账户类型,极致交易速度,点差低至0,满足不同客户的多种选择', box3item5: '交易平台 全球领先', box3item6: 'CWG采用全球领先的MT4/5交易平台,适应于多种终端设备,随时随地开启交易', box3item7: '分析培训 交易护航', box3item8: 'CWG拥有雄厚的师资团队及专业的策略分析,为您的交易保驾护航', box3item9: '科技创新 技术领先', box3item10: 'CWG拥有MAM/PAMM/API技术支持,满足交易员跨平台多账号管理系统需求', box3item11: '顶级流动 透明交易', box3item12: 'CWG作为用户与顶级银行报价的中介,直接接入顶级流动性的全球外汇交易市场', box4: '福利三部曲,奖励金拿到手软,交易保障亏损无忧', box4item1: '获取$50交易金', box4item2: '免费领取$50礼遇账户,无需入金', box4item3: '享受100%高额赠金', box4item4: '您的每一笔入金都可以享受100%的可提取赠金', box4item5: '加入LP300计划', box4item6: '每月高达$900亏损补偿,为您的交易保驾护航', box5: '在CWG进行交易您能获得', box5item1: '多种账户类型满足不同交易需求', box5item2: '平均订单执行速度低于40毫秒', box5item3: '严格监管保障资金安全无忧', box5item4: '专业的分析研究和交易工具', box6item1: '立即领取$50礼遇金', box6item2: '开启您的无风险交易之旅!', box6item3: '立即领取', box7item1: 'CWG Markets是CWG集团的商标。', box7item2: 'Cwgvu.com由CWG集团所有并运营。CWG集团包括:', box7item3: 'CWG Markets Ltd(UK),在英格兰和威尔士注册,公司编号为08888720。该公司是一家730K投资公司,由英国金融行为监管局(FCA)完全授权和监管,公司监管编号 FRN 785129 。', box7item4: 'CWG Markets Ltd(VU),是一家证券及金融衍生品交易商,接受瓦努阿图金融服务委员会(VFSC)监管,监管编号为41694,获得授权从事证券交易业务。', box7item5: '客户必须年满18周岁才能使用CWG Markets的服务。', box7item6: '外汇和杠杆化金融产品是复杂的工具,并且由于杠杆而有快速亏损的风险。您应该考虑是否了解差价合约是如何运作的,以及您是否有能力承担损失资金的风险。您应该了解与差价合约(CFD)相关的所有风险,如果您有任何疑问,请寻求独立顾问的建议。请仔细阅读我们的', box7item7: '风险披露', box7item8: '。', box7item9: '受限地区: CWG Markets Ltd无法为特定国家/地区提供服务,例如:美国,以色列和伊朗。如果此类分发或使用违反当地法律或法规,则本网站上的信息不是分发或用于此类国家或地区的任何人。', box7item10: '本网站使用cookies为您提供最佳体验并更好地了解您。通过访问我们的网站并将您的浏览器设置为允许cookie,即表示您同意我们使用我们的隐私政策中所述的cookie。', box7item11: '© 2020 CWG MARKETS', box7item12: 'cookies政策', box7item13: '和', box7item14: ' 隐私政策', box7item15: '.', code: '获取验证码', country: "请选择您所在国家", email: "邮箱格式错误", phone: "电话格式错误", password: "使用8到15个字符,同时使用大写和小写字母,使用数字和英文字母的组合", codeInput: "请输入验证码", agree: "请同意声明", CodeSuccess: "验证码获取成功", emailempty: "邮箱不能为空", waitCode1: "等待 ", waitCode2: "s ", registerSuc: "注册成功,正在登录...", SystemError: "系统错误,请稍后再试。", LoginSuccess: "登录成功,马上进入系统。", } } let vm = new Vue({ el: "#active1", data: { //多语言 langList: { en: "ENGLISH", cn: "中文简体" }, language: "cn", lang: {}, flag: false, loading: false, mock_options: [], // img_logo: logo, timer: 59, 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: "", agree: false, linkValue: null, }, // 验证规则 rules: { country: [ { validator: (rule, value, callback) => { if (value != "" && value != null) { callback(); } else { callback(new Error(content['cn'].country)); } }, trigger: "blur", }, ], email: [ { validator: (rule, value, callback) => { if (/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(value)) { callback(); } else { callback(new Error(content['cn'].email)); } }, trigger: "blur", }, ], emailCode: [ { validator: (rule, value, callback) => { if ( value != "" && value != null ) { callback(); } else { callback(new Error(content['cn'].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['cn'].password)); } }, trigger: "blur", }, ], agree: [ { validator: (rule, value, callback) => { if (value) { callback(); } else { callback(new Error(content['cn'].agree)); } }, trigger: "change", }, ], phone: [ { validator: (rule, value, callback) => { if (/^[0-9]\d*$/.test(value)) { callback(); } else { callback(new Error(content['cn'].phone)); } }, trigger: "blur", }, ], }, notRegisterMsg:"", notRegisterMsgOpen:false, imgUrl: '', ho: '' }, computed: { }, methods: { // 语言切换函数 chooseLang(key) { this.lang = content[key]; this.language = key; sessionStorage.setItem("lang", this.language); location.reload(); this.initTimer(); }, //获取国家列表 async getCountry() { axios.post(this.imgUrl + '/country/get', { ...this.params //参数 }).then(res => {//请求成功后的处理函数 if (res.data.code == 200) { this.mock_options = 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['cn'].country); return; } if (!this.params.email) { this.$message.error(content['cn'].emailempty); return; } if (!/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(this.params.email)) { this.$message.error(content['cn'].email); return; } } this.getCodeString = content['cn'].waitCode1 + this.timer + content['cn'].waitCode2; let that = this; if (!this.interval) { this.getCode1(val); this.interval = setInterval(() => { that.timer--; sessionStorage.setItem("timer", that.timer); that.getCodeString = content['cn'].waitCode1 + that.timer + content['cn'].waitCode2; if (that.timer == 0) { this.getCodeString = content['cn'].code; clearInterval(that.interval); that.interval = 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['cn'].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.params.sourceCode = this.getQueryStringRegExp('ex') this.params.w = this.getQueryStringRegExp('w') this.params.subId = this.getQueryStringRegExp('SUBID') 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; } } }, mounted() { // console.log(document.body.clientWidth); // this.clientWidth = document.body.clientWidth; // if (window.location.search.indexOf('&ex=') != '-1') { // this.params.sourceCode = window.location.search.split('&ex=')[1] || null; // } else if (window.location.search.indexOf('?ex=') != '-1') { // this.params.sourceCode = window.location.search.split('?ex=')[1] || null; // } this.getCodeQuery(); axios.defaults.headers.common['Language'] = 'cn'; this.ho = window.location.host.split('.')[1]; this.imgUrl = window.location.origin; // this.imgUrl = 'https://secure.cwgvu.com'; this.getCountryMsg() this.language = 'cn', this.lang = content['cn']; //获取国家 // this.getCountryCode(); this.getCountry(); this.initTimer(); }, destroyed() { clearInterval(this.interval); }, });