Browse Source

fix:接口联调

Cooklalala 5 months ago
parent
commit
973c3cfea1
5 changed files with 30 additions and 28 deletions
  1. 2 2
      mm/mm.config.js
  2. 5 1
      src/components/bgBox/index.vue
  3. 2 2
      src/config.js
  4. 20 14
      src/views/page1/index.vue
  5. 1 9
      src/views/page2/leftBox.vue

+ 2 - 2
mm/mm.config.js

@@ -23,10 +23,10 @@ module.exports = async (util) => {
     replayPort: 8101,
     watch: [`./api/`],
     proxy: {
-      '/': `http://192.168.1.70:8080/`, // 后端接口主域
+      '/': `http://192.168.1.196:8088/`, // 后端接口主域
       '/anything/intercept': [`origin`, `127.0.0.1`], // 修改接口返回的数据
     },
-    api: {
+    apiX: {
       'get /api/currentWeather': util.side({
         tags: [`公用`],
         summary: `当前天气`,

+ 5 - 1
src/components/bgBox/index.vue

@@ -119,7 +119,11 @@ export default {
   },
   methods: {
     async currentWeather() {
-      const data = await this.$http.get(`/api/currentWeather`)
+      const data = await this.$http.get(`/api/currentWeather`, {
+        params: {
+          adcode: `520600`,
+        },
+      })
       const item = getWeather(data.天气)
       this.weather = data
       this.weather.天气图标 = item.icon || `icon-duoyun`

+ 2 - 2
src/config.js

@@ -1,8 +1,8 @@
 export default {
   development: {
-    baseApi: `http://127.0.0.1:8100`,
+    baseApi: `http://192.168.1.86:8100`,
   },
   prod: {
-    baseApi: `http://127.0.0.1:8100`,
+    baseApi: `http://192.168.1.86:8100`,
   },
 }[process.env.NODE_ENV || `prod`]

+ 20 - 14
src/views/page1/index.vue

@@ -220,21 +220,27 @@ export default {
         })
     },
     getWeatherForecast() {
-      return this.$http.get(`/api/weatherForecast`).then((res) => {
-        const area = []
-        const dataArray = {
-          temperature: [],
-          Weather: [],
-        }
-        res.forEach((element) => {
-          area.push(element.时间)
-          dataArray.temperature.push(element.温度)
-          dataArray.Weather.push(element.天气)
+      return this.$http
+        .get(`/api/weatherForecast`, {
+          params: {
+            adcode: `520600`,
+          },
+        })
+        .then((res) => {
+          const area = []
+          const dataArray = {
+            temperature: [],
+            Weather: [],
+          }
+          res.forEach((element) => {
+            area.push(element.时间)
+            dataArray.temperature.push(element.温度)
+            dataArray.Weather.push(element.天气)
+          })
+          this.Weatherarea = area
+          this.WeatherdataArray = dataArray
+          this.isWeather = true
         })
-        this.Weatherarea = area
-        this.WeatherdataArray = dataArray
-        this.isWeather = true
-      })
     },
     getTransplantAreaInEachRegion() {
       return this.$http.get(`/api/transplantAreaInEachRegion`).then((res) => {

+ 1 - 9
src/views/page2/leftBox.vue

@@ -45,15 +45,7 @@ export default {
   methods: {
     async searchFn() {
       console.log(`search`, this.leftBox.input)
-      const data = await this.$http.get(`/base`, {
-        params: {
-          _sort:
-            this.leftBox.sortList[
-              this.leftBox.sortIndex % this.leftBox.sortList.length
-            ] || undefined,
-          名称_like: this.leftBox.input || undefined,
-        },
-      })
+      const data = await this.$http.get(`/api/getAllDistrict`)
       this.leftBox.list = []
       this.$nextTick(() => {
         this.leftBox.list = data