activeAnalysis

This commit is contained in:
liuye
2023-01-17 09:28:01 +08:00
parent 6eb5eb4caf
commit 21abd1a020
5 changed files with 849 additions and 5 deletions

View File

@@ -0,0 +1,246 @@
<template>
<div class="AppActive">
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
<div class="dataTop">
<div class="dataLeft">活动列表</div>
<div class="dataRight">
<span></span>
<span class="specialColor">{{ total }}</span>
<span>个活动</span>
</div>
</div>
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toDetail(item, 1)">
<template #custom>
<div class="left">
<div class="titles">{{ item.title }}</div>
<div class="nums">
<span class="specialColor">{{ item.realNum }}</span>
<span>已报名</span>
</div>
<div class="times">
<span class="timesCont">{{ item.beginTime }}</span>
<span> {{ item.endTime }}</span>
</div>
<div class="areaNmae" v-if="item.areaName || item.address">{{ item.areaName }}{{ item.address }}</div>
</div>
<img :src="items.url" alt="" v-for="(items, index) in JSON.parse(item.url || '[]')" :key="index" @click.stop="previewImage(JSON.parse(item.url || '[]'), item.url[0].url)" />
<div class="hints" :style="{ background: item.status == 0 ? '#000000' : item.status == 1 ? '#42D784' : '#E4E4E4' }">{{ $dict.getLabel('villageActivityStatus', item.status) }}</div>
</template>
</AiCard>
</template>
<AiEmpty description="暂无数据" v-else></AiEmpty>
<AiFixedBtn>
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()" />
</AiFixedBtn>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppWechatActivities',
appName: '企微活动',
data() {
return {
datas: [],
tabList: [{ name: '全部活动'}, { name: '报名中'}],
currentTabs: 0,
current: 1,
size: 6,
total: '',
}
},
computed: {
...mapState(['user']),
},
watch: {},
onLoad() {
this.$dict.load(['villageActivityStatus']).then(() => {
this.getList()
})
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
onShow() {
document.title = '企微活动'
},
methods: {
getList() {
this.$http
.post('/app/appvillageactivityinfo/listUp', null, {
params: {
size: this.size,
current: this.current,
createUserId: this.currentTabs == 1 ? this.user.id : '',
areaId: this.user.areaId,
},
})
.then((res) => {
if (res.code == 0) {
this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
this.$forceUpdate()
this.total = res.data.total
this.pages = res.data.pages
}
})
},
change(index) {
this.datas = []
this.current = 1
this.currentTabs = index
this.getList()
},
toAdd() {
uni.navigateTo({ url: `./Add` })
},
toDetail(item) {
uni.navigateTo({ url: `./Detail?id=${item.id}&createUserId=${item.createUserId}` })
},
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%;
}
.AppActive {
height: 100%;
// background: #f3f6f9;
.dataTop {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 48px;
margin-bottom: 8px;
padding: 0 32px;
.dataLeft {
font-size: 38px;
font-weight: 600;
}
.dataRight {
font-size: 28px;
color: #666666;
.specialColor {
color: #4181ff;
}
}
}
::v-deep .AiCard {
background: #f3f6f9;
.start {
background: #fff;
padding: 32px;
border-radius: 16px;
.fill {
display: flex;
justify-content: space-between;
// align-items: center;
.left {
width: calc(100% - 205px);
// background: pink;
.titles {
margin-bottom: 8px;
color: #333333;
font-weight: 500;
font-size: 30px;
line-height: 1.3;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.nums {
margin-top: 8px;
.specialColor {
color: #4181ff;
}
}
.times {
margin-top: 8px;
.timesCont {
margin-right: 10px;
}
}
.areaNmae {
margin-top: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
img {
position: relative;
width: 182px;
height: 182px;
}
.hints {
position: absolute;
right: 52px;
width: 96px;
height: 44px;
font-size: 26px;
color: #ffffff;
line-height: 44px;
text-align: center;
}
}
}
}
.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;
background: #fff;
color: #1365dd;
border-radius: 50%;
}
}
}
}
</style>

View File

@@ -0,0 +1,112 @@
<template>
<div class="BindPhone">
<div class="item">
<span class="label"><span class="tips">*</span>手机号</span>
<div class="value">
<u-input type="tel" placeholder="请填写手机号" v-model="form.phone" input-align="right" placeholder-style="color:#999;font-size:15px;" height="42" :maxlength="10" :clearable="false" />
</div>
</div>
<div class="add-btn" @click="submit()">
<div>提交</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
appName: '绑定手机号',
data() {
return {
form: {
phone: '',
}
}
},
computed: {
...mapState(['user']),
},
onShow() {
document.title = '绑定手机号'
},
methods: {
submit() {
if(!/^[0-9]+$/.test(this.form.registerCount)){
return this.$u.toast(`居民登记请输入正整数`)
}
this.$http.post(`/app/appwxuserfamiliarityrate/wxcpAdd`, this.form).then(res=> {
if(res.code == 0) {
uni.$emit('update')
this.$u.toast(`居民数据更新成功`)
setTimeout(() => {
uni.navigateBack()
}, 600);
}
})
}
},
}
</script>
<style lang="scss" scoped>
.BindPhone {
min-height: 100%;
background-color: #F5F5F5;
padding-top: 32px;
.item{
width: calc(100% - 32px);
padding: 40px 32px 40px 16px;
background: #FFFFFF;
display: flex;
justify-content: space-between;
font-size: 30px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #666;
line-height: 48px;
box-sizing: border-box;
margin: 0 0 24px 16px;
border-radius: 32px;
.color-999{
color: #999;
}
.value{
color: #333;
.u-icon{
margin-left: 16px;
}
}
.tips{
display: inline-block;
width: 16px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #FF4466;
line-height: 44px;
margin-right: 4px;
}
}
.add-btn {
position: fixed;
bottom: 0;
left: 0;
padding: 16px 32px;
width: 100%;
box-sizing: border-box;
div {
width: 100%;
height: 88px;
background: #3975C6;
border-radius: 44px;
text-align: center;
line-height: 88px;
color: #fff;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 34px;
}
}
}
</style>

View File

@@ -0,0 +1,488 @@
<template>
<div class="page">
<div class="header-content">
<div class="header-top">
<img :src="detail.url && detail.url[0].url" alt="" @click.stop="previewImage(detail.url, detail.url[0].url)" />
</div>
<div class="header-middle">
<div class="img-title">{{ detail.title }}</div>
<div class="header-middle-bottom">
<div class="left">
<div class="left-btn" :class="'status' + detail.status">{{ $dict.getLabel('villageActivityStatus', detail.status) }}</div>
</div>
<div class="right">
<img :src="detail.avatar" alt="" v-if="detail.avatar" />
<img src="./user-img.png" alt="" v-else />
<span v-if="detail.createUserName">{{ detail.createUserName }}</span>
</div>
</div>
<div class="cards">
<div class="cards-left">活动时间</div>
<div class="cards-right">{{ detail.beginTime && detail.beginTime.substring(0, detail.beginTime.length - 3) }}</div>
</div>
<div class="cards">
<div class="cards-left">活动人数</div>
<div class="cards-right" @click="toSignUser()">
<span style="color: #1c6bdf">{{ detail.realNum }}</span>
</div>
</div>
<div class="cards">
<div class="cards-left">活动地点</div>
<div class="cards-right" style="width: 75%; text-align: right">{{ detail.areaName }}{{ detail.address }}</div>
</div>
</div>
<div class="header-bottom">
<!-- v-if="detail.status == 1 || detail.status == 2 || detail.status == 3" -->
<div class="tab-title">
<span :class="current == 0 ? 'active' : ''" @click="change(0)">活动详情</span>
<span :class="current == 1 ? 'active' : ''" @click="change(1)">活动动态</span>
</div>
<!-- <div class="info-title" v-else>活动详情</div> -->
<div class="content-details" v-if="current == 0">
<div v-html="detail.content"></div>
</div>
<div class="content-trends" v-if="current == 1">
<div class="details" v-if="activeList.length > 0">
<div class="card" v-for="(item, index) in activeList" :key="index">
<div class="card-nav">
<div class="avatar">
<img :src="item.avatar" alt="" style="width: 100%; height: 100%" v-if="item.avatar" />
<span v-else>
<span v-if="item.name">{{ item.name.substring(item.name.length, item.name.length - 2) }}</span>
</span>
</div>
<div class="right">
<span class="name">{{ item.name }}</span>
<span class="time">{{ item.createTime }}</span>
</div>
</div>
<div class="card-font">
{{ item.content }}
</div>
<div class="card-img">
<img :src="e.url" v-for="(e, i) in imgList[index]" :key="i" alt="" @click.stop="previewImage(imgList[index], e.url)" />
</div>
<!-- <div class="card-icon">
<div>
<i class="iconfont">&#xe69d;</i>
<span>{{ item.viewNum ? item.viewNum : 0 }}</span>
</div>
<div>
<i class="iconfont">&#xe6a2;</i>
<span>{{ item.replyNum ? item.replyNum : 0 }}</span>
</div>
<div>
<i class="iconfont">&#xe698;</i>
<span>{{ item.supportNum ? item.supportNum : 0 }}</span>
</div>
</div> -->
</div>
<!-- <div class="card-bottom"></div> -->
</div>
<AiEmpty v-else />
</div>
</div>
<div class="fixedBtns" v-if="this.current == 0 && detail.status == 0 && this.createUserId == this.user.id" @click="toAdd">编辑活动</div>
</div>
<AiFixedBtn v-if="detail.status != 0 && this.createUserId == this.user.id && this.timeNow * 1 - this.timeEnd * 1 < 24 * 60 * 60 * 1000">
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="AddPosts()" />
</AiFixedBtn>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Detail',
computed: {
...mapState(['user']),
},
data() {
return {
id: '',
createUserId: '',
detail: {},
activeList: [],
imgList: [],
list: [
{
name: '活动详情',
},
{
name: '活动动态',
},
],
current: 0,
timeEndTime: '',
timeEnd: '',
timeNow: '',
}
},
onLoad(option) {
this.id = option.id
this.createUserId = option.createUserId
this.$dict.load(['villageActivityStatus']).then(() => {
this.getDetail()
})
},
onShow() {
document.title = '活动详情'
uni.$on('refresh', () => {
this.getListInit()
})
uni.$on('updateGetDetail', () => {
this.getDetail()
})
},
methods: {
getDetail() {
this.$http.post(`/app/appvillageactivityinfo/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
this.detail = res.data
console.log('结束时间', this.detail.endTime)
this.timeEnd = new Date(this.detail.endTime).getTime()
console.log('过去时间戳', this.timeEnd)
this.timeNow = new Date().getTime()
console.log('当前时间戳', this.timeNow)
console.log('过去时间戳加上24小时', this.timeEnd * 1 + 24 * 60 * 60 * 1000)
if (this.timeNow * 1 - this.timeEnd * 1 < 24 * 60 * 60 * 1000) {
console.log('可以添加')
}
if (this.detail) {
if (this.detail.url) {
this.detail.url = JSON.parse(res.data.url || '[]')
}
}
}
})
},
getListInit() {
this.current = 1
this.getActiveList()
},
getActiveList() {
this.$http.post(`/app/appvillageactivitypost/list?activityId=${this.id}`).then((res) => {
if (res?.data) {
this.activeList = res.data.records
if (this.activeList) {
let imagesList = []
this.activeList.map((item) => {
if (item.images) {
item.images = JSON.parse(item.images || '[]')
imagesList.push(item.images)
}
return item
})
this.imgList = imagesList
}
}
})
},
change(index) {
this.current = index
if (this.current == 1) {
this.getActiveList()
}
},
toAdd() {
uni.navigateTo({ url: `./Add?id=${this.id}&index=11` })
},
AddPosts() {
uni.navigateTo({ url: `./AddPosts?id=${this.id}` })
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
}
</script>
<style scoped lang="scss">
.page {
width: 100%;
height: 100%;
background-color: #fff;
.info-title {
padding-left: 32px;
line-height: 108px;
font-size: 32px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
}
.tab-title {
line-height: 108px;
font-size: 32px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333;
span {
display: inline-block;
width: 192px;
text-align: center;
}
.active {
color: #3671ee;
border-bottom: 4px solid #3671ee;
}
}
.status0 {
background: #000;
}
.status1 {
background: #42d784;
}
.status2 {
background: #e4e4e4;
}
.status3 {
background: #1aaaff;
}
.status4,
.status5 {
background: #e4e4e4;
}
.header-content {
// padding-bottom: 80px;
.header-top {
width: 100%;
height: 440px;
img {
width: 100%;
height: 100%;
}
}
.header-middle {
padding: 32px 32px 0 32px;
.img-title {
font-size: 36px;
font-weight: 600;
}
.header-middle-bottom {
display: flex;
justify-content: space-between;
margin-top: 32px;
.left {
.left-btn {
padding: 4px 8px;
border-radius: 8px;
font-size: 26px;
color: #ffffff;
text-align: center;
}
}
.right {
img {
width: 40px;
height: 40px;
border-radius: 50%;
vertical-align: text-top;
margin-right: 8px;
}
}
}
.cards {
display: flex;
justify-content: space-between;
border-bottom: 2px solid #eee;
padding: 36px 0;
line-height: 40px;
font-size: 28px;
.cards-left {
color: #999;
}
.cards-right {
color: #333;
}
}
}
.header-bottom {
// background: #fff;
.content-details {
padding: 32px 32px 130px 32px;
.font {
margin-top: 32px;
font-size: 30px;
line-height: 1.5;
}
.font-img {
margin-top: 26px;
width: 100%;
height: 480px;
}
}
.content-trends {
// padding-bottom: 40px;
background: #f3f6f9;
.details {
.card {
background: #fff;
padding: 26px 32px 28px 32px;
margin-bottom: 20px;
.card-nav {
display: flex;
.avatar {
width: 64px;
height: 64px;
line-height: 60px;
background: #4e8eee;
border-radius: 50%;
text-align: center;
font-size: 24px;
font-weight: 500;
color: #ffffff;
margin-right: 16px;
}
.right {
// display: inline;
display: flex;
flex-direction: column;
.name {
font-size: 26px;
font-weight: 500;
}
.time {
font-size: 22px;
color: #999999;
}
}
}
.card-font {
margin-top: 36px;
line-height: 1.6;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.card-img {
margin-top: 16px;
img {
width: 224px;
height: 224px;
margin-right: 8px;
}
img:nth-child(3n + 0) {
margin-right: 0;
}
}
.card-icon {
display: flex;
justify-content: space-between;
margin-top: 28px;
div {
display: flex;
align-items: center;
span {
font-size: 24px;
}
}
}
}
}
::v-deep .emptyWrap {
// background-color: pink;
padding-bottom: 50px;
}
.noDeatil {
background-color: #f3f6f9;
img {
width: 400px;
height: 240px;
transform: translate(50%, 25%);
padding-bottom: 156px;
}
}
.card-bottom {
height: 20px;
background-color: #f3f6f9;
}
}
}
.fixedBtns {
position: fixed;
bottom: 0;
width: 100%;
height: 112px;
line-height: 112px;
background: #1365dd;
text-align: center;
font-size: 32px;
font-weight: 500;
color: #ffffff;
}
}
.AiFixedBtn {
.movableArea {
.addBtn {
display: flex;
justify-content: center;
align-items: center;
width: 96px;
height: 96px;
flex-shrink: 0;
background: #fff;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
font-size: 48px;
color: #1365dd;
border-radius: 50%;
}
}
}
}
</style>