index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="header" >
  3. <div class="h-top">
  4. <div class="auto clearfix" style="display: flex">
  5. <!-- <div style="width: 15%">东盟头条新闻社 主办</div> -->
  6. <div class="top-left">
  7. <nuxt-link to="/aboutUS" tag="a" target="_blank">关于我们</nuxt-link>
  8. <!-- <a href="http://www.aseantop.com/#/aboutUS" target="_blank">关于我们</a> -->
  9. <a href="http://mp.aseantop.com" target="_blank">我要投稿</a>
  10. </div>
  11. <!-- <ul class="clearfix">
  12. <li>{{year}}年{{month}}月{{day}}日</li>
  13. <li style="padding-left: 10px;">{{weekDay}}</li>
  14. </ul> -->
  15. <!-- <div style="width:300px; margin:4px 0 0 60%;">
  16. <Input search enter-button="搜索" placeholder="站内搜索" size="small" @on-search="searchData" />
  17. </div> -->
  18. <div class="facebook">
  19. <svg class="icon" aria-hidden="true">
  20. <use xlink:href="#icon-facebook"></use>
  21. </svg>
  22. <svg class="icon" aria-hidden="true">
  23. <use xlink:href="#icon-twitter"></use>
  24. </svg>
  25. <svg class="icon" aria-hidden="true">
  26. <use xlink:href="#icon-weixin"></use>
  27. </svg>
  28. <svg class="icon" aria-hidden="true">
  29. <use xlink:href="#icon-weibo"></use>
  30. </svg>
  31. <!-- <p class="iconfont icon-facebook"></p>
  32. <p class="iconfont icon-twitter"></p>
  33. <p class="iconfont icon-weixin"></p>
  34. <p class="iconfont icon-weibo"></p> -->
  35. <p @mouseenter="()=>showQRcode=true" @mouseleave="()=>showQRcode=false">APP</p>
  36. <img class="QRcode" v-if='showQRcode' src="~/assets/img/QRcode.png" alt="">
  37. </div>
  38. </div>
  39. </div>
  40. <div class="h-main auto clearfix">
  41. <Row>
  42. <Col :span="24">
  43. <div class="fl h-logo">
  44. <nuxt-link :to="{path:'/'}">
  45. <img src="~/assets/img/logo.png" alt="logo" />
  46. </nuxt-link>
  47. <div>
  48. <span>{{weekDay}}</span>
  49. <span>{{year}}年{{month}}月{{day}}日</span>
  50. </div>
  51. </div>
  52. </Col>
  53. <!-- <Col :span="18">
  54. <h2 class="fr h-logo-ad">
  55. <a :href="headerAdurl" target="view_frame">
  56. <img :src="'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/'+headerAd" alt="">
  57. </a>
  58. </h2>
  59. </Col> -->
  60. </Row>
  61. </div>
  62. <nav class="nav wgw-bg">
  63. <div class="menu">
  64. <Menu mode="horizontal" theme="dark" @on-select="jump" :active-name="activeKey">
  65. <MenuItem name="1">
  66. 首页
  67. </MenuItem>
  68. <MenuItem name="recommend">
  69. 推荐
  70. </MenuItem>
  71. <Submenu name="4">
  72. <template slot="title">
  73. <div @click="jump('4')">
  74. 东盟
  75. </div>
  76. </template>
  77. <MenuItem name="26">柬埔寨</MenuItem>
  78. <MenuItem name="27">马来西亚</MenuItem>
  79. <MenuItem name="28">印度尼西亚</MenuItem>
  80. <MenuItem name="29">泰国</MenuItem>
  81. <MenuItem name="30">菲律宾</MenuItem>
  82. <MenuItem name="31">新加坡</MenuItem>
  83. <MenuItem name="32">文莱</MenuItem>
  84. <MenuItem name="33">越南</MenuItem>
  85. <MenuItem name="34">老挝</MenuItem>
  86. <MenuItem name="35">缅甸</MenuItem>
  87. </Submenu>
  88. <Submenu name="5" >
  89. <template slot="title" >
  90. <div @click="jump('5')">
  91. 中国
  92. </div>
  93. </template>
  94. <MenuItem name="36">中国要闻</MenuItem>
  95. <MenuItem name="15">外媒看中国</MenuItem>
  96. <MenuItem name="18">海外中企</MenuItem>
  97. </Submenu>
  98. <Submenu name="7">
  99. <template slot="title">
  100. <div @click="jump('7')">
  101. 国际
  102. </div>
  103. </template>
  104. <MenuItem name="37">政治</MenuItem>
  105. <MenuItem name="38">军事</MenuItem>
  106. <MenuItem name="39">财经</MenuItem>
  107. <MenuItem name="40">科技</MenuItem>
  108. </Submenu>
  109. <MenuItem name="23">
  110. 观察
  111. </MenuItem>
  112. <MenuItem name="3">
  113. 视频
  114. </MenuItem>
  115. <MenuItem name="6">
  116. 华社
  117. </MenuItem>
  118. <Submenu name="2">
  119. <template slot="title">
  120. <div @click="jump('2')">
  121. 生活
  122. </div>
  123. </template>
  124. <MenuItem name="9">旅游</MenuItem>
  125. <MenuItem name="11">美食</MenuItem>
  126. <MenuItem name="12">健康</MenuItem>
  127. <MenuItem name="13">流行风</MenuItem>
  128. </Submenu>
  129. <Submenu name="41">
  130. <template slot="title">
  131. <div @click="jump('41')">
  132. 文化
  133. </div>
  134. </template>
  135. <MenuItem name="24">玄学</MenuItem>
  136. <MenuItem name="8">娱乐</MenuItem>
  137. <MenuItem name="10">文艺</MenuItem>
  138. </Submenu>
  139. <MenuItem name="22">
  140. 专题
  141. </MenuItem>
  142. <Submenu name="16">
  143. <template slot="title">
  144. <div @click="jump('16')">
  145. 服务
  146. </div>
  147. </template>
  148. <MenuItem name="20">商务投资</MenuItem>
  149. <MenuItem name="21">会展活动</MenuItem>
  150. <MenuItem name="17">国外留学</MenuItem>
  151. <MenuItem name="14">咨询答疑</MenuItem>
  152. <MenuItem name="19">商会信息</MenuItem>
  153. </Submenu>
  154. <!-- <MenuItem name="42">
  155. 词条
  156. </MenuItem> -->
  157. <MenuItem name="43">
  158. English
  159. </MenuItem>
  160. </Menu>
  161. </div>
  162. </nav>
  163. </div>
  164. </template>
  165. <script>
  166. // import { mapMutations, mapState, mapGetters, mapActions } from 'vuex';
  167. import { mainAd } from "~/api/homePage";
  168. import Bus from "~/common/bus"
  169. export default {
  170. data() {
  171. return {
  172. activeKey:'1',
  173. year: "",
  174. month: "",
  175. day: "",
  176. weekDay: "",
  177. id: "",
  178. headerAd:'',
  179. headerAdurl:'',
  180. showQRcode:false
  181. };
  182. },
  183. mounted() {
  184. // this.id = parseInt(this.$route.params.id);
  185. this.getId()
  186. console.log(this.activeKey,'this.activeKey')
  187. var myDate = new Date();
  188. this.year = myDate.getFullYear();
  189. this.month = myDate.getMonth() + 1;
  190. this.day = myDate.getDate();
  191. switch (myDate.getDay()) {
  192. case 1:
  193. this.weekDay = "星期一";
  194. break;
  195. case 2:
  196. this.weekDay = "星期二";
  197. break;
  198. case 3:
  199. this.weekDay = "星期三";
  200. break;
  201. case 4:
  202. this.weekDay = "星期四";
  203. break;
  204. case 5:
  205. this.weekDay = "星期五";
  206. break;
  207. case 6:
  208. this.weekDay = "星期六";
  209. break;
  210. case 0:
  211. this.weekDay = "星期天";
  212. break;
  213. default:
  214. break;
  215. };
  216. mainAd().then(res => {
  217. this.headerAd = res.object['main-0'].adimg;
  218. this.headerAdurl=res.object['main-0'].adurl;
  219. });
  220. },
  221. watch: {
  222. $route() {
  223. this.getId()
  224. // this.$route.name=="content"?this.getColumId():this.id = this.$route.params.id;
  225. // console.log(this.$route.params.id,this.id,'this.$route.params.id')
  226. },
  227. },
  228. methods: {
  229. // culturalLife() {
  230. // // this.$router.push({ path: '/lists/88' })
  231. // // if(this.$route.name!="homePage"){
  232. // // this.$router.push({ path: '/lists/88' })
  233. // // }else{
  234. // // window.scrollTo(0, 3646);
  235. // // }
  236. // },
  237. searchData(val){
  238. if(val!=""){
  239. this.$store.dispatch('saveSearchVal',val);
  240. this.$router.push({ name:'lists'})
  241. }else{
  242. this.$Message.warning('请输入搜索内容!')
  243. }
  244. },
  245. getId(){
  246. if(this.$route.name=="content"){
  247. Bus.$on('columnId', (message) => {
  248. this.id = message;
  249. this.$nextTick(()=>{
  250. this.activeKey=parseInt(message)?message+'':'0';
  251. })
  252. })
  253. }else if(this.$route.name=="lists"){
  254. this.id = parseInt(this.$route.params.id)
  255. this.$nextTick(()=>{
  256. this.activeKey=this.id?this.id+'':'0';
  257. })
  258. }else{
  259. this.$nextTick(()=>{
  260. this.activeKey='1';
  261. })
  262. }
  263. },
  264. jump(name){//菜单跳转
  265. if(name=='1'){
  266. this.$router.push({path:'/homePage'})
  267. this.$nextTick(()=>{
  268. this.activeKey='1';
  269. })
  270. }else{
  271. let routeData = this.$router.resolve({path:'/lists',query:{id:name}});
  272. window.open(routeData.href, '_blank');
  273. }
  274. }
  275. }
  276. };
  277. </script>