Authored by 黄敬囿

Merge branch 'UFO_1.0.0' of http://git.yoho.cn/mobile/yoho-miniapp-ufo into UFO_1.0.0

... ... @@ -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(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();
... ...
... ... @@ -2,6 +2,7 @@ import rules from './rules';
import router from './router'
const urlParse = require('url');
const queryString = require('querystring');
import Taro from '@tarojs/taro'
const ACTION_TYPE = {
h5: 'go.h5',
... ...