提交 81133883 编写于 作者: 芊里

积分查询

上级 ec8d8dbd
...@@ -181,10 +181,17 @@ ...@@ -181,10 +181,17 @@
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
db.collection(dbCollectionName).field('score,balance').get().then((res) => { db.collection(dbCollectionName).where('user_id == $env.uid').field('score,balance').get().then((res) => {
const data = res.result.data[0]; const data = res.result.data[0];
console.log(data);
let msg = '';
if(data){
msg = '当前积分为' + data.balance
} else{
msg = '当前无积分';
}
uni.showToast({ uni.showToast({
title: '当前积分为' + data.balance, title: msg,
icon: 'none' icon: 'none'
}); });
}).catch((err) => { }).catch((err) => {
......
<template> <template>
<view class="container"> <view class="container">
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" :where="where" orderby="update_date desc" collection="opendb-news-favorite"> <unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" where="user_id == $env.uid"
<view v-if="error">{{error.message}}</view> orderby="update_date desc" collection="opendb-news-favorite" @load="isLoading == false" @error="isLoading == false">
<view v-else-if="data"> <view v-if="data && data.length">
<uni-list> <uni-list>
<uni-list-item v-for="(item, index) in data" :key="index" :clickable="true" @click="handleItemClick(item)"> <uni-list-item v-for="(item, index) in data" :key="index" :clickable="true"
<view slot="body"> @click="handleItemClick(item)">
<text>{{item.article_title || item.article_id}}</text> <view slot="body">
<uni-dateformat class="article-date" :date="item.update_date" format="yyyy-MM-dd hh:mm" <text>{{item.article_title || item.article_id}}</text>
:threshold="[0, 0]" /> <uni-dateformat class="article-date" :date="item.update_date" format="yyyy-MM-dd hh:mm"
</view> :threshold="[0, 0]" />
</uni-list-item> </view>
</uni-list> </uni-list-item>
</view> </uni-list>
<uni-load-more :status="loading?'loading':(hasMore ? 'more' : 'noMore')"></uni-load-more> </view>
</unicloud-db> <uni-nodata v-else :isLoading="isLoading" @retry="refreshData"></uni-nodata>
</view> <uni-load-more :status="loading?'loading':(hasMore ? 'more' : 'noMore')"></uni-load-more>
</template> </unicloud-db>
</view>
<script> </template>
import { mapGetters } from 'vuex';
export default { <script>
data() { export default {
return { data() {
loadMore: { return {
contentdown: '', isLoading: true,
contentrefresh: '', loadMore: {
contentnomore: '', contentdown: '',
} contentrefresh: '',
} contentnomore: '',
}, }
onPullDownRefresh() { }
this.$refs.udb.loadData({ },
clear: true onPullDownRefresh() {
}, () => { this.refreshData();
uni.stopPullDownRefresh() },
}) onReachBottom() {
}, this.$refs.udb.loadMore()
onReachBottom() { },
this.$refs.udb.loadMore() methods: {
}, refreshData() {
computed:{ this.$refs.udb.loadData({
...mapGetters({ clear: true
userInfo:'user/info' }, (res) => {
}), console.log(res);
where(){ uni.stopPullDownRefresh()
return `user_id == '${this.userInfo._id}'` })
} },
}, handleItemClick(item) {
methods: { uni.navigateTo({
handleItemClick(item) { url: '/pages/list/detail?id=' + item.article_id + '&title=' + (item.article_title || '')
uni.navigateTo({ })
url: '/pages/list/detail?id='+item.article_id+'&title='+(item.article_title || '') }
}) }
} }
} </script>
}
</script> <style>
.article-date {
<style> color: #C8C7CC;
.article-date{ }
color: #C8C7CC;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册