新增通知

This commit is contained in:
hupeng 2024-10-21 15:58:14 +08:00
parent 88d1c503c8
commit aba3c69153
9 changed files with 371 additions and 55 deletions

10
api/market.js Normal file
View File

@ -0,0 +1,10 @@
import api from './api'
export function getNews(data) {
return api.get('/system/notice/page', data, { login: false })
}
export function getNewsDetail(data) {
return api.get('/system/notice/get', data, { login: false })
}

View File

@ -280,6 +280,24 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/mine/list",
"style" :
{
"navigationBarTitleText": "通知",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/mine/news",
"style" :
{
"navigationBarTitleText": "通知详情",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/msg/wait",

View File

@ -1,50 +0,0 @@
<template>
<layout>
<!-- #ifdef MP-WEIXIN -->
<uv-navbar
:fixed="false"
:title="title"
left-arrow
@leftClick="$onClickLeft"
/>
<!-- #endif -->
<view>
<rich-text :nodes="content"></rich-text>
</view>
</layout>
</template>
<script setup>
import {
ref
} from 'vue'
import { onLoad,onShow} from '@dcloudio/uni-app'
import {
mineServiceContent
} from '@/api/user'
const title = ref('内容')
const content = ref('')
onLoad((option) => {
if (option.name) {
title.value = option.name
}
if (option.id) {
getContent(option.id);
}
})
const getContent = async(id) => {
let data = await mineServiceContent({id:id});
if (data) {
content.value = data.content;
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,325 @@
<template>
<uv-navbar
:fixed="false"
@leftClick="$onClickLeft"
bgColor="#09b4f1"
>
<template v-slot:left>
<uv-icon name="arrow-left" size="19" color="#ffffff"></uv-icon>
</template>
<template v-slot:center>
<text style="color:#ffffff">{{title}}</text>
</template>
</uv-navbar>
<view class="container" >
<view class="wrap">
<scroll-view scroll-y class="sv" :style="{height:scrollHeight+'px'}" :scroll-top="scrollTop" lower-threshold="20" @scroll="scroll" @scrolltolower="reachBottom">
<view class="page-box" @touchmove="handletouchstart" @touchend="handletouchend">
<block v-if="dataList.length > 0">
<view class="client" v-for="(items, index) in dataList" :key="index" @click="onItem(items.id)">
<view class="flex align-center font-size-medium mb-2"><uv-icon size="25" name="calendar"></uv-icon><text class="ml-2">{{items.title}}</text></view>
<view class="flex align-center font-size-sm "><uv-icon size="22" name="clock"></uv-icon><text class="ml-2 text-color-assist">{{timeFormats(items.createTime)}}</text></view>
</view>
<uv-load-more :status="listStatus" />
</block>
<uv-empty text="暂无数据" v-else margin-top="100" mode="list"></uv-empty>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import {
ref,
computed
} from 'vue'
import { onLoad,onShow ,onReady} from '@dcloudio/uni-app'
import {
getNews
} from '@/api/market'
import { formatDateTime } from '@/utils/util'
const title = ref('通知')
const keyword = ref('')
const mobile = ref('')
const phone = ref('')
const dealStatus = ref(-2)
const dealStatusName = ref('')
const scrollHeight = ref(0)
const pH = ref(0)
const scrollTop = ref(-1)
const specClass = ref('hide')
const oldScrollTop = ref(0)
const dataList = ref([])
const dx = ref(0)
const page = ref(1)
const pageSize = ref(10)
const lastPage = ref(false)
const listStatus = ref('loadmore')
const isRefresh = ref(false)
defineExpose({isRefresh})
const customStyle = computed(() =>{
return {
paddingLeft:'10rpx',
paddingRight:'120rpx'
}
})
const statusBarHeight = ref(0)
statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
const customStyle2 = computed(() =>{
return {
marginTop:(uni.getSystemInfoSync().statusBarHeight+40)+'px',
backgroundColor:'#ffffff'
//top:'100px'
}
})
const popup = ref()
onReady(()=>{
uni.getSystemInfo({
success(res) {
pH.value = res.windowHeight
let scrollH = uni.createSelectorQuery().select(".sv")
scrollH.boundingClientRect(data=>{
let pH0 = pH.value
scrollHeight.value = pH0 - data.top - 5
}).exec()
}
})
})
onLoad((e) => {
getCluesList();
})
// onShow(()=>{
// if (isRefresh.value) {
// isRefresh.value = false
// page.value = 1
// lastPage.value = false
// scrollTop.value = 0
// dataList.value = []
// getCluesList()
// }
// })
const handletouchstart = () => {
specClass.value = 'show'
}
const handletouchend = () => {
specClass.value = 'hide'
}
//
const timeFormats = (val) => {
if(val){
return formatDateTime(val)
} else {
return '--'
}
}
//
const getCluesList = async(isNextPage,pages) => {
await getNews({
pageNo: page.value,
pageSize: pageSize.value
}).then(res => {
res.list.forEach((item,index) => {
if(item.tags) {
item.tagsArr = item.tags.split(',')
}
})
if(res) {
//
if (res.list.length < 10) {
listStatus.value = 'nomore'
}
//
if(res.list.length == 0) {
lastPage.value = true
}
//
if(isNextPage) {
dataList.value = dataList.value.concat(res.list)
return
}
dataList.value = res.list
}
})
}
// scroll
const scroll = (e) => {
oldScrollTop.value = e.detail.scrollTop; //
}
//
const reachBottom = () => {
if(lastPage.value || listStatus.value == 'loading') return ;
if (!lastPage.value) {
listStatus.value = 'loading';
setTimeout(() => {
listStatus.value = 'loadmore'
getCluesList(true,++page.value)
}, 500)
}
}
//
const onItem = (id) => {
uni.navigateTo({
url: '/pages/components/pages/mine/news?id=' + id
});
}
</script>
<style lang="scss">
.container {
background-color: #F7F7F7;
}
.page-box {
padding: 20rpx 20rpx 45rpx;
}
.client {
width: 710rpx;
background-color: #ffffff;
margin-bottom: 20rpx;
border-radius: 20rpx;
box-sizing: border-box;
padding: 20rpx;
font-size: 28rpx;
.top {
display: flex;
justify-content: space-between;
.left {
display: flex;
align-items: center;
.store {
max-width: 400rpx;
font-size: 30rpx;
font-weight: bold;
}
}
}
.tap {
display: flex;
align-items: center;
flex-wrap: wrap;
margin: 20rpx 0 0;
.tap-item {
background-color: #FF6146;
color: #fff;
font-size: 25rpx;
padding: 10rpx 25rpx;
border-radius: 8rpx;
margin-left: 10rpx;
margin-bottom: 10rpx;
}
}
.item {
display: flex;
margin: 20rpx 0 0;
.content {
flex: 1;
.title {
font-size: 28rpx;
line-height: 50rpx;
}
.type {
margin: 10rpx 0;
font-size: 24rpx;
color: $uv-tips-color;
}
}
.right {
margin-left: 10rpx;
text-align: right;
.decimal {
font-size: 24rpx;
margin-top: 4rpx;
}
.number {
color: $uv-tips-color;
font-size: 24rpx;
}
}
}
.bottom {
display: flex;
margin-top: 20rpx;
justify-content: space-between;
align-items: center;
.client_time {
color: #777;
font-size: 26rpx;
}
.btn {
line-height: 60rpx;
width: 160rpx;
border-radius: 5px;
font-size: 26rpx;
text-align: center;
color: $uv-primary-dark;
}
.entity {
color: #fff;
background-color: #09b4f1;
}
}
}
.wrap {
display: flex;
flex-direction: column;
width: 100%;
}
.floatBtn {
font-size: 23rpx;
bottom: 100px;
right: 10px;
border-radius: 5000px;
z-index: 9;
opacity: 1;
width: 130rpx;
height: 130rpx;
position: fixed;
display: flex;
flex-direction: row;
flex-direction: column;
justify-content: center;
background-color: #fff;
color: #606266;
align-items: center;
transition: opacity 0.4s;
border: 1px solid #dcdfe6;
&.show {
animation: showLayer 0.2s linear both;
}
&.hide {
animation: hideLayer 0.5s linear both;
}
@keyframes showLayer {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(120rpx);
}
}
@keyframes hideLayer {
0% {
transform: translateX(120rpx);
}
100% {
transform: translateX(0);
}
}
}
</style>

View File

@ -36,7 +36,7 @@ onLoad((option) => {
}
})
const getContent = async(id) => {
let data = await getNewsDetail(id);
let data = await getNewsDetail({id:id});
if (data) {
news.value = data;
}

View File

@ -222,7 +222,7 @@ const getData = async() => {
toolIcons3.value[10].count = brieCount.count11
toolIcons3.value[11].count = brieCount.count12
main.SET_INDEX_COUNT(data)
let count = data.contractCheckCount + data.invoiceCheckCount + data.receivablesCheckCount + data.followBusinessCount + data.followCluesCount + data.followCustomerCount
let count = brieCount.count13+data.contractCheckCount + data.invoiceCheckCount + data.receivablesCheckCount + data.followBusinessCount + data.followCluesCount + data.followCustomerCount
//let str = count > 0 ? count + '' : ''
if(count > 0){
uni.setTabBarBadge({
@ -360,7 +360,7 @@ const gopage2 = (url) =>{
background-color: #D7D7D7;
font-size: 25rpx;
padding: 10rpx 20rpx;
border-radius: 20rpx;
border-radius: 20rpx;
}
}
}

View File

@ -30,8 +30,9 @@
<!-- user grid begin -->
<view class="w-100 flex align-items-center just-content-center">
<view class="user-grid" @click="gopage('')">
<view class="value font-size-extra-lg font-weight-bold text-color-base">
<view class="user-grid" @click="gopage('/pages/components/pages/mine/list')">
<view class="value font-size-extra-lg font-weight-bold text-color-base position-relative">
<uv-badge type="error" max="99" :value="noticeCount" :absolute="true" :offset="[-5,-5]"></uv-badge>
<image src="/static/images/12.png" class="icon-img"></image>
</view>
<view class="font-size-sm text-color-assist">通知</view>
@ -190,9 +191,11 @@ const roleName = ref('--')
const waitCount = ref(0)
const checkCount = ref(0)
const noticeCount = ref(0)
onShow(() => {
noticeCount.value = indexCount.value.brieCountVO.count13
waitCount.value = indexCount.value.followBusinessCount + indexCount.value.followCluesCount + indexCount.value.followCustomerCount
checkCount.value = indexCount.value.contractCheckCount + indexCount.value.invoiceCheckCount + indexCount.value.receivablesCheckCount
getUserInfo();

View File

@ -29,6 +29,14 @@
</view>
</template>
</uv-cell>
<uv-cell icon="/static/images/23.png" title="通知管理" label="系统公告通知" iconStyle="height:70rpx;width:70rpx;margin-right:10rpx">
<template v-slot:right-icon>
<view class="flex align-center" @click="gopage('/pages/components/pages/mine/list')">
<uv-badge type="error" max="99" :value="noticeCount"></uv-badge>
<uv-icon size="30rpx" name="arrow-right"></uv-icon>
</view>
</template>
</uv-cell>
</uv-cell-group>
</view>
@ -49,8 +57,10 @@ const cart = ref([])
const uToast = ref()
const waitCount = ref(0)
const checkCount = ref(0)
const noticeCount = ref(0)
onShow(() => {
noticeCount.value = indexCount.value.brieCountVO.count13
waitCount.value = indexCount.value.followBusinessCount + indexCount.value.followCluesCount + indexCount.value.followCustomerCount
checkCount.value = indexCount.value.contractCheckCount + indexCount.value.invoiceCheckCount + indexCount.value.receivablesCheckCount
})

BIN
static/images/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB