Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
aixianling
2021-12-22 09:35:29 +08:00
7 changed files with 506 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
<template #header>
<div flex>
<AiAreaPicker :areaId="user.areaId" @select="handleSelectArea" icon="Location2.png"/>
<u-search placeholder="请输入标题" :show-action="false" v-model="search.title" @search="current=1,getList()"/>
<u-search placeholder="请输入标题" :show-action="false" v-model="search.title" @search="current=1,getData()"/>
</div>
</template>
</AiNewsList>

View File

@@ -12,7 +12,7 @@
</div>
</div>
<template v-if="datas.length < 1">
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in 6" :key="i" @click.native="toDetail(item, 1)">
<template #custom>
<div class="left">

View File

@@ -143,8 +143,8 @@ export default {
return {
lists: [
{
iconPath: 'home',
selectedIconPath: 'home-fill',
iconPath: 'order',
selectedIconPath: 'order-fill',
text: '统计分析',
isDot: true,
customIcon: false,
@@ -385,6 +385,17 @@ export default {
changeTab(e) {
this.currentTabBar = e
if (this.currentTabBar == 0) {
this.getList()
this.$nextTick(() => {
if (this.currentTabs == 0) {
this.Echarts1 = echarts.init(document.getElementById('echarts1'))
} else {
this.Echarts2 = echarts.init(document.getElementById('echarts2'))
}
this.getEchart()
})
}
if (this.currentTabBar == 1) {
this.getList()
}

View File

@@ -40,6 +40,7 @@
</p>
</div>
</AiTopFixed>
<div class="card">
<AiCell title label="群标签">
<u-icon label="添加" size="38" name="iconAdd" custom-prefix="iconfont" color="#1365DD" label-color="#1365DD" @tap="showTagManage = true" />
@@ -50,6 +51,7 @@
</u-row>
</AiCell>
</div>
<div class="card">
<AiCell title label="群成员"></AiCell>
<div class="wrap">
@@ -70,6 +72,7 @@
</div>
</div>
</template>
<TagManage v-if="showTagManage" />
<AiBack v-if="isNormal && !showTagManage" />
</div>
@@ -77,10 +80,13 @@
<script>
import { mapActions } from 'vuex'
import TagManage from './tagManage'
export default {
name: 'GroupList',
components: {},
components: {
TagManage,
},
props: {},
provide() {
return {

182
src/apps/AppUniMsg/Add.vue Normal file
View File

@@ -0,0 +1,182 @@
<template>
<div class="add">
<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 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" required :border-bottom="false" label-position="top" class="contents">
<u-input v-model="forms.content" placeholder="请输入正文" type="textarea" auto-height height="100" 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"></AiUploader>
</u-form-item>
<div class="line"></div>
</u-form>
</div>
<div class="btn" @click="submit">保存</div>
<AiBack></AiBack>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
components: {},
props: {},
data() {
return {
id: '',
forms: {
title: '',
publishUnitName: '',
content: '',
images: [],
},
flag: false,
}
},
computed: { ...mapState(['user']) },
onLoad(o) {
this.id = o.id
this.getDetail()
},
mounted() {},
methods: {
getDetail() {
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 || '[]')
}
}
})
},
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('请输入正文')
}
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.$u.toast('发布成功')
this.flag = false
uni.navigateTo({ url: `./AppUniMsg` })
}
})
} else {
this.$u.toast('失败')
}
})
},
},
}
</script>
<style lang="scss" scoped>
.add {
height: 100%;
padding-bottom: 112px;
.header-description {
::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;
}
}
</style>

View File

@@ -0,0 +1,210 @@
<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" :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>
<img :src="items.url" alt="" v-for="(items, i) in item.images" :key="i" />
</template>
<template #menu>
<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()
},
onShow() {},
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
if (this.datas) {
this.datas.map((item) => {
if (item.images) {
item.images = JSON.parse(item.images || '[]')
}
return item
})
}
this.pages = res.data.pages
}
})
},
toAdd(item, type) {
console.log(type)
if (type == '1') {
console.log('详情')
uni.navigateTo({ url: `./Detail?id=${item.id}` })
}
if (type == '2') {
console.log('编辑')
uni.navigateTo({ url: `./Add?id=${item.id}` })
}
if (type == null) {
console.log('添加')
uni.navigateTo({ url: `./Add` })
}
},
toDetele(item) {
this.deletShow = true
this.deletId = item.id
},
delet() {
this.$http.post(`/app/appmininotice/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
},
change(index) {
this.currentTabs = index
this.getList()
},
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style scoped lang="scss">
.AppUniMsg {
height: 100%;
::v-deep .AiCard {
background: #f3f6f9;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
.fill {
.titles {
font-size: 30px;
color: #333;
font-family: 500;
}
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;
}
}
}
}
.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,92 @@
<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>
<div class="header-middle">
<span class="contsnts">{{ data.content }}</span>
<img :src="item.url" alt="" v-for="(item, i) in data.images" :key="i" />
</div>
</div>
</template>
<script>
export default {
name: 'Detail',
components: {},
props: {},
data() {
return {
data: [],
id: '',
}
},
computed: {},
watch: {},
onLoad(o) {
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 || '[]')
}
}
})
},
},
}
</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;
}
img {
margin-top: 30px;
width: 686px;
height: 486px;
}
}
}
</style>