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

View File

@@ -18,24 +18,25 @@
<div class="phone-wrapper"> <div class="phone-wrapper">
<h2>我上传的</h2> <h2>我上传的</h2>
<div class="list"> <div class="list">
<div class="item" v-for="(item, index) in 10" :key="index"> <div class="item" v-for="(item, index) in list" :key="index">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/photo-bg.png" /> <image :src="item.accessUrl" mode="aspectFill" />
<span>待审核</span> <span :class="'status-' + item.status">{{ mapStatus(item.status) }}</span>
<div class="bottom"> <div class="bottom">
<i>10-15 19:25</i> <i>{{ $dayjs(item.createTime).format('MM-DD HH:mm') }}</i>
<span>积分+5</span> <span v-if="item.integral > 0">积分+{{ item.integral }}</span>
</div> </div>
</div> </div>
</div> </div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div> </div>
<div class="btn-wrapper"> <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> </div>
<AiLogin ref="login"/>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'PhotoReport', name: 'PhotoReport',
appName: '随手拍', appName: '随手拍',
@@ -47,11 +48,19 @@
statusBarHeight: 20, statusBarHeight: 20,
list: [], list: [],
hideStatus: false, hideStatus: false,
pageShow: false pageShow: false,
current: 1,
isMore: false
} }
}, },
computed: {
...mapState(['user', 'token'])
},
onLoad () { onLoad () {
this.$loading()
this.getList()
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
}, },
methods: { methods: {
@@ -73,11 +82,19 @@
}) })
}, },
mapStatus (status) {
return {
'0': '待审核',
'1': '审核通过',
'2': '审核拒绝'
}[status]
},
upload () { upload () {
this.imgList = [] this.imgList = []
this.hideStatus = false this.hideStatus = false
uni.chooseImage({ uni.chooseImage({
count: this.limit, count: 1,
sizeType: ['compressed'], sizeType: ['compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
@@ -103,7 +120,7 @@
uploadFile (img, total) { uploadFile (img, total) {
uni.uploadFile({ uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add', url: this.$instance.defaults.baseURL + '/api/file/add',
filePath: img, filePath: img,
name: 'file', name: 'file',
header: { header: {
@@ -122,16 +139,22 @@
complete: () => { complete: () => {
this.$nextTick(() => { this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) { if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, { this.$instance.post(`/appwechatescalation/addOrUpdate`, {
areaName: uni.getStorageSync('areaName'), type: 0,
areaId: uni.getStorageSync('areaId'), listType: 0,
type: this.type, openId: this.user.openId,
urlList: this.imgList accessUrl: this.imgList[0]
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.getList(this.type) this.$dialog.alert({
this.getTotalInfo(this.type) title: '温馨提示',
uni.$emit('update') content: '上传成功!请等待后台人员审核'
}).then(() => {
}).catch(() => {
})
this.isMore = false
this.current = 1
this.getList()
} }
this.$hideLoading() this.$hideLoading()
this.hideStatus = false this.hideStatus = false
@@ -142,21 +165,34 @@
}) })
}, },
getList (type) { getList () {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbum?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => { if (this.isMore) return
if (res.code === 0) {
this.list = Object.keys(res.data).map(v => {
return {
name: v,
list: res.data[v]
}
})
this.$nextTick(() => { this.$instance.post(`/appwechatescalation/list`, null, {
this.pageShow = true 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() this.$hideLoading()
}) })
} }
@@ -164,6 +200,10 @@
onPageScroll (params) { onPageScroll (params) {
this.isFixed = params.scrollTop > 60 this.isFixed = params.scrollTop > 60
},
onReachBottom () {
this.getList()
} }
} }
</script> </script>
@@ -303,6 +343,14 @@
color: #FF883C; color: #FF883C;
background: rgba($color: #000000, $alpha: 0.8); background: rgba($color: #000000, $alpha: 0.8);
border-radius: 8px; border-radius: 8px;
&.status-1 {
color: #3BBC37;
}
&.status-2 {
color: red;
}
} }
.bottom { .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