2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";const t=require("../../../common/vendor.js"),e=require("../../../request/api.js"),c=require("../../../utils/util.js"),s=require("../../../common/assets.js"),a={data:()=>({navH:t.inject("navHeight"),listTop:"",sortListTop:"",keywords:"",newestPriceDate:"",cycleList:["3天","7天","14天","自定义"],selectCycleIndex:0,startDateStr:"",endDateStr:"",selectStartDateStr:"",selectEndDateStr:"",rankTabList:[{icon:"/static/icon/home/conceptCenter/increaseRate.png",selectIcon:"/static/icon/home/conceptCenter/increaseRate_s.png",title:"涨幅榜"},{icon:"/static/icon/home/conceptCenter/decreaseRate.png",selectIcon:"/static/icon/home/conceptCenter/decreaseRate_s.png",title:"跌幅榜"},{icon:"/static/icon/home/conceptCenter/active.png",selectIcon:"/static/icon/home/conceptCenter/active_s.png",title:"活跃榜"},{icon:"/static/icon/home/conceptCenter/fluctuate.png",selectIcon:"/static/icon/home/conceptCenter/fluctuate_s.png",title:"波动榜"},{icon:"/static/icon/home/conceptCenter/continuousRise.png",selectIcon:"/static/icon/home/conceptCenter/continuousRise_s.png",title:"连涨榜"}],selectTab:0,rankList:[],sortTypeList:[{icon:"/static/icon/home/conceptCenter/chgSort.png",name:"涨跌幅",key:"change_pct"},{icon:"/static/icon/home/conceptCenter/correlationSort.png",name:"相关度",key:"_score"},{icon:"/static/icon/home/conceptCenter/stockNumSort.png",name:"股票数量",key:"stock_count"},{icon:"/static/icon/home/conceptCenter/conceptNameSort.png",name:"概念名称",key:"concept_name"}],sortType:"change_pct",weekList:["一","二","三","四","五","六","日"],monthDateList:[],selectMonthIndex:0,selectMonth:"",selectDateStr:"",quickTimeList:["今天","昨天","一周前","一月前"],conceptList:[],page:1,getRateUpOrDown:c.getRateUpOrDown}),onLoad(){this.listTop=this.navH+160/750*t.inject("windowWidth"),this.sortListTop=this.navH+160/750*t.inject("windowWidth");let e=new Date,c=e.getFullYear(),s=e.getMonth()+1,a=e.getDate(),i=[];this.selectMonthIndex=240+s-1,this.selectMonth=c+"年"+s+"月",this.selectDateStr=this.endDateStr=this.selectEndDateStr=c+"-"+(s>9?s:"0"+s)+"-"+(a>9?a:"0"+a);let n=new Date(e);n.setDate(n.getDate()-3);let o=n.getFullYear(),r=n.getMonth()+1,l=n.getDate();this.startDateStr=this.selectStartDateStr=o+"-"+(r>9?r:"0"+r)+"-"+(l>9?l:"0"+l);for(var h=c-20;h<c+20;h++)for(var p=0;p<12;p++){let t=new Date(h,p+1,0),e=new Date(h,p+1,0);e.setDate(1);let n=t.getDate(),o=e.getDay()||7,r=[];for(var m=1;m<=n;m++){let t=new Date(h,p+1,0);t.setDate(m);let e=t.getMonth()+1,i=t.getDate(),n=t.getTime(),o=h+"-"+(e>9?e:"0"+e)+"-"+(i>9?i:"0"+i);r.push({date:o,year:h,month:e,day:i,isToday:h==c&&e==s&&i==a,isCurrentMonth:!0,timestamp:n})}for(m=0;m<o-1;m++){let t=h,e=p;p<1&&(t=h-1,e=12);let c=new Date(t,e,0).getDate(),s=new Date(t,e-1,c-m),a=s.getMonth()+1,i=s.getDate(),n=s.getTime(),o=t+"-"+(a>9?a:"0"+a)+"-"+(i>9?i:"0"+i);r.unshift({date:o,year:t,month:a,day:i,isToday:!1,isCurrentMonth:!1,timestamp:n})}let l=new Date(h,p+1,1),d=new Date(l-864e5).getDay()||7;for(m=1;m<8-d;m++){let t=h,e=p;e>11&&(e=0,t++);let c=new Date(t,e+1,m),s=c.getMonth()+1,a=c.getDate(),i=c.getTime(),n=t+"-"+(s>9?s:"0"+s)+"-"+(a>9?a:"0"+a);r.push({date:n,year:t,month:s,day:a,isToday:!1,isCurrentMonth:!1,timestamp:i})}i.push(r)}this.monthDateList=i,this.getConceptCenterData(),this.getNewestPriceDateData(),this.getRankListData()},methods:{clickSearch(){this.page=1,this.getConceptCenterData()},clickRank(){this.$refs.rankPopup.open()},clickRankClose(){this.$refs.rankPopup.close()},clickRankCycleListItem(t){if(this.selectCycleIndex!=t)if(this.selectCycleIndex=t,3==t);else{let e=new Date,c=e.getFullYear(),s=e.getMonth()+1,a=e.getDate(),i=new Date(e);0==t?i.setDate(i.getDate()-3):1==t?i.setDate(i.getDate()-7):2==t&&i.setDate(i.getDate()-14);let n=i.getFullYear(),o=i.getMonth()+1,r=i.getDate();this.endDateStr=this.selectEndDateStr=c+"-"+(s>9?s:"0"+s)+"-"+(a>9?a:"0"+a),this.startDateStr=this.selectStartdateStr=n+"-"+(o>9?o:"0"+o)+"-"+(r>9?r:"0"+r),this.getRankListData()}},clickRankTabItem(t){this.selectTab!=t&&(this.selectTab=t,this.getRankListData())},clickSortType(){this.$refs.sortTypePopup.open()},clickSortListItem(t){this.sortType=t.key,this.clickSearch(),this.$refs.sortTypePopup.close()},clickTransactionDate(){this.$refs.transactionDatePopup.open()},clickCancel(){this.$refs.transactionDatePopup.close()},clickConfirm(){this.clickCancel(),this.getConceptCenterData()},clickPreMonth(){if(this.selectMonthIndex>0){this.selectMonthIndex--;let t=this.monthDateList[this.selectMonthIndex],e="",c="";for(let s of t)if(s.isCurrentMonth){e=s.year,c=s.month;break}this.selectMonth=e+"年"+c+"月"}},clickNextMonth(){if(this.selectMonthIndex<this.monthDateList.length-1){this.selectMonthIndex++;let t=this.monthDateList[this.selectMonthIndex],e="",c="";for(let s of t)if(s.isCurrentMonth){e=s.year,c=s.month;break}this.selectMonth=e+"年"+c+"月"}},clickSelectDate(t){this.selectDateStr!=t.date&&(this.selectDateStr=t.date)},clickQuickTimeItem(t){let e=new Date,c=e.getFullYear();if(0==t){let t=e.getMonth()+1,s=e.getDate();this.selectMonthIndex=240+t-1,this.selectMonth=c+"年"+t+"月",this.selectDateStr=c+"-"+(t>9?t:"0"+t)+"-"+(s>9?s:"0"+s)}else if(1==t){let t=new Date(e);t.setDate(t.getDate()-1);let s=t.getFullYear(),a=t.getMonth()+1,i=t.getDate();this.selectMonthIndex=12*(20-(c-s))+a-1,this.selectMonth=s+"年"+a+"月",this.selectDateStr=s+"-"+(a>9?a:"0"+a)+"-"+(i>9?i:"0"+i)}else if(2==t){let t=new Date(e);t.setDate(t.getDate()-7);let s=t.getFullYear(),a=t.getMonth()+1,i=t.getDate();this.selectMonthIndex=12*(20-(c-s))+a-1,this.selectMonth=s+"年"+a+"月",this.selectDateStr=s+"-"+(a>9?a:"0"+a)+"-"+(i>9?i:"0"+i)}else{let t=new Date(e);t.setDate(t.getDate()-30);let s=t.getFullYear(),a=t.getMonth()+1,i=t.getDate();this.selectMonthIndex=12*(20-(c-s))+a-1,this.selectMonth=s+"年"+a+"月",this.selectDateStr=s+"-"+(a>9?a:"0"+a)+"-"+(i>9?i:"0"+i)}},clickNotVip(){this.$refs.vipPopup.open()},clickLater(){this.$refs.vipPopup.close()},clickUpgradeAtOnce(){this.clickLater()},clickStockMore(e){t.index.navigateTo({url:"/pages/index/hotStock/hotStock?id="+e.concept_id})},clickHistoricalTimeline(){t.index.navigateTo({url:"/pages/index/historicalTimeline/historicalTimeline"})},getConceptCenterData(){let t={query:this.keywords,size:10,page:this.page,sort_by:this.sortType,isJson:1,trade_date:this.selectDateStr};e.eventRelatedConcept(t).then((t=>{this.conceptList=t.results})).catch((t=>{}))},getNewestPriceDateData(){e.newestPriceDate().then((t=>{this.newestPriceDate=t.latest_trade_date})).catch((t=>{}))},getRankListData(){var t={};3==this.selectCycleIndex?(t.start_date=this.startDateStr,t.end_date=this.endDateStr):(t.day=3,1==this.selectCycleIndex?t.day=7:2==this.selectCycleIndex&&(t.day=14)),e.conceptRankList(t).then((t=>{0==this.selectTab?this.rankList=t.data.hot_concepts:1==this.selectTab?this.rankList=t.data.cold_concepts:2==this.selectTab?this.rankList=t.data.active_concepts:3==this.selectTab?this.rankList=t.data.volatile_concepts:this.rankList=t.data.momentum_concepts})).catch((t=>{}))}}};if(!Array){(t.resolveComponent("navBar")+t.resolveComponent("uni-popup"))()}Math||((()=>"../../../components/navBar/navBar.js")+(()=>"../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const i=t._export_sfc(a,[["render",function(e,c,a,i,n,o){return t.e({a:t.p({leftText:"概念中心",hideNavBg:!0}),b:s._imports_0$2,c:s._imports_1$8,d:t.o((t=>o.clickSearch())),e:n.keywords,f:t.o((t=>n.keywords=t.detail.value)),g:t.o((t=>o.clickRank())),h:t.t(n.newestPriceDate),i:s._imports_2$9,j:t.o((t=>o.clickSortType())),k:s._imports_3$6,l:t.o((t=>o.clickTransactionDate())),m:t.s("top: "+n.navH+"px;"),n:t.f(n.conceptList,((e,c,s)=>t.e({a:t.t(e.concept),b:e.price_info},e.price_info?{c:t.t(e.price_info.avg_change_pct),d:t.n("chg "+(n.getRateUpOrDown(e.price_info.avg_change_pct)?"down":"up"))}:{},{e:e.price_info},e.price_info?{f:t.t(e.stock_count),g:t.n("stockNum "+(n.getRateUpOrDown(e.price_info.avg_change_pct)?"down":"up"))}:{},{h:t.t(e.description),i:t.f(e.stocks.slice(0,3),((e,c,s)=>({a:t.t(e.stock_name),b:c}))),j:t.t(e.stock_count-3),k:t.o((t=>o.clickStockMore(e)),c),l:t.t(e.price_info?e.price_info.trade_date:""),m:t.o((t=>o.clickHistoricalTimeline()),c),n:c}))),o:s._imports_4$5,p:t.s("top: "+n.listTop+"px;"),q:s._imports_5$1,r:t.o((t=>o.clickRankClose())),s:s._imports_6$1,t:t.t(n.startDateStr),v:t.t(n.endDateStr),w:t.f(n.cycleList,((e,c,s)=>({a:t.t(e),b:t.n("item "+(n.selectCycleIndex==c?"select":"")),c:c,d:t.o((t=>o.clickRankCycleListItem(c)),c)}))),x:3==n.selectCycleIndex},3==n.selectCycleIndex?{y:t.t(n.selectStartDateStr),z:t.t(n.selectEndDateStr)}:{},{A:t.f(n.rankTabList,((e,c,s)=>t.e({a:n.selectTab==c},n.selectTab==c?{b:e.selectIcon}:{c:e.icon},{d:t.t(e.title),e:t.n("item flex1 flexCenter "+(n.selectTab==c?"select":"")),f:c,g:t.o((t=>o.clickRankTabItem(c)),c)}))),B:t.f(n.rankList,((e,c,a)=>t.e({a:0==c},0==c?{b:s._imports_7}:{},{c:1==c},1==c?{d:s._imports_8}:{},{e:2==c},2==c?{f:s._imports_9}:{},{g:c>2},c>2?{h:t.t(c+1)}:{},{i:t.t(e.name)},3==n.selectTab||4==n.selectTab?t.e({j:3==n.selectTab},3==n.selectTab?{k:t.t(e.avg_change)}:{},{l:4==n.selectTab},4==n.selectTab?{m:t.t(e.total_change)}:{}):t.e({n:0==n.selectTab||1==n.selectTab},0==n.selectTab||1==n.selectTab?{o:s._imports_10$1,p:t.t(e.news_count)}:{},{q:s._imports_11,r:t.t(e.news_count),s:2==n.selectTab},2==n.selectTab?{t:s._imports_12$1,v:t.t(e.report_count)}:{}),0==n.selectTab?{w:t.t(e.change_pct)}:{},1==n.selectTab?{x:t.t(e.change_pct)}:{},2==n.selectTab?{y:t.t(e.total_mentions)}:{},3==n.selectTab?{z:t.t(e.volatility)}:{},4==n.selectTab?{A:t.t(e.consecutive_days)}:{},{B:c}))),C:3==n.selectTab||4==n.selectTab,D:t.n("icon "+(4==n.selectTab?"continuousRise":"")),E:n.rankTabList[n.selectTab].selectIcon,F:0==n.selectTab,G:1==n.selectTab,H:2==n.selectTab,I:3==n.selectTab,J:4==n.selectTab,K:t.sr("rankPopup","260dfc26-1"),L:t.p({type:"bottom",safeArea:!1}),M:s._imports_13$1,N:t.f(n.sortTypeList,((e,c,s)=>({a:e.icon,b:t.t(e.name),c:c,d:t.o((t=>o.clickSortListItem(e)),c)}))),O:t.s("margin-top:"+n.sortListTop+"px;"),P:t.sr("sortTypePopup","260dfc26-2"),Q:t.p({type:"top","mask-background-color":"transparent",animation:!1}),R:t.o((t=>o.clickCancel())),S:t.o((t=>o.clickConfirm())),T:s._imports_1$7,U:t.o((t=>o.clickPreMonth())),V:t.t(n.selectMonth),W:s._imports_2$8,X:t.o((t=>o.clickNextMonth())),Y:t.f(n.weekList,((e,c,s)=>({a:t.t(e),b:c}))),Z:t.f(n.monthDateList[n.selectMonthIndex],((e,c,s)=>t.e({a:e.date==n.selectDateStr},e.date==n.selectDateStr?{b:t.t(e.day)}:t.e({c:!e.isCurrentMonth},e.isCurrentMonth?{e:t.t(e.day)}:{d:t.t(e.day)}),{f:c,g:t.o((t=>o.clickSelectDate(e)),c)}))),aa:t.f(n.quickTimeList,((e,c,s)=>({a:t.t(e),b:c,c:t.o((t=>o.clickQuickTimeItem(c)),c)}))),ab:t.sr("transactionDatePopup","260dfc26-3"),ac:t.p({type:"bottom",safeArea:!1}),ad:s._imports_16,ae:s._imports_17,af:s._imports_18,ag:s._imports_18,ah:s._imports_19,ai:s._imports_19,aj:s._imports_19,ak:t.o((t=>o.clickLater())),al:t.o((t=>o.clickUpgradeAtOnce())),am:t.sr("vipPopup","260dfc26-4"),an:t.p({type:"center"})})}]]);wx.createPage(i);
|