zlisen 3 vuotta sitten
vanhempi
commit
8d7854aec9

+ 2
- 2
config/dev.js Näytä tiedosto

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"http://127.0.0.1:8081"',
6
+    HOST: '"https://xlk.njyz.tech"',
7
+    // HOST: '"http://127.0.0.1:8081"',
8 8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9 9
     OSS_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',

+ 6
- 0
src/constants/api.js Näytä tiedosto

@@ -254,3 +254,9 @@ export const API_TEMPLATE_TYPE = resolvePath('template/of/')
254 254
 // 品牌商
255 255
 export const API_BRAND_LIST = resolvePath('brand')
256 256
 export const API_BRAND_INFO = resolvePath('brand')
257
+
258
+
259
+// 品牌商
260
+export const API_POLICYTYPE_LIST = resolvePath('taPolicyType')
261
+// export const API_BRAND_INFO = resolvePath('brand')
262
+// GET /api/{plat}/taPolicyType

+ 51
- 34
src/pages/index/encyDetail/index.jsx Näytä tiedosto

@@ -1,52 +1,69 @@
1
-import React, { useState, useEffect } from 'react'
2
-import withLayout from '@/layout'
3
-import './index.scss'
4
-import { ScrollView } from '@tarojs/components'
5
-import '@/assets/css/iconfont.css'
6
-import { Image, RichText } from '@tarojs/components'
1
+import React, { useState, useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import withLayout from "@/layout";
4
+import "./index.scss";
5
+import { ScrollView } from "@tarojs/components";
6
+import "@/assets/css/iconfont.css";
7
+import { Image, RichText } from "@tarojs/components";
8
+import { queryPolicyDetail } from "@/services/policy";
9
+import getDateFormat from "@/utils/chatDate";
7 10
 
8 11
 export default withLayout((props) => {
12
+  const { router, shareContent, trackData, person, page } = props;
13
+  const { id } = router.params;
14
+  const [data, setData] = useState({});
9 15
 
10
-  // const [PageProps] = useState(props)
16
+  const getData = (params) => {
17
+    Taro.showLoading();
18
+    queryPolicyDetail(params).then((res) => {
19
+      setData(res);
20
+      Taro.hideLoading();
21
+    });
22
+  };
23
+  useEffect(() => {
24
+    if (id) {
25
+      getData(id);
26
+    }
27
+  }, [id]);
11 28
 
12 29
   return (
13
-    <view className='Page encyDetail flex-v'>
14
-      <view className='flex-item'>
30
+    <view className="Page encyDetail flex-v">
31
+      <view className="flex-item">
15 32
         <view>
16
-          <ScrollView scroll-y={true} refresher-enabled={false} refresher-background='#fff'>
17
-            <view className='PageContent'>
18
-
19
-              <view className='Info'>
33
+          <ScrollView
34
+            scroll-y={true}
35
+            refresher-enabled={false}
36
+            refresher-background="#fff"
37
+          >
38
+            <view className="PageContent">
39
+              <view className="Info">
20 40
                 <view>
21
-                  <text className='Title'>公积金又有新变化,附最新南京公积金贷款和提取方法。</text>
41
+                  <text className="Title">
42
+                    {data.title} {data.subtitle}
43
+                  </text>
22 44
                   <view>
23
-                    <text>阅读:28</text>
24
-                    <text>点赞15</text>
25
-                    <text>收藏22</text>
45
+                  <text>阅读:{data.pvNum}</text>
46
+                    <text className="Time">
47
+                      {getDateFormat(
48
+                        new Date(data.createDate).valueOf(),
49
+                        true,
50
+                        "yyyy-M-d"
51
+                      )}
52
+                    </text>
53
+                   
26 54
                   </view>
27
-                  <text className='Time'>时间:2019-10-20 10:00 </text>
28
-                  <text className='Share'>分享好友</text>
29 55
                 </view>
30 56
               </view>
31 57
 
32
-              <view className='Content'>
33
-                <RichText nodes={'<p>这是内容</p>'}></RichText>
58
+              <view className="Content">
59
+                <RichText nodes={data.body}></RichText>
34 60
               </view>
35
-
36 61
             </view>
37 62
           </ScrollView>
38 63
         </view>
39 64
       </view>
40
-      <view className='Bottom'>
41
-        <view>
42
-          <Image mode='heightFix' src={require('../../../assets/buildingDetail-icon3.png')}></Image>
43
-          <text>生成海报</text>
44
-        </view>
45
-        <view>
46
-          <text className='iconfont icon-shoucang'></text>
47
-          <text>收藏</text>
48
-        </view>
49
-      </view>
65
+    
66
+    
50 67
     </view>
51
-  )
52
-})
68
+  );
69
+});

+ 1
- 1
src/pages/index/encyDetail/index.scss Näytä tiedosto

@@ -54,7 +54,7 @@
54 54
                 display: block;
55 55
                 font-size: 28px;
56 56
                 color: #333;
57
-                margin-top: 20px;
57
+                float: right;
58 58
               }
59 59
               >.Share {
60 60
                 display: block;

+ 149
- 48
src/pages/index/encyclopediasOfBuyHouse/index.jsx Näytä tiedosto

@@ -1,56 +1,157 @@
1
-import React, { useState, useEffect } from 'react'
2
-import withLayout from '@/layout'
3
-import './index.scss'
4
-import { ScrollView, Image } from '@tarojs/components'
5
-import '@/assets/css/iconfont.css'
6
-import Taro from '@tarojs/taro'
1
+import React, { useState, useEffect } from "react";
2
+import withLayout from "@/layout";
3
+import "./index.scss";
4
+import { useSelector } from "react-redux";
5
+import { ScrollView, Image } from "@tarojs/components";
6
+import "@/assets/css/iconfont.css";
7
+import Taro from "@tarojs/taro";
8
+import { fetch } from "@/utils/request";
9
+import { queryPolicyTypeList, queryPolicyList } from "@/services/policy";
7 10
 
8
-export default withLayout((props) => {
11
+const EncyItem = (props) => {
12
+  const city = useSelector(state => state.city)
13
+
14
+  const { item, index } = props;
15
+  const [list, setList] = useState([]);
16
+
17
+  useEffect(() => {
18
+    if (item.policyTypeId) {
19
+      getPolicyListByType(item.policyTypeId);
20
+    }
21
+  }, [item,city]);
9 22
 
23
+  const getPolicyListByType = policyTypeId => {
24
+    queryPolicyList({ pageSize: 100,policyTypeId,cityId: city?.curCity?.id }).then((res) => {
25
+      setList(res.records);
26
+    });
27
+  };
28
+
29
+  return (
30
+    <view key={`ListItem-${index}`}>
31
+      <view className="Title">
32
+        <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
33
+        <text>/{item.policyTypeName}</text>
34
+        {/* <Image mode="heightFix" src={item.icon}></Image> */}
35
+      </view>
36
+      <view className="List">
37
+        {list.map((subItem, subIndex) => (
38
+          <view
39
+            key={`subItem-${subIndex}`}
40
+            onClick={() => {
41
+              Taro.navigateTo({
42
+                url: `/pages/index/encyDetail/index?id=${subItem.policyId}`,
43
+              });
44
+            }}
45
+          >
46
+            <text className="Name">{subItem.title}</text>
47
+            {subItem.isHot === 1 && (
48
+              <text className="Tips" style={{ background: "#FF0000" }}>
49
+                {/* {subItem.tips} */}
50
+                HOT
51
+              </text>
52
+            )}
53
+            {/* {subItem.icon !== "" && (
54
+              <Image mode="heightFix" src={subItem.icon}></Image>
55
+            )} */}
56
+          </view>
57
+        ))}
58
+      </view>
59
+    </view>
60
+  );
61
+};
62
+
63
+export default withLayout((props) => {
10 64
   // const [PageProps] = useState(props)
11
-  const [PageList] = useState([
12
-    {name: '准备买房', icon: require('@/assets/ency-icon3.png'), list: [{name: '买房资质查询', id: 1, tips: 'HOT', tipsColor: '#FF0000', icon: ''}, {name: '22个房产名词', id: 2, tips: 'NEW', tipsColor: '#30CFCF', icon: ''}]},
13
-    {name: '看房选房', icon: require('@/assets/ency-icon4.png'), list: [{name: '热门楼盘地图', id: 3, tips: '', icon: ''}, {name: '选户型攻略', id: 4, tips: '实用', tipsColor: '#62D547', icon: ''}, {name: '期房新房怎么选', id: 5, tips: '', icon: ''}]},
14
-    {name: '认筹签约', icon: require('@/assets/ency-icon5.png'), list: [{name: '买房签约流程', id: 6, tips: '哇!', tipsColor: '#FF396C', icon: require('@/assets/ency-icon2.png')}, {name: '契税征收标准', id: 7, tips: '', icon: ''}, {name: '公司名义买房', id: 8, tips: '', icon: ''}]},
15
-    {name: '贷款买房', icon: require('@/assets/ency-icon6.png'), list: [{name: '新房贷政策', id: 9, tips: '', icon: ''}, {name: '贷款查征信', id: 10, tips: '', icon: require('../../../assets/ency-icon1.png')}]}
16
-  ])
17 65
 
66
+  const [PageList, setPageList] = useState([
67
+    {
68
+      name: "准备买房",
69
+      icon: require("@/assets/ency-icon3.png"),
70
+      list: [
71
+        {
72
+          name: "买房资质查询",
73
+          id: 1,
74
+          tips: "HOT",
75
+          tipsColor: "#FF0000",
76
+          icon: "",
77
+        },
78
+        {
79
+          name: "22个房产名词",
80
+          id: 2,
81
+          tips: "NEW",
82
+          tipsColor: "#30CFCF",
83
+          icon: "",
84
+        },
85
+      ],
86
+    },
87
+    {
88
+      name: "看房选房",
89
+      icon: require("@/assets/ency-icon4.png"),
90
+      list: [
91
+        { name: "热门楼盘地图", id: 3, tips: "", icon: "" },
92
+        {
93
+          name: "选户型攻略",
94
+          id: 4,
95
+          tips: "实用",
96
+          tipsColor: "#62D547",
97
+          icon: "",
98
+        },
99
+        { name: "期房新房怎么选", id: 5, tips: "", icon: "" },
100
+      ],
101
+    },
102
+    {
103
+      name: "认筹签约",
104
+      icon: require("@/assets/ency-icon5.png"),
105
+      list: [
106
+        {
107
+          name: "买房签约流程",
108
+          id: 6,
109
+          tips: "哇!",
110
+          tipsColor: "#FF396C",
111
+          icon: require("@/assets/ency-icon2.png"),
112
+        },
113
+        { name: "契税征收标准", id: 7, tips: "", icon: "" },
114
+        { name: "公司名义买房", id: 8, tips: "", icon: "" },
115
+      ],
116
+    },
117
+    {
118
+      name: "贷款买房",
119
+      icon: require("@/assets/ency-icon6.png"),
120
+      list: [
121
+        { name: "新房贷政策", id: 9, tips: "", icon: "" },
122
+        {
123
+          name: "贷款查征信",
124
+          id: 10,
125
+          tips: "",
126
+          icon: require("../../../assets/ency-icon1.png"),
127
+        },
128
+      ],
129
+    },
130
+  ]);
131
+
132
+  const getPageList = () => {
133
+    queryPolicyTypeList({ pageSize: 100 }).then((res) => {
134
+      setPageList(res.records);
135
+    });
136
+  };
137
+  // GET /api/{plat}/taPolicyType
138
+
139
+  useEffect(() => {
140
+    getPageList();
141
+  }, []);
18 142
   return (
19
-    <view className='Page encyclopediasOfBuyHouse'>
20
-
21
-      <ScrollView scroll-y={true} refresher-enabled={false} refresher-background='#fff'>
22
-        <view className='PageContent'>
23
-          {
24
-            PageList.map((item, index) => (
25
-              <view key={`ListItem-${index}`}>
26
-                <view className='Title'>
27
-                  <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
28
-                  <text>/{item.name}</text>
29
-                  <Image mode='heightFix' src={item.icon}></Image>
30
-                </view>
31
-                <view className='List'>
32
-                  {
33
-                    item.list.map((subItem, subIndex) => (
34
-                      <view key={`subItem-${subIndex}`} onClick={() => { Taro.navigateTo({ url: `/pages/index/encyDetail/index?id=${subItem.id}` }) }}>
35
-                        <text className='Name'>{subItem.name}</text>
36
-                        {
37
-                          subItem.tips !== '' &&
38
-                          <text className='Tips' style={{background: subItem.tipsColor}}>{subItem.tips}</text>
39
-                        }
40
-                        {
41
-                          subItem.icon !== '' &&
42
-                          <Image mode='heightFix' src={subItem.icon}></Image>
43
-                        }
44
-                      </view>
45
-                    ))
46
-                  }
47
-                </view>
48
-              </view>
49
-            ))
50
-          }
143
+    <view className="Page encyclopediasOfBuyHouse">
144
+      <ScrollView
145
+        scroll-y={true}
146
+        refresher-enabled={false}
147
+        refresher-background="#fff"
148
+      >
149
+        <view className="PageContent">
150
+          {PageList.map((item, index) => (
151
+            <EncyItem item={item} key={index} index={index}></EncyItem>
152
+          ))}
51 153
         </view>
52 154
       </ScrollView>
53
-
54 155
     </view>
55
-  )
56
-})
156
+  );
157
+});

+ 1
- 0
src/pages/index/encyclopediasOfBuyHouse/index.scss Näytä tiedosto

@@ -63,6 +63,7 @@
63 63
               color: #333;
64 64
               position: relative;
65 65
               z-index: 1;
66
+              padding: 0 20px;
66 67
             }
67 68
             >.Tips {
68 69
               display: inline-block;

+ 7
- 0
src/services/policy.js Näytä tiedosto

@@ -1,8 +1,15 @@
1 1
 import { fetch } from '@/utils/request'
2 2
 import {
3 3
   API_POLICY_LIST,
4
+  API_POLICYTYPE_LIST
4 5
 } from '@/constants/api'
5 6
 
7
+/**
8
+ * 获取列表
9
+ * @param {*} payload
10
+ */
11
+ export const queryPolicyTypeList = payload => fetch({ url: API_POLICYTYPE_LIST, payload })
12
+
6 13
 
7 14
 /**
8 15
  * 获取列表