2ed56652c67a71068715717d892bf72e1d4abb1d.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div>
  3. <div class="box">
  4. <div class="row allAlignment center head_on_box">
  5. <p
  6. class="logo"
  7. style="font-size:.6rem;color:#E1E1DF;font-family: 'Franklin Gothic Medium'"
  8. >
  9. <i style="color:#F76649;">HX</i>669
  10. </p>
  11. <!-- <img class="log" src="../assets/st-imges/indexlogo.png" alt=""> -->
  12. <div class="row allAlignment center">
  13. <yd-button type="primary" bgcolor="rgba(0,0,0,0)" @click.native="goBack()">
  14. <img class="user-ion" src="../assets/st-imges/back.png" alt>
  15. </yd-button>
  16. <yd-button type="primary" bgcolor="rgba(0,0,0,0)" @click.native="refresh()">
  17. <img class="user-ion" src="../assets/st-imges/ooopic.png" alt>
  18. </yd-button>
  19. <yd-button type="primary" bgcolor="rgba(0,0,0,0)" @click.native="urseInfo()">
  20. <img class="user-ion" src="../assets/st-imges/user.png" alt>
  21. </yd-button>
  22. <!-- <div v-if="nameShow" class="row allAlignment center username">
  23. {{name}}
  24. </div>-->
  25. <img
  26. style="margin-left: 0.44rem;"
  27. class="user-ion"
  28. src="../assets/st-imges/contact.png"
  29. alt
  30. >
  31. </div>
  32. </div>
  33. <div class="navtitle-box row">
  34. <div style="width:1rem;height:1rem" class="row center">
  35. <img
  36. @click="returnHome"
  37. :src="headActive=='home'?img1:img2"
  38. style="width:0.4rem;height:0.4rem;"
  39. alt
  40. >
  41. </div>
  42. <div class="head_box">
  43. <nav>
  44. <div v-for="(item,$index) in title" class="row" :key="item.id">
  45. <div class="row item-center nav-arr ">
  46. <div
  47. class="headbox"
  48. @click="activityJump($index,item.type_code)"
  49. :class="{active:headActive==item.type_code}"
  50. >{{item.type_name}}</div>
  51. <span
  52. :class="{numactive:headActive==item.type_code}"
  53. class="head_box_num row center"
  54. >{{item.matchNum>99?'1+':item.matchNum}}</span>
  55. </div>
  56. </div>
  57. </nav>
  58. </div>
  59. </div>
  60. </div>
  61. <div v-if="Lshow==true" class="login">
  62. <Login></Login>
  63. </div>
  64. <div v-else-if="rgShow==true">
  65. <register></register>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import "../css/index.css";
  71. import Login from "@/pages/Login/index/StLogin";
  72. import register from "@/pages/Login/index/register";
  73. export default {
  74. name: "SportsHead",
  75. components: {
  76. Login,
  77. register
  78. },
  79. data() {
  80. return {
  81. show: false,
  82. img1: require("../assets/st-imges/home.png"),
  83. img2: require("../assets/st-imges/gengduo-1.png"),
  84. title:'',
  85. headActive: "",
  86. init: true,
  87. nameShow: false, //展示登录组件或者是名字
  88. timers: true, //定时器清理
  89. Lshow: false,
  90. rgShow: false, //隐藏注册框
  91. getIsShow:true
  92. };
  93. },
  94. methods: {
  95. //判断登录是否过期
  96. getuserData(){
  97. if(localStorage.getItem('token')){
  98. this.$http.post(this.$ports.login.getAgent,{token:localStorage.getItem('token')}).then(res=>{
  99. if(res.data.status==-4001){
  100. this.$store.dispatch('SET_TOKEN','');
  101. this.$store.dispatch('GET_ISSHOW',false);
  102. this.$dialog.toast({mes: '对不起您的登录已过期,请您重新登录', timeout: 3000});
  103. }
  104. })
  105. }
  106. },
  107. urseInfo() {
  108. if (!localStorage.getItem("token")) {
  109. this.$store.dispatch("GET_ISSHOW", true);
  110. // 设置背景禁止滚动
  111. this.$store.dispatch('SET_NOROLL',true)
  112. } else {
  113. this.$router.push("/PersonalCenter");
  114. }
  115. },
  116. // 刷新
  117. refresh() {
  118. location.reload();
  119. },
  120. // 返回上一页
  121. goBack() {
  122. this.$router.go(-1);
  123. },
  124. // 数据封装
  125. getAjax() {
  126. //this.$store.dispatch("GETSHOW", true);
  127. this.$http.get(this.$ports.home.navTypeList).then(res => {
  128. if (res.data.status == 1) {
  129. this.title = res.data.data;
  130. this.$store.dispatch("SET_HEADTITLE", res.data.data);
  131. }
  132. });
  133. },
  134. /**
  135. * 头部导航
  136. */
  137. activityJump: function(index, code) {
  138. // 头部激活样式
  139. if(this.headActive!=code){
  140. this.headActive = code;
  141. }
  142. this.indeximg = false;
  143. this.$store.dispatch("GETACTIVITY", code); //将活动类别存入vuex里面
  144. if (this.$route.query.isTrue) return false;
  145. this.$router.replace({
  146. path: "/StRollBallpage",
  147. query: { home: 1 }
  148. });
  149. },
  150. /**
  151. * 回到首页
  152. */
  153. returnHome: function() {
  154. this.headActive='home'
  155. this.$store.dispatch("GETACTIVITY", "home");
  156. this.$router.replace({ path: "/" });
  157. }
  158. },
  159. /**
  160. *
  161. */
  162. computed: {
  163. // 获取登录注册状态
  164. loginAntReg: function() {
  165. return {
  166. isshow_code: this.$store.getters.getIsShow,
  167. rgShow: this.$store.getters.getRgShow
  168. };
  169. },
  170. },
  171. /**
  172. *
  173. */
  174. watch: {
  175. // 获取登录注册状态
  176. loginAntReg(obj) {
  177. this.Lshow = obj.isshow_code;
  178. this.rgShow = obj.rgShow;
  179. }
  180. },
  181. mounted() {
  182. // 导航样式初始化
  183. if (localStorage.getItem("activity")) {
  184. this.headActive = localStorage.getItem("activity");
  185. }else{
  186. this.headActive='home';
  187. this.$store.dispatch("GETACTIVITY", "home");
  188. }
  189. // 头部导航数据判断储存和更换
  190. if (this.$store.getters.getHeadTitle) {
  191. this.title = this.$store.getters.getHeadTitle;
  192. } else {
  193. this.getAjax();
  194. }
  195. if (localStorage.getItem("name")) {
  196. this.name = localStorage.getItem("name");
  197. this.nameShow = true;
  198. } else {
  199. this.nameShow = false;
  200. }
  201. // 轮询获取头部导航信息
  202. let _this = this;
  203. this.$public.ajaxTimerFun(function(timing) {
  204. if (_this.timers) {
  205. _this.getAjax();
  206. _this.getuserData()
  207. }else{
  208. clearInterval(timing);
  209. }
  210. },(1000*60));
  211. },
  212. beforeDestroy() {
  213. this.timers = false;
  214. },
  215. beforeUpdate(){
  216. // 获取url进入首页更改样式
  217. if(localStorage.getItem("activity")=='home'){
  218. this.headActive='home';
  219. }
  220. }
  221. };
  222. </script>
  223. <style scoped>
  224. .no-roll{
  225. position: fixed;
  226. top: 0;
  227. left: 0;
  228. }
  229. .head_on_box {
  230. padding: 0 .32rem;
  231. }
  232. .box {
  233. height: 1.76rem;
  234. background: linear-gradient(to bottom, #999999, #6a6a6b);
  235. overflow: hidden;
  236. }
  237. .navtitle-box {
  238. height: 1rem;
  239. padding: 0 0.32rem 0 0;
  240. }
  241. .headbox {
  242. font-size: 0.3rem;
  243. font-weight: bold;
  244. color: #e1e1df;
  245. }
  246. .head_box {
  247. width: 86%;
  248. height: 1rem;
  249. overflow: hidden;
  250. }
  251. .head_box nav {
  252. /* display: -webkit-box;
  253. display: -ms-flexbox;
  254. -webkit-box-align: middle;
  255. height: 1rem;
  256. -ms-flex-align: middle;
  257. align-items: middle;
  258. overflow-x: auto;
  259. -webkit-overflow-scrolling: touch; */
  260. display: -webkit-box;
  261. display: -ms-flexbox;
  262. display: flex;
  263. -webkit-box-align: middle;
  264. -ms-flex-align: middle;
  265. align-items: middle;
  266. overflow: auto;
  267. }
  268. /* .navtitle {
  269. font-size: 0.16rem;
  270. height: 1rem;
  271. -ms-flex-negative: 0;
  272. flex-shrink: 0;
  273. } */
  274. /* nav{
  275. width: 8.39rem;
  276. } */
  277. .nav-arr {
  278. width: 1.3rem;
  279. /* margin: 0 0.1rem; */
  280. font-size: 0.16rem;
  281. height: 1rem;
  282. }
  283. .user-ion {
  284. width: 0.3rem;
  285. height: 0.3rem;
  286. }
  287. div.active {
  288. color: #f76649;
  289. }
  290. .numactive {
  291. background: #f76649 !important;
  292. color: #f8f8f8 !important;
  293. }
  294. .head_box_num {
  295. width: 0.4rem;
  296. height: 0.4rem;
  297. border-radius: 50%;
  298. font-size: 0.2rem;
  299. background: #e1e1df;
  300. color: #333;
  301. margin-left: 0.1rem;
  302. }
  303. .username {
  304. color: #e1e1df;
  305. }
  306. </style>