pageHead.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <!-- 页面头部 -->
  3. <header>
  4. <!-- 顶部导航 -->
  5. <nav class="headerNav">
  6. <div class="inner">
  7. <div class="left">
  8. <span>中农兴业网团</span>
  9. <span>旗下网站:
  10. <span>农业百强网站(政府类30强)</span>
  11. </span>
  12. </div>
  13. <div class="mid" v-show="!getToken()">
  14. <button class="login" @click="goLogin">登录</button>
  15. <NuxtLink to="/">
  16. <button class="reg">注册</button>
  17. </NuxtLink>
  18. <button class="changePwd">修改密码</button>
  19. </div>
  20. <div class="right">
  21. <el-popover placement="top-start" :width="100" trigger="hover" algin="center" >
  22. <template #reference>
  23. <span v-show="getToken()">
  24. <em class="iconfont icon-gerenzhongxin"></em>
  25. 调查员01
  26. </span>
  27. </template>
  28. <p class="exit" @click="exit">退出</p>
  29. </el-popover>
  30. <!-- <span>
  31. <em class="iconfont icon-gerenzhongxin"></em>
  32. 调查员01
  33. </span> -->
  34. <!-- <div class="btn">
  35. <button>退出</button>
  36. </div> -->
  37. <span>
  38. <em class="home"></em>
  39. 设为首页
  40. </span>
  41. <span>
  42. <em class="collection"></em>
  43. 加入收藏
  44. </span>
  45. </div>
  46. </div>
  47. </nav>
  48. <!-- 头部logo -->
  49. <div class="headerLogo">
  50. <div class="inner">
  51. <img src="../../static/images/image 36@2x.png" alt="" class="left">
  52. <div class="search">
  53. <em></em>
  54. <input type="text" placeholder="输入关键词" v-model="keyword">
  55. <button @click="goSearch">搜索</button>
  56. </div>
  57. <ul class="serve">
  58. <li>
  59. <NuxtLink to="">
  60. <img src="../../static/images/huiyuan 1.png" alt="">
  61. <p>会员服务</p>
  62. </NuxtLink>
  63. </li>
  64. <li>
  65. <NuxtLink to="/advertising" target="_blank">
  66. <img src="../../static/images/lingquguanggao 1.png" alt="">
  67. <p>广告服务</p>
  68. </NuxtLink>
  69. </li>
  70. </ul>
  71. </div>
  72. </div>
  73. </header>
  74. </template>
  75. <script setup>
  76. import { ref, onMounted } from 'vue'
  77. import { ElPopover } from 'element-plus'
  78. import{getToken , setToken , removeToken}from '@/store/useCookieStore'
  79. let token1=getToken()
  80. console.log(token1);
  81. //关键词搜索
  82. // const props = defineProps({
  83. // keyword: String
  84. // });
  85. const nuxtApp = useNuxtApp();
  86. const axios = nuxtApp.$axios;
  87. definePageMeta({
  88. middleware: 'auth'
  89. });
  90. let keyword = ref('')
  91. let token=ref('')
  92. //点击登录按钮
  93. let goLogin = () => {
  94. window.location.href = ("http://admindev.bjzxtw.org.cn/auth/login.php?backurl=http%3a%2f%2faaa.letitgo.cn%2f")
  95. let token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwaHBlcjY2Ni9qd3QiLCJ1aWQiOjczLCJ1c2VyX25hbWUiOiIxNTIxMDIxMTIwMCIsIm1vYmlsZSI6IjE1MjEwMjExMjAwIiwiZW1haWwiOiIxNTIxMDIxMTIwMEBxcS5jb20iLCJsZXZlbF9pZCI6MSwidHlwZV9pZCI6MTAwMDAsImp3dF9zY2VuZSI6ImRlZmF1bHQiLCJqdGkiOiJkZWZhdWx0XzY3MmVmMjBlZWI1Y2Y2LjkzMjE3MzI0IiwiaWF0IjoxNzMxMTI5ODcwLCJuYmYiOjE3MzExMjk4NzAsImV4cCI6MTczMTIxNjI3MH0.9hxH0uEyY8AkPZ9qvyIx1qPbWfRTPAZluYRmIMpRI5Y"
  96. setToken(token)
  97. }
  98. //点击注册按钮
  99. // let goRegister = () => {
  100. // navigateTo('http://admindev.bjzxtw.org.cn/auth/login.php')
  101. // }
  102. //点击退出按钮
  103. let exit = () => {
  104. axios.get(`http://admindev.bjzxtw.org.cn/auth/logoutapi.php?token=${token1}`).then(data=>{
  105. console.log(data);
  106. })
  107. removeToken()
  108. }
  109. //点击搜索按钮
  110. let goSearch = () => {
  111. navigateTo({
  112. path: '/primaryNavigation/newsList',
  113. query: {
  114. keyword: keyword.value
  115. }
  116. })
  117. }
  118. </script>
  119. <style lang="less" scoped>
  120. /* 页面头部 */
  121. header {
  122. width: 100%;
  123. height: 201px;
  124. font-size: 12px;
  125. font-family: PingFang SC-Regular;
  126. color: #666666;
  127. background: url("../../static/images/Group 1505.png") no-repeat;
  128. }
  129. .headerNav {
  130. width: 100%;
  131. height: 42px;
  132. line-height: 42px;
  133. background-color: #fff;
  134. }
  135. .headerNav .left>span {
  136. margin-right: 47px;
  137. }
  138. .headerNav .mid {
  139. float: left;
  140. margin-left: 100px;
  141. button {
  142. font-size: 12px;
  143. color: #666666;
  144. border: none;
  145. background-color: #fff;
  146. }
  147. .login {
  148. width: 36px;
  149. height: 19px;
  150. color: #fff;
  151. border-radius: 4px;
  152. background-color: #028E21;
  153. margin-right: 15px;
  154. }
  155. .reg {
  156. margin-right: 30px;
  157. }
  158. }
  159. .headerNav .right {
  160. span {
  161. margin-left: 26px;
  162. }
  163. .home,
  164. .collection {
  165. display: inline-block;
  166. width: 16px;
  167. height: 16px;
  168. vertical-align: -3px;
  169. }
  170. .home {
  171. background-image: url("../../static/images/Iconly/Light/Home.png");
  172. }
  173. .collection {
  174. background-image: url("../../static/images/Iconly/Light/Star.png");
  175. }
  176. }
  177. /* // 头部logo */
  178. .headerLogo {
  179. height: 156px;
  180. border-bottom: 3px solid #006616;
  181. .inner>img {
  182. width: 342px;
  183. height: 72px;
  184. margin-top: 51px;
  185. }
  186. /* // 搜索框部分 */
  187. .search {
  188. float: left;
  189. width: 440px;
  190. height: 40px;
  191. background-color: #fff;
  192. line-height: 40px;
  193. margin-left: 39px;
  194. margin: 71px 39px 48px;
  195. position: relative;
  196. em {
  197. display: inline-block;
  198. width: 30px;
  199. height: 30px;
  200. background: url("../../static/images/Iconly/Broken/Search.png") no-repeat;
  201. position: absolute;
  202. top: 5px;
  203. left: 15px;
  204. }
  205. input {
  206. float: left;
  207. width: 351px;
  208. height: 40px;
  209. border: none;
  210. outline: none;
  211. padding-left: 65px;
  212. box-sizing: border-box;
  213. border: 1px solid #028E21;
  214. border-right: none;
  215. border-radius: 4px 0px 0px 4px;
  216. }
  217. button {
  218. float: right;
  219. width: 89px;
  220. height: 40px;
  221. background-color: #028E21;
  222. border-radius: 0px 4px 4px 0px;
  223. border: none;
  224. font-size: 14px;
  225. color: #fff;
  226. font-family: PingFang SC, PingFang SC;
  227. font-weight: 500;
  228. }
  229. }
  230. /* // 右侧小图标 */
  231. .serve {
  232. float: right;
  233. height: 60px;
  234. margin-top: 60px;
  235. margin-right: 60px;
  236. >li {
  237. float: left;
  238. height: 64px;
  239. margin-left: 48px;
  240. }
  241. >li>a {
  242. display: inline-block;
  243. height: 64px;
  244. }
  245. >li img {
  246. width: 29px;
  247. height: 29px;
  248. padding: 8px 14px;
  249. }
  250. >li p {
  251. height: 28px;
  252. text-align: center;
  253. color: #666666;
  254. }
  255. }
  256. }
  257. </style>