|
@@ -13,6 +13,7 @@ import collect from '../../static/images/collect.png'; |
|
@@ -13,6 +13,7 @@ import collect from '../../static/images/collect.png'; |
13
|
import collectOff from '../../static/images/collect-off.png';
|
13
|
import collectOff from '../../static/images/collect-off.png';
|
14
|
import './index.scss';
|
14
|
import './index.scss';
|
15
|
import event from '../../utils/event'
|
15
|
import event from '../../utils/event'
|
|
|
16
|
+import { getQRCodeSource } from '../../libs/miniQRCodeRoute'
|
16
|
|
17
|
|
17
|
const SHARE_FRIENDS = 'user-share-friends';
|
18
|
const SHARE_FRIENDS = 'user-share-friends';
|
18
|
const SHARE_MOMENTS = 'user-share-moments';
|
19
|
const SHARE_MOMENTS = 'user-share-moments';
|
|
@@ -76,20 +77,52 @@ export default class ProductDetail extends Component { |
|
@@ -76,20 +77,52 @@ export default class ProductDetail extends Component { |
76
|
}
|
77
|
}
|
77
|
}
|
78
|
}
|
78
|
componentDidMount() {
|
79
|
componentDidMount() {
|
79
|
- let id = this.$router.params.id;
|
80
|
+ let options = this.$router.params;
|
80
|
|
81
|
|
81
|
- var scene = decodeURIComponent(this.$router.params.scene)
|
|
|
82
|
console.log('====================================');
|
82
|
console.log('====================================');
|
83
|
- console.log(this.$router.params);
|
|
|
84
|
- console.log(scene);
|
83
|
+ console.log(options);
|
85
|
console.log('====================================');
|
84
|
console.log('====================================');
|
|
|
85
|
+
|
|
|
86
|
+ if (options && options.scene && options.scene.length == 32) {
|
|
|
87
|
+ let code = options.scene;
|
|
|
88
|
+ getQRCodeSource(code).then(json => {
|
|
|
89
|
+ console.log('====================================');
|
|
|
90
|
+ console.log(json);
|
|
|
91
|
+ console.log('====================================');
|
|
|
92
|
+ if (json) {
|
|
|
93
|
+ this.loadElement(json);
|
|
|
94
|
+ }
|
|
|
95
|
+ })
|
|
|
96
|
+ .catch(error => {
|
|
|
97
|
+ });
|
|
|
98
|
+ } else {
|
|
|
99
|
+ this.loadElement(options);
|
|
|
100
|
+ }
|
|
|
101
|
+ }
|
|
|
102
|
+
|
|
|
103
|
+ loadElement(options) {
|
|
|
104
|
+ let productId = options.id
|
|
|
105
|
+
|
|
|
106
|
+ if (options && options.scene && options.scene.length > 0) {
|
|
|
107
|
+ var scene = decodeURIComponent(options.scene)
|
|
|
108
|
+ var arr = scene ? scene.split("&") : [];
|
|
|
109
|
+ console.log('====================================');
|
|
|
110
|
+ console.log(scene);
|
|
|
111
|
+ console.log(arr);
|
|
|
112
|
+ console.log('====================================');
|
|
|
113
|
+
|
|
|
114
|
+ if (arr.length == 1) {
|
|
|
115
|
+ productId = scene;
|
|
|
116
|
+ }
|
|
|
117
|
+ }
|
|
|
118
|
+
|
86
|
this.setState({
|
119
|
this.setState({
|
87
|
- id: id
|
120
|
+ id: productId
|
88
|
});
|
121
|
});
|
89
|
|
122
|
|
90
|
- this.getProductData(id);
|
|
|
91
|
- this.getRecommendGoods(id);
|
|
|
92
|
- this.getFavoriteState(id);
|
123
|
+ this.getProductData(productId);
|
|
|
124
|
+ this.getRecommendGoods(productId);
|
|
|
125
|
+ this.getFavoriteState(productId);
|
93
|
|
126
|
|
94
|
event.on(SHARE_CANCEL, () => {
|
127
|
event.on(SHARE_CANCEL, () => {
|
95
|
this.onCancelSharesheetCallback();
|
128
|
this.onCancelSharesheetCallback();
|