Browse Source

数据刷新

h5_css
yanyan 3 years ago
parent
commit
0cdab583f0
  1. 59
      pages/my/my.vue
  2. 25
      subpkg/list/list.vue

59
pages/my/my.vue

@ -11,7 +11,7 @@
<swiper style="height: 100%;" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" :circular="true"> <swiper style="height: 100%;" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i"> <swiper-item v-for="(item, i) in swiperList" :key="i">
<navigator style="height: 100%;" class="swiper-item"> <navigator style="height: 100%;" class="swiper-item">
<img :src="item"></img> <img :src="item.uploadPath"></img>
</navigator> </navigator>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -28,50 +28,7 @@
<tabbar :page="page"></tabbar> <tabbar :page="page"></tabbar>
</view> </view>
</view> </view>
<!-- <view class="my-userinfo-container">
<view class="top-box">
<image :src="avatarUrl" class="avatar"></image>
<view class="nickname">{{name}}</view>
</view>
<view class="panel-list">
<view class="panel">
<view class="panel-body">
<view class="panel-item" @click="showMedal()">
<text>{{medalNum}}</text>
<text>勋章</text>
</view>
<view class="panel-item">
<text>0</text>
<text>挑战历史</text>
</view>
</view>
</view>
<view class="panel">
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<swiper-item v-for="(item, i) in swiperList" :key="i">
<navigator class="swiper-item">
<image :src="item"></image>
</navigator>
</swiper-item>
</swiper>
</view>
<view class="panel">
<view class="function-list">
<view class="panel-list-item" v-for="(item,i) in functionList" :key="i" @click="navClickHandler(item)">
<image class="function-img" :src="item.uploadPath"></image>
<text style="margin-right: 220px;">{{item.name}}</text>
<uni-icons type="arrowright" size="15"></uni-icons>
</view>
</view>
</view>
</view>
<tabbar :page="page"></tabbar>
</view> -->
</template> </template>
<script> <script>
@ -103,6 +60,18 @@
}, },
onShow() { onShow() {
this.page = "my" this.page = "my"
this.getSwiperList()
this.getFunctionList()
this.getMyMedalList()
this.getChallengeTotal()
this.getStatus()
},
onPullDownRefresh() {
this.getSwiperList()
this.getFunctionList()
this.getMyMedalList()
this.getChallengeTotal()
this.getStatus()
}, },
computed: { computed: {
...mapState('m_user', ['userinfo','userId']) ...mapState('m_user', ['userinfo','userId'])
@ -163,8 +132,8 @@
res.data.forEach(item => { res.data.forEach(item => {
item.uploadPath = uni.$http.baseUrl + item.uploadPath item.uploadPath = uni.$http.baseUrl + item.uploadPath
this.swiperList.push(item.uploadPath)
}) })
this.swiperList = res.data
// uni.$showMsg('数据请求成功!') // uni.$showMsg('数据请求成功!')
}, },
async getFunctionList() { async getFunctionList() {

25
subpkg/list/list.vue

@ -14,7 +14,7 @@
<image :src="item.image_src"></image> <image :src="item.image_src"></image>
</view> --> </view> -->
<navigator class="swiper-item"> <navigator class="swiper-item">
<image :src="item"></image> <image :src="item.uploadPath"></image>
</navigator> </navigator>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -67,6 +67,14 @@
this.getSwiperList(); this.getSwiperList();
this.getSceneList(); this.getSceneList();
}, },
onShow() {
this.getSwiperList();
this.getSceneListReload();
},
onPullDownRefresh() {
this.getSwiperList();
this.getSceneListReload();
},
methods: { methods: {
async getSwiperList() { async getSwiperList() {
const { const {
@ -76,9 +84,8 @@
res.data.forEach(item=>{ res.data.forEach(item=>{
item.uploadPath = uni.$http.baseUrl +item.uploadPath item.uploadPath = uni.$http.baseUrl +item.uploadPath
this.swiperList.push(item.uploadPath)
}) })
this.swiperList = res.data
// uni.$showMsg('数据请求成功!') // uni.$showMsg('数据请求成功!')
}, },
async getSceneList() { async getSceneList() {
@ -100,6 +107,18 @@
this.total = res.total this.total = res.total
// uni.$showMsg('数据请求成功!') // uni.$showMsg('数据请求成功!')
}, },
async getSceneListReload() {
const {
data: res
} = await uni.$http.post('/small/scene/manage/listApp',this.queryObj)
res.rows.forEach(item=>{
item.uploadPath = uni.$http.baseUrl +item.uploadPath
})
this.sceneList = res.rows
this.total = res.total
// uni.$showMsg('数据请求成功!')
},
navClickHandler(item) { navClickHandler(item) {
if(item !== ""){ if(item !== ""){
uni.navigateTo({ uni.navigateTo({

Loading…
Cancel
Save