Merge branch 'develop_daisy' into 'develop'

feat: 新增信息发布、广播、公告入口及公告页面部分布局UI

See merge request StarlockTeam/starwork-uniapp!9
This commit is contained in:
米子豪 2025-01-10 07:56:04 +00:00
commit fa98742c39
9 changed files with 1122 additions and 1 deletions

View File

@ -153,6 +153,38 @@
},
"needLogin": false
},
{
"path": "pages/info-publish/announce-notice",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/info-publish/basic-info",
"type": "page"
},
{
"path": "pages/info-publish/info-publish",
"type": "page"
},
{
"path": "pages/info-publish/notice-details",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/info-publish/notice-manage",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/login/login",
"type": "page",

View File

@ -255,7 +255,8 @@
{
id: 309,
icon: 'https://file.hikmall.com/prod/image/0706b7ff1e044928872839c61be74d54.png',
name: '公告'
name: '公告',
url: '/pages/info-publish/notice-manage'
},
{
id: 6093,
@ -316,5 +317,8 @@
const clickItem = item => {
console.log(item)
uni.navigateTo({
url: item.url
})
}
</script>

View File

@ -0,0 +1,174 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom'
}
}
</route>
<template>
<TopNavigation title="新增公告"></TopNavigation>
<div class="announce-notice">
<!-- 表单内容 -->
<div class="form-content">
<div class="form-item">
<div class="label">
<span class="required">*</span>
公告标题
</div>
<input
type="text"
v-model="formData.title"
placeholder="请输入公告标题"
class="input-field"
/>
</div>
<div class="form-item">
<div class="label">
<span class="required">*</span>
公告正文
</div>
<textarea
v-model="formData.content"
placeholder="请输入要发布的内容"
class="textarea-field"
@input="handleContentInput"
></textarea>
<div class="word-count">{{ contentLength }}/2000</div>
</div>
</div>
<!-- 底部按钮 -->
<view class="bottom-btns">
<button class="nextstep-btn" @click="handleNextStep">下一步</button>
</view>
</div>
</template>
<script>
export default {
data() {
return {
formData: {
title: '',
content: ''
}
}
},
computed: {
contentLength() {
return this.formData.content.length
}
},
methods: {
goBack() {
this.$router.back()
},
handleContentInput() {
if (this.formData.content.length > 2000) {
this.formData.content = this.formData.content.slice(0, 2000)
}
},
handleNextStep() {
uni.navigateTo({
url: '/pages/info-publish/basic-info'
})
}
}
}
</script>
<style scoped>
.announce-notice {
display: flex;
flex-direction: column;
height: 100vh;
background: #f5f5f5;
}
.header {
position: relative;
display: flex;
align-items: center;
height: 44px;
padding: 0 15px;
background: #fff;
}
.title {
flex: 1;
font-size: 17px;
font-weight: 500;
text-align: center;
}
.form-content {
flex: 1;
padding: 15px;
}
.form-item {
padding: 15px;
margin-bottom: 15px;
background: #fff;
border-radius: 8px;
}
.label {
margin-bottom: 10px;
font-size: 15px;
}
.required {
margin-right: 4px;
color: #ff4d4f;
}
.input-field {
width: 100%;
font-size: 14px;
border: none;
}
.textarea-field {
width: 100%;
min-height: 200px;
font-size: 14px;
resize: none;
border: none;
}
.word-count {
margin-top: 8px;
font-size: 12px;
color: #999;
text-align: right;
}
.bottom-btns {
position: fixed;
right: 0;
bottom: 0;
left: 0;
display: flex;
padding: 10px 15px;
background-color: #fff;
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
.nextstep-btn {
flex: 1;
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
border-radius: 4px;
}
.nextstep-btn {
color: #fff;
background-color: #007aff;
}
}
</style>

View File

@ -0,0 +1,349 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom'
}
}
</route>
<template>
<TopNavigation title="公告管理"></TopNavigation>
<div class="basic-info">
<!-- 基本信息区域 -->
<div class="content">
<div class="section-title">基本信息</div>
<!-- 发布对象 -->
<div class="form-item" @click="selectTarget">
<div class="label">
<span class="required">*</span>
<span>发布对象</span>
</div>
<div class="value">
<span class="placeholder">请选择</span>
<i class="arrow">></i>
</div>
</div>
<!-- 发布类型 -->
<div class="form-item" @click="showTimePicker = true">
<div class="label">
<span class="required">*</span>
<span>发布时间</span>
</div>
<div class="value">
<span>{{ publishType }}</span>
<i class="arrow">></i>
</div>
</div>
<!-- 发布日期 - 仅在定时发布时显示 -->
<div class="form-item" v-if="isScheduled" @click="showDatePicker = true">
<div class="label">
<span class="required">*</span>
<span>发布日期</span>
</div>
<div class="value">
<span>{{ publishDate }}</span>
<i class="arrow">></i>
</div>
</div>
<!-- 发布时间 - 仅在定时发布时显示 -->
<div class="form-item" v-if="isScheduled" @click="showTimePickerDetail = true">
<div class="label">
<span class="required">*</span>
<span>发布时间</span>
</div>
<div class="value">
<span>{{ publishTimeDetail }}</span>
<i class="arrow">></i>
</div>
</div>
</div>
<!-- 底部按钮 -->
<div class="footer">
<button class="draft-btn" @click="saveDraft">保存为草稿</button>
<button class="publish-btn" @click="publish">发布公告</button>
</div>
<!-- 发布类型选择弹窗 -->
<transition name="slide-up">
<div class="popup" v-if="showTimePicker">
<div class="mask" @click="hideTimePicker"></div>
<div class="popup-content">
<div class="popup-header">
<div class="popup-title">请选择发布时间</div>
<div class="popup-close" @click="showTimePicker = false">×</div>
</div>
<div class="popup-body">
<div
class="time-option"
:class="{ active: !isScheduled }"
@click="selectPublishType('now')"
>
立即发布
<i class="check-icon" v-if="!isScheduled"></i>
</div>
<div
class="time-option"
:class="{ active: isScheduled }"
@click="selectPublishType('schedule')"
>
定时发布
<i class="check-icon" v-if="isScheduled"></i>
</div>
</div>
</div>
</div>
</transition>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
//
const showTimePicker = ref(false) //
const showDatePicker = ref(false) //
const showTimePickerDetail = ref(false) //
//
const isScheduled = ref(false) //
const publishDate = ref('2025-01-07') //
const publishTimeDetail = ref('15:55:52') //
//
const publishType = computed(() => (isScheduled.value ? '定时发布' : '立即发布'))
//
const selectPublishType = (type: 'now' | 'schedule') => {
isScheduled.value = type === 'schedule'
showTimePicker.value = false
}
function hideTimePicker() {
showTimePicker.value = false
}
//
const selectDate = (date: string) => {
publishDate.value = date
showDatePicker.value = false
}
//
const selectTime = (time: string) => {
publishTimeDetail.value = time
showTimePickerDetail.value = false
}
const selectTarget = () => {
//
}
const saveDraft = () => {
// 稿
// 稿
uni.navigateTo({
url: '/pages/info-publish/drafts-list'
})
}
const publish = () => {
//
}
</script>
<style scoped>
.basic-info {
display: flex;
flex-direction: column;
min-height: 100vh;
background: #f5f5f5;
}
.header {
position: relative;
display: flex;
align-items: center;
height: 44px;
padding: 0 15px;
background: #fff;
}
.back-icon {
padding: 10px;
margin-left: -10px;
font-size: 18px;
}
.title {
flex: 1;
font-size: 17px;
font-weight: 500;
text-align: center;
}
.more,
.close {
padding: 10px;
font-size: 20px;
}
.content {
flex: 1;
padding: 15px;
}
.section-title {
margin-bottom: 10px;
font-size: 14px;
color: #999;
}
.form-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
margin-bottom: 1px;
background: #fff;
}
.label {
display: flex;
align-items: center;
}
.required {
margin-right: 4px;
color: #ff4d4f;
}
.value {
display: flex;
align-items: center;
color: #999;
}
.placeholder {
margin-right: 4px;
}
.arrow {
margin-left: 4px;
color: #ccc;
}
.footer {
position: fixed;
right: 0;
bottom: 0;
left: 0;
display: flex;
padding: 10px 15px;
background-color: #fff;
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
.draft-btn,
.publish-btn {
flex: 1;
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
border-radius: 4px;
}
.draft-btn {
margin-right: 10px;
color: #333;
background-color: #f5f5f5;
}
.publish-btn {
color: #fff;
background-color: #007aff;
}
}
/* 弹窗相关样式 */
.time-picker-popup {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1000;
}
.mask {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.4);
}
.popup-content {
position: absolute;
right: 0;
bottom: 0;
left: 0;
background: #fff;
border-radius: 16px 16px 0 0;
}
.popup-header {
display: flex;
align-items: center;
padding: 16px;
border-bottom: 1px solid #f5f5f5;
}
.popup-title {
flex: 1;
font-size: 16px;
font-weight: 500;
text-align: center;
}
.popup-close {
padding: 8px;
font-size: 20px;
color: #999;
}
.popup-body {
padding: 8px 0;
}
.time-option {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
font-size: 16px;
}
.time-option.active {
color: #4080ff;
}
.check-icon {
font-size: 18px;
color: #4080ff;
}
/* 动画效果 */
.slide-up-enter-active,
.slide-up-leave-active {
transition: all 0.3s ease-out;
}
.slide-up-enter-from,
.slide-up-leave-to {
transform: translateY(100%);
}
</style>

View File

@ -0,0 +1,107 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom'
}
}
</route>
<template>
<TopNavigation title="草稿箱"></TopNavigation>
<view class="drafts-list">
<!-- 草稿箱列表 -->
<view class="list-item" v-for="item in listNotice" :key="item.id" @click="clickItem(item)">
<view class="item-title">{{ item.title }}</view>
<view class="item-content">{{ item.content }}</view>
<view class="item-info">
<text class="item-author">{{ item.author }}</text>
<text class="item-date">{{ item.date }}</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const listNotice = ref([
{
id: 3,
title: '公告栏公告1',
content: '公告栏公告1内容',
author: 'HikMall_30013234C',
date: '2024-12-18'
},
{
id: 4,
title: '公告栏公告2',
content: '公告栏公告2内容',
author: 'HikMall_30013234D',
date: '2024-12-18'
}
])
//
const notices = ref([
{
id: 1,
title: '1',
content: '公告1内容',
author: 'HikMall_30013234A',
date: '2024-12-17'
},
{
id: 2,
title: '2',
content: '公告2内容',
author: 'HikMall_30013234B',
date: '2024-12-17'
}
])
const clickItem = item => {
console.log(item)
uni.navigateTo({
url: `/pages/info-publish/notice-details?id=${item.id}`
})
}
</script>
<style lang="scss" scoped>
.drafts-list {
min-height: 100vh;
background-color: #f5f5f5;
}
.drafts-list {
padding: 15px;
list-style-type: none; /* 移除列表左侧的黑点 */
.list-item {
position: relative; /* 为绝对定位提供参考 */
padding: 15px;
margin-bottom: 10px;
background-color: #fff;
border-radius: 8px;
.item-title {
margin-bottom: 8px;
font-size: 16px;
font-weight: 500;
}
.item-content {
margin-bottom: 8px;
color: #666;
}
.item-info {
display: flex;
gap: 10px;
font-size: 12px;
color: #999;
}
}
}
</style>

View File

@ -0,0 +1,7 @@
<template>
<view></view>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,151 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom'
}
}
</route>
<template>
<TopNavigation title="公告详情"></TopNavigation>
<view class="notice-details-page">
<!-- 公告列表 -->
<view class="notice-list">
<view class="list-item" v-for="item in notices" :key="item.id">
<view class="item-title">{{ item.title }}</view>
<view class="item-content">{{ item.content }}</view>
<view class="item-info">
<text class="item-author">{{ item.author }}</text>
<text class="item-date">{{ item.date }}</text>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns">
<button class="recall-btn" @click="handleRecall">撤回</button>
<button class="share-btn" @click="handleShare">分享到微信</button>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
//
const activeTab = ref('manage')
//
const notices = ref([
{
id: 1,
title: '1',
content: '公告1内容',
author: 'HikMall_30013234A',
date: '2024-12-17'
}
])
//
const handleRecall = () => {}
//
const handleShare = () => {}
</script>
<style lang="scss" scoped>
.notice-details-page {
min-height: 100vh;
background-color: #f5f5f5;
}
.nav-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 15px;
background-color: #fff;
.title {
font-size: 16px;
font-weight: 500;
}
}
.notice-list {
padding: 15px;
list-style-type: none; /* 移除列表左侧的黑点 */
.list-item {
position: relative; /* 为绝对定位提供参考 */
padding: 15px;
margin-bottom: 10px;
background-color: #fff;
border-radius: 8px;
.item-title {
margin-bottom: 8px;
font-size: 16px;
font-weight: 500;
}
.item-content {
margin-bottom: 8px;
color: #666;
}
.item-info {
display: flex;
gap: 10px;
font-size: 12px;
color: #999;
}
.item-status {
position: absolute;
top: 10px;
right: 10px;
padding: 2px 8px;
font-size: 12px;
font-weight: bold;
color: white; /* 白色字体 */
background-color: green; /* 绿色背景 */
border-radius: 4px;
}
}
}
.bottom-btns {
position: fixed;
right: 0;
bottom: 0;
left: 0;
display: flex;
padding: 10px 15px;
background-color: #fff;
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
}
.recall-btn,
.share-btn {
flex: 1;
flex-basis: 50%; /* 确保按钮等宽 */
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
border-radius: 4px;
}
.recall-btn {
margin-right: 10px;
color: #333;
background-color: #f5f5f5;
}
.share-btn {
color: #fff;
background-color: #007aff;
}
</style>

View File

@ -0,0 +1,294 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom'
}
}
</route>
<template>
<TopNavigation title="公告管理"></TopNavigation>
<view class="notice-page">
<!-- 标签页 -->
<view class="tabs">
<view
class="tab-item"
:class="{ active: activeTab === 'manage' }"
@click="activeTab = 'manage'"
>
公告管理
</view>
<view class="tab-item" :class="{ active: activeTab === 'list' }" @click="activeTab = 'list'">
公告栏
</view>
</view>
<!-- 提示信息 -->
<view class="tip-box">
<text>若需发布图片视频公告请在web端发布</text>
<button class="copy-btn" @click="copyWebUrl">复制地址</button>
</view>
<!-- 公告管理列表 -->
<view v-if="activeTab === 'manage'" class="notice-list">
<view class="list-item" v-for="item in listNotice" :key="item.id" @click="clickItem(item)">
<view class="item-title">{{ item.title }}</view>
<view class="item-content">{{ item.content }}</view>
<view class="item-info">
<text class="item-author">{{ item.author }}</text>
<text class="item-date">{{ item.date }}</text>
</view>
<view class="item-status">{{ item.status }}</view>
</view>
</view>
<!-- 公告栏列表 -->
<view v-if="activeTab === 'list'" class="notice-list">
<view class="list-item" v-for="item in listNotice" :key="item.id" @click="clickItem(item)">
<view class="item-title">{{ item.title }}</view>
<view class="item-content">{{ item.content }}</view>
<view class="item-info">
<text class="item-author">{{ item.author }}</text>
<text class="item-date">{{ item.date }}</text>
</view>
<view class="item-status">{{ item.status }}</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns">
<button class="draft-btn" @click="handleDraft">草稿箱</button>
<button class="publish-btn" @click="handlePublish">发布公告</button>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
//
const activeTab = ref('manage')
const listNotice = ref([
{
id: 3,
title: '公告栏公告1',
content: '公告栏公告1内容',
author: 'HikMall_30013234C',
date: '2024-12-18',
status: '已发布'
},
{
id: 4,
title: '公告栏公告2',
content: '公告栏公告2内容',
author: 'HikMall_30013234D',
date: '2024-12-18',
status: '已发布'
}
])
//
const notices = ref([
{
id: 1,
title: '1',
content: '公告1内容',
author: 'HikMall_30013234A',
date: '2024-12-17',
status: '已发布'
},
{
id: 2,
title: '2',
content: '公告2内容',
author: 'HikMall_30013234B',
date: '2024-12-17',
status: '已发布'
}
])
// Web
const copyWebUrl = () => {
uni.setClipboardData({
data: 'https://your-web-url.com',
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
})
}
})
}
const clickItem = item => {
console.log(item)
uni.navigateTo({
url: `/pages/info-publish/notice-details?id=${item.id}`
})
}
// 稿
const handleDraft = () => {
// 稿
uni.navigateTo({
url: '/pages/info-publish/drafts-list'
})
}
//
const handlePublish = () => {
//
uni.navigateTo({
url: '/pages/info-publish/announce-notice'
})
}
</script>
<style lang="scss" scoped>
.notice-page {
min-height: 100vh;
background-color: #f5f5f5;
}
.nav-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 15px;
background-color: #fff;
.title {
font-size: 16px;
font-weight: 500;
}
}
.tabs {
display: flex;
align-items: center;
justify-content: center; /* 居中显示 */
}
.tab-item {
flex: 1; /* 平均分布 */
padding: 10px 0;
text-align: center;
cursor: pointer;
}
.tab-item.active {
position: relative;
font-weight: 500;
color: #007aff;
}
.tab-item.active::after {
position: absolute;
bottom: 0;
left: 25%;
align-items: center;
width: 50%; /* 调整宽度 */
height: 2px; /* 调整高度 */
content: '';
background-color: #007aff;
}
.tip-box {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 15px;
font-size: 14px;
color: #999;
background-color: #fff7e6;
.copy-btn {
padding: 0;
margin: 0;
font-size: 14px;
color: #007aff;
background: none;
border: none;
&::after {
border: none;
}
}
}
.notice-list {
padding: 15px;
list-style-type: none; /* 移除列表左侧的黑点 */
.list-item {
position: relative; /* 为绝对定位提供参考 */
padding: 15px;
margin-bottom: 10px;
background-color: #fff;
border-radius: 8px;
.item-title {
margin-bottom: 8px;
font-size: 16px;
font-weight: 500;
}
.item-content {
margin-bottom: 8px;
color: #666;
}
.item-info {
display: flex;
gap: 10px;
font-size: 12px;
color: #999;
}
.item-status {
position: absolute;
top: 10px;
right: 10px;
padding: 2px 8px;
font-size: 12px;
font-weight: bold;
color: white; /* 白色字体 */
background-color: green; /* 绿色背景 */
border-radius: 4px;
}
}
}
.bottom-btns {
position: fixed;
right: 0;
bottom: 0;
left: 0;
display: flex;
padding: 10px 15px;
background-color: #fff;
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
.draft-btn,
.publish-btn {
flex: 1;
height: 40px;
font-size: 14px;
line-height: 40px;
text-align: center;
border-radius: 4px;
}
.draft-btn {
margin-right: 10px;
color: #333;
background-color: #f5f5f5;
}
.publish-btn {
color: #fff;
background-color: #007aff;
}
}
</style>

View File

@ -17,6 +17,9 @@ interface NavigateToOptions {
"/pages/attendance/issue-record" |
"/pages/code/code" |
"/pages/get-code/get-code" |
"/pages/info-publish/info-publish" |
"/pages/info-publish/notice-details" |
"/pages/info-publish/notice" |
"/pages/login/login" |
"/pages/mine/mine" |
"/pages/notification/notification" |