This commit is contained in:
yanran200730
2022-11-02 14:44:45 +08:00
parent 98277aa8b9
commit a1ddb7ab60
6 changed files with 83 additions and 35 deletions

View File

@@ -79,21 +79,21 @@
size: 10
}
}).then(res => {
if (res.code === 200) {
if (res.code === 0) {
this.$hideLoading()
if (this.page > 1) {
this.list = [...this.list, ...res.data]
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data
this.list = res.data.records
}
if (res.data.length < 10) {
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.page = this.page + 1
this.current = this.current + 1
} else {
this.isMore = true
}

View File

@@ -18,24 +18,25 @@
<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">
<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>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
<div class="btn-wrapper">
<div class="btn" @click="upload" hover-class="text-hover">拍照上传</div>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'PhotoReport',
appName: '随手拍',
@@ -47,11 +48,19 @@
statusBarHeight: 20,
list: [],
hideStatus: false,
pageShow: false
pageShow: false,
current: 1,
isMore: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad () {
this.$loading()
this.getList()
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
@@ -73,11 +82,19 @@
})
},
mapStatus (status) {
return {
'0': '待审核',
'1': '审核通过',
'2': '审核拒绝'
}[status]
},
upload () {
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: this.limit,
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
@@ -103,7 +120,7 @@
uploadFile (img, total) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add',
url: this.$instance.defaults.baseURL + '/api/file/add',
filePath: img,
name: 'file',
header: {
@@ -122,16 +139,22 @@
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
this.$instance.post(`/appwechatescalation/addOrUpdate`, {
type: 0,
listType: 0,
openId: this.user.openId,
accessUrl: this.imgList[0]
}).then(res => {
if (res.code == 0) {
this.getList(this.type)
this.getTotalInfo(this.type)
uni.$emit('update')
this.$dialog.alert({
title: '温馨提示',
content: '上传成功!请等待后台人员审核'
}).then(() => {
}).catch(() => {
})
this.isMore = false
this.current = 1
this.getList()
}
this.$hideLoading()
this.hideStatus = false
@@ -142,21 +165,34 @@
})
},
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]
}
})
getList () {
if (this.isMore) return
this.$nextTick(() => {
this.pageShow = true
})
this.$instance.post(`/appwechatescalation/list`, null, {
params: {
current: this.current,
size: 10
}
}).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()
})
}
@@ -164,6 +200,10 @@
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
},
onReachBottom () {
this.getList()
}
}
</script>
@@ -303,6 +343,14 @@
color: #FF883C;
background: rgba($color: #000000, $alpha: 0.8);
border-radius: 8px;
&.status-1 {
color: #3BBC37;
}
&.status-2 {
color: red;
}
}
.bottom {

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB