dengjie commit : 我的页面部分接口
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="my_avatar">
|
||||
<view style="border: 1px solid #EEEEEE;border-radius: 50rpx;">
|
||||
<view style="border-radius: 50rpx;">
|
||||
<u-avatar :src="avatar" size="100rpx" shape="circle"></u-avatar>
|
||||
</view>
|
||||
<view style="margin-top: 10rpx;margin-bottom: 4rpx;">
|
||||
@@ -10,12 +10,11 @@
|
||||
</u--image>
|
||||
</view>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<text style="margin-right: 8rpx;">顾发航</text>
|
||||
<text style="margin-right: 8rpx;">{{nickname}}</text>
|
||||
<u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx"
|
||||
@click="changeAvatar()">
|
||||
</u--image>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -32,7 +31,8 @@
|
||||
return {
|
||||
show: false,
|
||||
showEdit: true,
|
||||
avatar: 'https://cdn.uviewui.com/uview/album/2.jpg',
|
||||
avatar: '',
|
||||
nickname: '',
|
||||
normal: '/static/my/wo_icon_pthy.png',
|
||||
VIP: '/static/my/wo_icon_vip.png',
|
||||
};
|
||||
@@ -41,6 +41,8 @@
|
||||
if (this.center != false) {
|
||||
this.showEdit = false
|
||||
}
|
||||
this.avatar = uni.getStorageSync('avatar')
|
||||
this.nickname = uni.getStorageSync('nickname')
|
||||
},
|
||||
methods: {
|
||||
//修改头像
|
||||
@@ -48,11 +50,7 @@
|
||||
uni.navigateTo({
|
||||
url: '../../packageMy/changeAvatar/changeAvatar'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
return {
|
||||
model: {
|
||||
userInfo: {
|
||||
name: '',
|
||||
phone: '',
|
||||
name: '姓名',
|
||||
phone: '2342233',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
created() {
|
||||
this.getProducts()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
//获取产品列表
|
||||
getProducts() {
|
||||
|
||||
126
components/productsBtn/productsBtn.vue
Normal file
126
components/productsBtn/productsBtn.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="products_box">
|
||||
<u-grid :border="false" col="2">
|
||||
<u-grid-item v-for="(item,index) in productList" :key="index">
|
||||
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
|
||||
</u-image>
|
||||
<view class="bgContent">
|
||||
<view>
|
||||
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true"
|
||||
@click="toDetailPage()">
|
||||
</u-image>
|
||||
<view class="img_tag">{{item.cate_name}}</view>
|
||||
</view>
|
||||
<view style="padding: 14rpx 22rpx;">
|
||||
<view class="title_box">
|
||||
<text class="title">{{item.name}}</text>
|
||||
<u-tag :text="item.tags" type="warning" shape="circle"></u-tag>
|
||||
</view>
|
||||
<view class="product_desc">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="releaseDate">
|
||||
<u-image src="/static/products/xp_icon_sjf.png" width="22rpx" height="22rpx"
|
||||
:lazy-load="true">
|
||||
</u-image>
|
||||
<text class="release">发布日期:</text>
|
||||
<text>{{item.create_time}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-button v-if="type==1" type="success" text="移除" color="#0EBB5B" @click="showModal()"></u-button>
|
||||
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B"></u-button>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
<u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay @confirm="confirm"
|
||||
@cancel="cancel" @close="close">
|
||||
</u-modal>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="type==1&&productList.length==0">
|
||||
暂无更多浏览记录</view>
|
||||
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
|
||||
v-if="type==2&&productList.length==0">
|
||||
暂无更多收藏记录</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
dateFormatHistory
|
||||
} from '../../utills/date.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
productId: '',
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
productList: [],
|
||||
showM: false,
|
||||
content: '您确定移除吗?',
|
||||
productList: []
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: String
|
||||
},
|
||||
created() {
|
||||
this.getHistoryOrCollection()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
},
|
||||
methods: {
|
||||
//获取历史记录
|
||||
getHistoryOrCollection() {
|
||||
this.$apiServe.getHistoryOrCollection(this.type).then(res => {
|
||||
let data = res.data.data
|
||||
for (const item of data) {
|
||||
let tag = item.tags
|
||||
this.tagsArray = tag.split(',')
|
||||
item.tags = this.tagsArray[0]
|
||||
item.create_time = dateFormatHistory(item.create_time)
|
||||
}
|
||||
// console.log('获取历史记录', res.data);
|
||||
this.productId = data.id
|
||||
this.productList = data
|
||||
}).finally(_ => {
|
||||
|
||||
})
|
||||
},
|
||||
//移除按钮
|
||||
showModal() {
|
||||
this.showM = true
|
||||
},
|
||||
confirm() {
|
||||
this.showM = false
|
||||
console.log('删除成功');
|
||||
// this.$apiServe.deleteHistoryOrCollection(this.productId).then(res => {
|
||||
// console.log('删除历史记录或收藏', res);
|
||||
// this.getHistoryOrCollection()
|
||||
// }).finally(_ => {})
|
||||
},
|
||||
cancel() {
|
||||
this.showM = false
|
||||
},
|
||||
close() {
|
||||
this.showM = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.u-modal__content {
|
||||
padding: 43rpx 104rpx !important;
|
||||
text-indent: 25rpx;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
width: 150rpx !important;
|
||||
height: 50rpx !important;
|
||||
background: #0EBB5B;
|
||||
border-radius: 10rpx !important;
|
||||
margin-top: 22rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user