feat: 1.星勤:信息发布模块—新增草稿箱页面布局 2.星勤:信息发布模块—新增已有公告各个页面逻辑跳转

This commit is contained in:
“DaisyWu” 2025-01-10 15:51:41 +08:00
parent d4635349a6
commit c91cbf4550
5 changed files with 468 additions and 11 deletions

View File

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

View File

@ -42,14 +42,13 @@
<!-- 底部按钮 -->
<view class="bottom-btns">
<button class="nextstep-btn" @click="handlePublish">下一步</button>
<button class="nextstep-btn" @click="handleNextStep">下一步</button>
</view>
</div>
</template>
<script>
export default {
name: 'AnnounceNotice',
data() {
return {
formData: {
@ -73,14 +72,9 @@
}
},
handleNextStep() {
if (!this.formData.title) {
this.$toast('请输入公告标题')
return
}
if (!this.formData.content) {
this.$toast('请输入公告内容')
}
// TODO:
uni.navigateTo({
url: '/pages/info-publish/basic-info'
})
}
}
}

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

@ -132,6 +132,9 @@
// 稿
const handleDraft = () => {
// 稿
uni.navigateTo({
url: '/pages/info-publish/drafts-list'
})
}
//