Browse Source

点赞转发

dev
mk 1 year ago
parent
commit
ed61b50422
  1. 8
      src/api/activity.js
  2. 10
      src/api/home.js
  3. BIN
      src/assets/images/share/ai.gif
  4. BIN
      src/assets/images/share/shadow.png
  5. BIN
      src/assets/images/share/tip.png
  6. 53
      src/components/Share/index.vue
  7. 6
      src/plugins/vant.js
  8. 95
      src/views/activity/detail.vue
  9. 11
      src/views/activity/index.vue
  10. 26
      src/views/communityPublicity/detail.vue
  11. 24
      src/views/home/index.vue

8
src/api/activity.js

@ -16,3 +16,11 @@ export function detail(id) {
})
}
export function communityActivityApplicationRecordDelete(data) {
return request({
url: `/actual/base/communityActivityApplicationRecord/delete`,
method: 'post',
data
})
}

10
src/api/home.js

@ -65,4 +65,12 @@ export function popularSearch(data) {
method: 'post',
data
})
}
}
//社区讯息点赞
export function communityPublicityGiveLike(data) {
return request({
url: `/actual/base/communityPublicity/giveLike`,
method: 'post',
data
})
}

BIN
src/assets/images/share/ai.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

BIN
src/assets/images/share/shadow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/assets/images/share/tip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

53
src/components/Share/index.vue

@ -0,0 +1,53 @@
<template>
<div class="">
<van-overlay :show="show" />
<img src="@/assets/images/share/tip.png" alt="" class="tip" v-if="show" @click="$emit('closeShare')">
<img src="@/assets/images/share/ai.gif" alt="" class="ai" v-if="show" >
<img src="@/assets/images/share/shadow.png" alt="" class="shadow">
</div>
</template>
<script>
export default {
name: 'SvgIcon',
props: {
show: {
type: Boolean,
required: false
},
},
computed: {
}
}
</script>
<style scoped>
.tip {
position: absolute;
top: 30px;
left: 90px;
z-index: 2;
width: 270px;
height: 206px;
}
.ai {
position: absolute;
top: 50px;
left: 70px;
z-index: 2;
width: 106px;
height: 92px;
}
.shadow {
position: absolute;
top: 125px;
left: 95px;
z-index: 2;
width: 60px;
height: 25px;
}
</style>

6
src/plugins/vant.js

@ -27,7 +27,8 @@ import {
Swipe,
SwipeItem,
NoticeBar,
CellGroup
CellGroup,
Overlay
} from 'vant'
Vue.use(Button)
@ -56,4 +57,5 @@ Vue.use(Button)
.use(Swipe)
.use(SwipeItem)
.use(NoticeBar)
.use(CellGroup)
.use(CellGroup)
.use(Overlay)

95
src/views/activity/detail.vue

@ -1,19 +1,19 @@
<template>
<div class='container m-bot50'>
<div class="card">
<img :src="info.coverPic" alt="" style="width: 100%;">
<img :src="info.coverPic" alt="" style="width: 100%;">
<div class="m-top15 p0">
<h2 style="margin: 0; font-size: 21px;">{{ info.activityName }}</h2>
<van-cell class="m-top15" :border="false" :title-style="{ 'max-width': '80px' }" title="活动时间:"
:value="`${info.startTime} 至 ${info.endTime}`"></van-cell>
<van-cell :border="false" :title-style="{ 'max-width': '115px' }" title="报名开始时间:"
:value=" info.startTime "></van-cell>
:value="info.startTime"></van-cell>
<van-cell :border="false" :title-style="{ 'max-width': '115px' }" title="报名截止时间:"
:value="info.cutOffTime || '--'"></van-cell>
<van-cell :border="false" :title-style="{ 'max-width': '80px' }" title="活动地点:"
:value="info.address"></van-cell>
<van-cell :border="false" :title-style="{ 'max-width': '65px' }" title="举办方:"
:value="info.assistingParty"></van-cell>
:value="info.assistingParty"></van-cell>
<van-divider />
<div v-html="info.content"></div>
</div>
@ -23,85 +23,103 @@
<van-cell-group v-for="(item, index) in signUp" :border="false">
<van-field v-model="signUp[index].name" required :label="`姓名${index + 1}`" placeholder="请输入用户名" />
<van-field v-model="signUp[index].mobile" required label="联系电话" placeholder="请输入您的电话号码" />
<van-field v-model="signUp[index].remark" label="备注" placeholder="请输入" rows="3" autosize
<van-field v-model="signUp[index].remark" label="备注" placeholder="请输入" rows="3" autosize
type="textarea" />
<div class="flex flex-center1 m-top12">
<div class="flex flex-center2 flex-center1 flex1" @click="handelAddResi"
v-if="index + 1 === signUp.length"> <img src="@/assets/images/icons/add.png" alt=""
class="img_20 m-right7">添加</div>
<div class="flex flex-center2 flex-center1 flex1" v-show="signUp.length > 1"
@click="handelDelResi(item)">
<img src="@/assets/images/icons/del.png" alt="" class="img_20 m-right7">删除
</div>
</div>
</van-cell-group>
<div class="flex flex-center1 m-top12">
<div class="flex flex-center2 flex-center1 flex1" @click="handelAddResi"> <img
src="@/assets/images/icons/add.png" alt="" class="img_20 m-right7">添加</div>
<div class="flex flex-center2 flex-center1 flex1" v-show="signUp.length > 1" @click="handelDelResi"> <img
src="@/assets/images/icons/del.png" alt="" class="img_20 m-right7">删除</div>
</div>
</div>
<div class="bot_btn flex flex-center2" style="height: 50px;">
<div class="flex1 flex flex-center1 flex-center2">报名人数<span class="orange font-size18">{{info.currentParticipants || 0}}</span> / {{info.participants}}</div>
<div class="flex1 flex flex-center1 flex-center2"> <van-button size="small" class="m-right7" round>
<div class="flex1 flex flex-center1 flex-center2">报名人数<span class="orange font-size18">{{
info.currentParticipants || 0 }}</span> / {{ info.participants }}</div>
<div class="flex1 flex flex-center1 flex-center2">
<van-button size="small" class="m-right7" round @click="showShare = true">
<template #icon>
<img src="@/assets/images/icons/share.png" alt="" class="img_20">
</template> 转发</van-button> <van-button type="info" size="small" round @click="save" v-if="info.online === 1" :disabled="new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime()<Date.now() || this.info.currentParticipants >= this.info.participants">立即报名</van-button></div>
</template> 转发</van-button>
<van-button type="info" size="small" round @click="save" v-if="info.online === 1"
:disabled="new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime() < Date.now() || this.info.currentParticipants >= this.info.participants">立即报名</van-button>
</div>
</div>
<Share :show="showShare" @closeShare="showShare = false" />
</div>
</template>
<script>
import {addActivityRecord,detail} from "@/api/activity"
import { addActivityRecord, detail, communityActivityApplicationRecordDelete } from "@/api/activity"
import Share from "@/components/Share"
export default {
data() {
return {
activityList:[],
activityList: [],
signUp: [
{ name: "", mobile: "", remark: "" },
],
info:{},
isPast:false
info: {},
isPast: false,
showShare: false
};
},
created() {
},
mounted(){
if(this.$route.query.id){
this.detail( this.$route.query.id)
mounted() {
if (this.$route.query.id) {
this.detail(this.$route.query.id)
}
},
methods: {
checkIfPast() {
const currentTimestamp = Date.now();
const specifiedTimestamp = new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime();
this.isPast = specifiedTimestamp < currentTimestamp;
const currentTimestamp = Date.now();
const specifiedTimestamp = new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime();
this.isPast = specifiedTimestamp < currentTimestamp;
},
async detail(id){
async detail(id) {
let res = await detail(id)
if(res){
if (res) {
this.info = res;
if(res.cutOffTime){
this.checkIfPast()
if (res.recordList) {
this.signUp = res.recordList;
}
if (res.cutOffTime) {
this.checkIfPast()
}
}
},
handelAddResi() {
this.signUp.push({ name: "", mobile: "", remark: "",})
this.signUp.push({ name: "", mobile: "", remark: "", })
},
handelDelResi() {
this.signUp.pop()
async handelDelResi(item) {
let res = await communityActivityApplicationRecordDelete([item.id])
this.detail(this.$route.query.id)
},
async save(){
this.signUp.forEach((item)=>{
async save() {
this.signUp.forEach((item) => {
item.activityId = this.info.id;
item.applicationId = this.$store.state.app.userInfo.id;
item.customerId = this.$store.state.app.userInfo.customerId;
})
let parm = {
formDTOList:this.signUp
formDTOList: this.signUp
}
let res = await addActivityRecord(parm)
if(res){
if (res) {
this.$toast.success(res)
this.signUp= [{ name: "", mobile: "", remark: "" }]
this.signUp = [{ name: "", mobile: "", remark: "" }]
this.detail(this.$route.query.id)
}
},
},
components: {},
components: { Share },
computed: {},
watch: {},
}
@ -111,12 +129,15 @@ export default {
:deep(.p0>.van-cell) {
padding: 0;
}
:deep(.van-cell) {
padding: 16px 8px;
}
:deep(.van-cell__title) {
color: #666666;
display: flex;
&>span {
flex: 1;
}

11
src/views/activity/index.vue

@ -14,7 +14,7 @@
class="font-size14">{{ item.participants }}</span>
</div>
<van-button type="info" size="small" round @click="handelClickJump('activityDetail',item)"
:disabled="new Date(item.cutOffTime.replace(/-/g, '/')).getTime()<Date.now() || item.currentParticipants >= item.participants">报名</van-button>
:disabled="new Date(item.cutOffTime.replace(/-/g, '/')).getTime()<Date.now() || item.currentParticipants >= item.participants">{{recordFlag(item)?'已报名':'报名'}}</van-button>
</div>
</div>
</div>
@ -79,7 +79,14 @@ export default {
}
},
components: {registerDialog},
computed: {},
computed: {
recordFlag(){
return (item)=>{
if(!item.recordList) return false
return item.recordList.findIndex(itemC=>itemC.mobile === this.$store.state.app.userInfo.mobile) != -1
}
},
},
watch: {},
}
</script>

26
src/views/communityPublicity/detail.vue

@ -14,27 +14,31 @@
</div>
<div class="bot_btn flex flex-center2" style="height: 50px;">
<div class="flex1 flex flex-center1 flex-center2">
<van-button size="small" class="m-right7" round>
<van-button size="small" class="m-right7" round @click="communityPublicityGiveLike(info.id,'likes')">
<template #icon>
<img src="@/assets/images/icons/link.png" alt="" class="img_20">
</template> 点赞{{ info.likes }}1200 </van-button>
</template> 点赞{{ info.likes }} </van-button>
</div>
<div class="flex1 flex flex-center1 flex-center2">
<van-button size="small" class="m-right7" round @click="share">
<van-button size="small" class="m-right7" round @click="communityPublicityGiveLike(info.id,'transpond')">
<template #icon>
<img src="@/assets/images/icons/share.png" alt="" class="img_20">
</template> 转发 {{ info.likes }}420 </van-button>
</template> 转发 {{ info.transpond }} </van-button>
</div>
</div>
<Share :show="showShare" @closeShare="showShare = false" />
</div>
</template>
<script>
import { setConfig } from '@/utils/jweixin'
import {communityPublicityGiveLike } from '@/api/home';
import Share from "@/components/Share"
export default {
data() {
return {
info: {},
showShare:false,
};
},
created() {
@ -47,6 +51,18 @@ export default {
this.share()
},
methods: {
async communityPublicityGiveLike(id,type){
let parm = {
id,
likes:type === 'likes'?1:0,
transpond:type === 'transpond'?1:0
}
let res = await communityPublicityGiveLike(parm)
if(res){
this.info = res;
this.showShare = type === 'transpond'
}
},
share() {
console.log('zhixingle');
let than = this
@ -76,7 +92,7 @@ export default {
}
}
},
components: {},
components: {Share},
computed: {},
watch: {},
}

24
src/views/home/index.vue

@ -68,7 +68,7 @@
class="font-size14">{{ item.participants }}</span>
</div>
<van-button type="info" size="small" round @click="handelClickJump(`activityDetail`,item)"
:disabled="new Date(item.cutOffTime.replace(/-/g, '/')).getTime()<Date.now() || item.currentParticipants >= item.participants">报名</van-button>
:disabled="new Date(item.cutOffTime.replace(/-/g, '/')).getTime()<Date.now() || item.currentParticipants >= item.participants">{{recordFlag(item)?'已报名':'报名'}}</van-button>
</div>
</div>
</div>
@ -114,7 +114,7 @@
<div class="flex flex-end flex-center gray m-top10 font-size13">
<div class="flex">
<div class="flex flex-center m-right26" v-if="item.tagId && tagList">{{filterTagId(item.tagId)}}</div>
<div class="flex flex-center"><img src="@/assets/images/icons/support.png"
<div class="flex flex-center" @click.stop="communityPublicityGiveLike(item.id)"><img src="@/assets/images/icons/support.png"
alt="" class="img_16 m-right7"><span>{{ item.likes }}</span>
</div>
</div>
@ -136,7 +136,7 @@
<script>
import registerDialog from '@/components/registerDialog';
import { communityActivity, icEventOldDiscuss, advertisingTag, communityPublicity,handelClicsupport } from '@/api/home';
import { communityActivity, icEventOldDiscuss, advertisingTag, communityPublicity,handelClicsupport,communityPublicityGiveLike } from '@/api/home';
import { querystaffmessage } from '@/api/message';
export default {
@ -227,6 +227,15 @@ export default {
this.icEventOldDiscuss()
},
async communityPublicityGiveLike(id){
let parm = {
id,
likes:1,
transpond:0
}
let res = await communityPublicityGiveLike(parm)
this.communityPublicity()
},
async handelClicsupport1(id){
let parm = {
eventId:id,
@ -331,7 +340,14 @@ export default {
},
components: { registerDialog },
computed: {},
computed: {
recordFlag(){
return (item)=>{
if(!item.recordList) return false
return item.recordList.findIndex(itemC=>itemC.mobile === this.$store.state.app.userInfo.mobile) != -1
}
},
},
watch: {},
}
</script>

Loading…
Cancel
Save