许成详 6 年之前
父節點
當前提交
5c1f000d3d
共有 2 個檔案被更改,包括 17 行新增36 行删除
  1. 16
    35
      config/api.js
  2. 1
    1
      pages/ActivityDetail/index.js

+ 16
- 35
config/api.js 查看文件

@@ -17,20 +17,12 @@ const $api = {
17 17
     update: {
18 18
       method: 'PUT',
19 19
       url: `${BaseAPIURl}wx/user`
20
-    },
21
-    appointment: {
22
-      method: 'GET',
23
-      url: `${BaseAPIURl}wx/appointment/:openid`
24
-    },    
25
-    delAppointment: {
26
-      method: 'DELETE',
27
-      url: `${BaseAPIURl}wx/appointment/of/:id`
28 20
     }
29 21
   },
30 22
   dict: {
31 23
     list: {
32 24
       methods: 'GET',
33
-      url: `${BaseAPIURl}dict`
25
+      url: `${BaseAPIURl}/dict`
34 26
     }
35 27
   },
36 28
   banner: {
@@ -46,7 +38,7 @@ const $api = {
46 38
     },
47 39
     detail: {
48 40
       method: 'GET',
49
-      url: `${BaseAPIURl}wx/buildingSelectId/:id`
41
+      url: `${BaseAPIURl}/wx/buildingSelectId/:id`
50 42
     }
51 43
   },
52 44
   dynamic: { // 项目
@@ -72,25 +64,31 @@ const $api = {
72 64
   appointment: {
73 65
     getByUser: {
74 66
       method: 'GET',
75
-      url: `${BaseAPIURl}wx/appointment/:openid`
67
+      url: `${BaseAPIURl}/wx/appointment/:openid`
76 68
     },
77 69
     save: {
78 70
       method: 'POST',
79
-      url: `${BaseAPIURl}wx/appointment/:openid`
71
+      url: `${BaseAPIURl}/wx/appointment/:openid`
80 72
     }
81 73
   },
82 74
   collection: {
83 75
     getByUser: {
84 76
       method: 'GET',
85
-      url: `${BaseAPIURl}wx/collection/:openid`
77
+      url: `${BaseAPIURl}/wx/collection/:openid`
86 78
     },
87 79
     save: {
88 80
       method: 'POST',
89
-      url: `${BaseAPIURl}wx/collection/:openid`
81
+      url: `${BaseAPIURl}/wx/collection/:openid`
90 82
     },
91 83
     deleteById: {
92 84
       method: 'DELETE',
93
-      url: `${BaseAPIURl}wx/collection/:openid`
85
+      url: `${BaseAPIURl}/wx/collection/:openid`
86
+    }
87
+  },
88
+  comment: {
89
+    list: { // 评论列表
90
+      methods: 'GET',
91
+      url: `${BaseAPIURl}/wx/comment/list`
94 92
     }
95 93
   }
96 94
 }
@@ -98,9 +96,9 @@ const $api = {
98 96
 const hasKey = (o, k) => Object.keys(o).indexOf(k) > -1
99 97
 
100 98
 // 获取 api 支持 a.b.c 字符串格式
101
-function get(k = '', urlParams = {}) {
99
+function get(k = '') {
102 100
   let found = true
103
-  const api = k.split('.').reduce((acc, key) => {
101
+  return k.split('.').reduce((acc, key) => {
104 102
     if (!found) return acc;
105 103
 
106 104
     if (acc === 0) {
@@ -118,27 +116,10 @@ function get(k = '', urlParams = {}) {
118 116
         return acc
119 117
       }
120 118
     }
121
-<<<<<<< HEAD
122
-  },
123
-  comment: {
124
-    list: { // 评论列表
125
-      methods: 'GET',
126
-      url: `${BaseAPIURl}/wx/comment/list`
127
-    }
128
-=======
129 119
   }, 0)
130
-
131
-  return {
132
-    ...api,
133
-    url: api.url.split('/').map((item) => {
134
-      const key = item.replace(':', '')
135
-      return item !== 'https:' && hasKey(urlParams, key) ? urlParams[key] : item
136
-    }).join('/')
137
->>>>>>> 654f865abc085b939a020914c39080d00a3ad02a
138
-  }
139 120
 }
140 121
 
141 122
 module.exports = {
142 123
   $api: $api,
143 124
   get: get,
144
-}
125
+}

+ 1
- 1
pages/ActivityDetail/index.js 查看文件

@@ -86,7 +86,7 @@ Page({
86 86
     }
87 87
   },
88 88
   GetCommentList() { // 获取评论列表
89
-    HttpSever.Ajax({
89
+    fetch({
90 90
       url: $api.comment.list.url + '?pageNum=1&pageSize=10000&commentType=activity&mainId=' + this.data.Id,
91 91
       method: $api.comment.list.method
92 92
     }).then((res) => {