update api
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="tab-swiper">
|
||||
<u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" active-color="#FF780F" inactive-color="#333333" font-size="30" gutter="317" height="98" :show-bar="false" swiperWidth="750" :is-scroll=false></u-tabs-swiper>
|
||||
<u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" active-color="#FF780F" inactive-color="#333333" font-size="30" gutter="317" height="98" :show-bar="false" swiperWidth="750" :is-scroll="false"></u-tabs-swiper>
|
||||
</view>
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
|
||||
<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 5" :key="index">
|
||||
<ContentItem :cur="current" :delItem="showPopup"></ContentItem>
|
||||
<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 5" :key="index">
|
||||
<ContentItem :cur="current" :delItem="showPopup"></ContentItem>
|
||||
<view v-for="(item, index) in newlist" :key="index">
|
||||
<ContentItem :info="item" :type="type" @del="del"></ContentItem>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
@@ -43,23 +43,61 @@ export default {
|
||||
}, {
|
||||
name: '视频'
|
||||
}],
|
||||
type:1,
|
||||
num:1,
|
||||
newlist:[]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ContentItem
|
||||
},
|
||||
onLoad() {
|
||||
this.getlist()
|
||||
},
|
||||
onReachBottom() {
|
||||
this.num++
|
||||
this.getlist()
|
||||
},
|
||||
methods: {
|
||||
showPopup() {
|
||||
this.show = true;
|
||||
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])
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
del(e) {
|
||||
// 删除元素
|
||||
this.show=true
|
||||
console.log(e)
|
||||
},
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
this.type=index+1;
|
||||
this.num=0
|
||||
this.newlist=[]
|
||||
this.getlist()
|
||||
},
|
||||
animationfinish(e) {
|
||||
console.log(12345666)
|
||||
let current = e.detail.current;
|
||||
// this.$refs.uTabs.setFinishCurrent(current);
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
this.type=current+1;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
<view class="lately">
|
||||
<view class="title">最新</view>
|
||||
<view class="items">
|
||||
<view v-for="(item, index) in 3" :key="index">
|
||||
<FansItem></FansItem>
|
||||
<view v-for="(item, index) in myfans" :key="index">
|
||||
<FansItem :info="item"></FansItem>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="before">
|
||||
<view class="title">早前</view>
|
||||
<view class="items">
|
||||
<view v-for="(item, index) in 13" :key="index">
|
||||
<FansItem></FansItem>
|
||||
<view v-for="(item, index) in newfans" :key="index">
|
||||
<FansItem :info="item"></FansItem>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -22,10 +22,35 @@
|
||||
import FansItem from '@/components/fans-item/index'
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
myfans:[],
|
||||
newfans:[]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
FansItem
|
||||
},
|
||||
onLoad() {
|
||||
this.fans()
|
||||
},
|
||||
methods:{
|
||||
fans(){
|
||||
let that = this;
|
||||
this.$u.api.myfanlist({
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
that.myfans = res.data.fans
|
||||
that.newfans = res.data.fansNewest
|
||||
console.log(that.myfans,that.newfans)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<view class="user">
|
||||
<view class="head" @click="toOthersPage('info')">
|
||||
<view class="info">
|
||||
<image></image>
|
||||
<image :src="info.member_avatar"></image>
|
||||
<view class="name">
|
||||
<text>萨大赛</text>
|
||||
<text>账号:123456789</text>
|
||||
<text>个性签名:为梦努力</text>
|
||||
<text>{{info.member_nickname==null?"新用户":info.member_nickname}}</text>
|
||||
<text>账号:{{info.member_name}}</text>
|
||||
<text>个性签名:{{info.signature==""?"该用户很懒没有签名!":info.signature}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<image src="/static/image/user/1.png"></image>
|
||||
@@ -28,7 +28,31 @@
|
||||
<script>
|
||||
export default {
|
||||
name:"user",
|
||||
data() {
|
||||
return {
|
||||
info:{}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getmyinfo()
|
||||
},
|
||||
methods: {
|
||||
// 获取个人信息
|
||||
getmyinfo(){
|
||||
let that = this;
|
||||
this.$u.api.getshopinfo({
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.info = res.data.memberInfo
|
||||
}
|
||||
});
|
||||
},
|
||||
toOthersPage(url) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/' + url
|
||||
|
||||
@@ -1,45 +1,106 @@
|
||||
<template>
|
||||
<view class="info">
|
||||
<view class="head" @click="showImage=true">
|
||||
<image></image>
|
||||
<text>更换头像</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="title">用户名</text>
|
||||
<text class="value">兽兽</text>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="head" @click="chooseImage">
|
||||
<image :src="fileurl" :key="num"></image>
|
||||
<text>更换头像</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="title">个性签名</text>
|
||||
<text class="value">变瘦变高变有钱</text>
|
||||
</view>
|
||||
<text class="title">用户名</text>
|
||||
<input type="text" :value="info.member_nickname==null?'新用户':info.member_nickname" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="title">个性签名</text>
|
||||
<input type="text" :value="info.signature==''?'该用户很懒没有签名!':info.signature" />
|
||||
</view>
|
||||
<view class="password" @click="updatePwd">
|
||||
<text>修改密码</text>
|
||||
<image src="/static/image/user/1.png"></image>
|
||||
</view>
|
||||
<u-popup v-model="showImage" mode="bottom">
|
||||
<view class="image-popup">
|
||||
<view @click="chooseImage('camera')">拍摄新照片</view>
|
||||
<view @click="chooseImage('album')">从相册选取</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:"info",
|
||||
name: 'info',
|
||||
data() {
|
||||
return {
|
||||
showImage: false
|
||||
}
|
||||
fileurl: "",
|
||||
filename:"",
|
||||
info:{},
|
||||
num:0
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getmyinfo()
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
let that = this;
|
||||
this.$u.api.changeinfo({
|
||||
nickname:that.info.member_nickname,
|
||||
avatar:that.filename,
|
||||
signature:that.info.signature
|
||||
}).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'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 获取个人信息
|
||||
getmyinfo(){
|
||||
let that = this;
|
||||
this.$u.api.getshopinfo({
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.info = res.data.memberInfo
|
||||
this.fileurl = res.data.memberInfo.member_avatar
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取图片,上传图片
|
||||
chooseImage(sourceType) {
|
||||
let that = this
|
||||
const token = uni.getStorageSync('token');
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: [sourceType],
|
||||
success: function (res) {
|
||||
success: function(res) {
|
||||
console.log(JSON.stringify(res.tempFilePaths));
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
that.fileurl = tempFilePaths[0]
|
||||
uni.uploadFile({
|
||||
url: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'avatar',
|
||||
formData:{
|
||||
name:"avatar"
|
||||
},
|
||||
header:{
|
||||
Authorization:'Bearer' + " " + token
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
let obj = JSON.parse(uploadFileRes.data)
|
||||
that.fileurl = obj.data.file_path
|
||||
that.filename = obj.data.file_name
|
||||
that.num++
|
||||
console.log(that.fileurl,that.filename)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -48,50 +109,49 @@ export default {
|
||||
url: '/pages/user/updatePassword'
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.info{
|
||||
.info {
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
background: #ececec;
|
||||
.head{
|
||||
height: 202rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #fff;
|
||||
background: #ececec;
|
||||
.head {
|
||||
height: 202rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #fff;
|
||||
margin-bottom: 2rpx;
|
||||
>image{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #0f0;
|
||||
}
|
||||
>text{
|
||||
font-size: 24rpx;
|
||||
color: #FF780F;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
> image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
> text {
|
||||
font-size: 24rpx;
|
||||
color: #ff780f;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 98rpx;
|
||||
background: rgba(255,255,255,1);
|
||||
background: rgba(255, 255, 255, 1);
|
||||
padding: 0 30rpx;
|
||||
margin-bottom: 2rpx;
|
||||
.title {
|
||||
width: 120rpx;
|
||||
font-size: 30rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin-right: 120rpx;
|
||||
}
|
||||
.value {
|
||||
font-size: 30rpx;
|
||||
color: rgba(101,101,101,1);
|
||||
color: rgba(101, 101, 101, 1);
|
||||
}
|
||||
}
|
||||
.password {
|
||||
@@ -101,10 +161,10 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: rgba(255,255,255,1);
|
||||
background: rgba(255, 255, 255, 1);
|
||||
> text {
|
||||
font-size: 30rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
> image {
|
||||
width: 11rpx;
|
||||
@@ -114,14 +174,14 @@ export default {
|
||||
.image-popup {
|
||||
padding: 0 30rpx;
|
||||
> view {
|
||||
font-size: 28rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
font-size: 28rpx;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 98rpx;
|
||||
text-align: center;
|
||||
&:first-child {
|
||||
border-bottom: 2rpx solid #EBEBEB;
|
||||
border-bottom: 2rpx solid #ebebeb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
217
pages/user/myinfo.vue
Normal file
217
pages/user/myinfo.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<view class="user">
|
||||
<view class="head" @click="toOthersPage('info')">
|
||||
<view class="info">
|
||||
<image :src="info.member_avatar"></image>
|
||||
<view class="name">
|
||||
<text>{{info.member_nickname==null?"新用户":info.member_nickname}}</text>
|
||||
<text>账号:{{info.member_name}}</text>
|
||||
<text>个性签名:{{info.signature==""?"该用户很懒没有签名!":info.signature}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<image src="/static/image/user/1.png"></image>
|
||||
</view>
|
||||
<view class="nav" @click="toOthersPage('fans')">
|
||||
<text>我的粉丝</text>
|
||||
<image src="/static/image/user/1.png"></image>
|
||||
</view>
|
||||
<view class="nav" @click="toOthersPage('content')">
|
||||
<text>内容管理</text>
|
||||
<image src="/static/image/user/1.png"></image>
|
||||
</view>
|
||||
<view class="release-btn" @click="publish">
|
||||
<image src="../../static/image/index/publish.png"></image>
|
||||
<view class="text">发布</view>
|
||||
</view>
|
||||
<u-popup v-model="publishstate" mode="bottom">
|
||||
<view class="publish">
|
||||
<view class="list">
|
||||
<view @click="navto('release/tosign')">
|
||||
<image src="../../static/image/index/live.png"></image>
|
||||
<text>直播</text>
|
||||
</view>
|
||||
<view @click="navto('release/index')">
|
||||
<image src="../../static/image/index/photo.png"></image>
|
||||
<text>图文</text>
|
||||
</view>
|
||||
<view @click="navto('release/video')">
|
||||
<image src="../../static/image/index/video.png"></image>
|
||||
<text>视频</text>
|
||||
</view>
|
||||
</view>
|
||||
<image src="../../static/image/index/close.png" class="off" @click="close"></image>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:"user",
|
||||
data() {
|
||||
return {
|
||||
publishstate:false,
|
||||
info:{},
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getmyinfo()
|
||||
},
|
||||
methods: {
|
||||
// 获取个人信息
|
||||
getmyinfo(){
|
||||
let that = this;
|
||||
this.$u.api.getshopinfo({
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.info = res.data.memberInfo
|
||||
}
|
||||
});
|
||||
},
|
||||
toOthersPage(url) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/' + url
|
||||
});
|
||||
},
|
||||
// 打开发布弹窗
|
||||
publish() {
|
||||
this.publishstate = true;
|
||||
},
|
||||
// 关闭发布弹窗
|
||||
close() {
|
||||
this.publishstate = false;
|
||||
},
|
||||
// 跳转发布页面
|
||||
navto(url) {
|
||||
this.$u.route({
|
||||
url: `/pages/${url}`
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.release-btn {
|
||||
position: fixed;
|
||||
bottom: 475rpx;
|
||||
right: 30rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: rgba(255, 120, 15, 1);
|
||||
box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(255, 120, 15, 0.22);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
> image {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
flex-shrink: 0;
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
.text {
|
||||
font-size: 20rpx;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
.publish {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 50rpx 84rpx 31rpx 78rpx;
|
||||
image {
|
||||
}
|
||||
.list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
> view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
> image {
|
||||
width: 94rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
> text {
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
.off {
|
||||
margin-top: 81rpx;
|
||||
width: 37rpx;
|
||||
height: 37rpx;
|
||||
}
|
||||
}
|
||||
.user{
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
background: #ececec;
|
||||
.head{
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
background-color: #FF780F;
|
||||
padding: 0 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.info{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
>image{
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #0f0;
|
||||
}
|
||||
.name{
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 26rpx;
|
||||
>text{
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
>text:first-child{
|
||||
font-size: 28rpx;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
>image{
|
||||
width: 12rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
.nav{
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
padding: 30rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 2rpx;
|
||||
color:#333;
|
||||
background-color: #fff;
|
||||
>image{
|
||||
width: 13rpx;
|
||||
height: 25rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,8 @@
|
||||
</u-form>
|
||||
</view>
|
||||
<text class="tips">密码必须是8-16位,至少含数字/字母/字符两种组合</text>
|
||||
<view class="btn">确定</view>
|
||||
<view class="btn" @click="update">确定</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -28,6 +29,29 @@ export default {
|
||||
rePassword: ''
|
||||
},
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
update(){
|
||||
let that = this;
|
||||
this.$u.api.editpassword({
|
||||
old_password:that.model.password,
|
||||
password:that.model.newPassword,
|
||||
repassword:that.model.rePassword
|
||||
}).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'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user