flat: 消息

This commit is contained in:
史典卓
2025-05-15 14:17:51 +08:00
parent 5333254c58
commit a93907018c
40 changed files with 875 additions and 56 deletions

View File

@@ -47,7 +47,7 @@ function navToPost(jobId) {
function getJobList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {

View File

@@ -85,7 +85,7 @@ const companyInfo = ref({});
onLoad((options) => {
console.log(options);
getCompanyInfo(options.companyId);
getCompanyInfo(options.companyId || options.bussinessId);
});
function companyCollection() {
@@ -112,7 +112,7 @@ function getCompanyInfo(id) {
function getJobsList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {

View File

@@ -44,7 +44,7 @@
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { storeToRefs } from 'pinia';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, navBack } = inject('globalFunction');
import useLocationStore from '@/stores/useLocationStore';
@@ -68,15 +68,16 @@ const currentDate = ref('');
onLoad(() => {
getBrowseDate();
const today = new Date().toISOString().split('T')[0];
getJobList('refresh');
currentDate.value = today;
// const today = new Date().toISOString().split('T')[0];
// currentDate.value = today;
});
function toSelectDate() {
navTo('/packageA/pages/selectDate/selectDate', {
query: {
date: currentDate.value,
record: true,
},
onBack: (res) => {
currentDate.value = res.date;
@@ -216,4 +217,4 @@ image {
background: #f4f4f4
}
</style>
</style>

View File

@@ -72,7 +72,7 @@ function searchCollection(e) {
// list
function getDataList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {

View File

@@ -93,7 +93,7 @@ function handleScrollToLowerCompany() {
function getJobList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
@@ -121,7 +121,7 @@ function getJobList(type = 'add') {
function getCompanyList(type = 'add') {
if (type === 'refresh') {
pageCompanyState.page = 0;
pageCompanyState.page = 1;
pageCompanyState.maxPage = 1;
}
if (type === 'add' && pageCompanyState.page < pageCompanyState.maxPage) {

View File

@@ -0,0 +1,147 @@
<template>
<view class="reser-content">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<view class="content-top">
<view
class="top-item button-click"
:class="{ active: state.tabIndex === 'all' }"
@click="changeOption('all')"
>
全部
</view>
<view
class="top-item button-click"
:class="{ active: state.tabIndex === index }"
v-for="(item, index) in userInfo.jobTitle"
:key="index"
@click="changeOption(index)"
>
{{ item }}
</view>
</view>
</scroll-view>
<view class="main">
<scroll-view class="scroll-view" scroll-y @scrolltolower="scrollBottom">
<view class="list">
<renderJobs
:list="pageState.list"
v-if="pageState.list.length"
:longitude="longitudeVal"
:latitude="latitudeVal"
></renderJobs>
<empty v-else pdTop="200"></empty>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, navTo, debounce, customSystem } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import useLocationStore from '@/stores/useLocationStore';
import useUserStore from '@/stores/useUserStore';
const { userInfo } = storeToRefs(useUserStore());
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
search: {},
lastDate: '',
});
const state = reactive({
tabIndex: 'all',
});
onLoad(() => {
getList('refresh');
});
function scrollBottom() {
getList();
}
function changeOption(index) {
state.tabIndex = index;
if (index === 'all') {
pageState.search = {};
getList('refresh');
} else {
pageState.search.jobTitle = userInfo.value.jobTitle[index];
getList('refresh');
}
}
function getList(type = 'add', loading = true) {
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
...pageState.search,
};
$api.createRequest('/app/notice/recommend', params).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
</script>
<style lang="stylus" scoped>
.reser-content{
width: 100%;
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
display: flex;
flex-direction: column;
.content-top{
display: flex
padding: 28rpx
.top-item{
font-weight: 400;
font-size: 32rpx;
margin-right: 48rpx
color: #666D7F;
white-space: nowrap
}
.top-item:last-child{
padding-right: 38rpx
}
.active{
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
}
.main{
flex: 1
overflow: hidden
background: #F4F4F4
.scroll-view{
height: 100%
.list{
padding: 0 28rpx 28rpx 28rpx
}
}
}
}
</style>

View File

@@ -97,7 +97,7 @@ function updateCancel(item) {
function getList(type = 'add', loading = true) {
if (type === 'refresh') {
pageState.page = 0;
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {

View File

@@ -52,6 +52,8 @@ const calendarData = ref([]);
const current = ref({});
import { Solar, Lunar } from '@/lib/lunar-javascript@1.7.2.js';
const isRecord = ref(false);
const recordNum = ref(4);
const pages = reactive({
year: 0,
month: 0,
@@ -63,15 +65,21 @@ onLoad((options) => {
date: options?.date || null,
};
}
console.log(options);
initPagesDate();
addMonth();
addMonth();
addMonth();
if (options.record) {
isRecord.value = true;
initOldPagesDate();
new Array(recordNum.value + 1).fill(null).map(() => {
addMonth();
});
} else {
initPagesDate();
new Array(recordNum.value).fill(null).map(() => {
addMonth();
});
}
});
function backParams() {
console.log(isValidDateString(current.value.date));
if (isValidDateString(current.value.date)) {
navBack({
data: current.value,
@@ -94,6 +102,7 @@ function isValidDateString(dateStr) {
}
function onScrollBottom() {
if (isRecord.value) return;
addMonth();
}
@@ -101,10 +110,22 @@ function selectDay(item) {
current.value = item;
}
function initOldPagesDate() {
const d = new Date();
const yue = d.getMonth();
if (yue < recordNum.value) {
pages.month = 12 + (yue - recordNum.value);
pages.year = d.getFullYear() - 1;
} else {
pages.month = yue - recordNum.value;
pages.year = d.getFullYear();
}
}
function initPagesDate() {
const d = new Date();
pages.year = d.getFullYear();
pages.month = d.getMonth();
pages.year = d.getFullYear();
}
function addMonth() {

View File

@@ -0,0 +1,138 @@
<template>
<view class="notifi-content">
<scroll-view class="scroll-view" scroll-y @scrolltolower="scrollBottom">
<view class="list">
<view class="card btn-light" v-for="(item, index) in pageState.list" :key="index">
<view class="card-Date">{{ item.date }}</view>
<view class="card-Title">{{ item.title }}</view>
<view class="card-subTitle">{{ item.subTitle }}</view>
<view class="card-btns" v-if="item.noticeType === '2'" @click="seeBussiness(item)">
<view class="btns-text">立即查看</view>
<view class="btns-text"><uni-icons type="forward" color="#256bfa" size="18"></uni-icons></view>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
const { $api, navTo, debounce, customSystem } = inject('globalFunction');
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
search: {},
lastDate: '',
});
onLoad(() => {
getList('refresh');
});
function scrollBottom() {
getList();
}
function seeBussiness(item) {
if (item.bussinessId) {
navTo(`/packageA/pages/UnitDetails/UnitDetails?bussinessId=${item.bussinessId}`);
}
}
function setRead(row) {
const ids = row
.filter((item) => !item.isRead)
.map((item) => item.noticeId)
.join(',');
if (ids) {
$api.createRequest(`/app/notice/read/sysNotice?id=${ids}`, {}, 'POST').then((resData) => {
console.log('设置已读');
});
}
}
function getList(type = 'add', loading = true) {
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
...pageState.search,
};
$api.createRequest('/app/notice/sysNotice', params).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
setRead(rows);
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
</script>
<style lang="scss" scoped>
.notifi-content {
background-color: #f4f4f4;
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
.scroll-view {
height: 100%;
}
.list {
padding: 28rpx;
.card {
background: #ffffff;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 20rpx 20rpx 20rpx 20rpx;
padding: 32rpx;
margin-bottom: 28rpx;
.card-Date {
font-weight: 400;
font-size: 28rpx;
color: #6c7282;
}
.card-Title {
margin-top: 24rpx;
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.card-subTitle {
margin-top: 16rpx;
font-weight: 400;
font-size: 28rpx;
color: #495265;
}
.card-btns {
font-weight: 400;
font-size: 28rpx;
color: #256bfa;
line-height: 45rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 2rpx solid #efefef;
width: 630rpx;
margin-top: 28rpx;
padding-top: 28rpx;
}
}
}
}
</style>