File tree 3 files changed +53
-1
lines changed 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { get } from '../utils/request'
2
+
3
+ export function getTotic ( params ) {
4
+ /**
5
+ * @description 获取主题
6
+ * @param {string } tab 顶部tab,如果全部,可不传或all,其他使用 node name
7
+ * @param {number } p 第几页,不传代表第1页
8
+ */
9
+ return get ( '/topics' , params )
10
+ }
11
+ export function getToticDetail ( params ) {
12
+ /**
13
+ * @description 获取主题详情
14
+ * @param {number } tid 主题id
15
+ */
16
+ return get ( '/topic/detail' , params )
17
+ }
18
+
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default Vue.extend({
21
21
name: ' Article' ,
22
22
data () {
23
23
return {
24
- article: {
24
+ article: {
25
25
author: {
26
26
avatar: ' http://img1.3lian.com/gif/more/11/2012/03/d037a77443c0a72a1432d815cd3b5724.jpg' ,
27
27
nickname: ' 昵称'
Original file line number Diff line number Diff line change
1
+
2
+ const baseUrl = 'https://studygolang.com/app'
3
+ function request ( { url, data, method } ) {
4
+ const header = {
5
+ token : wx . getStorageSync ( 'token' ) || '' ,
6
+ }
7
+ return new Promise ( ( resove , reject ) => {
8
+ wx . request ( {
9
+ url : baseUrl + url ,
10
+ method,
11
+ data : { ...data , from : 4 } ,
12
+ header,
13
+ success : ( res ) => {
14
+ resove ( res . data )
15
+ } ,
16
+ fail : ( res ) => {
17
+ reject ( res )
18
+ }
19
+ } )
20
+ } )
21
+ }
22
+
23
+ function get ( url , data ) {
24
+ return request ( { url, method : 'get' , data } )
25
+ }
26
+ function post ( url , data ) {
27
+ return request ( { url, method : 'post' , data } )
28
+ }
29
+
30
+ export {
31
+ request ,
32
+ get ,
33
+ post
34
+ }
You can’t perform that action at this time.
0 commit comments