增加平安用户端增加退出
This commit is contained in:
@@ -126,11 +126,22 @@ abstract class Base extends HD_Controller
|
||||
|
||||
/**
|
||||
* @param $view
|
||||
* @param false $refresh
|
||||
*/
|
||||
protected function show_view($view)
|
||||
protected function show_view($view, $refresh = false)
|
||||
{
|
||||
$this->load->view('h5/paic/header', $this->data);
|
||||
$this->load->view($view);
|
||||
$this->load->view('h5/paic/footer');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @return string
|
||||
*/
|
||||
protected function getUser()
|
||||
{
|
||||
$user = $this->session->userdata(self::LOGIN_USER_INFO);
|
||||
return $user ?: '';
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,12 @@ class Home extends Base
|
||||
}
|
||||
}
|
||||
}
|
||||
$user = $this->getUser();
|
||||
$userInfo = [
|
||||
'name' => $user['name'] ?: '',
|
||||
'belong_to' => App_paic_users_model::BELONG_TO_LIST[$user['belong_to']]
|
||||
];
|
||||
$this->data['userInfo'] = $userInfo;
|
||||
$this->data['tabList'] = $tabList;
|
||||
$this->data['_title'] = '我的推广';
|
||||
$this->show_view('h5/paic/home/enroll');
|
||||
|
||||
@@ -15,7 +15,7 @@ class Login extends Base
|
||||
|
||||
public function index()
|
||||
{
|
||||
if($this->uid){
|
||||
if ($this->uid) {
|
||||
header('Location:/h5/paic/home');
|
||||
}
|
||||
if ($this->input->is_ajax_request()) {
|
||||
@@ -67,7 +67,7 @@ class Login extends Base
|
||||
|
||||
public function logout()
|
||||
{
|
||||
// $_SESSION[self::SESSION_KEY] = '';
|
||||
$this->show_json('', 200, '退出成功');
|
||||
$this->session->set_userdata(self::LOGIN_USER_INFO, '');
|
||||
$this->success('', '退出成功');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,20 @@
|
||||
</style>
|
||||
<body>
|
||||
<div id="app" style="min-height: 100vh;" class="bg-f6 relative">
|
||||
<div class="inner20">
|
||||
<div class="relative pl20 pr200 bg-333 ulib-r750">
|
||||
<!--
|
||||
<img class='block absolute left-0 box-middle ml10 imgsize-32X32 ulib-r750' src='' />
|
||||
-->
|
||||
<div class="pt15 pb15 text-nowrap font-22 color-ddd">
|
||||
<span class="color-fff"><?= $userInfo['name'] ?>·</span>
|
||||
<span class="color-ddd"><?= $userInfo['belong_to'] ?></span>
|
||||
</div>
|
||||
<a class="block absolute right-0 mr20 box-middle bg-fff imgsize-32X32 ulib-r750" @click="logout">
|
||||
<i class="absolute box-center-middle iconfont font-24 icon-tuichu1"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<div class="relative pb30">
|
||||
<van-tabs v-model="active" sticky color="#000" @click="onChange">
|
||||
@@ -187,6 +201,27 @@
|
||||
},
|
||||
goDetail(id) {
|
||||
window.location.href = '/h5/paic/home/detail?id=' + id
|
||||
},
|
||||
logout() {
|
||||
vant.Dialog.confirm({
|
||||
title: '确定退出',
|
||||
message: '是否确认执行该操作?',
|
||||
}).then(() => {
|
||||
$.get('/h5/paic/login/logout', function (response) {
|
||||
if (response.code == 200) {
|
||||
vant.Toast.success({
|
||||
message: '退出成功',
|
||||
onClose: function () {
|
||||
window.location = '/h5/paic/login'
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vant.Toast.fail(response.msg);
|
||||
}
|
||||
}, 'json')
|
||||
}).catch(() => {
|
||||
console.log('用户点击了取消');
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user