Browse Source

Merge branch 'v3.5.1' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into v3.5.1

周立森 5 years ago
parent
commit
da674b8973

+ 4
- 4
config/dev.js View File

5
   defineConstants: {
5
   defineConstants: {
6
     // HOST: '"http://47.101.36.130:8085"',//测试
6
     // HOST: '"http://47.101.36.130:8085"',//测试
7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
8
-    // HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
-    // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
8
+    HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
+    WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10
     // HOST: '"https://lt.pawoma.cn"',
10
     // HOST: '"https://lt.pawoma.cn"',
11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    HOST: '"http://192.168.0.84:8080"',
13
-    WSS_HOST: '"ws://192.168.0.84:8080"',
12
+    // HOST: '"http://192.168.0.84:8080"',
13
+    // WSS_HOST: '"ws://192.168.0.84:8080"',
14
   },
14
   },
15
   weapp: {},
15
   weapp: {},
16
   h5: {}
16
   h5: {}

+ 1
- 1
project.config.json View File

2
 	"miniprogramRoot": "dist/",
2
 	"miniprogramRoot": "dist/",
3
 	"projectname": "mini-chengjiao",
3
 	"projectname": "mini-chengjiao",
4
 	"description": "知与行联调",
4
 	"description": "知与行联调",
5
-	"appid": "wxd9ee3a9480a4e544",
5
+	"appid": "wxda1f84b79b3edeb3",
6
 	"setting": {
6
 	"setting": {
7
 		"urlCheck": false,
7
 		"urlCheck": false,
8
 		"es6": false,
8
 		"es6": false,

+ 30
- 26
src/app.js View File

144
       ]
144
       ]
145
     },
145
     },
146
   }
146
   }
147
+
147
   componentDidHide() {
148
   componentDidHide() {
148
-    ready.close()
149
+    // ready.close()
149
     // socket.closeSocket()
150
     // socket.closeSocket()
150
   }
151
   }
151
 
152
 
152
   componentDidShow() {
153
   componentDidShow() {
154
+    const updateManager = wx.getUpdateManager()
155
+    updateManager.onCheckForUpdate(function (res) {
156
+      // 请求完新版本信息的回调
157
+      console.info('新版本是否更新:', res.hasUpdate)
158
+    })
159
+
160
+    updateManager.onUpdateReady(function () {
161
+      wx.showModal({
162
+        title: '更新提示',
163
+        content: '新版本已经准备好,是否重启应用?',
164
+        success(res) {
165
+          if (res.confirm) {
166
+            // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
167
+            updateManager.applyUpdate()
168
+          }
169
+        }
170
+      })
171
+    })
172
+  }
173
+  componentDidMount() {
174
+    console.info('app componentDidMount')
175
+  }
176
+  componentWillMount(params) {
177
+    // console.info('app componentWillMount', params)
178
+    this.initData()
179
+  }
180
+
181
+  initData () {
153
     console.info('app componentDidShow')
182
     console.info('app componentDidShow')
154
     console.info('router1', this.$router.params)
183
     console.info('router1', this.$router.params)
155
     console.info('ready status1', ready)
184
     console.info('ready status1', ready)
190
         })
219
         })
191
       })
220
       })
192
     })
221
     })
193
-
194
-    const updateManager = wx.getUpdateManager()
195
-    updateManager.onCheckForUpdate(function (res) {
196
-      // 请求完新版本信息的回调
197
-      console.info('新版本是否更新:', res.hasUpdate)
198
-    })
199
-
200
-    updateManager.onUpdateReady(function () {
201
-      wx.showModal({
202
-        title: '更新提示',
203
-        content: '新版本已经准备好,是否重启应用?',
204
-        success(res) {
205
-          if (res.confirm) {
206
-            // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
207
-            updateManager.applyUpdate()
208
-          }
209
-        }
210
-      })
211
-    })
212
-  }
213
-  componentDidMount() {
214
-    console.info('app componentDidMount')
215
-  }
216
-  componentWillMount(params) {
217
-    console.info('app componentWillMount', params)
218
   }
222
   }
219
 
223
 
220
   getRouterParams() {
224
   getRouterParams() {

+ 105
- 121
src/components/charts/Line.js View File

2
 import echarts from '../ec-canvas/echarts'
2
 import echarts from '../ec-canvas/echarts'
3
 import './style.scss'
3
 import './style.scss'
4
 
4
 
5
-function initChart(callback, options) {
5
+function initChart(options, callback) {
6
   return function (canvas, width, height) {
6
   return function (canvas, width, height) {
7
     const chart = echarts.init(canvas, null, {
7
     const chart = echarts.init(canvas, null, {
8
       width: width,
8
       width: width,
9
       height: height
9
       height: height
10
     });
10
     });
11
     canvas.setChart(chart);
11
     canvas.setChart(chart);
12
-    chart.setOption(options);
12
+    chart.setOption(options);    
13
     callback && callback(chart);
13
     callback && callback(chart);
14
     return chart;
14
     return chart;
15
   }
15
   }
16
 }
16
 }
17
 
17
 
18
+function createLineOptions(source = []) {
19
+  const colorWithOpacity = op => `rgba(187,156,121, ${op})`
20
+
21
+  const defaultOpt = {
22
+    color: [colorWithOpacity(1)],
23
+    xAxis: {
24
+      type: 'category',
25
+      boundaryGap: false,
26
+      axisLabel: {
27
+        textStyle: {
28
+          color: '#666'
29
+        }
30
+      }
31
+
32
+    },
33
+    yAxis: {
34
+      type: 'value',
35
+      axisLabel: {
36
+        textStyle: {
37
+          color: '#666'
38
+        }
39
+      }
40
+    },
41
+    grid: {
42
+      left: '10%',
43
+      right: '8%',
44
+      bottom: '12%',
45
+      top: '15%',
46
+    },
47
+    series: [],
48
+  }
49
+
50
+  // 数据展示只展示 5 个
51
+  const endValue = source.length - 1 > 0 ? source.length - 1 : 0
52
+  const startValue = endValue - 5 > 0 ? endValue - 5 : 0
53
+
54
+  return {
55
+    ...defaultOpt,
56
+    dataset: { source },
57
+    dataZoom: [{
58
+      type: 'inside',
59
+      startValue, endValue,
60
+      show: true,
61
+    }],
62
+    series: [{
63
+      type: 'line',
64
+      dimensions: ['name', 'value'],
65
+      symbolSize: 6,
66
+      smooth: true,
67
+      label: {
68
+        show: true,
69
+        formatter: '{@value}人'
70
+      },
71
+      lineStyle: {
72
+        shadowColor: colorWithOpacity(0.5),
73
+        shadowBlur: 5,
74
+        shadowOffsetY: 7
75
+      },
76
+      areaStyle: {
77
+        color: {
78
+          type: 'linear',
79
+          x: 0,
80
+          y: 0,
81
+          x2: 0,
82
+          y2: 1,
83
+          colorStops: [{
84
+            offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
85
+          }, {
86
+            offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
87
+          }],
88
+          global: false,
89
+        }
90
+      },
91
+    }],
92
+  }
93
+}
94
+
18
 /**
95
 /**
19
  * 传入 source 的格式为 [{ name: xxx, value: xxx }, {}]
96
  * 传入 source 的格式为 [{ name: xxx, value: xxx }, {}]
20
  */
97
  */
25
     }
102
     }
26
   }
103
   }
27
 
104
 
28
-  // this.echart
29
-  echart = null
105
+  // this.ecComponent
106
+  chart = null;
30
   ecComponent = null
107
   ecComponent = null
31
 
108
 
32
   state = {
109
   state = {
33
     ec: { lazyLoad: true },
110
     ec: { lazyLoad: true },
111
+    isDisposed: false,
34
   }
112
   }
35
 
113
 
36
-  // 禁止 props 变更时渲染
37
-  shouldComponentUpdate(nextProps) {
38
-    console.log('--nextProps--->', nextProps)
39
-
40
-    this.refreshChart(nextProps.source)
41
-
42
-    return false
114
+  componentDidShow() {
115
+    this.setState({ isDisposed: false })
43
   }
116
   }
44
 
117
 
45
-  handleEcComponent(ref) {
46
-    this.ecComponent = ref
118
+  componentDidHide() {
119
+    this.setState({ isDisposed: true })
47
   }
120
   }
48
 
121
 
49
-  handleChart(chart) {
50
-    this.echart = chart
122
+  componentDidMount() {
123
+    this.ecComponent = this.$scope.selectComponent(`#${this.props.lid}`)
124
+    this.init(this.props)
51
   }
125
   }
52
 
126
 
53
-  createOptions(source = []) {
54
-    const colorWithOpacity = op => `rgba(187,156,121, ${op})`
55
-
56
-    const defaultOpt = {
57
-      color: [colorWithOpacity(1)],
58
-      xAxis: {
59
-        type: 'category',
60
-        boundaryGap: false,
61
-        axisLabel: {
62
-          textStyle: {
63
-            color: '#666'
64
-          }
65
-        }
66
-
67
-      },
68
-      yAxis: {
69
-        type: 'value',
70
-        axisLabel: {
71
-          textStyle: {
72
-            color: '#666'
73
-          }
74
-        }
75
-      },
76
-      grid: {
77
-        left: '10%',
78
-        right: '8%',
79
-        bottom: '12%',
80
-        top: '10%',
81
-      },
82
-      series: [],
83
-    }
84
-
85
-    // 数据展示只展示 5 个
86
-    const endValue = source.length - 1 > 0 ? source.length - 1 : 0
87
-    const startValue = endValue - 5 > 0 ? endValue - 5 : 0
127
+  componentWillReceiveProps(nextProps) {
128
+    // 简单优化, 不显示的组件不更新
129
+    // 但是有个 bug 。如果此时有 props 更新, 会导致页面绘制的数据错误
130
+    if (this.state.isDisposed) return
88
 
131
 
89
-    return {
90
-      ...defaultOpt,
91
-      dataset: { source },
92
-      dataZoom: [{
93
-        type: 'slider',
94
-        startValue, endValue,
95
-        show: true,
96
-        xAxisIndex: [0],
97
-        handleSize: 10,//滑动条的 左右2个滑动条的大小  
98
-        height: 20,//组件高度  
99
-        left: 30, //左边的距离  
100
-        right: 30,//右边的距离  
101
-        bottom: 0,//下边的距离  
102
-        handleColor: 'rgba(0,0,0,0.1)',//h滑动图标的颜色  
103
-        realtime : true,
104
-        handleStyle: {
105
-          borderColor: "#999",
106
-          borderWidth: "1",
107
-          shadowBlur: 2,
108
-          background: "rgba(0,0,0,0.1)",
109
-          shadowColor: "rgba(0,0,0,0.1)",
110
-        },
111
-        backgroundColor: 'rgba(0,0,0,0.1)',//两边未选中的滑动条区域的颜色  
112
-        showDataShadow: false,//是否显示数据阴影 默认auto  
113
-        showDetail: false,
114
-
115
-      }],
116
-      series: [{
117
-        type: 'line',
118
-        dimensions: ['name', 'value'],
119
-        symbolSize: 6,
120
-        smooth: true,
121
-        label: {
122
-          show: true,
123
-          formatter: '{@value}人'
124
-        },
125
-        lineStyle: {
126
-          shadowColor: colorWithOpacity(0.5),
127
-          shadowBlur: 5,
128
-          shadowOffsetY: 7
129
-        },
130
-        areaStyle: {
131
-          color: {
132
-            type: 'linear',
133
-            x: 0,
134
-            y: 0,
135
-            x2: 0,
136
-            y2: 1,
137
-            colorStops: [{
138
-              offset: 0, color: colorWithOpacity(0.2) // 0% 处的颜色
139
-            }, {
140
-              offset: 1, color: colorWithOpacity(0) // 100% 处的颜色
141
-            }],
142
-            global: false,
143
-          }
144
-        },
145
-      }],
132
+    // 简单的性能优化, 只有数据改变了才重新绘图
133
+    if (JSON.stringify(nextProps.source) != JSON.stringify(this.props.source)) {
134
+      this.init(nextProps)
146
     }
135
     }
147
   }
136
   }
148
 
137
 
149
-  refreshChart(source) {
150
-    const options = this.createOptions(source)
151
-
152
-    if (!this.echart) {
153
-      if (this.ecComponent) {
154
-        const initFunc = initChart(this.handleChart.bind(this), options)
155
-        this.ecComponent.init(initFunc)
156
-      } else {
157
-        console.warn('echart componet not ready')
138
+  init = (props) => {
139
+    const tk = setTimeout(() => {
140
+      if (this.ecComponent && props.source && props.source.length) {
141
+        const options = createLineOptions(props.source)
142
+        this.ecComponent.init(initChart(options, chart => (this.chart = chart)))
158
       }
143
       }
159
-    } else {
160
-      this.echart.setOption(options)
161
-    }
144
+
145
+      clearTimeout(tk)
146
+    }, 500)
162
   }
147
   }
163
 
148
 
164
   render() {
149
   render() {
165
-    // this.refreshChart(this.props.source)
166
     return (
150
     return (
167
       <View style="width:100vw;height:480rpx;position: relative;">
151
       <View style="width:100vw;height:480rpx;position: relative;">
168
         <View className="map-container">
152
         <View className="map-container">
169
-          <ec-canvas ref={this.handleEcComponent} ec={this.state.ec}></ec-canvas>
153
+          <ec-canvas id={this.props.lid} ec={this.state.ec}></ec-canvas>
170
         </View>
154
         </View>
171
       </View>
155
       </View>
172
     )
156
     )

+ 1
- 1
src/pages/activity/detail/assemble.js View File

642
                         (groupState === GroupInProcess && !isJoin) &&
642
                         (groupState === GroupInProcess && !isJoin) &&
643
                         (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
643
                         (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
644
                       }                      
644
                       }                      
645
-                      <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"}>
645
+                      <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} style="border:none">
646
                         <FormIdCollector>
646
                         <FormIdCollector>
647
                           <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
647
                           <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
648
                         </FormIdCollector>
648
                         </FormIdCollector>

+ 2
- 1
src/pages/activity/detail/index.js View File

190
         return
190
         return
191
       }
191
       }
192
 
192
 
193
-      const { userInfo: { person } } = this.props
193
+      const { userInfo: { person, miniApp } } = this.props
194
       const { avatarurl, nickname, personId } = person
194
       const { avatarurl, nickname, personId } = person
195
       const { detail: { dynamicId, posters, createDate } } = this.state
195
       const { detail: { dynamicId, posters, createDate } } = this.state
196
       const payload = {
196
       const payload = {
208
           title: posters[0].posterTitle,//海报标题
208
           title: posters[0].posterTitle,//海报标题
209
           posterDescription: posters[0].posterDescription,//海报标题
209
           posterDescription: posters[0].posterDescription,//海报标题
210
           createDate: createDate,//时间
210
           createDate: createDate,//时间
211
+          miniAppName: miniApp.name, // 小程序名称
211
         }
212
         }
212
         resolve(data)
213
         resolve(data)
213
       })
214
       })

+ 3
- 3
src/pages/activity/detail/poster.js View File

110
       {
110
       {
111
         x: 100,
111
         x: 100,
112
         y: 1065,
112
         y: 1065,
113
-        text: '橙蕉',
113
+        text: data.miniAppName,
114
         fontSize: 34,
114
         fontSize: 34,
115
         color: 'red',
115
         color: 'red',
116
         baseLine: 'middle',
116
         baseLine: 'middle',
117
         lineHeight: 48,
117
         lineHeight: 48,
118
-        width: 120,
118
+        width: (data.miniAppName || '').length * 30 + 60,
119
         zIndex: 11
119
         zIndex: 11
120
       },
120
       },
121
       {
121
       {
122
-        x: 190,
122
+        x: (data.miniAppName || '').length * 30 + 130,
123
         y: 1065,
123
         y: 1065,
124
         text: '热门活动',
124
         text: '热门活动',
125
         fontSize: 26,
125
         fontSize: 26,

+ 2
- 2
src/pages/card/index.js View File

293
         resolve(posterData)
293
         resolve(posterData)
294
         return
294
         return
295
       }
295
       }
296
-      const { userInfo: { person }, projectDetail: { buildingId }, cardInfo } = this.props
296
+      const { userInfo: { person, miniApp }, projectDetail: { buildingId }, cardInfo } = this.props
297
       const { id } = cardInfo
297
       const { id } = cardInfo
298
       const { personId } = person
298
       const { personId } = person
299
       const payload = {
299
       const payload = {
301
         "page": 'pages/card/index',
301
         "page": 'pages/card/index',
302
       }
302
       }
303
       getMiniQrcode(payload).then(qrcode => {
303
       getMiniQrcode(payload).then(qrcode => {
304
-        let data = Object.assign({ qrcode }, cardInfo)
304
+        let data = Object.assign({ qrcode, miniAppName: miniApp.name }, cardInfo)
305
         resolve(data)
305
         resolve(data)
306
       })
306
       })
307
     })
307
     })

+ 4
- 4
src/pages/card/poster.js View File

118
       {
118
       {
119
         x: 170,
119
         x: 170,
120
         y: 755,
120
         y: 755,
121
-        text: '橙蕉',
121
+        text: data.miniAppName,
122
         fontSize: 34,
122
         fontSize: 34,
123
         color: 'red',
123
         color: 'red',
124
         baseLine: 'middle',
124
         baseLine: 'middle',
125
         lineHeight: 48,
125
         lineHeight: 48,
126
-        width: 120,
126
+        width: (data.miniAppName || '').length * 30 + 60,
127
         zIndex: 100
127
         zIndex: 100
128
       },
128
       },
129
       {
129
       {
130
-        x: 260,
130
+        x: (data.miniAppName || '').length * 30 + 200,
131
         y: 755,
131
         y: 755,
132
         text: '查看主页',
132
         text: '查看主页',
133
         fontSize: 26,
133
         fontSize: 26,
140
       {
140
       {
141
         x: 320,
141
         x: 320,
142
         y: 1075,
142
         y: 1075,
143
-        text: '橙蕉',
143
+        text: data.miniAppName,
144
         fontSize: 32,
144
         fontSize: 32,
145
         color: '#b5b3b3',
145
         color: '#b5b3b3',
146
         baseLine: 'middle',
146
         baseLine: 'middle',

+ 3
- 2
src/pages/news/detail/index.js View File

154
         resolve(posterData)
154
         resolve(posterData)
155
         return
155
         return
156
       }
156
       }
157
-      const { userInfo: { person } } = this.props
157
+      const { userInfo: { person, miniApp } } = this.props
158
       const { avatarurl, nickname, personId } = person
158
       const { avatarurl, nickname, personId } = person
159
       const { newsId, detail: { posters, newsName, createDate } } = this.state
159
       const { newsId, detail: { posters, newsName, createDate } } = this.state
160
       const payload = {
160
       const payload = {
171
           title: posters[0].posterTitle,//资讯海报标题
171
           title: posters[0].posterTitle,//资讯海报标题
172
           posterDescription: posters[0].posterDescription,//资讯海报描述
172
           posterDescription: posters[0].posterDescription,//资讯海报描述
173
           createDate: createDate,//资讯时间
173
           createDate: createDate,//资讯时间
174
-          poster: posters[0].posterImg
174
+          poster: posters[0].posterImg,
175
+          miniAppName: miniApp.name,
175
         }
176
         }
176
         resolve(data)
177
         resolve(data)
177
       })
178
       })

+ 3
- 3
src/pages/news/detail/poster.js View File

110
       {
110
       {
111
         x: 100,
111
         x: 100,
112
         y: 1065,
112
         y: 1065,
113
-        text: '橙蕉',
113
+        text: data.miniAppName,
114
         fontSize: 34,
114
         fontSize: 34,
115
         color: 'red',
115
         color: 'red',
116
         baseLine: 'middle',
116
         baseLine: 'middle',
117
         lineHeight: 48,
117
         lineHeight: 48,
118
-        width: 120,
118
+        width: (data.miniAppName || '').length * 30 + 60,
119
         zIndex: 11
119
         zIndex: 11
120
       },
120
       },
121
       {
121
       {
122
-        x: 190,
122
+        x: (data.miniAppName || '').length * 30 + 130,
123
         y: 1065,
123
         y: 1065,
124
         text: '查看资讯',
124
         text: '查看资讯',
125
         fontSize: 26,
125
         fontSize: 26,

+ 6
- 4
src/pages/person/customerAnalysis/analysis.js View File

12
 import LineChart from "../../../components/charts/Line";
12
 import LineChart from "../../../components/charts/Line";
13
 const nothing = require('@assets/person/nothing.png')
13
 const nothing = require('@assets/person/nothing.png')
14
 
14
 
15
+const rand = n => Math.random().toString(36).substr(2, n)
15
 
16
 
16
 @connect(({ user, city }) => ({ user, city }))
17
 @connect(({ user, city }) => ({ user, city }))
17
 export default class analysis extends Taro.Component {
18
 export default class analysis extends Taro.Component {
28
     chartInfo: [],
29
     chartInfo: [],
29
     chartInfo2: [],
30
     chartInfo2: [],
30
     chartInfo3: [],
31
     chartInfo3: [],
32
+    lineIds: [ rand(7), rand(7), rand(7) ],
31
   }
33
   }
32
 
34
 
33
   componentWillUnmount() {
35
   componentWillUnmount() {
160
 
162
 
161
     const tabList = [{ title: '新增客户' }, { title: '跟进客户' }, { title: '到访客户' }]
163
     const tabList = [{ title: '新增客户' }, { title: '跟进客户' }, { title: '到访客户' }]
162
     const dailyMonth = ['日', '月']
164
     const dailyMonth = ['日', '月']
163
-    const { sexInfo, chartInfo, chartInfo2, chartInfo3, checkedWhich, current } = this.state
165
+    const { sexInfo, chartInfo, chartInfo2, chartInfo3, checkedWhich, current, lineIds } = this.state
164
 
166
 
165
     return (
167
     return (
166
       <View>
168
       <View>
179
               </View>
181
               </View>
180
               {
182
               {
181
                 chartInfo.length &&
183
                 chartInfo.length &&
182
-                <LineChart source={chartInfo} />
184
+                <LineChart source={chartInfo} lid={lineIds[0]} />
183
               }
185
               }
184
               {
186
               {
185
                 !chartInfo.length &&
187
                 !chartInfo.length &&
218
                 </View>
220
                 </View>
219
               </View>
221
               </View>
220
               {chartInfo2.length &&
222
               {chartInfo2.length &&
221
-                <LineChart source={chartInfo2} />
223
+                <LineChart source={chartInfo2} lid={lineIds[1]}/>
222
               }
224
               }
223
               {
225
               {
224
                 !chartInfo2.length &&
226
                 !chartInfo2.length &&
258
               </View>
260
               </View>
259
               {
261
               {
260
                 chartInfo3.length &&
262
                 chartInfo3.length &&
261
-                <LineChart source={chartInfo3} />
263
+                <LineChart source={chartInfo3} lid={lineIds[2]} />
262
               }
264
               }
263
               {
265
               {
264
                 !chartInfo3.length &&
266
                 !chartInfo3.length &&

+ 2
- 2
src/pages/project/detail/Around/index.js View File

15
   // 展示内容数组
15
   // 展示内容数组
16
   const dataList = poiDatas.map((item) => {
16
   const dataList = poiDatas.map((item) => {
17
     const key = item.key
17
     const key = item.key
18
-    const manualData = (detail[`building${key}`] === '' ? [] : detail[`building${key}`].split(','))
18
+    const manualData = (detail[`building${key}`] === '' ? [] : (detail[`building${key}`] || '').split(','))
19
     
19
     
20
     return {
20
     return {
21
       ...item,
21
       ...item,
28
   const markersList = dataList.map((item) => {
28
   const markersList = dataList.map((item) => {
29
     const mapJson = JSON.parse(item.data) 
29
     const mapJson = JSON.parse(item.data) 
30
     return (mapJson || []).map((it) => {
30
     return (mapJson || []).map((it) => {
31
-      const [longitude, latitude] = it.location.split(',')
31
+      const [longitude, latitude] = (it.location || '').split(',')
32
 
32
 
33
       return {
33
       return {
34
         id: it.id,
34
         id: it.id,

+ 22
- 21
src/pages/project/detail/index.js View File

48
     activityList: [],
48
     activityList: [],
49
     helpList: [],
49
     helpList: [],
50
     groupList: [],
50
     groupList: [],
51
-    statusOpts: ['待', '售罄', '在售'],
52
-    statusBgColors: ['#F6B61D', '#BB9C79', '#CECECE'],
51
+    statusOpts: ['待', '售罄', '在售'],
52
+    statusBgColors: ['#BB9C79', '#CECECE', '#F6B61D'],
53
     // circumOpts: [],
53
     // circumOpts: [],
54
     curTab: 'Transport',
54
     curTab: 'Transport',
55
     recordId: null,
55
     recordId: null,
63
 
63
 
64
   componentWillMount() {
64
   componentWillMount() {
65
     ready.queue(() => {
65
     ready.queue(() => {
66
-    
67
       // 分享场景需要先授权手机, 再授权头像
66
       // 分享场景需要先授权手机, 再授权头像
68
       const options = wx.getLaunchOptionsSync()
67
       const options = wx.getLaunchOptionsSync()
69
       if (sceneInShare(options.scene)) {
68
       if (sceneInShare(options.scene)) {
80
 
79
 
81
       this.initPageData()
80
       this.initPageData()
82
     })
81
     })
82
+    console.log('---------------after componentWillMount---------------')
83
   }
83
   }
84
 
84
 
85
   componentWillUnmount() {
85
   componentWillUnmount() {
245
     })
245
     })
246
   }
246
   }
247
 
247
 
248
-  toViewAlbum (index){
248
+  toViewAlbum(index) {
249
     const { buildingId } = this.state
249
     const { buildingId } = this.state
250
-    console.log('1111111',index)
251
-    this.navigateTo(`/pages/project/album/index?id=${buildingId}&current=${index}` )
250
+    console.log('1111111', index)
251
+    this.navigateTo(`/pages/project/album/index?id=${buildingId}&current=${index}`)
252
   }
252
   }
253
 
253
 
254
   onViewFans() {
254
   onViewFans() {
297
         return
297
         return
298
       }
298
       }
299
       const {
299
       const {
300
-        userInfo: { person: { avatarurl, nickname, personId } },
300
+        userInfo: { person: { avatarurl, nickname, personId }, miniApp },
301
         projectDetail: { posters, buildingId, poster, price, buildingRestaurant, createDate, buildingName, tel, buildingTag, uvList = {} }
301
         projectDetail: { posters, buildingId, poster, price, buildingRestaurant, createDate, buildingName, tel, buildingTag, uvList = {} }
302
       } = this.props
302
       } = this.props
303
       const { total = 0 } = uvList
303
       const { total = 0 } = uvList
319
           buildingName: posters[0].posterTitle,//标题
319
           buildingName: posters[0].posterTitle,//标题
320
           createDate: createDate,//时间
320
           createDate: createDate,//时间
321
           buildingTag: buildingTag,//标签,
321
           buildingTag: buildingTag,//标签,
322
-          total: total//围观人数
322
+          total: total, //围观人数
323
+          miniAppName: miniApp.name,
323
         }
324
         }
324
         resolve(data)
325
         resolve(data)
325
       })
326
       })
636
                       console.log(buildingImgUrl, 'buildingImgUrl')
637
                       console.log(buildingImgUrl, 'buildingImgUrl')
637
 
638
 
638
                       // if (buildingImgUrl != null) {
639
                       // if (buildingImgUrl != null) {
639
-                      return ( <View key={index + "listimg"}>
640
+                      return (<View key={index + "listimg"}>
640
                         {buildingImgUrl != null && (<View
641
                         {buildingImgUrl != null && (<View
641
                           style={{ marginRight: '8px' }}
642
                           style={{ marginRight: '8px' }}
642
-                          
643
+
643
                         >
644
                         >
644
 
645
 
645
                           <View>
646
                           <View>
646
-                            <Image className='albumimg' src={getThumbnail(buildingImgList[0].url)} onClick={()=>this.toViewAlbum(index)}></Image>
647
+                            <Image className='albumimg' src={getThumbnail(buildingImgList[0].url)} onClick={() => this.toViewAlbum(index)}></Image>
647
                             <View style={{ width: '218rpx', display: 'flex', justifyContent: 'center' }} >
648
                             <View style={{ width: '218rpx', display: 'flex', justifyContent: 'center' }} >
648
                               <View style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}> {apartmentName}  </View>
649
                               <View style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}> {apartmentName}  </View>
649
                               <View> ({buildingImgList.length})</View>
650
                               <View> ({buildingImgList.length})</View>
650
                             </View>
651
                             </View>
651
                           </View>
652
                           </View>
652
                         </View>)}
653
                         </View>)}
653
-                        </View>
654
+                      </View>
654
                       )
655
                       )
655
                       // }
656
                       // }
656
 
657
 
868
   }
869
   }
869
   renderActivities() {
870
   renderActivities() {
870
 
871
 
871
- 
872
+
872
     const { activityList } = this.state
873
     const { activityList } = this.state
873
-   
874
+
874
     return (
875
     return (
875
       <Block>
876
       <Block>
876
         {
877
         {
877
           activityList.length > 0 && (
878
           activityList.length > 0 && (
878
             <View className="activity" >
879
             <View className="activity" >
879
-           
880
+
880
               <View className="section-head">
881
               <View className="section-head">
881
-                 <Text className="section-head__title" style={{margin: '10rpx 0 40rpx 35rpx'}}>热门活动</Text>
882
-                 <View className="section-head__more"  style={{marginRight: '20rpx'}} onClick={this.handleActivityMoreClick}>
883
-                   更多活动<Text className="iconfont icon-more"></Text>
884
-                 </View>
885
-               </View>
882
+                <Text className="section-head__title" style={{ margin: '10rpx 0 40rpx 35rpx' }}>热门活动</Text>
883
+                <View className="section-head__more" style={{ marginRight: '20rpx' }} onClick={this.handleActivityMoreClick}>
884
+                  更多活动<Text className="iconfont icon-more"></Text>
885
+                </View>
886
+              </View>
886
               <View
887
               <View
887
                 style={{ position: 'relative' }}>
888
                 style={{ position: 'relative' }}>
888
                 <HelpGroupBanner
889
                 <HelpGroupBanner
897
 
898
 
898
               </View>
899
               </View>
899
             </View>
900
             </View>
900
-      
901
+
901
           )
902
           )
902
         }
903
         }
903
       </Block>
904
       </Block>

+ 3
- 3
src/pages/project/detail/poster.js View File

101
       {
101
       {
102
         x: 100,
102
         x: 100,
103
         y: 1070,
103
         y: 1070,
104
-        text: '橙蕉',
104
+        text: data.miniAppName,
105
         fontSize: 34,
105
         fontSize: 34,
106
         color: 'red',
106
         color: 'red',
107
         baseLine: 'middle',
107
         baseLine: 'middle',
108
         lineHeight: 48,
108
         lineHeight: 48,
109
-        width: 120,
109
+        width: (data.miniAppName || '').length * 30 + 60,
110
         zIndex: 11
110
         zIndex: 11
111
       },
111
       },
112
       {
112
       {
113
-        x: 190,
113
+        x: (data.miniAppName || '').length * 30 + 130,
114
         y: 1070,
114
         y: 1070,
115
         text: '项目详情',
115
         text: '项目详情',
116
         fontSize: 26,
116
         fontSize: 26,

+ 1
- 1
src/utils/request.js View File

94
       icon: 'none'
94
       icon: 'none'
95
     })
95
     })
96
 
96
 
97
-    throw new Error(errMessage)
97
+    throw new Error(err)
98
   })
98
   })
99
 }
99
 }
100
 
100