Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
success(res) {
if (res.confirm) {
Taro.setStorageSync('Authorization', '')
Taro.setStorageSync('userInfo', null)
Taro.navigateBack()
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
handlerGobackClick() {
const pages = Taro.getCurrentPages();
if (pages.length >= 2) {
Taro.navigateBack({
delta: 1
});
} else {
Taro.navigateTo({
url: '/pages/index/index'
});
}
}
render() {
username,
password,
wxUserInfo,
code
}
})
switch (response.statusCode) {
case 200:
await Taro.setStorage({
key: 'token',
data: response.data
})
Taro.eventCenter.trigger('user::logged_in', response.data)
Taro.navigateBack()
break
case 404:
const result = await Taro.showModal({
title: '是否创建新用户',
content: '请求绑定的用户不存在,是否要创建一个新用户?'
})
if (result.confirm) {
this.setState({
action: 'register',
submitButtonText: '注册用户',
wxUserLogin: true
})
Taro.setNavigationBarTitle({
title: '注册用户'
data: {
username,
password
}
})
switch (response.statusCode) {
case 200:
await Taro.setStorage({
key: 'token',
data: response.data
})
Taro.eventCenter.trigger('user::logged_in', response.data)
Taro.navigateBack()
break
case 404:
Taro.atMessage({
type: 'error',
message: response.data
})
break
case 401:
Taro.atMessage({
type: 'error',
message: response.data
})
break
method: 'POST',
url: `${API_WS}/wx-login`,
data: {
code
}
})
switch (response.statusCode) {
case 200:
await Taro.setStorage({
key: 'token',
data: response.data
})
Taro.eventCenter.trigger('user::logged_in', response.data)
Taro.navigateBack()
break
case 404:
this.wxUserBind()
break
}
} catch (error) {
Taro.atMessage({
type: 'error',
message: '微信登录失败,请重试!'
})
}
}
success: (e) => {
if (e.confirm) {
Taro.navigateBack({
delta: 1
});
}
}
})
handlerGobackClick() {
const pages = Taro.getCurrentPages();
if (pages.length >= 2) {
Taro.navigateBack({
delta: 1
});
} else {
Taro.navigateTo({
url: '/pages/index/index'
});
}
}
render() {
yield takeEvery(ROUTER.DETAIL_ROUTER_BACK, function() {
const pages = Taro.getCurrentPages();
if (pages.length === 1) {
Taro.switchTab({ url: '/pages/recent/index' });
} else {
Taro.navigateBack();
}
});
}
const success = () => {
Taro.showToast({
title: '提交成功',
})
Taro.navigateBack()
}
if (id) {
handleBackClick() {
if (_isFunction(this.props.onBack)) {
this.props.onBack();
} else {
const pages = Taro.getCurrentPages();
if (pages.length >= 2) {
Taro.navigateBack({
delta: this.props.delta
});
}
}
}
handleGoHomeClick() {