Commit c021e069 authored by ziyu's avatar ziyu

Merge branch 'master' of git.quantgroup.cn:ui/mini-program-wepy into feature/optimize

parents 354f6610 01b31208
......@@ -38,10 +38,10 @@ const request = async (url, options) => {
if (res.data.code === 2000) {
return res.data.data;
}
Notify({ message: res.data.msg || '请求异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '请求异常,请稍后重试');
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请稍后重试');
}
Notify({ message: '请求异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
});
};
......
......@@ -85,14 +85,6 @@
type: String,
default: ''
},
bgColor: {
type: String,
default: '#FFF'
},
fontColor: {
type: String,
default: '#FF0000'
}
},
computed: {
goldUrl() {
......@@ -117,7 +109,7 @@
watch: {
des(newVal, oldVal) {
if (this.type === 'gold') {
if (!this.addCount) {
if (this.addCount <= 1) {
this.addCount ++;
return;
}
......
......@@ -262,7 +262,7 @@
lastPage: 0,
currentIndex: 5, // 商品当前滑动到第几个
authmodal: false,
sign: false,
sign: true,
showAnimation: false,
userImgStyle: '',
goldStyle: '',
......@@ -406,16 +406,7 @@
this.setUserInfo(e.$wx.detail.userInfo);
await this.getMainInfo();
this.authmodal = false;
console.log('isRegister', wx.getStorageSync('isRegister'));
if (wx.getStorageSync('isRegister') === false) {
const userInfo = {
...e.$wx.detail.userInfo,
openid: wx.getStorageSync('openId'),
inviter: this.inviter
};
await register(userInfo);
wx.setStorageSync('isRegister', true);
}
this.registUser(e.$wx.detail.userInfo);
}
},
changeVideo(e) {
......@@ -500,7 +491,6 @@
});
},
onShareAppMessage: function(res) {
console.log(this.$wepy.userInfo, this.$wepy.awardsInfo);
if (res.from === 'button') {
console.log('onShareAppMessage2', res.target);
}
......@@ -524,6 +514,9 @@
getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
if (!batchId) return;
if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {
Notify({ message: '您的克币数为0, 无法参与抽奖', background: '#FF5D15', safeAreaInsetTop: true});
}
wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
});
......@@ -546,11 +539,23 @@
},
getMainInfo: async function() {
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.sign = this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone || false);
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
this.showAwardsModal = true;
}
},
async registUser(userInfo) {
if (wx.getStorageSync('isRegister') === false) {
const params = {
...userInfo,
inviter: this.inviter
};
await register(params);
wx.setStorageSync('isRegister', true);
}
}
},
......@@ -568,29 +573,7 @@
}
});
}
// this.list = [
// {value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'},
// {value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'},
// {value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'},
// {value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'},
// {value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'},
// {value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'},
// {value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'},
// {value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'},
// {value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'},
// {value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'}
// ];
// let urls = [
// // 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4',
// // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
// // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
// // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4'
// 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151556813&di=44964ab823b5fb5f3fadcf9ceb87553b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201503%2F07%2F20150307113019_FSEFE.thumb.700_0.png',
// 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg',
// 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151520979&di=beba310e6bc314f7dd7ede841d068f68&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201610%2F05%2F20161005092600_jCmSx.thumb.700_0.jpeg'
// ];
this.videoList = await getPrizeList();
// this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' }));
},
async onLoad (options) {
if (options.openid) {
......@@ -603,18 +586,13 @@
if (setting.authSetting['scope.userInfo']) {
const { userInfo } = await wepy.wx.getUserInfo();
this.setUserInfo(userInfo);
if (wx.getStorageSync('isRegister') === false) {
const params = {
...userInfo,
inviter: this.inviter
};
await register(params);
wx.setStorageSync('isRegister', true);
}
this.registUser(userInfo);
await this.getMainInfo();
} else {
this.authmodal = true;
}
} else {
this.registUser(this.userInfo);
}
},
onShow() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment