hengmei-two/pagesA/my-diary/my-diary.vue

118 lines
3.6 KiB
Vue
Raw Normal View History

<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'我的日记'" :statusTitle="true"></status-nav>
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 160rpx;">
<view v-if="dataList.length!=0" class="mar-s30 bacf pad20" v-for="(item,index) in dataList" :key="index" style="border-radius: 28rpx;">
<view class="clips1">{{item.title}}</view>
<view class="mar-s20 fon24 col9">{{item.content}}</view>
<view class="disac fw mar-s20">
2022-01-03 07:54:22 +00:00
<image class="diary-img mar-x10" @tap="preImg(index,index1)" :src="item1" v-for="(item1,index1) in item.imgArr" :key="index1" mode="aspectFill"></image>
</view>
<view class="disjbac mar-s20">
<view class="fon28 pcol bold">{{item.doctorName}}</view>
<view class="fon24 col9">{{item.creatTime}}</view>
</view>
<view @tap="delDiaryEv(item.id,index)" class="disac mar-s20 pad-s20" style="border-top: 2rpx solid #E6E6E6;">
<image src="../../static/public/del-diary.png" style="width: 20px;height: 20px;vertical-align: bottom;" mode=""></image>
<view class="fon28 colf8 bold" style="margin-top: -4rpx;">删除</view>
</view>
</view>
<nothing-page v-if="dataList.length==0" :content="'暂无日记'"></nothing-page>
</view>
<!-- 底部按钮 -->
<view class="posixzy pad-sx25">
<view @tap="goAddDiary" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">添加日记</view>
</view>
2022-03-04 08:48:40 +00:00
<!-- 用户信息授权手机号授权 -->
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
</view>
</template>
<script>
import {base64ToPath} from '@/jsFile/base64-src.js';
import {checkBanner} from '@/jsFile/publicAPI.js';
export default {
data() {
return {
2022-03-04 08:48:40 +00:00
statusHNH:uni.getStorageSync('electric_nav_height'),
publicColor:uni.getStorageSync('publicColor'),
optionObj:'',
2022-01-03 07:54:22 +00:00
dataList:[],
page:1,
size:20,
total:'',//总数
isZanw:true,
}
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++
this.checkDiaryEv()//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多日记','none',1000)
this.isZanw = false
}
},
onUnload: function() {
},
onShow() {
2022-03-04 08:48:40 +00:00
this.$toolAll.tools.isLogin()
if(uni.getStorageSync('phone_active')!=0){
this.checkDiaryEv();
}
},
onLoad() {
},
methods: {
goAddDiary(){
uni.navigateTo({
url:'/pagesA/my-diary-edit/my-diary-edit'
})
},
checkDiaryEv(){
this.$requst.get('user/diary',{page:this.page,size:this.size}).then(res=>{
if(res.code==0){
if(this.page==1) this.dataList = [];
this.total = res.data.total;
2022-01-03 07:54:22 +00:00
if(res.data.list.length){
res.data.list.forEach(item=>{
let obj = {
id:item.id,
title:item.title,
content:item.content,
imgArr:item.images.split(','),
doctorName:item.doctor_name,
creatTime:item.created_at,
}
this.dataList.push(obj);
})
}
} else this.$toolAll.tools.showToast(res.msg);
},error=>{})
},
delDiaryEv(id,index){
this.$requst.get('user/diary-del',{id:id}).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('删除成功');
this.dataList.splice(index,1);
} else this.$toolAll.tools.showToast(res.msg);
},error=>{})
2022-01-03 07:54:22 +00:00
},
preImg(index,num){
console.log(this.dataList[index]);
uni.previewImage({
current:this.dataList[index].imgArr[num],
urls:this.dataList[index].imgArr
})
}
}
}
</script>
<style>
</style>