active1.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. var content = {
  2. 'cn': {
  3. headers1: 'Login',
  4. headers2: 'Live Chat',
  5. headers3: 'Create Account',
  6. box1item1: 'Start your journey at CWG with friends from more than 150 countries around the world',
  7. box1item2: 'Just a click away to trade global forex, stocks, precious metals, index, futures, enjoy low cost, fast execution and multiple discounts',
  8. box1item3: '*T&Cs apply. Full details of our promotions are on our website.',
  9. box1item4: 'Signup!',
  10. box1item5: 'Country',
  11. box1item6: 'Phone',
  12. box1item7: 'Email',
  13. box1item8: 'Email Varification Code',
  14. box1item9: 'Password',
  15. box1item10: 'I declared and confirmed that I am not a citizen or resident of the United States.',
  16. box1item11: 'Submit',
  17. box2item1: 'Minimum deposit',
  18. box2item2: 'Highest leverage',
  19. box2item3: 'Spread as low as',
  20. box2item4: 'Trading instruments',
  21. box3: 'Why Choose CWG?',
  22. box3item1: 'Wide-Range of Global Trading Products',
  23. box3item2: 'CWG provides global traders with more than 500 kinds of financial derivatives such as foreign exchange, stocks, precious metals, indexes and futures',
  24. box3item3: 'Dynamic Account, Instant Trading',
  25. box3item4: 'Four types of accounts, the ultimate speed, to meet the various choices of different customers',
  26. box3item5: 'Global Leading Trading Platform',
  27. box3item6: "CWG adopts the world's leading MT4 / 5 trading platform, which is suitable for a variety of terminal devices to start trading anytime and anywhere",
  28. box3item7: 'Analysis Training,Your Support',
  29. box3item8: 'CWG has a strong team of consultants and professional strategy analysis to support you',
  30. box3item9: 'Technological Innovation, Leading Technology',
  31. box3item10: 'CWG has technical support to meet the needs of cross platform multi account management system for all customers',
  32. box3item11: 'Top Liquidity With Transparency',
  33. box3item12: 'CWG act as an intermediary between users and top banks and has direct access to the top liquid global foreign exchange market',
  34. box4: 'The trilogy of benefits: ',
  35. box4item1: 'Get Welcome Bouns',
  36. box4item2: 'Get the Welcome Bouns Hi Account for free',
  37. box4item3: 'Enjoy attractive bonus',
  38. box4item4: 'You can enjoy attractive bonus',
  39. box4item5: 'Join LP300 program',
  40. box4item6: 'Compensation to protect your Account',
  41. box5: 'At CWG you can get:',
  42. box5item1: 'Multiple solutions to meet your needs',
  43. box5item2: 'The average order execution speed is less than 40 milliseconds',
  44. box5item3: 'Strict supervision',
  45. box5item4: 'Professional analytical research and instruments',
  46. box6item1: 'Get the $50 bonus now',
  47. box6item2: 'Start your risk-free trading journey!',
  48. box6item3: 'Claim Bonus',
  49. box7item1: 'CWG Markets is the trading name of CWG Group of companies.',
  50. box7item2: 'Cwgvu.com is owned and operated within the CWG Group of companies. CWG Group consists of:',
  51. box7item3: 'CWG Markets Ltd(UK), which is registered in England and Wales with company number 08888720. It is an investment firm fully authorised and regulated by the Financial Conduct Authority (FCA), under the firm reference number FRN 785129.',
  52. box7item4: '',
  53. box7item5: 'Clients must be at least 18 years old to use the services of CWG Markets.',
  54. box7item6: '',
  55. box7item7: '',
  56. box7item8: '',
  57. box7item9: 'Restricted Regions: CWG Markets Ltd does not provide services for the residents of certain countries, such as the United States of America, Israel and the Islamic Republic of Iran. If such distribution or use violates local laws or regulations, the information on this website is not intended to be distributed or used to anyone in such countries or regions.',
  58. box7item10: '',
  59. box7item11: '© 2020 CWG MARKETS',
  60. box7item12: 'Privacy Policy',
  61. box7item13: '.',
  62. box7item14: ' Terms & Conditions',
  63. box7item15: '.',
  64. code: 'Get Code',
  65. country: "Please select your country",
  66. email: "Email Address Format Error",
  67. phone: "Phone Format Error",
  68. password: "Must be between 8 to 15 characters,Contain both uppercase and lowercase letter,Use a combination of numbers and letters",
  69. codeInput: "Please enter the Email verification code",
  70. agree: "Please agree to the declaration",
  71. CodeSuccess: "Verification code has been successfully obtained ",
  72. emailempty: "Email Address cannot be empty",
  73. waitCode1: "Please wait ",
  74. waitCode2: "s ",
  75. registerSuc: "Registration successful, log in now...",
  76. SystemError: "System Error, please try again.",
  77. LoginSuccess: "Login Successful",
  78. },
  79. 'en': {
  80. headers1: 'Login',
  81. headers2: 'Live Chat',
  82. headers3: 'Create Account',
  83. box1item1: 'Start your journey at CWG with friends from more than 150 countries around the world',
  84. box1item2: 'Just a click away to trade global forex, stocks, precious metals, index, futures, enjoy low cost, fast execution and multiple discounts',
  85. box1item3: '*T&Cs apply. Full details of our promotions are on our website.',
  86. box1item4: 'Signup!',
  87. box1item5: 'Country',
  88. box1item6: 'Phone',
  89. box1item7: 'Email',
  90. box1item8: 'Email Varification Code',
  91. box1item9: 'Password',
  92. box1item10: 'I declared and confirmed that I am not a citizen or resident of the United States.',
  93. box1item11: 'Submit',
  94. box2item1: 'Minimum deposit',
  95. box2item2: 'Highest leverage',
  96. box2item3: 'Spread as low as',
  97. box2item4: 'Trading instruments',
  98. box3: 'Why Choose CWG?',
  99. box3item1: 'Wide-Range of Global Trading Products',
  100. box3item2: 'CWG provides global traders with more than 500 kinds of financial derivatives such as foreign exchange, stocks, precious metals, indexes and futures',
  101. box3item3: 'Dynamic Account, Instant Trading',
  102. box3item4: 'Four types of accounts, the ultimate speed, to meet the various choices of different customers',
  103. box3item5: 'Global Leading Trading Platform',
  104. box3item6: "CWG adopts the world's leading MT4 / 5 trading platform, which is suitable for a variety of terminal devices to start trading anytime and anywhere",
  105. box3item7: 'Analysis Training,Your Support',
  106. box3item8: 'CWG has a strong team of consultants and professional strategy analysis to support you',
  107. box3item9: 'Technological Innovation, Leading Technology',
  108. box3item10: 'CWG has technical support to meet the needs of cross platform multi account management system for all customers',
  109. box3item11: 'Top Liquidity With Transparency',
  110. box3item12: 'CWG act as an intermediary between users and top banks and has direct access to the top liquid global foreign exchange market',
  111. box4: 'The trilogy of benefits: ',
  112. box4item1: 'Get Welcome Bouns',
  113. box4item2: 'Get the Welcome Bouns Hi Account for free',
  114. box4item3: 'Enjoy attractive bonus',
  115. box4item4: 'You can enjoy attractive bonus',
  116. box4item5: 'Join LP300 program',
  117. box4item6: 'Compensation to protect your Account',
  118. box5: 'At CWG you can get:',
  119. box5item1: 'Multiple solutions to meet your needs',
  120. box5item2: 'The average order execution speed is less than 40 milliseconds',
  121. box5item3: 'Strict supervision',
  122. box5item4: 'Professional analytical research and instruments',
  123. box6item1: 'Get the $50 bonus now',
  124. box6item2: 'Start your risk-free trading journey!',
  125. box6item3: 'Claim Bonus',
  126. box7item1: 'CWG Markets is the trading name of CWG Group of companies.',
  127. box7item2: 'Cwgvu.com is owned and operated within the CWG Group of companies. CWG Group consists of:',
  128. box7item3: 'CWG Markets Ltd(UK), which is registered in England and Wales with company number 08888720. It is an investment firm fully authorised and regulated by the Financial Conduct Authority (FCA), under the firm reference number FRN 785129.',
  129. box7item4: '',
  130. box7item5: 'Clients must be at least 18 years old to use the services of CWG Markets.',
  131. box7item6: '',
  132. box7item7: '',
  133. box7item8: '',
  134. box7item9: 'Restricted Regions: CWG Markets Ltd does not provide services for the residents of certain countries, such as the United States of America, Israel and the Islamic Republic of Iran. If such distribution or use violates local laws or regulations, the information on this website is not intended to be distributed or used to anyone in such countries or regions.',
  135. box7item10: '',
  136. box7item11: '© 2020 CWG MARKETS',
  137. box7item12: 'Privacy Policy',
  138. box7item13: '.',
  139. box7item14: ' Terms & Conditions',
  140. box7item15: '.',
  141. code: 'Get Code',
  142. country: "Please select your country",
  143. email: "Email Address Format Error",
  144. phone: "Phone Format Error",
  145. password: "Must be between 8 to 15 characters,Contain both uppercase and lowercase letter,Use a combination of numbers and letters",
  146. codeInput: "Please enter the Email verification code",
  147. agree: "Please agree to the declaration",
  148. CodeSuccess: "Verification code has been successfully obtained ",
  149. emailempty: "Email Address cannot be empty",
  150. waitCode1: "Please wait ",
  151. waitCode2: "s ",
  152. registerSuc: "Registration successful, log in now...",
  153. SystemError: "System Error, please try again.",
  154. LoginSuccess: "Login Successful",
  155. }
  156. }
  157. let vm = new Vue({
  158. el: "#active1",
  159. data: {
  160. //多语言
  161. langList: {
  162. en: "ENGLISH",
  163. cn: "中文简体"
  164. },
  165. language: "en",
  166. lang: {},
  167. flag: false,
  168. loading: false,
  169. mock_options: [],
  170. // img_logo: logo,
  171. timer: 59,
  172. interval: null,
  173. getCodeString: "",
  174. notCountry:[
  175. 'AF','AI','AG','BS','BY',
  176. 'BZ','BA','BI','CF','CD','CU',
  177. 'ET','FJ','PS','GN','GW','HT',
  178. 'IR','IQ','LB','LY','ML','MM',
  179. 'NI','KP','PW','RU','SO','SS',
  180. 'SD','SY','UA','US','VE','YE','ZW','MY'
  181. ],
  182. // 表单参数
  183. params: {
  184. agentId: null,
  185. comPoint: null,
  186. sourceCode:null,
  187. subId: "",
  188. email: "",
  189. password: "",
  190. country: "",
  191. emailCode: "",
  192. agree: false,
  193. linkValue: null,
  194. },
  195. // 验证规则
  196. rules: {
  197. country: [
  198. {
  199. validator: (rule, value, callback) => {
  200. if (value != "" && value != null) {
  201. callback();
  202. } else {
  203. callback(new Error(content[sessionStorage.getItem('lang')].country));
  204. }
  205. },
  206. trigger: "blur",
  207. },
  208. ],
  209. email: [
  210. {
  211. validator: (rule, value, callback) => {
  212. if (/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(value)) {
  213. callback();
  214. } else {
  215. callback(new Error(content[sessionStorage.getItem('lang')].email));
  216. }
  217. },
  218. trigger: "blur",
  219. },
  220. ],
  221. emailCode: [
  222. {
  223. validator: (rule, value, callback) => {
  224. if (
  225. value != "" &&
  226. value != null
  227. ) {
  228. callback();
  229. } else {
  230. callback(new Error(content[sessionStorage.getItem('lang')].codeInput));
  231. }
  232. },
  233. trigger: "blur",
  234. },
  235. ],
  236. password: [
  237. {
  238. validator: (rule, value, callback) => {
  239. if (/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/.test(value)) {
  240. callback();
  241. } else {
  242. callback(new Error(content[sessionStorage.getItem('lang')].password));
  243. }
  244. },
  245. trigger: "blur",
  246. },
  247. ],
  248. agree: [
  249. {
  250. validator: (rule, value, callback) => {
  251. if (value) {
  252. callback();
  253. } else {
  254. callback(new Error(content[sessionStorage.getItem('lang')].agree));
  255. }
  256. },
  257. trigger: "change",
  258. },
  259. ],
  260. phone: [
  261. {
  262. validator: (rule, value, callback) => {
  263. if (/^[0-9]\d*$/.test(value)) {
  264. callback();
  265. } else {
  266. callback(new Error(content[sessionStorage.getItem('lang')].phone));
  267. }
  268. },
  269. trigger: "blur",
  270. },
  271. ],
  272. },
  273. notRegisterMsg:"",
  274. notRegisterMsgOpen:false,
  275. imgUrl: '',
  276. ho: ''
  277. },
  278. computed: {
  279. },
  280. methods: {
  281. // 语言切换函数
  282. chooseLang(key) {
  283. this.lang = content[key];
  284. this.language = key;
  285. sessionStorage.setItem("lang", this.language);
  286. location.reload();
  287. this.initTimer();
  288. },
  289. //获取国家列表
  290. async getCountry() {
  291. axios.post(this.imgUrl + '/country/get', {
  292. ...this.params
  293. //参数
  294. }).then(res => {//请求成功后的处理函数
  295. if (res.data.code == 200) {
  296. this.mock_options = res.data.data;
  297. } else {
  298. this.$message.error(res.data.msg);
  299. }
  300. }).catch(err => {//请求失败后的处理函数
  301. })
  302. },
  303. //获取当前国家编码
  304. async getCountryMsg() {
  305. axios.get(this.imgUrl + '/country/get', {
  306. //参数
  307. }).then(res => {//请求成功后的处理函数
  308. if (res.data.code == 200) {
  309. this.notRegisterMsg = res.data.msg
  310. if ((res.data.msg == "GB"||res.data.msg == "IE")&&res.data.data.indexOf('//195.224.141.218') == -1) {
  311. window.location.href = 'https://www.cwgmarkets.co.uk';
  312. } else {
  313. document.getElementById("pre").style.display = 'none'
  314. }
  315. } else {
  316. document.getElementById("pre").style.display = 'none'
  317. this.$message.error(res.data.msg);
  318. }
  319. }).catch(err => {//请求失败后的处理函数
  320. })
  321. },
  322. //获取当前国家编码
  323. async getCountryCode() {
  324. axios.post(this.imgUrl + '/country/getCodeByIp', {
  325. //参数
  326. }).then(res => {//请求成功后的处理函数
  327. if (res.data.code == 200) {
  328. if (this.notCountry.indexOf(res.data.msg)==-1) {
  329. this.params.country = res.data.msg;
  330. }
  331. if (!sessionStorage.getItem("timer")) {
  332. let lang = sessionStorage.getItem("lang")
  333. ? sessionStorage.getItem("lang")
  334. : this.params.country == "CN"
  335. ? "cn"
  336. : "en";
  337. sessionStorage.clear();
  338. sessionStorage.setItem("lang", lang);
  339. } else {
  340. let timer = sessionStorage.getItem("timer");
  341. let lang = sessionStorage.getItem("lang")
  342. ? sessionStorage.getItem("lang")
  343. : this.params.country == "CN"
  344. ? "cn"
  345. : "en";
  346. sessionStorage.clear();
  347. sessionStorage.setItem("lang", lang);
  348. sessionStorage.setItem("timer", timer);
  349. }
  350. this.language = sessionStorage.getItem("lang");
  351. this.lang = content[this.language];
  352. this.initTimer();
  353. } else {
  354. this.$message.error(res.data.msg);
  355. }
  356. }).catch(err => {//请求失败后的处理函数
  357. })
  358. },
  359. // 注册
  360. register: async function () {
  361. if (this.notRegisterMsg == 'MY') {
  362. this.notRegisterMsgOpen = true;
  363. return
  364. }
  365. this.$refs["params"].validate(async (valid) => {
  366. if (valid) {
  367. if (this.flag) {
  368. return;
  369. } else {
  370. this.flag = true;
  371. }
  372. axios.post(this.imgUrl + '/custom/register', {
  373. ...this.params
  374. //参数
  375. }).then(res => {//请求成功后的处理函数
  376. if (res.data.code == 200) {
  377. this.loading = true;
  378. this.$message({
  379. message: this.lang.registerSuc,
  380. type: 'success'
  381. });
  382. this.login();
  383. this.flag = false;
  384. } else {
  385. this.$message.error(res.data.msg);
  386. this.flag = false;
  387. }
  388. }).catch(err => {//请求失败后的处理函数
  389. })
  390. } else {
  391. return false;
  392. }
  393. });
  394. },
  395. // 登陆
  396. login: async function () {
  397. axios.post(this.imgUrl + '/custom/login', {
  398. loginName: this.params.email,
  399. password: this.params.password,
  400. //参数
  401. }).then(res => {//请求成功后的处理函数
  402. if (res.data.code == 200) {
  403. sessionStorage.setItem("access_token", res.data.data);
  404. axios.defaults.headers.common["Access-Token"] = res.data.data;
  405. this.getLoginInfo();
  406. } else {
  407. this.$message.error(res.data.msg);
  408. }
  409. }).catch(err => {//请求失败后的处理函数
  410. })
  411. },
  412. //获取登录信息
  413. async getLoginInfo() {
  414. axios.post(this.imgUrl + '/custom/info', {
  415. //参数
  416. }).then(res => {//请求成功后的处理函数
  417. if (res.data.code == 200) {
  418. this.loading = true;
  419. // this.$store.commit("InitInfo", res.data.data);
  420. this.$message({
  421. message: this.lang.LoginSuccess,
  422. type: 'success'
  423. });
  424. setTimeout(() => {
  425. this.loading = false;
  426. Session.Set("user", JSON.stringify(res.data.data), true)
  427. window.location.href = this.imgUrl + '/#/customer/index';
  428. }, 1000);
  429. } else {
  430. this.$message.error(this.lang.SystemError);
  431. }
  432. }).catch(err => {//请求失败后的处理函数
  433. })
  434. },
  435. // 获取验证码
  436. getCode: async function (val) {
  437. if (val) {
  438. if (!this.params.country) {
  439. this.$message.error(content[sessionStorage.getItem("lang")].country);
  440. return;
  441. }
  442. if (!this.params.email) {
  443. this.$message.error(content[sessionStorage.getItem("lang")].emailempty);
  444. return;
  445. }
  446. if (!/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(this.params.email)) {
  447. this.$message.error(content[sessionStorage.getItem("lang")].email);
  448. return;
  449. }
  450. }
  451. this.getCodeString =
  452. content[sessionStorage.getItem("lang")].waitCode1 +
  453. this.timer +
  454. content[sessionStorage.getItem("lang")].waitCode2;
  455. let that = this;
  456. if (!this.interval) {
  457. this.getCode1(val);
  458. this.interval = setInterval(() => {
  459. that.timer--;
  460. sessionStorage.setItem("timer", that.timer);
  461. that.getCodeString =
  462. content[sessionStorage.getItem("lang")].waitCode1 +
  463. that.timer +
  464. content[sessionStorage.getItem("lang")].waitCode2;
  465. if (that.timer == 0) {
  466. this.getCodeString = content[sessionStorage.getItem("lang")].code;
  467. clearInterval(that.interval);
  468. that.interval = null;
  469. that.timer = 59;
  470. sessionStorage.setItem("timer", that.timer);
  471. }
  472. }, 1000);
  473. }
  474. },
  475. //验证码
  476. async getCode1(val) {
  477. if (val) {
  478. axios.post(this.imgUrl + '/custom/register/send/code', {
  479. ...this.params
  480. //参数
  481. }).then(res => {//请求成功后的处理函数
  482. if (res.data.code == 200) {
  483. this.$message({
  484. message: this.lang.CodeSuccess,
  485. type: 'success'
  486. });
  487. } else {
  488. this.$message.error(res.data.msg);
  489. }
  490. }).catch(err => {//请求失败后的处理函数
  491. })
  492. }
  493. },
  494. // 初始化定时器
  495. initTimer: function () {
  496. let t = sessionStorage.getItem("timer") || this.timer;
  497. if (t == 59) {
  498. this.getCodeString = content[sessionStorage.getItem("lang")].code;
  499. } else {
  500. this.timer = sessionStorage.getItem("timer");
  501. this.getCode(0);
  502. }
  503. },
  504. getQueryStringRegExp(name){
  505. var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
  506. if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
  507. },
  508. getCodeQuery(){
  509. this.params.sourceCode = this.getQueryStringRegExp('ex')
  510. this.params.w = this.getQueryStringRegExp('w')
  511. this.params.subId = this.getQueryStringRegExp('SUBID')
  512. this.params.agentId = Number(this.getQueryStringRegExp('mmdi')) || null;
  513. this.params.linkValue = this.getQueryStringRegExp('mmF')
  514. switch (this.getQueryStringRegExp('mmF')) {
  515. case "F0":
  516. this.params.comPoint = 0;
  517. break;
  518. case "F1":
  519. this.params.comPoint = 10;
  520. break;
  521. case "F2":
  522. this.params.comPoint = 20;
  523. break;
  524. case "F3":
  525. this.params.comPoint = 30;
  526. break;
  527. }
  528. switch (this.getQueryStringRegExp('mmB')) {
  529. case "B0":
  530. this.params.ibInvalid = 0;
  531. break;
  532. case "B1":
  533. this.params.ibInvalid = 1;
  534. break;
  535. }
  536. }
  537. },
  538. mounted() {
  539. // console.log(document.body.clientWidth);
  540. // this.clientWidth = document.body.clientWidth;
  541. // if (window.location.search.indexOf('&ex=') != '-1') {
  542. // this.params.sourceCode = window.location.search.split('&ex=')[1] || null;
  543. // } else if (window.location.search.indexOf('?ex=') != '-1') {
  544. // this.params.sourceCode = window.location.search.split('?ex=')[1] || null;
  545. // }
  546. this.getCodeQuery();
  547. this.ho = window.location.host.split('.')[1];
  548. this.imgUrl = window.location.origin;
  549. // this.imgUrl = 'http://8.210.194.53:8000';
  550. this.getCountryMsg()
  551. if (sessionStorage.getItem("lang")) {
  552. this.language = sessionStorage.getItem("lang"),
  553. this.lang = content[sessionStorage.getItem("lang")];
  554. } else {
  555. this.language = 'en',
  556. this.lang = content['en'];
  557. }
  558. //获取国家
  559. this.getCountryCode();
  560. this.getCountry();
  561. // this.initTimer();
  562. },
  563. destroyed() {
  564. clearInterval(this.interval);
  565. },
  566. });