This commit is contained in:
yanran200730
2022-11-02 16:05:35 +08:00
parent a1ddb7ab60
commit 83e06be215
5 changed files with 347 additions and 174 deletions

View File

@@ -1,39 +1,37 @@
<template>
<div class="Activity">
<div class="Activity" v-if="pageShow">
<div class="section">
<h2>10.30线下公益宣传</h2>
<p>在今天4月28日下午的联防联控机制新闻发布会上有关负责人表示预计五一假期客流量较去年明显下降出游应严格做好疫情防控</p>
<h2>{{ info.title }}</h2>
<p>{{ info.detail }}</p>
</div>
<div class="section">
<h2>基础信息</h2>
<div class="info-wrapper">
<div class="info-item">
<h2>活动地点</h2>
<span class="omit">成都市金牛区xxxx大厦成都成都市金牛区xxxx大厦成都成都市金牛区xxxx大厦成都</span>
<div class="right">
<span class="omit">{{ info.address }}</span>
<div class="right" @click="toAddress">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/dh.png" />
<i>导航</i>
</div>
</div>
<div class="info-item">
<h2>进场打卡</h2>
<span>2022-10-14 09:25:25
2022-10-28 12:00:00</span>
<span>{{ info.intoBegintime }} {{ info.intoEndtime }}</span>
</div>
<div class="info-item">
<h2>离场打卡</h2>
<span>2022-10-14 09:25:25
2022-10-28 12:00:00</span>
<span>{{ info.exitBegintime }} {{ info.exitEndtime }}</span>
</div>
</div>
</div>
<div class="signin">
<div class="top" @click="getLocation">
<div class="top" @click="toSign" :class="[isClock ? '' : 'disable']">
<h2>打卡签到</h2>
<span>积分+5</span>
<span v-if="isClock">积分+{{ intoIntegral }}</span>
</div>
<p>符合打卡条件</p>
<i>未到打卡时间/不在指定位置</i>
<p v-if="isClock">符合打卡条件</p>
<i v-else>未到打卡时间/不在指定位置</i>
</div>
</div>
</template>
@@ -46,18 +44,145 @@
data () {
return {
qqmapsdk: null
id: '',
info: {},
qqmapsdk: null,
pageShow: false,
latitude: '',
longitude: '',
address: '',
distance: 100000
}
},
onLoad () {
// this.getLocation()
computed: {
isClock () {
if (!this.info.id) {
return false
}
const times = new Date().getTime()
const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime()
const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime()
const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime()
const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime()
if (this.info.clockRange > this.distance && (!this.info.intoClock && (times > inSTimes && times < inETimes)) || this.info.exitClock && (times > outSTimes && times < outETimes)) {
return true
}
return false
},
intoIntegral () {
if (!this.info.id) {
return 0
}
const times = new Date().getTime()
const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime()
const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime()
const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime()
const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime()
if (!this.info.intoClock && (times > inSTimes && times < inETimes)) {
return this.info.intoIntegral
}
if (!this.info.exitClock && (times > outSTimes && times < outETimes)) {
return this.info.exitIntegral
}
return 0
}
},
onShow () {
this.getInfo()
},
onLoad (query) {
this.id = query.id
this.qqmapsdk = new QQMapWX({
key: '3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY'
})
this.$loading()
},
methods: {
getInfo () {
this.$instance.post(`/appactivityinfo/queryDetailById?id=${this.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.$nextTick(() => {
this.getLocation()
this.pageShow = true
})
}
})
},
toSign () {
if (!this.latitude) {
this.$dialog.alert({
title: '温馨提示',
content: '您未授权定位,请先授权!'
}).then(() => {
this.getLocation()
}).catch(() => {
})
return false
}
if (!this.isClock) {
this.$dialog.alert({
title: '温馨提示',
content: '不满足打卡条件!'
}).then(() => {
this.getLocation()
}).catch(() => {
})
return false
}
this.$loading()
let type = 0
const times = new Date().getTime()
const inSTimes = new Date(this.info.intoBegintime.replaceAll('-', '/')).getTime()
const inETimes = new Date(this.info.intoEndtime.replaceAll('-', '/')).getTime()
const outSTimes = new Date(this.info.exitBegintime.replaceAll('-', '/')).getTime()
const outETimes = new Date(this.info.exitEndtime.replaceAll('-', '/')).getTime()
if (!this.info.intoClock && (times > inSTimes && times < inETimes)) {
type = 0
}
if (!this.info.exitClock && (times > outSTimes && times < outETimes)) {
type = 1
}
this.$instance.post(`/appactivityinfo/clock`, {
address: this.address,
activityId: this.id,
clockTime: this.$dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
lat: this.latitude,
lng: this.longitude,
type
}).then(res => {
if (res.code === 0) {
this.$toast('打卡成功')
this.getInfo()
}
this.$hideLoading()
}).catch(() => {
this.$hideLoading()
})
},
getLocation () {
wx.authorize({
scope: 'scope.userLocation',
@@ -65,14 +190,13 @@
uni.getLocation({
type: 'wgs84',
success: res => {
console.log('当前位置的经度:' + res.longitude)
console.log('当前位置的纬度:' + res.latitude)
this.latitude = res.latitude
this.longitude = res.longitude
this.qqmapsdk.reverseGeocoder({
location: `${res.latitude},${res.longitude}`,
success: data => {
console.log(data)
this.address = data.result.formatted_addresses.recommend
},
fail: function(info){
console.log(info)
@@ -85,11 +209,11 @@
latitude: res.latitude
},
to: [{
longitude: 114.342093,
latitude: 30.499959
longitude: this.info.lng,
latitude: this.info.lat
}],
success: res => {
console.log(res.result.elements[0].distance)
this.distance = res.result.elements[0].distance
},
fail: function(error) {
console.error(error)
@@ -121,6 +245,14 @@
}
})
},
toAddress () {
wx.openLocation({
latitude: this.info.lat,
longitude: this.info.lng,
scale: 18
})
}
}
}
</script>
@@ -232,13 +364,22 @@
box-shadow: 0 8px 12px -4px rgba(133,196,255,0.65);
border-radius: 50%;
&.disable {
border-color: #D5DCEA;
background-image: none;
h2 {
color: #ADB9D1;
}
}
h2 {
margin-bottom: 20px;
color: #fff;
font-size: 40px;
}
span {
margin-top: 20px;
color: rgba(255, 255, 255, 0.8);
font-size: 28px;
}

View File

@@ -13,19 +13,19 @@
<div class="activity-wrapper">
<h2>线下活动</h2>
<div class="activity-list">
<div class="activity-item" @click="$linkTo('./Activity')" hover-class="bg-hover" v-for="(item, index) in list" :key="index">
<div class="activity-item" @click="$linkTo('./Activity?id=' + item.id)" hover-class="bg-hover" v-for="(item, index) in list" :key="index">
<div class="top">
<h2>10月31日线下公益宣传</h2>
<p>百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北百年征程波澜壮阔百年初心历久弥坚7月1日上午庆祝中国共产党成立100周年大会在北</p>
<h2>{{ item.title }}</h2>
<p>{{ item.detail }}</p>
</div>
<div class="bottom">
<div class="item">
<h3>进场时间</h3>
<span>2022-10-14 09:25:25 2022-10-28 12:00:00</span>
<span>{{ item.intoBegintime }} {{ item.intoEndtime }}</span>
</div>
<div class="item">
<h3>进场时间</h3>
<span>2022-10-14 09:25:25 2022-10-28 12:00:00</span>
<span>{{ item.exitBegintime }} {{ item.exitEndtime }}</span>
</div>
</div>
</div>

View File

@@ -18,161 +18,188 @@
<div class="phone-wrapper">
<h2>我上传的</h2>
<div class="list">
<div class="item" v-for="(item, index) in 10" :key="index">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/photo-bg.png" />
<span>待审核</span>
<div class="item" v-for="(item, index) in list" :key="index" @click="preview(item.accessUrl)">
<image :src="item.accessUrl" mode="aspectFill" />
<span :class="'status-' + item.status">{{ mapStatus(item.status) }}</span>
<div class="bottom">
<i>10-15 19:25</i>
<span>积分+5</span>
<i>{{ $dayjs(item.createTime).format('MM-DD HH:mm') }}</i>
<span v-if="item.integral > 0">积分+{{ item.integral }}</span>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
<div class="btn-wrapper">
<div class="btn" @click="upload" hover-class="text-hover">上传朋友圈截图</div>
<div class="btn" @click="upload" hover-class="text-hover">上传群聊截图</div>
<div class="btn" @click="upload(1)" hover-class="text-hover">上传朋友圈截图</div>
<div class="btn" @click="upload(2)" hover-class="text-hover">上传群聊截图</div>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
export default {
name: 'Culture',
appName: '文明倡导',
customNavigation: true,
import { mapState } from 'vuex'
export default {
name: 'PhotoReport',
appName: '随手拍',
customNavigation: true,
data () {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
hideStatus: false,
pageShow: false
}
},
onLoad () {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
preview (url) {
let imgs = []
this.list.forEach(item => {
imgs = [...imgs, ...item.list.map(v => v.url)]
})
uni.previewImage({
urls: imgs,
current: url
})
},
upload () {
if (!this.token) {
this.$refs.login.show()
return false
}
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: this.limit,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
return false
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length)
})
})
},
})
},
uploadFile (img, total) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
if (data.code === 0) {
this.imgList.push(data.data[0].split(';')[0])
} else {
this.$toast(data.msg)
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, {
areaName: uni.getStorageSync('areaName'),
areaId: uni.getStorageSync('areaId'),
type: this.type,
urlList: this.imgList
}).then(res => {
if (res.code == 0) {
this.getList(this.type)
this.getTotalInfo(this.type)
uni.$emit('update')
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getList (type) {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbum?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0) {
this.list = Object.keys(res.data).map(v => {
return {
name: v,
list: res.data[v]
}
})
this.$nextTick(() => {
this.pageShow = true
})
}
this.$hideLoading()
})
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
data () {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
hideStatus: false,
pageShow: false,
current: 1,
isMore: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad () {
this.$loading()
this.getList()
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
preview (url) {
let imgs = this.list.map(v => v.accessUrl)
uni.previewImage({
urls: imgs,
current: url
})
},
mapStatus (status) {
return {
'0': '待审核',
'1': '审核通过',
'2': '审核拒绝'
}[status]
},
upload (type) {
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
return false
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length, type)
})
})
},
})
},
uploadFile (img, total, type) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/api/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
if (data.code === 0) {
this.imgList.push(data.data[0].split(';')[0])
} else {
this.$toast(data.msg)
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/appwechatescalation/addOrUpdate`, {
type: type,
openId: this.user.openId,
accessUrl: this.imgList[0]
}).then(res => {
if (res.code == 0) {
this.$toast('上传成功!请等待后台人员审核')
this.isMore = false
this.current = 1
this.getList()
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getList () {
if (this.isMore) return
this.$instance.post(`/appwechatescalation/list`, null, {
params: {
current: this.current,
size: 10,
listType: 1
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
},
onReachBottom () {
this.getList()
}
}
</script>
<style lang="scss" socped>
@@ -322,6 +349,14 @@
color: #FF883C;
background: rgba($color: #000000, $alpha: 0.8);
border-radius: 8px;
&.status-1 {
color: #3BBC37;
}
&.status-2 {
color: red;
}
}
.bottom {

View File

@@ -18,7 +18,7 @@
<div class="phone-wrapper">
<h2>我上传的</h2>
<div class="list">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item" v-for="(item, index) in list" :key="index" @click="preview(item.accessUrl)">
<image :src="item.accessUrl" mode="aspectFill" />
<span :class="'status-' + item.status">{{ mapStatus(item.status) }}</span>
<div class="bottom">
@@ -71,10 +71,7 @@
},
preview (url) {
let imgs = []
this.list.forEach(item => {
imgs = [...imgs, ...item.list.map(v => v.url)]
})
let imgs = this.list.map(v => v.accessUrl)
uni.previewImage({
urls: imgs,
@@ -171,7 +168,8 @@
this.$instance.post(`/appwechatescalation/list`, null, {
params: {
current: this.current,
size: 10
size: 10,
listType: 0
}
}).then(res => {
if (res.code === 0) {

View File

@@ -10,7 +10,6 @@ instance.interceptors.request.use(config => {
config.url = '/api' + config.url.replace(/(app|auth|admin)\//, "")
}
console.log(config)
return config
})