Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
01b31208
Commit
01b31208
authored
May 28, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/animation' into 'master'
优化注册流程 See merge request
!16
parents
222b8d49
c3d9f2bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
54 deletions
+24
-54
wxRequest.js
src/common/wxRequest.js
+3
-3
sign.wpy
src/components/custom/sign.wpy
+1
-9
index.wpy
src/pages/index.wpy
+20
-42
No files found.
src/common/wxRequest.js
View file @
01b31208
...
@@ -38,10 +38,10 @@ const request = async (url, options) => {
...
@@ -38,10 +38,10 @@ const request = async (url, options) => {
if
(
res
.
data
.
code
===
2000
)
{
if
(
res
.
data
.
code
===
2000
)
{
return
res
.
data
.
data
;
return
res
.
data
.
data
;
}
}
Notify
({
message
:
res
.
data
.
msg
||
'
请求
异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
Notify
({
message
:
'
服务器
异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
throw
new
Error
(
res
.
data
.
msg
||
'
请求
异常,请稍后重试
'
);
throw
new
Error
(
res
.
data
.
msg
||
'
服务器
异常,请稍后重试
'
);
}
}
Notify
({
message
:
'
请求
异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
Notify
({
message
:
'
服务器
异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
});
});
};
};
...
...
src/components/custom/sign.wpy
View file @
01b31208
...
@@ -85,14 +85,6 @@
...
@@ -85,14 +85,6 @@
type: String,
type: String,
default: ''
default: ''
},
},
bgColor: {
type: String,
default: '#FFF'
},
fontColor: {
type: String,
default: '#FF0000'
}
},
},
computed: {
computed: {
goldUrl() {
goldUrl() {
...
@@ -117,7 +109,7 @@
...
@@ -117,7 +109,7 @@
watch: {
watch: {
des(newVal, oldVal) {
des(newVal, oldVal) {
if (this.type === 'gold') {
if (this.type === 'gold') {
if (
!this.addCount
) {
if (
this.addCount <= 1
) {
this.addCount ++;
this.addCount ++;
return;
return;
}
}
...
...
src/pages/index.wpy
View file @
01b31208
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
lastPage: 0,
lastPage: 0,
currentIndex: 5, // 商品当前滑动到第几个
currentIndex: 5, // 商品当前滑动到第几个
authmodal: false,
authmodal: false,
sign:
fals
e,
sign:
tru
e,
showAnimation: false,
showAnimation: false,
userImgStyle: '',
userImgStyle: '',
goldStyle: '',
goldStyle: '',
...
@@ -406,16 +406,7 @@
...
@@ -406,16 +406,7 @@
this.setUserInfo(e.$wx.detail.userInfo);
this.setUserInfo(e.$wx.detail.userInfo);
await this.getMainInfo();
await this.getMainInfo();
this.authmodal = false;
this.authmodal = false;
console.log('isRegister', wx.getStorageSync('isRegister'));
this.registUser(e.$wx.detail.userInfo);
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);
}
}
}
},
},
changeVideo(e) {
changeVideo(e) {
...
@@ -500,7 +491,6 @@
...
@@ -500,7 +491,6 @@
});
});
},
},
onShareAppMessage: function(res) {
onShareAppMessage: function(res) {
console.log(this.$wepy.userInfo, this.$wepy.awardsInfo);
if (res.from === 'button') {
if (res.from === 'button') {
console.log('onShareAppMessage2', res.target);
console.log('onShareAppMessage2', res.target);
}
}
...
@@ -524,6 +514,9 @@
...
@@ -524,6 +514,9 @@
getAwards: function() {
getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
if (!batchId) return;
if (!batchId) return;
if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {
Notify({ message: '您的克币数为0, 无法参与抽奖', background: '#FF5D15', safeAreaInsetTop: true});
}
wx.navigateTo({
wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
});
});
...
@@ -546,11 +539,23 @@
...
@@ -546,11 +539,23 @@
},
},
getMainInfo: async function() {
getMainInfo: async function() {
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
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) {
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true;
this.showShareModal = true;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
this.showAwardsModal = true;
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 @@
...
@@ -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 = await getPrizeList();
// this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' }));
},
},
async onLoad (options) {
async onLoad (options) {
if (options.openid) {
if (options.openid) {
...
@@ -603,18 +586,13 @@
...
@@ -603,18 +586,13 @@
if (setting.authSetting['scope.userInfo']) {
if (setting.authSetting['scope.userInfo']) {
const { userInfo } = await wepy.wx.getUserInfo();
const { userInfo } = await wepy.wx.getUserInfo();
this.setUserInfo(userInfo);
this.setUserInfo(userInfo);
if (wx.getStorageSync('isRegister') === false) {
this.registUser(userInfo);
const params = {
...userInfo,
inviter: this.inviter
};
await register(params);
wx.setStorageSync('isRegister', true);
}
await this.getMainInfo();
await this.getMainInfo();
} else {
} else {
this.authmodal = true;
this.authmodal = true;
}
}
} else {
this.registUser(this.userInfo);
}
}
},
},
onShow() {
onShow() {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment