Sfoglia il codice sorgente

首页市场分类部分完成

Jing 1 settimana fa
parent
commit
af3d3260db

+ 1 - 1
.nuxt/manifest/latest.json

@@ -1 +1 @@
-{"id":"7a69660f-9734-4ce0-b468-a70dc2b08ac5","timestamp":1751441336491}
+{"id":"867d6194-7126-466a-9400-87d13239a347","timestamp":1751597398484}

+ 0 - 1
.nuxt/manifest/meta/7a69660f-9734-4ce0-b468-a70dc2b08ac5.json

@@ -1 +0,0 @@
-{"id":"7a69660f-9734-4ce0-b468-a70dc2b08ac5","timestamp":1751441336491,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 0
.nuxt/manifest/meta/867d6194-7126-466a-9400-87d13239a347.json

@@ -0,0 +1 @@
+{"id":"867d6194-7126-466a-9400-87d13239a347","timestamp":1751597398484,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}

+ 1 - 1
.nuxt/tsconfig.json

@@ -102,7 +102,7 @@
         "./imports"
       ],
       "#app-manifest": [
-        "./manifest/meta/7a69660f-9734-4ce0-b468-a70dc2b08ac5.json"
+        "./manifest/meta/867d6194-7126-466a-9400-87d13239a347.json"
       ],
       "#components": [
         "./components"

+ 15 - 5
assets/css/index.less

@@ -606,7 +606,7 @@ section {
 .index_4_img_box {
     float: left;
     width: 100px;
-    height: 340px;
+    height: 500px;
     background-image: url(@/public/img/7.png);
 }
 
@@ -617,12 +617,14 @@ section {
 
 .index_4_ol_li {
     float: left;
-    width: 182px;
+    width: 230px;
+    height: 130px;
     background: #fff;
     border: solid 1px #fff;
     border-radius: 6px;
     padding-bottom: 4px;
-    margin: 20px 0px 0px 30px;
+    margin: 20px 0px 0px 34px;
+    // box-sizing: border-box;
 
     .index_4_ol_li_head {
         margin: 15px 0px 13px;
@@ -648,7 +650,7 @@ section {
 
 .index_4_ol_in_li_a {
     float: left;
-    width: 91px;
+    width: 115px;
     height: 18px;
     line-height: 18px;
     box-sizing: border-box;
@@ -666,7 +668,7 @@ section {
 }
 
 .index_4_ol_in_li_a:nth-of-type(even) {
-    padding-left: 3px;
+    padding-left: 15px;
 }
 
 .index_4_ol_li:nth-of-type(1) .index_4_ol_li_head_a {
@@ -709,6 +711,14 @@ section {
     background-image: url(@/public/img/20.png);
 }
 
+.index_4_ol_li:nth-of-type(11) .index_4_ol_li_head_a {
+    background-image: url(@/public/img/21.png);
+}
+
+.index_4_ol_li:nth-of-type(12) .index_4_ol_li_head_a {
+    background-image: url(@/public/img/22.png);
+}
+
 .index_5 {
     margin: 30px auto 15px;
 }

+ 51 - 10
pages/index.vue

@@ -310,29 +310,40 @@
                 <!--open   市场分类-->
                 <div class="index_head_btn_box">
                     <div class="index_head_btn index_head_btn_only">
-                        <a class="index_head_a" href="" title="">市场分类</a>
+                        <span class="index_head_a">市场分类</span>
                     </div>
+                    <!-- 长度最多可以放8个 -->
                     <div class="index_head_right_btn_box">
-                        <a class="index_2_head_right_a" href="" title="">农产商家</a>
-                        <a class="index_2_head_right_a" href="" title="">市场信息</a>
-                        <a class="index_2_head_right_a" href="" title="">书刊音像</a>
-                        <a class="index_2_head_right_a" href="" title="">生活用品</a>
+                        <a class="index_2_head_right_a" v-for="(item, index) in navigation.slice(0, 8)" :key="index"
+                            :href="getLinkPath(item)" :title="item.alias">
+                            {{ item.alias }}
+                        </a>
                     </div>
                     <div class="index_head_btn_right_box">
-                        <a class="index_head_btn_right_a" href="" title="">发布信息</a>
+                        <span class="index_head_btn_right_a" @click="goAddShop">发布信息</span>
                     </div>
                 </div>
                 <div class="index_4_in clearfix">
                     <div class="index_4_img_box back100">
                     </div>
                     <div class="index_4_ol clearfix">
-                        <div class="index_4_ol_li" v-for="(per_obj, per_index) in 10" :key="per_obj">
+                        <div class="index_4_ol_li" v-for="(item, index) in navigation" :key="index">
                             <div class="index_4_ol_li_head clearfix">
-                                <a class="index_4_ol_li_head_a dot1" href="" title="">粮油茶糖</a>
+                                <a class="index_4_ol_li_head_a dot1" :href="getLinkPath(item)" :title="item.alias">
+                                    {{ item.alias }}
+                                </a>
                             </div>
                             <div class="index_4_ol_in clearfix">
-                                <a class="index_4_ol_in_li_a dot1" href="" title="" v-for="(per_obj, per_index) in 6"
-                                    :key="per_obj">粮油茶糖粮</a>
+                                <a class="index_4_ol_in_li_a dot1"
+                                    :href="`${item.aLIas_pinyin}/${item1.aLIas_pinyin}/list-1.html`"
+                                    :title="item1.alias" v-for="(item1, index1) in item.children.slice(0, 5)"
+                                    :key="index1">
+                                    {{ item1.alias }}
+                                </a>
+                                <a class="index_4_ol_in_li_a dot1" :href="getLinkPath(item)" :title="item.alias"
+                                    v-if="item.children.length > 5">
+                                    更多 &gt;
+                                </a>
                             </div>
                         </div>
                     </div>
@@ -646,6 +657,9 @@
 //0.加载页面必备组件 start---------------------------------------->
 import { ref, onMounted } from 'vue';
 import { ElMessage } from 'element-plus';
+import { getToken } from '@/store/useCookieStore'
+//获得全局url
+const { $BwebUrl, $CwebUrl } = useNuxtApp();
 //0.加载页面必备组件 end---------------------------------------->
 
 //1.获取头条新闻 start---------------------------------------->
@@ -680,6 +694,15 @@ async function getModelData1() {
 }
 getModelData1()
 
+// 1.2 跳转
+let goAddShop = () => {
+    if (getToken()) {
+        window.open($BwebUrl + '/#/addGood', '_blank');
+    } else {
+        ElMessage.error('请先登录!')
+    }
+}
+
 //1.3 今日热点
 const hotNewsList = ref("")
 async function getModelData3() {
@@ -702,6 +725,24 @@ async function getModelData3() {
     }
 }
 getModelData3()
+
+// 1.4 获取商城导航菜单
+const navigation = ref([]);
+async function getNavigation() {
+    const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
+        method: 'GET',
+        query: {
+            'pid': 0,
+            'num': 12,
+            'placeid': 13,
+            'type': 1,
+        },
+    });
+    console.log("获取商城导航菜单", mkdata.data);
+
+    navigation.value = mkdata.data;
+}
+getNavigation();
 //1.获取头条新闻 end---------------------------------------->
 
 //2.选项卡 start---------------------------------------->

+ 2 - 2
plugins/category.ts

@@ -30,7 +30,7 @@ const navPre: number[] = [
 
 export default defineNuxtPlugin((nuxtApp) => {
     //master 环境
-    nuxtApp.provide('pageNav', navMaster)
+    // nuxtApp.provide('pageNav', navMaster)
     //pre 环境
-    // nuxtApp.provide('pageNav', navPre)
+    nuxtApp.provide('pageNav', navPre)
 })

+ 10 - 10
plugins/globals.ts

@@ -1,17 +1,17 @@
 export default defineNuxtPlugin((nuxtApp) => {
   //农副产品供销网pre环境
-  // nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
-  // nuxtApp.provide('CwebUrl', 'http://pre.nfcpgx.org.cn')
-  // nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
-  // nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
-  // nuxtApp.provide('userUrl', 'http://localhost:3005')
+  nuxtApp.provide('webUrl', 'http://apipre1.bjzxtw.org.cn:29501')
+  nuxtApp.provide('CwebUrl', 'http://pre.nfcpgx.org.cn')
+  nuxtApp.provide('BwebUrl', 'http://adminpre.bjzxtw.org.cn')
+  nuxtApp.provide('LoginWebUrl', 'http://adminpre.bjzxtw.org.cn/adminapi')
+  nuxtApp.provide('userUrl', 'http://localhost:3005')
 
   // 农副产品供销网正式环境
-  nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
-  nuxtApp.provide('CwebUrl', 'http://nw.nfcpgx.org.cn')
-  nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
-  nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
-  nuxtApp.provide('userUrl', 'http://localhost:3005')
+  // nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')
+  // nuxtApp.provide('CwebUrl', 'http://nw.nfcpgx.org.cn')
+  // nuxtApp.provide('BwebUrl', 'https://admin.bjzxtw.org.cn')
+  // nuxtApp.provide('LoginWebUrl', 'http://admin.bjzxtw.org.cn/adminapi')
+  // nuxtApp.provide('userUrl', 'http://localhost:3005')
 
   // 农副产品供销网正式环境
   // nuxtApp.provide('webUrl', 'https://flzxw.bjzxtw.org.cn')

+ 4 - 4
plugins/request.ts

@@ -6,11 +6,11 @@ export default defineNuxtPlugin(() => {
 
     let Url = {
         //正式环境
-        webUrl: 'https://flzxw.bjzxtw.org.cn', //接口地址
-        CwebUrl: 'nw.nfcpgx.org.cn' //页面地址
+        // webUrl: 'https://flzxw.bjzxtw.org.cn', //接口地址
+        // CwebUrl: 'nw.nfcpgx.org.cn' //页面地址
         //pre环境
-        // webUrl: 'http://apipre1.bjzxtw.org.cn:29501', //pre接口地址
-        // CwebUrl: 'pre.nfcpgx.org.cn' //页面地址
+        webUrl: 'http://apipre1.bjzxtw.org.cn:29501', //pre接口地址
+        CwebUrl: 'pre.nfcpgx.org.cn' //页面地址
     }
 
     const service = axios.create({

BIN
public/img/21.png


BIN
public/img/22.png


BIN
public/img/7.png