访客页面 退出登录

This commit is contained in:
liyuanchao 2025-08-23 18:08:54 +08:00
parent 8d6c55007e
commit f259275adb
3 changed files with 891 additions and 814 deletions

View File

@ -9,6 +9,9 @@ const install = (Vue, vm) => {
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
//获取单位列表
getUnits:(params = {}) => vm.$u.get(config.adminPath+'/property/enum-fetcher/enum-values/getUnit',params),
getcode:(params= {}) => vm.$u.post(config.adminPath+'/property/visitorManagement/getcode',params),
spfk:(params= {}) => vm.$u.put(config.adminPath+'/property/visitorManagement',params),
fklist:(params = {}) => vm.$u.get(config.adminPath+'/property/visitorManagement/list',params),

View File

@ -64,8 +64,17 @@
<view class="form-item">
<text class="label">被访单位</text>
<view class="input-wrapper">
<input type="text" placeholder="请输入被访单位名称" v-model="formData.interviewedUnit" />
<view class="select-wrapper" :class="{active: showUnitDialog}" @click.stop="showUnitDialog = true">
<text>{{ interviewedUnitLabel || '请选择被访单位' }}</text>
<image class="filter-img" src="/static/ic_down_arrow_g.png" />
<view v-if="showUnitDialog" class="dropdown">
<view class="dropdown-list">
<view v-for="(item, index) in unitList" :key="index" class="dropdown-item"
@click.stop="selectInterviewedUnit(item)">
{{ item.name }}
</view>
</view>
</view>
</view>
</view>
@ -138,6 +147,11 @@
</view>
</view>
</view>
<view class="form-item">
<view class="face-tip-wrapper">
<text class="face-tip">请确保无遮挡光线明亮正脸拍摄</text>
</view>
</view>
<!-- <view class="form-item">
<text class="label">预约状态</text>
@ -197,10 +211,20 @@
3: '已完成'
},
typeList: ['业务洽谈', '会议参与', '面试应聘', '技术支持', '办事咨询', '调研考察'],
showTypeDialog: false
showTypeDialog: false,
showUnitDialog: false,
unitList: []
}
},
computed: {
interviewedUnitLabel() {
if (!this.formData.interviewedUnit) return '';
const unit = this.unitList.find(item => item.value === this.formData.interviewedUnit);
return unit ? unit.name : '';
}
},
onLoad() {
this.getUnits()
// #ifdef APP-PLUS
plus.screen.lockOrientation('default');
// #endif
@ -211,15 +235,28 @@
// #endif
},
methods: {
async getUnits() {
console.log("t1","11111")
let res = await this.$u.api.getUnits();
if (res.code == '200') {
this.unitList = res.data;
}
},
// 访
selectVisitingReason(reason) {
this.formData.visitingReason = reason;
this.showTypeDialog = false;
},
// 访
selectInterviewedUnit(unit) {
this.formData.interviewedUnit = unit.value;
this.showUnitDialog = false;
},
//
handleClickOutside() {
this.showTypeDialog = false;
this.showUnitDialog = false;
},
//
@ -807,4 +844,14 @@
.dropdown-item:hover {
background-color: #f5f7fa;
}
.face-tip-wrapper {
flex: 1;
margin-left: 108px; /* 与label宽度和margin一致 */
}
.face-tip {
font-size: 12px;
color: #999;
}
</style>

View File

@ -46,6 +46,9 @@
</u-cell-group>
</view>
</view>
<view class="button-wrapper">
<button class="logout-btn" @click="logout">退出登录</button>
</view>
</view>
</template>
<script>
@ -74,17 +77,23 @@ export default {
});
},
logout() {
this.$u.api.logout().then(res => {
this.$u.toast(res.msg);
if (res.code == '200' || res.code == '401') {
let self = this;
setTimeout(() => {
uni.reLaunch({
url: '/pages/sys/login/index'
});
}, 500);
}
//
this.$u.vuex('vuex_user', {});
this.$u.vuex('vuex_token', '');
uni.reLaunch({
url: '/pages/sys/login/index'
});
// this.$u.api.logout().then(res => {
// this.$u.toast(res.msg);
// if (res.code == '200' || res.code == '401') {
// let self = this;
// setTimeout(() => {
// uni.reLaunch({
// url: '/pages/sys/login/index'
// });
// }, 500);
// }
// });
},
upgrade(){
// #ifdef APP-PLUS
@ -117,8 +126,12 @@ export default {
page {
background-color: #f5f5f5;
}
.button-wrapper {
padding: 80rpx 0;
}
.wrap .u-cell-box .u-cell_title{
color:#202328;
margin-bottom: 80rpx;
}
.sign-in-images{
width: 125rpx;
@ -131,4 +144,18 @@ page {
height:50rpx;
}
}
.logout-btn {
width: 80vw;
height: 80rpx;
background: #0090FF;
color: #fff;
font-size: 32rpx;
border: none;
border-radius: 40rpx;
display: block;
box-shadow: 0 18rpx 24rpx rgba(0, 0, 0, 0.18);
font-weight: bold;
margin: 0 auto;
}
</style>