active1.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. var content = {
  2. 'cn': {
  3. nav1: "关于CWG",
  4. nav2: "立即参赛",
  5. headers1: 'CWG交易之星',
  6. headers2: '(中国·新疆)特邀巅峰赛',
  7. headers3: '总奖池:',
  8. headers4: '美金',
  9. headers5: '报名截止:',
  10. headers6: '报名截止时间:',
  11. headers7: '比赛时间:',
  12. headers8: '*本次邀请赛的参赛者限定为中国新疆地区客户',
  13. headers9: '年',
  14. headers10: '月',
  15. headers11: '日',
  16. headers12: '时',
  17. headers13: '分',
  18. headers14: '秒',
  19. table1: '参加比赛并瓜分总奖金池',
  20. table2: '活跃参与者有机会参加每个交易日的每日幸运星抽奖活动',
  21. table3: '排名',
  22. table4: '账户昵称',
  23. table5: 'CWG账号',
  24. table6: '账户净值',
  25. table7: '最大回撤',
  26. table8: '盈利率',
  27. table9: '综合分',
  28. table10: '暂无数据',
  29. table11: '*排行版更新时间为每日平台时间(夏令时GMT+3,冬令时GMT+2)00:00',
  30. step1: '如何参赛',
  31. step2: '收到邀请的CWG真实客户登录CWG客户专区',
  32. step3: '在客户专区活动中心找到实盘特邀交易大赛活动入口',
  33. step4: '点击报名按钮选择参赛账户并填写完信息提交即为报名成功',
  34. footer1: '每日幸运星',
  35. footer2: 'CWG会在每个交易日从活跃参赛者中抽取一名幸运星,将得到CWG定制大赛礼盒一份。',
  36. footer3: '(*活跃参赛者即当日有任意交易或账户有持仓)',
  37. footer4: '*幸运星精品礼盒奖励将在10个工作日内按照您的报名地址寄出,如需更换地址,请在获奖后3个工作日内联系CWG官网在线客服进行处理。',
  38. },
  39. 'en': {
  40. nav1: "About CWG",
  41. nav2: "Join Now",
  42. headers1: 'CWG Trading Star',
  43. headers2: '(China · Xinjiang) Invitational Championship',
  44. headers3: 'Total Prize Pool:',
  45. headers4: 'Dollars',
  46. headers5: 'Registration Deadline:',
  47. headers6: 'Countdown To The Competition:',
  48. headers7: 'Competition Time:',
  49. headers8: '*This event is an exclusive invitation for the CWG Xinjiang region in China. Participation is limited to CWG customers from the Xinjiang region in China.',
  50. headers9: 'Year',
  51. headers10: 'Month',
  52. headers11: 'Days',
  53. headers12: 'Hours',
  54. headers13: 'Minutes',
  55. headers14: 'Seconds',
  56. table1: 'Participate In The Competition & Divide The Total Bonus Pool',
  57. table2: 'Active participants have the opportunity to participate in the Daily Lucky Star Lucky Draw every trading day',
  58. table3: 'Rank',
  59. table4: 'Account Nickname',
  60. table5: 'CWG Account',
  61. table6: 'Account Equity',
  62. table7: 'Maximum Drawdown',
  63. table8: 'Profit Percentage',
  64. table9: 'Overall Score',
  65. table10: 'Not Data',
  66. table11: '*The update time of the ranking board is 00:00 daily platform time (daylight saving time GMT+3, winter time GMT+2)',
  67. step1: 'Three Simple Participation Techniques',
  68. step2: 'CWG real customers who have received an invitation should log in to the CWG Client Area.',
  69. step3: 'In the Client Area’s Activity Center, locate the entrance to the Real Account Invitational Trading Competition.',
  70. step4: 'Clicking the "Register" button confirms your successful registration.',
  71. footer1: 'Daily Lucky Stars',
  72. footer2: 'CWG will randomly select one lucky star from the pool of active participants on each trading day. The chosen lucky star will receive a specially curated CWG Championship Gift Box.',
  73. footer3: '(*Active participants are those who have engaged in any trading activity on that day or have open positions in their accounts.)',
  74. footer4: '(*Active participants are those who have engaged in any trading activity on that day or have open positions in their accounts.)',
  75. }
  76. }
  77. let vm = new Vue({
  78. el: "#active1",
  79. data: {
  80. //多语言
  81. langList: {
  82. en: "ENGLISH",
  83. cn: "中文简体"
  84. },
  85. language: "en",
  86. lang: {},
  87. flag: false,
  88. loading: false,
  89. mock_options: {
  90. time:'',
  91. list:[]
  92. },
  93. // img_logo: logo,
  94. timer: 59,
  95. interval: null,
  96. getCodeString: "",
  97. notCountry:[
  98. 'AF','AI','AG','BS','BY',
  99. 'BZ','BA','BI','CF','CD','CU',
  100. 'ET','FJ','PS','GN','GW','HT',
  101. 'IR','IQ','LB','LY','ML','MM',
  102. 'NI','KP','PW','RU','SO','SS',
  103. 'SD','SY','UA','US','VE','YE','ZW','MY'
  104. ],
  105. // 表单参数
  106. params: {
  107. agentId: null,
  108. comPoint: null,
  109. sourceCode:null,
  110. subId: "",
  111. email: "",
  112. password: "",
  113. country: "",
  114. emailCode: "",
  115. phone: "",
  116. w: "",
  117. agree: false,
  118. },
  119. clientWidth:'',
  120. pagerInfo: {row: 10, current: 1, pageTotal: 0, rowTotal: 0},//分页
  121. pictLoading:false,
  122. // 验证规则
  123. rules: {
  124. country: [
  125. {
  126. validator: (rule, value, callback) => {
  127. if (value != "" && value != null) {
  128. callback();
  129. } else {
  130. callback(new Error(content[sessionStorage.getItem('lang')].country));
  131. }
  132. },
  133. trigger: "blur",
  134. },
  135. ],
  136. email: [
  137. {
  138. validator: (rule, value, callback) => {
  139. if (/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(value)) {
  140. callback();
  141. } else {
  142. callback(new Error(content[sessionStorage.getItem('lang')].email));
  143. }
  144. },
  145. trigger: "blur",
  146. },
  147. ],
  148. emailCode: [
  149. {
  150. validator: (rule, value, callback) => {
  151. if (
  152. value != "" &&
  153. value != null
  154. ) {
  155. callback();
  156. } else {
  157. callback(new Error(content[sessionStorage.getItem('lang')].codeInput));
  158. }
  159. },
  160. trigger: "blur",
  161. },
  162. ],
  163. password: [
  164. {
  165. validator: (rule, value, callback) => {
  166. if (/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/.test(value)) {
  167. callback();
  168. } else {
  169. callback(new Error(content[sessionStorage.getItem('lang')].password));
  170. }
  171. },
  172. trigger: "blur",
  173. },
  174. ],
  175. agree: [
  176. {
  177. validator: (rule, value, callback) => {
  178. if (value) {
  179. callback();
  180. } else {
  181. callback(new Error(content[sessionStorage.getItem('lang')].agree));
  182. }
  183. },
  184. trigger: "change",
  185. },
  186. ],
  187. phone: [
  188. {
  189. validator: (rule, value, callback) => {
  190. if (/^[0-9]\d*$/.test(value)) {
  191. callback();
  192. } else {
  193. callback(new Error(content[sessionStorage.getItem('lang')].phone));
  194. }
  195. },
  196. trigger: "blur",
  197. },
  198. ],
  199. },
  200. imgUrl: '',
  201. ho: '',
  202. isPc:null,
  203. centerDialogVisible:false,
  204. CompetitionData:{},//基础信息
  205. rankingList:{},//排名列表
  206. Countdown:{
  207. d:'0',
  208. h:'0',
  209. m:'0',
  210. s:'0',
  211. },
  212. CountdownFlag:true,
  213. infoCode: '',
  214. },
  215. computed: {
  216. rule1: function () {
  217. if (!this.params.password) {
  218. return false;
  219. }
  220. return /^.{8,16}$/.test(this.params.password);
  221. },
  222. rule2: function () {
  223. return /^(?=.*?[a-z])(?=.*?[A-Z]).*$/.test(this.params.password);
  224. },
  225. rule3: function () {
  226. return /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/.test(
  227. this.params.password
  228. );
  229. },
  230. },
  231. methods: {
  232. // 语言切换函数
  233. chooseLang(key) {
  234. this.lang = content[key];
  235. this.language = key;
  236. sessionStorage.setItem("lang", this.language);
  237. location.reload();
  238. },
  239. //分页返回数据
  240. handleSizeChange (val) {
  241. this.pagerInfo.row = val;
  242. this.searchFunc();
  243. },
  244. handleCurrentChange (val) {
  245. this.pagerInfo.current = val;
  246. this.searchFunc();
  247. },
  248. //获取当前国家编码
  249. async getCountryMsg() {
  250. axios.get(this.imgUrl + '/country/get', {
  251. //参数
  252. }).then(res => {//请求成功后的处理函数
  253. if (res.data.code == 200) {
  254. if ((res.data.msg == "GB"||res.data.msg == "IE")&&res.data.data.indexOf('//195.224.141.218') == -1) {
  255. window.location.href = 'https://www.cwgmarkets.co.uk';
  256. } else {
  257. document.getElementById("pre").style.display = 'none'
  258. }
  259. } else {
  260. document.getElementById("pre").style.display = 'none'
  261. this.$message.error(res.data.msg);
  262. }
  263. }).catch(err => {//请求失败后的处理函数
  264. })
  265. },
  266. //获取列表数据
  267. async searchFunc () {
  268. this.pictLoading = true;
  269. axios.post(this.imgUrl + '/follow/cpt/result/search/list', {
  270. "infoCode": this.infoCode,
  271. page: {
  272. current: this.pagerInfo.current,
  273. row: this.pagerInfo.row
  274. }
  275. //参数
  276. }).then(res => {//请求成功后的处理函数
  277. if (res.data.code == 200) {
  278. if (res.data.data && res.data.data.length) {
  279. this.mock_options.list = res.data.data;
  280. }
  281. if (res.data.page != null) {
  282. this.pagerInfo.rowTotal = res.data.page.rowTotal;
  283. this.pagerInfo.pageTotal = res.data.page.pageTotal;
  284. } else {
  285. this.pagerInfo.rowTotal = 0;
  286. }
  287. this.pictLoading = false;
  288. } else {
  289. this.$message.error(res.data.msg);
  290. this.pictLoading = false;
  291. }
  292. }).catch(err => {//请求失败后的处理函数
  293. this.pictLoading = false;
  294. })
  295. },
  296. //获取基础数据
  297. async searchCompetition () {
  298. this.pictLoading = true;
  299. axios.post(this.imgUrl + '/follow/cpt/info/front', {
  300. "infoCode": this.infoCode
  301. //参数
  302. }).then(res => {//请求成功后的处理函数
  303. if (res.data.code == 200) {
  304. this.CompetitionData = res.data.data;
  305. this.CompetitionData.startDate = res.data.data.startDate.split(' ')[0];
  306. this.CompetitionData.endDate = res.data.data.endDate.split(' ')[0];
  307. // this.CompetitionData.startDate = '2023-9-7'
  308. let that = this;
  309. let startTime = new Date(that.CompetitionData.signEndDate.replace(/-/g, '/')).getTime();
  310. that.interval = setInterval(() => {
  311. let timezone = 3; //目标时区时间,东3区 东时区正数 西市区负数
  312. let offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
  313. let nowDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
  314. let nowTime = new Date(nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
  315. let sec = 1000, min = 60 * sec, hour = min * 60, day = 24 * hour;
  316. let time = startTime - nowTime;
  317. if (time>0) {
  318. that.CountdownFlag = true;
  319. that.Countdown.d = that.getzero(Math.floor(time / day));
  320. that.Countdown.h = that.getzero(Math.floor((time % day) / hour));
  321. that.Countdown.m = that.getzero(Math.floor((time % hour) / min));
  322. that.Countdown.s = that.getzero(Math.floor((time % min) / sec));
  323. } else {
  324. that.CountdownFlag = false;
  325. this.CompetitionData.signStartDate = res.data.data.signStartDate.split(' ')[0];
  326. this.CompetitionData.signEndDate = res.data.data.signEndDate.split(' ')[0];
  327. }
  328. //时间归零,重新获取数据
  329. if (nowTime >= startTime) {
  330. clearInterval(that.interval);
  331. }
  332. }, 1000);
  333. this.pictLoading = false;
  334. } else {
  335. this.$message.error(res.data.msg);
  336. this.pictLoading = false;
  337. }
  338. }).catch(err => {//请求失败后的处理函数
  339. this.pictLoading = false;
  340. })
  341. },
  342. //时间补0
  343. getzero(time){
  344. return time > '9' ? time : '0' + time
  345. },
  346. getQueryStringRegExp(name){
  347. var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
  348. if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
  349. },
  350. },
  351. watch:{ },
  352. mounted() {
  353. this.ho = window.location.host.split('.')[1];
  354. this.imgUrl = window.location.origin;
  355. this.infoCode = this.getQueryStringRegExp('code')
  356. // this.imgUrl = 'https://secure.cwgchinese.com/';
  357. this.getCountryMsg()
  358. if (sessionStorage.getItem("lang")) {
  359. this.language = sessionStorage.getItem("lang"),
  360. this.lang = content[sessionStorage.getItem("lang")];
  361. } else {
  362. var jsSrc =(navigator.language || navigator.browserLanguage).toLowerCase();
  363. if(jsSrc.indexOf('zh') >= 0){
  364. this.language = 'cn'
  365. this.lang = content['cn'];
  366. }else{
  367. this.language = 'en'
  368. this.lang = content['en'];
  369. }
  370. sessionStorage.setItem("lang", this.language);
  371. }
  372. this.searchFunc();//获取列表数据
  373. this.searchCompetition();
  374. },
  375. destroyed() {
  376. clearInterval(this.interval);
  377. },
  378. });