Panel.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <main class="panel_main">
  3. <div class="panel_head_box">
  4. <span class="panel_head_btn" @click="close_panel_btn_fun"></span>
  5. <h4 class="panel_head_h4">
  6. 网站地图
  7. </h4>
  8. </div>
  9. <section class="panel_long clearfix">
  10. <div class="panel_main_in">
  11. <!-- 首页 -->
  12. <div class="panel_box">
  13. <div class="panel_a_box ">
  14. <NuxtLink to="/" title="首页" class="panel_a_btn">
  15. 首页
  16. </NuxtLink>
  17. <NuxtLink class="panel_a_btn"
  18. v-for="(item, index) in navigation1" :key="index"
  19. @click="getLinkPath(item)"
  20. :target="item.is_url == 1 ? '_blank' : '_self'"
  21. >
  22. {{ item.alias }}
  23. </NuxtLink>
  24. <!--
  25. <NuxtLink class="panel_a_btn"
  26. v-for="(item, index) in navigation2" :key="index"
  27. @click="getLinkPath(item)"
  28. :target="item.is_url == 1 ? '_blank' : '_self'"
  29. >
  30. 2{{ item.alias }}
  31. </NuxtLink> -->
  32. </div>
  33. </div>
  34. <!-- 互动推荐 -->
  35. <div class="panel_box phone_none" >
  36. <div class="panel_name_box">
  37. <div class="panel_name">互动推荐</div>
  38. </div>
  39. <div class="panel_a_box ">
  40. <NuxtLink class="panel_a_btn"
  41. v-for="(item, index) in navigation2" :key="index"
  42. @click="getLinkPath(item)"
  43. :target="item.is_url == 1 ? '_blank' : '_self'"
  44. >
  45. {{ item.alias }}
  46. </NuxtLink>
  47. </div>
  48. </div>
  49. </div>
  50. </section>
  51. </main>
  52. </template>
  53. <script setup>
  54. //3.获取导航菜单 start ---------------------------------------->
  55. const navigation1 = ref([]);
  56. const navigation2 = ref([]);// 互动推荐
  57. const navigation3 = ref([]);// 深度服务
  58. const province_arr = ref([]);// 省列表
  59. // 引入全局状态
  60. const panelVisible = useState('panelVisible')
  61. //获得详情id
  62. const route = useRoute();
  63. const router = useRouter();
  64. // 关闭面板
  65. const close_panel_btn_fun = () => {
  66. panelVisible.value = false
  67. }
  68. //获取导航菜单1
  69. async function getNavigation1() {
  70. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  71. method: 'GET',
  72. query: {
  73. 'pid': 0,
  74. 'num': 999,
  75. 'placeid': 1
  76. },
  77. });
  78. navigation1.value = mkdata.data;
  79. }
  80. getNavigation1();
  81. //深度服务
  82. async function getNavigation3() {
  83. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  84. method: 'GET',
  85. query: {
  86. 'pid': 0,
  87. 'num': 6,
  88. 'placeid': 33
  89. },
  90. });
  91. navigation3.value = mkdata.data;
  92. }
  93. getNavigation3();
  94. //获取导航菜单4--互动推荐
  95. async function getNavigation2() {
  96. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  97. method: 'GET',
  98. query: {
  99. 'pid': 0,
  100. 'num': 999,
  101. 'placeid': 11
  102. },
  103. });
  104. navigation2.value = mkdata.data;
  105. }
  106. getNavigation2();
  107. const getLinkPath = (item) => {
  108. close_panel_btn_fun()
  109. let linkPath = ''
  110. if (item.is_url == 1) {
  111. linkPath = `/${item.web_url}`;
  112. } else if (item.children_count == 0) {
  113. //return `/newsList/${item.category_id}?page=1`;
  114. linkPath = `/${item.aLIas_pinyin}/list-1.html`;
  115. } else {
  116. //return `/primaryNavigation/${item.aLIas_pinyin}/`;
  117. linkPath = `/${item.aLIas_pinyin}/index.html`;
  118. }
  119. // router.push(linkPath)
  120. return navigateTo({
  121. path: linkPath,
  122. })
  123. }
  124. import { watch } from 'vue'
  125. onMounted(() => {
  126. const delayTimer_hid = ref(null);//延迟器
  127. delayTimer_hid.value = setTimeout(() => {
  128. watch(panelVisible, (newValue, oldValue) => {
  129. // 根据panelVisible的状态执行不同操作
  130. if (newValue) {
  131. document.body.classList.add("body_hid")
  132. } else {
  133. // 面板隐藏时的操作
  134. document.body.classList.remove('body_hid')
  135. }
  136. })
  137. }, 333);
  138. })
  139. </script>
  140. <style lang="less" scoped>
  141. // @import url('@/assets/css/nav.less');
  142. </style>
  143. <style lang="less" scoped>
  144. @media screen and (max-width:800px){/*ipad_phone*/
  145. .dot1{word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis; }
  146. .panel_main{
  147. position:fixed;
  148. top:0px;
  149. left:0px;
  150. width:100%;
  151. height:100%;
  152. background:#F6F6F6;
  153. z-index:1999;
  154. overflow:hidden;
  155. }
  156. .panel_head_box{
  157. width:97%;margin:0px auto 4px;
  158. height:50px;border-bottom:1px solid #b8b8b8;
  159. text-align:center;position:relative;
  160. }
  161. .panel_long{
  162. height:100%;
  163. overflow:auto;
  164. }
  165. .panel_head_h4{height:50px;line-height:50px;display:inline-block;
  166. font-size:22px;color:#333;text-align:center;}
  167. .panel_head_btn{float:right;width:22px;height:22px; top:12px;
  168. position:absolute;right:0px;
  169. background:url('../../public/image/guanbi 1.png') no-repeat center center;
  170. background-size:100% 100%;
  171. }
  172. .panel_main_in{width:96%;margin:0px auto;padding-bottom:66px;}
  173. .panel_box{}
  174. .panel_name_box{
  175. width:100%;
  176. height:44px;
  177. }
  178. .panel_name{
  179. float:left;font-weight:bold;
  180. height:44px;
  181. line-height:44px;
  182. font-size:16px;
  183. color:#333;
  184. // padding-left:20px;
  185. }
  186. .panel_a_box{
  187. width:100%;
  188. overflow:hidden;
  189. margin-bottom:10px;
  190. }
  191. .panel_box_line{
  192. border-bottom:1px solid #ddd;
  193. }
  194. .panel_a_btn{
  195. float:left;
  196. width:23%;margin: 2% 1%;box-sizing:border-box;text-align:center;
  197. height:44px;
  198. line-height:44px;
  199. font-size:12px;
  200. color:#333;
  201. padding:0 4px;background:#F6F6F6;border:solid 1px #ddd;
  202. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  203. }
  204. .panel_a_btn_2{
  205. float:left;
  206. width:14%;margin:4px 1.3%;box-sizing:border-box;text-align:center;
  207. height:33px;
  208. line-height:33px;
  209. font-size:14px;
  210. color:#333;
  211. padding:0 8px;background:#F6F6F6;border:solid 1px #ddd;
  212. }
  213. }
  214. </style>
  215. <style>
  216. @media screen and (min-width:801px){/*pc*/
  217. .pc_none{display:none;}
  218. }
  219. @media screen and (max-width:800px){/*ipad_phone*/
  220. .body_hid{
  221. overflow:hidden;
  222. }
  223. .phone_none{display:none;}
  224. }
  225. </style>