短视频优化交互细节,IM浮窗
This commit is contained in:
parent
ef29aebf9c
commit
4ab450a368
18
api/vlog.js
18
api/vlog.js
@ -85,6 +85,24 @@ export function vlogList(page, pageSize, userId = '', cityCode = '', search = ''
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户删除短视频
|
||||||
|
*/
|
||||||
|
export function vlogDel({
|
||||||
|
userId,
|
||||||
|
vlogId,
|
||||||
|
status
|
||||||
|
}) {
|
||||||
|
return http.request({
|
||||||
|
url: api.vlog + "/vlog/changeVlogStatus",
|
||||||
|
method: Method.POST,
|
||||||
|
params: {
|
||||||
|
userId,
|
||||||
|
vlogId,
|
||||||
|
status
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 短视频喜欢
|
* 短视频喜欢
|
||||||
*/
|
*/
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
:show-fullscreen-btn="false"
|
:show-fullscreen-btn="false"
|
||||||
:show-center-play-btn="false"
|
:show-center-play-btn="false"
|
||||||
:style="boxStyle"
|
:style="boxStyle"
|
||||||
:object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
:object-fit="item.width >= item.height ? 'contain' : 'cover'"
|
||||||
@timeupdate="timeupdate($event, i)"
|
@timeupdate="timeupdate($event, i)"
|
||||||
:poster="item.firstFrameImg"
|
:poster="item.firstFrameImg"
|
||||||
></video>
|
></video>
|
||||||
@ -107,8 +107,8 @@
|
|||||||
<image
|
<image
|
||||||
v-if="!item.playIng"
|
v-if="!item.playIng"
|
||||||
:src="item.firstFrameImg"
|
:src="item.firstFrameImg"
|
||||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
:mode="item.width >= item.height ? 'aspectFit' : 'aspectFit'"
|
||||||
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 'px; position: absolute;'"
|
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 26 + 'px; position: absolute;'"
|
||||||
></image>
|
></image>
|
||||||
<!--
|
<!--
|
||||||
mode: 图片裁剪、缩放的模式
|
mode: 图片裁剪、缩放的模式
|
||||||
@ -424,9 +424,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { graceNumber } from '@/utils/tools.js';
|
import { graceNumber, clickFeedBack } from '@/utils/tools.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import { vlogFollowList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
import { vlogFollowList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts, vlogDetail } from '@/api/vlog';
|
||||||
/*
|
/*
|
||||||
引入评论组件
|
引入评论组件
|
||||||
*/
|
*/
|
||||||
@ -583,21 +583,32 @@ export default {
|
|||||||
this.refreshVlogCounts();
|
this.refreshVlogCounts();
|
||||||
this.freshCommentCounts();
|
this.freshCommentCounts();
|
||||||
}
|
}
|
||||||
|
if (data.from == 'initGuanzhu') {
|
||||||
|
console.log('初始化关注视频数据');
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
// 刷新点赞状态
|
||||||
|
if (data.from == 'refreshLike') {
|
||||||
|
// 刷新点赞状态
|
||||||
|
this.refreshLike(data.vlogId, data.flag);
|
||||||
|
// 刷新点赞数据
|
||||||
|
this.refreshVlogCounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.platform = uni.getSystemInfoSync().platform;
|
this.platform = uni.getSystemInfoSync().platform;
|
||||||
var model = uni.getSystemInfoSync().model;
|
var model = uni.getSystemInfoSync().model;
|
||||||
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
||||||
// this.deleteHeight = 32; //有 tabbar的 修改这里可以改变视频高度
|
this.deleteHeight = 0; //有 tabbar的 修改这里可以改变视频高度
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.heightNum = 1.27;
|
this.heightNum = 1.27;
|
||||||
} else {
|
} else {
|
||||||
// this.deleteHeight = 0;
|
this.deleteHeight = 0;
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
@ -612,7 +623,8 @@ export default {
|
|||||||
// 控制渲染 -- end
|
// 控制渲染 -- end
|
||||||
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
||||||
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
||||||
this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
// this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
||||||
|
this.wHeight = uni.getSystemInfoSync().windowHeight; //获取屏幕可用高度
|
||||||
console.log(this.wHeight);
|
console.log(this.wHeight);
|
||||||
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
||||||
console.log(this.boxStyle);
|
console.log(this.boxStyle);
|
||||||
@ -621,6 +633,18 @@ export default {
|
|||||||
},
|
},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 点赞取消点赞,后刷新点赞状态
|
||||||
|
refreshLike(vlogId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogId == vlogId) {
|
||||||
|
vlog.doILikeThisVlog = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
async refreshVlogCounts() {
|
async refreshVlogCounts() {
|
||||||
// 查询当前点赞数,重新赋值给当前视频
|
// 查询当前点赞数,重新赋值给当前视频
|
||||||
var me = this;
|
var me = this;
|
||||||
@ -642,6 +666,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 关注博主
|
// 关注博主
|
||||||
async followMe(vlogerId) {
|
async followMe(vlogerId) {
|
||||||
|
clickFeedBack();
|
||||||
var myUserInfo = storage.getVlogUserInfo();
|
var myUserInfo = storage.getVlogUserInfo();
|
||||||
if (myUserInfo == null) {
|
if (myUserInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -655,6 +680,7 @@ export default {
|
|||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
// 关注成功后修改当前数据的状态
|
// 关注成功后修改当前数据的状态
|
||||||
this.dataList[this.k].doIFollowVloger = true;
|
this.dataList[this.k].doIFollowVloger = true;
|
||||||
|
this.reFollowPlayList(vlogerId, true);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -663,11 +689,24 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 关注/取消关注,后刷新关注状态
|
||||||
|
reFollowPlayList(vlogerId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogerId == vlogerId) {
|
||||||
|
vlog.doIFollowVloger = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
||||||
getGraceNumber(num) {
|
getGraceNumber(num) {
|
||||||
return graceNumber(num);
|
return graceNumber(num);
|
||||||
},
|
},
|
||||||
async likeOrDislikeVlog(item) {
|
async likeOrDislikeVlog(item) {
|
||||||
|
clickFeedBack();
|
||||||
var info = storage.getVlogUserInfo();
|
var info = storage.getVlogUserInfo();
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
this.userId = info.id;
|
this.userId = info.id;
|
||||||
@ -691,7 +730,8 @@ export default {
|
|||||||
});
|
});
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts++;
|
// item.likeCounts++;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -708,7 +748,8 @@ export default {
|
|||||||
vlogId: item.vlogId
|
vlogId: item.vlogId
|
||||||
});
|
});
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts--;
|
// item.likeCounts--;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
:show-fullscreen-btn="false"
|
:show-fullscreen-btn="false"
|
||||||
:show-center-play-btn="false"
|
:show-center-play-btn="false"
|
||||||
:style="boxStyle"
|
:style="boxStyle"
|
||||||
:object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
:object-fit="item.width >= item.height ? 'contain' : 'cover'"
|
||||||
@timeupdate="timeupdate($event, i)"
|
@timeupdate="timeupdate($event, i)"
|
||||||
:poster="item.firstFrameImg"
|
:poster="item.firstFrameImg"
|
||||||
></video>
|
></video>
|
||||||
@ -107,8 +107,8 @@
|
|||||||
<image
|
<image
|
||||||
v-if="!item.playIng"
|
v-if="!item.playIng"
|
||||||
:src="item.firstFrameImg"
|
:src="item.firstFrameImg"
|
||||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
:mode="item.width >= item.height ? 'aspectFit' : 'aspectFit'"
|
||||||
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 'px; position: absolute;'"
|
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 26 + 'px; position: absolute;'"
|
||||||
></image>
|
></image>
|
||||||
<!--
|
<!--
|
||||||
mode: 图片裁剪、缩放的模式
|
mode: 图片裁剪、缩放的模式
|
||||||
@ -424,9 +424,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { graceNumber } from '@/utils/tools.js';
|
import { graceNumber, clickFeedBack } from '@/utils/tools.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import { vlogList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
import { vlogList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts, vlogDetail } from '@/api/vlog';
|
||||||
/*
|
/*
|
||||||
引入评论组件
|
引入评论组件
|
||||||
*/
|
*/
|
||||||
@ -583,21 +583,34 @@ export default {
|
|||||||
this.refreshVlogCounts();
|
this.refreshVlogCounts();
|
||||||
this.freshCommentCounts();
|
this.freshCommentCounts();
|
||||||
}
|
}
|
||||||
|
// 刷新当前视频关注的状态
|
||||||
|
if (data.from == 'refresh') {
|
||||||
|
console.log('刷新同城列表关注状态');
|
||||||
|
this.reFollowPlayList(data.vlogerId, data.flag);
|
||||||
|
}
|
||||||
|
// 刷新点赞状态
|
||||||
|
if (data.from == 'refreshLike') {
|
||||||
|
// 刷新点赞状态
|
||||||
|
this.refreshLike(data.vlogId, data.flag);
|
||||||
|
// 刷新点赞数据
|
||||||
|
this.refreshVlogCounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.platform = uni.getSystemInfoSync().platform;
|
this.platform = uni.getSystemInfoSync().platform;
|
||||||
var model = uni.getSystemInfoSync().model;
|
var model = uni.getSystemInfoSync().model;
|
||||||
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
||||||
// this.deleteHeight = 32; //有 tabbar的 修改这里可以改变视频高度
|
// this.deleteHeight = 50 + 26; //有 tabbar的 修改这里可以改变视频高度
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
this.deleteHeight = 0;
|
||||||
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.heightNum = 1.27;
|
this.heightNum = 1.27;
|
||||||
} else {
|
} else {
|
||||||
// this.deleteHeight = 0;
|
this.deleteHeight = 0;
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
@ -612,7 +625,8 @@ export default {
|
|||||||
// 控制渲染 -- end
|
// 控制渲染 -- end
|
||||||
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
||||||
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
||||||
this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
// this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
||||||
|
this.wHeight = uni.getSystemInfoSync().windowHeight; //获取屏幕可用高度
|
||||||
console.log(this.wHeight);
|
console.log(this.wHeight);
|
||||||
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
||||||
console.log(this.boxStyle);
|
console.log(this.boxStyle);
|
||||||
@ -621,6 +635,18 @@ export default {
|
|||||||
},
|
},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 点赞取消点赞,后刷新点赞状态
|
||||||
|
refreshLike(vlogId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogId == vlogId) {
|
||||||
|
vlog.doILikeThisVlog = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
async refreshVlogCounts() {
|
async refreshVlogCounts() {
|
||||||
// 查询当前点赞数,重新赋值给当前视频
|
// 查询当前点赞数,重新赋值给当前视频
|
||||||
var me = this;
|
var me = this;
|
||||||
@ -642,6 +668,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 关注博主
|
// 关注博主
|
||||||
async followMe(vlogerId) {
|
async followMe(vlogerId) {
|
||||||
|
clickFeedBack();
|
||||||
var myUserInfo = storage.getVlogUserInfo();
|
var myUserInfo = storage.getVlogUserInfo();
|
||||||
if (myUserInfo == null) {
|
if (myUserInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -655,6 +682,11 @@ export default {
|
|||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
// 关注成功后修改当前数据的状态
|
// 关注成功后修改当前数据的状态
|
||||||
this.dataList[this.k].doIFollowVloger = true;
|
this.dataList[this.k].doIFollowVloger = true;
|
||||||
|
this.reFollowPlayList(vlogerId, true);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -663,11 +695,24 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 关注/取消关注,后刷新关注状态
|
||||||
|
reFollowPlayList(vlogerId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogerId == vlogerId) {
|
||||||
|
vlog.doIFollowVloger = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
||||||
getGraceNumber(num) {
|
getGraceNumber(num) {
|
||||||
return graceNumber(num);
|
return graceNumber(num);
|
||||||
},
|
},
|
||||||
async likeOrDislikeVlog(item) {
|
async likeOrDislikeVlog(item) {
|
||||||
|
clickFeedBack();
|
||||||
var info = storage.getVlogUserInfo();
|
var info = storage.getVlogUserInfo();
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
this.userId = info.id;
|
this.userId = info.id;
|
||||||
@ -691,7 +736,8 @@ export default {
|
|||||||
});
|
});
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts++;
|
// item.likeCounts++;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -708,7 +754,8 @@ export default {
|
|||||||
vlogId: item.vlogId
|
vlogId: item.vlogId
|
||||||
});
|
});
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts--;
|
// item.likeCounts--;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -92,16 +92,16 @@
|
|||||||
:show-fullscreen-btn="false"
|
:show-fullscreen-btn="false"
|
||||||
:show-center-play-btn="false"
|
:show-center-play-btn="false"
|
||||||
:style="boxStyle"
|
:style="boxStyle"
|
||||||
:object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
:object-fit="item.width >= item.height ? 'contain' : 'cover'"
|
||||||
@timeupdate="timeupdate($event, i)"
|
@timeupdate="timeupdate($event, i)"
|
||||||
:poster="item.firstFrameImg"
|
:poster="item.firstFrameImg"
|
||||||
></video>
|
></video>
|
||||||
<!-- 这里是封面 -->
|
<!-- 这里是封面 26是进度条的高度 -->
|
||||||
<image
|
<image
|
||||||
v-if="!item.playIng"
|
v-if="!item.playIng"
|
||||||
:src="item.firstFrameImg"
|
:src="item.firstFrameImg"
|
||||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
:mode="item.width >= item.height ? 'aspectFit' : 'aspectFit'"
|
||||||
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 'px; position: absolute;'"
|
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 26 + 'px; position: absolute;'"
|
||||||
></image>
|
></image>
|
||||||
<!--
|
<!--
|
||||||
mode: 图片裁剪、缩放的模式
|
mode: 图片裁剪、缩放的模式
|
||||||
@ -417,9 +417,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { graceNumber } from '@/utils/tools.js';
|
import { graceNumber, clickFeedBack } from '@/utils/tools.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import { vlogList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
import { vlogList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts, vlogQueryDoIFollowVloger, vlogDetail } from '@/api/vlog';
|
||||||
/*
|
/*
|
||||||
引入评论组件
|
引入评论组件
|
||||||
*/
|
*/
|
||||||
@ -571,25 +571,40 @@ export default {
|
|||||||
this.channelComment.onmessage = (event) => {
|
this.channelComment.onmessage = (event) => {
|
||||||
const { type, data } = event.data;
|
const { type, data } = event.data;
|
||||||
if (type == 'comment-counts') {
|
if (type == 'comment-counts') {
|
||||||
|
// 刷新评论数据,点赞数据
|
||||||
if (data.from == 'tuijian') {
|
if (data.from == 'tuijian') {
|
||||||
this.refreshVlogCounts();
|
this.refreshVlogCounts();
|
||||||
this.freshCommentCounts();
|
this.freshCommentCounts();
|
||||||
}
|
}
|
||||||
|
// 刷新当前视频关注的状态
|
||||||
|
if (data.from == 'refresh') {
|
||||||
|
console.log('刷新推荐列表关注状态');
|
||||||
|
this.reFollowPlayList(data.vlogerId, data.flag);
|
||||||
|
}
|
||||||
|
// 刷新点赞状态
|
||||||
|
if (data.from == 'refreshLike') {
|
||||||
|
console.log('触发刷新点赞状态');
|
||||||
|
// 刷新点赞状态
|
||||||
|
this.refreshLike(data.vlogId, data.flag);
|
||||||
|
// 刷新点赞数据
|
||||||
|
this.refreshVlogCounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.platform = uni.getSystemInfoSync().platform;
|
this.platform = uni.getSystemInfoSync().platform;
|
||||||
var model = uni.getSystemInfoSync().model;
|
var model = uni.getSystemInfoSync().model;
|
||||||
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
||||||
// this.deleteHeight = 32; //有 tabbar的 修改这里可以改变视频高度
|
this.deleteHeight = 0; //有 tabbar的 修改这里可以改变视频高度
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10,默认50
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.heightNum = 1.27;
|
this.heightNum = 1.27;
|
||||||
} else {
|
} else {
|
||||||
// this.deleteHeight = 0;
|
// this.deleteHeight = 50 + 16;
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
this.deleteHeight = 0;
|
||||||
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
@ -603,7 +618,9 @@ export default {
|
|||||||
// 控制渲染 -- end
|
// 控制渲染 -- end
|
||||||
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
||||||
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
||||||
this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
// this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
||||||
|
this.wHeight = uni.getSystemInfoSync().windowHeight; //获取屏幕可用高度
|
||||||
|
console.log(uni.getSystemInfoSync());
|
||||||
console.log(this.wHeight);
|
console.log(this.wHeight);
|
||||||
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
||||||
console.log(this.boxStyle);
|
console.log(this.boxStyle);
|
||||||
@ -633,6 +650,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 关注博主
|
// 关注博主
|
||||||
async followMe(vlogerId) {
|
async followMe(vlogerId) {
|
||||||
|
clickFeedBack();
|
||||||
var myUserInfo = storage.getVlogUserInfo();
|
var myUserInfo = storage.getVlogUserInfo();
|
||||||
if (myUserInfo == null) {
|
if (myUserInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -646,6 +664,11 @@ export default {
|
|||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
// 关注成功后修改当前数据的状态
|
// 关注成功后修改当前数据的状态
|
||||||
this.dataList[this.k].doIFollowVloger = true;
|
this.dataList[this.k].doIFollowVloger = true;
|
||||||
|
this.reFollowPlayList(vlogerId, true);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -654,11 +677,36 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 关注/取消关注,后刷新关注状态
|
||||||
|
reFollowPlayList(vlogerId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogerId == vlogerId) {
|
||||||
|
vlog.doIFollowVloger = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 点赞取消点赞,后刷新点赞状态
|
||||||
|
refreshLike(vlogId, flag) {
|
||||||
|
var me = this;
|
||||||
|
var playerList = me.dataList;
|
||||||
|
// 关注以后,循环当前playerList,修改对应粉丝关系的doIFollowVloger改为true
|
||||||
|
for (var i = 0; i < playerList.length; i++) {
|
||||||
|
var vlog = playerList[i];
|
||||||
|
if (vlog.vlogId == vlogId) {
|
||||||
|
vlog.doILikeThisVlog = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
||||||
getGraceNumber(num) {
|
getGraceNumber(num) {
|
||||||
return graceNumber(num);
|
return graceNumber(num);
|
||||||
},
|
},
|
||||||
async likeOrDislikeVlog(item) {
|
async likeOrDislikeVlog(item) {
|
||||||
|
clickFeedBack();
|
||||||
var info = storage.getVlogUserInfo();
|
var info = storage.getVlogUserInfo();
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
this.userId = info.id;
|
this.userId = info.id;
|
||||||
@ -682,8 +730,9 @@ export default {
|
|||||||
});
|
});
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts++;
|
// item.likeCounts++;
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
|
this.refreshVlogCounts();
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -699,7 +748,8 @@ export default {
|
|||||||
vlogId: item.vlogId
|
vlogId: item.vlogId
|
||||||
});
|
});
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts--;
|
// item.likeCounts--;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -713,7 +763,14 @@ export default {
|
|||||||
// --------------------
|
// --------------------
|
||||||
showVd() {
|
showVd() {
|
||||||
console.log('回到前台');
|
console.log('回到前台');
|
||||||
if (this.dataList.length !== 0) {
|
if (this.dataList.length != 0) {
|
||||||
|
// if (uni.getSystemInfoSync().platform == 'ios') {
|
||||||
|
// this.dataList[this.k].state = 'play';
|
||||||
|
// uni.createVideoContext(this.dataList[this.k].id, this).play();
|
||||||
|
// } else {
|
||||||
|
// this.dataList[this.k].state = 'play';
|
||||||
|
// uni.createVideoContext(this.dataList[this.k].id, this).play();
|
||||||
|
// }
|
||||||
this.dataList[this.k].state = 'play';
|
this.dataList[this.k].state = 'play';
|
||||||
uni.createVideoContext(this.dataList[this.k].id, this).play();
|
uni.createVideoContext(this.dataList[this.k].id, this).play();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ const prod = {
|
|||||||
common: "http://43.143.227.203:8890",
|
common: "http://43.143.227.203:8890",
|
||||||
buyer: "http://43.143.227.203:8888",
|
buyer: "http://43.143.227.203:8888",
|
||||||
vlog: "http://43.143.227.203:8099",
|
vlog: "http://43.143.227.203:8099",
|
||||||
|
// vlog: "http://192.168.1.86:8099",
|
||||||
web: "http://43.143.227.203:8099",
|
web: "http://43.143.227.203:8099",
|
||||||
seller: "http://43.143.227.203:8889",
|
seller: "http://43.143.227.203:8889",
|
||||||
};
|
};
|
||||||
|
@ -1303,7 +1303,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#999696",
|
"color": "#CCCCCC",
|
||||||
"selectedColor": "#FFFFFF",
|
"selectedColor": "#FFFFFF",
|
||||||
"borderStyle": "#1c1b1b",
|
"borderStyle": "#1c1b1b",
|
||||||
"backgroundColor": "#0e0d0d",
|
"backgroundColor": "#0e0d0d",
|
||||||
|
104
pages/me/me.nvue
104
pages/me/me.nvue
@ -20,6 +20,21 @@
|
|||||||
scroll-y="true"
|
scroll-y="true"
|
||||||
@scrolltolower="loadMore"
|
@scrolltolower="loadMore"
|
||||||
>
|
>
|
||||||
|
<refresh
|
||||||
|
class="refresh"
|
||||||
|
@refresh="onrefresh"
|
||||||
|
@pullingdown="onpullingdown"
|
||||||
|
:display="refreshing ? 'show' : 'hide'"
|
||||||
|
>
|
||||||
|
<loading style="background-color: #ffffff">
|
||||||
|
<view style="align-items: center; display: flex; justify-content: center">
|
||||||
|
<image
|
||||||
|
src="@/static/img/index/logins.gif"
|
||||||
|
:style="'width: 80upx; height: 40upx; margin-top: 80upx; margin-bottom: 30upx;'"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
</loading>
|
||||||
|
</refresh>
|
||||||
<image
|
<image
|
||||||
class="mybg"
|
class="mybg"
|
||||||
:src="pageUserInfo.bgImg"
|
:src="pageUserInfo.bgImg"
|
||||||
@ -187,9 +202,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="vlog-list">
|
<view class="vlog-list">
|
||||||
<block
|
<view
|
||||||
|
class="vlogBox"
|
||||||
|
@longpress="delVlog(vlog)"
|
||||||
v-for="(vlog, index) in vlogList"
|
v-for="(vlog, index) in vlogList"
|
||||||
:key="index"
|
:key="vlog.vlogId"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="vlog-cover"
|
class="vlog-cover"
|
||||||
@ -197,7 +214,14 @@
|
|||||||
@click="goToVlog(vlog)"
|
@click="goToVlog(vlog)"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
></image>
|
></image>
|
||||||
</block>
|
<view class="rightLike">
|
||||||
|
<image
|
||||||
|
src="/static/images/icon-unlike.png"
|
||||||
|
style="width: 30rpx; height: 30rpx"
|
||||||
|
></image>
|
||||||
|
<text style="color: #ffffff">{{ getGraceNumber(vlog.likeCounts) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
@ -222,9 +246,9 @@ let system = uni.getSystemInfoSync();
|
|||||||
import * as filters from '@/utils/filters.js';
|
import * as filters from '@/utils/filters.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { vlogUserInfo, vlogMyPublicList, vlogMyPrivateList, vlogMyLikedList, vlogMeTag } from '@/api/vlog';
|
import { vlogUserInfo, vlogMyPublicList, vlogMyPrivateList, vlogMyLikedList, vlogMeTag, vlogDel } from '@/api/vlog';
|
||||||
|
|
||||||
import { getAstro, getAnimal, dateFormat, graceNumber } from '@/utils/tools.js';
|
import { getAstro, getAnimal, dateFormat, graceNumber, clickFeedBack } from '@/utils/tools.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -258,7 +282,8 @@ export default {
|
|||||||
|
|
||||||
page: 0,
|
page: 0,
|
||||||
toalPage: 0,
|
toalPage: 0,
|
||||||
vlogList: []
|
vlogList: [],
|
||||||
|
refreshing: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@ -287,15 +312,56 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
delVlog(item) {
|
||||||
|
clickFeedBack();
|
||||||
|
let myUserInfo = storage.getVlogUserInfo();
|
||||||
|
let myUserId = myUserInfo.id;
|
||||||
|
var data = {
|
||||||
|
userId: myUserId,
|
||||||
|
vlogId: item.vlogId,
|
||||||
|
status: 5 // 5=删除 4=下架
|
||||||
|
};
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认删除视频吗?',
|
||||||
|
success: async (r) => {
|
||||||
|
if (r.confirm) {
|
||||||
|
var res = await vlogDel(data);
|
||||||
|
if (res.data.success) {
|
||||||
|
// 本地删除
|
||||||
|
this.vlogList = this.vlogList.filter((v) => v.vlogId !== item.vlogId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async initInfo() {
|
||||||
|
let me = this;
|
||||||
|
// 判断我有没有登录
|
||||||
|
this.userIsLogin = storage.getHasLogin();
|
||||||
|
console.log(this.userIsLogin);
|
||||||
|
if (this.userIsLogin) {
|
||||||
|
this.getUinfo();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onpullingdown() {
|
||||||
|
// console.log('正在下拉刷新,此时手还在触摸没有松开')
|
||||||
|
this.refreshing = true;
|
||||||
|
},
|
||||||
|
onrefresh() {
|
||||||
|
// console.log('下拉刷新完毕,此时手松开了')
|
||||||
|
this.initInfo();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.refreshing = false;
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
async getUinfo() {
|
async getUinfo() {
|
||||||
let myUserInfo = storage.getVlogUserInfo();
|
let myUserInfo = storage.getVlogUserInfo();
|
||||||
|
|
||||||
let myUserId = myUserInfo.id;
|
let myUserId = myUserInfo.id;
|
||||||
uni.showLoading({
|
|
||||||
title: '正在加载!'
|
|
||||||
});
|
|
||||||
var result = await vlogUserInfo(myUserId);
|
var result = await vlogUserInfo(myUserId);
|
||||||
uni.hideLoading();
|
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
this.pageUserInfo = result.data.data;
|
this.pageUserInfo = result.data.data;
|
||||||
@ -348,7 +414,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadMore() {
|
loadMore() {
|
||||||
let requestArr = ['myPublicList', 'myPrivateList', 'myLikedList'];
|
// let requestArr = ['myPublicList', 'myPrivateList', 'myLikedList'];
|
||||||
|
let requestArr = ['myPublicList', 'myLikedList'];
|
||||||
if (this.page >= this.toalPage) {
|
if (this.page >= this.toalPage) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -362,7 +429,7 @@ export default {
|
|||||||
var uinfo = storage.getVlogUserInfo();
|
var uinfo = storage.getVlogUserInfo();
|
||||||
if (uinfo == null) return;
|
if (uinfo == null) return;
|
||||||
let userId = uinfo.id;
|
let userId = uinfo.id;
|
||||||
var result = await vlogMeTag(requrl, page, 20, userId);
|
var result = await vlogMeTag(requrl, page, 10, userId);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
let vlogList = result.data.data.rows;
|
let vlogList = result.data.data.rows;
|
||||||
console.log(vlogList);
|
console.log(vlogList);
|
||||||
@ -730,6 +797,17 @@ export default {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
}
|
}
|
||||||
|
.vlogBox {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.rightLike {
|
||||||
|
position: absolute;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
left: 5px;
|
||||||
|
bottom: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
.empty-text {
|
.empty-text {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
@ -759,7 +837,7 @@ export default {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -260rpx;
|
top: -400rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.isLogin-info-wrapper {
|
.isLogin-info-wrapper {
|
||||||
|
@ -95,6 +95,9 @@ export default {
|
|||||||
me.bgUrl = newBg;
|
me.bgUrl = newBg;
|
||||||
// 上传
|
// 上传
|
||||||
let serverUrl = api.vlog;
|
let serverUrl = api.vlog;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中'
|
||||||
|
});
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
header: {
|
header: {
|
||||||
headerUserId: userId,
|
headerUserId: userId,
|
||||||
@ -127,6 +130,9 @@ export default {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
complete() {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<text
|
<text
|
||||||
class="operator-words"
|
class="operator-words"
|
||||||
style="color: #ef274d"
|
style="color: #ef274d"
|
||||||
@click="followMe(f.fanId)"
|
@click="followMe(f)"
|
||||||
>
|
>
|
||||||
回粉
|
回粉
|
||||||
</text>
|
</text>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<text
|
<text
|
||||||
class="operator-words"
|
class="operator-words"
|
||||||
style="color: #ffffff"
|
style="color: #ffffff"
|
||||||
@click="cancelFollow(f.fanId)"
|
@click="cancelFollow(f)"
|
||||||
>
|
>
|
||||||
互粉
|
互粉
|
||||||
</text>
|
</text>
|
||||||
@ -58,7 +58,7 @@
|
|||||||
let system = uni.getSystemInfoSync();
|
let system = uni.getSystemInfoSync();
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { vlogFansCancel, vlogFansFollow, vlogQueryMyFans } from '@/api/vlog';
|
import { vlogFansCancel, vlogFansFollow, vlogQueryMyFans } from '@/api/vlog';
|
||||||
import { isStrEmpty } from '@/utils/tools.js';
|
import { isStrEmpty, clickFeedBack } from '@/utils/tools.js';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -70,7 +70,15 @@ export default {
|
|||||||
from: false
|
from: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
console.log('组件销毁');
|
||||||
|
// 销毁时关闭 BroadcastChannel
|
||||||
|
if (this.channelComment) {
|
||||||
|
this.channelComment.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(param) {
|
onLoad(param) {
|
||||||
|
this.channelComment = new BroadcastChannel('comment-counts');
|
||||||
if (!isStrEmpty(param.userId)) {
|
if (!isStrEmpty(param.userId)) {
|
||||||
this.from = true;
|
this.from = true;
|
||||||
this.userId = param.userId;
|
this.userId = param.userId;
|
||||||
@ -107,17 +115,26 @@ export default {
|
|||||||
}
|
}
|
||||||
me.fansList = fansList;
|
me.fansList = fansList;
|
||||||
},
|
},
|
||||||
async cancelFollow(vlogerId) {
|
async cancelFollow(item) {
|
||||||
|
clickFeedBack();
|
||||||
let me = this;
|
let me = this;
|
||||||
let userId = me.userId;
|
let userId = me.userId;
|
||||||
let data = {
|
let data = {
|
||||||
myId: userId,
|
myId: userId,
|
||||||
vlogerId
|
vlogerId: item.fanId
|
||||||
};
|
};
|
||||||
var result = await vlogFansCancel(data);
|
var result = await vlogFansCancel(data);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
me.reFreshList(vlogerId, 0);
|
me.reFreshList(item.fanId, 0);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: false, from: 'refresh', vlogerId: item.fanId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -126,17 +143,26 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async followMe(vlogerId) {
|
async followMe(item) {
|
||||||
|
clickFeedBack();
|
||||||
let me = this;
|
let me = this;
|
||||||
let userId = me.userId;
|
let userId = me.userId;
|
||||||
let data = {
|
let data = {
|
||||||
myId: userId,
|
myId: userId,
|
||||||
vlogerId
|
vlogerId: item.fanId
|
||||||
};
|
};
|
||||||
var result = await vlogFansFollow(data);
|
var result = await vlogFansFollow(data);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
me.reFreshList(vlogerId, 1);
|
me.reFreshList(item.fanId, 1);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: true, from: 'refresh', vlogerId: item.fanId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<text
|
<text
|
||||||
class="operator-words"
|
class="operator-words"
|
||||||
style="color: #ef274d"
|
style="color: #ef274d"
|
||||||
@click="cancelFollow(f.vlogerId)"
|
@click="cancelFollow(f)"
|
||||||
>
|
>
|
||||||
已关注
|
已关注
|
||||||
</text>
|
</text>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<text
|
<text
|
||||||
class="operator-words"
|
class="operator-words"
|
||||||
style="color: #ffffff"
|
style="color: #ffffff"
|
||||||
@click="cancelFollow(f.vlogerId)"
|
@click="cancelFollow(f)"
|
||||||
>
|
>
|
||||||
互关
|
互关
|
||||||
</text>
|
</text>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { vlogFansCancel, vlogFansFollow, vlogQueryMyFollows } from '@/api/vlog';
|
import { vlogFansCancel, vlogFansFollow, vlogQueryMyFollows } from '@/api/vlog';
|
||||||
import { isStrEmpty } from '@/utils/tools.js';
|
import { isStrEmpty, clickFeedBack } from '@/utils/tools.js';
|
||||||
let system = uni.getSystemInfoSync();
|
let system = uni.getSystemInfoSync();
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -67,10 +67,19 @@ export default {
|
|||||||
page: 0,
|
page: 0,
|
||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
followsList: [],
|
followsList: [],
|
||||||
from: false
|
from: false,
|
||||||
|
channelComment: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
console.log('组件销毁');
|
||||||
|
// 销毁时关闭 BroadcastChannel
|
||||||
|
if (this.channelComment) {
|
||||||
|
this.channelComment.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(param) {
|
onLoad(param) {
|
||||||
|
this.channelComment = new BroadcastChannel('comment-counts');
|
||||||
if (!isStrEmpty(param.userId)) {
|
if (!isStrEmpty(param.userId)) {
|
||||||
this.from = true;
|
this.from = true;
|
||||||
this.userId = param.userId;
|
this.userId = param.userId;
|
||||||
@ -106,17 +115,26 @@ export default {
|
|||||||
}
|
}
|
||||||
me.followsList = followsList;
|
me.followsList = followsList;
|
||||||
},
|
},
|
||||||
async cancelFollow(vlogerId) {
|
async cancelFollow(item) {
|
||||||
|
clickFeedBack();
|
||||||
let me = this;
|
let me = this;
|
||||||
let userId = this.userId;
|
let userId = this.userId;
|
||||||
var data = {
|
var data = {
|
||||||
myId: userId,
|
myId: userId,
|
||||||
vlogerId
|
vlogerId: item.vlogerId
|
||||||
};
|
};
|
||||||
var result = await vlogFansCancel(data);
|
var result = await vlogFansCancel(data);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
me.reFreshList(vlogerId, 0);
|
me.reFreshList(item.vlogerId, 0);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: false, from: 'refresh', vlogerId: item.vlogerId, vlogId: item.vlogId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -126,6 +144,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async followMe(vlogerId) {
|
async followMe(vlogerId) {
|
||||||
|
clickFeedBack();
|
||||||
let me = this;
|
let me = this;
|
||||||
let userId = this.userId;
|
let userId = this.userId;
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<view
|
<view
|
||||||
class="mheader"
|
class="mheader"
|
||||||
:style="{ marginTop: deleteHeight + 'px' }"
|
:style="{ marginTop: statusBarHeight + 'px' }"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="header-left"
|
class="header-left"
|
||||||
@ -102,7 +102,7 @@
|
|||||||
:show-fullscreen-btn="false"
|
:show-fullscreen-btn="false"
|
||||||
:show-center-play-btn="false"
|
:show-center-play-btn="false"
|
||||||
:style="boxStyle"
|
:style="boxStyle"
|
||||||
:object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
:object-fit="item.width >= item.height ? 'contain' : 'cover'"
|
||||||
@timeupdate="timeupdate($event, i)"
|
@timeupdate="timeupdate($event, i)"
|
||||||
:poster="item.firstFrameImg"
|
:poster="item.firstFrameImg"
|
||||||
></video>
|
></video>
|
||||||
@ -110,8 +110,8 @@
|
|||||||
<image
|
<image
|
||||||
v-if="!item.playIng"
|
v-if="!item.playIng"
|
||||||
:src="item.firstFrameImg"
|
:src="item.firstFrameImg"
|
||||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
:mode="item.width >= item.height ? 'aspectFit' : 'aspectFit'"
|
||||||
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 'px; position: absolute;'"
|
:style="'width: ' + windowWidth + 'px; height: ' + boxStyle.height + 26 + 'px; position: absolute;'"
|
||||||
></image>
|
></image>
|
||||||
<!--
|
<!--
|
||||||
mode: 图片裁剪、缩放的模式
|
mode: 图片裁剪、缩放的模式
|
||||||
@ -149,7 +149,7 @@
|
|||||||
v-if="!item.doIFollowVloger && userId != item.vlogerId"
|
v-if="!item.doIFollowVloger && userId != item.vlogerId"
|
||||||
src="/static/images/icon-follow.png"
|
src="/static/images/icon-follow.png"
|
||||||
class="follow-me"
|
class="follow-me"
|
||||||
@click="followMe(item.vlogerId)"
|
@click="followMe(item)"
|
||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- 2.点赞 -->
|
<!-- 2.点赞 -->
|
||||||
@ -427,7 +427,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { graceNumber } from '@/utils/tools.js';
|
import { graceNumber, clickFeedBack } from '@/utils/tools.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import { vlogDetail, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
import { vlogDetail, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
||||||
/*
|
/*
|
||||||
@ -514,7 +514,8 @@ export default {
|
|||||||
isPrivate: 0
|
isPrivate: 0
|
||||||
},
|
},
|
||||||
vlogId: '',
|
vlogId: '',
|
||||||
channelComment: null
|
channelComment: null,
|
||||||
|
statusBarHeight: uni.getSystemInfoSync().statusBarHeight
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// components: {
|
// components: {
|
||||||
@ -577,6 +578,13 @@ export default {
|
|||||||
let vlogId = option.vlogId || 1;
|
let vlogId = option.vlogId || 1;
|
||||||
this.vlogId = vlogId;
|
this.vlogId = vlogId;
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
console.log('视频详情组件销毁');
|
||||||
|
// 销毁时关闭 BroadcastChannel
|
||||||
|
if (this.channelComment) {
|
||||||
|
this.channelComment.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
// created() {
|
// created() {
|
||||||
// this.channel = new BroadcastChannel('video-progress');
|
// this.channel = new BroadcastChannel('video-progress');
|
||||||
// },
|
// },
|
||||||
@ -594,16 +602,16 @@ export default {
|
|||||||
this.platform = uni.getSystemInfoSync().platform;
|
this.platform = uni.getSystemInfoSync().platform;
|
||||||
var model = uni.getSystemInfoSync().model;
|
var model = uni.getSystemInfoSync().model;
|
||||||
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
if (this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')) {
|
||||||
// this.deleteHeight = 32; //有 tabbar的 修改这里可以改变视频高度
|
this.deleteHeight = 0; //有 tabbar的 修改这里可以改变视频高度
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 26; //进度条高度16,点高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.heightNum = 1.27;
|
this.heightNum = 1.27;
|
||||||
} else {
|
} else {
|
||||||
// this.deleteHeight = 0;
|
this.deleteHeight = 0;
|
||||||
this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
// this.deleteHeight = uni.getSystemInfoSync().statusBarHeight + 16; // 安卓只处理进度条高度10
|
||||||
/*
|
/*
|
||||||
引入评论参数
|
引入评论参数
|
||||||
*/
|
*/
|
||||||
@ -617,7 +625,8 @@ export default {
|
|||||||
// 控制渲染 -- end
|
// 控制渲染 -- end
|
||||||
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
|
||||||
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
this.boxStyle.width = this.windowWidth + 'px'; //给宽度加px
|
||||||
this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
// this.wHeight = uni.getSystemInfoSync().screenHeight; //获取屏幕高度
|
||||||
|
this.wHeight = uni.getSystemInfoSync().windowHeight; //获取屏幕可用高度
|
||||||
console.log(this.wHeight);
|
console.log(this.wHeight);
|
||||||
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
this.boxStyle.height = this.wHeight - this.deleteHeight; //改变视频高度
|
||||||
console.log(this.boxStyle);
|
console.log(this.boxStyle);
|
||||||
@ -651,7 +660,8 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 关注博主
|
// 关注博主
|
||||||
async followMe(vlogerId) {
|
async followMe(item) {
|
||||||
|
clickFeedBack();
|
||||||
var myUserInfo = storage.getVlogUserInfo();
|
var myUserInfo = storage.getVlogUserInfo();
|
||||||
if (myUserInfo == null) {
|
if (myUserInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -661,10 +671,19 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var userId = myUserInfo.id;
|
var userId = myUserInfo.id;
|
||||||
var result = await vlogFollow(userId, vlogerId);
|
var result = await vlogFollow(userId, item.vlogerId);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
// 关注成功后修改当前数据的状态
|
// 关注成功后修改当前数据的状态
|
||||||
this.dataList[this.k].doIFollowVloger = true;
|
this.dataList[this.k].doIFollowVloger = true;
|
||||||
|
// 同步修改视频列表数据
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: true, from: 'refresh', vlogerId: item.vlogerId, vlogId: item.vlogId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -678,6 +697,8 @@ export default {
|
|||||||
return graceNumber(num);
|
return graceNumber(num);
|
||||||
},
|
},
|
||||||
async likeOrDislikeVlog(item) {
|
async likeOrDislikeVlog(item) {
|
||||||
|
console.log(item);
|
||||||
|
clickFeedBack();
|
||||||
var info = storage.getVlogUserInfo();
|
var info = storage.getVlogUserInfo();
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
this.userId = info.id;
|
this.userId = info.id;
|
||||||
@ -701,8 +722,19 @@ export default {
|
|||||||
});
|
});
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts++;
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
|
console.log('是否执行通道');
|
||||||
|
try {
|
||||||
|
console.log(item.vlogId);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: true, from: 'refreshLike', vlogId: item.vlogId }
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
// item.likeCounts++;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -718,8 +750,13 @@ export default {
|
|||||||
vlogId: item.vlogId
|
vlogId: item.vlogId
|
||||||
});
|
});
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.likeCounts--;
|
// item.likeCounts--;
|
||||||
|
this.refreshVlogCounts();
|
||||||
item.doILikeThisVlog = !item.doILikeThisVlog;
|
item.doILikeThisVlog = !item.doILikeThisVlog;
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: false, from: 'refreshLike', vlogId: item.vlogId }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
|
@ -171,7 +171,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="vlog-list">
|
<view class="vlog-list">
|
||||||
<block
|
<view
|
||||||
|
class="vlogBox"
|
||||||
v-for="(vlog, index) in vlogList"
|
v-for="(vlog, index) in vlogList"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
@ -181,7 +182,14 @@
|
|||||||
@click="goToVlog(vlog)"
|
@click="goToVlog(vlog)"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
></image>
|
></image>
|
||||||
</block>
|
<view class="rightLike">
|
||||||
|
<image
|
||||||
|
src="/static/images/icon-unlike.png"
|
||||||
|
style="width: 30rpx; height: 30rpx"
|
||||||
|
></image>
|
||||||
|
<text style="color: #ffffff">{{ getGraceNumber(vlog.likeCounts) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
@ -203,7 +211,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
let system = uni.getSystemInfoSync();
|
let system = uni.getSystemInfoSync();
|
||||||
import * as filters from '@/utils/filters.js';
|
import { clickFeedBack } from '@/utils/tools.js';
|
||||||
import api from '@/config/api.js';
|
import api from '@/config/api.js';
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { vlogUserInfo, vlogQueryDoIFollowVloger, vlogMyPublicList, vlogMyPrivateList, vlogMyLikedList, vlogMeTag, vlogFansCancel, vlogFansFollow } from '@/api/vlog';
|
import { vlogUserInfo, vlogQueryDoIFollowVloger, vlogMyPublicList, vlogMyPrivateList, vlogMyLikedList, vlogMeTag, vlogFansCancel, vlogFansFollow } from '@/api/vlog';
|
||||||
@ -244,10 +252,19 @@ export default {
|
|||||||
|
|
||||||
page: 0,
|
page: 0,
|
||||||
totalpage: 0,
|
totalpage: 0,
|
||||||
vlogList: []
|
vlogList: [],
|
||||||
|
channelComment: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
console.log('博主信息页面销毁');
|
||||||
|
// 销毁时关闭 BroadcastChannel
|
||||||
|
if (this.channelComment) {
|
||||||
|
this.channelComment.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
async onLoad(params) {
|
async onLoad(params) {
|
||||||
|
this.channelComment = new BroadcastChannel('comment-counts');
|
||||||
this.statusBarHeight = system.statusBarHeight;
|
this.statusBarHeight = system.statusBarHeight;
|
||||||
let screenHeight = system.safeArea.bottom + 50;
|
let screenHeight = system.safeArea.bottom + 50;
|
||||||
this.screenHeight = screenHeight;
|
this.screenHeight = screenHeight;
|
||||||
@ -350,7 +367,8 @@ export default {
|
|||||||
if (this.page >= this.toalPage) {
|
if (this.page >= this.toalPage) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
this.myList(this.page);
|
var prop = ['myPublicList', 'myLikedList'];
|
||||||
|
this.myList(this.page, prop[this.currentTab]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async myList(page, requrl, init = false) {
|
async myList(page, requrl, init = false) {
|
||||||
@ -358,7 +376,7 @@ export default {
|
|||||||
page = page + 1;
|
page = page + 1;
|
||||||
me.page = page;
|
me.page = page;
|
||||||
let userId = me.userPageId;
|
let userId = me.userPageId;
|
||||||
var result = await vlogMeTag(requrl, page, 20, userId);
|
var result = await vlogMeTag(requrl, page, 10, userId);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
let vlogList = result.data.data.rows;
|
let vlogList = result.data.data.rows;
|
||||||
console.log(vlogList);
|
console.log(vlogList);
|
||||||
@ -378,6 +396,15 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async cancelFollow() {
|
async cancelFollow() {
|
||||||
|
var myUserInfo = storage.getVlogUserInfo();
|
||||||
|
if (myUserInfo == null) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/passport/login',
|
||||||
|
animationType: 'slide-in-bottom'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clickFeedBack();
|
||||||
let me = this;
|
let me = this;
|
||||||
let vlogerId = me.userPageId;
|
let vlogerId = me.userPageId;
|
||||||
let userId = storage.getVlogUserInfo().id;
|
let userId = storage.getVlogUserInfo().id;
|
||||||
@ -388,6 +415,14 @@ export default {
|
|||||||
// 刷新当前页的粉丝数
|
// 刷新当前页的粉丝数
|
||||||
let pendingInfo = me.pageUserInfo;
|
let pendingInfo = me.pageUserInfo;
|
||||||
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts - 1;
|
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts - 1;
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: false, from: 'refresh', vlogerId: vlogerId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -399,7 +434,14 @@ export default {
|
|||||||
async followMe() {
|
async followMe() {
|
||||||
let me = this;
|
let me = this;
|
||||||
let myUserInfo = storage.getVlogUserInfo();
|
let myUserInfo = storage.getVlogUserInfo();
|
||||||
|
if (myUserInfo == null) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/passport/login',
|
||||||
|
animationType: 'slide-in-bottom'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clickFeedBack();
|
||||||
let vlogerId = me.userPageId;
|
let vlogerId = me.userPageId;
|
||||||
let userId = myUserInfo.id;
|
let userId = myUserInfo.id;
|
||||||
var result = await vlogFansFollow({ myId: userId, vlogerId: vlogerId });
|
var result = await vlogFansFollow({ myId: userId, vlogerId: vlogerId });
|
||||||
@ -409,6 +451,14 @@ export default {
|
|||||||
// 刷新当前页的粉丝数
|
// 刷新当前页的粉丝数
|
||||||
let pendingInfo = me.pageUserInfo;
|
let pendingInfo = me.pageUserInfo;
|
||||||
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts + 1;
|
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts + 1;
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: true, from: 'refresh', vlogerId: vlogerId }
|
||||||
|
});
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { from: 'initGuanzhu' }
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -449,7 +499,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style>
|
||||||
.header-right-search {
|
.header-right-search {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
@ -523,6 +573,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
width: 130rpx;
|
width: 130rpx;
|
||||||
@ -593,6 +644,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.bottom {
|
.bottom {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -683,6 +735,17 @@ export default {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
}
|
}
|
||||||
|
.vlogBox {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.rightLike {
|
||||||
|
position: absolute;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
left: 5px;
|
||||||
|
bottom: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
.empty {
|
.empty {
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
@ -703,7 +766,7 @@ export default {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -260rpx;
|
top: -400rpx;
|
||||||
}
|
}
|
||||||
.isLogin-info-wrapper {
|
.isLogin-info-wrapper {
|
||||||
}
|
}
|
||||||
|
@ -563,6 +563,7 @@ export default {
|
|||||||
// 将vlog的token和vlog用户信息放入缓存
|
// 将vlog的token和vlog用户信息放入缓存
|
||||||
storage.setVlogToken(vlogInfo.userToken);
|
storage.setVlogToken(vlogInfo.userToken);
|
||||||
storage.setVlogUserInfo(vlogInfo);
|
storage.setVlogUserInfo(vlogInfo);
|
||||||
|
storage.setRefreshVlogIndex('1');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录成功后获取个人信息
|
* 登录成功后获取个人信息
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
:model="searchContent"
|
:model="searchContent"
|
||||||
:value="searchContent"
|
:value="searchContent"
|
||||||
@input="typingContent"
|
@input="typingContent"
|
||||||
@confirm=""
|
@confirm="doSearch"
|
||||||
|
confirm-type="search"
|
||||||
placeholder="请输入内容~"
|
placeholder="请输入内容~"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
class="search-input"
|
class="search-input"
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
:model="searchContent"
|
:model="searchContent"
|
||||||
:value="searchContent"
|
:value="searchContent"
|
||||||
@input="typingContent"
|
@input="typingContent"
|
||||||
|
@confirm="doSearch"
|
||||||
|
confirm-type="search"
|
||||||
placeholder="请输入内容~"
|
placeholder="请输入内容~"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
class="search-input"
|
class="search-input"
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
<view class="flxbox">
|
<view class="flxbox">
|
||||||
<view class="bottom-info">
|
<view class="bottom-info">
|
||||||
<u-image
|
<u-image
|
||||||
width="30rpx"
|
width="40rpx"
|
||||||
height="30rpx"
|
height="40rpx"
|
||||||
:src="item.vlogerFace"
|
:src="item.vlogerFace"
|
||||||
loading-icon="/static/missing-face.png"
|
loading-icon="/static/missing-face.png"
|
||||||
error-icon="/static/missing-face.png"
|
error-icon="/static/missing-face.png"
|
||||||
@ -34,7 +34,7 @@
|
|||||||
></u-image>
|
></u-image>
|
||||||
<view class="showOne ml">{{ item.vlogerName }}</view>
|
<view class="showOne ml">{{ item.vlogerName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-info">
|
<view class="bottom-info pdr">
|
||||||
<image
|
<image
|
||||||
style="width: 20rpx; height: 20rpx"
|
style="width: 20rpx; height: 20rpx"
|
||||||
src="/static/images/icon-comment-unlike.png"
|
src="/static/images/icon-comment-unlike.png"
|
||||||
@ -62,8 +62,8 @@
|
|||||||
<view class="flxbox">
|
<view class="flxbox">
|
||||||
<view class="bottom-info">
|
<view class="bottom-info">
|
||||||
<u-image
|
<u-image
|
||||||
width="30rpx"
|
width="40rpx"
|
||||||
height="30rpx"
|
height="40rpx"
|
||||||
loading-icon="/static/missing-face.png"
|
loading-icon="/static/missing-face.png"
|
||||||
error-icon="/static/missing-face.png"
|
error-icon="/static/missing-face.png"
|
||||||
:src="item.vlogerFace"
|
:src="item.vlogerFace"
|
||||||
@ -72,7 +72,7 @@
|
|||||||
></u-image>
|
></u-image>
|
||||||
<view class="showOne ml">{{ item.vlogerName }}</view>
|
<view class="showOne ml">{{ item.vlogerName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-info">
|
<view class="bottom-info pdr">
|
||||||
<image
|
<image
|
||||||
style="width: 20rpx; height: 20rpx"
|
style="width: 20rpx; height: 20rpx"
|
||||||
src="/static/images/icon-comment-unlike.png"
|
src="/static/images/icon-comment-unlike.png"
|
||||||
@ -179,7 +179,7 @@ export default {
|
|||||||
clear() {
|
clear() {
|
||||||
var dom = this.$refs.uWaterfall;
|
var dom = this.$refs.uWaterfall;
|
||||||
if (dom) {
|
if (dom) {
|
||||||
clear();
|
dom.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ export default {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
padding: 8px;
|
padding: 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 329rpx;
|
max-width: 329rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -207,7 +207,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.showOne {
|
.showOne {
|
||||||
width: 200rpx;
|
width: 180rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@ -240,4 +241,7 @@ export default {
|
|||||||
display: block;
|
display: block;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
.pdr {
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
:key="i.id"
|
:key="i.id"
|
||||||
>
|
>
|
||||||
<u-image
|
<u-image
|
||||||
|
@click="tozuozhe(i.id)"
|
||||||
:src="i.face"
|
:src="i.face"
|
||||||
class="flxleft"
|
class="flxleft"
|
||||||
width="120"
|
width="120"
|
||||||
@ -18,15 +19,28 @@
|
|||||||
style="display: flex; align-items: center"
|
style="display: flex; align-items: center"
|
||||||
></u-image>
|
></u-image>
|
||||||
|
|
||||||
<view class="flxcenter">
|
<view
|
||||||
|
class="flxcenter"
|
||||||
|
@click="tozuozhe(i.id)"
|
||||||
|
>
|
||||||
<view class="nkname">{{ i.nickname }}</view>
|
<view class="nkname">{{ i.nickname }}</view>
|
||||||
<!-- <view class="fans">粉丝:125.2万</view> -->
|
<view
|
||||||
|
class="fans"
|
||||||
|
v-if="i.myFansCounts"
|
||||||
|
>
|
||||||
|
粉丝:{{ getGraceNumber(i.myFansCounts || 0) }}
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="fans"
|
||||||
|
v-if="i.totalLikeMeCounts"
|
||||||
|
>
|
||||||
|
获赞:{{ getGraceNumber(i.totalLikeMeCounts || 0) }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flxright">
|
<view class="flxright">
|
||||||
<u-button
|
<u-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="follow(i)"
|
@click="follow(i)"
|
||||||
size="mini"
|
|
||||||
v-if="i.followStatus == '未关注'"
|
v-if="i.followStatus == '未关注'"
|
||||||
>
|
>
|
||||||
关注
|
关注
|
||||||
@ -35,7 +49,6 @@
|
|||||||
v-else
|
v-else
|
||||||
type="plain"
|
type="plain"
|
||||||
@click="cancelFollow(i)"
|
@click="cancelFollow(i)"
|
||||||
size="mini"
|
|
||||||
>
|
>
|
||||||
{{ i.followStatus }}
|
{{ i.followStatus }}
|
||||||
</u-button>
|
</u-button>
|
||||||
@ -59,7 +72,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage.js'; //缓存
|
import storage from '@/utils/storage.js'; //缓存
|
||||||
import { vlogSearchUser, vlogFansFollow, vlogFansCancel } from '@/api/vlog';
|
import { vlogSearchUser, vlogFansFollow, vlogFansCancel, vlogQueryDoIFollowVloger } from '@/api/vlog';
|
||||||
|
import { clickFeedBack, graceNumber } from '@/utils/tools.js';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
keywords: {
|
keywords: {
|
||||||
@ -74,13 +88,31 @@ export default {
|
|||||||
page: 0,
|
page: 0,
|
||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
search: '',
|
search: '',
|
||||||
id: ''
|
id: '',
|
||||||
|
channelComment: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
console.log('查询用户组件销毁');
|
||||||
|
// 销毁时关闭 BroadcastChannel
|
||||||
|
if (this.channelComment) {
|
||||||
|
this.channelComment.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initData();
|
this.initData();
|
||||||
|
this.channelComment = new BroadcastChannel('comment-counts');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 把超过1000或10000的数字调整, 比如1.3k/6.8w
|
||||||
|
getGraceNumber(num) {
|
||||||
|
return graceNumber(num);
|
||||||
|
},
|
||||||
|
tozuozhe(userId) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/me/vlogerInfo?userPageId=' + userId
|
||||||
|
});
|
||||||
|
},
|
||||||
async getData() {
|
async getData() {
|
||||||
if (this.loadStatus !== 'loadmore') return;
|
if (this.loadStatus !== 'loadmore') return;
|
||||||
var info = storage.getVlogUserInfo();
|
var info = storage.getVlogUserInfo();
|
||||||
@ -134,6 +166,7 @@ export default {
|
|||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
async follow(item) {
|
async follow(item) {
|
||||||
|
clickFeedBack();
|
||||||
let userInfo = storage.getVlogUserInfo();
|
let userInfo = storage.getVlogUserInfo();
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -149,7 +182,18 @@ export default {
|
|||||||
var result = await vlogFansFollow(data);
|
var result = await vlogFansFollow(data);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.followStatus = '已关注';
|
var bothFrd = await vlogQueryDoIFollowVloger({ myId: item.id, vlogerId: userInfo.id });
|
||||||
|
if (bothFrd.data.data) {
|
||||||
|
item.followStatus = '互相关注';
|
||||||
|
} else {
|
||||||
|
item.followStatus = '已关注';
|
||||||
|
}
|
||||||
|
console.log(bothFrd);
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: true, from: 'refresh', vlogerId: item.id, vlogId: item.vlogId }
|
||||||
|
});
|
||||||
|
item.myFansCounts++;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -159,6 +203,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async cancelFollow(item) {
|
async cancelFollow(item) {
|
||||||
|
clickFeedBack();
|
||||||
let userInfo = storage.getVlogUserInfo();
|
let userInfo = storage.getVlogUserInfo();
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -174,7 +219,12 @@ export default {
|
|||||||
var result = await vlogFansCancel(data);
|
var result = await vlogFansCancel(data);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if (result.data.status == 200) {
|
if (result.data.status == 200) {
|
||||||
item.doIflow = false;
|
item.followStatus = '未关注';
|
||||||
|
this.channelComment.postMessage({
|
||||||
|
type: 'comment-counts',
|
||||||
|
data: { flag: false, from: 'refresh', vlogerId: item.id, vlogId: item.vlogId }
|
||||||
|
});
|
||||||
|
item.myFansCounts--;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: result.data.msg,
|
title: result.data.msg,
|
||||||
@ -212,11 +262,11 @@ export default {
|
|||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 26rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
.fans {
|
.fans {
|
||||||
font-size: 24rpx;
|
font-size: 26rpx;
|
||||||
color: #999;
|
color: #000;
|
||||||
}
|
}
|
||||||
.flxright {
|
.flxright {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
@ -247,6 +247,7 @@ export default {
|
|||||||
storage.setRefreshVlogIndex('0'); //初始完数据修改状态不需要刷新
|
storage.setRefreshVlogIndex('0'); //初始完数据修改状态不需要刷新
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
console.log('index刷新子组件');
|
||||||
this.$refs[prop].showVd();
|
this.$refs[prop].showVd();
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
@ -272,14 +273,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
handleHuaWei() {
|
handleHuaWei() {
|
||||||
// 处理华为机型问题
|
// 处理华为机型问题
|
||||||
const deviceInfo = uni.getSystemInfoSync();
|
// #ifdef APP-HARMONY
|
||||||
console.log(deviceInfo.brand);
|
uni.setTabBarStyle({
|
||||||
if (deviceInfo.brand === 'HUAWEI') {
|
color: '#e8e8e8'
|
||||||
// 针对华为设备,修改 Tabbar 样式
|
});
|
||||||
uni.setTabBarStyle({
|
// #endif
|
||||||
color: '#e8e8e8'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
getLocation() {
|
getLocation() {
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
getUserimInfo
|
getUserimInfo
|
||||||
} from '@/api/members';
|
} from '@/api/members';
|
||||||
|
import {
|
||||||
|
refreshTokenFn
|
||||||
|
} from "@/api/login.js";
|
||||||
|
|
||||||
|
import storage from "@/utils/storage.js";
|
||||||
|
// ---------------------------
|
||||||
import {
|
import {
|
||||||
TUILogin
|
TUILogin
|
||||||
} from '@tencentcloud/tui-core';
|
} from '@tencentcloud/tui-core';
|
||||||
@ -18,7 +23,6 @@ import {
|
|||||||
|
|
||||||
import * as Push from '@/uni_modules/TencentCloud-Push';
|
import * as Push from '@/uni_modules/TencentCloud-Push';
|
||||||
|
|
||||||
import storage from "@/utils/storage.js";
|
|
||||||
|
|
||||||
// sdkStateNotReady IM断了
|
// sdkStateNotReady IM断了
|
||||||
// onMessageReceived 收到推送的单聊、群聊、群提示、群系统通知的新消息
|
// onMessageReceived 收到推送的单聊、群聊、群提示、群系统通知的新消息
|
||||||
@ -26,11 +30,11 @@ import storage from "@/utils/storage.js";
|
|||||||
// im断开链接时
|
// im断开链接时
|
||||||
const onSdkNotReady = function(event) {
|
const onSdkNotReady = function(event) {
|
||||||
console.log('IM断了')
|
console.log('IM断了')
|
||||||
var islogin = storage.getVlogUserInfo();
|
// var islogin = storage.getVlogUserInfo();
|
||||||
if (islogin != null) {
|
// if (islogin != null) {
|
||||||
// 重新执行IM登录
|
// // 重新执行IM登录
|
||||||
loginIm()
|
// loginIm()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
const onMessageReceived = function(event) {
|
const onMessageReceived = function(event) {
|
||||||
@ -71,8 +75,23 @@ const pushMsgBack = (res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const loginIm = () => {
|
export const loginIm = async () => {
|
||||||
console.log('执行im登录')
|
console.log('执行im登录')
|
||||||
|
if (storage.getRefreshToken() && storage.getHasLogin()) {
|
||||||
|
var tokenResult = await refreshTokenFn(storage.getRefreshToken())
|
||||||
|
if (tokenResult.data.result) {
|
||||||
|
var {
|
||||||
|
accessToken,
|
||||||
|
refreshToken
|
||||||
|
} = tokenResult.data.result;
|
||||||
|
storage.setAccessToken(accessToken);
|
||||||
|
storage.setRefreshToken(refreshToken);
|
||||||
|
console.log('----------IM初始化登录--------------刷新token成功')
|
||||||
|
} else {
|
||||||
|
console.log('-------------------IM初始化登录-----刷新token失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
getUserimInfo()
|
getUserimInfo()
|
||||||
.then(({
|
.then(({
|
||||||
data
|
data
|
||||||
|
@ -205,6 +205,7 @@ http.interceptors.response.use(
|
|||||||
(response.statusCode == 200 && !response.data.success) ||
|
(response.statusCode == 200 && !response.data.success) ||
|
||||||
response.statusCode == 400
|
response.statusCode == 400
|
||||||
) {
|
) {
|
||||||
|
<<<<<<< Updated upstream
|
||||||
if (response.data.code == 408) {
|
if (response.data.code == 408) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@ -227,6 +228,31 @@ http.interceptors.response.use(
|
|||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
});
|
});
|
||||||
|
=======
|
||||||
|
if (response.data.message) {
|
||||||
|
if (response.data.code == 408) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: response.data.message,
|
||||||
|
showCancel: false,
|
||||||
|
success() {
|
||||||
|
logout().then(() => {
|
||||||
|
cleanStorage();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (response.data.code == 20003 || response.data.code == 20004) {
|
||||||
|
// rereshtoken也失效了=20004提示=用户已退出,请重新登录,身份凭证token过期=20003提示=用户未登录
|
||||||
|
cleanStorage();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 1500,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
} else if (response.data.code == 502) {
|
} else if (response.data.code == 502) {
|
||||||
cleanStorage();
|
cleanStorage();
|
||||||
|
@ -277,6 +277,26 @@ const dateFormat = (fmt, date) => {
|
|||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clickFeedBack = (fn) => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||||
|
let UIImpactFeedbackGenerator = plus.ios.importClass('UIImpactFeedbackGenerator');
|
||||||
|
let impact = new UIImpactFeedbackGenerator();
|
||||||
|
impact.prepare();
|
||||||
|
impact.init(2);
|
||||||
|
impact.impactOccurred();
|
||||||
|
}
|
||||||
|
if (uni.getSystemInfoSync().platform == 'android') {
|
||||||
|
// vibrateShort
|
||||||
|
uni.vibrateLong({
|
||||||
|
success: () => {
|
||||||
|
console.log('点击震动');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getNetworkType,
|
getNetworkType,
|
||||||
@ -288,5 +308,6 @@ export {
|
|||||||
isStrEmpty,
|
isStrEmpty,
|
||||||
getAstro,
|
getAstro,
|
||||||
getAnimal,
|
getAnimal,
|
||||||
dateFormat
|
dateFormat,
|
||||||
|
clickFeedBack
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user