You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
809 B
53 lines
809 B
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
showUploadTip: false,
|
|
haveGetOpenId: false,
|
|
envId: '',
|
|
openId: ''
|
|
},
|
|
|
|
onLoad(options) {
|
|
this.setData({
|
|
envId: options.envId
|
|
});
|
|
},
|
|
|
|
getOpenId() {
|
|
wx.showLoading({
|
|
title: '',
|
|
});
|
|
wx.cloud.callFunction({
|
|
name: 'quickstartFunctions',
|
|
config: {
|
|
env: this.data.envId
|
|
},
|
|
data: {
|
|
type: 'getOpenId'
|
|
}
|
|
}).then((resp) => {
|
|
this.setData({
|
|
haveGetOpenId: true,
|
|
openId: resp.result.openid
|
|
});
|
|
wx.hideLoading();
|
|
}).catch((e) => {
|
|
this.setData({
|
|
showUploadTip: true
|
|
});
|
|
wx.hideLoading();
|
|
});
|
|
},
|
|
|
|
clearOpenId() {
|
|
this.setData({
|
|
haveGetOpenId: false,
|
|
openId: ''
|
|
});
|
|
}
|
|
|
|
});
|