Browse Source

点赞转发

dev
mk 1 year ago
parent
commit
ed61b50422
  1. 8
      src/api/activity.js
  2. 8
      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. 4
      src/plugins/vant.js
  8. 47
      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
})
}

8
src/api/home.js

@ -65,4 +65,12 @@ export function popularSearch(data) {
method: 'post', method: 'post',
data 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>

4
src/plugins/vant.js

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

47
src/views/activity/detail.vue

@ -25,26 +25,37 @@
<van-field v-model="signUp[index].mobile" required label="联系电话" 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" /> type="textarea" />
</van-cell-group>
<div class="flex flex-center1 m-top12"> <div class="flex flex-center1 m-top12">
<div class="flex flex-center2 flex-center1 flex1" @click="handelAddResi"> <img <div class="flex flex-center2 flex-center1 flex1" @click="handelAddResi"
src="@/assets/images/icons/add.png" alt="" class="img_20 m-right7">添加</div> v-if="index + 1 === signUp.length"> <img src="@/assets/images/icons/add.png" alt=""
<div class="flex flex-center2 flex-center1 flex1" v-show="signUp.length > 1" @click="handelDelResi"> <img class="img_20 m-right7">添加</div>
src="@/assets/images/icons/del.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> </div>
</van-cell-group>
</div> </div>
<div class="bot_btn flex flex-center2" style="height: 50px;"> <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">报名人数<span class="orange font-size18">{{
<div class="flex1 flex flex-center1 flex-center2"> <van-button size="small" class="m-right7" round> 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> <template #icon>
<img src="@/assets/images/icons/share.png" alt="" class="img_20"> <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> </div>
<Share :show="showShare" @closeShare="showShare = false" />
</div> </div>
</template> </template>
<script> <script>
import {addActivityRecord,detail} from "@/api/activity" import { addActivityRecord, detail, communityActivityApplicationRecordDelete } from "@/api/activity"
import Share from "@/components/Share"
export default { export default {
data() { data() {
return { return {
@ -53,7 +64,8 @@ export default {
{ name: "", mobile: "", remark: "" }, { name: "", mobile: "", remark: "" },
], ],
info: {}, info: {},
isPast:false isPast: false,
showShare: false
}; };
}, },
created() { created() {
@ -65,6 +77,7 @@ export default {
} }
}, },
methods: { methods: {
checkIfPast() { checkIfPast() {
const currentTimestamp = Date.now(); const currentTimestamp = Date.now();
const specifiedTimestamp = new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime(); const specifiedTimestamp = new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime();
@ -74,6 +87,9 @@ export default {
let res = await detail(id) let res = await detail(id)
if (res) { if (res) {
this.info = res; this.info = res;
if (res.recordList) {
this.signUp = res.recordList;
}
if (res.cutOffTime) { if (res.cutOffTime) {
this.checkIfPast() this.checkIfPast()
} }
@ -82,8 +98,9 @@ export default {
handelAddResi() { handelAddResi() {
this.signUp.push({ name: "", mobile: "", remark: "", }) this.signUp.push({ name: "", mobile: "", remark: "", })
}, },
handelDelResi() { async handelDelResi(item) {
this.signUp.pop() let res = await communityActivityApplicationRecordDelete([item.id])
this.detail(this.$route.query.id)
}, },
async save() { async save() {
this.signUp.forEach((item) => { this.signUp.forEach((item) => {
@ -98,10 +115,11 @@ export default {
if (res) { if (res) {
this.$toast.success(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: {}, computed: {},
watch: {}, watch: {},
} }
@ -111,12 +129,15 @@ export default {
:deep(.p0>.van-cell) { :deep(.p0>.van-cell) {
padding: 0; padding: 0;
} }
:deep(.van-cell) { :deep(.van-cell) {
padding: 16px 8px; padding: 16px 8px;
} }
:deep(.van-cell__title) { :deep(.van-cell__title) {
color: #666666; color: #666666;
display: flex; display: flex;
&>span { &>span {
flex: 1; flex: 1;
} }

11
src/views/activity/index.vue

@ -14,7 +14,7 @@
class="font-size14">{{ item.participants }}</span> class="font-size14">{{ item.participants }}</span>
</div> </div>
<van-button type="info" size="small" round @click="handelClickJump('activityDetail',item)" <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> </div>
</div> </div>
@ -79,7 +79,14 @@ export default {
} }
}, },
components: {registerDialog}, 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: {}, watch: {},
} }
</script> </script>

26
src/views/communityPublicity/detail.vue

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

24
src/views/home/index.vue

@ -68,7 +68,7 @@
class="font-size14">{{ item.participants }}</span> class="font-size14">{{ item.participants }}</span>
</div> </div>
<van-button type="info" size="small" round @click="handelClickJump(`activityDetail`,item)" <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> </div>
</div> </div>
@ -114,7 +114,7 @@
<div class="flex flex-end flex-center gray m-top10 font-size13"> <div class="flex flex-end flex-center gray m-top10 font-size13">
<div class="flex"> <div class="flex">
<div class="flex flex-center m-right26" v-if="item.tagId && tagList">{{filterTagId(item.tagId)}}</div> <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> alt="" class="img_16 m-right7"><span>{{ item.likes }}</span>
</div> </div>
</div> </div>
@ -136,7 +136,7 @@
<script> <script>
import registerDialog from '@/components/registerDialog'; 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'; import { querystaffmessage } from '@/api/message';
export default { export default {
@ -227,6 +227,15 @@ export default {
this.icEventOldDiscuss() this.icEventOldDiscuss()
}, },
async communityPublicityGiveLike(id){
let parm = {
id,
likes:1,
transpond:0
}
let res = await communityPublicityGiveLike(parm)
this.communityPublicity()
},
async handelClicsupport1(id){ async handelClicsupport1(id){
let parm = { let parm = {
eventId:id, eventId:id,
@ -331,7 +340,14 @@ export default {
}, },
components: { registerDialog }, 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: {}, watch: {},
} }
</script> </script>

Loading…
Cancel
Save