持续集成分支

This commit is contained in:
aixianling
2024-10-31 14:34:57 +08:00
parent 6a833be062
commit 8c56cf808b
2165 changed files with 4116 additions and 8716 deletions

View File

@@ -0,0 +1,211 @@
<template>
<div class="add" v-if="isShow">
<div class="header-description">
<u-form :model="forms" ref="uForm" label-width="auto" :border-bottom="false">
<u-form-item label="标题" prop="title" required :border-bottom="false" class="names">
<u-input :focus="true" v-model="forms.title" placeholder="请输入标题" maxlength="30"/>
</u-form-item>
<u-form-item label="发布组织" prop="publishUnitName" required :border-bottom="false" class="phones">
<u-input v-model="forms.publishUnitName" placeholder="请输入发布组织" maxlength="16"/>
</u-form-item>
<u-form-item label="正文" prop="content" :border-bottom="false" label-position="top" class="contents">
<AiEditor v-model="forms.content" placeholder="请输入正文" :maxlength="500"/>
</u-form-item>
<div class="line"></div>
<u-form-item label="图片上传 (最多9张)" prop="images" :border-bottom="false" class="avatars" label-position="top">
<AiUploader :def.sync="forms.images" multiple placeholder="上传图片" :limit="9"
action="/admin/file/add2"/>
</u-form-item>
</u-form>
</div>
<div class="btn" @click="submit">保存</div>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'Add',
props: {},
data() {
return {
id: '',
forms: {
title: '',
publishUnitName: '',
content: '',
images: [],
},
flag: false,
isShow: false
}
},
computed: {...mapState(['user'])},
onLoad(o) {
this.id = o.id
if(!o.id) {
this.isShow = true
}
this.getDetail()
},
onShow() {
document.title = '新增小程序公告'
},
mounted() {
},
methods: {
getDetail() {
if (this.id) {
this.$http.post(`/app/appmininotice/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
this.forms = res.data
if (res.data.images) {
this.forms.images = JSON.parse(res.data.images || '[]')
}
this.isShow = true
}
})
}
},
submit() {
if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (!this.forms.title) {
return this.$u.toast('请输入标题')
}
if (!this.forms.publishUnitName) {
return this.$u.toast('请输入发布组织')
}
var isContent = false
if (this.forms.content || this.forms.images.length > 0) {
isContent = true
}
if (!isContent) {
return this.$u.toast('请输入正文或图片')
}
const imgs = []
if (this.forms.images) {
this.forms.images.map((e) => {
imgs.push({url: e.url, id: e.id})
})
}
this.flag = true
this.$http
.post(`/app/appmininotice/addOrUpdate`, {
title: this.forms.title,
publishUnitName: this.forms.publishUnitName,
content: this.forms.content,
images: JSON.stringify(imgs) || [],
id: this.id,
})
.then((res) => {
if (res.code == 0) {
this.flag = false
this.$u.toast('提交成功')
uni.$emit('updateList')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
} else {
this.$u.toast('失败')
}
})
},
},
}
</script>
<style lang="scss" scoped>
uni-page-body {
height: 100%;
}
.add {
height: 100%;
.header-description {
padding-bottom: 112px;
::v-deep .u-form {
.u-form-item {
padding: 0 45px !important;
.u-form-item__body {
.u-form-item--right__content__slot {
padding-bottom: 0;
.u-input {
text-align: right !important;
}
}
}
}
.names,
.modeTypes,
.phones {
.u-form-item__body {
border-bottom: 1px solid #dddddd;
}
}
.u-form-item:last-child {
margin-bottom: 40px;
}
.avatars,
.contents {
padding-bottom: 20px !important;
.u-form-item__body {
.u-form-item--right__content__slot {
.u-input {
text-align: left !important;
}
}
.default {
width: 160px;
height: 160px;
}
}
}
.line {
height: 24px;
background: #f3f6f9;
}
}
}
.btn {
position: fixed;
bottom: 0;
width: 100%;
height: 112px;
line-height: 112px;
background: #1365dd;
text-align: center;
font-size: 32px;
font-weight: 500;
color: #ffffff;
z-index: 999999;
}
}
</style>

View File

@@ -0,0 +1,239 @@
<template>
<div class="AppUniMsg">
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :ref="item.id" :key="i" @click.native="toAdd(item, 1)">
<template #custom>
<div class="titles">
{{ item.title }}
</div>
<div class="publishUnitNames">
<span>发布部门</span>
<span>{{ item.publishUnitName }}</span>
</div>
<div class="createTimes">
<span>发布时间</span>
<span>{{ item.createTime }}</span>
</div>
<div class="imgs">
<img :src="items.url" alt="" v-for="(items, i) in JSON.parse(item.images || '[]')" :key="i" v-if="i < 3" @click.stop="previewImage(JSON.parse(item.images || '[]'), items.url)" />
</div>
</template>
<template #menu v-if="item.createUserId == user.id">
<div class="menu" @tap.stop="toAdd(item, 2)">编辑</div>
<div class="menu" @tap.stop="toDetele(item)">删除</div>
</template>
</AiCard>
<u-loadmore :status="loadmore" color="#999" font-size="24" margin-top="32" margin-bottom="80" />
</template>
<AiEmpty description="暂无数据" v-else></AiEmpty>
<AiFixedBtn>
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()" />
</AiFixedBtn>
<u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true" :show-title="false" @confirm="delet"></u-modal>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppUniMsg',
appName: '小程序公告',
components: {},
props: {},
data() {
return {
datas: [],
current: 1,
size: 10,
deletShow: false,
deletId: '',
tabList: [
{
name: '全部公告',
},
{
name: '我的发布',
},
],
currentTabs: 0,
}
},
computed: {
...mapState(['user']),
loadmore() {
return this.pages <= this.current ? 'loading ' : 'nomore'
},
},
watch: {},
onLoad() {
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
onShow() {
document.title = '小程序公告'
},
methods: {
getList() {
this.$http
.post('/app/appmininotice/list', null, {
params: {
size: this.size,
current: this.current,
createUserId: this.currentTabs == 1 ? this.user.id : '',
},
})
.then((res) => {
if (res.code == 0) {
this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
this.pages = res.data.pages
}
})
},
toAdd(item, type) {
if (item?.id) {
this.$refs?.[item.id]?.[0]?.handleClose()
}
if (type == '1') {
uni.navigateTo({ url: `./Detail?id=${item.id}` })
}
if (type == '2') {
uni.navigateTo({ url: `./Add?id=${item.id}` })
}
if (type == null) {
uni.navigateTo({ url: `./Add` })
}
},
toDetele(item) {
this.deletShow = true
this.deletId = item.id
this.$refs?.[item.id]?.[0]?.handleClose()
},
delet() {
this.$http.post(`/app/appmininotice/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
},
change(index) {
this.datas = []
this.current = 1
this.currentTabs = index
this.getList()
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style scoped lang="scss">
uni-page-body {
height: 100%;
}
.AppUniMsg {
height: 100%;
::v-deep .AiCard {
background: #f5f5f5;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
.fill {
.titles {
font-size: 30px;
color: #333;
font-family: 500;
}
.imgs {
margin-top: 10px;
img {
width: 200px;
height: 200px;
margin-right: 8px;
}
img:nth-child(3n) {
margin-right: 0;
}
}
}
}
.mask {
.moreMenu {
transform: translate(-175px, 20px);
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
}
}
}
.u-load-more-wrap {
background: #f5f5f5 !important;
margin: 0 !important;
padding: 34px 0;
}
.AiFixedBtn {
.movableArea {
.addBtn {
display: flex;
justify-content: center;
align-items: center;
width: 96px;
height: 96px;
flex-shrink: 0;
background: $uni-color-primary;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
font-size: 48px;
color: #fff;
border-radius: 50%;
}
}
}
}
</style>

View File

@@ -0,0 +1,112 @@
<template>
<div class="Detail">
<div class="header-top">
<div class="titles">{{ data.title }}</div>
<div class="titles-bottom">
<span>发布单位</span>
<span>{{ data.publishUnitName }}</span>
</div>
<div class="titles-bottom">
<span>发布时间</span>
<span>{{ data.createTime }}</span>
</div>
</div>
<div class="header-middle">
<u-parse :html="data.content"></u-parse>
<div class="imgs">
<img :src="item.url" alt="" v-for="(item, i) in data.images" :key="i" @click="previewImage(data.images, item.url)" />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Detail',
components: {},
props: {},
data() {
return {
data: [],
id: '',
}
},
computed: {},
watch: {},
onLoad(o) {
document.title = '小程序公告详情'
this.id = o.id
this.getDetail()
},
mounted() {},
methods: {
getDetail() {
this.$http.post(`/app/appmininotice/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
this.data = res.data
if (res.data.images) {
this.data.images = JSON.parse(res.data.images || '[]')
}
}
})
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
}
</script>
<style scoped lang="scss">
uni-page-body {
height: 100%;
}
.Detail {
height: 100%;
padding: 0 32px;
background: #fff;
.header-top {
padding: 40px 0 32px 0;
.titles {
font-size: 48px;
font-weight: 600;
}
.titles-bottom {
margin-top: 16px;
font-size: 30px;
color: #999999;
.to-left {
margin-left: 32px;
}
}
}
.header-middle {
padding: 32px 0;
.contsnts {
font-size: 36px;
line-height: 1.5;
word-break: break-all;
}
.imgs {
margin-top: 32px;
img {
width: 224px;
height: 218px;
margin-right: 8px;
}
img:nth-child(3n) {
margin-right: 0;
}
}
}
}
</style>