fixed v-toast

This commit is contained in:
cmxdd
2020-07-30 10:12:27 +08:00
parent 70e848cbbb
commit 5094efd41e
12 changed files with 80 additions and 47 deletions

View File

@@ -3,6 +3,7 @@
<view class="complaint-item" v-for="(item, index) in 4" :key="index" @click="toDetailsPage">
<ComplaintItem></ComplaintItem>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>

View File

@@ -28,6 +28,7 @@
<view class="title">投诉原因</view>
<view class="value u-line-4">太慢了太慢了</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>

View File

@@ -16,27 +16,19 @@
:is-scroll="false"
></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" class="list">
<view v-for="(item, index) in newlist" :key="index"><ContentItem :info="item" :type="type" del="del"></ContentItem></view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" class="video-list">
<view v-for="(item, index) in newlist" :key="index"><ContentItem :info="item" :type="type" @del="del"></ContentItem></view>
</scroll-view>
</swiper-item>
</swiper>
<view class="box">
<view v-for="(item, index) in newlist" :key="index"><ContentItem :info="item" :type="type" @del="del"></ContentItem></view>
</view>
<u-popup v-model="show" mode="center">
<view class="close-popup">
<view class="tips">确定要删除该视频吗</view>
<view class="tips">{{msg}}</view>
<view class="btn">
<view class="cancel" @click="show = false">取消</view>
<view class="confirm">确定</view>
<view class="confirm" @click="delarticle">确定</view>
</view>
</view>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>
@@ -57,7 +49,9 @@ export default {
],
type: 1,
num: 1,
newlist: []
newlist: [],
delid:null,
msg:""
};
},
components: {
@@ -73,44 +67,66 @@ export default {
methods: {
getlist() {
let that = this;
this.$u.api
.articlelist({
type: that.type,
page: that.num
})
.then(res => {
console.log(res);
if (res.errCode != 0) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
} else {
let arr = res.data.articleList;
for (let index in arr) {
that.newlist.push(arr[index]);
}
this.$u.api.articlelist({
type: that.type,
page: that.num
})
.then(res => {
if (res.errCode != 0) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
} else {
let arr = res.data.articleList;
for (let index in arr) {
that.newlist.push(arr[index]);
}
});
}
});
},
del(e) {
// 删除元素
// 提示是否删除弹窗
if(this.type==1){
this.msg="确定要删除该图文吗?"
}else{
this.msg="确定要删除该视频吗?"
}
this.show = true;
console.log(e);
this.delid = e
},
// 删除文章
delarticle(){
let that = this;
that.show = false;
this.$u.api.delarticle({
article_id: that.delid
})
.then(res => {
console.log(res)
if (res.errCode != 0) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
} else {
this.$refs.uToast.show({
title: res.message,
type: 'success'
});
// 删除后更新页面
this.newlist = [];
that.num=1
that.getlist()
}
});
},
tabsChange(index) {
this.swiperCurrent = index;
this.current = index;
this.type = index + 1;
this.num = 0;
this.newlist = [];
this.getlist();
},
animationfinish(e) {
console.log(12345666);
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
this.type = current + 1;
}
}
};
@@ -120,7 +136,8 @@ export default {
width: 100%;
position: fixed;
top: 0;
margin-bottom: 2rpx 0 20rpx 0;
margin-bottom: 20rpx;
z-index: 1000;
}
.content {
min-height: calc(100vh - var(--window-top));
@@ -130,6 +147,9 @@ export default {
> uni-swiper {
flex: 1;
}
.box{
padding-top: 120rpx;
}
.close-popup {
background: rgba(255, 255, 255, 1);
border-radius: 10rpx;

View File

@@ -39,6 +39,7 @@
</view>
</view>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>

View File

@@ -16,6 +16,7 @@
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>

View File

@@ -23,6 +23,7 @@
<text>骑手投诉</text>
<image src="/static/image/user/1.png"></image>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>

View File

@@ -42,6 +42,7 @@
<image src="../../static/image/index/close.png" class="off" @click="close"></image>
</view>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>