访客页面
This commit is contained in:
1 parent
1c6c0a0f7b
commit
0a952f01c1
4 files changed
+239
-213
No files matched your search
@@ -95,6 +95,14 @@ const tabbar: TabbarItem[] = [
|
||||
selectedIconPath: "/static/tabbar/my-select.png",
|
||||
launchParam: ["canteen", "selfMerchant"],
|
||||
auth: ["user",],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/integrated/visitor/verify",
|
||||
text: "访客核销",
|
||||
iconPath: "/static/tabbar/my.png",
|
||||
selectedIconPath: "/static/tabbar/my-select.png",
|
||||
launchParam: ["canteen", "selfMerchant"],
|
||||
auth: ["user",],
|
||||
},
|
||||
{
|
||||
pagePath: "pages/tabbar/my",
|
||||
|
||||
+50
-149
@@ -9,67 +9,47 @@
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
// {
|
||||
// "path": "pages/tabbar/canteen",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "食堂",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/tabbar/selfMerchant",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "自营商家",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/tabbar/coopMerchant",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "合作商家",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/tabbar/order",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "订单",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/tabbar/flowStatistics",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "流水统计",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/tabbar/individualOrder",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "订单",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/integrated/visitor/myvisitor",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "访客",
|
||||
// "disableScroll": true
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/tabbar/my",
|
||||
"path": "pages/integrated/visitor/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"disableScroll": true
|
||||
"navigationBarTitleText": "访客申请",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/integrated/visitor/myvisitor",
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请记录",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/integrated/visitor/myyyvisitor",
|
||||
"style": {
|
||||
"navigationBarTitleText": "访客邀约",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/integrated/visitor/myyyvisitorlist",
|
||||
"style": {
|
||||
"navigationBarTitleText": "邀约记录",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/integrated/visitor/verify",
|
||||
"style": {
|
||||
"navigationBarTitleText": "访客核销",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"disableScroll": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
@@ -371,7 +351,7 @@
|
||||
{
|
||||
"path": "visitor/myyyvisitor",
|
||||
"style": {
|
||||
"navigationBarTitleText": "邀约访客"
|
||||
"navigationBarTitleText": "访客邀约"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -412,118 +392,39 @@
|
||||
{
|
||||
"pagePath": "pages/integrated/visitor/index",
|
||||
"text": "访客申请",
|
||||
"iconPath": "",
|
||||
"selectedIconPath": ""
|
||||
"iconPath": "static/tabbar/visitor-apply.png",
|
||||
"selectedIconPath": "static/tabbar/visitor-apply-select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/integrated/visitor/myvisitor",
|
||||
"text": "申请记录",
|
||||
"iconPath": "",
|
||||
"selectedIconPath": ""
|
||||
"iconPath": "static/tabbar/visitor-record.png",
|
||||
"selectedIconPath": "static/tabbar/visitor-record-select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/integrated/visitor/myyyvisitor",
|
||||
"text": "访客邀约",
|
||||
"iconPath": "",
|
||||
"selectedIconPath": ""
|
||||
"iconPath": "static/tabbar/visitor-invite.png",
|
||||
"selectedIconPath": "static/tabbar/visitor-invite-select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/integrated/visitor/myyyvisitorlist",
|
||||
"text": "邀约记录",
|
||||
"iconPath": "",
|
||||
"selectedIconPath": ""
|
||||
"iconPath": "static/tabbar/visitor-invited.png",
|
||||
"selectedIconPath": "static/tabbar/visitor-invited-select.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/integrated/visitor/verify",
|
||||
"text": "核销",
|
||||
"iconPath": "",
|
||||
"selectedIconPath": ""
|
||||
"text": "访客核销",
|
||||
"iconPath": "static/tabbar/visitor-verify.png",
|
||||
"selectedIconPath": "static/tabbar/visitor-verify-select.png"
|
||||
},
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/canteen",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/selfMerchant",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/coopMerchant",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/order",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/flowStatistics",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/individualOrder",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/my",
|
||||
// "text": "",
|
||||
// "iconPath": "",
|
||||
// "selectedIconPath": ""
|
||||
// }
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/canteen",
|
||||
// "text": "食堂",
|
||||
// "iconPath": "static/tabbar/canteen.png",
|
||||
// "selectedIconPath": "static/tabbar/canteen-select.png"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/selfMerchant",
|
||||
// "text": "自营商家",
|
||||
// "iconPath": "static/tabbar/selfMerchant.png",
|
||||
// "selectedIconPath": "static/tabbar/selfMerchant-select.png"
|
||||
// },
|
||||
// {
|
||||
// pagePath: "pages/tabbar/coopMerchant",
|
||||
// text: "合作商家",
|
||||
// iconPath: "static/tabbar/coopMerchant.png",
|
||||
// selectedIconPath: "static/tabbar/coopMerchant-select.png",
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/order",
|
||||
// "text": "订单",
|
||||
// "iconPath": "static/tabbar/order.png",
|
||||
// "selectedIconPath": "static/tabbar/order-select.png"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/flowStatistics",
|
||||
// "text": "流水统计",
|
||||
// "iconPath": "static/tabbar/order.png",
|
||||
// "selectedIconPath": "static/tabbar/order-select.png"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/tabbar/individualOrder",
|
||||
// "text": "订单",
|
||||
// "iconPath": "static/tabbar/order.png",
|
||||
// "selectedIconPath": "static/tabbar/order-select.png"
|
||||
// },
|
||||
{
|
||||
"pagePath": "pages/tabbar/my",
|
||||
"text": "我的",
|
||||
"iconPath": "static/tabbar/my.png",
|
||||
"selectedIconPath": "static/tabbar/my-select.png"
|
||||
}
|
||||
|
||||
{
|
||||
"pagePath": "pages/tabbar/my",
|
||||
"text": "我的",
|
||||
"iconPath": "static/tabbar/my.png",
|
||||
"selectedIconPath": "static/tabbar/my-select.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -69,30 +69,6 @@
|
||||
<view class="empty" v-if="!loading && visitorList.length === 0">
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
|
||||
<!-- 底部固定导航 -->
|
||||
<view class="bottom-nav">
|
||||
<view class="nav-item">
|
||||
<image src="/static/images/visitor/visitor-apply.png" mode="aspectFit" class="nav-icon"></image>
|
||||
<text class="nav-text active">访客申请</text>
|
||||
</view>
|
||||
<view class="nav-item">
|
||||
<image src="/static/images/visitor/visitor-record.png" mode="aspectFit" class="nav-icon"></image>
|
||||
<text class="nav-text">申请记录</text>
|
||||
</view>
|
||||
<view class="nav-item">
|
||||
<image src="/static/images/visitor/visitor-invite.png" mode="aspectFit" class="nav-icon"></image>
|
||||
<text class="nav-text">主动邀约</text>
|
||||
</view>
|
||||
<view class="nav-item">
|
||||
<image src="/static/images/visitor/visitor-invited.png" mode="aspectFit" class="nav-icon"></image>
|
||||
<text class="nav-text">邀约记录</text>
|
||||
</view>
|
||||
<view class="nav-item">
|
||||
<image src="/static/images/visitor/visitor-my.png" mode="aspectFit" class="nav-icon"></image>
|
||||
<text class="nav-text">我的</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -362,7 +338,7 @@ defineExpose({
|
||||
.page-container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
padding-bottom: 120rpx; // 为底部导航留出空间
|
||||
padding-bottom: 20rpx; // 修改底部间距
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
@@ -506,40 +482,4 @@ defineExpose({
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid #eee;
|
||||
padding-bottom: env(safe-area-inset-bottom); // 适配iPhone底部安全区
|
||||
|
||||
.nav-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
|
||||
.nav-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.nav-text {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
|
||||
&.active {
|
||||
color: #1777FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+180
-3
@@ -16,7 +16,7 @@
|
||||
</view>
|
||||
<text class="sub-text-26">ID {{ state.userInfo?.sysUser?.userId }}</text>
|
||||
</view>
|
||||
<view v-else class="flex-row items-center m-l-30rpx" @tap="onTabLogin">
|
||||
<view v-else class="flex-row items-center m-l-30rpx" @tap="showLoginPopup">
|
||||
<text class="sub-text-32">请先登录</text>
|
||||
<text class="iconfont icon-youjiantou" />
|
||||
</view>
|
||||
@@ -42,6 +42,40 @@
|
||||
切换角色
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 登录弹窗 -->
|
||||
<view class="login-popup" v-if="showLogin">
|
||||
<view class="popup-mask" @tap="closeLoginPopup"></view>
|
||||
<view class="popup-content">
|
||||
<view class="popup-header">
|
||||
<text class="popup-title">账号密码登录</text>
|
||||
<text class="popup-close" @tap="closeLoginPopup">×</text>
|
||||
</view>
|
||||
<view class="popup-body">
|
||||
<view class="input-item">
|
||||
<input
|
||||
type="text"
|
||||
v-model="loginForm.username"
|
||||
placeholder="请输入账号"
|
||||
placeholder-class="placeholder"
|
||||
class="input"
|
||||
/>
|
||||
</view>
|
||||
<view class="input-item">
|
||||
<input
|
||||
type="password"
|
||||
v-model="loginForm.password"
|
||||
placeholder="请输入密码"
|
||||
placeholder-class="placeholder"
|
||||
class="input"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="popup-footer">
|
||||
<button class="login-btn" @tap="handleLogin">登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
@@ -80,7 +114,7 @@ const state = reactive<{
|
||||
// { text: "访客记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myvisitor" },
|
||||
// { text: "访客邀约", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitor" },
|
||||
// { text: "邀约记录", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/myyyvisitorlist" },
|
||||
// { text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" },
|
||||
{ text: "访客核销", icon: "/static/icon/service_5.png", router: "/pages/integrated/visitor/verify" },
|
||||
|
||||
// { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" }
|
||||
],
|
||||
@@ -125,6 +159,59 @@ const storage = {
|
||||
},
|
||||
}
|
||||
|
||||
// 添加登录相关的状态
|
||||
const showLogin = ref(false)
|
||||
const loginForm = reactive({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
|
||||
// 显示登录弹窗
|
||||
const showLoginPopup = () => {
|
||||
showLogin.value = true
|
||||
}
|
||||
|
||||
// 关闭登录弹窗
|
||||
const closeLoginPopup = () => {
|
||||
showLogin.value = false
|
||||
loginForm.username = ''
|
||||
loginForm.password = ''
|
||||
}
|
||||
|
||||
// 处理账号密码登录
|
||||
const handleLogin = async () => {
|
||||
if (!loginForm.username || !loginForm.password) {
|
||||
uni.showToast({
|
||||
title: '请输入账号和密码',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
uni.showLoading({ title: '登录中...', mask: true })
|
||||
const response = await userApi.login({
|
||||
username: loginForm.username,
|
||||
password: loginForm.password
|
||||
})
|
||||
|
||||
if (response.code === 0) {
|
||||
storage.saveToken({ accessToken: response.data.accessToken })
|
||||
const { data: userData } = await userApi.userInfo()
|
||||
storage.saveUserInfo(userData)
|
||||
closeLoginPopup()
|
||||
uni.showToast({ title: '登录成功', icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: response.msg || '登录失败', icon: 'none' })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('登录失败:', error)
|
||||
uni.showToast({ title: '登录失败', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
const login = {
|
||||
// 检查应用环境并登录
|
||||
checkAppInfo: async () => {
|
||||
@@ -137,7 +224,8 @@ const login = {
|
||||
const zhengdingResult = login.zhengdingLogin()
|
||||
if (zhengdingResult) return
|
||||
|
||||
uni.showToast({ title: "当前登录环境未知", icon: "none" })
|
||||
// 如果都不是,显示账号密码登录弹窗
|
||||
showLoginPopup()
|
||||
} catch (error) {
|
||||
console.error("登录失败:", error)
|
||||
uni.showToast({ title: "登录失败", icon: "none" })
|
||||
@@ -393,4 +481,93 @@ onShow(() => {
|
||||
border-bottom: 1px solid #fafafa;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
// 添加登录弹窗样式
|
||||
.login-popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 100;
|
||||
|
||||
.popup-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
}
|
||||
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
|
||||
.popup-title {
|
||||
font-size: 32rpx;
|
||||
color: #323233;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.popup-close {
|
||||
font-size: 40rpx;
|
||||
color: #969799;
|
||||
padding: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-body {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.input-item {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #F7F8FA;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 30rpx;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #969799;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-footer {
|
||||
padding: 24rpx 32rpx;
|
||||
background: #fff;
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #1989FA;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user