Compare commits

4 Commits
kslc ... main

Author SHA1 Message Date
冯辉
968e6b4091 阿里图标库引入 2025-10-20 16:15:29 +08:00
冯辉
d9c1f83693 微信授权登录功能开发联调 2025-10-20 11:43:44 +08:00
冯辉
ae91ded327 微信登录调试 2025-10-20 11:05:11 +08:00
冯辉
959e9ee9e4 登录注册逻辑开发 2025-10-17 13:15:14 +08:00
46 changed files with 4991 additions and 375 deletions

36
App.vue
View File

@@ -11,24 +11,26 @@ onLaunch((options) => {
useDictStore().getDictData();
// uni.hideTabBar();
// 登录
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
if (token) {
useUserStore()
.loginSetToken(token)
.then(() => {
$api.msg('登录成功');
})
.catch(() => {
uni.redirectTo({
url: '/pages/login/login',
// 尝试从缓存恢复用户信息
const restored = useUserStore().restoreUserInfo();
if (restored) {
// 如果成功恢复用户信息验证token是否有效
let token = uni.getStorageSync('token') || '';
if (token) {
useUserStore()
.loginSetToken(token)
.then(() => {
console.log('用户登录状态已恢复');
})
.catch(() => {
// token无效清除缓存不跳转登录页
console.log('token已过期需要重新登录');
useUserStore().logOut(false);
});
});
} else {
uni.redirectTo({
url: '/pages/login/login',
});
}
}
// 不再强制跳转到登录页,而是在需要登录时弹出授权弹窗
});
onMounted(() => {
@@ -53,6 +55,8 @@ onHide(() => {
/*每个页面公共css */
@import '@/common/animation.css';
@import '@/common/common.css';
/* 引入阿里图标库 */
@import url("/static/iconfont/iconfont.css");
/* 修改pages tabbar样式 H5有效 */
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
height: 110rpx !important;

View File

@@ -7,6 +7,42 @@ page {
overflow: hidden;
}
/* 安全区域适配 - 通用解决方案 */
/* #ifdef MP-WEIXIN */
.safe-area-container {
padding-top: env(safe-area-inset-top);
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
padding-bottom: env(safe-area-inset-bottom);
}
.safe-area-top {
padding-top: env(safe-area-inset-top);
}
.safe-area-left {
padding-left: env(safe-area-inset-left);
}
.safe-area-right {
padding-right: env(safe-area-inset-right);
}
.safe-area-bottom {
padding-bottom: env(safe-area-inset-bottom);
}
.safe-area-horizontal {
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
}
.safe-area-vertical {
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
/* #endif */
/* 禁止页面回弹 */
/* html,
body,

View File

@@ -0,0 +1,70 @@
<template>
<text class="iconfont" :class="iconClass" :style="iconStyle" @click="handleClick"></text>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
// 图标名称home、user、search
name: {
type: String,
required: true
},
// 图标大小单位rpx
size: {
type: [String, Number],
default: 32
},
// 图标颜色
color: {
type: String,
default: ''
},
// 是否粗体
bold: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['click'])
// 图标类名
const iconClass = computed(() => {
const prefix = props.name.startsWith('icon-') ? '' : 'icon-'
return `${prefix}${props.name}`
})
// 图标样式
const iconStyle = computed(() => {
const style = {
fontSize: `${props.size}rpx`
}
if (props.color) {
style.color = props.color
}
if (props.bold) {
style.fontWeight = 'bold'
}
return style
})
// 点击事件
const handleClick = (e) => {
emit('click', e)
}
</script>
<style scoped>
.iconfont {
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: inline-block;
}
</style>

View File

@@ -13,10 +13,10 @@
</view>
<text class="text-content button-click">{{ content }}</text>
<template v-if="showButton">
<uni-button class="popup-button button-click" v-if="isTip" @click="close">{{ buttonText }}</uni-button>
<button class="popup-button button-click" v-if="isTip" @click="close">{{ buttonText }}</button>
<view v-else class="confirm-btns">
<uni-button class="popup-button button-click" @click="close">{{ cancelText }}</uni-button>
<uni-button class="popup-button button-click" @click="confirm">{{ confirmText }}</uni-button>
<button class="popup-button button-click" @click="close">{{ cancelText }}</button>
<button class="popup-button button-click" @click="confirm">{{ confirmText }}</button>
</view>
</template>
</view>
@@ -137,4 +137,18 @@ export default {
}
}
}
// 重置button样式
button {
padding: 0;
margin: 0;
border: none;
background: none;
font-size: inherit;
line-height: inherit;
}
button::after {
border: none;
}
</style>

View File

@@ -62,7 +62,7 @@
</template>
<script setup>
import { inject, computed, toRaw, ref, defineExpose } from 'vue';
import { inject, computed, toRaw, ref } from 'vue';
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();

View File

@@ -75,10 +75,10 @@ const { getTransformChildren } = useDictStore();
// 岗位类型数据
const getJobTypeData = () => {
return [
{ label: '常规岗位', value: 'regular', text: '常规岗位' },
{ label: '就业见习岗位', value: 'internship', text: '就业见习岗位' },
{ label: '实习实训岗位', value: 'training', text: '实习实训岗位' },
{ label: '社区实践岗位', value: 'community', text: '社区实践岗位' }
{ label: '常规岗位', value: 0, text: '常规岗位' },
{ label: '就业见习岗位', value: 1, text: '就业见习岗位' },
{ label: '实习实训岗位', value: 2, text: '实习实训岗位' },
{ label: '社区实践岗位', value: 3, text: '社区实践岗位' }
];
};
@@ -201,13 +201,7 @@ defineExpose({
<style lang="scss" scoped>
.popup-fix {
position: fixed !important;
left: 0;
right: 0;
bottom: 0;
top: 0;
height: 100vh;
z-index: 9999;
z-index: 9999 !important;
}
.popup-content {
color: #000000;

View File

@@ -32,7 +32,7 @@
</template>
<script setup>
import { ref, reactive, computed, inject, nextTick, defineExpose, onMounted } from 'vue';
import { ref, reactive, computed, inject, nextTick, onMounted } from 'vue';
const { $api, navTo, setCheckedNodes, cloneDeep } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
import { storeToRefs } from 'pinia';

View File

@@ -19,7 +19,7 @@
</template>
<script setup>
import { ref, defineProps, onMounted, computed } from 'vue';
import { ref, onMounted, computed } from 'vue';
import { useReadMsg } from '@/stores/useReadMsg';
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
@@ -108,7 +108,8 @@ const tabbarList = computed(() => {
});
onMounted(() => {
uni.hideTabBar();
// 自定义TabBar不需要调用hideTabBar因为已经在pages.json中设置了custom: true
// uni.hideTabBar(); // 移除这行避免在自定义TabBar模式下调用
currentItem.value = props.currentpage;
});

View File

@@ -0,0 +1,386 @@
<template>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="auth-modal">
<view class="modal-content">
<!-- 关闭按钮 -->
<view class="close-btn" @click="close">
<uni-icons type="closeempty" size="24" color="#999"></uni-icons>
</view>
<!-- Logo和标题 -->
<view class="auth-header">
<image class="auth-logo" src="@/static/logo.png" mode="aspectFit"></image>
<view class="auth-title">欢迎使用就业服务</view>
<view class="auth-subtitle">需要您授权手机号登录</view>
</view>
<!-- 授权说明 -->
<view class="auth-tips">
<view class="tip-item">
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
<text>保护您的个人信息安全</text>
</view>
<view class="tip-item">
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
<text>为您推荐更合适的岗位</text>
</view>
<view class="tip-item">
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
<text>享受完整的就业服务</text>
</view>
</view>
<!-- 授权按钮 -->
<view class="auth-actions">
<!-- 微信小程序使用 open-type="getPhoneNumber" -->
<!-- #ifdef MP-WEIXIN -->
<button
class="auth-btn primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
<text>微信授权登录</text>
</button>
<!-- #endif -->
<!-- H5和App使用普通按钮 -->
<!-- #ifndef MP-WEIXIN -->
<button class="auth-btn primary" @click="wxLogin">
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
<text>微信授权登录</text>
</button>
<!-- #endif -->
<!-- 测试登录按钮仅开发环境 -->
<!-- #ifdef APP-PLUS || H5 -->
<button class="auth-btn secondary" @click="testLogin">
<text>测试账号登录</text>
</button>
<!-- #endif -->
</view>
<!-- 用户协议 -->
<view class="auth-agreement">
<text>登录即表示同意</text>
<text class="link" @click="openAgreement('user')">用户协议</text>
<text></text>
<text class="link" @click="openAgreement('privacy')">隐私政策</text>
</view>
</view>
</view>
</uni-popup>
</template>
<script setup>
import { ref, inject } from 'vue';
import useUserStore from '@/stores/useUserStore';
const { $api } = inject('globalFunction');
const { loginSetToken } = useUserStore();
const popup = ref(null);
const emit = defineEmits(['success', 'cancel']);
// 打开弹窗
const open = () => {
popup.value?.open();
};
// 关闭弹窗
const close = () => {
popup.value?.close();
emit('cancel');
};
// 微信小程序获取手机号
const getPhoneNumber = (e) => {
console.log('获取手机号:', e);
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const { code, encryptedData, iv } = e.detail;
// 调用后端接口进行登录
uni.showLoading({ title: '登录中...' });
$api.createRequest('/app/appLogin', {
code,
encryptedData,
iv
}, 'post').then((resData) => {
uni.hideLoading();
if (resData.token) {
// 登录成功存储token
loginSetToken(resData.token).then((resume) => {
$api.msg('登录成功');
close();
emit('success');
// 如果用户信息不完整,跳转到完善信息页面
if (!resume.data.jobTitleId) {
uni.navigateTo({
url: '/pages/login/login?step=1'
});
}
}).catch(() => {
$api.msg('获取用户信息失败');
});
} else {
$api.msg('登录失败,请重试');
}
}).catch((err) => {
uni.hideLoading();
$api.msg(err.msg || '登录失败,请重试');
});
} else if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
$api.msg('您取消了授权');
} else {
$api.msg('获取手机号失败');
}
};
// H5/App 微信登录
const wxLogin = () => {
// #ifdef H5
// H5网页微信登录逻辑
uni.showLoading({ title: '登录中...' });
// 获取微信授权code
uni.login({
provider: 'weixin',
success: (loginRes) => {
console.log('微信登录成功:', loginRes);
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', {
code: loginRes.code
}, 'post').then((resData) => {
uni.hideLoading();
if (resData.token) {
loginSetToken(resData.token).then((resume) => {
$api.msg('登录成功');
close();
emit('success');
if (!resume.data.jobTitleId) {
uni.navigateTo({
url: '/pages/login/login?step=1'
});
}
});
} else {
$api.msg('登录失败,请重试');
}
}).catch((err) => {
uni.hideLoading();
$api.msg(err.msg || '登录失败,请重试');
});
},
fail: (err) => {
uni.hideLoading();
console.error('微信登录失败:', err);
$api.msg('微信登录失败');
}
});
// #endif
// #ifdef APP-PLUS
// App微信登录逻辑
uni.getProvider({
service: 'oauth',
success: (res) => {
if (~res.provider.indexOf('weixin')) {
uni.login({
provider: 'weixin',
success: (loginRes) => {
console.log('微信登录成功:', loginRes);
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', {
code: loginRes.code
}, 'post').then((resData) => {
if (resData.token) {
loginSetToken(resData.token).then((resume) => {
$api.msg('登录成功');
close();
emit('success');
if (!resume.data.jobTitleId) {
uni.navigateTo({
url: '/pages/login/login?step=1'
});
}
});
}
});
},
fail: (err) => {
console.error('微信登录失败:', err);
$api.msg('微信登录失败');
}
});
}
}
});
// #endif
};
// 测试账号登录(仅开发环境)
const testLogin = () => {
uni.showLoading({ title: '登录中...' });
const params = {
username: 'test',
password: 'test',
};
$api.createRequest('/app/login', params, 'post').then((resData) => {
uni.hideLoading();
loginSetToken(resData.token).then((resume) => {
$api.msg('测试登录成功');
close();
emit('success');
if (!resume.data.jobTitleId) {
uni.navigateTo({
url: '/pages/login/login?step=1'
});
}
}).catch(() => {
$api.msg('获取用户信息失败');
});
}).catch((err) => {
uni.hideLoading();
$api.msg(err.msg || '登录失败');
});
};
// 打开用户协议
const openAgreement = (type) => {
const urls = {
user: '/pages/agreement/user',
privacy: '/pages/agreement/privacy'
};
if (urls[type]) {
uni.navigateTo({
url: urls[type]
});
}
};
// 暴露方法供父组件调用
defineExpose({
open,
close
});
</script>
<style lang="stylus" scoped>
.auth-modal
width: 620rpx
background: #FFFFFF
border-radius: 24rpx
overflow: hidden
.modal-content
padding: 60rpx 40rpx 40rpx
position: relative
.close-btn
position: absolute
right: 20rpx
top: 20rpx
width: 60rpx
height: 60rpx
display: flex
align-items: center
justify-content: center
z-index: 10
.auth-header
text-align: center
margin-bottom: 40rpx
.auth-logo
width: 120rpx
height: 120rpx
margin: 0 auto 24rpx
.auth-title
font-size: 36rpx
font-weight: 600
color: #333333
margin-bottom: 12rpx
.auth-subtitle
font-size: 28rpx
color: #666666
.auth-tips
background: #F7F8FA
border-radius: 16rpx
padding: 24rpx
margin-bottom: 40rpx
.tip-item
display: flex
align-items: center
margin-bottom: 16rpx
font-size: 26rpx
color: #666666
&:last-child
margin-bottom: 0
text
margin-left: 12rpx
.auth-actions
margin-bottom: 32rpx
.auth-btn
width: 100%
height: 88rpx
border-radius: 44rpx
display: flex
align-items: center
justify-content: center
font-size: 32rpx
font-weight: 500
border: none
margin-bottom: 20rpx
&:last-child
margin-bottom: 0
&.primary
background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%)
color: #FFFFFF
box-shadow: 0 8rpx 20rpx rgba(37, 107, 250, 0.3)
&.secondary
background: #F7F8FA
color: #666666
text
margin-left: 12rpx
.auth-agreement
text-align: center
font-size: 24rpx
color: #999999
line-height: 1.6
.link
color: #256BFA
text-decoration: underline
// 按钮重置样式
button::after
border: none
</style>

102
config/icons.js Normal file
View File

@@ -0,0 +1,102 @@
/**
* 图标配置文件
* 统一管理项目中使用的所有图标名称
* 使用方式import { ICONS } from '@/config/icons'
*/
export const ICONS = {
// 导航类
HOME: 'home',
SEARCH: 'search',
USER: 'user',
SETTING: 'setting',
BACK: 'back',
CLOSE: 'close',
MENU: 'menu',
MORE: 'more',
// 操作类
ADD: 'add',
EDIT: 'edit',
DELETE: 'delete',
SAVE: 'save',
REFRESH: 'refresh',
UPLOAD: 'upload',
DOWNLOAD: 'download',
SHARE: 'share',
FILTER: 'filter',
SORT: 'sort',
// 通讯类
PHONE: 'phone',
MESSAGE: 'message',
EMAIL: 'email',
CHAT: 'chat',
NOTIFICATION: 'notification',
// 位置类
LOCATION: 'location',
MAP: 'map',
NAVIGATE: 'navigate',
// 状态类
SUCCESS: 'success',
ERROR: 'error',
WARNING: 'warning',
INFO: 'info',
LOADING: 'loading',
// 媒体类
IMAGE: 'image',
VIDEO: 'video',
AUDIO: 'audio',
FILE: 'file',
CAMERA: 'camera',
// 交互类
LIKE: 'like',
STAR: 'star',
COLLECT: 'collect',
COMMENT: 'comment',
EYE: 'eye',
HEART: 'heart',
// 箭头类
ARROW_UP: 'arrow-up',
ARROW_DOWN: 'arrow-down',
ARROW_LEFT: 'arrow-left',
ARROW_RIGHT: 'arrow-right',
// 其他
TIME: 'time',
DATE: 'date',
CALENDAR: 'calendar',
LOCK: 'lock',
UNLOCK: 'unlock',
HELP: 'help',
QUESTION: 'question',
}
// 图标尺寸预设
export const ICON_SIZES = {
MINI: 24,
SMALL: 28,
NORMAL: 32,
LARGE: 40,
XLARGE: 48,
}
// 图标颜色预设
export const ICON_COLORS = {
PRIMARY: '#13C57C',
SECONDARY: '#256BFA',
SUCCESS: '#13C57C',
WARNING: '#FF9800',
DANGER: '#F44336',
INFO: '#2196F3',
TEXT: '#333333',
TEXT_SECONDARY: '#666666',
TEXT_PLACEHOLDER: '#999999',
WHITE: '#FFFFFF',
}

View File

@@ -0,0 +1,318 @@
# H5端CSS引入问题解决方案
## ❌ 错误提示
```
iconfont.css:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/css". Strict MIME type checking is enforced for module scripts per HTML spec.
```
## 🔍 问题原因
`main.js` 中使用了 **错误的方式** 引入CSS文件
```javascript
// ❌ 错误尝试将CSS作为JavaScript模块导入
import './static/iconfont/iconfont.css'
```
这种 `import` 语法在H5端会导致浏览器尝试将CSS文件作为JavaScript模块加载从而产生MIME类型错误。
## ✅ 解决方案
### 方案一:在 App.vue 中使用 @import推荐
`App.vue``<style>` 标签中使用CSS的 `@import` 语法:
```vue
<style>
/* 引入阿里图标库 */
@import url("/static/iconfont/iconfont.css");
</style>
```
**优点:**
- ✅ 所有平台兼容H5、小程序、App
- ✅ 符合CSS规范
- ✅ 全局生效
### 方案二:条件编译(如果必须在 main.js 中引入)
如果确实需要在 `main.js` 中引入,使用条件编译:
```javascript
// #ifndef H5
import './static/iconfont/iconfont.css'
// #endif
```
然后在 `App.vue` 中单独为H5引入
```vue
<style>
/* #ifdef H5 */
@import url("/static/iconfont/iconfont.css");
/* #endif */
</style>
```
## 📋 CSS引入方式对比
### JavaScript import不推荐用于CSS
```javascript
// ❌ 在 main.js 中
import './static/iconfont/iconfont.css'
```
**问题:**
- H5端会报MIME类型错误
- 将CSS当作JavaScript模块处理
### CSS @import推荐
```vue
<!-- App.vue 或其他 .vue 文件中 -->
<style>
@import url("/static/iconfont/iconfont.css");
</style>
```
**优点:**
- 所有平台兼容
- 符合CSS标准
- 不会产生MIME类型错误
### 使用 <style> 标签的 src 属性(可选)
```vue
<style src="/static/iconfont/iconfont.css"></style>
```
## 🔧 修复步骤
### Step 1: 删除 main.js 中的CSS import
打开 `main.js`,找到并删除或注释掉:
```javascript
// import './static/iconfont/iconfont.css' // 删除这行
```
### Step 2: 确认 App.vue 中的引入
确保 `App.vue` 中有正确的CSS引入
```vue
<style>
@import '@/common/animation.css';
@import '@/common/common.css';
/* 引入阿里图标库 */
@import url("/static/iconfont/iconfont.css");
</style>
```
### Step 3: 清除缓存并重新编译
1. 关闭开发服务器
2. 清除浏览器缓存
3. 重新运行 `npm run dev:h5` 或点击HBuilderX的运行按钮
## 🎯 最佳实践
### 全局CSS引入位置
**推荐顺序:**
```vue
<!-- App.vue -->
<style>
/* 1. 重置样式 / 通用样式 */
@import '@/common/reset.css';
@import '@/common/common.css';
/* 2. 第三方库样式 */
@import url("/static/iconfont/iconfont.css");
/* 3. 动画效果 */
@import '@/common/animation.css';
/* 4. 项目全局样式 */
/* 自定义全局样式 */
</style>
```
### 路径写法
**绝对路径(推荐):**
```css
@import url("/static/iconfont/iconfont.css");
```
**相对路径:**
```css
@import url("./static/iconfont/iconfont.css");
@import url("@/static/iconfont/iconfont.css");
```
**注意:** 在不同平台上路径解析可能有差异,推荐使用绝对路径。
## 🚫 常见错误
### 错误1在 main.js 中 import CSS
```javascript
// ❌ 错误
import './styles/global.css'
import '@/static/iconfont/iconfont.css'
```
**解决:** 改用 App.vue 的 `@import`
### 错误2路径不正确
```css
/* ❌ 错误:路径错误 */
@import url("static/iconfont/iconfont.css");
/* ✅ 正确:使用正确的路径 */
@import url("/static/iconfont/iconfont.css");
```
### 错误3缺少分号
```css
/* ❌ 错误:缺少分号 */
@import url("/static/iconfont/iconfont.css")
/* ✅ 正确:添加分号 */
@import url("/static/iconfont/iconfont.css");
```
### 错误4在 scoped 样式中引入
```vue
<!-- 不推荐 scoped 样式中引入全局CSS -->
<style scoped>
@import url("/static/iconfont/iconfont.css");
</style>
<!-- 推荐全局样式不要加 scoped -->
<style>
@import url("/static/iconfont/iconfont.css");
</style>
```
## 📊 平台兼容性
| 引入方式 | H5 | 小程序 | App | 推荐 |
|---------|----|----|-----|-----|
| main.js import | ❌ | ✅ | ✅ | ❌ |
| App.vue @import | ✅ | ✅ | ✅ | ✅ |
| style src | ✅ | ✅ | ✅ | ✅ |
| 条件编译 | ✅ | ✅ | ✅ | ⚠️ |
## 🔍 调试方法
### 1. 检查CSS是否加载
在浏览器开发者工具中:
```
F12 → Network → Filter: CSS → 查找 iconfont.css
```
**成功标志:**
- 状态码200
- Type: stylesheet
- Size: 文件大小正常
### 2. 检查字体文件
```
F12 → Network → Filter: Font → 查找 iconfont.ttf/woff
```
### 3. 检查控制台错误
```
F12 → Console → 查看是否有错误信息
```
### 4. 验证样式生效
```javascript
// 在控制台执行
document.querySelector('.iconfont')
// 应该能找到使用了 iconfont 类的元素
```
## ✅ 验证成功
修复后,应该看到:
1. ✅ H5端控制台无CSS加载错误
2. ✅ 图标正常显示
3. ✅ Network 中 iconfont.css 状态码为 200
4. ✅ 字体文件正常加载
## 📝 注意事项
### uni-app 项目特点
1. **多平台编译**
- H5端使用浏览器标准
- 小程序有自己的规范
- App使用原生渲染
2. **路径处理**
- `@/` 代表项目根目录
- `/static/` 代表静态资源目录
- 不同平台路径解析略有差异
3. **样式隔离**
- `scoped` 样式只在当前组件生效
- 全局样式在 App.vue 中引入
- 不要在 scoped 中引入全局CSS
### Vite 项目特点
如果使用 Vite 构建HBuilderX 3.2+
```javascript
// main.js 中可以使用(但不推荐)
import './static/iconfont/iconfont.css'
```
但为了兼容性,仍然推荐在 App.vue 中使用 `@import`
## 🎉 总结
### 问题
`main.js` 中使用 `import` 引入CSS导致H5端报错。
### 解决
1. ✅ 删除 `main.js` 中的 CSS import
2. ✅ 在 `App.vue``<style>` 中使用 `@import`
3. ✅ 重启开发服务器
### 最佳实践
- 所有全局CSS在 `App.vue` 中通过 `@import` 引入
- 使用绝对路径:`/static/...`
- 不要在 `scoped` 样式中引入全局CSS
- 保持引入顺序:重置 → 第三方 → 动画 → 自定义
## 📚 相关文档
- [uni-app 样式导入](https://uniapp.dcloud.net.cn/tutorial/syntax-css.html#%E6%A0%B7%E5%BC%8F%E5%AF%BC%E5%85%A5)
- [CSS @import](https://developer.mozilla.org/zh-CN/docs/Web/CSS/@import)
- [Vite 静态资源处理](https://cn.vitejs.dev/guide/assets.html)
---
**该问题已解决!** 🎉
现在H5端应该可以正常加载CSS文件了。如果还有问题请检查
1. 文件路径是否正确
2. 是否清除了浏览器缓存
3. 是否重启了开发服务器

View File

@@ -0,0 +1,442 @@
# HBuilderX小程序编译错误解决方案
## 错误信息
```
[vite]: Rollup failed to resolve import "@dcloudio/uni-ui/lib/uni-button/uni-button.vue" from "components/MsgTips/MsgTips.vue".
[@vue/compiler-sfc] `defineExpose` is a compiler macro and no longer needs to be imported.
[@vue/compiler-sfc] `defineProps` is a compiler macro and no longer needs to be imported.
[@vue/compiler-sfc] `defineEmits` is a compiler macro and no longer needs to be imported.
```
## 问题分析
### 问题1uni-button 组件未安装
**原因:**
- `uni-button` 不是 uni-app 的内置组件
- 项目中使用了 `<uni-button>` 但没有安装 `@dcloudio/uni-ui` 完整包
- 只安装了部分组件uni-popup、uni-icons等
**解决方案:**
使用原生 `<button>` 替代 `<uni-button>`
### 问题2Vue编译器宏错误导入
**原因:**
- `defineProps``defineEmits``defineExpose` 是 Vue 3 的编译器宏
- 它们由编译器自动注入,不需要从 vue 中导入
-`<script setup>` 中可以直接使用
**错误写法:**
```javascript
import { defineProps, defineEmits, defineExpose } from 'vue'
```
**正确写法:**
```javascript
// 无需导入,直接使用
const props = defineProps({...})
const emit = defineEmits([...])
defineExpose({...})
```
## ✅ 已修复的文件
### 1. components/MsgTips/MsgTips.vue
**修改内容:**
- ✅ 将 `<uni-button>` 替换为 `<button>`
- ✅ 添加了 button 样式重置
**修改前:**
```vue
<uni-button class="popup-button" @click="close">确定</uni-button>
```
**修改后:**
```vue
<button class="popup-button" @click="close">确定</button>
```
**样式重置:**
```scss
button {
padding: 0;
margin: 0;
border: none;
background: none;
font-size: inherit;
line-height: inherit;
}
button::after {
border: none;
}
```
### 2. pages/chat/components/ai-paging.vue
**修改内容:**
- ✅ 移除 `defineProps``defineEmits` 的导入
**修改前:**
```javascript
import {
ref,
defineProps,
defineEmits,
// ...
} from 'vue';
```
**修改后:**
```javascript
import {
ref,
// 移除了 defineProps 和 defineEmits
// ...
} from 'vue';
```
### 3. components/tabbar/midell-box.vue
**修改内容:**
- ✅ 移除 `defineProps` 的导入
### 4. pages/chat/components/popupbadFeeback.vue
**修改内容:**
- ✅ 移除 `defineEmits` 的导入
### 5. components/selectJobs/selectJobs.vue
**修改内容:**
- ✅ 移除 `defineExpose` 的导入
### 6. components/renderJobs/renderJobsCheckBox.vue
**修改内容:**
- ✅ 移除 `defineExpose` 的导入
## 📋 Vue 3 Composition API 编译器宏
### 什么是编译器宏?
编译器宏是 Vue 3 在 `<script setup>` 中提供的特殊函数,由编译器在编译时处理,不是运行时的函数。
### 常用编译器宏
| 宏名称 | 作用 | 是否需要导入 |
|--------|------|------------|
| `defineProps` | 定义组件 props | ❌ 不需要 |
| `defineEmits` | 定义组件事件 | ❌ 不需要 |
| `defineExpose` | 暴露组件方法/属性 | ❌ 不需要 |
| `withDefaults` | 为 props 设置默认值 | ❌ 不需要 |
| `defineOptions` | 定义组件选项 | ❌ 不需要 |
| `defineSlots` | 定义插槽类型 | ❌ 不需要 |
| `defineModel` | 定义 v-model | ❌ 不需要 |
### 正确使用示例
```vue
<script setup>
// ✅ 正确:直接使用,无需导入
const props = defineProps({
name: String,
age: Number
})
const emit = defineEmits(['update', 'change'])
defineExpose({
open,
close
})
// ❌ 错误:不要从 vue 导入
// import { defineProps } from 'vue'
</script>
```
## 🔧 替代方案
### 如果确实需要 uni-ui
如果项目中大量使用了 uni-ui 组件,可以安装完整的 uni-ui
```bash
npm install @dcloudio/uni-ui
```
然后在 `pages.json` 中配置:
```json
{
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
}
}
```
### 使用原生组件的优势
1.**更小的包体积** - 不需要引入额外的库
2.**更好的兼容性** - 原生组件在所有平台都可用
3.**更快的编译速度** - 减少依赖解析
4.**更灵活的样式** - 可以完全自定义
## 🎯 button vs uni-button 对比
### 原生 button
```vue
<button class="custom-btn" @click="handleClick">
点击我
</button>
<style>
.custom-btn {
width: 100%;
height: 80rpx;
background: #256BFA;
color: white;
border-radius: 12rpx;
border: none;
}
button::after {
border: none; /* 移除默认边框 */
}
</style>
```
**优点:**
- ✅ 无需安装依赖
- ✅ 完全自定义样式
- ✅ 支持所有平台
- ✅ 性能更好
**缺点:**
- ⚠️ 需要手动重置样式
- ⚠️ 需要自己实现 loading、disabled 等状态
### uni-button
```vue
<uni-button type="primary" @click="handleClick">
点击我
</uni-button>
```
**优点:**
- ✅ 内置多种样式
- ✅ 自带 loading、disabled 状态
- ✅ 统一的UI风格
**缺点:**
- ❌ 需要安装 uni-ui
- ❌ 增加包体积
- ❌ 自定义样式受限
## 📝 button 样式重置模板
推荐在全局样式中添加 button 重置:
```css
/* App.vue 或 common.css */
/* 重置 button 默认样式 */
button {
padding: 0;
margin: 0;
border: none;
background: none;
font-size: inherit;
font-family: inherit;
color: inherit;
line-height: inherit;
text-align: inherit;
cursor: pointer;
box-sizing: border-box;
}
/* 移除微信小程序 button 的默认边框 */
button::after {
border: none;
}
/* 移除 button 按下时的背景色 */
button:active {
background-color: inherit;
}
/* 通用按钮样式 */
.btn {
display: inline-block;
padding: 20rpx 40rpx;
border-radius: 12rpx;
text-align: center;
transition: all 0.3s;
}
.btn-primary {
background: linear-gradient(135deg, #13C57C 0%, #0FA368 100%);
color: #FFFFFF;
box-shadow: 0 8rpx 20rpx rgba(19, 197, 124, 0.3);
}
.btn-secondary {
background: #F7F8FA;
color: #666666;
}
```
## ⚠️ 注意事项
### 1. 编译器宏的特殊性
```javascript
// ❌ 错误:不能解构或重命名
import { defineProps as props } from 'vue'
// ❌ 错误:不能在条件语句中使用
if (someCondition) {
defineProps({...})
}
// ✅ 正确:直接在顶层使用
const props = defineProps({...})
```
### 2. TypeScript 支持
如果使用 TypeScript编译器宏会自动获得类型支持
```typescript
<script setup lang="ts">
// 自动获得类型提示
const props = defineProps<{
name: string
age?: number
}>()
const emit = defineEmits<{
update: [value: string]
change: [id: number]
}>()
</script>
```
### 3. 在非 setup 语法中
如果不使用 `<script setup>`,需要用传统方式:
```vue
<script>
export default {
props: {
name: String
},
emits: ['update'],
setup(props, { emit, expose }) {
// ...
expose({ open, close })
}
}
</script>
```
## ✅ 验证修复
修复后,重新编译项目应该看到:
1. ✅ 没有 "Rollup failed to resolve import" 错误
2. ✅ 没有 "defineXxx is a compiler macro" 警告
3. ✅ 小程序正常编译和运行
4. ✅ 按钮样式显示正常
## 🔍 排查步骤
如果修复后仍然有问题:
### 1. 清除缓存
```
HBuilderX:
运行 → 停止运行
工具 → 清除缓存
重新运行
```
### 2. 检查所有文件
使用全局搜索检查是否还有遗漏:
```
Ctrl + Shift + F
搜索: import.*defineProps
搜索: import.*defineEmits
搜索: import.*defineExpose
```
### 3. 检查 pages.json
确保 easycom 配置正确:
```json
{
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
}
}
```
### 4. 重新安装依赖
```bash
# 删除 node_modules 和 lock 文件
rm -rf node_modules
rm package-lock.json
# 重新安装
npm install
```
## 📚 相关文档
- [Vue 3 script setup 文档](https://cn.vuejs.org/api/sfc-script-setup.html)
- [uni-app button 组件](https://uniapp.dcloud.net.cn/component/button.html)
- [uni-ui 文档](https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html)
- [Vite 构建优化](https://cn.vitejs.dev/guide/dep-pre-bundling.html)
## 🎉 总结
### 问题
1. 使用了未安装的 `uni-button` 组件
2. 错误地从 vue 导入了编译器宏
### 解决
1. ✅ 将 `<uni-button>` 替换为 `<button>`
2. ✅ 移除所有编译器宏的 import 语句
3. ✅ 添加 button 样式重置
### 最佳实践
- 优先使用原生组件
- 不要导入 Vue 编译器宏
- 保持依赖简洁
- 定期清理未使用的代码
---
**所有错误已修复!** 🎉
现在可以正常编译和运行小程序了。

View File

@@ -0,0 +1,284 @@
# 微信小程序组件依赖问题解决方案
## 问题描述
```
components/IconfontIcon/IconfontIcon.js 已被代码依赖分析忽略,无法被其他模块引用。
你可根据控制台中的【代码依赖分析】告警信息修改代码,或关闭【过滤无依赖文件】功能。
```
## 问题原因
1. **组件未被正确引用** - 组件文件存在但没有被任何页面或组件引用
2. **缺少 easycom 配置** - uni-app 项目需要在 `pages.json` 中配置组件自动引入
3. **文件路径问题** - 组件路径不正确或文件名不匹配
## ✅ 解决方案
### 方案一:配置 easycom 自动引入(推荐)✨
`pages.json` 中添加 `easycom` 配置:
```json
{
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
"^IconfontIcon$": "@/components/IconfontIcon/IconfontIcon.vue",
"^WxAuthLogin$": "@/components/WxAuthLogin/WxAuthLogin.vue"
}
}
}
```
**配置说明:**
- `autoscan: true` - 自动扫描 `components` 目录
- `custom` - 自定义组件路径映射
- `^IconfontIcon$` - 组件名称(大小写敏感)
- 配置后无需 import直接在模板中使用
**使用方式:**
```vue
<template>
<!-- 无需 import直接使用 -->
<IconfontIcon name="home" :size="48" />
<WxAuthLogin ref="loginRef" />
</template>
```
### 方案二:手动引入组件
如果不想使用 easycom可以在需要的页面手动引入
```vue
<script setup>
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
</script>
<template>
<IconfontIcon name="home" />
</template>
```
### 方案三:关闭"过滤无依赖文件"功能
如果组件确实暂时不需要使用,可以在微信开发者工具中关闭此功能:
1. 打开微信开发者工具
2. 点击右上角"详情"
3. 找到"本地设置"标签
4. 取消勾选"过滤无依赖文件"
**注意:** 不推荐此方法,因为会增加打包体积。
## 🔧 完整操作步骤
### Step 1: 确认文件结构
确保组件文件存在且路径正确:
```
components/
├── IconfontIcon/
│ └── IconfontIcon.vue ✅ 文件存在
└── WxAuthLogin/
└── WxAuthLogin.vue ✅ 文件存在
```
### Step 2: 修改 pages.json
已为你自动添加了 easycom 配置,位置在 `globalStyle` 后面。
### Step 3: 重启微信开发者工具
1. 关闭微信开发者工具
2. 重新打开项目
3. 等待编译完成
### Step 4: 清除缓存
如果问题仍然存在:
1. 点击顶部菜单"工具" → "清除缓存"
2. 选择"清除文件缓存"
3. 重新编译项目
### Step 5: 验证组件可用
在任意页面中测试:
```vue
<template>
<view>
<IconfontIcon name="home" :size="48" color="#13C57C" />
</view>
</template>
<script setup>
// 使用 easycom 后无需 import
</script>
```
## 📋 配置详解
### easycom 规则说明
```json
{
"easycom": {
// 是否自动扫描 components 目录
"autoscan": true,
// 自定义规则
"custom": {
// 格式: "匹配规则": "组件路径"
"^IconfontIcon$": "@/components/IconfontIcon/IconfontIcon.vue"
}
}
}
```
**匹配规则说明:**
- `^` - 字符串开始
- `$` - 字符串结束
- `^IconfontIcon$` - 精确匹配 `IconfontIcon`
- `^uni-(.*)` - 匹配所有 `uni-` 开头的组件
### 组件命名规范
**推荐命名:**
-`IconfontIcon` - 大驼峰命名
-`WxAuthLogin` - 大驼峰命名
-`MyCustomComponent` - 大驼峰命名
**不推荐:**
-`iconfontIcon` - 小驼峰
-`iconfont-icon` - 短横线
-`Iconfont_Icon` - 下划线
## 🎯 常见问题
### Q1: 配置后仍然报错?
**解决方法:**
1. 检查 `pages.json` 语法是否正确JSON格式
2. 确认组件路径是否正确
3. 重启微信开发者工具
4. 清除缓存后重新编译
### Q2: 组件找不到?
**检查清单:**
- [ ] 文件路径是否正确:`@/components/IconfontIcon/IconfontIcon.vue`
- [ ] 文件名大小写是否一致
- [ ] 组件名称是否与配置匹配
- [ ] 是否重启了开发者工具
### Q3: 在页面中使用组件报错?
**常见原因:**
```vue
<!-- 错误使用了短横线命名 -->
<iconfont-icon name="home" />
<!-- 正确使用大驼峰命名 -->
<IconfontIcon name="home" />
```
### Q4: 多个组件如何配置?
```json
{
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
"^IconfontIcon$": "@/components/IconfontIcon/IconfontIcon.vue",
"^WxAuthLogin$": "@/components/WxAuthLogin/WxAuthLogin.vue",
"^CustomButton$": "@/components/CustomButton/CustomButton.vue"
}
}
}
```
### Q5: autoscan 和 custom 的区别?
**autoscan自动扫描**
```
components/
├── CustomButton/
│ └── CustomButton.vue → 自动识别为 <CustomButton>
├── MyCard/
│ └── MyCard.vue → 自动识别为 <MyCard>
```
**custom自定义规则**
```json
{
"custom": {
"^Button$": "@/components/CustomButton/CustomButton.vue"
}
}
```
使用 `<Button>` 会映射到 `CustomButton.vue`
## 🔍 调试方法
### 1. 查看编译日志
在微信开发者工具控制台查看编译信息:
```
点击顶部"编译" → 查看控制台输出
```
### 2. 检查组件是否被打包
1. 打开"详情" → "本地设置"
2. 查看"代码依赖分析"信息
3. 确认组件是否在依赖树中
### 3. 手动引入测试
```vue
<script setup>
// 临时测试:手动引入
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
console.log('组件加载成功:', IconfontIcon)
</script>
```
## ✅ 验证成功标志
配置成功后,应该看到:
1. ✅ 微信开发者工具控制台无警告
2. ✅ 组件可以正常显示
3. ✅ 无需 import 即可使用
4. ✅ 组件出现在代码依赖分析中
## 📚 相关文档
- [uni-app easycom 文档](https://uniapp.dcloud.net.cn/collocation/pages.html#easycom)
- [微信小程序代码依赖分析](https://developers.weixin.qq.com/miniprogram/dev/devtools/codecompile.html)
- [组件化开发文档](https://uniapp.dcloud.net.cn/tutorial/vue3-components.html)
## 🎉 总结
该问题已通过以下方式解决:
1. ✅ 在 `pages.json` 中添加了 `easycom` 配置
2. ✅ 配置了 `IconfontIcon``WxAuthLogin` 组件的自动引入
3. ✅ 组件现在可以在任何页面中直接使用,无需 import
**下一步:**
- 重启微信开发者工具
- 清除缓存
- 开始使用组件
如果问题仍然存在,请检查:
1. 文件路径是否正确
2. 文件名大小写是否一致
3. pages.json 语法是否正确
4. 是否已重启开发者工具

View File

@@ -0,0 +1,321 @@
# 微信授权登录功能说明
## 功能概述
本次开发实现了微信授权登录功能,当用户点击首页的特定功能时,会检查用户是否已登录,如果未登录则弹出授权弹窗,而不是直接跳转到登录页面。
## 主要功能点
### 1. 需要登录验证的功能入口
以下功能在点击时会进行登录验证:
- **附近工作** - 点击后跳转到附近工作列表页
- **九宫格服务功能** - 包含9个服务项
- 服务指导
- 事业单位招录
- 简历制作
- 劳动政策指引
- 技能培训信息
- 技能评价指引
- 题库和考试
- 素质测评
- AI智能面试
- **职位列表** - 点击任意职位卡片查看详情
### 2. 登录弹窗功能
#### 弹窗特性
- 使用 `uni-popup` 组件实现弹窗效果
- 弹窗居中显示,支持关闭按钮
- 不可点击遮罩关闭,确保用户必须做出选择
#### 弹窗内容
- **Logo和标题** - 显示应用logo和欢迎信息
- **授权说明** - 列出三个要点:
- 保护您的个人信息安全
- 为您推荐更合适的岗位
- 享受完整的就业服务
- **授权按钮**
- 微信小程序:使用 `open-type="getPhoneNumber"` 获取手机号
- H5/App使用微信登录接口
- 测试登录按钮仅H5/App环境显示
- **用户协议** - 显示用户协议和隐私政策链接
### 3. 登录流程
#### 微信小程序登录流程
1. 用户点击"微信授权登录"按钮
2. 触发微信小程序的手机号授权
3. 获取到 `code``encryptedData``iv`
4. 调用后端 `/app/wxLogin` 接口
5. 后端返回 `token`
6. 存储 `token` 并获取用户信息
7. 如果用户信息不完整,跳转到完善信息页面
8. 关闭弹窗,继续用户之前的操作
#### H5/App登录流程
1. 用户点击"微信授权登录"按钮
2. 调用 `uni.login` 获取微信授权 `code`
3. 调用后端 `/app/wxLogin` 接口
4. 后续流程同上
#### 测试登录流程(仅开发环境)
1. 用户点击"测试账号登录"按钮
2. 使用测试账号密码登录
3. 后续流程同上
### 4. 登录状态管理
#### 状态恢复
- 应用启动时自动从本地缓存恢复用户信息
- 验证 `token` 是否有效
- 如果 `token` 失效,清除缓存但不跳转登录页
#### 状态检查
- 使用 `checkLogin()` 函数统一检查登录状态
- 检查 `token` 是否存在
- 检查 `hasLogin` 状态
- 如果未登录,自动打开授权弹窗
## 文件结构
```
ks-app-employment-service/
├── components/
│ └── WxAuthLogin/
│ └── WxAuthLogin.vue # 微信授权登录弹窗组件
├── pages/
│ └── index/
│ └── components/
│ └── index-one.vue # 首页组件(已修改)
├── stores/
│ └── useUserStore.js # 用户状态管理(已修改)
├── App.vue # 应用入口(已修改)
└── docs/
└── 微信授权登录功能说明.md # 本文档
```
## 核心代码说明
### 1. WxAuthLogin.vue 组件
这是一个可复用的微信授权登录弹窗组件,提供以下接口:
**Props**
-
**Events**
- `success` - 登录成功时触发
- `cancel` - 取消登录时触发
**Methods**
- `open()` - 打开弹窗
- `close()` - 关闭弹窗
**使用示例**
```vue
<template>
<WxAuthLogin ref="wxAuthLoginRef" @success="handleLoginSuccess" />
</template>
<script setup>
import WxAuthLogin from '@/components/WxAuthLogin/WxAuthLogin.vue';
const wxAuthLoginRef = ref(null);
const handleLoginSuccess = () => {
console.log('登录成功');
// 执行登录后的操作
};
// 打开登录弹窗
const showLogin = () => {
wxAuthLoginRef.value?.open();
};
</script>
```
### 2. 登录检查函数
`index-one.vue` 中添加了统一的登录检查函数:
```javascript
// 登录检查函数
const checkLogin = () => {
const tokenValue = uni.getStorageSync('token') || '';
if (!tokenValue || !hasLogin.value) {
// 未登录,打开授权弹窗
wxAuthLoginRef.value?.open();
return false;
}
return true;
};
```
### 3. 点击事件处理
所有需要登录的功能都使用统一的检查逻辑:
```javascript
// 处理附近工作点击
const handleNearbyClick = () => {
if (checkLogin()) {
navTo('/pages/nearby/nearby');
}
};
// 处理服务功能点击
const handleServiceClick = (serviceType) => {
if (checkLogin()) {
navToService(serviceType);
}
};
// 处理职位详情点击
function nextDetail(job) {
if (checkLogin()) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
}
}
```
### 4. 状态管理优化
`useUserStore.js` 中优化了 `logOut` 函数:
```javascript
const logOut = (redirect = true) => {
hasLogin.value = false;
token.value = ''
resume.value = {}
userInfo.value = {}
role.value = {}
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
// 只有在明确需要跳转时才跳转到登录页
if (redirect) {
uni.redirectTo({
url: '/pages/login/login',
});
}
}
```
## 后端接口要求
### 1. 微信登录接口
**接口地址**: `/app/appLogin`
**请求方法**: `POST`
**请求参数**:
#### 微信小程序
```json
{
"code": "string", // 微信登录凭证
"encryptedData": "string", // 加密数据
"iv": "string" // 加密算法初始向量
}
```
#### H5/App
```json
{
"code": "string" // 微信登录凭证
}
```
**返回数据**:
```json
{
"token": "string", // 用户token
"msg": "string", // 返回消息
"code": 200 // 状态码
}
```
### 2. 获取用户信息接口
**接口地址**: `/app/user/resume`
**请求方法**: `GET`
**请求头**: `Authorization: Bearer {token}`
**返回数据**:
```json
{
"code": 200,
"data": {
"name": "string",
"phone": "string",
"jobTitle": ["string"],
"jobTitleId": "string",
// ... 其他用户信息
}
}
```
## 注意事项
1. **小程序配置**
- 需要在微信小程序后台配置服务器域名
- 需要申请手机号授权权限
2. **H5配置**
- 需要配置微信公众号的授权回调域名
- 需要引入微信JSSDK
3. **安全性**
- Token存储在本地缓存中注意加密
- 敏感操作前需要重新验证token有效性
4. **用户体验**
- 登录弹窗不可通过点击遮罩关闭,确保用户必须做出选择
- 提供测试登录按钮方便开发调试
- 登录成功后自动刷新数据
5. **兼容性**
- 使用条件编译确保在不同平台上正常运行
- 小程序、H5、App使用不同的登录逻辑
## 测试建议
### 功能测试
1. 未登录状态点击"附近工作",应弹出登录弹窗
2. 未登录状态点击九宫格任意服务,应弹出登录弹窗
3. 未登录状态点击职位列表,应弹出登录弹窗
4. 登录成功后,能够正常访问所有功能
5. 关闭登录弹窗后,不会自动跳转到登录页
### 登录流程测试
1. 微信小程序:测试手机号授权流程
2. H5测试微信网页授权流程
3. 测试账号登录功能(开发环境)
4. 测试登录失败的错误提示
5. 测试用户取消授权的处理
### 状态管理测试
1. 测试应用重启后登录状态的恢复
2. 测试token失效后的处理
3. 测试退出登录功能
4. 测试多次登录的状态切换
## 更新日志
### v1.0.0 (2024-10-20)
- 创建微信授权登录弹窗组件
- 添加登录状态检查逻辑
- 优化用户状态管理
- 更新首页各功能的登录验证
- 完善登录流程和错误处理
## 开发者
- 开发时间: 2024-10-20
- 涉及模块: 登录模块、首页模块、用户状态管理

View File

@@ -0,0 +1,109 @@
# 首页滚动隐藏功能修复报告
## 问题描述
用户反馈:列表区域向上滚动时,上面的区域(搜索栏、附近工作卡片、服务图标网格)没有隐藏,导致下面的职位列表显示区域被压缩得很小。
## 修复方案
### 1. **简化滚动逻辑**
- 移除了复杂的触摸手势处理
- 移除了 `requestAnimationFrame` 的复杂节流处理
- 使用简单直接的滚动位置判断
### 2. **优化滚动阈值**
```javascript
const HIDE_THRESHOLD = 50; // 向下滚动50px后隐藏顶部区域
const SHOW_THRESHOLD = 5; // 滚动到顶部5px内显示顶部区域
const STICKY_THRESHOLD = 80; // 滚动80px后筛选区域吸顶
```
### 3. **简化CSS动画**
```css
.hidden-animation {
transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
overflow: hidden;
opacity: 1;
transform: translateY(0);
}
.hidden-height {
opacity: 0 !important;
transform: translateY(-100%) !important;
pointer-events: none !important;
max-height: 0 !important;
padding: 0 !important;
margin: 0 !important;
}
```
### 4. **核心滚动处理函数**
```javascript
function handleScroll(e) {
const currentScrollTop = e.detail.scrollTop || 0;
// 简单的滚动逻辑:向下滚动超过阈值就隐藏,滚动到顶部就显示
if (currentScrollTop > HIDE_THRESHOLD) {
if (!shouldHideTop.value) {
shouldHideTop.value = true;
}
} else if (currentScrollTop <= SHOW_THRESHOLD) {
if (shouldHideTop.value) {
shouldHideTop.value = false;
}
}
// 控制筛选区域吸顶
if (currentScrollTop > STICKY_THRESHOLD) {
if (!shouldStickyFilter.value) {
shouldStickyFilter.value = true;
}
} else {
if (shouldStickyFilter.value) {
shouldStickyFilter.value = false;
}
}
// 更新滚动位置
lastScrollTop.value = currentScrollTop;
scrollTop.value = currentScrollTop;
}
```
## 测试方法
### 1. **手动测试**
- 点击右上角的红色"测试"按钮验证CSS动画是否正常工作
- 按钮文字会显示当前状态:"测试: 隐藏" 或 "测试: 显示"
### 2. **滚动测试**
- 向下滚动列表区域超过50px顶部区域应该自动隐藏
- 滚动回到顶部5px内顶部区域应该自动显示
- 滚动超过80px筛选区域应该吸顶显示
## 预期效果
1. **向下滚动 > 50px**:顶部区域(搜索栏、附近工作卡片、服务图标)平滑向上滑出隐藏
2. **滚动到顶部 < 5px**:顶部区域平滑向下滑入显示
3. **滚动 > 80px**:筛选区域吸顶显示,提供更好的导航体验
## 技术特点
-**简单可靠**:移除了复杂的逻辑,使用最直接的滚动位置判断
-**性能优化**使用CSS硬件加速流畅的动画效果
-**跨平台兼容**支持微信小程序、H5、App
-**用户体验**平滑的动画过渡符合Material Design规范
## 后续优化建议
1. **移除测试按钮**:确认功能正常后,删除临时测试按钮
2. **调整阈值**:根据实际使用情况,可以微调滚动阈值
3. **添加用户偏好**:可以考虑添加设置选项,让用户选择是否启用自动隐藏
## 文件修改
- `pages/index/components/index-one.vue` - 主要修改文件
- `docs/首页滚动优化说明.md` - 详细技术文档
---
**注意**:当前版本包含一个临时的红色测试按钮,用于验证功能是否正常工作。确认功能正常后,请删除测试按钮。

View File

@@ -0,0 +1,429 @@
# 阿里图标库iconfont引入指南
## 📦 方式一:使用字体文件(推荐)
### 第一步:下载图标资源
1. 访问 [阿里图标库](https://www.iconfont.cn/)
2. 注册/登录账号
3. 搜索需要的图标,点击"添加入库"
4. 点击右上角购物车图标
5. 点击"添加至项目"(如果没有项目,先创建一个)
6. 进入"我的项目"
7. 点击"下载至本地"按钮
### 第二步:解压并复制文件
下载的压缩包中包含以下文件:
```
iconfont.css
iconfont.ttf
iconfont.woff
iconfont.woff2
iconfont.json
demo_index.html
demo.css
```
**需要的文件:**
- `iconfont.css` - 样式文件
- `iconfont.ttf` - 字体文件
- `iconfont.woff` - 字体文件
- `iconfont.woff2` - 字体文件
### 第三步:创建项目目录
在项目中创建 `static/iconfont/` 目录(如果不存在):
```
ks-app-employment-service/
├── static/
│ ├── iconfont/ ← 新建此目录
│ │ ├── iconfont.css
│ │ ├── iconfont.ttf
│ │ ├── iconfont.woff
│ │ └── iconfont.woff2
│ └── ...
```
### 第四步:修改 CSS 文件
打开 `static/iconfont/iconfont.css`,修改字体文件路径:
**原始路径:**
```css
@font-face {
font-family: "iconfont";
src: url('iconfont.woff2?t=1234567890') format('woff2'),
url('iconfont.woff?t=1234567890') format('woff'),
url('iconfont.ttf?t=1234567890') format('truetype');
}
```
**修改为(相对路径):**
```css
@font-face {
font-family: "iconfont";
src: url('./iconfont.woff2?t=1234567890') format('woff2'),
url('./iconfont.woff?t=1234567890') format('woff'),
url('./iconfont.ttf?t=1234567890') format('truetype');
}
```
**或修改为(绝对路径,推荐):**
```css
@font-face {
font-family: "iconfont";
src: url('/static/iconfont/iconfont.woff2?t=1234567890') format('woff2'),
url('/static/iconfont/iconfont.woff?t=1234567890') format('woff'),
url('/static/iconfont/iconfont.ttf?t=1234567890') format('truetype');
}
```
### 第五步:在项目中引入
#### 方法 A全局引入App.vue
`App.vue` 中引入:
```vue
<style>
/* 引入阿里图标库 */
@import url("/static/iconfont/iconfont.css");
/* 其他全局样式 */
@import '@/common/animation.css';
@import '@/common/common.css';
</style>
```
#### 方法 B在 main.js 中引入
```javascript
// main.js
import './static/iconfont/iconfont.css'
```
### 第六步:使用图标
#### 使用方式 1Unicode 方式
```vue
<template>
<view class="icon">&#xe600;</view>
</template>
<style>
.icon {
font-family: "iconfont" !important;
font-size: 32rpx;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
```
#### 使用方式 2Font Class 方式(推荐)
```vue
<template>
<view class="iconfont icon-home"></view>
<view class="iconfont icon-user"></view>
<view class="iconfont icon-search"></view>
</template>
<style scoped>
.iconfont {
font-size: 32rpx;
color: #333;
}
</style>
```
#### 使用方式 3封装为组件
创建 `components/IconfontIcon/IconfontIcon.vue`
```vue
<template>
<text class="iconfont" :class="iconClass" :style="iconStyle"></text>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
name: {
type: String,
required: true
},
size: {
type: [String, Number],
default: 32
},
color: {
type: String,
default: '#333'
}
})
const iconClass = computed(() => `icon-${props.name}`)
const iconStyle = computed(() => ({
fontSize: `${props.size}rpx`,
color: props.color
}))
</script>
<style scoped>
.iconfont {
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
```
**使用组件:**
```vue
<template>
<IconfontIcon name="home" :size="48" color="#13C57C" />
<IconfontIcon name="user" :size="36" color="#256BFA" />
</template>
<script setup>
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
</script>
```
---
## 📦 方式二:使用在线链接(不推荐小程序)
### 第一步:获取在线链接
1. 在阿里图标库"我的项目"中
2. 点击"Font class"
3. 点击"查看在线链接"
4. 复制 CSS 链接
### 第二步:引入在线 CSS
`App.vue` 中:
```vue
<style>
/* 注意:小程序不支持在线字体 */
@import url("//at.alicdn.com/t/c/font_xxxxx.css");
</style>
```
**⚠️ 注意:** 微信小程序不支持外部字体文件,必须使用方式一!
---
## 📦 方式三:使用 Symbol 方式SVG
### 第一步:获取 Symbol 代码
1. 在"我的项目"中
2. 点击"Symbol"
3. 点击"生成代码"
4. 复制生成的 JS 链接
### 第二步:下载 JS 文件
将 JS 文件下载到 `static/iconfont/iconfont.js`
### 第三步:引入并使用
`App.vue` 或需要的页面中:
```vue
<template>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-home"></use>
</svg>
</template>
<script>
// 引入 Symbol 脚本
// 注意:需要在 main.js 中引入 iconfont.js
</script>
<style>
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
```
**⚠️ 注意:** 小程序对 SVG 支持有限,推荐使用方式一!
---
## 🎯 最佳实践建议
### 1. 使用 Font Class 方式(方式一)
**优点:**
- ✅ 兼容性好,支持所有平台
- ✅ 可以自定义颜色和大小
- ✅ 语义化强,易于维护
- ✅ 体积小,加载快
**缺点:**
- ❌ 只支持单色图标
### 2. 创建图标组件库
```
components/
├── IconfontIcon/
│ └── IconfontIcon.vue # 通用图标组件
```
### 3. 统一管理图标名称
创建 `config/icons.js`
```javascript
// 图标配置
export const ICONS = {
HOME: 'home',
USER: 'user',
SEARCH: 'search',
LOCATION: 'location',
PHONE: 'phone',
// ... 更多图标
}
```
使用:
```vue
<script setup>
import { ICONS } from '@/config/icons'
</script>
<template>
<IconfontIcon :name="ICONS.HOME" />
</template>
```
---
## 🔧 常见问题
### Q1: 小程序中图标不显示?
**解决方案:**
- 确保使用本地字体文件,不要使用在线链接
- 检查 CSS 中的字体路径是否正确
- 确保字体文件已正确复制到 `static/iconfont/` 目录
### Q2: 图标显示为方框?
**解决方案:**
- 检查字体文件是否完整
- 检查 `@font-face``font-family` 名称是否一致
- 清除缓存重新编译
### Q3: 如何更新图标库?
1. 在阿里图标库添加新图标到项目
2. 重新下载至本地
3. 替换 `static/iconfont/` 下的所有文件
4. 清除缓存,重新编译
### Q4: H5 和小程序路径不一致?
**解决方案:**
使用条件编译:
```css
@font-face {
font-family: "iconfont";
/* #ifdef H5 */
src: url('/static/iconfont/iconfont.woff2') format('woff2');
/* #endif */
/* #ifdef MP-WEIXIN */
src: url('./iconfont.ttf') format('truetype');
/* #endif */
}
```
---
## 📝 示例代码
### 完整示例:登录按钮
```vue
<template>
<button class="login-btn">
<text class="iconfont icon-phone"></text>
<text>手机号登录</text>
</button>
</template>
<style scoped>
.login-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx 40rpx;
background: #13C57C;
border-radius: 12rpx;
color: #fff;
}
.iconfont {
font-size: 32rpx;
margin-right: 12rpx;
}
</style>
```
---
## 🎨 推荐使用的图标
### 常用图标
- `icon-home` - 首页
- `icon-user` - 用户
- `icon-search` - 搜索
- `icon-location` - 位置
- `icon-phone` - 电话
- `icon-message` - 消息
- `icon-setting` - 设置
- `icon-star` - 收藏
- `icon-share` - 分享
- `icon-close` - 关闭
---
## 📚 相关资源
- [阿里图标库官网](https://www.iconfont.cn/)
- [uni-app 字体图标文档](https://uniapp.dcloud.net.cn/tutorial/syntax-css.html#%E5%AD%97%E4%BD%93%E5%9B%BE%E6%A0%87)
- [CSS @font-face](https://developer.mozilla.org/zh-CN/docs/Web/CSS/@font-face)
---
## ✅ 检查清单
- [ ] 已下载图标文件到 `static/iconfont/` 目录
- [ ] 已修改 CSS 中的字体文件路径
- [ ] 已在 App.vue 中引入 iconfont.css
- [ ] 已测试图标显示正常
- [ ] 已封装图标组件(可选)
- [ ] 已统一管理图标名称(可选)

View File

@@ -0,0 +1,407 @@
# 阿里图标库快速开始 🚀
## 一、5分钟快速上手
### Step 1: 下载图标文件2分钟
1. 访问 https://www.iconfont.cn/
2. 登录后搜索图标,点击"添加入库"
3. 购物车 → 添加至项目(没有项目先创建)
4. 我的项目 → 下载至本地
### Step 2: 放置文件1分钟
解压下载的文件将以下4个文件复制到 `static/iconfont/` 目录:
```
✅ iconfont.css
✅ iconfont.ttf
✅ iconfont.woff
✅ iconfont.woff2
```
### Step 3: 修改CSS路径1分钟
打开 `static/iconfont/iconfont.css`,将字体路径修改为相对路径:
```css
@font-face {
font-family: "iconfont";
src: url('./iconfont.woff2?t=xxx') format('woff2'),
url('./iconfont.woff?t=xxx') format('woff'),
url('./iconfont.ttf?t=xxx') format('truetype');
}
```
### Step 4: 全局引入1分钟
`App.vue``<style>` 标签中添加:
```vue
<style>
/* 引入阿里图标库 */
@import url("/static/iconfont/iconfont.css");
</style>
```
### Step 5: 开始使用 ✨
```vue
<template>
<!-- 直接使用 -->
<text class="iconfont icon-home"></text>
<!-- 或使用组件 -->
<IconfontIcon name="home" :size="48" color="#13C57C" />
</template>
```
---
## 二、推荐使用方式
### 方式 A使用封装的组件最推荐👍
```vue
<template>
<IconfontIcon name="phone" :size="40" color="#13C57C" />
</template>
<script setup>
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
</script>
```
**优点:**
- ✅ 统一管理,易于维护
- ✅ 支持动态修改大小和颜色
- ✅ 语义清晰
- ✅ 支持点击事件
### 方式 B使用配置常量推荐
```vue
<template>
<IconfontIcon
:name="ICONS.HOME"
:size="ICON_SIZES.LARGE"
:color="ICON_COLORS.PRIMARY"
/>
</template>
<script setup>
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
import { ICONS, ICON_SIZES, ICON_COLORS } from '@/config/icons'
</script>
```
**优点:**
- ✅ 统一图标名称
- ✅ 避免拼写错误
- ✅ IDE 自动补全
- ✅ 便于重构
### 方式 C直接使用类名
```vue
<template>
<text class="iconfont icon-home" style="font-size: 32rpx; color: #333;"></text>
</template>
```
---
## 三、常用场景示例
### 场景1导航栏图标
```vue
<template>
<view class="navbar">
<IconfontIcon name="arrow-left" :size="40" @click="goBack" />
<text class="title">页面标题</text>
<IconfontIcon name="share" :size="36" @click="share" />
</view>
</template>
<script setup>
const goBack = () => {
uni.navigateBack()
}
const share = () => {
// 分享逻辑
}
</script>
```
### 场景2按钮图标
```vue
<template>
<button class="primary-btn">
<IconfontIcon name="phone" :size="32" color="#FFFFFF" />
<text>手机号登录</text>
</button>
</template>
<style>
.primary-btn {
display: flex;
align-items: center;
gap: 12rpx;
}
</style>
```
### 场景3列表项图标
```vue
<template>
<view class="list-item">
<IconfontIcon name="location" :size="36" color="#13C57C" />
<text class="text">工作地点</text>
<IconfontIcon name="arrow-right" :size="28" color="#999" />
</view>
</template>
```
### 场景4状态图标
```vue
<template>
<view class="status-box">
<IconfontIcon
:name="status.icon"
:size="64"
:color="status.color"
/>
<text>{{ status.text }}</text>
</view>
</template>
<script setup>
import { computed } from 'vue'
const orderStatus = ref('success')
const status = computed(() => {
const map = {
success: { icon: 'success', color: '#13C57C', text: '提交成功' },
error: { icon: 'error', color: '#F44336', text: '提交失败' },
loading: { icon: 'loading', color: '#256BFA', text: '处理中...' }
}
return map[orderStatus.value]
})
</script>
```
---
## 四、组件API说明
### IconfontIcon 组件
**Props:**
| 参数 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| name | String | - | 图标名称(必填),如:'home' 或 'icon-home' |
| size | String/Number | 32 | 图标大小单位rpx |
| color | String | - | 图标颜色支持十六进制、rgb等 |
| bold | Boolean | false | 是否加粗 |
**Events:**
| 事件名 | 说明 | 回调参数 |
|--------|------|----------|
| click | 点击图标时触发 | event |
**使用示例:**
```vue
<IconfontIcon
name="home"
:size="48"
color="#13C57C"
:bold="true"
@click="handleClick"
/>
```
---
## 五、配置说明
### 图标名称配置config/icons.js
```javascript
export const ICONS = {
HOME: 'home',
USER: 'user',
SEARCH: 'search',
// ... 更多图标
}
```
### 尺寸预设
```javascript
export const ICON_SIZES = {
MINI: 24, // 24rpx
SMALL: 28, // 28rpx
NORMAL: 32, // 32rpx默认
LARGE: 40, // 40rpx
XLARGE: 48, // 48rpx
}
```
### 颜色预设
```javascript
export const ICON_COLORS = {
PRIMARY: '#13C57C', // 主色调
SECONDARY: '#256BFA', // 次要色
SUCCESS: '#13C57C', // 成功
WARNING: '#FF9800', // 警告
DANGER: '#F44336', // 危险
TEXT: '#333333', // 文本色
}
```
---
## 六、常见问题
### Q1: 图标不显示?
**检查清单:**
- [ ] 文件是否已复制到 `static/iconfont/` 目录
- [ ] CSS路径是否正确修改
- [ ] 是否已在 App.vue 中引入
- [ ] 图标类名是否正确(如:`icon-home`
- [ ] 清除缓存并重新编译
### Q2: 如何查看可用的图标?
1. 打开下载包中的 `demo_index.html`
2. 或查看 `iconfont.css` 中的类名
3. 类名格式通常为 `.icon-xxx:before`
### Q3: 如何更新图标?
1. 在阿里图标库添加新图标到项目
2. 重新下载至本地
3. 替换 `static/iconfont/` 下的所有文件
4. 清除缓存,重新编译
### Q4: 小程序能用在线链接吗?
❌ 不能!微信小程序必须使用本地字体文件。
---
## 七、最佳实践
### ✅ 推荐做法
1. **统一管理图标名称**
```javascript
// 使用配置文件
import { ICONS } from '@/config/icons'
```
2. **使用封装的组件**
```vue
<IconfontIcon name="home" />
```
3. **预设常用尺寸和颜色**
```javascript
import { ICON_SIZES, ICON_COLORS } from '@/config/icons'
```
4. **语义化命名**
```javascript
const ICONS = {
HOME: 'home', // ✅ 语义清晰
USER_CENTER: 'user', // ✅ 明确用途
}
```
### ❌ 不推荐做法
1. **硬编码图标名称**
```vue
<text class="iconfont icon-home"></text> <!-- ❌ 不推荐 -->
```
2. **使用在线链接(小程序)**
```css
@import url("//at.alicdn.com/xxx.css"); /* ❌ 小程序不支持 */
```
3. **直接使用 Unicode**
```vue
<text class="iconfont">&#xe600;</text> <!-- ❌ 不直观 -->
```
---
## 八、测试页面
已为你创建了测试页面,可以查看各种使用方式:
**路径:** `pages/demo/iconfont-demo.vue`
在 `pages.json` 中添加页面配置即可访问:
```json
{
"path": "pages/demo/iconfont-demo",
"style": {
"navigationBarTitleText": "图标示例"
}
}
```
---
## 九、相关文件
```
项目结构:
├── components/
│ └── IconfontIcon/
│ └── IconfontIcon.vue # 图标组件
├── config/
│ └── icons.js # 图标配置
├── static/
│ └── iconfont/
│ ├── iconfont.css # 样式文件
│ ├── iconfont.ttf # 字体文件
│ ├── iconfont.woff # 字体文件
│ ├── iconfont.woff2 # 字体文件
│ └── README.md # 说明文档
├── pages/
│ └── demo/
│ └── iconfont-demo.vue # 测试页面
└── docs/
├── 阿里图标库引入指南.md # 详细文档
└── 阿里图标库快速开始.md # 本文档
```
---
## 十、总结
✅ **记住这三步:**
1. **下载** - 从阿里图标库下载文件
2. **放置** - 复制到 `static/iconfont/` 目录
3. **引入** - 在 `App.vue` 中引入 CSS
🎉 **就是这么简单!**
如有问题,请参考详细文档:`docs/阿里图标库引入指南.md`

View File

@@ -0,0 +1,87 @@
# 首页滚动显示隐藏优化说明
## 修复的问题
### 1. **逻辑冲突问题**
- **原问题**:同时存在触摸手势(`handleTouchStart/Move/End`)和滚动事件两套控制逻辑
- **影响**:两套逻辑相互干扰,导致显示隐藏行为不稳定
- **解决方案**:移除触摸手势处理,统一使用滚动事件控制
### 2. **小程序兼容性问题**
- **原问题**:使用了 `document.querySelector('.falls-scroll')` 操作 DOM
- **影响**:在微信小程序中无法正常工作
- **解决方案**:完全通过响应式数据和滚动事件处理,避免直接操作 DOM
### 3. **不合理的显示逻辑**
- **原问题**:使用 `isManuallyHidden` 标记,只有手动隐藏后才能通过滚动显示
- **影响**:用户体验差,需要特定操作才能恢复显示
- **解决方案**:简化逻辑,滚动到顶部自动显示,向下滚动超过阈值自动隐藏
### 4. **性能问题**
- **原问题**:使用 `setTimeout` 进行节流,清理不完善
- **影响**:可能导致内存泄漏和性能下降
- **解决方案**:改用 `requestAnimationFrame`,添加 `ticking` 标志,在组件卸载时清理
## 优化内容
### 1. **滚动阈值优化**
```javascript
const HIDE_THRESHOLD = 150; // 隐藏顶部区域的滚动阈值
const SHOW_THRESHOLD = 10; // 显示顶部区域的滚动阈值(接近顶部)
const STICKY_THRESHOLD = 100; // 筛选区域吸顶的滚动阈值
```
### 2. **滚动方向判断优化**
- 添加最小位移判断2px避免微小抖动导致的误判
- 使用 `delta` 计算滚动方向,更加准确
### 3. **动画效果优化**
- 使用 Material Design 的缓动曲线 `cubic-bezier(0.4, 0.0, 0.2, 1)`
- 优化过渡时间,使动画更加流畅自然
- 添加 `pointer-events: none` 避免隐藏时的交互问题
- 使用硬件加速(`transform: translateZ(0)`)提升性能
### 4. **吸顶效果优化**
- 优化占位符高度,避免内容跳动
- 改进阴影效果,视觉层次更加清晰
- H5 和小程序分别处理,确保跨平台一致性
### 5. **资源清理**
-`onUnmounted` 生命周期中清理 `requestAnimationFrame`
- 防止内存泄漏
## 使用效果
### 滚动行为
1. **向下滚动超过 150px**:顶部区域(搜索框、卡片、服务网格)自动隐藏
2. **滚动到顶部(小于 10px**:顶部区域自动显示
3. **滚动超过 100px**:筛选区域吸顶显示
### 动画效果
- 隐藏/显示过渡时间350ms
- 透明度过渡300ms
- 平滑的向上滑动动画
### 性能表现
- 使用 `requestAnimationFrame` 确保 60fps 流畅度
- 防抖处理避免过度渲染
- 硬件加速提升动画性能
## 兼容性
- ✅ 微信小程序
- ✅ H5
- ✅ App (理论支持,需实际测试)
## 注意事项
1. 如需调整滚动阈值,修改 `HIDE_THRESHOLD``SHOW_THRESHOLD``STICKY_THRESHOLD` 三个常量
2. 如需调整动画速度,修改 `.hidden-animation` 中的 `transition` 时间
3. 占位符高度需要与 `.nav-filter` 的实际高度保持一致
## 后续优化建议
1. 可以考虑添加滚动速度检测,快速滚动时立即隐藏
2. 可以添加用户偏好设置,允许关闭自动隐藏功能
3. 可以添加触底提示,优化加载更多的体验

View File

@@ -20,7 +20,16 @@ export function useColumnCount(onChange = () => {}) {
// }
// }
const calcColumn = () => {
const width = uni.getSystemInfoSync().windowWidth
// 使用新的API替代已废弃的getSystemInfoSync
let width
// #ifdef MP-WEIXIN
const mpSystemInfo = uni.getWindowInfo()
width = mpSystemInfo.windowWidth
// #endif
// #ifndef MP-WEIXIN
const otherSystemInfo = uni.getSystemInfoSync()
width = otherSystemInfo.windowWidth
// #endif
let count = 2
if (width >= 1000) {
@@ -46,15 +55,20 @@ export function useColumnCount(onChange = () => {}) {
onMounted(() => {
columnCount.value = 2
calcColumn()
// if (process.client) {
window.addEventListener('resize', calcColumn)
// }
// 只在H5环境下添加resize监听器
// #ifdef H5
if (typeof window !== 'undefined') {
window.addEventListener('resize', calcColumn)
}
// #endif
})
onUnmounted(() => {
// if (process.client) {
window.removeEventListener('resize', calcColumn)
// }
// #ifdef H5
if (typeof window !== 'undefined') {
window.removeEventListener('resize', calcColumn)
}
// #endif
})
// 列数变化时执行回调

View File

@@ -4,39 +4,69 @@ import {
export function useScrollDirection(options = {}) {
const {
threshold = 200, // 滚动偏移阈值
throttleTime = 100, // 节流时间(毫秒)
onChange = null // 滚动方向变化的回调
threshold = 50, // 滚动偏移阈值,降低以更敏感
throttleTime = 16, // 节流时间(毫秒)约60fps
onChange = null, // 滚动方向变化的回调
hideThreshold = 100, // 隐藏区域的滚动阈值
enablePerformanceMode = true // 启用性能优化模式
} = options
const lastScrollTop = ref(0)
const accumulatedScroll = ref(0)
const isScrollingDown = ref(false)
const shouldHideTop = ref(false) // 控制顶部区域隐藏
const shouldStickyFilter = ref(false) // 控制筛选区域吸顶
let lastInvoke = 0
function handleScroll(e) {
const now = Date.now()
if (now - lastInvoke < throttleTime) return
if (enablePerformanceMode && now - lastInvoke < throttleTime) return
lastInvoke = now
const scrollTop = e.detail.scrollTop
const delta = scrollTop - lastScrollTop.value
accumulatedScroll.value += delta
if (accumulatedScroll.value > threshold) {
if (!isScrollingDown.value) {
isScrollingDown.value = true
onChange?.(true) // 通知变更为向下
// 控制顶部区域隐藏
if (scrollTop > hideThreshold) {
if (!shouldHideTop.value) {
shouldHideTop.value = true
}
} else {
if (shouldHideTop.value) {
shouldHideTop.value = false
}
accumulatedScroll.value = 0
}
if (accumulatedScroll.value < -threshold) {
if (isScrollingDown.value) {
isScrollingDown.value = false
onChange?.(false) // 通知变更为向上
// 控制筛选区域吸顶(当顶部区域隐藏时)
if (scrollTop > hideThreshold + 50) { // 稍微延迟吸顶
if (!shouldStickyFilter.value) {
shouldStickyFilter.value = true
}
} else {
if (shouldStickyFilter.value) {
shouldStickyFilter.value = false
}
}
// 滚动方向检测(仅在性能模式下使用阈值)
if (!enablePerformanceMode || Math.abs(accumulatedScroll.value) > threshold) {
if (accumulatedScroll.value > 0) {
// 向下滚动
if (!isScrollingDown.value) {
isScrollingDown.value = true
onChange?.(true) // 通知变更为向下
}
} else {
// 向上滚动
if (isScrollingDown.value) {
isScrollingDown.value = false
onChange?.(false) // 通知变更为向上
}
}
if (enablePerformanceMode) {
accumulatedScroll.value = 0
}
accumulatedScroll.value = 0
}
lastScrollTop.value = scrollTop
@@ -44,6 +74,8 @@ export function useScrollDirection(options = {}) {
return {
isScrollingDown,
shouldHideTop,
shouldStickyFilter,
handleScroll
}
}

View File

@@ -13,6 +13,7 @@ import SelectPopup from '@/components/selectPopup/selectPopup.vue'
import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin';
import RenderJobs from '@/components/renderJobs/renderJobs.vue';
import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue';
// iconfont.css 已在 App.vue 中通过 @import 引入,无需在此处重复引入
// import Tabbar from '@/components/tabbar/midell-box.vue'
// 自动导入 directives 目录下所有指令
const directives = import.meta.glob('./directives/*.js', {
@@ -23,8 +24,8 @@ import {
createSSRApp,
} from 'vue'
const foldFeature = window.visualViewport && 'segments' in window.visualViewport
console.log('是否支持多段屏幕:', foldFeature)
// const foldFeature = window.visualViewport && 'segments' in window.visualViewport
// console.log('是否支持多段屏幕:', foldFeature)
// 全局组件
export function createApp() {

View File

@@ -1,102 +1,103 @@
{
"name": "qingdao-employment-service",
"appid": "__UNI__C939371",
"description": "招聘",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
/* */
"modules": {},
/* */
"distribute": {
/* android */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios": {},
/* SDK */
"sdkConfigs": {}
}
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "用于用户选择地图查看位置"
}
}
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3",
"locale": "zh-Hans",
"h5": {
"router": {
"base": "/ks_app/",
"mode": "hash"
},
"title": "青岛智慧就业服务",
"optimization": {
"treeShaking": {
"enable": true
}
},
"sdkConfigs": {
"maps": {
"amap": {
"key": "9cfc9370bd8a941951da1cea0308e9e3",
"securityJsCode": "7b16386c7f744c3ca05595965f2b037f",
"serviceHost": ""
}
}
}
}
}
{
"name" : "qingdao-employment-service",
"appid" : "__UNI__F0ABFDF",
"description" : "招聘",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx9d1cbc11c8c40ba7",
"setting" : {
"urlCheck" : false,
"es6" : true,
"postcss" : true,
"minified" : true
},
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "用于用户选择地图查看位置"
}
},
"libVersion" : "3.5.7"
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3",
"locale" : "zh-Hans",
"h5" : {
"router" : {
"base" : "/ks_app/",
"mode" : "hash"
},
"title" : "青岛智慧就业服务",
"optimization" : {
"treeShaking" : {
"enable" : true
}
},
"sdkConfigs" : {
"maps" : {
"amap" : {
"key" : "9cfc9370bd8a941951da1cea0308e9e3",
"securityJsCode" : "7b16386c7f744c3ca05595965f2b037f",
"serviceHost" : ""
}
}
}
}
}

View File

@@ -27,15 +27,15 @@
{
"path": "pages/careerfair/careerfair",
"style": {
"navigationBarTitleText": "招聘会",
"navigationStyle": "custom"
"navigationBarTitleText": "招聘会"
// "navigationStyle": "custom"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "AI+就业服务程序",
"navigationStyle": "custom"
"navigationBarTitleText": "AI+就业服务程序"
// "navigationStyle": "custom"
}
},
{
@@ -79,20 +79,20 @@
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path" : "packageA/pages/addWorkExperience/addWorkExperience",
"style" :
{
"navigationBarTitleText" : "添加工作经历",
"navigationStyle": "custom"
}
}
],
"subpackages": [{
"root": "packageA",
"pages": [{
"pages": [
{
"path" : "pages/addWorkExperience/addWorkExperience",
"style" :
{
"navigationBarTitleText" : "添加工作经历",
"navigationStyle": "custom"
}
},{
"path": "pages/choiceness/choiceness",
"style": {
"navigationBarTitleText": "精选",
@@ -241,17 +241,10 @@
]
}],
"tabBar": {
"custom": true,
"display": "none",
"color": "#5E5F60",
"selectedColor": "#256BFA",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"midButton": {
"width": "50px",
"height": "50px",
"backgroundImage": "static/tabbar/logo2copy.png"
},
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/tabbar/calendar.png",
@@ -267,7 +260,8 @@
{
"pagePath": "pages/chat/chat",
"iconPath": "static/tabbar/logo3.png",
"selectedIconPath": "static/tabbar/logo3.png"
"selectedIconPath": "static/tabbar/logo3.png",
"text": "AI+"
},
{
"pagePath": "pages/msglog/msglog",
@@ -294,5 +288,13 @@
"rpxCalcMaxDeviceWidth": 750,
"rpxCalcIncludeWidth": 750
},
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
"^IconfontIcon$": "@/components/IconfontIcon/IconfontIcon.vue",
"^WxAuthLogin$": "@/components/WxAuthLogin/WxAuthLogin.vue"
}
},
"uniIdRouter": {}
}

View File

@@ -83,7 +83,7 @@
<empty v-else pdTop="200"></empty>
</scroll-view>
</view>
<Tabbar :currentpage="1"></Tabbar>
<!-- 统一使用系统tabBar -->
</view>
</view>
</template>
@@ -91,7 +91,6 @@
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import Tabbar from '@/components/tabbar/midell-box.vue';
import useLocationStore from '@/stores/useLocationStore';
import { storeToRefs } from 'pinia';
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());

View File

@@ -64,7 +64,7 @@
</view>
<!-- 自定义tabbar -->
<view class="chatmain-footer" v-show="!isDrawerOpen">
<Tabbar :currentpage="2"></Tabbar>
<!-- 统一使用系统tabBar -->
</view>
</view>
</view>
@@ -74,7 +74,6 @@
import { ref, inject, nextTick, computed } from 'vue';
const { $api, navTo, insertSortData, config } = inject('globalFunction');
import { onLoad, onShow, onHide } from '@dcloudio/uni-app';
import Tabbar from '@/components/tabbar/midell-box.vue';
import useChatGroupDBStore from '@/stores/userChatGroupStore';
import useUserStore from '@/stores/useUserStore';
import aiPaging from './components/ai-paging.vue';

View File

@@ -249,8 +249,6 @@ import {
ref,
inject,
nextTick,
defineProps,
defineEmits,
onMounted,
onUnmounted,
toRaw,

View File

@@ -37,7 +37,7 @@
</template>
<script setup>
import { ref, inject, defineEmits } from 'vue';
import { ref, inject } from 'vue';
const emit = defineEmits(['onSend']);
const { $api } = inject('globalFunction');
const popup = ref(null);

View File

@@ -0,0 +1,272 @@
<template>
<view class="demo-page">
<view class="demo-title">阿里图标库使用示例</view>
<!-- 方式一直接使用 iconfont -->
<view class="demo-section">
<view class="section-title">方式一直接使用</view>
<view class="icon-list">
<view class="icon-item">
<text class="iconfont icon-home"></text>
<text class="icon-name">icon-home</text>
</view>
<view class="icon-item">
<text class="iconfont icon-user"></text>
<text class="icon-name">icon-user</text>
</view>
<view class="icon-item">
<text class="iconfont icon-search"></text>
<text class="icon-name">icon-search</text>
</view>
</view>
</view>
<!-- 方式二使用封装的组件 -->
<view class="demo-section">
<view class="section-title">方式二使用封装组件</view>
<view class="icon-list">
<view class="icon-item">
<IconfontIcon name="home" :size="48" color="#13C57C" />
<text class="icon-name">绿色 48rpx</text>
</view>
<view class="icon-item">
<IconfontIcon name="user" :size="36" color="#256BFA" />
<text class="icon-name">蓝色 36rpx</text>
</view>
<view class="icon-item">
<IconfontIcon name="search" :size="32" color="#FF9800" />
<text class="icon-name">橙色 32rpx</text>
</view>
</view>
</view>
<!-- 方式三使用配置常量 -->
<view class="demo-section">
<view class="section-title">方式三使用配置常量</view>
<view class="icon-list">
<view class="icon-item">
<IconfontIcon
:name="ICONS.PHONE"
:size="ICON_SIZES.LARGE"
:color="ICON_COLORS.PRIMARY"
/>
<text class="icon-name">电话</text>
</view>
<view class="icon-item">
<IconfontIcon
:name="ICONS.MESSAGE"
:size="ICON_SIZES.LARGE"
:color="ICON_COLORS.SECONDARY"
/>
<text class="icon-name">消息</text>
</view>
<view class="icon-item">
<IconfontIcon
:name="ICONS.LOCATION"
:size="ICON_SIZES.LARGE"
:color="ICON_COLORS.DANGER"
/>
<text class="icon-name">位置</text>
</view>
</view>
</view>
<!-- 方式四按钮中使用 -->
<view class="demo-section">
<view class="section-title">方式四在按钮中使用</view>
<button class="demo-button primary">
<IconfontIcon name="phone" :size="32" color="#FFFFFF" />
<text>手机号登录</text>
</button>
<button class="demo-button secondary">
<IconfontIcon name="user" :size="32" color="#256BFA" />
<text>个人中心</text>
</button>
<button class="demo-button success">
<IconfontIcon name="star" :size="32" color="#FFFFFF" />
<text>收藏职位</text>
</button>
</view>
<!-- 方式五列表中使用 -->
<view class="demo-section">
<view class="section-title">方式五在列表中使用</view>
<view class="demo-list">
<view class="list-item" v-for="item in menuList" :key="item.id">
<IconfontIcon :name="item.icon" :size="40" :color="item.color" />
<view class="item-content">
<view class="item-title">{{ item.title }}</view>
<view class="item-desc">{{ item.desc }}</view>
</view>
<IconfontIcon name="arrow-right" :size="28" color="#999" />
</view>
</view>
</view>
<!-- 注意事项 -->
<view class="demo-section">
<view class="section-title"> 注意事项</view>
<view class="tips-box">
<view class="tip-item">1. 确保已从阿里图标库下载字体文件到 static/iconfont/ 目录</view>
<view class="tip-item">2. 确保已在 App.vue 中引入 iconfont.css</view>
<view class="tip-item">3. 图标名称需要与阿里图标库中的类名保持一致</view>
<view class="tip-item">4. 推荐使用封装的 IconfontIcon 组件便于统一管理</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
import { ICONS, ICON_SIZES, ICON_COLORS } from '@/config/icons'
const menuList = ref([
{
id: 1,
icon: 'home',
title: '首页',
desc: '查看推荐职位',
color: '#13C57C'
},
{
id: 2,
icon: 'search',
title: '搜索',
desc: '搜索心仪职位',
color: '#256BFA'
},
{
id: 3,
icon: 'message',
title: '消息',
desc: '查看聊天消息',
color: '#FF9800'
},
{
id: 4,
icon: 'user',
title: '我的',
desc: '个人中心',
color: '#9C27B0'
}
])
</script>
<style lang="stylus" scoped>
.demo-page
padding: 40rpx
background: #F5F5F5
min-height: 100vh
.demo-title
font-size: 48rpx
font-weight: bold
color: #333
text-align: center
margin-bottom: 40rpx
.demo-section
background: #FFFFFF
border-radius: 16rpx
padding: 32rpx
margin-bottom: 32rpx
.section-title
font-size: 32rpx
font-weight: 600
color: #333
margin-bottom: 24rpx
padding-bottom: 16rpx
border-bottom: 2rpx solid #F0F0F0
.icon-list
display: flex
flex-wrap: wrap
gap: 32rpx
.icon-item
display: flex
flex-direction: column
align-items: center
gap: 12rpx
min-width: 120rpx
.iconfont
font-size: 48rpx
color: #333
.icon-name
font-size: 24rpx
color: #666
text-align: center
.demo-button
width: 100%
height: 88rpx
border-radius: 44rpx
display: flex
align-items: center
justify-content: center
gap: 12rpx
font-size: 32rpx
margin-bottom: 20rpx
border: none
&.primary
background: linear-gradient(135deg, #13C57C 0%, #0FA368 100%)
color: #FFFFFF
&.secondary
background: #F7F8FA
color: #256BFA
&.success
background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%)
color: #FFFFFF
.demo-list
display: flex
flex-direction: column
gap: 20rpx
.list-item
display: flex
align-items: center
padding: 24rpx
background: #F7F8FA
border-radius: 12rpx
gap: 20rpx
.item-content
flex: 1
.item-title
font-size: 30rpx
color: #333
font-weight: 500
margin-bottom: 8rpx
.item-desc
font-size: 24rpx
color: #999
.tips-box
padding: 24rpx
background: #FFF3E0
border-radius: 12rpx
.tip-item
font-size: 26rpx
color: #E65100
line-height: 1.8
margin-bottom: 12rpx
&:last-child
margin-bottom: 0
// 按钮重置样式
button::after
border: none
</style>

View File

@@ -1,6 +1,14 @@
<template>
<view class="app-container">
<view class="nav-hidden hidden-animation" :class="{ 'hidden-height': isScrollingDown }">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序背景图片 -->
<image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
<!-- #endif -->
<view
class="nav-hidden hidden-animation"
:class="{ 'hidden-height': shouldHideTop }"
>
<view class="container-search">
<view class="search-input button-click" @click="navTo('/pages/search/search')">
<uni-icons class="iconsearch" color="#666666" type="search" size="18"></uni-icons>
@@ -9,7 +17,7 @@
<!-- <view class="chart button-click">职业图谱</view> -->
</view>
<view class="cards" v-if="userInfo.userType !== 0">
<view class="card press-button" @click="navTo('/pages/nearby/nearby')">
<view class="card press-button" @click="handleNearbyClick">
<view class="card-title">附近工作</view>
<view class="card-text">好岗职等你来</view>
</view>
@@ -19,88 +27,70 @@
</view> -->
</view>
<!-- 用户类型切换器测试用 -->
<UserTypeSwitcher v-if="showUserTypeSwitcher" />
<!-- 服务功能网格 -->
<view class="service-grid" v-if="userInfo.userType !== 0">
<view class="service-item press-button" @click="navToService('service-guidance')">
<view class="service-item press-button" @click="handleServiceClick('service-guidance')">
<view class="service-icon service-icon-1">
<uni-icons type="auth-filled" size="32" color="#FFFFFF"></uni-icons>
</view>
<view class="service-title">服务指导</view>
</view>
<view class="service-item press-button" @click="navToService('public-recruitment')">
<view class="service-item press-button" @click="handleServiceClick('public-recruitment')">
<view class="service-icon service-icon-2">
<svg t="1760592459382" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4717" width="32" height="32">
<path d="M652.4 934.1H91.9V110.2c0-26.7 21.7-48.3 48.3-48.3H604c26.7 0 48.3 21.7 48.3 48.3v823.9z m-513-47.4H605V110.2c0-0.5-0.4-0.9-0.9-0.9H140.3c-0.5 0-0.9 0.4-0.9 0.9v776.5z" fill="#FFFFFF" p-id="4718"></path>
<path d="M929.9 934.5l-325.7-4.8V412.3c0-26.7 21.7-48.3 48.3-48.3h229.1c26.7 0 48.3 21.7 48.3 48.3v522.2z m-278.3-51.6l230.8 3.4v-474c0-0.5-0.4-0.9-0.9-0.9h-229c-0.5 0-0.9 0.4-0.9 0.9v470.6zM340.9 319.9c0 1.3-1.1 2.4-2.4 2.4H236.8c-1.3 0-2.4-1.1-2.5-2.4V218.2c0-1.3 1.1-2.4 2.5-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4v101.7zM510 319.9c0 1.3-1.1 2.4-2.4 2.4H405.9c-1.3 0-2.4-1.1-2.4-2.4V218.2c0-1.3 1.1-2.4 2.4-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4v101.7zM340.9 475.1c0 1.3-1.1 2.4-2.4 2.4H236.8c-1.3 0-2.4-1.1-2.5-2.4V373.4c0-1.4 1.1-2.4 2.5-2.5h101.7c1.3 0 2.4 1.1 2.4 2.5v101.7zM510 475.1c0 1.3-1.1 2.4-2.4 2.4H405.9c-1.3 0-2.4-1.1-2.4-2.4V373.4c0-1.4 1.1-2.4 2.4-2.5h101.7c1.3 0 2.4 1.1 2.4 2.5v101.7zM340.9 630.3c0 1.3-1.1 2.4-2.4 2.4H236.8c-1.3 0-2.4-1.1-2.5-2.4V528.6c0-1.4 1.1-2.4 2.5-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4v101.7zM510 630.3c0 1.3-1.1 2.4-2.4 2.4H405.9c-1.3 0-2.4-1.1-2.4-2.4V528.6c0-1.4 1.1-2.4 2.4-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4v101.7zM340.9 785.5c0 1.4-1.1 2.4-2.4 2.5H236.8c-1.3 0-2.4-1.1-2.5-2.5V683.9c0-1.4 1.1-2.4 2.5-2.5h101.7c1.3 0 2.4 1.1 2.4 2.5v101.6zM510 785.5c0 1.4-1.1 2.4-2.4 2.5H405.9c-1.3 0-2.4-1.1-2.4-2.5V683.9c0-1.4 1.1-2.4 2.4-2.5h101.7c1.3 0 2.4 1.1 2.4 2.5v101.6z" fill="#FFFFFF" p-id="4719"></path>
<path d="M820.3 598.8c0 1.3-1.1 2.4-2.4 2.4H716.2c-1.4 0-2.4-1.1-2.4-2.4V497.1c0-1.3 1.1-2.4 2.4-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4v101.7z m0 0M820.3 754c0 1.3-1.1 2.4-2.4 2.5H716.2c-1.4 0-2.4-1.1-2.4-2.5V652.3c0-1.3 1.1-2.4 2.4-2.4h101.7c1.3 0 2.4 1.1 2.4 2.4V754z m0 0M998.1 934.1H23.7C10.6 934.1 0 923.5 0 910.4s10.6-23.7 23.7-23.7h974.4c13.1 0 23.7 10.6 23.7 23.7s-10.6 23.7-23.7 23.7z" fill="#FFFFFF" p-id="4720"></path>
</svg>
<IconfontIcon name="zhengfulou" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">事业单位招录</view>
</view>
<view class="service-item press-button" @click="navToService('resume-creation')">
<view class="service-item press-button" @click="handleServiceClick('resume-creation')">
<view class="service-icon service-icon-3">
<svg t="1760592325364" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2765" width="32" height="32">
<path d="M294.56 128.48a8 8 0 0 1 8 8v96a8 8 0 0 0 8 8h403.23a8 8 0 0 0 8-8v-96a8 8 0 0 1 8-8h99.71c17.673 0 32 14.327 32 32v744.65c0 17.673-14.327 32-32 32h-635c-17.673 0-32-14.327-32-32V160.48c0-17.673 14.327-32 32-32h100.06zM366.5 351c-28.443 0-51.5 23.057-51.5 51.5 0 18.94 10.224 35.491 25.453 44.435C313.845 457.44 295 483.562 295 514.125c0 39.833 143 39.833 143 0 0-30.563-18.845-56.686-45.454-67.188C407.776 437.991 418 421.44 418 402.5c0-28.443-23.057-51.5-51.5-51.5zM721 479H520a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h201a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8z m0-128H520a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h201a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8zM677.36 65.87c4.418 0 8 2.583 8 5.77V186.1c0 1.53-0.843 2.998-2.343 4.08-1.5 1.082-3.535 1.69-5.657 1.69H351.65c-4.418 0-8-2.583-8-5.77V71.64c0-3.187 3.582-5.77 8-5.77h325.71z" fill="#FFFFFF" p-id="2766"></path>
</svg>
<IconfontIcon name="jianli" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">简历制作</view>
</view>
<view class="service-item press-button" @click="navToService('labor-policy')">
<view class="service-item press-button" @click="handleServiceClick('labor-policy')">
<view class="service-icon service-icon-4">
<svg t="1760592549133" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6704" width="32" height="32">
<path d="M907.295876 1023.702H192.2831A107.635966 107.635966 0 0 1 76.960136 908.378036v-184.519942a38.441988 38.441988 0 0 1 38.440988-38.440988 38.441988 38.441988 0 0 1 38.441988 38.441988v184.518942c0 23.064993 0 38.440988 38.440988 38.440988h715.012776a38.441988 38.441988 0 0 1 0 76.882976z" fill="#FFFFFF" p-id="6705"></path>
<path d="M822.723903 893.001041H115.400124A38.441988 38.441988 0 0 1 76.960136 854.560053V116.482284A115.324964 115.324964 0 0 1 192.2831 1.15832h630.440803a107.635966 107.635966 0 0 1 123.012961 115.323964v661.194793A123.012962 123.012962 0 0 1 822.723903 893.000041z m-668.881791-76.882976h668.881791c15.376995 0 46.129986-7.687998 46.129985-38.440988V116.482284c0-30.75299-15.376995-38.440988-46.129985-38.440988h-630.439803a38.441988 38.441988 0 0 0-38.441988 38.440988z" fill="#FFFFFF" p-id="6706"></path>
<path d="M392.180037 708.482099h-30.75399a69.194978 69.194978 0 0 1-30.75299-61.505981l23.064992-107.636967-76.882976-76.882976a61.505981 61.505981 0 0 1-15.376995-61.50598 61.505981 61.505981 0 0 1 53.817983-38.441988l99.947969-15.375995 46.129986-99.947969a61.505981 61.505981 0 0 1 107.635966 0l46.129986 92.259971 99.947969 15.375995a61.505981 61.505981 0 0 1 38.440988 38.440988 61.505981 61.505981 0 0 1-7.687998 61.506981l-76.882976 76.882976 15.376995 107.635966a61.505981 61.505981 0 0 1-23.064993 61.506981 61.505981 61.505981 0 0 1-61.50698 0l-92.259972-46.129986-84.569973 46.129986z m123.011962-61.505981z m-130.700959-15.376995z m123.012961-53.817984h23.064993l76.882976 38.440988-15.376995-76.882976a61.505981 61.505981 0 0 1 15.376995-53.817983l61.505981-61.505981h-84.570974c-7.688998-7.688998-30.75299-15.376995-38.441988-38.441987l-30.75299-76.882976-38.441988 69.194978c-15.375995 23.064993-30.75299 38.440988-46.129986 38.440988h-76.881976l53.817984 61.506981a53.817983 53.817983 0 0 1 23.064992 46.129985l-15.376995 92.259971 69.194979-30.75399z m-146.077954-30.75299zM615.139968 347.132212z m-192.20794-7.688998z m76.882976-61.505981z m30.75399 0z" fill="#FFFFFF" p-id="6707"></path>
</svg>
<IconfontIcon name="zhengce" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">劳动政策指引</view>
</view>
<view class="service-item press-button" @click="navToService('skill-training')">
<view class="service-item press-button" @click="handleServiceClick('skill-training')">
<view class="service-icon service-icon-5">
<svg t="1760592652548" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9602" width="32" height="32">
<path d="M938.1888 34.2016H87.8592C50.3808 34.2016 20.48 64.7168 20.48 101.5808v522.4448c0 37.4784 30.5152 67.1744 67.1744 67.1744h97.0752v-167.3216c0-72.2944 58.9824-131.2768 131.2768-131.2768h65.9456c44.2368 0 85.6064 22.9376 109.568 59.5968l159.744-158.5152c12.6976-14.1312 23.9616-15.7696 30.5152-9.4208 6.3488 6.3488 6.3488 17.8176-5.5296 31.744L514.048 522.0352v169.1648h424.3456c37.4784 0 67.1744-30.5152 67.1744-67.1744V101.5808c-0.2048-36.864-30.1056-67.3792-67.3792-67.3792z m-589.824 346.9312c-50.7904 0-91.3408-41.3696-91.3408-91.3408 0-50.7904 41.3696-91.3408 91.3408-91.3408 50.7904 0 91.3408 41.3696 91.3408 91.3408v0.6144c0 49.9712-40.7552 90.7264-91.3408 90.7264zM129.6384 761.0368h54.4768c60.416 0 109.568 48.9472 109.568 109.568V989.184H19.8656v-119.1936c0.6144-60.0064 49.5616-108.9536 109.7728-108.9536z m711.2704 0h54.4768c60.416 0 109.568 48.9472 109.568 109.568V989.184H731.3408v-119.1936c0.6144-60.0064 49.5616-108.9536 109.568-108.9536z m-356.352 0h54.4768c60.416 0 109.568 48.9472 109.568 109.568V989.184H375.6032v-119.1936c0-60.0064 48.9472-108.9536 108.9536-108.9536z" fill="#FFFFFF" p-id="9603"></path>
</svg>
<IconfontIcon name="jinengpeixun" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">技能培训信息</view>
</view>
<view class="service-item press-button" @click="navToService('skill-evaluation')">
<view class="service-item press-button" @click="handleServiceClick('skill-evaluation')">
<view class="service-icon service-icon-6">
<svg t="1760592781996" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11602" width="32" height="32">
<path d="M857.414449 459.839013c-11.227716 0-19.427468 8.609075-19.427468 20.708648l0 366.92895c0 40.951691-32.461319 74.631768-71.780837 74.631768L189.751157 922.108379c-19.48682 0-41.531905-8.202822-57.936527-21.98778-18.148335-14.71719-28.503171-34.088376-28.503171-53.108568L103.311459 269.045619c0-19.428491 10.354835-40.137139 28.503171-56.94699 17.276479-16.403598 38.915311-26.350135 58.34278-26.350135l310.738184 0c11.634991 0 20.708648-8.201799 20.708648-19.428491 0-11.168364-9.073656-18.962887-20.708648-18.962887L190.157409 147.357116c-69.976748 0-124.888382 53.514821-124.888382 121.689527l0 577.965387c0 32.80822 12.505825 61.774949 36.297694 82.426291 22.453385 20.300348 53.980425 31.119765 88.590688 31.119765l576.918545 0c33.739429 0 61.8343-10.819416 81.261769-30.655184 19.429515-20.300348 29.375028-48.802496 29.375028-82.890872l-0.871857-366.463346C876.841917 468.913693 868.639095 459.839013 857.414449 459.839013zM935.650301 182.722578l-94.234221-94.52484c-12.970406-13.3214-32.397874-21.1149-53.166897-21.1149-19.834744 0-39.320541 7.794523-53.106522 20.707624l-76.550467 90.627067L250.245949 569.08002l-26.409486 228.720192 7.388271 6.515391 222.961024-30.248931 390.255215-408.752498 91.208305-73.816193C964.151425 262.588557 964.561771 211.224726 935.650301 182.722578zM273.97949 754.638179l8.260128-134.660956 124.422777 124.308167L273.97949 754.638179zM812.041052 344.199273 439.062316 719.679993l-134.370337-134.661979 376.410905-374.666168 132.217301 132.101667L812.041052 344.199273zM907.089825 260.029268l-59.622936 59.506279-143.03774-143.270031 59.214636-59.564607c6.459109-6.458085 15.124466-9.946536 24.605398-9.946536 9.540284 0 18.150382 3.489474 24.665773 9.946536l94.174869 94.116541C920.526859 224.197178 920.526859 246.64954 907.089825 260.029268z" fill="#FFFFFF" p-id="11603"></path>
</svg>
<IconfontIcon name="jinengpingjia" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">技能评价指引</view>
</view>
<view class="service-item press-button" @click="navToService('question-bank')">
<view class="service-item press-button" @click="handleServiceClick('question-bank')">
<view class="service-icon service-icon-7">
<svg t="1760592856482" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12615" width="32" height="32">
<path d="M847.644444 1024H150.755556c-48.355556-5.688889-88.177778-42.666667-93.866667-93.866667V93.866667C62.577778 45.511111 102.4 5.688889 150.755556 0h466.488888l327.111112 327.111111v605.866667c-8.533333 48.355556-48.355556 85.333333-96.711112 91.022222z m0-389.688889V327.111111h-184.888888c-25.6-2.844444-45.511111-22.755556-45.511112-45.511111V93.866667H196.266667c-25.6-2.844444-45.511111 17.066667-45.511111 42.666666v748.088889c5.688889 22.755556 22.755556 42.666667 45.511111 45.511111h605.866666c25.6-2.844444 45.511111-22.755556 45.511111-45.511111v-250.311111zM554.666667 824.888889c-17.066667 17.066667-48.355556 17.066667-65.422223 0-17.066667-17.066667-17.066667-48.355556 0-65.422222l233.244445-233.244445c17.066667-17.066667 48.355556-17.066667 65.422222 0 17.066667 17.066667 17.066667 48.355556 0 65.422222L554.666667 824.888889z m76.8-312.888889h-341.333334c-25.6 0-45.511111-19.911111-45.511111-45.511111 0-25.6 19.911111-45.511111 45.511111-45.511111h418.133334c8.533333 0 17.066667 2.844444 22.755555 8.533333-17.066667 5.688889-31.288889 14.222222-42.666666 28.444445l-56.888889 54.044444z m-341.333334 45.511111h292.977778l-93.866667 93.866667h-201.955555c-25.6 0-45.511111-19.911111-45.511111-45.511111 0-25.6 22.755556-48.355556 48.355555-48.355556z m0 139.377778h153.6l-25.6 25.6c-17.066667 17.066667-28.444444 39.822222-34.133333 65.422222h-93.866667c-25.6 0-45.511111-19.911111-45.511111-45.511111-2.844444-22.755556 19.911111-45.511111 45.511111-45.511111z m463.644445 48.355555c0 25.6-19.911111 45.511111-45.511111 45.511112h-17.066667l62.577778-62.577778v17.066666z" fill="#FFFFFF" p-id="12616"></path>
</svg>
<IconfontIcon name="suzhicepingtiku" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">题库和考试</view>
</view>
<view class="service-item press-button" @click="navToService('quality-assessment')">
<view class="service-item press-button" @click="handleServiceClick('quality-assessment')">
<view class="service-icon service-icon-8">
<svg t="1760594375550" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14087" width="32" height="32">
<path d="M815.542857 73.142857c58.514286 0 106.057143 47.542857 106.057143 106.057143v636.342857c0 58.514286-47.542857 106.057143-106.057143 106.057143h-636.342857c-58.514286 0-106.057143-47.542857-106.057143-106.057143v-636.342857C73.142857 120.685714 120.685714 73.142857 179.2 73.142857z m0 79.506286h-636.342857c-14.628571 0-26.550857 11.922286-26.550857 26.550857v636.342857c0 14.628571 11.922286 26.477714 26.550857 26.477714h636.342857c14.628571 0 26.477714-11.849143 26.477714-26.477714v-636.342857c0-14.628571-11.849143-26.550857-26.477714-26.550857zM362.788571 497.371429a120.173714 120.173714 0 1 1 0 240.420571 120.173714 120.173714 0 0 1 0-240.420571z m373.248 95.451428c20.48 0 37.083429 16.603429 37.083429 37.156572a42.422857 42.422857 0 0 1-37.156571 42.422857H594.651429a42.422857 42.422857 0 0 1-37.083429-42.422857c0-20.48 16.603429-37.156571 37.083429-37.156572z m-373.321142-19.017143a43.739429 43.739429 0 1 0 0 87.478857 43.739429 43.739429 0 0 0 0-87.405714z m64.365714-291.693714a37.083429 37.083429 0 0 1 48.493714 3.437714 37.302857 37.302857 0 0 1 2.486857 49.664L366.592 446.610286a37.156571 37.156571 0 0 1-52.004571-0.073143l-75.264-75.337143a37.083429 37.083429 0 0 1 3.510857-48.566857 37.376 37.376 0 0 1 49.956571-2.121143l45.494857 50.102857z m308.882286 45.568a37.156571 37.156571 0 0 1 0 74.24H594.651429a37.083429 37.083429 0 0 1 0-74.24z" fill="#FFFFFF" p-id="14088"></path>
</svg>
<IconfontIcon name="suzhicepingtiku" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">素质测评</view>
</view>
<view class="service-item press-button" @click="navToService('ai-interview')">
<view class="service-item press-button" @click="handleServiceClick('ai-interview')">
<view class="service-icon service-icon-9">
<svg t="1760594523105" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18134" width="32" height="32">
<path d="M826.368 325.632c0-7.168 2.048-10.24 10.24-10.24h123.904c7.168 0 10.24 2.048 10.24 10.24v621.568c0 7.168-2.048 10.24-10.24 10.24h-122.88c-8.192 0-10.24-4.096-10.24-10.24l-1.024-621.568z m-8.192-178.176c0-50.176 35.84-79.872 79.872-79.872 48.128 0 79.872 32.768 79.872 79.872 0 52.224-33.792 79.872-81.92 79.872-46.08 1.024-77.824-27.648-77.824-79.872zM462.848 584.704C441.344 497.664 389.12 307.2 368.64 215.04h-2.048c-16.384 92.16-58.368 247.808-92.16 369.664h188.416zM243.712 712.704l-62.464 236.544c-2.048 7.168-4.096 8.192-12.288 8.192H54.272c-8.192 0-10.24-2.048-8.192-12.288l224.256-783.36c4.096-13.312 7.168-26.624 8.192-65.536 0-6.144 2.048-8.192 7.168-8.192H450.56c6.144 0 8.192 2.048 10.24 8.192l250.88 849.92c2.048 7.168 0 10.24-7.168 10.24H573.44c-7.168 0-10.24-2.048-12.288-7.168l-65.536-236.544c1.024 1.024-251.904 0-251.904 0z" fill="#FFFFFF" p-id="18135"></path>
</svg>
<IconfontIcon name="ai" :size="68" color="#FFFFFF" />
</view>
<view class="service-title">AI智能面试</view>
</view>
</view>
</view>
<view class="nav-filter" v-if="userInfo.userType !== 0">
<!-- 吸顶筛选区域占位 -->
<view class="filter-placeholder" v-if="shouldStickyFilter && userInfo.userType !== 0"></view>
<view class="nav-filter" :class="{ 'sticky-filter': shouldStickyFilter }" v-if="userInfo.userType !== 0">
<view class="filter-top" @touchmove.stop.prevent>
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<view class="jobs-left">
@@ -146,8 +136,94 @@
</view>
</view>
<view class="table-list">
<scroll-view :scroll-y="true" class="falls-scroll" @scroll="handleScroll" @scrolltolower="scrollBottom">
<scroll-view
:scroll-y="true"
class="falls-scroll"
@scroll="handleScroll"
@scrolltolower="scrollBottom"
:enable-back-to-top="false"
:scroll-with-animation="false"
>
<view class="falls" v-if="list.length">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序使用具名插槽 -->
<custom-waterfalls-flow
:column="columnCount"
:columnSpace="columnSpace"
ref="waterfallsFlowRef"
:value="list"
>
<view v-for="(job, index) in list" :key="index" :slot="`slot${index}`">
<view class="item btn-feel" v-if="!job.recommend">
<view class="falls-card" @click="nextDetail(job)">
<view class="falls-card-pay">
<view class="pay-text">
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
:is-month="true"
></Salary-Expectation>
</view>
<image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
</view>
<view class="falls-card-title">{{ job.jobTitle }}</view>
<view class="fl_box fl_warp">
<view class="falls-card-education mar_ri10" v-if="job.education">
<dict-Label dictType="education" :value="job.education"></dict-Label>
</view>
<view class="falls-card-experience" v-if="job.experience">
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
</view>
</view>
<view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
<!-- {{ job.jobLocation }} -->
<dict-Label dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
</view>
<view class="falls-card-pepleNumber">
<view>
<image class="point2" src="/static/icon/pintDate.png"></image>
<view class="fl_1">
{{ job.postingDate || '发布日期' }}
</view>
</view>
<view>
<image class="point3" src="/static/icon/pointpeople.png"></image>
<view class="fl_1">
{{ vacanciesTo(job.vacancies) }}
</view>
</view>
</view>
<view class="falls-card-company2">
<image class="point3" src="/static/icon/point3.png"></image>
<view class="fl_1">
{{ job.companyName }}
</view>
</view>
<!-- <view class="falls-card-matchingrate">
<view class=""><matchingDegree :job="job"></matchingDegree></view>
<uni-icons type="star" size="30"></uni-icons>
</view> -->
</view>
</view>
<view class="item" :class="{ isBut: job.isBut }" v-else>
<view class="recommend-card">
<view class="card-content">
<view class="recommend-card-title">在找{{ job.jobCategory }}工作吗</view>
<view class="recommend-card-tip">{{ job.tip }}</view>
<view class="recommend-card-line"></view>
<view class="recommend-card-controll">
<view class="controll-no" @click="clearfindJob(job)">不是</view>
<view class="controll-yes" @click="findJob(job)">是的</view>
</view>
</view>
</view>
</view>
</view>
</custom-waterfalls-flow>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<!-- H5/App使用作用域插槽 -->
<custom-waterfalls-flow
:column="columnCount"
:columnSpace="columnSpace"
@@ -222,6 +298,7 @@
</view>
</template>
</custom-waterfalls-flow>
<!-- #endif -->
<loadmore ref="loadmoreRef"></loadmore>
</view>
<empty v-else pdTop="200"></empty>
@@ -230,6 +307,9 @@
<!-- 筛选 -->
<select-filter ref="selectFilterModel"></select-filter>
<!-- 微信授权登录弹窗 -->
<WxAuthLogin ref="wxAuthLoginRef" @success="handleLoginSuccess"></WxAuthLogin>
<!-- <view class="maskFristEntry" v-if="maskFristEntry">
<view class="entry-content">
<text class="text1">左滑查看视频</text>
@@ -242,14 +322,14 @@
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, watchEffect, nextTick } from 'vue';
import { reactive, inject, watch, ref, onMounted, onUnmounted, watchEffect, nextTick } from 'vue';
import img from '@/static/icon/filter.png';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo, vacanciesTo, formatTotal, config } = inject('globalFunction');
import { onLoad, onShow } from '@dcloudio/uni-app';
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
const { userInfo } = storeToRefs(useUserStore());
const { userInfo, hasLogin, token } = storeToRefs(useUserStore());
import useDictStore from '@/stores/useDictStore';
const { getTransformChildren, oneDictData } = useDictStore();
import useLocationStore from '@/stores/useLocationStore';
@@ -257,16 +337,60 @@ import selectFilter from '@/components/selectFilter/selectFilter.vue';
import { useRecommedIndexedDBStore, jobRecommender } from '@/stores/useRecommedIndexedDBStore.js';
import { useScrollDirection } from '@/hook/useScrollDirection';
import { useColumnCount } from '@/hook/useColumnCount';
import UserTypeSwitcher from '@/components/UserTypeSwitcher/UserTypeSwitcher.vue';
const { isScrollingDown, handleScroll } = useScrollDirection();
import WxAuthLogin from '@/components/WxAuthLogin/WxAuthLogin.vue';
import IconfontIcon from '@/components/IconfontIcon/IconfontIcon.vue'
// 滚动状态管理
const shouldHideTop = ref(false);
const shouldStickyFilter = ref(false);
const lastScrollTop = ref(0);
const scrollTop = ref(0);
// 当用户与筛选/导航交互时,临时锁定头部显示状态,避免因数据刷新导致回弹显示
const isInteractingWithFilter = ref(false);
// 滚动阈值配置
const HIDE_THRESHOLD = 50; // 隐藏顶部区域的滚动阈值(降低阈值,更容易触发)
const SHOW_THRESHOLD = 5; // 显示顶部区域的滚动阈值(接近顶部)
const STICKY_THRESHOLD = 80; // 筛选区域吸顶的滚动阈值
// 简化的滚动处理函数
function handleScroll(e) {
const currentScrollTop = e.detail.scrollTop || 0;
// 简单的滚动逻辑:向下滚动超过阈值就隐藏,滚动到顶部就显示
if (currentScrollTop > HIDE_THRESHOLD) {
if (!shouldHideTop.value) {
shouldHideTop.value = true;
}
} else if (currentScrollTop <= SHOW_THRESHOLD) {
// 仅在非交互期才允许自动显示顶部区域
if (shouldHideTop.value && !isInteractingWithFilter.value) {
shouldHideTop.value = false;
}
}
// 控制筛选区域吸顶
if (currentScrollTop > STICKY_THRESHOLD) {
if (!shouldStickyFilter.value) {
shouldStickyFilter.value = true;
}
} else {
if (shouldStickyFilter.value) {
shouldStickyFilter.value = false;
}
}
// 更新最后的滚动位置
lastScrollTop.value = currentScrollTop;
scrollTop.value = currentScrollTop;
}
const recommedIndexDb = useRecommedIndexedDBStore();
const emits = defineEmits(['onShowTabbar']);
console.log(userInfo.value);
const waterfallsFlowRef = ref(null);
const loadmoreRef = ref(null);
const conditionSearch = ref({});
const waterfallcolumn = ref(2);
const maskFristEntry = ref(false);
const wxAuthLoginRef = ref(null);
const state = reactive({
tabIndex: 'all',
});
@@ -291,8 +415,6 @@ const rangeOptions = ref([
{ value: 3, text: '疆外' },
]);
const isLoaded = ref(false);
// 控制用户类型切换器显示(测试用)
const showUserTypeSwitcher = ref(true);
const { columnCount, columnSpace } = useColumnCount(() => {
pageState.pageSize = 10 * (columnCount.value - 1);
@@ -303,6 +425,42 @@ const { columnCount, columnSpace } = useColumnCount(() => {
});
});
// 组件初始化时加载数据
onMounted(() => {
getJobRecommend('refresh');
});
// 登录检查函数
const checkLogin = () => {
const tokenValue = uni.getStorageSync('token') || '';
if (!tokenValue || !hasLogin.value) {
// 未登录,打开授权弹窗
wxAuthLoginRef.value?.open();
return false;
}
return true;
};
// 登录成功回调
const handleLoginSuccess = () => {
// 登录成功后刷新数据
getJobRecommend('refresh');
};
// 处理附近工作点击
const handleNearbyClick = () => {
if (checkLogin()) {
navTo('/pages/nearby/nearby');
}
};
// 处理服务功能点击
const handleServiceClick = (serviceType) => {
if (checkLogin()) {
navToService(serviceType);
}
};
async function loadData() {
try {
if (isLoaded.value) return;
@@ -373,12 +531,15 @@ function clearfindJob(job) {
}
function nextDetail(job) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
// 登录检查
if (checkLogin()) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
}
function navToService(serviceType) {
@@ -411,34 +572,43 @@ function navToService(serviceType) {
}
function openFilter() {
isInteractingWithFilter.value = true;
showFilter.value = true;
emits('onShowTabbar', false);
selectFilterModel.value?.open({
title: '筛选',
maskClick: true,
success: (values) => {
console.log('---', values);
pageState.search = {
...pageState.search,
};
for (const [key, value] of Object.entries(values)) {
pageState.search[key] = value.join(',');
// 特殊处理岗位类型,直接传递数字值
if (key === 'jobType') {
pageState.search.type = value.join(',');
} else {
pageState.search[key] = value.join(',');
}
}
showFilter.value = false;
getJobList('refresh');
// 短暂延迟后解除交互锁,避免数据刷新导致顶部区域回弹
setTimeout(() => { isInteractingWithFilter.value = false; }, 400);
},
cancel: () => {
showFilter.value = false;
emits('onShowTabbar', true);
setTimeout(() => { isInteractingWithFilter.value = false; }, 200);
},
});
}
function handleFilterConfirm(e) {
console.log(e);
// 处理筛选确认
}
function choosePosition(index) {
isInteractingWithFilter.value = true;
state.tabIndex = index;
list.value = [];
if (index === 'all') {
@@ -453,10 +623,11 @@ function choosePosition(index) {
inputText.value = '';
getJobList('refresh');
}
nextTick(() => { setTimeout(() => { isInteractingWithFilter.value = false; }, 300); });
}
const isShowJw = ref(0);
function handelHostestSearch(val) {
console.log(val.value);
isInteractingWithFilter.value = true;
isShowJw.value = val.value;
pageState.search.order = val.value;
pageState.search.jobType = val.value === 3 ? 1 : 0;
@@ -465,6 +636,7 @@ function handelHostestSearch(val) {
} else {
getJobList('refresh');
}
nextTick(() => { setTimeout(() => { isInteractingWithFilter.value = false; }, 300); });
}
function getJobRecommend(type = 'add') {
@@ -506,7 +678,8 @@ function getJobRecommend(type = 'add') {
list.value.push(...reslist);
});
} else {
list.value = dataToImg(data);
const reslist = dataToImg(data);
list.value = reslist;
}
// 切换状态
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
@@ -565,11 +738,12 @@ function getJobList(type = 'add') {
}
function dataToImg(data) {
return data.map((item) => ({
const result = data.map((item) => ({
...item,
image: img,
hide: true,
}));
return result;
}
defineExpose({ loadData });
@@ -658,20 +832,46 @@ defineExpose({ loadData });
.app-container
width: 100%;
height: 100vh;
/* #ifdef H5 */
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
background: url('@/static/icon/background2.png') 0 0 no-repeat;
background-size: 100% 728rpx;
/* #endif */
/* #ifdef MP-WEIXIN */
/* 小程序不支持CSS中的本地图片使用image标签替代 */
position: relative;
/* #endif */
background-color: #FFFFFF;
display: flex;
flex-direction: column
.hidden-animation
max-height: 1000px;
transition: all 0.3s ease;
overflow: hidden;
.hidden-height
max-height: 0;
padding-top: 0;
padding-bottom: 0;
flex-direction: column;
overflow: hidden;
/* #ifdef MP-WEIXIN */
.mp-background
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 728rpx;
z-index: 0;
/* #endif */
.hidden-animation
transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
overflow: hidden;
opacity: 1;
transform: translateY(0);
will-change: transform, opacity;
.hidden-height
opacity: 0 !important;
transform: translateY(-100%) !important;
pointer-events: none !important;
max-height: 0 !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
.container-search
padding: 16rpx 24rpx
display: flex
@@ -895,16 +1095,60 @@ defineExpose({ loadData });
width: 100%
max-width: 100%
// 吸顶筛选区域占位
.filter-placeholder
height: 140rpx; // 根据筛选区域的实际高度调整包含padding
width: 100%;
/* #ifdef H5 */
height: 0; // H5使用sticky不需要占位
/* #endif */
/* #ifdef MP-WEIXIN */
height: 140rpx; // 小程序需要占位
/* #endif */
.nav-filter
padding: 16rpx 28rpx 0 28rpx
padding: 16rpx 28rpx
box-sizing: border-box;
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
transition: box-shadow 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
background: #FFFFFF;
z-index: 10;
&.sticky-filter
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
z-index: 100;
will-change: transform;
transform: translateZ(0);
-webkit-transform: translateZ(0);
/* #ifdef H5 */
position: sticky;
top: 0;
z-index: 100;
/* #endif */
/* #ifdef MP-WEIXIN */
position: fixed;
top: 0;
padding: 16rpx 28rpx;
padding-top: calc(16rpx + env(safe-area-inset-top));
padding-left: calc(28rpx + env(safe-area-inset-left));
padding-right: calc(28rpx + env(safe-area-inset-right));
/* #endif */
.filter-top
display: flex
justify-content: space-between;
.tab-scroll
flex: 1;
overflow: hidden;
margin-right: 20rpx
margin-right: 20rpx;
/* #ifdef MP-WEIXIN */
margin-right: 0;
/* #endif */
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
@@ -932,6 +1176,9 @@ defineExpose({ loadData });
font-size: 32rpx;
color: #666D7F;
line-height: 38rpx;
min-width: 80rpx;
padding: 8rpx 12rpx;
white-space: nowrap;
.filter-bottom
display: flex
justify-content: space-between
@@ -963,9 +1210,12 @@ defineExpose({ loadData });
background: #F4F4F4
flex: 1
overflow: hidden
height: 0; // 确保flex容器正确计算高度
.falls-scroll
width: 100%
height: 100%
// 确保滚动容器可以正常滚动
-webkit-overflow-scrolling: touch;
.falls
padding: 28rpx 28rpx;
.item

View File

@@ -6,14 +6,13 @@
<IndexOne @onShowTabbar="changeShowTabbar" />
</view>
<Tabbar :currentpage="0"></Tabbar>
<!-- 统一使用系统tabBar -->
</view>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import Tabbar from '@/components/tabbar/midell-box.vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import IndexOne from './components/index-one.vue';
// import IndexTwo from './components/index-two.vue';
@@ -22,7 +21,7 @@ import { useReadMsg } from '@/stores/useReadMsg';
const { unreadCount } = storeToRefs(useReadMsg());
onLoad(() => {
useReadMsg().fetchMessages();
// useReadMsg().fetchMessages();
});
</script>

View File

@@ -56,9 +56,17 @@
<view class="input-titile">学历</view>
<input class="input-con" v-model="state.educationText" disabled placeholder="本科" />
</view>
<view class="content-input">
<view class="content-input" :class="{ 'input-error': idCardError }">
<view class="input-titile">身份证</view>
<input class="input-con2" v-model="fromValue.idcard" maxlength="18" placeholder="本科" />
<input
class="input-con2"
v-model="fromValue.idcard"
maxlength="18"
placeholder="请输入身份证号码"
@input="validateIdCard"
/>
<view v-if="idCardError" class="error-message">{{ idCardError }}</view>
<view v-if="fromValue.idcard && !idCardError" class="success-message"> 身份证格式正确</view>
</view>
</view>
<view class="next-btn" @tap="nextStep">下一步</view>
@@ -130,7 +138,7 @@ const openSelectPopup = inject('openSelectPopup');
// console.log(config.appInfo.areaName);
// status
const selectJobsModel = ref();
const tabCurrent = ref(0);
const tabCurrent = ref(1);
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const state = reactive({
station: [],
@@ -154,6 +162,9 @@ const fromValue = reactive({
idcard: '',
});
// 身份证校验相关
const idCardError = ref('');
onLoad((parmas) => {
getTreeselect();
});
@@ -163,6 +174,26 @@ onMounted(() => {});
function changeSex(sex) {
fromValue.sex = sex;
}
// 身份证实时校验
function validateIdCard() {
const idCard = fromValue.idcard.trim();
// 如果为空,清除错误信息
if (!idCard) {
idCardError.value = '';
return;
}
// 使用身份证校验器进行校验
const result = IdCardValidator.validate(idCard);
if (result.valid) {
idCardError.value = '';
} else {
idCardError.value = result.message;
}
}
function changeExperience() {
openSelectPopup({
title: '工作经验',
@@ -239,6 +270,19 @@ function changeJobs() {
}
function nextStep() {
// 校验身份证号码
const idCard = fromValue.idcard.trim();
if (!idCard) {
$api.msg('请输入身份证号码');
return;
}
const result = IdCardValidator.validate(idCard);
if (!result.valid) {
$api.msg(result.message);
return;
}
tabCurrent.value += 1;
}
@@ -451,6 +495,19 @@ function complete() {
border-radius: 2rpx
background: #697279;
transform: rotate(45deg)
.error-message
color: #ff4757;
font-size: 24rpx;
margin-top: 10rpx;
line-height: 1.4;
.success-message
color: #2ed573;
font-size: 24rpx;
margin-top: 10rpx;
line-height: 1.4;
.input-error
.input-con2
border-bottom-color: #ff4757;
.content-sex
height: 110rpx;
display: flex

View File

@@ -97,7 +97,7 @@
</uni-popup>
</view>
<template #footer>
<Tabbar :currentpage="4"></Tabbar>
<!-- 统一使用系统tabBar -->
</template>
</AppLayout>
</template>
@@ -105,7 +105,6 @@
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { storeToRefs } from 'pinia';
import Tabbar from '@/components/tabbar/midell-box.vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, navTo } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';

View File

@@ -28,7 +28,7 @@
</swiper>
</view>
<Tabbar :currentpage="3"></Tabbar>
<!-- 统一使用系统tabBar -->
</view>
</view>
</template>

View File

@@ -1,5 +1,5 @@
<template>
<view class="container">
<view class="container safe-area-top">
<view>
<view class="top">
<image class="btnback button-click" src="@/static/icon/back.png" @click="navBack"></image>

57
static/iconfont/README.md Normal file
View File

@@ -0,0 +1,57 @@
# 阿里图标库文件说明
## 📁 目录结构
将从阿里图标库下载的文件放在这个目录下:
```
static/iconfont/
├── iconfont.css ← CSS 样式文件
├── iconfont.ttf ← 字体文件TrueType
├── iconfont.woff ← 字体文件Web Open Font Format
├── iconfont.woff2 ← 字体文件Web Open Font Format 2.0,推荐)
└── README.md ← 本说明文件
```
## 📝 使用步骤
### 1. 下载图标文件
1. 访问 https://www.iconfont.cn/
2. 登录并选择/创建项目
3. 添加需要的图标
4. 点击"下载至本地"
### 2. 复制文件
将下载包中的以下文件复制到本目录:
- `iconfont.css`
- `iconfont.ttf`
- `iconfont.woff`
- `iconfont.woff2`
### 3. 修改 CSS 路径
打开 `iconfont.css`,将字体文件路径修改为:
```css
@font-face {
font-family: "iconfont";
src: url('./iconfont.woff2') format('woff2'),
url('./iconfont.woff') format('woff'),
url('./iconfont.ttf') format('truetype');
}
```
### 4. 在 App.vue 中引入
已在 `App.vue` 中自动引入,无需额外操作。
## ⚠️ 注意事项
1. **必须使用本地文件**:微信小程序不支持在线字体链接
2. **路径必须正确**:确保字体文件路径指向正确位置
3. **文件完整性**:确保所有字体文件都已复制
4. **版本更新**:更新图标时替换所有文件
## 🔗 相关链接
- [阿里图标库](https://www.iconfont.cn/)
- [使用文档](../../docs/阿里图标库引入指南.md)

539
static/iconfont/demo.css Normal file
View File

@@ -0,0 +1,539 @@
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@@ -0,0 +1,372 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
<style>
.main .logo {
margin-top: 0;
height: auto;
}
.main .logo a {
display: flex;
align-items: center;
}
.main .logo .sub-title {
margin-left: 0.5em;
font-size: 22px;
color: #fff;
background: linear-gradient(-45deg, #3967FF, #B500FE);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=5044714" target="_blank" class="nav-more">查看项目</a>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe607;</span>
<div class="name">素质测评</div>
<div class="code-name">&amp;#xe607;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe887;</span>
<div class="name">智能AI</div>
<div class="code-name">&amp;#xe887;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe614;</span>
<div class="name">技能培训</div>
<div class="code-name">&amp;#xe614;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe61d;</span>
<div class="name">政策</div>
<div class="code-name">&amp;#xe61d;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe67f;</span>
<div class="name">题库和考试</div>
<div class="code-name">&amp;#xe67f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe723;</span>
<div class="name">技能评价</div>
<div class="code-name">&amp;#xe723;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe61c;</span>
<div class="name">简历</div>
<div class="code-name">&amp;#xe61c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe7e9;</span>
<div class="name">政府楼</div>
<div class="code-name">&amp;#xe7e9;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>
<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持两种方式引用多色图标SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1760941852498') format('woff2'),
url('iconfont.woff?t=1760941852498') format('woff'),
url('iconfont.ttf?t=1760941852498') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-suzhicepingtiku"></span>
<div class="name">
素质测评
</div>
<div class="code-name">.icon-suzhicepingtiku
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-ai"></span>
<div class="name">
智能AI
</div>
<div class="code-name">.icon-ai
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jinengpeixun"></span>
<div class="name">
技能培训
</div>
<div class="code-name">.icon-jinengpeixun
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhengce"></span>
<div class="name">
政策
</div>
<div class="code-name">.icon-zhengce
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-chengjifuben"></span>
<div class="name">
题库和考试
</div>
<div class="code-name">.icon-chengjifuben
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jinengpingjia"></span>
<div class="name">
技能评价
</div>
<div class="code-name">.icon-jinengpingjia
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jianli"></span>
<div class="name">
简历
</div>
<div class="code-name">.icon-jianli
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhengfulou"></span>
<div class="name">
政府楼
</div>
<div class="code-name">.icon-zhengfulou
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>
<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-suzhicepingtiku"></use>
</svg>
<div class="name">素质测评</div>
<div class="code-name">#icon-suzhicepingtiku</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-ai"></use>
</svg>
<div class="name">智能AI</div>
<div class="code-name">#icon-ai</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jinengpeixun"></use>
</svg>
<div class="name">技能培训</div>
<div class="code-name">#icon-jinengpeixun</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhengce"></use>
</svg>
<div class="name">政策</div>
<div class="code-name">#icon-zhengce</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-chengjifuben"></use>
</svg>
<div class="name">题库和考试</div>
<div class="code-name">#icon-chengjifuben</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jinengpingjia"></use>
</svg>
<div class="name">技能评价</div>
<div class="code-name">#icon-jinengpingjia</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jianli"></use>
</svg>
<div class="name">简历</div>
<div class="code-name">#icon-jianli</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhengfulou"></use>
</svg>
<div class="name">政府楼</div>
<div class="code-name">#icon-zhengfulou</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>
<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()
$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()
if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')
tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
@font-face {
font-family: "iconfont"; /* Project id 5044714 */
src: url('iconfont.woff2?t=1760941852498') format('woff2'),
url('iconfont.woff?t=1760941852498') format('woff'),
url('iconfont.ttf?t=1760941852498') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-suzhicepingtiku:before {
content: "\e607";
}
.icon-ai:before {
content: "\e887";
}
.icon-jinengpeixun:before {
content: "\e614";
}
.icon-zhengce:before {
content: "\e61d";
}
.icon-chengjifuben:before {
content: "\e67f";
}
.icon-jinengpingjia:before {
content: "\e723";
}
.icon-jianli:before {
content: "\e61c";
}
.icon-zhengfulou:before {
content: "\e7e9";
}

View File

@@ -0,0 +1,65 @@
{
"id": "5044714",
"name": "喀什APP",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "28808301",
"name": "素质测评",
"font_class": "suzhicepingtiku",
"unicode": "e607",
"unicode_decimal": 58887
},
{
"icon_id": "4638874",
"name": "智能AI",
"font_class": "ai",
"unicode": "e887",
"unicode_decimal": 59527
},
{
"icon_id": "2400112",
"name": "技能培训",
"font_class": "jinengpeixun",
"unicode": "e614",
"unicode_decimal": 58900
},
{
"icon_id": "21800726",
"name": "政策",
"font_class": "zhengce",
"unicode": "e61d",
"unicode_decimal": 58909
},
{
"icon_id": "28948661",
"name": "题库和考试",
"font_class": "chengjifuben",
"unicode": "e67f",
"unicode_decimal": 59007
},
{
"icon_id": "43251924",
"name": "技能评价",
"font_class": "jinengpingjia",
"unicode": "e723",
"unicode_decimal": 59171
},
{
"icon_id": "648773",
"name": "简历",
"font_class": "jianli",
"unicode": "e61c",
"unicode_decimal": 58908
},
{
"icon_id": "43701068",
"name": "政府楼",
"font_class": "zhengfulou",
"unicode": "e7e9",
"unicode_decimal": 59369
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
// BaseStore.js - 基础Store类
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
// import UniStorageHelper from '../common/UniStorageHelper'
import UniStorageHelper from '../common/UniStorageHelper'
import useChatGroupDBStore from './userChatGroupStore'
import config from '@/config'
@@ -34,7 +34,7 @@ class BaseStore {
this.db = new IndexedDBHelper(this.dbName, config.DBversion);
// // #endif
// // #ifndef H5
// this.db = new UniStorageHelper(this.dbName, config.DBversion);
this.db = new UniStorageHelper(this.dbName, config.DBversion);
// // #endif
this.db.openDB([{
name: 'record',

View File

@@ -64,17 +64,21 @@ const useUserStore = defineStore("user", () => {
});
}
const logOut = () => {
const logOut = (redirect = true) => {
hasLogin.value = false;
token.value = ''
resume.value = {}
userInfo.value = {}
role.value = {}
uni.clearStorageSync('userInfo')
uni.clearStorageSync('token')
uni.redirectTo({
url: '/pages/login/login',
});
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
// 只有在明确需要跳转时才跳转到登录页
if (redirect) {
uni.redirectTo({
url: '/pages/login/login',
});
}
}
const getUserInfo = () => {
@@ -101,7 +105,7 @@ const useUserStore = defineStore("user", () => {
token.value = value
uni.setStorageSync('token', value);
// 获取消息列表
useReadMsg().fetchMessages()
// useReadMsg().fetchMessages()
// 获取用户信息
return getUserResume()
}

View File

@@ -12,8 +12,8 @@
"bigPackageSizeSupport": true
},
"compileType": "miniprogram",
"libVersion": "",
"appid": "touristappid",
"libVersion": "3.5.7",
"appid": "wx9d1cbc11c8c40ba7",
"projectname": "qingdao-employment-service",
"condition": {
"search": {

View File

@@ -1,95 +0,0 @@
# 用户类型导航功能实现说明
## 功能概述
根据用户类型动态显示不同的底部导航栏:
- **企业用户userType=0**:显示"发布岗位"导航,隐藏"招聘会"导航
- **其他用户userType=1,2,3**:显示"招聘会"导航
## 实现内容
### 1. 用户信息扩展
-`stores/useUserStore.js` 中添加了模拟的 `userType` 字段
- 默认设置为企业用户userType=0
### 2. 导航栏组件修改
- 修改了 `components/tabbar/midell-box.vue`
- 根据 `userInfo.userType` 动态生成不同的导航配置
- 企业用户显示"发布岗位",其他用户显示"招聘会"
- 修复了跳转逻辑tabBar页面使用 `switchTab`,普通页面使用 `navigateTo`
- 更新了发布岗位图标使用自定义SVG图标
- 未选中状态:深灰色 (#666666) - 新图标设计
- 选中状态:蓝色 (#256BFA) - 新图标设计
### 3. 发布岗位页面
- 创建了 `pages/job/publishJob.vue` 发布岗位页面
- 包含完整的岗位信息表单
- 支持岗位基本信息、薪资待遇、任职要求、岗位描述、联系方式等
### 4. 测试组件
- 创建了 `components/UserTypeSwitcher/UserTypeSwitcher.vue` 用于测试
- 创建了 `pages/test/userTypeTest.vue` 测试页面
- 在首页添加了用户类型切换器(可控制显示/隐藏)
## 用户类型定义
```javascript
const userTypes = [
{ value: 0, label: '企业用户' },
{ value: 1, label: '求职者' },
{ value: 2, label: '网格员' },
{ value: 3, label: '政府人员' }
];
```
## 导航栏配置
### 企业用户userType=0
- 首页
- 发布岗位(招聘会导航完全隐藏)
- AI助手
- 消息
- 我的
### 其他用户userType=1,2,3
- 首页
- 招聘会
- AI助手
- 消息
- 我的
## 使用方法
### 1. 切换用户类型
```javascript
// 在组件中切换用户类型
userInfo.value.userType = 0; // 切换到企业用户
uni.setStorageSync('userInfo', userInfo.value);
```
### 2. 测试功能
- 访问 `/pages/test/userTypeTest` 页面进行测试
- 在首页可以看到用户类型切换器(测试用)
### 3. 生产环境
- 移除测试相关的组件和代码
- 从后端接口获取真实的用户类型信息
## 注意事项
1. 当前是模拟实现,实际项目中需要从后端接口获取用户类型
2. 发布岗位页面已存在:`/packageA/pages/addPosition/addPosition`
3. 招聘会页面已存在:`/pages/careerfair/careerfair`
4. 测试完成后可以隐藏用户类型切换器
## 文件修改清单
- `stores/useUserStore.js` - 添加 userType 字段
- `components/tabbar/midell-box.vue` - 动态导航配置
- `pages/job/publishJob.vue` - 发布岗位页面
- `static/tabbar/publish-job.svg` - 发布岗位图标(普通状态)
- `static/tabbar/publish-job-selected.svg` - 发布岗位图标(选中状态)
- `components/UserTypeSwitcher/UserTypeSwitcher.vue` - 测试组件
- `pages/test/userTypeTest.vue` - 测试页面
- `pages/index/components/index-one.vue` - 添加测试组件
- `pages.json` - 添加页面配置