peko
This commit is contained in:
71
view/peko/modules/logout/js/confirm.js
Normal file
71
view/peko/modules/logout/js/confirm.js
Normal file
@@ -0,0 +1,71 @@
|
||||
let urlPrefix = getUrlPrefix()
|
||||
const toastMsg = (content = '操作完成', time = 2) => {
|
||||
layer.open({
|
||||
content,
|
||||
time,
|
||||
skin: 'msg'
|
||||
})
|
||||
}
|
||||
|
||||
let text = ''
|
||||
$(function(){
|
||||
getInfoFromClient()
|
||||
|
||||
$('.confirm_btn').click(() => {
|
||||
text = $('.ipt').val().trim()
|
||||
if (text === '我已知晓并确认账号注销') {
|
||||
getUserInfo()
|
||||
$('.popup').show()
|
||||
} else {
|
||||
toastMsg('输入错误,请检查输入内容')
|
||||
}
|
||||
})
|
||||
|
||||
$('.cancel').click(() => {
|
||||
$('.popup').hide()
|
||||
})
|
||||
$('.confirm_final').click(() => {
|
||||
confirmLogout(text)
|
||||
$('.popup').hide()
|
||||
})
|
||||
})
|
||||
|
||||
const getUserInfo = () => {
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/user/getUserBase',
|
||||
data: {
|
||||
uid: pubInfo.uid
|
||||
},
|
||||
success(res) {
|
||||
if (res.code === 200) {
|
||||
$('.nick span').html(res.data.nick)
|
||||
$('.erbanNo span').html(res.data.erbanNo)
|
||||
} else {
|
||||
toastMsg(res.message)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
toastMsg('网络错误')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const confirmLogout = (text) => {
|
||||
networkRequest({
|
||||
type: 'POST',
|
||||
url: urlPrefix + '/user/cancel/users',
|
||||
data: {
|
||||
confirmTxt : text
|
||||
},
|
||||
success(res) {
|
||||
if (res.code === 200) {
|
||||
} else {
|
||||
toastMsg(res.message)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
toastMsg('网络错误')
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user