Authored by 肖亚东

快照扫码提交 — review by 黄敬囿

... ... @@ -13,6 +13,7 @@ import collect from '../../static/images/collect.png';
import collectOff from '../../static/images/collect-off.png';
import './index.scss';
import event from '../../utils/event'
import { getQRCodeSource } from '../../libs/miniQRCodeRoute'
const SHARE_FRIENDS = 'user-share-friends';
const SHARE_MOMENTS = 'user-share-moments';
... ... @@ -76,20 +77,52 @@ export default class ProductDetail extends Component {
}
}
componentDidMount() {
let id = this.$router.params.id;
let options = this.$router.params;
var scene = decodeURIComponent(this.$router.params.scene)
console.log('====================================');
console.log(this.$router.params);
console.log(scene);
console.log(options);
console.log('====================================');
if (options && options.scene && options.scene.length == 32) {
let code = options.scene;
getQRCodeSource(code).then(json => {
console.log('====================================');
console.log(json);
console.log('====================================');
if (json) {
this.loadElement(json);
}
})
.catch(error => {
});
} else {
this.loadElement(options);
}
}
loadElement(options) {
let productId = options.id
if (options && options.scene && options.scene.length > 0) {
var scene = decodeURIComponent(options.scene)
var arr = scene ? scene.split("&") : [];
console.log('====================================');
console.log(scene);
console.log(arr);
console.log('====================================');
if (arr.length == 1) {
productId = scene;
}
}
this.setState({
id: id
id: productId
});
this.getProductData(id);
this.getRecommendGoods(id);
this.getFavoriteState(id);
this.getProductData(productId);
this.getRecommendGoods(productId);
this.getFavoriteState(productId);
event.on(SHARE_CANCEL, () => {
this.onCancelSharesheetCallback();
... ...