shop
This commit is contained in:
commit
f1d1f5cc5c
103
App.vue
103
App.vue
@ -2,19 +2,20 @@
|
||||
/**
|
||||
* vuex管理登录状态,具体可以参考官方登录模板示例
|
||||
*/
|
||||
import { mapMutations } from "vuex";
|
||||
import APPUpdate from "@/plugins/APPUpdate";
|
||||
import { getClipboardData } from "@/js_sdk/h5-copy/h5-copy.js";
|
||||
import config from "@/config/config";
|
||||
import { mapMutations } from 'vuex';
|
||||
import APPUpdate from '@/plugins/APPUpdate';
|
||||
import { getClipboardData } from '@/js_sdk/h5-copy/h5-copy.js';
|
||||
import config from '@/config/config';
|
||||
// 区域code
|
||||
import provinceList from "./json/area_province.js";
|
||||
import cityList from "./json/area_city.js";
|
||||
import districtList from "./json/area_district.js";
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import provinceList from './json/area_province.js';
|
||||
import cityList from './json/area_city.js';
|
||||
import districtList from './json/area_district.js';
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
config
|
||||
};
|
||||
},
|
||||
|
||||
@ -22,23 +23,20 @@ export default {
|
||||
* 监听返回
|
||||
*/
|
||||
onBackPress(e) {
|
||||
if (e.from == "backbutton") {
|
||||
if (e.from == 'backbutton') {
|
||||
let routes = getCurrentPages();
|
||||
let curRoute = routes[routes.length - 1].options;
|
||||
routes.forEach((item) => {
|
||||
if (
|
||||
item.route == "pages/tabbar/cart/cartList" ||
|
||||
item.route.indexOf("pages/product/goods") != -1
|
||||
) {
|
||||
if (item.route == 'pages/tabbar/cart/cartList' || item.route.indexOf('pages/product/goods') != -1) {
|
||||
uni.redirectTo({
|
||||
url: item.route,
|
||||
url: item.route
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (curRoute.addId) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/tabbar/cart/cartList",
|
||||
url: '/pages/tabbar/cart/cartList'
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
@ -47,7 +45,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["login"]),
|
||||
...mapMutations(['login'])
|
||||
},
|
||||
onLaunch: function () {
|
||||
// #ifdef APP-PLUS
|
||||
@ -55,7 +53,7 @@ export default {
|
||||
APPUpdate();
|
||||
this.hanleTabCenter();
|
||||
// 重点是以下: 一定要监听后台恢复 !一定要
|
||||
plus.globalEvent.addEventListener("newintent", (e) => {
|
||||
plus.globalEvent.addEventListener('newintent', (e) => {
|
||||
this.checkArguments(); // 检测启动参数
|
||||
});
|
||||
// #endif
|
||||
@ -75,31 +73,30 @@ export default {
|
||||
hanleTabCenter() {
|
||||
// 点击中间的➕
|
||||
uni.onTabBarMidButtonTap(() => {
|
||||
console.log("center");
|
||||
console.log('center');
|
||||
// 未登录不能发布视频
|
||||
let myUserInfo = storage.getVlogUserInfo() || null;
|
||||
let myUserInfo = storage.getVlogUserInfo();
|
||||
if (myUserInfo == null) {
|
||||
uni.navigateTo({
|
||||
// url: "../loginRegist/loginRegist",
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom',
|
||||
success() {
|
||||
this.loginWords = "请登录";
|
||||
},
|
||||
this.loginWords = '请登录';
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.chooseVideo({
|
||||
sourceType: ["album"],
|
||||
sourceType: ['album'],
|
||||
compressed: false,
|
||||
success(e) {
|
||||
console.log(JSON.stringify(e));
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/publish/publish?fileObjectEvent=" + JSON.stringify(e),
|
||||
url: '/pages/publish/publish?fileObjectEvent=' + JSON.stringify(e)
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -115,14 +112,14 @@ export default {
|
||||
|
||||
updateManager.onUpdateReady(function (res) {
|
||||
uni.showModal({
|
||||
title: "更新提示",
|
||||
content: "发现新版本,是否重启应用?",
|
||||
title: '更新提示',
|
||||
content: '发现新版本,是否重启应用?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateFailed(function (res) {
|
||||
@ -134,20 +131,20 @@ export default {
|
||||
launch() {
|
||||
try {
|
||||
// 获取本地存储中launchFlag标识 开屏广告
|
||||
const value = uni.getStorageSync("launchFlag");
|
||||
const value = uni.getStorageSync('launchFlag');
|
||||
if (!value) {
|
||||
// this.$u.route("/pages/index/agreement");
|
||||
} else {
|
||||
//app启动时打开启动广告页
|
||||
var w = plus.webview.open(
|
||||
"/hybrid/html/advertise/advertise.html",
|
||||
"本地地址",
|
||||
'/hybrid/html/advertise/advertise.html',
|
||||
'本地地址',
|
||||
{
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
zindex: 999,
|
||||
zindex: 999
|
||||
},
|
||||
"fade-in",
|
||||
'fade-in',
|
||||
500
|
||||
);
|
||||
//设置定时器,4s后关闭启动广告页
|
||||
@ -159,11 +156,11 @@ export default {
|
||||
} catch (e) {
|
||||
// error
|
||||
uni.setStorage({
|
||||
key: "launchFlag",
|
||||
key: 'launchFlag',
|
||||
data: true,
|
||||
success: function () {
|
||||
console.log("error时存储launchFlag");
|
||||
},
|
||||
console.log('error时存储launchFlag');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -178,23 +175,23 @@ export default {
|
||||
*/
|
||||
if (res.indexOf(config.shareLink) != -1) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "检测到一个分享链接是否跳转?",
|
||||
confirmText: "跳转",
|
||||
title: '提示',
|
||||
content: '检测到一个分享链接是否跳转?',
|
||||
confirmText: '跳转',
|
||||
success: function (callback) {
|
||||
if (callback.confirm) {
|
||||
const path = res.split(config.shareLink)[1];
|
||||
if (path.indexOf("tabbar") != -1) {
|
||||
if (path.indexOf('tabbar') != -1) {
|
||||
uni.switchTab({
|
||||
url: path,
|
||||
url: path
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
url: path
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -208,27 +205,27 @@ export default {
|
||||
const args = plus.runtime.arguments;
|
||||
if (args) {
|
||||
const argsStr = decodeURIComponent(args);
|
||||
const path = argsStr.split("//")[1];
|
||||
if (path.indexOf("tabbar") != -1) {
|
||||
const path = argsStr.split('//')[1];
|
||||
if (path.indexOf('tabbar') != -1) {
|
||||
uni.switchTab({
|
||||
url: `/${path}`,
|
||||
url: `/${path}`
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/${path}`,
|
||||
url: `/${path}`
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* #ifndef APP-NVUE */
|
||||
@import "uview-ui/index.scss";
|
||||
@import 'uview-ui/index.scss';
|
||||
/* #endif */
|
||||
|
||||
// -------适配底部安全区 苹果x系列刘海屏
|
||||
|
197
api/vlog.js
197
api/vlog.js
@ -2,13 +2,39 @@
|
||||
* 短视频相关API
|
||||
*/
|
||||
|
||||
import { http, Method } from "@/utils/request.js";
|
||||
import {
|
||||
http,
|
||||
Method
|
||||
} from "@/utils/request.js";
|
||||
|
||||
import api from "@/config/api.js";
|
||||
|
||||
|
||||
/**
|
||||
* 短视频关注列表
|
||||
* 根据昵称搜索用户
|
||||
*/
|
||||
export function vlogSearchUser({
|
||||
id,
|
||||
nickname,
|
||||
page,
|
||||
pageSize
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/userInfo/searchByNickname",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: {
|
||||
id,
|
||||
nickname,
|
||||
page,
|
||||
pageSize
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 短视频详情
|
||||
*/
|
||||
export function vlogDetail(vlogId, userId) {
|
||||
let data = {
|
||||
@ -43,11 +69,12 @@ export function vlogFollowList(page, pageSize,myId) {
|
||||
/**
|
||||
* 短视频列表-true
|
||||
*/
|
||||
export function vlogList(page, pageSize,userId='',search='') {
|
||||
export function vlogList(page, pageSize, userId = '', cityCode = '', search = '') {
|
||||
let data = {
|
||||
page,
|
||||
pageSize,
|
||||
userId,
|
||||
cityCode,
|
||||
search
|
||||
}
|
||||
return http.request({
|
||||
@ -61,24 +88,40 @@ export function vlogList(page, pageSize,userId='',search='') {
|
||||
/**
|
||||
* 短视频喜欢
|
||||
*/
|
||||
export function vlogLike({userId,vlogId,vlogerId}) {
|
||||
export function vlogLike({
|
||||
userId,
|
||||
vlogId,
|
||||
vlogerId
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/vlog/like",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {userId,vlogId,vlogerId}
|
||||
params: {
|
||||
userId,
|
||||
vlogId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 短视频不喜欢
|
||||
*/
|
||||
export function vlogUnLike({userId,vlogId,vlogerId}) {
|
||||
export function vlogUnLike({
|
||||
userId,
|
||||
vlogId,
|
||||
vlogerId
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/vlog/unlike",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {userId,vlogId,vlogerId}
|
||||
params: {
|
||||
userId,
|
||||
vlogId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -90,7 +133,9 @@ export function vlogComment(vlogId) {
|
||||
url: api.vlog + "/comment/counts",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { vlogId },
|
||||
params: {
|
||||
vlogId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -106,7 +151,10 @@ export function vlogFollow(myId,vlogerId) {
|
||||
url: api.vlog + "/fans/follow",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {myId,vlogerId}
|
||||
params: {
|
||||
myId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -118,7 +166,9 @@ export function vlogTotalLikedCounts(vlogId) {
|
||||
url: api.vlog + "/vlog/totalLikedCounts",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {vlogId}
|
||||
params: {
|
||||
vlogId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -130,7 +180,9 @@ export function vlogUserInfo(userId) {
|
||||
url: api.vlog + "/userInfo/query",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { userId },
|
||||
params: {
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -142,7 +194,11 @@ export function vlogMyPublicList(page,pageSize,userId) {
|
||||
url: api.vlog + "/vlog/myPublicList",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { page,pageSize,userId },
|
||||
params: {
|
||||
page,
|
||||
pageSize,
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -154,7 +210,11 @@ export function vlogMyPrivateList(page,pageSize,userId) {
|
||||
url: api.vlog + "/vlog/myPrivateList",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { page,pageSize,userId },
|
||||
params: {
|
||||
page,
|
||||
pageSize,
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -166,7 +226,11 @@ export function vlogMyLikedList(page,pageSize,userId) {
|
||||
url: api.vlog + "/vlog/myLikedList",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { page,pageSize,userId },
|
||||
params: {
|
||||
page,
|
||||
pageSize,
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -178,7 +242,11 @@ export function vlogMeTag(path,page,pageSize,userId) {
|
||||
url: api.vlog + "/vlog/" + path,
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { page,pageSize,userId },
|
||||
params: {
|
||||
page,
|
||||
pageSize,
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -190,7 +258,9 @@ export function vlogCommentCounts(vlogId) {
|
||||
url: api.vlog + "/comment/counts",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { vlogId },
|
||||
params: {
|
||||
vlogId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -202,7 +272,10 @@ export function vlogCommentUnLike(userId,commentId) {
|
||||
url: api.vlog + "/comment/unlike",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {userId,commentId}
|
||||
params: {
|
||||
userId,
|
||||
commentId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -214,7 +287,10 @@ export function vlogCommentLike(userId,commentId) {
|
||||
url: api.vlog + "/comment/like",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params: {userId,commentId}
|
||||
params: {
|
||||
userId,
|
||||
commentId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -226,7 +302,11 @@ export function vlogCommentDelete(vlogId,commentUserId,commentId) {
|
||||
url: api.vlog + "/comment/delete",
|
||||
method: Method.DELETE,
|
||||
needToken: true,
|
||||
params: {vlogId,commentUserId,commentId}
|
||||
params: {
|
||||
vlogId,
|
||||
commentUserId,
|
||||
commentId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -239,7 +319,12 @@ export function vlogCommentList(page,pageSize,vlogId,userId) {
|
||||
url: api.vlog + "/comment/list",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: { page,pageSize,vlogId,userId },
|
||||
params: {
|
||||
page,
|
||||
pageSize,
|
||||
vlogId,
|
||||
userId
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -263,7 +348,10 @@ export function vlogChangeToPublic(userId,vlogId) {
|
||||
url: api.vlog + "/vlog/changeToPublic",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params:{userId,vlogId}
|
||||
params: {
|
||||
userId,
|
||||
vlogId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -275,7 +363,10 @@ export function vlogChangeToPrivate(userId,vlogId) {
|
||||
url: api.vlog + "/vlog/changeToPrivate",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params:{userId,vlogId}
|
||||
params: {
|
||||
userId,
|
||||
vlogId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -295,46 +386,92 @@ export function vlogModifyUserInfo(data,type) {
|
||||
/**
|
||||
* 取关
|
||||
*/
|
||||
export function vlogFansCancel({myId,vlogerId}) {
|
||||
export function vlogFansCancel({
|
||||
myId,
|
||||
vlogerId
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/fans/cancel",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params:{myId,vlogerId}
|
||||
params: {
|
||||
myId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 关注
|
||||
*/
|
||||
export function vlogFansFollow({myId,vlogerId}) {
|
||||
export function vlogFansFollow({
|
||||
myId,
|
||||
vlogerId
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/fans/follow",
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params:{myId,vlogerId}
|
||||
params: {
|
||||
myId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的粉丝
|
||||
*/
|
||||
export function vlogQueryMyFans({myId,page,pageSize}) {
|
||||
export function vlogQueryMyFans({
|
||||
myId,
|
||||
page,
|
||||
pageSize
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/fans/queryMyFans",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params:{myId,page,pageSize}
|
||||
params: {
|
||||
myId,
|
||||
page,
|
||||
pageSize
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的关注
|
||||
*/
|
||||
export function vlogQueryMyFollows({myId,page,pageSize}) {
|
||||
export function vlogQueryMyFollows({
|
||||
myId,
|
||||
page,
|
||||
pageSize
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/fans/queryMyFollows",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params:{myId,page,pageSize}
|
||||
params: {
|
||||
myId,
|
||||
page,
|
||||
pageSize
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的关注
|
||||
*/
|
||||
export function vlogQueryDoIFollowVloger({
|
||||
myId,
|
||||
vlogerId
|
||||
}) {
|
||||
return http.request({
|
||||
url: api.vlog + "/fans/queryDoIFollowVloger",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params: {
|
||||
myId,
|
||||
vlogerId
|
||||
}
|
||||
});
|
||||
}
|
@ -1,70 +1,177 @@
|
||||
<template>
|
||||
<view style="flex: 1">
|
||||
<!-- <uni-list @change="onchange" :num="playerList.length"> -->
|
||||
<list ref="list" :pagingEnabled="true" :show-scrollbar="false" @scroll="listScroll" @scrollend="scroll"
|
||||
:scrollable="true">
|
||||
<refresh @pullingdown="onpullingdown" @refresh="onrefresh" :display="refreshing ? 'show' : 'hide'">
|
||||
<list
|
||||
ref="list"
|
||||
:pagingEnabled="true"
|
||||
:show-scrollbar="false"
|
||||
@scroll="listScroll"
|
||||
@scrollend="scroll"
|
||||
:scrollable="!isDragging"
|
||||
>
|
||||
<refresh
|
||||
@pullingdown="onpullingdown"
|
||||
@refresh="onrefresh"
|
||||
:display="refreshing ? 'show' : 'hide'"
|
||||
>
|
||||
<text class="refresh-info-txt"></text>
|
||||
<loading-indicator></loading-indicator>
|
||||
</refresh>
|
||||
<cell :recycle="false" v-for="(item, index) in playerList" :key="index" :data-index="index"
|
||||
:style="{ height: screenHeight + 'px' }">
|
||||
<!-- <uni-video :src="item.url" :playStatus="playStatus" :screenHeight="screenHeight" v-if="playerCur === index" @play="onplay"></uni-video> -->
|
||||
<video ref="myVideo" id="myVideo" :object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
||||
:src="item.url" :controls="false" :enable-progress-gesture="false"
|
||||
v-if="playerCur === index" loop autoplay show-loading="true" :http-cache="true"
|
||||
style="width: 750rpx" :style="{ height: screenHeight + 'px' }" @click="playOrPause" @play="onplay"
|
||||
@error="onerror" @timeupdate="timeupdate"></video>
|
||||
<image :lazy-load="true" :fade-show="false" v-if="!item.play" :src="item.cover"
|
||||
<cell
|
||||
:recycle="false"
|
||||
:class="isIOS ? 'abs-box-ios' : ''"
|
||||
v-for="(item, index) in playerList"
|
||||
:key="index"
|
||||
:data-index="index"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
>
|
||||
<video
|
||||
ref="myVideo"
|
||||
id="myVideo"
|
||||
:object-fit="item.width >= item.height ? 'contain' : 'fill'"
|
||||
preload="metadata"
|
||||
:src="item.url"
|
||||
:controls="false"
|
||||
:enable-progress-gesture="false"
|
||||
v-if="playerCur === index"
|
||||
autoplay
|
||||
loop
|
||||
:http-cache="true"
|
||||
style="width: 750rpx"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
@click="playOrPause"
|
||||
@play="onplay"
|
||||
@error="onerror"
|
||||
@timeupdate="onTimeUpdate"
|
||||
></video>
|
||||
<!-- 首帧图 -->
|
||||
<image
|
||||
:fade-show="false"
|
||||
v-if="!item.play"
|
||||
:src="item.firstFrameImg"
|
||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
||||
style="width: 750rpx; filter: blur(10px)" :style="{ height: screenHeight + 'px' }"></image>
|
||||
<!--<image :lazy-load="true" :fade-show="false" v-if="!item.play" :src="item.cover" mode="" style="width: 750rpx;position:absolute;left: 0;right: 0;top: 0;bottom: 0; filter: blur(10px);" :style="{height: screenHeight+ 'px'}"></image>-->
|
||||
style="width: 750rpx; filter: blur(10px)"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
></image>
|
||||
<!-- 播放按钮 -->
|
||||
|
||||
<view
|
||||
v-if="!isIOS && !playStatus && item.play"
|
||||
class="abs-box-ad"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
>
|
||||
<image
|
||||
src="/static/images/playvd.png"
|
||||
class="play-btn"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
<image
|
||||
v-if="isIOS && !playStatus && item.play"
|
||||
src="/static/images/playvd.png"
|
||||
class="play-btn"
|
||||
></image>
|
||||
|
||||
<!-- 进度条 -->
|
||||
<view
|
||||
class="progress-bar"
|
||||
@touchstart="startDrag"
|
||||
@touchmove="onDragging"
|
||||
@panend="endDrag"
|
||||
v-if="progressFlag"
|
||||
>
|
||||
<view
|
||||
v-if="progressFlag"
|
||||
class="progress-background"
|
||||
></view>
|
||||
<view
|
||||
v-if="progressFlag"
|
||||
class="progress-foreground"
|
||||
:class="isDragging ? '' : 'anm'"
|
||||
:style="{ width: progressWidth + 'px' }"
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<!-- 浮动时间提示 -->
|
||||
<view
|
||||
class="float-time"
|
||||
v-if="isDragging"
|
||||
:style="{ left: floatLeft + 'px' }"
|
||||
>
|
||||
<text style="color: #fff">{{ formatTime(floatTime) }}</text>
|
||||
</view>
|
||||
<view class="publish-info-box">
|
||||
<view class="">
|
||||
<text class="publish-info-vloger-name">@{{ item.vlogerName }}</text>
|
||||
<text class="publish-info-content">{{ item.content }}</text>
|
||||
<view class="publish-info-music-box">
|
||||
<image src="/static/images/icon-fire.png" class="icon-fire"></image>
|
||||
<image
|
||||
src="/static/images/icon-fire.png"
|
||||
class="icon-fire"
|
||||
></image>
|
||||
<text class="muisc-words">{{ item.vlogerName }}的原声创作</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="flex-direction: row">
|
||||
<image src="/static/images/cd-play-4.gif" style="width: 150rpx;height: 150rpx;opacity: 0.8;">
|
||||
</image>
|
||||
<image v-if="!isIOS" src="/static/images/icon-cd.png" class="play-cd"
|
||||
style="width: 120rpx; height: 120rpx"></image>
|
||||
<image v-if="isIOS" :src="
|
||||
'https://imooc-news.oss-cn-shanghai.aliyuncs.com/image/cd-play-4.gif?time=' +
|
||||
times
|
||||
" class="play-cd"></image>
|
||||
</view>
|
||||
<!-- 右下角 -->
|
||||
<!-- <view
|
||||
class=""
|
||||
style="flex-direction: row"
|
||||
>
|
||||
<image
|
||||
src="/static/images/cd-play-4.gif"
|
||||
style="width: 150rpx; height: 150rpx; opacity: 0.8"
|
||||
></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- 视频展示右侧的操作按钮,头像 - 点赞 - 评论 - 转发 -->
|
||||
<view class="operation-box">
|
||||
<view class="operation-face-box">
|
||||
<image :src="item.vlogerFace" class="user-face" @click="goUserInfoSeeSee(item.vlogerId)">
|
||||
</image>
|
||||
<image
|
||||
:src="item.vlogerFace"
|
||||
class="user-face"
|
||||
@click="goUserInfoSeeSee(item.vlogerId)"
|
||||
></image>
|
||||
</view>
|
||||
<image v-if="!item.doIFollowVloger && userId != thisVlogerId" src="/static/images/icon-follow.png"
|
||||
@click="followMe(item.vlogerId)" class="follow-me"></image>
|
||||
<image
|
||||
v-if="!item.doIFollowVloger && userId != thisVlogerId"
|
||||
src="/static/images/icon-follow.png"
|
||||
@click="followMe(item.vlogerId)"
|
||||
class="follow-me"
|
||||
></image>
|
||||
<view class="like-box">
|
||||
<image v-if="!item.doILikeThisVlog" src="/static/images/icon-unlike.png"
|
||||
@click="likeOrDislikeVlog(1)" class="icon"></image>
|
||||
<image v-if="item.doILikeThisVlog" src="/static/images/icon-like.png"
|
||||
@click="likeOrDislikeVlog(0)" class="icon"></image>
|
||||
<image
|
||||
v-if="!item.doILikeThisVlog"
|
||||
src="/static/images/icon-unlike.png"
|
||||
@click="likeOrDislikeVlog(1)"
|
||||
class="icon"
|
||||
></image>
|
||||
<image
|
||||
v-if="item.doILikeThisVlog"
|
||||
src="/static/images/icon-like.png"
|
||||
@click="likeOrDislikeVlog(0)"
|
||||
class="icon"
|
||||
></image>
|
||||
<text class="some-counts">
|
||||
{{ getGraceNumber(item.likeCounts) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="comment-and-share-box">
|
||||
<image src="/static/images/icon-comments.png" @click="commentToggle" class="icon"></image>
|
||||
<image
|
||||
src="/static/images/icon-comments.png"
|
||||
@click="commentToggle"
|
||||
class="icon"
|
||||
></image>
|
||||
<!-- <text class="some-counts">{{item.commentsCounts}}</text> -->
|
||||
<text class="some-counts">
|
||||
{{ getGraceNumber(thisVlogTotalComentCounts) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="comment-and-share-box">
|
||||
<image src="/static/images/icon-share.png" @click="shareToggle" class="icon"></image>
|
||||
<image
|
||||
src="/static/images/icon-share.png"
|
||||
@click="shareToggle"
|
||||
class="icon"
|
||||
></image>
|
||||
<text class="some-counts">分享</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -74,50 +181,56 @@
|
||||
|
||||
<view>
|
||||
<!-- 底部窗口popup -->
|
||||
<uni-popup ref="comment" type="comment">
|
||||
<uni-popup-comments :thisVlogerId="thisVlogerId" :thisVlogId="thisVlogId"></uni-popup-comments>
|
||||
<uni-popup
|
||||
ref="comment"
|
||||
type="comment"
|
||||
>
|
||||
<uni-popup-comments
|
||||
:thisVlogerId="thisVlogerId"
|
||||
:thisVlogId="thisVlogId"
|
||||
></uni-popup-comments>
|
||||
</uni-popup>
|
||||
<uni-popup ref="share" background-color="#fff" type="share">
|
||||
<uni-popup-share :thisVlogerId="thisVlogerId" :thisVlogId="thisVlogId" :vlogUrl="thisVlog.url"
|
||||
:isPrivate="thisVlog.isPrivate"></uni-popup-share>
|
||||
<uni-popup
|
||||
ref="share"
|
||||
background-color="#fff"
|
||||
type="share"
|
||||
>
|
||||
<uni-popup-share
|
||||
:thisVlogerId="thisVlogerId"
|
||||
:thisVlogId="thisVlogId"
|
||||
:vlogUrl="thisVlog.url"
|
||||
:isPrivate="thisVlog.isPrivate"
|
||||
></uni-popup-share>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import {
|
||||
graceNumber
|
||||
} from '@/utils/tools.js'
|
||||
import api from "@/config/api.js";
|
||||
import {
|
||||
vlogList,
|
||||
vlogLike,
|
||||
vlogUnLike,
|
||||
vlogComment,
|
||||
vlogFollow,
|
||||
vlogTotalLikedCounts
|
||||
} from "@/api/vlog";
|
||||
let system = uni.getSystemInfoSync();
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import { graceNumber } from '@/utils/tools.js';
|
||||
import api from '@/config/api.js';
|
||||
import { vlogList, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
||||
export default {
|
||||
props: {
|
||||
screenHeight: {
|
||||
default: 0,
|
||||
default: 0
|
||||
},
|
||||
src: {
|
||||
default: false,
|
||||
default: false
|
||||
},
|
||||
playStatus: {
|
||||
default: false,
|
||||
default: false
|
||||
},
|
||||
videoList: {
|
||||
default: [],
|
||||
default: []
|
||||
},
|
||||
refreshList: {
|
||||
default: [],
|
||||
default: []
|
||||
},
|
||||
pagingList: {
|
||||
default: [],
|
||||
default: []
|
||||
},
|
||||
//
|
||||
pid: {
|
||||
@ -127,17 +240,20 @@
|
||||
parentId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
progressFlag: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
thisVlog: {}, // 当前的短视频对象
|
||||
thisVlogId: "", // 当前的短视频主键id
|
||||
thisVlogerId: "", // 当前的短视频博主的主键id
|
||||
userId: "", // 当前用户id
|
||||
thisVlogId: '', // 当前的短视频主键id
|
||||
thisVlogerId: '', // 当前的短视频博主的主键id
|
||||
userId: '', // 当前用户id
|
||||
|
||||
refreshing: false,
|
||||
showRefreshLoading: "hide",
|
||||
showRefreshLoading: 'hide',
|
||||
|
||||
playerCur: 0,
|
||||
page: 0,
|
||||
@ -153,13 +269,22 @@
|
||||
|
||||
times: new Date().getTime(),
|
||||
|
||||
objectFit: "fill",
|
||||
isIOS: uni.getSystemInfoSync().platform == "ios",
|
||||
objectFit: 'fill',
|
||||
isIOS: uni.getSystemInfoSync().platform == 'ios',
|
||||
|
||||
duration: 0,
|
||||
currentTime: 0,
|
||||
progressWidth: 0,
|
||||
floatTime: 0,
|
||||
floatLeft: 0,
|
||||
isDragging: false
|
||||
// progressFlag: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.isIOS);
|
||||
if (!this.isIOS) {
|
||||
this.objectFit = "cover";
|
||||
this.objectFit = 'cover';
|
||||
}
|
||||
|
||||
let myUserInfo = storage.getVlogUserInfo();
|
||||
@ -169,8 +294,8 @@
|
||||
|
||||
// 查询首页短视频列表
|
||||
this.displayVideoPaging(this.page + 1, true);
|
||||
this.videoContext = uni.createVideoContext("myVideo", this.$refs.myVideo);
|
||||
console.log(this.videoContext)
|
||||
this.videoContext = uni.createVideoContext('myVideo', this.$refs.myVideo);
|
||||
console.log(this.videoContext);
|
||||
},
|
||||
onReady() {},
|
||||
watch: {
|
||||
@ -189,15 +314,72 @@
|
||||
|
||||
playStatus(val) {
|
||||
var me = this;
|
||||
|
||||
if (!val) {
|
||||
me.videoContext.pause();
|
||||
} else {
|
||||
me.videoContext.play();
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//进度start
|
||||
formatTime(sec) {
|
||||
const m = Math.floor(sec / 60);
|
||||
const s = Math.floor(sec % 60);
|
||||
return `${m}:${s < 10 ? '0' : ''}${s}`;
|
||||
},
|
||||
onTimeUpdate(e) {
|
||||
// console.log(e);
|
||||
if (e.detail.currentTime > 0.2) {
|
||||
this.doplay(e.detail.currentTime);
|
||||
}
|
||||
if (this.isDragging) return;
|
||||
this.currentTime = e.detail.currentTime;
|
||||
this.duration = e.detail.duration;
|
||||
this.updateProgress();
|
||||
},
|
||||
updateProgress() {
|
||||
const percent = this.currentTime / this.duration;
|
||||
this.progressWidth = Math.floor(system.screenWidth * percent);
|
||||
// console.log(this.progressWidth);
|
||||
},
|
||||
startDrag(e) {
|
||||
console.log('触发开始拖动');
|
||||
this.isDragging = true;
|
||||
},
|
||||
onDragging(e) {
|
||||
console.log(this.isDragging);
|
||||
console.log('拖动中');
|
||||
const touchX = e.touches[0].pageX;
|
||||
const max = system.screenWidth;
|
||||
const clampedX = Math.max(0, Math.min(touchX, max));
|
||||
|
||||
this.progressWidth = clampedX;
|
||||
const percent = clampedX / max;
|
||||
this.floatTime = percent * this.duration;
|
||||
|
||||
// 浮动提示偏移,避免越界
|
||||
const floatBoxWidth = 60;
|
||||
this.floatLeft = Math.max(0, Math.min(clampedX - floatBoxWidth / 2, max - floatBoxWidth));
|
||||
},
|
||||
endDrag() {
|
||||
console.log('拖动结束');
|
||||
const percent = this.progressWidth / system.screenWidth;
|
||||
const seekTime = percent * this.duration;
|
||||
if (!this.duration || isNaN(seekTime)) {
|
||||
console.warn('duration 未就绪或 seekTime 非法');
|
||||
this.isDragging = false;
|
||||
return;
|
||||
}
|
||||
// 避免重复 seek
|
||||
if (Math.abs(seekTime - this.currentTime) > 0.2) {
|
||||
this.videoContext.seek(seekTime);
|
||||
}
|
||||
this.isDragging = false;
|
||||
},
|
||||
|
||||
//进度end
|
||||
|
||||
//------------addd
|
||||
setScrollRef(height) {
|
||||
if (this.$refs['list'].setSpecialEffects) {
|
||||
@ -223,10 +405,10 @@
|
||||
async freshCommentCounts() {
|
||||
var me = this;
|
||||
var currentIndex = me.playerCur;
|
||||
console.log('currentIndex', currentIndex)
|
||||
console.log('currentIndex', currentIndex);
|
||||
var vlog = me.playerList[currentIndex];
|
||||
var vlogId = vlog.vlogId;
|
||||
var result = await vlogComment(vlogId)
|
||||
var result = await vlogComment(vlogId);
|
||||
if (result.data.status == 200) {
|
||||
me.thisVlogTotalComentCounts = result.data.data;
|
||||
} else {
|
||||
@ -235,16 +417,15 @@
|
||||
},
|
||||
async likeOrDislikeVlog(isLike) {
|
||||
var me = this;
|
||||
var myUserInfo = storage.getVlogUserInfo() || null
|
||||
var myUserInfo = storage.getVlogUserInfo() || null;
|
||||
var currentIndex = me.playerCur;
|
||||
var vlog = me.playerList[currentIndex];
|
||||
if (isLike == 1) {
|
||||
// 喜欢/点赞视频
|
||||
if (myUserInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -253,28 +434,25 @@
|
||||
userId,
|
||||
vlogerId: vlog.vlogerId,
|
||||
vlogId: vlog.vlogId
|
||||
})
|
||||
console.log(result)
|
||||
});
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
me.reLikePlayList(vlog.vlogId);
|
||||
me.refreshVlogCounts();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
|
||||
} else if (isLike == 0) {
|
||||
// 取消喜欢/点赞视频
|
||||
var myUserInfo = storage.getVlogUserInfo() || null
|
||||
var myUserInfo = storage.getVlogUserInfo() || null;
|
||||
if (myUserInfo == null) {
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -284,15 +462,15 @@
|
||||
userId,
|
||||
vlogerId: vlog.vlogerId,
|
||||
vlogId: vlog.vlogId
|
||||
})
|
||||
});
|
||||
if (result.data.status == 200) {
|
||||
me.reDislikePlayList(vlog.vlogId);
|
||||
me.refreshVlogCounts();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -363,53 +541,54 @@
|
||||
// 关注博主
|
||||
async followMe(vlogerId) {
|
||||
var me = this;
|
||||
var myUserInfo = storage.getVlogUserInfo()||null
|
||||
var myUserInfo = storage.getVlogUserInfo() || null;
|
||||
if (myUserInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
var userId = myUserInfo.id;
|
||||
var result = await vlogFollow(userId, vlogerId)
|
||||
var result = await vlogFollow(userId, vlogerId);
|
||||
if (result.data.status == 200) {
|
||||
me.reFollowPlayList(vlogerId);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
// 查看用户详情
|
||||
goUserInfoSeeSee(userId) {
|
||||
uni.setStorageSync("userPageId", userId);
|
||||
const info = storage.getVlogUserInfo() || null
|
||||
uni.setStorageSync('userPageId', userId);
|
||||
const info = storage.getVlogUserInfo() || null;
|
||||
if (info == null) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return
|
||||
return;
|
||||
}
|
||||
let myUserId = info.id
|
||||
let myUserId = info.id;
|
||||
if (myUserId == userId) {
|
||||
uni.switchTab({
|
||||
url: "/pages/me/me",
|
||||
url: '/pages/me/me'
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/me/vlogerInfo?userPageId=" + userId,
|
||||
url: '/pages/me/vlogerInfo?userPageId=' + userId
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
listScroll(e) {
|
||||
// console.log(e.contentOffset.y)
|
||||
// console.log(e.contentOffset.y);
|
||||
this.progressFlag = false;
|
||||
if (e.contentOffset.y > 0) {
|
||||
this.$emit("showLoading");
|
||||
this.$emit('showLoading');
|
||||
}
|
||||
},
|
||||
|
||||
@ -435,7 +614,7 @@
|
||||
|
||||
// 下拉刷新的过程中,改变头部tab显示的字样
|
||||
onpullingdown(e) {
|
||||
console.log('下拉中')
|
||||
console.log('下拉中');
|
||||
},
|
||||
async onrefresh(e) {
|
||||
// console.log('开始')
|
||||
@ -446,32 +625,38 @@
|
||||
// uni.stopPullDownRefresh()
|
||||
// this.refreshing = false;
|
||||
// this.$emit("hideLoading");
|
||||
console.log('开始')
|
||||
console.log('开始');
|
||||
this.refreshing = true;
|
||||
// 通过list组件的下拉刷新触发当前所在页面的下拉刷新
|
||||
uni.startPullDownRefresh();
|
||||
await this.displayVideoPaging(1,true)
|
||||
uni.stopPullDownRefresh()
|
||||
await this.displayVideoPaging(1, true);
|
||||
uni.stopPullDownRefresh();
|
||||
this.refreshing = false;
|
||||
this.$emit("hideLoading");
|
||||
this.$emit('hideLoading');
|
||||
},
|
||||
|
||||
onplay: function (e) {
|
||||
if (uni.getSystemInfoSync().platform == "ios") {
|
||||
// console.log('开始播放');
|
||||
// let timer = setTimeout(() => {
|
||||
// this.progressFlag = true;
|
||||
// clearTimeout(timer);
|
||||
// }, 10);
|
||||
this.progressFlag = true;
|
||||
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||
this.doplay(0.1);
|
||||
}
|
||||
},
|
||||
onerror: function (err) {},
|
||||
timeupdate: function(e) {
|
||||
if (e.detail.currentTime > 0.2) {
|
||||
this.doplay(e.detail.currentTime);
|
||||
}
|
||||
},
|
||||
// timeupdate: function (e) {
|
||||
// if (e.detail.currentTime > 0.2) {
|
||||
// this.doplay(e.detail.currentTime);
|
||||
// }
|
||||
// },
|
||||
|
||||
playOrPause() {
|
||||
var me = this;
|
||||
var playStatus = this.playStatus;
|
||||
|
||||
console.log(playStatus);
|
||||
if (!playStatus) {
|
||||
me.videoContext.pause();
|
||||
} else {
|
||||
@ -489,13 +674,11 @@
|
||||
this.contentOffsetY = Number(e.contentOffset.y);
|
||||
var num = this.playerList.length;
|
||||
if (num > 0) {
|
||||
var ht = Number(e.contentSize.height)
|
||||
console.log(ht)
|
||||
this.currentIndex = Math.round(
|
||||
Math.abs(this.contentOffsetY) / (ht / num)
|
||||
);
|
||||
var ht = Number(e.contentSize.height);
|
||||
console.log(ht);
|
||||
this.currentIndex = Math.round(Math.abs(this.contentOffsetY) / (ht / num));
|
||||
} else {
|
||||
this.currentIndex = 0
|
||||
this.currentIndex = 0;
|
||||
}
|
||||
this.onchange(this.currentIndex);
|
||||
|
||||
@ -504,7 +687,7 @@
|
||||
if (this.playerList.length - this.currentIndex < 3) {
|
||||
// 如果要分页的page和总数totalPage相等,则没有更多
|
||||
if (this.page == this.totalPage || this.totalPage == 0) {
|
||||
this.$emit('hideLoading')
|
||||
this.$emit('hideLoading');
|
||||
return;
|
||||
}
|
||||
this.displayVideoPaging(this.page + 1, false);
|
||||
@ -514,18 +697,18 @@
|
||||
// 分页查询新的list, 并且追加到现有list中
|
||||
async displayVideoPaging(page, needClearList) {
|
||||
// 查询首页短视频列表
|
||||
let me = this
|
||||
let myUserInfo = storage.getVlogUserInfo()
|
||||
let userId = "";
|
||||
let me = this;
|
||||
let myUserInfo = storage.getVlogUserInfo();
|
||||
let userId = '';
|
||||
if (myUserInfo != null) {
|
||||
userId = myUserInfo.id;
|
||||
this.userId = userId
|
||||
this.userId = userId;
|
||||
}
|
||||
const result = await vlogList(page, 10, userId).catch(err => {
|
||||
const result = await vlogList(page, 10, userId).catch((err) => {
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
});
|
||||
uni.stopPullDownRefresh();
|
||||
console.log(result)
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
let vlogList = result.data.data.rows;
|
||||
// 缺:该条视频是否被喜欢过
|
||||
@ -545,11 +728,10 @@
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
doplay: function (time) {
|
||||
@ -558,13 +740,19 @@
|
||||
}
|
||||
},
|
||||
onchange: function (index) {
|
||||
console.log(index)
|
||||
console.log(this.playerCur)
|
||||
console.log(index);
|
||||
console.log(this.playerCur);
|
||||
if (index != this.playerCur) {
|
||||
this.playerList[this.playerCur].play = false;
|
||||
this.playerCur = index;
|
||||
this.playStatus = true;
|
||||
this.progressWidth = 0;
|
||||
}
|
||||
|
||||
this.progressFlag = true;
|
||||
// let timer = setTimeout(() => {
|
||||
// this.progressFlag = true;
|
||||
// clearTimeout(timer);
|
||||
// }, 20);
|
||||
this.refreshVlogCounts();
|
||||
this.setThisVlogInfo();
|
||||
this.freshCommentCounts();
|
||||
@ -585,7 +773,7 @@
|
||||
var me = this;
|
||||
var currentIndex = me.playerCur;
|
||||
var vlog = me.playerList[currentIndex];
|
||||
var result = await vlogTotalLikedCounts(vlog.vlogId)
|
||||
var result = await vlogTotalLikedCounts(vlog.vlogId);
|
||||
if (result.data.status == 200) {
|
||||
var counts = result.data.data;
|
||||
me.reChangeVlogLikedCountsInPlayList(vlog.vlogId, counts);
|
||||
@ -610,20 +798,86 @@
|
||||
commentToggle() {
|
||||
this.$refs.comment.open();
|
||||
uni.hideTabBar({
|
||||
animation: true,
|
||||
animation: true
|
||||
});
|
||||
},
|
||||
shareToggle() {
|
||||
this.$refs.share.open();
|
||||
uni.hideTabBar({
|
||||
animation: true,
|
||||
animation: true
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.progress-bar {
|
||||
height: 60rpx;
|
||||
width: 750rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.progress-background {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 750rpx;
|
||||
height: 2px;
|
||||
background-color: #ccc;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.progress-foreground {
|
||||
z-index: 2;
|
||||
height: 2px;
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.anm {
|
||||
transition: width 0.25s linear;
|
||||
}
|
||||
|
||||
.float-time {
|
||||
position: fixed;
|
||||
bottom: 2px;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.abs-box-ad {
|
||||
width: 750rpx;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.abs-box-ios {
|
||||
position: relative;
|
||||
width: 750rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.play-btn {
|
||||
position: absolute;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
|
@ -5,13 +5,15 @@
|
||||
:show-scrollbar="false"
|
||||
@scroll="listScroll"
|
||||
@scrollend="scroll"
|
||||
:scrollable="true">
|
||||
:scrollable="true"
|
||||
>
|
||||
<cell
|
||||
:recycle="false"
|
||||
v-for="(item, index) in playerList"
|
||||
:key="index"
|
||||
:data-index="index"
|
||||
:style="{ height: screenHeight + 'px' }">
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
>
|
||||
<video
|
||||
ref="videoDetail"
|
||||
id="videoDetail"
|
||||
@ -28,15 +30,54 @@
|
||||
@click="playOrPause"
|
||||
@play="onplay"
|
||||
@error="onerror"
|
||||
@timeupdate="timeupdate"></video>
|
||||
@timeupdate="onTimeUpdate"
|
||||
></video>
|
||||
<image
|
||||
:lazy-load="true"
|
||||
:fade-show="false"
|
||||
v-if="!item.play"
|
||||
:src="item.cover"
|
||||
:src="item.firstFrameImg"
|
||||
:mode="item.width >= item.height ? 'aspectFit' : 'scaleToFill'"
|
||||
style="width: 750rpx; filter: blur(10px)"
|
||||
:style="{ height: screenHeight + 'px' }"></image>
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
></image>
|
||||
<!-- 播放按钮 -->
|
||||
<view
|
||||
v-else-if="!playStatus"
|
||||
class="abs-box"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
>
|
||||
<image
|
||||
:fade-show="true"
|
||||
src="/static/images/playvd.png"
|
||||
class="play-btn"
|
||||
></image>
|
||||
</view>
|
||||
<!-- 进度条 -->
|
||||
<view
|
||||
v-if="playerCur === index"
|
||||
class="progress-bar"
|
||||
@touchstart="startDrag"
|
||||
@touchmove="onDragging"
|
||||
@panend="endDrag"
|
||||
>
|
||||
<view class="progress-background"></view>
|
||||
<view
|
||||
class="progress-foreground"
|
||||
:class="isDragging ? '' : 'anm'"
|
||||
:style="{ width: progressWidth + 'px' }"
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<!-- 浮动时间提示 -->
|
||||
<view
|
||||
class="float-time"
|
||||
v-if="isDragging"
|
||||
:style="{ left: floatLeft + 'px' }"
|
||||
>
|
||||
<text style="color: #fff">{{ formatTime(floatTime) }}</text>
|
||||
</view>
|
||||
|
||||
<view class="publish-info-box">
|
||||
<view class="">
|
||||
<text class="publish-info-vloger-name">@{{ item.vlogerName }}</text>
|
||||
@ -44,26 +85,20 @@
|
||||
<view class="publish-info-music-box">
|
||||
<image
|
||||
src="/static/images/icon-fire.png"
|
||||
class="icon-fire"></image>
|
||||
class="icon-fire"
|
||||
></image>
|
||||
<text class="muisc-words">{{ item.vlogerName }}的原声创作</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="flex-direction: row">
|
||||
<image src="/static/images/cd-play-4.gif"
|
||||
style="width: 150rpx;height: 150rpx;opacity: 0.8;"></image>
|
||||
<!-- <view
|
||||
class=""
|
||||
style="flex-direction: row"
|
||||
>
|
||||
<image
|
||||
v-if="!isIOS"
|
||||
src="/static/images/icon-cd.png"
|
||||
class="play-cd"
|
||||
style="width: 120rpx; height: 120rpx"></image>
|
||||
<image
|
||||
v-if="isIOS"
|
||||
:src="
|
||||
'https://imooc-news.oss-cn-shanghai.aliyuncs.com/image/cd-play-4.gif?time=' +
|
||||
times
|
||||
"
|
||||
class="play-cd"></image>
|
||||
</view>
|
||||
src="/static/images/cd-play-4.gif"
|
||||
style="width: 150rpx; height: 150rpx; opacity: 0.8"
|
||||
></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- 视频展示右侧的操作按钮, 头像 - 点赞 - 评论 - 转发 -->
|
||||
<view class="operation-box">
|
||||
@ -71,38 +106,44 @@
|
||||
<image
|
||||
:src="item.vlogerFace"
|
||||
class="user-face"
|
||||
@click="goUserInfoSeeSee(item.vlogerId)"></image>
|
||||
@click="goUserInfoSeeSee(item.vlogerId)"
|
||||
></image>
|
||||
</view>
|
||||
<image
|
||||
v-if="!item.doIFollowVloger && userId != item.vlogerId"
|
||||
src="/static/images/icon-follow.png"
|
||||
@click="followMe(item.vlogerId)"
|
||||
class="follow-me"></image>
|
||||
class="follow-me"
|
||||
></image>
|
||||
<view class="like-box">
|
||||
<image
|
||||
v-if="!item.doILikeThisVlog"
|
||||
src="/static/images/icon-unlike.png"
|
||||
@click="likeOrDislikeVlog(1)"
|
||||
class="icon"></image>
|
||||
class="icon"
|
||||
></image>
|
||||
<image
|
||||
v-if="item.doILikeThisVlog"
|
||||
src="/static/images/icon-like.png"
|
||||
@click="likeOrDislikeVlog(0)"
|
||||
class="icon"></image>
|
||||
class="icon"
|
||||
></image>
|
||||
<text class="some-counts">{{ item.likeCounts }}</text>
|
||||
</view>
|
||||
<view class="comment-and-share-box">
|
||||
<image
|
||||
src="/static/images/icon-comments.png"
|
||||
@click="commentToggle"
|
||||
class="icon"></image>
|
||||
class="icon"
|
||||
></image>
|
||||
<text class="some-counts">{{ thisVlogTotalComentCounts }}</text>
|
||||
</view>
|
||||
<view class="comment-and-share-box">
|
||||
<image
|
||||
src="/static/images/icon-share.png"
|
||||
@click="shareToggle"
|
||||
class="icon"></image>
|
||||
class="icon"
|
||||
></image>
|
||||
<text class="some-counts">分享</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -111,64 +152,63 @@
|
||||
<!-- </uni-list> -->
|
||||
|
||||
<view v-if="thisVlog != null && thisVlog != {}">
|
||||
<uni-popup ref="comment" type="comment">
|
||||
<uni-popup
|
||||
ref="comment"
|
||||
type="comment"
|
||||
>
|
||||
<uni-popup-comments
|
||||
:thisVlogerId="thisVlogerId"
|
||||
:thisVlogId="thisVlogId"></uni-popup-comments>
|
||||
:thisVlogId="thisVlogId"
|
||||
></uni-popup-comments>
|
||||
</uni-popup>
|
||||
<uni-popup ref="share" background-color="#fff" type="share">
|
||||
<uni-popup
|
||||
ref="share"
|
||||
background-color="#fff"
|
||||
type="share"
|
||||
>
|
||||
<uni-popup-share
|
||||
:thisVlogerId="thisVlogerId"
|
||||
:thisVlogId="thisVlogId"
|
||||
:vlogUrl="thisVlog.url"
|
||||
:isPrivate="thisVlog.isPrivate"></uni-popup-share>
|
||||
:isPrivate="thisVlog.isPrivate"
|
||||
></uni-popup-share>
|
||||
</uni-popup>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniPopupComments from "@/uni_modules/uni-popup/components/uni-popup-comments/uni-popup-comments.vue"
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import {
|
||||
graceNumber
|
||||
} from '@/utils/tools.js'
|
||||
import api from "@/config/api.js";
|
||||
import {
|
||||
vlogDetail,
|
||||
vlogLike,
|
||||
vlogUnLike,
|
||||
vlogComment,
|
||||
vlogFollow,
|
||||
vlogTotalLikedCounts
|
||||
} from "@/api/vlog";
|
||||
|
||||
let system = uni.getSystemInfoSync();
|
||||
import uniPopupComments from '@/uni_modules/uni-popup/components/uni-popup-comments/uni-popup-comments.vue';
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import { graceNumber } from '@/utils/tools.js';
|
||||
import api from '@/config/api.js';
|
||||
import { vlogDetail, vlogLike, vlogUnLike, vlogComment, vlogFollow, vlogTotalLikedCounts } from '@/api/vlog';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uniPopupComments,
|
||||
uniPopupComments
|
||||
},
|
||||
props: {
|
||||
screenHeight: {
|
||||
default: 0,
|
||||
default: 0
|
||||
},
|
||||
src: {
|
||||
default: false,
|
||||
default: false
|
||||
},
|
||||
playStatus: {
|
||||
default: false,
|
||||
default: false
|
||||
},
|
||||
vlogId: {
|
||||
default: false,
|
||||
},
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
thisVlog: {}, // 当前的短视频对象
|
||||
thisVlogId: "", // 当前的短视频主键id
|
||||
thisVlogerId: "", // 当前的短视频博主的主键id
|
||||
userId: "",
|
||||
thisVlogId: '', // 当前的短视频主键id
|
||||
thisVlogerId: '', // 当前的短视频博主的主键id
|
||||
userId: '',
|
||||
|
||||
playerCur: 0,
|
||||
page: 0,
|
||||
@ -196,13 +236,20 @@ export default {
|
||||
currentIndex: 0,
|
||||
contentOffsetY: 0,
|
||||
times: new Date().getTime(),
|
||||
objectFit: "fill",
|
||||
isIOS: uni.getSystemInfoSync().platform == "ios",
|
||||
objectFit: 'fill',
|
||||
isIOS: uni.getSystemInfoSync().platform == 'ios',
|
||||
|
||||
duration: 0,
|
||||
currentTime: 0,
|
||||
progressWidth: 0,
|
||||
floatTime: 0,
|
||||
floatLeft: 0,
|
||||
isDragging: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (!this.isIOS) {
|
||||
this.objectFit = "cover";
|
||||
this.objectFit = 'cover';
|
||||
}
|
||||
let myUserInfo = storage.getVlogUserInfo() || null;
|
||||
if (myUserInfo != null) {
|
||||
@ -233,9 +280,60 @@ export default {
|
||||
} else {
|
||||
me.videoContext.play();
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//进度start
|
||||
formatTime(sec) {
|
||||
const m = Math.floor(sec / 60);
|
||||
const s = Math.floor(sec % 60);
|
||||
return `${m}:${s < 10 ? '0' : ''}${s}`;
|
||||
},
|
||||
onTimeUpdate(e) {
|
||||
// console.log(e);
|
||||
if (e.detail.currentTime > 0.2) {
|
||||
this.doplay(e.detail.currentTime);
|
||||
}
|
||||
if (this.isDragging) return;
|
||||
this.currentTime = e.detail.currentTime;
|
||||
this.duration = e.detail.duration;
|
||||
this.updateProgress();
|
||||
},
|
||||
updateProgress() {
|
||||
const percent = this.currentTime / this.duration;
|
||||
this.progressWidth = Math.floor(system.screenWidth * percent);
|
||||
// console.log(this.progressWidth);
|
||||
},
|
||||
startDrag(e) {
|
||||
this.isDragging = true;
|
||||
},
|
||||
onDragging(e) {
|
||||
const touchX = e.touches[0].pageX;
|
||||
const max = system.screenWidth;
|
||||
const clampedX = Math.max(0, Math.min(touchX, max));
|
||||
|
||||
this.progressWidth = clampedX;
|
||||
const percent = clampedX / max;
|
||||
this.floatTime = percent * this.duration;
|
||||
|
||||
// 浮动提示偏移,避免越界
|
||||
const floatBoxWidth = 60;
|
||||
this.floatLeft = Math.max(0, Math.min(clampedX - floatBoxWidth / 2, max - floatBoxWidth));
|
||||
},
|
||||
endDrag() {
|
||||
const percent = this.progressWidth / system.screenWidth;
|
||||
const seekTime = percent * this.duration;
|
||||
if (!this.duration || isNaN(seekTime)) {
|
||||
console.warn('duration 未就绪或 seekTime 非法');
|
||||
this.isDragging = false;
|
||||
return;
|
||||
}
|
||||
// 避免重复 seek
|
||||
if (Math.abs(seekTime - this.currentTime) > 0.2) {
|
||||
this.videoContext.seek(seekTime);
|
||||
}
|
||||
this.isDragging = false;
|
||||
},
|
||||
// 喜欢, 点赞的list重新设置
|
||||
reLikePlayList(vlogId) {
|
||||
let me = this;
|
||||
@ -278,11 +376,11 @@ export default {
|
||||
async refreshVlogCounts() {
|
||||
var me = this;
|
||||
if (me.playerList.length == 0) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
var currentIndex = me.playerCur;
|
||||
var vlog = me.playerList[currentIndex];
|
||||
var result = await vlogTotalLikedCounts(vlog.vlogId)
|
||||
var result = await vlogTotalLikedCounts(vlog.vlogId);
|
||||
if (result.data.status == 200) {
|
||||
let counts = result.data.data;
|
||||
me.reChangeVlogLikedCountsInPlayList(vlog.vlogId, counts);
|
||||
@ -290,20 +388,19 @@ export default {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
duration: 3000,
|
||||
icon: "none",
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
async likeOrDislikeVlog(isLike) {
|
||||
var me = this;
|
||||
var myUserInfo = storage.getVlogUserInfo() || null
|
||||
var myUserInfo = storage.getVlogUserInfo() || null;
|
||||
var currentIndex = me.playerCur;
|
||||
var vlog = me.playerList[currentIndex];
|
||||
if (myUserInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom",
|
||||
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -315,15 +412,15 @@ export default {
|
||||
userId,
|
||||
vlogerId: vlog.vlogerId,
|
||||
vlogId: vlog.vlogId
|
||||
})
|
||||
});
|
||||
if (result.data.status == 200) {
|
||||
me.reLikePlayList(vlog.vlogId);
|
||||
me.refreshVlogCounts();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
} else if (isLike == 0) {
|
||||
@ -331,15 +428,15 @@ export default {
|
||||
userId,
|
||||
vlogerId: vlog.vlogerId,
|
||||
vlogId: vlog.vlogId
|
||||
})
|
||||
});
|
||||
if (result.data.status == 200) {
|
||||
me.reDislikePlayList(vlog.vlogId);
|
||||
me.refreshVlogCounts();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -376,40 +473,40 @@ export default {
|
||||
let myUserInfo = storage.getVlogUserInfo() || null;
|
||||
if (myUserInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/passport/login",
|
||||
animationType: "slide-in-bottom"
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let userId = myUserInfo.id;
|
||||
var result = await vlogFollow(userId,vlogerId)
|
||||
var result = await vlogFollow(userId, vlogerId);
|
||||
if (result.data.status == 208) {
|
||||
me.reFollowPlayList(vlogerId);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
goUserInfoSeeSee(userId) {
|
||||
// 是否是当前登录的用户
|
||||
let myUserId = "";
|
||||
var info = storage.getVlogUserInfo()||null
|
||||
let myUserId = '';
|
||||
var info = storage.getVlogUserInfo() || null;
|
||||
if (info != null) {
|
||||
myUserId = info.id;
|
||||
}
|
||||
if (myUserId == userId) {
|
||||
uni.switchTab({
|
||||
url: "/pages/me/me",
|
||||
url: '/pages/me/me'
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/me/vlogerInfo?userPageId=" + userId,
|
||||
url: '/pages/me/vlogerInfo?userPageId=' + userId
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -421,7 +518,7 @@ export default {
|
||||
},
|
||||
|
||||
onplay: function (e) {
|
||||
if (uni.getSystemInfoSync().platform == "ios") {
|
||||
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||
this.doplay(0.1);
|
||||
}
|
||||
},
|
||||
@ -448,20 +545,19 @@ export default {
|
||||
let vlogId = me.vlogId;
|
||||
|
||||
let myUserInfo = storage.getVlogUserInfo() || null;
|
||||
let userId = "";
|
||||
if ((myUserInfo!=null)) {
|
||||
let userId = '';
|
||||
if (myUserInfo != null) {
|
||||
userId = myUserInfo.id;
|
||||
}
|
||||
|
||||
|
||||
var result = await vlogDetail(vlogId,userId)
|
||||
var result = await vlogDetail(vlogId, userId);
|
||||
if (result.data.status == 200) {
|
||||
let vlog = result.data.data;
|
||||
let playerList = [];
|
||||
playerList.push(vlog);
|
||||
me.playerList = playerList;
|
||||
if (this.videoContext != null && playerList.length > 0) {
|
||||
let videoContext = uni.createVideoContext("videoDetail");
|
||||
let videoContext = uni.createVideoContext('videoDetail');
|
||||
this.videoContext = videoContext;
|
||||
}
|
||||
me.freshCommentCounts();
|
||||
@ -469,8 +565,8 @@ export default {
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -491,11 +587,7 @@ export default {
|
||||
// 设置当前vlog的信息
|
||||
setThisVlogInfo() {
|
||||
let me = this;
|
||||
if (
|
||||
me.playerList != null &&
|
||||
me.playerList != undefined &&
|
||||
me.playerList.length > 0
|
||||
) {
|
||||
if (me.playerList != null && me.playerList != undefined && me.playerList.length > 0) {
|
||||
let currentIndex = me.playerCur;
|
||||
let vlog = me.playerList[currentIndex];
|
||||
this.thisVlog = vlog;
|
||||
@ -505,21 +597,17 @@ export default {
|
||||
},
|
||||
async freshCommentCounts() {
|
||||
var me = this;
|
||||
var uinfo = storage.getVlogUserInfo()||null
|
||||
var uinfo = storage.getVlogUserInfo() || null;
|
||||
if (uinfo != null) {
|
||||
var userId=uinfo.id
|
||||
var userId = uinfo.id;
|
||||
}
|
||||
if (
|
||||
me.playerList == null ||
|
||||
me.playerList == undefined ||
|
||||
me.playerList.length == 0
|
||||
) {
|
||||
if (me.playerList == null || me.playerList == undefined || me.playerList.length == 0) {
|
||||
return;
|
||||
}
|
||||
var currentIndex = me.playerCur;
|
||||
var vlog = me.playerList[currentIndex];
|
||||
var vlogId = vlog.vlogId;
|
||||
var result = await vlogComment(vlogId)
|
||||
var result = await vlogComment(vlogId);
|
||||
if (result.data.status == 200) {
|
||||
me.thisVlogTotalComentCounts = result.data.data;
|
||||
} else {
|
||||
@ -529,20 +617,79 @@ export default {
|
||||
commentToggle() {
|
||||
this.$refs.comment.open();
|
||||
uni.hideTabBar({
|
||||
animation: true,
|
||||
animation: true
|
||||
});
|
||||
},
|
||||
shareToggle() {
|
||||
this.$refs.share.open();
|
||||
uni.hideTabBar({
|
||||
animation: true,
|
||||
animation: true
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.progress-bar {
|
||||
height: 60rpx;
|
||||
width: 750rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.progress-background {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 750rpx;
|
||||
height: 2px;
|
||||
background-color: #ccc;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.progress-foreground {
|
||||
z-index: 2;
|
||||
height: 2px;
|
||||
background-color: #fff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.anm {
|
||||
transition: width 0.25s linear;
|
||||
}
|
||||
|
||||
.float-time {
|
||||
position: fixed;
|
||||
bottom: 2px;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
color: white;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.abs-box {
|
||||
width: 750rpx;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.play-btn {
|
||||
position: absolute;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
@ -567,7 +714,7 @@ export default {
|
||||
}
|
||||
.publish-info-box {
|
||||
position: absolute;
|
||||
bottom: 200rpx;
|
||||
bottom: 120rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding-left: 20rpx;
|
||||
|
File diff suppressed because it is too large
Load Diff
1017
components/vlog/videoLocal.vue
Normal file
1017
components/vlog/videoLocal.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,12 +6,10 @@
|
||||
const dev = {
|
||||
// common: "https://common-api.pickmall.cn",
|
||||
// buyer: "https://buyer-api.pickmall.cn",
|
||||
|
||||
common: "http://192.168.1.211:8890",
|
||||
buyer: "http://192.168.1.211:8888",
|
||||
vlog: "http://192.168.1.211:8099",
|
||||
web: "http://192.168.1.211:8099",
|
||||
|
||||
};
|
||||
// 生产环境
|
||||
const prod = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "wzj4",
|
||||
"appid" : "__UNI__1F0975C",
|
||||
"appid" : "__UNI__6DB512D",
|
||||
"description" : "admin",
|
||||
"versionName" : "4.0.0",
|
||||
"versionCode" : 4000049,
|
||||
@ -23,14 +23,13 @@
|
||||
"modules" : {
|
||||
"Payment" : {},
|
||||
"Share" : {},
|
||||
"Fingerprint" : {},
|
||||
"FaceID" : {},
|
||||
"Geolocation" : {},
|
||||
"Maps" : {},
|
||||
"OAuth" : {},
|
||||
"Camera" : {},
|
||||
"Barcode" : {},
|
||||
"VideoPlayer" : {}
|
||||
"VideoPlayer" : {},
|
||||
"Push" : {}
|
||||
},
|
||||
"error" : {
|
||||
/* 404错误页面*/
|
||||
@ -90,7 +89,7 @@
|
||||
"payment" : {
|
||||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wx32788b91bdb614c0",
|
||||
"appid" : "wxebcdaea31881caab",
|
||||
"UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
|
||||
},
|
||||
"alipay" : {
|
||||
@ -100,14 +99,14 @@
|
||||
"ad" : {},
|
||||
"share" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx32788b91bdb614c0",
|
||||
"appid" : "wxebcdaea31881caab",
|
||||
"UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
|
||||
}
|
||||
},
|
||||
"oauth" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx32788b91bdb614c0",
|
||||
"appsecret" : "230233cef7520ee935bbecad372a370e",
|
||||
"appid" : "wxebcdaea31881caab",
|
||||
"appsecret" : "71826d76bad096ec5407897c6ed1391f",
|
||||
"UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
|
||||
},
|
||||
"apple" : {},
|
||||
@ -120,6 +119,9 @@
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appkey_ios" : "f463d3350efe63f8be5d9a62f24d0aab",
|
||||
"appkey_android" : "fb3f1ccb34616c70f068aa950f3e27df"
|
||||
},
|
||||
"system" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
}
|
||||
},
|
||||
"maps" : {
|
||||
@ -174,7 +176,8 @@
|
||||
"xxhdpi" : "CustomStartPage/start-page.9.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nativePlugins" : {}
|
||||
},
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
|
1
nativeResources/android/assets/agconnect-services.json
Normal file
1
nativeResources/android/assets/agconnect-services.json
Normal file
@ -0,0 +1 @@
|
||||
{"agcgw":{"url":"connect-drcn.dbankcloud.cn","backurl":"connect-drcn.hispace.hicloud.com","websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn","websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com"},"agcgw_all":{"SG":"connect-dra.dbankcloud.cn","SG_back":"connect-dra.hispace.hicloud.com","CN":"connect-drcn.dbankcloud.cn","CN_back":"connect-drcn.hispace.hicloud.com","RU":"connect-drru.hispace.dbankcloud.ru","RU_back":"connect-drru.hispace.dbankcloud.cn","DE":"connect-dre.dbankcloud.cn","DE_back":"connect-dre.hispace.hicloud.com"},"websocketgw_all":{"SG":"connect-ws-dra.hispace.dbankcloud.cn","SG_back":"connect-ws-dra.hispace.dbankcloud.com","CN":"connect-ws-drcn.hispace.dbankcloud.cn","CN_back":"connect-ws-drcn.hispace.dbankcloud.com","RU":"connect-ws-drru.hispace.dbankcloud.ru","RU_back":"connect-ws-drru.hispace.dbankcloud.cn","DE":"connect-ws-dre.hispace.dbankcloud.cn","DE_back":"connect-ws-dre.hispace.dbankcloud.com"},"client":{"cp_id":"30086000741655511","product_id":"388421841221950710","client_id":"1346412471476315840","client_secret":"F4B8602C5E2D5642872ED211C7478DB199EA3882FF02AD64113FCFD85CAE0E39","project_id":"388421841221950710","app_id":"110231111","api_key":"DQEDAKxxD0khNfIg6UkOoL08FvJ7BHkKnRi926D1isiHr1coC0avMtrtUxZSJOgu8nUoEWou+q/cZEY+O+5p40IarYKa/PD/JPoYMQ==","package_name":"cn.net.wzj.mall"},"oauth_client":{"client_id":"110231111","client_type":1},"app_info":{"app_id":"110231111","package_name":"cn.net.wzj.mall"},"service":{"analytics":{"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn","collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com","collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn","resource_id":"p1","channel_id":""},"ml":{"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"},"cloudstorage":{"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg":"https://ops-dra.agcstorage.link","storage_url_de":"https://ops-dre.agcstorage.link","storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia","storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu","storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn"},"search":{"url":"https://search-drcn.cloud.huawei.com"},"edukit":{"edu_url":"edukit.cloud.huawei.com.cn","dh_url":"edukit.cloud.huawei.com.cn"}},"region":"CN","configuration_version":"3.0","appInfos":[{"package_name":"cn.net.wzj.mall","client":{"app_id":"110231111"},"app_info":{"package_name":"cn.net.wzj.mall","app_id":"110231111"},"oauth_client":{"client_type":1,"client_id":"110231111"}}]}
|
1
nativeResources/android/assets/timpush-configs.json
Normal file
1
nativeResources/android/assets/timpush-configs.json
Normal file
@ -0,0 +1 @@
|
||||
{"version":"1.0.1","cn.net.wzj.mall":{"manifestPlaceholders":{"VIVO_APPKEY":"ebe0d2ef18e69264e8ddfb48472cb3ec","VIVO_APPID":"105722088","HONOR_APPID":"104443878"},"xiaomiPushBussinessId":"41169","xiaomiPushAppId":"2882303761520283584","xiaomiPushAppKey":"5242028361584","oppoPushBussinessId":"41170","oppoPushAppKey":"d64af1f3a4c54c0dae37d556fde086af","oppoPushAppSecret":"f6458a874f9b432aaa7a4e4a7b782fd0","huaweiPushBussinessId":"41171","huaweiBadgeClassName":"","meizuPushBussinessId":"41176","meizuPushAppId":"153237","meizuPushAppKey":"e6cdd35fcd6b47679ccd9f5bba117578","vivoPushBussinessId":"41177","honorPushBussinessId":"41178"}}
|
5
nativeResources/android/manifestPlaceholders.json
Normal file
5
nativeResources/android/manifestPlaceholders.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"VIVO_APPKEY": "ebe0d2ef18e69264e8ddfb48472cb3ec",
|
||||
"VIVO_APPID": "105722088",
|
||||
"HONOR_APPID": "104443878"
|
||||
}
|
6
nativeResources/android/mcs-services.json
Normal file
6
nativeResources/android/mcs-services.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"developer_id":"109999867274",
|
||||
"app_id":"104443878",
|
||||
"package_name":"cn.net.wzj.mall",
|
||||
"version":"1.0"
|
||||
}
|
3
nativeResources/ios/Resources/timpush-configs.json
Normal file
3
nativeResources/ios/Resources/timpush-configs.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"businessID": "45148"
|
||||
}
|
BIN
nativeplugins/JG-JPush/android/HiPushSDK-8.0.12.307.aar
Normal file
BIN
nativeplugins/JG-JPush/android/HiPushSDK-8.0.12.307.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/agconnect-core-1.7.3.302.aar
Normal file
BIN
nativeplugins/JG-JPush/android/agconnect-core-1.7.3.302.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/availableupdate-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/availableupdate-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/base-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/base-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/baselegacyapi-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/baselegacyapi-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/com.heytap.msp_3.5.3.aar
Normal file
BIN
nativeplugins/JG-JPush/android/com.heytap.msp_3.5.3.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/device-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/device-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-common-20.3.1.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-common-20.3.1.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-components-17.1.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-components-17.1.0.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-datatransport-18.1.7.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-datatransport-18.1.7.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-encoders-json-18.0.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-encoders-json-18.0.0.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-iid-interop-17.1.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-iid-interop-17.1.0.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-installations-17.1.3.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-installations-17.1.3.aar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/firebase-messaging-23.1.2.aar
Normal file
BIN
nativeplugins/JG-JPush/android/firebase-messaging-23.1.2.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/hatool-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/hatool-6.9.0.300.aar
Normal file
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/libs/commons-codec-1.6.jar
Normal file
BIN
nativeplugins/JG-JPush/android/libs/commons-codec-1.6.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/libs/firebase-encoders-17.0.0.jar
Normal file
BIN
nativeplugins/JG-JPush/android/libs/firebase-encoders-17.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/libs/javax.inject-1.jar
Executable file
BIN
nativeplugins/JG-JPush/android/libs/javax.inject-1.jar
Executable file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/libs/jpush-android-5.6.0.jar
Normal file
BIN
nativeplugins/JG-JPush/android/libs/jpush-android-5.6.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/libs/tasks-1.5.2.206.jar
Normal file
BIN
nativeplugins/JG-JPush/android/libs/tasks-1.5.2.206.jar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/log-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/log-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/network-common-6.0.2.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/network-common-6.0.2.300.aar
Normal file
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/network-grs-6.0.2.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/network-grs-6.0.2.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/niopush-sdk-v1.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/niopush-sdk-v1.0.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/opendevice-6.11.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/opendevice-6.11.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/play-services-base-18.0.1.aar
Normal file
BIN
nativeplugins/JG-JPush/android/play-services-base-18.0.1.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/play-services-basement-18.1.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/play-services-basement-18.1.0.aar
Normal file
Binary file not shown.
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/play-services-stats-17.0.2.aar
Normal file
BIN
nativeplugins/JG-JPush/android/play-services-stats-17.0.2.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/play-services-tasks-18.0.2.aar
Normal file
BIN
nativeplugins/JG-JPush/android/play-services-tasks-18.0.2.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/push-6.11.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/push-6.11.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/push-internal-5.0.3.aar
Normal file
BIN
nativeplugins/JG-JPush/android/push-internal-5.0.3.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/security-base-1.2.0.307.aar
Normal file
BIN
nativeplugins/JG-JPush/android/security-base-1.2.0.307.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/security-encrypt-1.2.0.307.aar
Normal file
BIN
nativeplugins/JG-JPush/android/security-encrypt-1.2.0.307.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/security-ssl-1.2.0.307.aar
Normal file
BIN
nativeplugins/JG-JPush/android/security-ssl-1.2.0.307.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/stats-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/stats-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/transport-api-3.0.0.aar
Normal file
BIN
nativeplugins/JG-JPush/android/transport-api-3.0.0.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/transport-backend-cct-3.1.8.aar
Normal file
BIN
nativeplugins/JG-JPush/android/transport-backend-cct-3.1.8.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/transport-runtime-3.1.8.aar
Normal file
BIN
nativeplugins/JG-JPush/android/transport-runtime-3.1.8.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/ui-6.9.0.300.aar
Normal file
BIN
nativeplugins/JG-JPush/android/ui-6.9.0.300.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/uniplugin_jpush-release.aar
Normal file
BIN
nativeplugins/JG-JPush/android/uniplugin_jpush-release.aar
Normal file
Binary file not shown.
BIN
nativeplugins/JG-JPush/android/vivo_pushSDK_v4.0.6.0_506.aar
Normal file
BIN
nativeplugins/JG-JPush/android/vivo_pushSDK_v4.0.6.0_506.aar
Normal file
Binary file not shown.
@ -0,0 +1,17 @@
|
||||
//
|
||||
// JPushModule.h
|
||||
// UniPluginJPush
|
||||
//
|
||||
// Created by huangshuni on 2021/1/12.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DCUniModule.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface JPushModule : DCUniModule
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
BIN
nativeplugins/JG-JPush/ios/UniPluginJPush.framework/Info.plist
Normal file
BIN
nativeplugins/JG-JPush/ios/UniPluginJPush.framework/Info.plist
Normal file
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
169
nativeplugins/JG-JPush/package.json
Executable file
169
nativeplugins/JG-JPush/package.json
Executable file
@ -0,0 +1,169 @@
|
||||
{
|
||||
"name": "JG-JPush",
|
||||
"id": "JG-JPush",
|
||||
"version": "1.2.5",
|
||||
"description": "极光推送Hbuilder插件",
|
||||
"_dp_type":"nativeplugin",
|
||||
"_dp_nativeplugin":{
|
||||
"ios": {
|
||||
"deploymentTarget": "11.0",
|
||||
"validArchitectures": [
|
||||
"arm64"
|
||||
],
|
||||
"plugins": [{
|
||||
"type": "module",
|
||||
"name": "JG-JPush",
|
||||
"class": "JPushModule"
|
||||
}],
|
||||
"hooksClass": "JPushProxy",
|
||||
"integrateType": "framework",
|
||||
"frameworks": [
|
||||
"CFNetwork.framework",
|
||||
"CoreFoundation.framework",
|
||||
"CoreTelephony.framework",
|
||||
"SystemConfiguration.framework",
|
||||
"CoreGraphics.framework",
|
||||
"Foundation.framework",
|
||||
"UIKit.framework",
|
||||
"Security.framework",
|
||||
"libz.tbd",
|
||||
"AdSupport.framework",
|
||||
"UserNotifications.framework",
|
||||
"libresolv.tbd",
|
||||
"WebKit.framework",
|
||||
"AppTrackingTransparency.framework",
|
||||
"StoreKit.framework"
|
||||
],
|
||||
"resources": [
|
||||
|
||||
],
|
||||
"capabilities": {
|
||||
"entitlements": {
|
||||
"aps-environment":"development"
|
||||
}
|
||||
},
|
||||
"privacies": [
|
||||
"NSLocationAlwaysAndWhenInUseUsageDescription",
|
||||
"NSLocationAlwaysUsageDescription",
|
||||
"NSLocationWhenInUseUsageDescription"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_ISPRODUCTION_IOS": {
|
||||
"des": "[iOS]是否是生产环境,是填true,不是填false或者不填",
|
||||
"key": "JPush:ISPRODUCTION"
|
||||
},
|
||||
"JPUSH_ADVERTISINGID_IOS": {
|
||||
"des": "[iOS]广告标识符(IDFA)如果不需要使用IDFA,可不填",
|
||||
"key": "JPush:ADVERTISINGID"
|
||||
},
|
||||
"JPUSH_DEFAULTINITJPUSH_IOS": {
|
||||
"des": "[iOS]是否默认初始化,是填true,不是填false或者不填",
|
||||
"key": "JPush:DEFAULTINITJPUSH"
|
||||
}
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "JG-JPush",
|
||||
"class": "cn.jiguang.uniplugin_jpush.JPushModule"
|
||||
}
|
||||
],
|
||||
"integrateType": "aar",
|
||||
"minSdkVersion": "19",
|
||||
"permissions": [
|
||||
"${applicationId}.permission.JPUSH_MESSAGE",
|
||||
"android.permission.INTERNET",
|
||||
"android.permission.ACCESS_NETWORK_STATE",
|
||||
"android.permission.POST_NOTIFICATIONS",
|
||||
"com.huawei.android.launcher.permission.CHANGE_BADGE",
|
||||
"com.vivo.notification.permission.BADGE_ICON",
|
||||
"com.hihonor.android.launcher.permission.CHANGE_BADGE",
|
||||
"android.permission.VIBRATE",
|
||||
"android.permission.ACCESS_COARSE_LOCATION",
|
||||
"android.permission.ACCESS_FINE_LOCATION",
|
||||
"android.permission.ACCESS_BACKGROUND_LOCATION",
|
||||
"android.permission.READ_PHONE_STATE",
|
||||
"android.permission.QUERY_ALL_PACKAGES",
|
||||
"android.permission.GET_TASKS",
|
||||
"android.permission.ACCESS_WIFI_STATE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"${applicationId}.permission.MIPUSH_RECEIVE",
|
||||
"com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE",
|
||||
"com.heytap.mcs.permission.RECIEVE_MCS_MESSAGE"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_OPPO_APPKEY": {
|
||||
"des": "厂商OPPO-appkey,示例:OP-12345678",
|
||||
"key": "OPPO_APPKEY"
|
||||
},
|
||||
"JPUSH_OPPO_APPID":{
|
||||
"des": "厂商OPPO-appId,示例:OP-12345678",
|
||||
"key": "OPPO_APPID"
|
||||
},
|
||||
"JPUSH_OPPO_APPSECRET":{
|
||||
"des": "厂商OPPO-appSecret,示例:OP-12345678",
|
||||
"key": "OPPO_APPSECRET"
|
||||
},
|
||||
"JPUSH_VIVO_APPKEY":{
|
||||
"des": "厂商VIVO-appkey,示例:12345678",
|
||||
"key": "com.vivo.push.api_key"
|
||||
},
|
||||
"JPUSH_VIVO_APPID":{
|
||||
"des": "厂商VIVO-appId,示例:12345678",
|
||||
"key": "com.vivo.push.app_id"
|
||||
},
|
||||
"JPUSH_MEIZU_APPKEY":{
|
||||
"des": "厂商MEIZU-appKey,示例:MZ-12345678",
|
||||
"key": "MEIZU_APPKEY"
|
||||
},
|
||||
"JPUSH_MEIZU_APPID":{
|
||||
"des": "厂商MEIZU-appId,示例:MZ-12345678",
|
||||
"key": "MEIZU_APPID"
|
||||
},
|
||||
"JPUSH_XIAOMI_APPKEY":{
|
||||
"des": "厂商XIAOMI-appKey,示例:MI-12345678",
|
||||
"key": "XIAOMI_APPKEY"
|
||||
},
|
||||
"JPUSH_XIAOMI_APPID":{
|
||||
"des": "厂商XIAOMI-appId,示例:MI-12345678",
|
||||
"key": "XIAOMI_APPID"
|
||||
},
|
||||
"JPUSH_HUAWEI_APPID":{
|
||||
"des": "厂商HUAWEI-appId,示例:appid=12346578",
|
||||
"key": "com.huawei.hms.client.appid"
|
||||
},
|
||||
"JPUSH_HONOR_APPID" : {
|
||||
"des" : "厂商HONOR-appId,示例:12346578",
|
||||
"key" : "com.hihonor.push.app_id"
|
||||
},
|
||||
"JPUSH_NIO_APPID" : {
|
||||
"des" : "厂商nio-appId,示例:12346578",
|
||||
"key" : "nio_push_app_id"
|
||||
},
|
||||
"JPUSH_GOOGLE_API_KEY" : {
|
||||
"des" : "厂商google api_key,示例:g-12346578",
|
||||
"key" : "google_api_key"
|
||||
},
|
||||
"JPUSH_GOOGLE_APP_ID" : {
|
||||
"des" : "厂商google mobilesdk_app_id,示例:g-12346578",
|
||||
"key" : "google_app_id"
|
||||
},
|
||||
"JPUSH_GOOGLE_PROJECT_NUMBER" : {
|
||||
"des" : "厂商google project_number,示例:g-12346578",
|
||||
"key" : "gcm_defaultSenderId"
|
||||
},
|
||||
"JPUSH_GOOGLE_PROJECT_ID" : {
|
||||
"des" : "厂商google project_id ,示例:g-12346578",
|
||||
"key" : "project_id"
|
||||
},
|
||||
"JPUSH_GOOGLE_STORAGE_BUCKET" : {
|
||||
"des" : "厂商google storage_bucket,示例:g-12346578",
|
||||
"key" : "google_storage_bucket"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1958
package-lock.json
generated
1958
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
pages.json
39
pages.json
@ -489,14 +489,14 @@
|
||||
"navigationBarBackgroundColor": "#181b27"
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "path" : "pages/me/settings",
|
||||
// "style" : {
|
||||
// "navigationBarTitleText" : "设置",
|
||||
// "navigationBarTextStyle" : "white",
|
||||
// "navigationBarBackgroundColor" : "#181b27"
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/me/settings",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#181b27"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/me/myFans",
|
||||
"style": {
|
||||
@ -543,7 +543,22 @@
|
||||
"navigationBarTitleText": "消息详情",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#181b27"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/search/search",
|
||||
"style": {
|
||||
"app-plus": {
|
||||
"titleNView": false //禁用原生导航栏
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/search/searchList",
|
||||
"style": {
|
||||
"app-plus": {
|
||||
"titleNView": false //禁用原生导航栏
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -1271,12 +1286,10 @@
|
||||
"app-plus": {
|
||||
"softinputMode": "adjustResize",
|
||||
"titleNView": {
|
||||
"buttons": [
|
||||
{
|
||||
"buttons": [{
|
||||
"type": "menu"
|
||||
// "click": "handleMenuClick" // 绑定点击事件
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
},
|
||||
"h5": {
|
||||
|
@ -121,7 +121,7 @@
|
||||
|
||||
<view class="vlog-list">
|
||||
<block v-for="(vlog, index) in vlogList" :key="index">
|
||||
<image class="vlog-cover" :src="vlog.cover" @click="goToVlog(vlog)" mode="aspectFill"></image>
|
||||
<image class="vlog-cover" :src="vlog.cover||vlog.firstFrameImg" @click="goToVlog(vlog)" mode="aspectFill"></image>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
@ -231,7 +231,8 @@
|
||||
this.pageUserInfo = result.data.data;
|
||||
storage.setVlogUserInfo(this.pageUserInfo)
|
||||
// 查询用户信息
|
||||
this.myList(0, 'myPublicList', true);
|
||||
this.switchTab(0)
|
||||
// this.myList(0, 'myPublicList', true);
|
||||
this.setBasicUserInfo(this.pageUserInfo);
|
||||
}
|
||||
},
|
||||
@ -355,14 +356,14 @@
|
||||
goMyFans(userId) {
|
||||
uni.navigateTo({
|
||||
animationType: "fade-in",
|
||||
url: "myFans?userId=" + userId,
|
||||
url: "myFans",
|
||||
});
|
||||
},
|
||||
// 关注列表
|
||||
goMyFollows(userId) {
|
||||
uni.navigateTo({
|
||||
animationType: "fade-in",
|
||||
url: "myFollows?userId=" + userId,
|
||||
url: "myFollows",
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
<view class="mpage">
|
||||
<view class="line"></view>
|
||||
<scroll-view scroll-y="true" @scrolltolower="pagingFansList()">
|
||||
<view class="user-wrapper" v-for="(f, index) in fansList" :key="index">
|
||||
<view class="user-wrapper" v-for="(f, index) in fansList" :key="f.fanId">
|
||||
<view class="user-info" @click="goTovlogerInfo(f.fanId)">
|
||||
<image class="face" :src="f.face" />
|
||||
<text class="user-name">
|
||||
@ -10,29 +10,19 @@
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view v-if="isLogin && f.me" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff">你</text>
|
||||
</view>
|
||||
<view v-else-if="!isLogin || isLogin && !f.follow && !f.fan" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff" @click="followMe(f.fanId)">
|
||||
关注
|
||||
</text>
|
||||
</view>
|
||||
<view v-else-if="isLogin && !f.follow && f.fan" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff" @click="followMe(f.fanId)">
|
||||
<view v-if="!from">
|
||||
<view v-if="f.bothFriend==0" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ef274d" @click="followMe(f.fanId)">
|
||||
回粉
|
||||
</text>
|
||||
</view>
|
||||
<view v-else-if="isLogin && f.follow && !f.fan" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ef274d" @click="cancelFollow(f.fanId)">
|
||||
已关注
|
||||
<view v-if="f.bothFriend==1" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff" @click="cancelFollow(f.fanId)">
|
||||
互粉
|
||||
</text>
|
||||
</view>
|
||||
<view v-else-if="isLogin && f.follow && f.fan" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ef274d" @click="cancelFollow(f.fanId)">
|
||||
互关
|
||||
</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@ -53,28 +43,28 @@
|
||||
data() {
|
||||
return {
|
||||
userId: "",
|
||||
currentUserId: "",
|
||||
isLogin: false,
|
||||
screenHeight: 0,
|
||||
page: 0,
|
||||
totalPage: 0,
|
||||
fansList: [],
|
||||
from:false
|
||||
};
|
||||
},
|
||||
onLoad(param) {
|
||||
if(!isStrEmpty(param.userId)){
|
||||
this.from = true
|
||||
this.userId = param.userId
|
||||
}else{
|
||||
var uinfo = storage.getVlogUserInfo()
|
||||
if (uinfo == null) {
|
||||
return
|
||||
this.userId = uinfo.id;
|
||||
}
|
||||
this.isLogin = true;
|
||||
this.currentUserId = uinfo.id
|
||||
this.userId = param.userId;
|
||||
this.queryMyFansList(0);
|
||||
},
|
||||
methods: {
|
||||
goTovlogerInfo(vlogerId) {
|
||||
var id = storage.getVlogUserInfo().id
|
||||
// 是否是当前登录的用户
|
||||
if (this.currentUserId == vlogerId) {
|
||||
if (id == vlogerId) {
|
||||
uni.switchTab({
|
||||
url: "me",
|
||||
});
|
||||
@ -91,15 +81,15 @@
|
||||
for (let i = 0; i < fansList.length; i++) {
|
||||
let fan = fansList[i];
|
||||
if (fan.fanId == vlogerId) {
|
||||
fan.follow = status;
|
||||
fansList.splice(i, 1, fan);
|
||||
fan.bothFriend = status;
|
||||
// fansList.splice(i, 1);
|
||||
}
|
||||
}
|
||||
me.fansList = fansList;
|
||||
},
|
||||
async cancelFollow(vlogerId) {
|
||||
let me = this;
|
||||
let userId = storage.getVlogUserInfo().id
|
||||
let userId = me.userId
|
||||
let data = {
|
||||
myId: userId,
|
||||
vlogerId
|
||||
@ -107,7 +97,7 @@
|
||||
var result = await vlogFansCancel(data)
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
me.reFreshList(vlogerId, false);
|
||||
me.reFreshList(vlogerId, 0);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
@ -118,7 +108,7 @@
|
||||
},
|
||||
async followMe(vlogerId) {
|
||||
let me = this;
|
||||
let userId = this.currentUserId;
|
||||
let userId = me.userId;
|
||||
let data = {
|
||||
myId: userId,
|
||||
vlogerId
|
||||
@ -126,7 +116,7 @@
|
||||
var result = await vlogFansFollow(data)
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
me.reFreshList(vlogerId, true);
|
||||
me.reFreshList(vlogerId, 1);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
@ -148,6 +138,7 @@
|
||||
pageSize: 10
|
||||
}
|
||||
var result = await vlogQueryMyFans(data)
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
let fansList = result.data.data.rows;
|
||||
let totalPage = result.data.data.total;
|
||||
@ -218,6 +209,7 @@
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
@ -232,7 +224,7 @@
|
||||
justify-content: center;
|
||||
background-color: #ef274d;
|
||||
border-radius: 20rpx;
|
||||
align-self: center;
|
||||
align-items: center;
|
||||
border-width: 2rpx;
|
||||
border-color: #ef274d;
|
||||
background-color: #181b27;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<view class="mpage">
|
||||
<view class="line"></view>
|
||||
<scroll-view scroll-y="true" @scrolltolower="pagingFollowsList">
|
||||
<view class="user-wrapper" v-for="(f, index) in followsList" :key="index">
|
||||
<view class="user-wrapper" v-for="(f, index) in followsList" :key="f.vlogerId">
|
||||
<view class="user-info" @click="goTovlogerInfo(f.vlogerId)">
|
||||
<image class="face" :src="f.face" />
|
||||
<text class="user-name">
|
||||
@ -10,25 +10,19 @@
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view v-if="f.me" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff">你</text>
|
||||
</view>
|
||||
<view v-else-if="!f.follow" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff" @click="followMe(f.vlogerId)">
|
||||
关注
|
||||
</text>
|
||||
</view>
|
||||
<view v-else-if="f.follow && !f.fan" class="operator-wrapper">
|
||||
<view v-if="!from">
|
||||
<view v-if="f.bothFriend==0" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ef274d" @click="cancelFollow(f.vlogerId)">
|
||||
已关注
|
||||
</text>
|
||||
</view>
|
||||
<view v-else-if="f.follow && f.fan" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ef274d" @click="cancelFollow(f.vlogerId)">
|
||||
<view v-if="f.bothFriend==1" class="operator-wrapper">
|
||||
<text class="operator-words" style="color: #ffffff" @click="cancelFollow(f.vlogerId)">
|
||||
互关
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
@ -48,26 +42,27 @@
|
||||
data() {
|
||||
return {
|
||||
userId: "",
|
||||
currentUserId: "",
|
||||
screenHeight: 0,
|
||||
page: 0,
|
||||
totalPage: 0,
|
||||
followsList: [],
|
||||
from: false
|
||||
};
|
||||
},
|
||||
onLoad(param) {
|
||||
if (!isStrEmpty(param.userId)) {
|
||||
this.from = true
|
||||
this.userId = param.userId
|
||||
} else {
|
||||
var uinfo = storage.getVlogUserInfo()
|
||||
if (uinfo==null) {
|
||||
return
|
||||
this.userId = uinfo.id;
|
||||
}
|
||||
this.currentUserId = uinfo.id
|
||||
this.userId = param.userId;
|
||||
this.queryMyFollowList(0);
|
||||
},
|
||||
methods: {
|
||||
goTovlogerInfo(vlogerId) {
|
||||
// 是否是当前登录的用户
|
||||
if (this.currentUserId == vlogerId) {
|
||||
var id = storage.getVlogUserInfo().id
|
||||
if (id == vlogerId) {
|
||||
uni.switchTab({
|
||||
url: "me",
|
||||
});
|
||||
@ -84,15 +79,15 @@
|
||||
for (let i = 0; i < followsList.length; i++) {
|
||||
let vloger = followsList[i];
|
||||
if (vloger.vlogerId == vlogerId) {
|
||||
vloger.follow = status;
|
||||
followsList.splice(i, 1, vloger);
|
||||
vloger.bothFriend = status;
|
||||
followsList.splice(i, 1);
|
||||
}
|
||||
}
|
||||
me.followsList = followsList;
|
||||
},
|
||||
async cancelFollow(vlogerId) {
|
||||
let me = this;
|
||||
let userId = this.currentUserId;
|
||||
let userId = this.userId;
|
||||
var data = {
|
||||
myId: userId,
|
||||
vlogerId
|
||||
@ -100,7 +95,7 @@
|
||||
var result = await vlogFansCancel(data)
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
me.reFreshList(vlogerId, false);
|
||||
me.reFreshList(vlogerId, 0);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
@ -111,7 +106,7 @@
|
||||
},
|
||||
async followMe(vlogerId) {
|
||||
let me = this;
|
||||
let userId = this.currentUserId;
|
||||
let userId = this.userId;
|
||||
let data = {
|
||||
myId: userId,
|
||||
vlogerId
|
||||
@ -132,11 +127,8 @@
|
||||
let me = this;
|
||||
page = page + 1;
|
||||
let userId = me.userId;
|
||||
let currentUserId = this.currentUserId;
|
||||
var data = {
|
||||
myId: userId,
|
||||
// vlogerId: userId,
|
||||
// currentUserId: currentUserId,
|
||||
page: page,
|
||||
pageSize: 10
|
||||
}
|
||||
@ -145,6 +137,7 @@
|
||||
let followsList = result.data.data.rows;
|
||||
let totalPage = result.data.data.total;
|
||||
me.followsList = me.followsList.concat(followsList);
|
||||
console.log(me.followsList)
|
||||
me.page = page;
|
||||
me.totalPage = totalPage;
|
||||
}
|
||||
@ -157,8 +150,8 @@
|
||||
}
|
||||
this.queryMyFollowList(this.page);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -206,7 +199,7 @@
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
align-items: center;
|
||||
|
||||
|
||||
}
|
||||
|
227
pages/me/settings.vue
Executable file
227
pages/me/settings.vue
Executable file
@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- <view class="line"></view> -->
|
||||
|
||||
<scroll-view scroll-y="true">
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
">
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
">
|
||||
<image
|
||||
src="/static/imooc/lee.jpeg"
|
||||
mode="widthFix"
|
||||
class="fengjianyingyue"
|
||||
style="align-self: center"></image>
|
||||
<image
|
||||
src="/static/imooc/fengjianyingyue.png"
|
||||
mode="widthFix"
|
||||
class="fengjianyingyue-name"
|
||||
style="align-self: center"></image>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<text class="introduce">
|
||||
物流科技公司部门经理,近10年开发和技术管理经验。主要从事后端技术和架构领域,有丰富的电商平台与物流平台核心系统的架构设计和开发经验。
|
||||
拥有丰富的大型项目开发经验,授课风格诙谐幽默,讲解到位细致。
|
||||
</text>
|
||||
<text class="introduce">
|
||||
近20万的学生学习人数,学生入职公司有:
|
||||
百度云盘,阿里,腾讯云,字节跳动,金山,网易,OPPO,新浪微博,华为,货拉拉,58同城,海信,蘑菇街,金蝶
|
||||
等。
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
">
|
||||
<image
|
||||
src="/static/imooc/course-javaarchitect.png"
|
||||
mode="widthFix"
|
||||
class="course"
|
||||
style="width: 380rpx"></image>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
">
|
||||
<image
|
||||
src="/static/imooc/course-pm.png"
|
||||
mode="widthFix"
|
||||
class="course"
|
||||
style=""></image>
|
||||
<image
|
||||
src="/static/imooc/course-springcloud.png"
|
||||
mode="widthFix"
|
||||
class="course"
|
||||
style=""></image>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
">
|
||||
<image
|
||||
src="/static/imooc/course-netty.png"
|
||||
mode="widthFix"
|
||||
class="course"
|
||||
style=""></image>
|
||||
<image
|
||||
src="/static/imooc/course-zookeeper.png"
|
||||
mode="widthFix"
|
||||
class="course"
|
||||
style=""></image>
|
||||
</view>
|
||||
|
||||
<!-- <view style="display: flex;flex-direction: row;justify-content: center;margin-top: 20rpx;">
|
||||
<image src="/static/imooc/lee-qrcode.png" mode="widthFix" class="course" style="width: 380rpx;"></image>
|
||||
</view> -->
|
||||
|
||||
<view
|
||||
:class="{ logout: !logoutTouched, 'logout-touched': logoutTouched }"
|
||||
@touchstart="touchstartLogout"
|
||||
@touchend="touchendLogout"
|
||||
@click="logout"
|
||||
style="
|
||||
margin-top: 20rpx;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
width: 750rpx;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
">
|
||||
<text style="color: #ffffff; align-self: center; font-size: 15px">
|
||||
退出登录
|
||||
</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
logoutTouched: false,
|
||||
};
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {
|
||||
touchstartLogout() {
|
||||
this.logoutTouched = true;
|
||||
},
|
||||
touchendLogout() {
|
||||
this.logoutTouched = false;
|
||||
},
|
||||
logout() {
|
||||
// let userId = getApp().getUserInfoSession().id;
|
||||
// uni.request({
|
||||
// method: "GET",
|
||||
// url: serverUrl + "/passport/logout?userId=" + userId,
|
||||
// success(result) {
|
||||
// let status = result.data.status;
|
||||
// if (status == 211) {
|
||||
// app.clearUserInfo();
|
||||
// uni.showToast({
|
||||
// title: result.data.msg,
|
||||
// duration: 3000
|
||||
// })
|
||||
// // 在登录登出后,都需要重新刷新首页list,目的为了刷新关注点赞状态
|
||||
// // uni.setStorageSync("needRefreshIndexVlogList", "1");
|
||||
// // uni.switchTab({
|
||||
// // url: "../index/index"
|
||||
// // })
|
||||
// uni.reLaunch({
|
||||
// url: "../index/index",
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #181b27;
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 1rpx;
|
||||
background-color: #393a41;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.place-box {
|
||||
background-color: #4a4c52;
|
||||
}
|
||||
.place-box-touched {
|
||||
background-color: #6d6b6b;
|
||||
}
|
||||
|
||||
.right-arrow {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.logout {
|
||||
background-color: #4a4c52;
|
||||
}
|
||||
.logout-touched {
|
||||
background-color: #6d6b6b;
|
||||
}
|
||||
.fengjianyingyue {
|
||||
width: 250rpx;
|
||||
border-width: 1rpx;
|
||||
border-color: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.fengjianyingyue-name {
|
||||
width: 200rpx;
|
||||
margin-top: 26rpx;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.introduce {
|
||||
color: #f1f1f1;
|
||||
font-size: 26rpx;
|
||||
font-weight: 300;
|
||||
width: 440rpx;
|
||||
}
|
||||
.course {
|
||||
width: 330rpx;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
687
pages/me/vlogerInfo.nvue
Executable file
687
pages/me/vlogerInfo.nvue
Executable file
@ -0,0 +1,687 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view
|
||||
class="isLogin-info-wrapper"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
scroll-y="true"
|
||||
@scrolltolower="loadMore">
|
||||
<image class="mybg" :src="pageUserInfo.bgImg" mode="aspectFill" />
|
||||
|
||||
|
||||
<view class="header" :style="{ marginTop: statusBarHeight + 'px' }">
|
||||
<image
|
||||
class="header-right-search"
|
||||
src="../../static/images/icon-back.png"
|
||||
@click="back()" />
|
||||
</view>
|
||||
<view class="my-info-wrapper">
|
||||
<view class="my-info">
|
||||
<image :src="pageUserInfo.face" mode="aspectFill" class="my-face" />
|
||||
<view class="info-wrapper">
|
||||
<text class="nickname">
|
||||
{{ pageUserInfo.nickname }}
|
||||
</text>
|
||||
<view class="tiktok-num-wrapper">
|
||||
<text class="tiktok-num">视频号:</text>
|
||||
<text class="tiktok-num">
|
||||
{{ pageUserInfo.imoocNum }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="location">
|
||||
<text class="location-text">所在地:</text>
|
||||
<text class="location-text">
|
||||
{{ pageUserInfo.city == "" ? "中国" : "" + pageUserInfo.city
|
||||
}}{{
|
||||
pageUserInfo.district == "" ? "" : "·" + pageUserInfo.district
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="sex-wrapper">
|
||||
<view class="constellation">
|
||||
<image
|
||||
class="sex-img"
|
||||
v-if="pageUserInfo.sex == 1"
|
||||
src="/static/images/icon-sex-boy.png" />
|
||||
<image
|
||||
class="sex-img"
|
||||
v-if="pageUserInfo.sex == 0"
|
||||
src="/static/images/icon-sex-girl.png" />
|
||||
<image
|
||||
class="sex-img"
|
||||
v-if="pageUserInfo.sex == 2"
|
||||
src="/static/images/icon-sex-secret.png" />
|
||||
<text class="astro">{{ astro }}座</text>
|
||||
</view>
|
||||
<view class="animal">
|
||||
<text class="animal-text">
|
||||
{{ animal }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="desc">
|
||||
{{ pageUserInfo.description }}
|
||||
</text>
|
||||
|
||||
<view class="bottom-wrapper">
|
||||
<view class="bottom">
|
||||
<view class="bottom-item" @click="goMyFollows(pageUserInfo.id)">
|
||||
<text class="item-num">
|
||||
{{ getGraceNumber(pageUserInfo.myFollowsCounts) }}
|
||||
</text>
|
||||
<text class="item-text">关注</text>
|
||||
</view>
|
||||
<view class="bottom-item" @click="goMyFans(pageUserInfo.id)">
|
||||
<text class="item-num">
|
||||
{{ getGraceNumber(pageUserInfo.myFansCounts) }}
|
||||
</text>
|
||||
<text class="item-text">粉丝</text>
|
||||
</view>
|
||||
<view class="bottom-item">
|
||||
<text class="item-num">
|
||||
{{ getGraceNumber(pageUserInfo.totalLikeMeCounts) }}
|
||||
</text>
|
||||
<text class="item-text">获赞</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="edit">
|
||||
<view
|
||||
v-if="isFollow && !isFan"
|
||||
@click="cancelFollow()"
|
||||
class="follow-btn">
|
||||
<text class="follow-text">已关注</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="isFollow && isFan"
|
||||
@click="cancelFollow()"
|
||||
class="follow-btn">
|
||||
<text class="follow-text">相互关注</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="!isFollow"
|
||||
@click="followMe()"
|
||||
class="follow-btn"
|
||||
style="background-color: #ef274d">
|
||||
<text class="follow-text">关注我</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tab-wrapper">
|
||||
<view class="tab-item" @click="switchTab(0)">
|
||||
<text class="tab-normal" :class="{ 'tab-selected': currentTab == 0 }">
|
||||
作品
|
||||
</text>
|
||||
<view v-if="currentTab == 0" class="selected-tab"></view>
|
||||
</view>
|
||||
<!-- <view class="tab-item" @click="switchTab(1)">
|
||||
<text class="tab-normal" :class="{ 'tab-selected': currentTab == 1 }">
|
||||
私密
|
||||
</text>
|
||||
<view v-if="currentTab == 1" class="selected-tab"></view>
|
||||
</view> -->
|
||||
<view class="tab-item" @click="switchTab(1)">
|
||||
<text class="tab-normal" :class="{ 'tab-selected': currentTab == 1 }">
|
||||
赞过
|
||||
</text>
|
||||
<view v-if="currentTab == 1" class="selected-tab"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="vlog-list">
|
||||
<block v-for="(vlog, index) in vlogList" :key="index">
|
||||
<image
|
||||
class="vlog-cover"
|
||||
:src="vlog.cover||vlog.firstFrameImg"
|
||||
@click="goToVlog(vlog)"
|
||||
mode="aspectFill"></image>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view v-if="vlogList.length == 0" class="empty">
|
||||
<text class="empty-text">~ 空空如也 ~</text>
|
||||
</view>
|
||||
|
||||
<view v-if="vlogList.length > 0" class="not-empty">
|
||||
<text class="not-empty-text">~ 没有更多了 ~</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let system = uni.getSystemInfoSync();
|
||||
import * as filters from "@/utils/filters.js"
|
||||
import api from "@/config/api.js";
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import {
|
||||
vlogUserInfo,
|
||||
vlogQueryDoIFollowVloger,
|
||||
vlogMyPublicList,
|
||||
vlogMyPrivateList,
|
||||
vlogMyLikedList,
|
||||
vlogMeTag,
|
||||
vlogFansCancel,
|
||||
vlogFansFollow
|
||||
} from "@/api/vlog"
|
||||
|
||||
import {
|
||||
getAstro,
|
||||
getAnimal,
|
||||
dateFormat,
|
||||
graceNumber,
|
||||
isStrEmpty
|
||||
} from '@/utils/tools.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageUserInfo: {
|
||||
id: "",
|
||||
mobile: "",
|
||||
nickname: "",
|
||||
imoocNum: "",
|
||||
face: "",
|
||||
birthday: "1998-12-31T16:00:00.000+0000",
|
||||
country: "",
|
||||
province: "",
|
||||
city: "",
|
||||
district: "",
|
||||
description: "",
|
||||
myFollowsCounts: 0,
|
||||
myFansCounts: 0,
|
||||
totalLikeMeCounts: 0
|
||||
},
|
||||
userPageId: "",
|
||||
astro: "",
|
||||
animal: "",
|
||||
loginWords: "请登录",
|
||||
|
||||
statusBarHeight: 0,
|
||||
screenHeight: 0,
|
||||
screenHeightUnLogin: 0,
|
||||
|
||||
currentTab: 0,
|
||||
isFollow: false,
|
||||
isFan: false,
|
||||
isAndroid: uni.getSystemInfoSync().platform == "android",
|
||||
|
||||
page: 0,
|
||||
totalpage: 0,
|
||||
vlogList: [],
|
||||
};
|
||||
},
|
||||
async onLoad(params) {
|
||||
this.statusBarHeight = system.statusBarHeight;
|
||||
let screenHeight = system.safeArea.bottom + 50;
|
||||
this.screenHeight = screenHeight;
|
||||
let screenHeightUnLogin = system.safeArea.bottom;
|
||||
this.screenHeightUnLogin = screenHeightUnLogin;
|
||||
let me = this;
|
||||
|
||||
// 从视频页面, 点击用户头像传递过来的id
|
||||
let userPageId = params.userPageId;
|
||||
if (isStrEmpty(userPageId)) {
|
||||
uni.showToast({
|
||||
title: "出错啦~",
|
||||
icon: " none",
|
||||
duration: 2000,
|
||||
});
|
||||
settimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
me.userPageId = userPageId;
|
||||
var result = await vlogUserInfo(userPageId)
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
me.pageUserInfo = result.data.data;
|
||||
me.setBasicUserInfo(me.pageUserInfo);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
// this.switchTab(0);
|
||||
this.myList(0, 'myPublicList', true);
|
||||
let myUserId = "";
|
||||
let info = storage.getVlogUserInfo()
|
||||
if (info!=null) {
|
||||
myUserId = info.id;
|
||||
}
|
||||
|
||||
if (!isStrEmpty(myUserId)) {
|
||||
// 查询我是否关注博主
|
||||
var result = await vlogQueryDoIFollowVloger({myId:myUserId,vlogerId:userPageId})
|
||||
console.log(result)
|
||||
if (result.data.status == 200) {
|
||||
me.isFollow = result.data.data;
|
||||
// me.isFan = result.data.data;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
// 查询博主是否关注我
|
||||
var result2 = await vlogQueryDoIFollowVloger({myId:userPageId,vlogerId:myUserId})
|
||||
if (result2.data.status == 200) {
|
||||
me.isFan = result2.data.data;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result2.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setBasicUserInfo(myUserInfo) {
|
||||
// 根据生日判断星座
|
||||
let birthday = myUserInfo.birthday;
|
||||
let birth = dateFormat("YYYY-mm-dd", new Date(birthday));
|
||||
let birthArr = birth.split("-");
|
||||
let year = birthArr[0];
|
||||
let month = birthArr[1];
|
||||
let day = birthArr[2];
|
||||
let astro = getAstro(month, day);
|
||||
this.astro = astro;
|
||||
|
||||
// 根据生日判断生肖
|
||||
let animal = getAnimal(year);
|
||||
this.animal = animal;
|
||||
},
|
||||
switchTab(index) {
|
||||
this.currentTab = index;
|
||||
if (index == 0) {
|
||||
this.page = 0;
|
||||
this.toalPage = 0;
|
||||
this.myList(0, 'myPublicList', true);
|
||||
} else if (index == 1) {
|
||||
this.page = 0;
|
||||
this.toalPage = 0;
|
||||
this.myList(0, 'myLikedList', true);
|
||||
}
|
||||
},
|
||||
loadMore() {
|
||||
if (this.page >= this.toalPage) {
|
||||
return;
|
||||
} else {
|
||||
this.myList(this.page);
|
||||
}
|
||||
},
|
||||
async myList(page, requrl, init = false) {
|
||||
let me = this;
|
||||
page = page + 1;
|
||||
me.page = page;
|
||||
let userId = me.userPageId;;
|
||||
var result = await vlogMeTag(requrl, page, 20, userId)
|
||||
if (result.data.status == 200) {
|
||||
let vlogList = result.data.data.rows;
|
||||
console.log(vlogList)
|
||||
let toalPage = result.data.data.total;
|
||||
if (init) {
|
||||
me.vlogList = vlogList
|
||||
} else {
|
||||
me.vlogList = me.vlogList.concat(vlogList);
|
||||
}
|
||||
me.page = page;
|
||||
me.toalPage = toalPage;
|
||||
}
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
},
|
||||
async cancelFollow() {
|
||||
let me = this;
|
||||
let vlogerId = me.userPageId;
|
||||
let userId = storage.getVlogUserInfo().id;
|
||||
var result = await vlogFansCancel({myId:userId,vlogerId:vlogerId})
|
||||
if (result.data.status == 200) {
|
||||
me.isFollow = false;
|
||||
// uni.setStorageSync("justCancelVlogerId", vlogerId);
|
||||
// 刷新当前页的粉丝数
|
||||
let pendingInfo = me.pageUserInfo;
|
||||
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts - 1;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
},
|
||||
async followMe() {
|
||||
let me = this;
|
||||
let myUserInfo = storage.getVlogUserInfo();
|
||||
|
||||
let vlogerId = me.userPageId;
|
||||
let userId = myUserInfo.id;
|
||||
var result = await vlogFansFollow({myId:userId,vlogerId:vlogerId})
|
||||
if (result.data.status == 200) {
|
||||
me.isFollow = true;
|
||||
// uni.setStorageSync("justFollowVlogerId", vlogerId);
|
||||
// 刷新当前页的粉丝数
|
||||
let pendingInfo = me.pageUserInfo;
|
||||
me.pageUserInfo.myFansCounts = pendingInfo.myFansCounts + 1;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 把超过1000或10000的数字调整, 比如1.3k/6.8w
|
||||
getGraceNumber(num) {
|
||||
return graceNumber(num);
|
||||
},
|
||||
|
||||
goToVlog(vlog) {
|
||||
let vlogId = vlog.id ? vlog.id : vlog.vlogId;
|
||||
// uni.navigateTo({
|
||||
// url: "../vlog/vlog?type=mine&isNeedPage=1&vlogId=" + vlogId,
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: "/pages/me/vlog?vlogId=" + vlogId,
|
||||
});
|
||||
},
|
||||
goMyFans(userId) {
|
||||
uni.navigateTo({
|
||||
animationType: "fade-in",
|
||||
url: "myFans?userId=" + userId,
|
||||
});
|
||||
},
|
||||
|
||||
goMyFollows(userId) {
|
||||
uni.navigateTo({
|
||||
animationType: "fade-in",
|
||||
url: "myFollows?userId=" + userId,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #000000;
|
||||
|
||||
.isLogin-info-wrapper {
|
||||
.header {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
flex-direction: row;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
align-items: center;
|
||||
padding-left: 40rpx;
|
||||
padding-right: 40rpx;
|
||||
.header-right-search {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
.mybg {
|
||||
width: 750rpx;
|
||||
height: 750rpx;
|
||||
box-shadow: inset 0 -150px 180px #313030;
|
||||
}
|
||||
|
||||
.my-info-wrapper {
|
||||
position: relative;
|
||||
left: 30rpx;
|
||||
top: -560rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 1000rpx;
|
||||
.my-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.my-face {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 100rpx;
|
||||
border-width: 1px;
|
||||
border-color: #f1f1f1;
|
||||
}
|
||||
.info-wrapper {
|
||||
margin-left: 30rpx;
|
||||
padding-top: 20rpx;
|
||||
width: 500rpx;
|
||||
.nickname {
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tiktok-num-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.tiktok-num {
|
||||
font-size: 10px;
|
||||
color: #ffffff;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
.location {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 20px;
|
||||
margin-top: 2px;
|
||||
font-size: 1px;
|
||||
.location-text {
|
||||
line-height: 20px;
|
||||
color: #ffffff;
|
||||
font-size: 10px;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
.sex-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-top: 10rpx;
|
||||
.constellation {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
background-color: #000000;
|
||||
opacity: 0.5;
|
||||
width: 130rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 10px;
|
||||
.sex-img {
|
||||
width: 22rpx;
|
||||
height: 22rpx;
|
||||
align-self: center;
|
||||
}
|
||||
.astro {
|
||||
font-size: 10px;
|
||||
color: #ffffff;
|
||||
line-height: 20px;
|
||||
font-weight: bold;
|
||||
margin-left: 6rpx;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
.animal {
|
||||
margin-left: 10rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
background-color: #000000;
|
||||
opacity: 0.5;
|
||||
width: 60rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 10px;
|
||||
.animal-text {
|
||||
font-size: 10px;
|
||||
color: #ffffff;
|
||||
line-height: 20px;
|
||||
font-weight: bold;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.desc {
|
||||
position: relative;
|
||||
top: -520rpx;
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
|
||||
.bottom-wrapper {
|
||||
position: relative;
|
||||
top: -510rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
.bottom {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.bottom-item {
|
||||
margin-left: 30rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
.item-num {
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
align-self: center;
|
||||
}
|
||||
.item-text {
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
font-weight: 300;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.edit {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-right: 30rpx;
|
||||
.follow-btn {
|
||||
margin-right: 20rpx;
|
||||
border-width: 1px;
|
||||
border-color: #ffffff;
|
||||
width: 200rpx;
|
||||
height: 66rpx;
|
||||
background-color: #545456;
|
||||
opacity: 0.8;
|
||||
border-radius: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-self: center;
|
||||
.follow-text {
|
||||
font-size: 13px;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.tab-wrapper {
|
||||
position: relative;
|
||||
top: -480rpx;
|
||||
height: 40px;
|
||||
background-color: #171825;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-top: 3px;
|
||||
border-top-left-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
.tab-item {
|
||||
width: 250rpx;
|
||||
align-self: center;
|
||||
.tab-normal {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
align-self: center;
|
||||
color: #808080;
|
||||
}
|
||||
.tab-selected {
|
||||
color: #ffffff;
|
||||
}
|
||||
.selected-tab {
|
||||
margin-top: 5px;
|
||||
height: 5rpx;
|
||||
width: 250rpx;
|
||||
border-radius: 6rpx;
|
||||
background-color: #ef274d;
|
||||
}
|
||||
}
|
||||
}
|
||||
.vlog-list {
|
||||
position: relative;
|
||||
top: -480rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
background-color: #000000;
|
||||
.vlog-cover {
|
||||
align-self: center;
|
||||
width: 248rpx;
|
||||
height: 360rpx;
|
||||
border-width: 1rpx;
|
||||
}
|
||||
}
|
||||
.empty {
|
||||
background-color: #000000;
|
||||
width: 750rpx;
|
||||
height: 300rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
top: -480rpx;
|
||||
.empty-text {
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.not-empty {
|
||||
width: 750rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
top: -260rpx;
|
||||
.not-empty-text {
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -464,8 +464,13 @@ export default {
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
storage.setAccessToken(res.data.result.accessToken);
|
||||
storage.setRefreshToken(res.data.result.refreshToken);
|
||||
var infoData = res.data.result;
|
||||
storage.setAccessToken(infoData.accessToken);
|
||||
storage.setRefreshToken(infoData.refreshToken);
|
||||
const vlogInfo = JSON.parse(infoData.tikUser);
|
||||
// 将vlog的token和vlog用户信息放入缓存
|
||||
storage.setVlogToken(vlogInfo.userToken);
|
||||
storage.setVlogUserInfo(vlogInfo);
|
||||
// 登录成功
|
||||
uni.showToast({
|
||||
title: "第三方登录成功!",
|
||||
|
@ -1,33 +1,85 @@
|
||||
<template>
|
||||
<scroll-view class="prpage" scroll-y="true">
|
||||
<scroll-view
|
||||
class="prpage"
|
||||
scroll-y="true"
|
||||
>
|
||||
<view class="line"></view>
|
||||
<!-- 进度条 -->
|
||||
<view class="progress" v-if="percentCompleted != 100">
|
||||
<progress :percent="percentCompleted" stroke-width="3" activeColor="#ef274d" backgroundColor="#F1F1F1" />
|
||||
<view
|
||||
class="progress"
|
||||
v-if="percentCompleted != 100"
|
||||
>
|
||||
<progress
|
||||
:percent="percentCompleted"
|
||||
stroke-width="3"
|
||||
activeColor="#ef274d"
|
||||
backgroundColor="#F1F1F1"
|
||||
/>
|
||||
<text class="progress-text">视频上传中,请耐心等待~~</text>
|
||||
<image class="progress-img" mode="aspectFit" src="/static/images/loading-4.gif" />
|
||||
<image
|
||||
class="progress-img"
|
||||
mode="aspectFit"
|
||||
src="/static/images/loading-4.gif"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 发布主体内容 -->
|
||||
<view class="main-body" v-if="percentCompleted == 100">
|
||||
<image class="main-body-img-m" v-if="tempCover" :src="tempCover" mode="widthFix" />
|
||||
<image class="main-body-img-m" v-if="!tempCover" src='/static/images/loading-4.gif' mode="aspectFit" />
|
||||
<view
|
||||
class="main-body"
|
||||
v-if="percentCompleted == 100"
|
||||
>
|
||||
<image
|
||||
class="main-body-img-m"
|
||||
v-if="tempCover"
|
||||
:src="tempCover"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<image
|
||||
class="main-body-img-m"
|
||||
v-if="!tempCover"
|
||||
src="/static/images/loading-4.gif"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<view class="main-body-content">
|
||||
<view class="preplay-wrapper" @click="preview" @touchstart="touchstartPreplay"
|
||||
@touchend="touchendPreplay">
|
||||
<image class="preplay-icon" src="/static/images/btn-play.png" />
|
||||
<view
|
||||
class="preplay-wrapper"
|
||||
@click="preview"
|
||||
@touchstart="touchstartPreplay"
|
||||
@touchend="touchendPreplay"
|
||||
>
|
||||
<image
|
||||
class="preplay-icon"
|
||||
src="/static/images/btn-play.png"
|
||||
/>
|
||||
<text class="preplay-text">预览视频</text>
|
||||
</view>
|
||||
<view class="choose-cover" @click="chooseCover">
|
||||
<view
|
||||
class="choose-cover"
|
||||
@click="chooseCover"
|
||||
>
|
||||
<text class="choose-cover-text">选择封面</text>
|
||||
</view>
|
||||
</view>
|
||||
<textarea class="vlog-content" placeholder-style="color: #9798a0;" placeholder="添加合适的描述内容~" :value="title"
|
||||
:model="title" maxlength="60" @input="typingContent" confirm-type="done"></textarea>
|
||||
<view class="mbtn" :class="{
|
||||
<textarea
|
||||
class="vlog-content"
|
||||
placeholder-style="color: #9798a0;"
|
||||
placeholder="添加合适的描述内容~"
|
||||
:value="title"
|
||||
:model="title"
|
||||
maxlength="60"
|
||||
@input="typingContent"
|
||||
confirm-type="done"
|
||||
></textarea>
|
||||
<view
|
||||
class="mbtn"
|
||||
:class="{
|
||||
'btn-publish': !publishTouched,
|
||||
'btn-publish-touched': publishTouched,
|
||||
}" @touchstart="touchstartPublish" @touchend="touchendPublish" @click="doPublich">
|
||||
'btn-publish-touched': publishTouched
|
||||
}"
|
||||
@touchstart="touchstartPublish"
|
||||
@touchend="touchendPublish"
|
||||
@click="doPublich"
|
||||
>
|
||||
<text class="btn-text">发布视频</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -35,28 +87,28 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
// import {
|
||||
// graceNumber
|
||||
// } from '@/utils/tools.js'
|
||||
import api from "@/config/api.js";
|
||||
import api from '@/config/api.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
publishTouched: false,
|
||||
preplayTouched: false,
|
||||
tempFilePath: "",
|
||||
videoUrl: "",
|
||||
tempCover: "", // 视频封面
|
||||
title: "",
|
||||
tempFilePath: '',
|
||||
videoUrl: '',
|
||||
tempCover: '', // 视频封面
|
||||
title: '',
|
||||
width: 0,
|
||||
height: 0,
|
||||
percentCompleted: 0, // 进度
|
||||
percentCompleted: 0 // 进度
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
let me = this;
|
||||
let vlogInfo = storage.getVlogUserInfo()
|
||||
let vlogInfo = storage.getVlogUserInfo();
|
||||
// 上个页面传过来的文件事件对象, 其中包含了相册中选择的视频内容
|
||||
let fileObjectEvent = JSON.parse(params.fileObjectEvent);
|
||||
let times = new Date().getTime();
|
||||
@ -66,7 +118,7 @@
|
||||
let serverUrl = api.vlog;
|
||||
const uploadTask = uni.uploadFile({
|
||||
filePath: fileObjectEvent.tempFilePath,
|
||||
url: serverUrl + "/upload",
|
||||
url: serverUrl + '/upload',
|
||||
name: 'file',
|
||||
formData: {
|
||||
filetype: 'video'
|
||||
@ -76,15 +128,15 @@
|
||||
headerUserToken: storage.getVlogToken()
|
||||
},
|
||||
success: (f) => {
|
||||
console.log(f)
|
||||
let jsondata = f.data
|
||||
let data = JSON.parse(jsondata)
|
||||
console.log(f);
|
||||
let jsondata = f.data;
|
||||
let data = JSON.parse(jsondata);
|
||||
let videoUrl = data.data;
|
||||
me.videoUrl = videoUrl;
|
||||
me.width = fileObjectEvent.width;
|
||||
me.height = fileObjectEvent.height;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
uploadTask.onProgressUpdate((res) => {
|
||||
console.log('上传进度' + res.progress);
|
||||
@ -94,8 +146,8 @@
|
||||
// let percentCompleted = Math.round(
|
||||
// (res.progress * 100) / res.total
|
||||
// );
|
||||
me.percentCompleted = res.progress
|
||||
})
|
||||
me.percentCompleted = res.progress;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
typingContent(e) {
|
||||
@ -105,13 +157,13 @@
|
||||
doPublich() {
|
||||
if (this.title.length < 5) {
|
||||
uni.showToast({
|
||||
title: "请输入5个字以上的标题!",
|
||||
icon: "none",
|
||||
title: '请输入5个字以上的标题!',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let me = this;
|
||||
let vlogInfo = storage.getVlogUserInfo()
|
||||
let vlogInfo = storage.getVlogUserInfo();
|
||||
let userId = vlogInfo.id;
|
||||
let vlog = {
|
||||
vlogerId: userId,
|
||||
@ -120,52 +172,48 @@
|
||||
title: me.title,
|
||||
width: me.width,
|
||||
height: me.height,
|
||||
cityCode: storage.getCityCode()
|
||||
};
|
||||
|
||||
// 发布视频
|
||||
let serverUrl = api.vlog
|
||||
let serverUrl = api.vlog;
|
||||
uni.request({
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
header: {
|
||||
headerUserId: userId,
|
||||
headerUserToken: storage.getVlogToken(),
|
||||
headerUserToken: storage.getVlogToken()
|
||||
},
|
||||
url: serverUrl + "/vlog/publish",
|
||||
url: serverUrl + '/vlog/publish',
|
||||
data: vlog,
|
||||
success(result) {
|
||||
if (result.data.status == 200) {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/user/my",
|
||||
url: '/pages/me/me'
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
preview() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/publish/preview?videoUrl=" +
|
||||
this.videoUrl +
|
||||
"&width=" +
|
||||
this.width +
|
||||
"&height=" +
|
||||
this.height,
|
||||
animationType: "slide-in-bottom",
|
||||
animationDuration: 500,
|
||||
url: '/pages/publish/preview?videoUrl=' + this.videoUrl + '&width=' + this.width + '&height=' + this.height,
|
||||
animationType: 'slide-in-bottom',
|
||||
animationDuration: 500
|
||||
});
|
||||
},
|
||||
|
||||
@ -187,50 +235,50 @@
|
||||
|
||||
chooseCover() {
|
||||
let me = this;
|
||||
let vlogInfo = storage.getVlogUserInfo()
|
||||
let vlogInfo = storage.getVlogUserInfo();
|
||||
let userId = vlogInfo.id;
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: "original",
|
||||
sourceType: ["album"],
|
||||
sizeType: 'original',
|
||||
sourceType: ['album'],
|
||||
success(e) {
|
||||
me.tempCover = e.tempFilePaths[0]; //先在本地回显
|
||||
// 上传封面
|
||||
let serverUrl = api.vlog;
|
||||
uni.uploadFile({
|
||||
filePath: e.tempFilePaths[0],
|
||||
url: serverUrl + "/upload",
|
||||
url: serverUrl + '/upload',
|
||||
formData: {
|
||||
filetype: 'video'
|
||||
},
|
||||
header: {
|
||||
headerUserId: userId,
|
||||
headerUserToken: storage.getVlogToken(),
|
||||
headerUserToken: storage.getVlogToken()
|
||||
},
|
||||
name: "file",
|
||||
name: 'file',
|
||||
success(result) {
|
||||
let res = JSON.parse(result.data);
|
||||
console.log(res)
|
||||
console.log(res);
|
||||
if (res.status == 200) {
|
||||
let imageUrl = res.data;
|
||||
me.tempCover = imageUrl;
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 2000,
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -244,7 +292,6 @@
|
||||
background-color: #181b27;
|
||||
}
|
||||
|
||||
|
||||
.main-body-img-m {
|
||||
min-height: 400rpx;
|
||||
/* width: 750rpx; */
|
||||
@ -268,8 +315,6 @@
|
||||
width: 200rpx;
|
||||
height: 100rpx;
|
||||
position: relative;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.preplay-icon {
|
||||
@ -297,7 +342,6 @@
|
||||
/* display: flex; */
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
|
||||
}
|
||||
|
||||
.vlog-content {
|
||||
@ -340,7 +384,6 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.main-body {
|
||||
margin-top: 20rpx;
|
||||
padding: 0 20rpx;
|
||||
|
296
pages/search/search.vue
Executable file
296
pages/search/search.vue
Executable file
@ -0,0 +1,296 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 这里是状态栏, 每个页面都需要有, 目的不让页面覆盖状态栏 -->
|
||||
<view :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<view class="big-search-wrapper">
|
||||
<image
|
||||
class="header-right-search icon-search"
|
||||
src="/static/images/icon-back.png"
|
||||
@click="back"
|
||||
/>
|
||||
<view class="search-box">
|
||||
<view class="search-box-left">
|
||||
<image
|
||||
class="header-right-search search-image"
|
||||
src="/static/images/icon-search.png"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
:model="searchContent"
|
||||
:value="searchContent"
|
||||
@input="typingContent"
|
||||
@confirm=""
|
||||
placeholder="请输入内容~"
|
||||
maxlength="10"
|
||||
class="search-input"
|
||||
/>
|
||||
|
||||
<!-- <view class="search-box-right">
|
||||
<image
|
||||
class="scan-image"
|
||||
src="/static/images/icon-scan-qrcode.png"
|
||||
@click="scan"
|
||||
/>
|
||||
</view> -->
|
||||
</view>
|
||||
<view
|
||||
class="sbtn"
|
||||
@click="doSearch"
|
||||
>
|
||||
搜索
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="history">
|
||||
<view
|
||||
v-for="(h, index) in historyList"
|
||||
:key="index"
|
||||
class="history-item-wrapper"
|
||||
>
|
||||
<view
|
||||
class="time-and-text"
|
||||
@click="searchByHistory(h)"
|
||||
>
|
||||
<image
|
||||
class="time-image"
|
||||
src="/static/images/icon-time.png"
|
||||
/>
|
||||
<text class="history-text">{{ h }}</text>
|
||||
</view>
|
||||
<image
|
||||
class="delete-image"
|
||||
src="/static/images/icon-delete.png"
|
||||
@click="removeHistoryItem(index)"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="historyList.length == 0"
|
||||
class="clear-all-wrapper"
|
||||
@click="removeAllHistory"
|
||||
>
|
||||
<text class="clear-all"></text>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="clear-all-wrapper"
|
||||
@click="removeAllHistory"
|
||||
>
|
||||
<text class="clear-all">清除所有搜索记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let system = uni.getSystemInfoSync();
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import { isStrEmpty } from '@/utils/tools.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
searchContent: '',
|
||||
historyList: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.statusBarHeight = system.statusBarHeight;
|
||||
|
||||
// 从本地缓存获得搜索的历史记录
|
||||
let historyListJSON = uni.getStorageSync('historyList') || null;
|
||||
console.log(historyListJSON);
|
||||
if (historyListJSON != null && historyListJSON != undefined) {
|
||||
this.historyList = JSON.parse(historyListJSON);
|
||||
} else {
|
||||
this.historyList = [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
scan() {
|
||||
// 扫描二维码跳转视频详情,先不做
|
||||
// uni.scanCode({
|
||||
// success: (e) => {
|
||||
// let result = e.result;
|
||||
// let vlogId = JSON.parse(result).content;
|
||||
// uni.navigateTo({
|
||||
// url: '../vlog/vlog?vlogId=' + vlogId
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
},
|
||||
typingContent(e) {
|
||||
this.searchContent = e.detail.value;
|
||||
},
|
||||
searchByHistory(searchContent) {
|
||||
console.log(searchContent);
|
||||
this.searchContent = searchContent;
|
||||
this.doSearch();
|
||||
},
|
||||
doSearch() {
|
||||
var searchContent = this.searchContent;
|
||||
if (isStrEmpty(this.searchContent)) {
|
||||
uni.showToast({
|
||||
title: '搜索关键字为空!',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
this.searchContent = '';
|
||||
return;
|
||||
}
|
||||
|
||||
let tempList = this.historyList;
|
||||
// 判断搜索内容是否已经存在, 如果存在, 则移除
|
||||
for (let i = 0; i < tempList.length; i++) {
|
||||
let old = tempList[i];
|
||||
if (this.searchContent === old) {
|
||||
tempList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tempList.unshift(searchContent);
|
||||
|
||||
// 如果超过10个, 则删除第一一项
|
||||
if (tempList.length > 10) {
|
||||
tempList.splice(0, 1);
|
||||
this.historyList = tempList;
|
||||
}
|
||||
|
||||
// 保存到本地缓存
|
||||
uni.setStorageSync('historyList', JSON.stringify(this.historyList));
|
||||
|
||||
// 跳转页面, 把搜索条件携带过去
|
||||
uni.navigateTo({
|
||||
url: 'searchList?search=' + searchContent
|
||||
});
|
||||
},
|
||||
|
||||
removeHistoryItem(index) {
|
||||
this.historyList.splice(index, 1);
|
||||
uni.setStorageSync('historyList', JSON.stringify(this.historyList));
|
||||
},
|
||||
|
||||
removeAllHistory() {
|
||||
this.historyList = [];
|
||||
uni.setStorageSync('historyList', JSON.stringify(this.historyList));
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.page {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #181b27;
|
||||
|
||||
.big-search-wrapper {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
.header-right-search {
|
||||
height: 100rpx;
|
||||
}
|
||||
.icon-search {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.search-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.search-box-left {
|
||||
padding: 0 10rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #55565e;
|
||||
border-top-left-radius: 6rpx;
|
||||
border-bottom-left-radius: 6rpx;
|
||||
.search-image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
.search-input {
|
||||
width: 410rpx;
|
||||
height: 50rpx;
|
||||
background-color: #55565e;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
border-top-right-radius: 6rpx;
|
||||
border-bottom-right-radius: 6rpx;
|
||||
}
|
||||
.search-box-right {
|
||||
padding: 0 16rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #55565e;
|
||||
border-top-right-radius: 6rpx;
|
||||
border-bottom-right-radius: 6rpx;
|
||||
.scan-image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
.sbtn {
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.history {
|
||||
.history-item-wrapper {
|
||||
padding: 16rpx 26rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
.time-and-text {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 500rpx;
|
||||
.time-image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.history-text {
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
.delete-image {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
.clear-all-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-top: 40rpx;
|
||||
.clear-all {
|
||||
color: #f1f1f1;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
399
pages/search/searchList.vue
Executable file
399
pages/search/searchList.vue
Executable file
@ -0,0 +1,399 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view :style="{ height: statusBarHeight + 'px' }">
|
||||
<!-- 这里是状态栏, 每个页面都需要有, 目的不让页面覆盖状态栏 -->
|
||||
</view>
|
||||
<view class="big-search-wrapper">
|
||||
<image
|
||||
class="header-right-search icon-search"
|
||||
src="/static/images/icon-back.png"
|
||||
@click="back"
|
||||
/>
|
||||
<view class="search-box">
|
||||
<view class="search-box-left">
|
||||
<image
|
||||
class="header-right-search search-image"
|
||||
src="/static/images/icon-search.png"
|
||||
/>
|
||||
</view>
|
||||
<input
|
||||
type="text"
|
||||
:model="searchContent"
|
||||
:value="searchContent"
|
||||
@input="typingContent"
|
||||
placeholder="请输入内容~"
|
||||
maxlength="10"
|
||||
class="search-input"
|
||||
/>
|
||||
</view>
|
||||
<view
|
||||
class="sbtn"
|
||||
@click="doSearch"
|
||||
>
|
||||
搜索
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mainCont">
|
||||
<view
|
||||
class="wrap"
|
||||
:style="{ height: screenHeight - statusBarHeight - 50 + 'px' }"
|
||||
>
|
||||
<view class="u-tabs-box">
|
||||
<u-tabs-swiper
|
||||
bgColor=" #F5F5F5"
|
||||
activeColor="#FF3229"
|
||||
ref="tabs"
|
||||
:list="list"
|
||||
:current="current"
|
||||
@change="change"
|
||||
:is-scroll="false"
|
||||
swiperWidth="750"
|
||||
font-size="30rpx"
|
||||
barWidth="24"
|
||||
barHeight="8"
|
||||
></u-tabs-swiper>
|
||||
</view>
|
||||
<swiper
|
||||
class="swiper-box"
|
||||
:current="swiperCurrent"
|
||||
@transition="transition"
|
||||
@animationfinish="animationfinish"
|
||||
>
|
||||
<swiper-item class="swiper-item">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="no-scrollbar"
|
||||
style="height: 100%; width: 100%"
|
||||
@scrolltolower="reachBottom"
|
||||
>
|
||||
<view class="page-box">
|
||||
<!--视频-->
|
||||
<search-vd
|
||||
ref="vd"
|
||||
:keywords="searchContent"
|
||||
></search-vd>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
|
||||
<swiper-item class="swiper-item">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="no-scrollbar"
|
||||
style="height: 100%; width: 100%"
|
||||
@scrolltolower="reachBottom"
|
||||
>
|
||||
<view class="page-box">
|
||||
<!--商品-->
|
||||
<shop
|
||||
ref="shop"
|
||||
:keywords="searchContent"
|
||||
></shop>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
|
||||
<swiper-item class="swiper-item">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="no-scrollbar"
|
||||
style="height: 100%; width: 100%"
|
||||
@scrolltolower="reachBottom"
|
||||
>
|
||||
<view class="page-box">
|
||||
<!--用户-->
|
||||
<user
|
||||
ref="user"
|
||||
:keywords="searchContent"
|
||||
></user>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
|
||||
<swiper-item class="swiper-item">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="no-scrollbar"
|
||||
style="height: 100%; width: 100%"
|
||||
@scrolltolower="reachBottom"
|
||||
>
|
||||
<view class="page-box">
|
||||
<!--团购-->
|
||||
<tuangou
|
||||
ref="tuangou"
|
||||
:keywords="searchContent"
|
||||
></tuangou>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- <view class="page-footer">
|
||||
<view class="contract-button">
|
||||
自定义底部栏
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let system = uni.getSystemInfoSync();
|
||||
console.log(system);
|
||||
import { isStrEmpty } from '@/utils/tools.js';
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import searchVd from './searchVd.vue';
|
||||
import shop from './shop';
|
||||
import user from './user';
|
||||
import tuangou from './tuangou';
|
||||
export default {
|
||||
components: {
|
||||
searchVd,
|
||||
shop,
|
||||
user,
|
||||
tuangou
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
screenHeight: 0,
|
||||
statusBarHeight: 0,
|
||||
search: '',
|
||||
searchContent: '',
|
||||
// tabs
|
||||
list: [
|
||||
{
|
||||
name: '视频'
|
||||
},
|
||||
{
|
||||
name: '商品'
|
||||
},
|
||||
{
|
||||
name: '用户'
|
||||
},
|
||||
{
|
||||
name: '团购'
|
||||
}
|
||||
],
|
||||
listValue: ['vd', 'shop', 'user', 'tuangou'],
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
dx: 0
|
||||
// tabs-end
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
this.statusBarHeight = system.statusBarHeight;
|
||||
let screenHeight = system.safeArea.bottom;
|
||||
this.screenHeight = screenHeight;
|
||||
// 搜索的关键字
|
||||
let search = params.search || ''.trim();
|
||||
this.searchContent = params.search;
|
||||
},
|
||||
watch: {
|
||||
current(n) {
|
||||
this.initCurrentData();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化数据
|
||||
initCurrentData() {
|
||||
console.log(this.current);
|
||||
var prop = this.listValue[this.current];
|
||||
var dom = this.$refs[prop];
|
||||
var child = dom.search; //子组件内部的关键字
|
||||
console.log('子关键字:' + child);
|
||||
var flag = dom.flag; // 子组件内部索引
|
||||
var parent = this.searchContent;
|
||||
console.log('fu关键字:' + parent);
|
||||
if (parent != child && this.swiperCurrent == flag && this.searchContent != '') {
|
||||
dom.initData();
|
||||
}
|
||||
},
|
||||
// tab栏切换
|
||||
change(index) {
|
||||
this.swiperCurrent = index;
|
||||
},
|
||||
transition({ detail: { dx } }) {
|
||||
this.$refs.tabs.setDx(dx);
|
||||
},
|
||||
animationfinish({ detail: { current } }) {
|
||||
this.$refs.tabs.setFinishCurrent(current);
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
},
|
||||
reachBottom() {
|
||||
console.log('触底' + this.current);
|
||||
var prop = this.listValue[this.current];
|
||||
var dom = this.$refs[prop];
|
||||
dom.getData();
|
||||
},
|
||||
doSearch() {
|
||||
let me = this;
|
||||
let searchContent = this.searchContent;
|
||||
if (isStrEmpty(searchContent)) {
|
||||
uni.showToast({
|
||||
title: '搜索为空!',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
this.searchContent = '';
|
||||
return;
|
||||
} else {
|
||||
this.initCurrentData();
|
||||
}
|
||||
},
|
||||
typingContent(e) {
|
||||
this.searchContent = e.detail.value || ''.trim();
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
// position: absolute;
|
||||
// left: 0;
|
||||
// right: 0;
|
||||
// top: 0;
|
||||
// bottom: 0;
|
||||
background-color: #181b27;
|
||||
|
||||
.big-search-wrapper {
|
||||
padding: 14px;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
.header-right-search {
|
||||
height: 50px;
|
||||
}
|
||||
.icon-search {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.search-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.search-box-left {
|
||||
padding: 0 10rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #55565e;
|
||||
border-top-left-radius: 6rpx;
|
||||
border-bottom-left-radius: 6rpx;
|
||||
.search-image {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
.search-input {
|
||||
width: 410rpx;
|
||||
height: 25px;
|
||||
background-color: #55565e;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
border-top-right-radius: 6rpx;
|
||||
border-bottom-right-radius: 6rpx;
|
||||
}
|
||||
.search-box-right {
|
||||
padding: 0 16rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
background-color: #55565e;
|
||||
border-top-right-radius: 6rpx;
|
||||
border-bottom-right-radius: 6rpx;
|
||||
.scan-image {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
.sbtn {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
// 隐藏ios端滚动条
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
//
|
||||
.mainCont {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.u-tabs-box {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.page-box {
|
||||
width: 710rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// footer config
|
||||
// .page-footer {
|
||||
// width: 750rpx;
|
||||
// height: 128rpx;
|
||||
// background: #ffffff;
|
||||
// box-shadow: 0rpx -4rpx 16rpx rgba(219, 208, 208, 0.61);
|
||||
// opacity: 1;
|
||||
// border-radius: 0rpx;
|
||||
|
||||
// .contract-button {
|
||||
// width: 686rpx;
|
||||
// height: 80rpx;
|
||||
|
||||
// margin-top: 24rpx;
|
||||
// margin-left: 32rpx;
|
||||
|
||||
// font-size: 34rpx;
|
||||
// font-family: PingFang SC;
|
||||
// font-weight: 500;
|
||||
|
||||
// text-align: center;
|
||||
|
||||
// line-height: 80rpx;
|
||||
// color: #ffffff;
|
||||
// letter-spacing: 5rpx;
|
||||
|
||||
// background: linear-gradient(137deg, #ff3229 0%, #ff7b59 100%);
|
||||
// opacity: 1;
|
||||
// border-radius: 40rpx;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
</style>
|
243
pages/search/searchVd.vue
Normal file
243
pages/search/searchVd.vue
Normal file
@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view v-if="flowList.length">
|
||||
<u-waterfall
|
||||
v-model="flowList"
|
||||
ref="uWaterfall"
|
||||
idKey="vlogId"
|
||||
>
|
||||
<template v-slot:left="{ leftList }">
|
||||
<view
|
||||
class="demo-warter"
|
||||
v-for="(item, index) in leftList"
|
||||
:key="index"
|
||||
@click="goToVlog(item.vlogId)"
|
||||
>
|
||||
<u-lazy-load
|
||||
border-radius="10"
|
||||
:image="item.cover || item.firstFrameImg"
|
||||
:index="index"
|
||||
></u-lazy-load>
|
||||
<view class="content">
|
||||
{{ item.content }}
|
||||
</view>
|
||||
<view class="flxbox">
|
||||
<view class="bottom-info">
|
||||
<u-image
|
||||
width="30rpx"
|
||||
height="30rpx"
|
||||
:src="item.vlogerFace"
|
||||
loading-icon="/static/missing-face.png"
|
||||
error-icon="/static/missing-face.png"
|
||||
shape="circle"
|
||||
style="display: flex; align-items: center"
|
||||
></u-image>
|
||||
<view class="showOne ml">{{ item.vlogerName }}</view>
|
||||
</view>
|
||||
<view class="bottom-info">
|
||||
<image
|
||||
style="width: 20rpx; height: 20rpx"
|
||||
src="/static/images/icon-comment-unlike.png"
|
||||
></image>
|
||||
<view class="ml">{{ getGraceNumber(item.likeCounts) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-slot:right="{ rightList }">
|
||||
<view
|
||||
class="demo-warter"
|
||||
v-for="(item, index) in rightList"
|
||||
:key="index"
|
||||
@click="goToVlog(item.vlogId)"
|
||||
>
|
||||
<u-lazy-load
|
||||
border-radius="10"
|
||||
:image="item.cover || item.firstFrameImg"
|
||||
:index="index"
|
||||
></u-lazy-load>
|
||||
<view class="content">
|
||||
{{ item.content }}
|
||||
</view>
|
||||
<view class="flxbox">
|
||||
<view class="bottom-info">
|
||||
<u-image
|
||||
width="30rpx"
|
||||
height="30rpx"
|
||||
loading-icon="/static/missing-face.png"
|
||||
error-icon="/static/missing-face.png"
|
||||
:src="item.vlogerFace"
|
||||
shape="circle"
|
||||
style="display: flex; align-items: center"
|
||||
></u-image>
|
||||
<view class="showOne ml">{{ item.vlogerName }}</view>
|
||||
</view>
|
||||
<view class="bottom-info">
|
||||
<image
|
||||
style="width: 20rpx; height: 20rpx"
|
||||
src="/static/images/icon-comment-unlike.png"
|
||||
></image>
|
||||
<view class="ml">{{ getGraceNumber(item.likeCounts) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</u-waterfall>
|
||||
<u-loadmore
|
||||
style="padding: 10px 0"
|
||||
bg-color="#f8f8f8"
|
||||
:status="loadStatus"
|
||||
@loadmore="getData"
|
||||
></u-loadmore>
|
||||
</view>
|
||||
|
||||
<u-empty
|
||||
class="mt20"
|
||||
v-else
|
||||
text="暂无数据"
|
||||
mode="data"
|
||||
></u-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { vlogList } from '@/api/vlog';
|
||||
import { graceNumber, isStrEmpty } from '@/utils/tools.js';
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
export default {
|
||||
props: {
|
||||
keywords: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
flag: 0, // 在tabs中的索引
|
||||
loadStatus: 'loadmore',
|
||||
flowList: [],
|
||||
page: 0,
|
||||
totalPage: 0,
|
||||
search: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.clear();
|
||||
this.search = this.keywords;
|
||||
this.page = 0;
|
||||
this.totalPage = 0;
|
||||
this.flowList = [];
|
||||
this.loadStatus = 'loadmore';
|
||||
this.getData();
|
||||
},
|
||||
async getData() {
|
||||
try {
|
||||
if (this.loadStatus !== 'loadmore') return;
|
||||
let me = this;
|
||||
me.loadStatus = 'loading';
|
||||
let page = me.page + 1;
|
||||
let keywords = me.search;
|
||||
let userInfo = storage.getVlogUserInfo();
|
||||
let userId = '';
|
||||
if (userInfo != null) {
|
||||
userId = userInfo.id;
|
||||
}
|
||||
var result = await vlogList(page, 10, userId, '', keywords);
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
let flowList = result.data.data.rows;
|
||||
let totalPage = result.data.data.total;
|
||||
me.flowList = me.flowList.concat(flowList);
|
||||
me.page = page;
|
||||
me.totalPage = totalPage;
|
||||
if (page >= totalPage) {
|
||||
me.loadStatus = 'nomore';
|
||||
} else {
|
||||
me.loadStatus = 'loadmore';
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
this.loadStatus = 'nomore';
|
||||
}
|
||||
},
|
||||
// 把超过1000或10000的数字调整,比如1.3k/6.8w
|
||||
getGraceNumber(num) {
|
||||
return graceNumber(num);
|
||||
},
|
||||
goToVlog(vlogId) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/me/vlog?vlogId=' + vlogId
|
||||
});
|
||||
},
|
||||
remove(id) {
|
||||
this.$refs.uWaterfall.remove(id);
|
||||
},
|
||||
clear() {
|
||||
var dom = this.$refs.uWaterfall;
|
||||
if (dom) {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mt20 {
|
||||
margin-top: 20% !important;
|
||||
}
|
||||
.demo-warter {
|
||||
border-radius: 8px;
|
||||
margin: 5px;
|
||||
background-color: #ffffff;
|
||||
padding: 8px;
|
||||
position: relative;
|
||||
max-width: 329rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.u-close {
|
||||
position: absolute;
|
||||
top: 32rpx;
|
||||
right: 32rpx;
|
||||
}
|
||||
|
||||
.showOne {
|
||||
width: 200rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.content {
|
||||
// width: 329rpx;
|
||||
font-size: 28rpx;
|
||||
color: #000;
|
||||
margin-top: 5px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3; /* 最多显示三行 */
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.flxbox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.bottom-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22rpx;
|
||||
color: $u-tips-color;
|
||||
}
|
||||
.ml {
|
||||
display: block;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
818
pages/search/shop.vue
Normal file
818
pages/search/shop.vue
Normal file
@ -0,0 +1,818 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view v-if="flowList.length">
|
||||
<view class="goods-list">
|
||||
<view
|
||||
v-for="(item, index) in flowList"
|
||||
:key="index"
|
||||
class="goods-item"
|
||||
>
|
||||
<view
|
||||
class="image-wrapper"
|
||||
@click="navigateToDetailPage(item)"
|
||||
>
|
||||
<image
|
||||
:src="removeOssStyle(item.content.thumbnail)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="goods-detail">
|
||||
<div
|
||||
class="title"
|
||||
@click="navigateToDetailPage(item)"
|
||||
>
|
||||
{{ item.content.goodsName }}
|
||||
</div>
|
||||
<view
|
||||
class="price-box"
|
||||
@click="navigateToDetailPage(item)"
|
||||
>
|
||||
<div
|
||||
class="price"
|
||||
v-if="item.content.price != undefined"
|
||||
>
|
||||
¥
|
||||
<span>{{ formatPrice(item.content.price)[0] }}</span>
|
||||
.{{ formatPrice(item.content.price)[1] }}
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<div
|
||||
class="promotion"
|
||||
@click="navigateToDetailPage(item)"
|
||||
>
|
||||
<div
|
||||
v-for="(promotionItem, promotionIndex) in getPromotion(item)"
|
||||
:key="promotionIndex"
|
||||
>
|
||||
<span v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="count-config"
|
||||
@click="navigateToDetailPage(item)"
|
||||
>
|
||||
<span>已售 {{ item.content.buyCount || '0' }}</span>
|
||||
<span>{{ item.content.commentNum || '0' }}条评论</span>
|
||||
</div>
|
||||
<div
|
||||
class="store-seller-name"
|
||||
@click="navigateToStoreDetailPage(item)"
|
||||
>
|
||||
<div class="text-hidden">
|
||||
<u-tag
|
||||
style="margin-right: 10rpx"
|
||||
size="mini"
|
||||
mode="dark"
|
||||
v-if="item.selfOperated"
|
||||
text="自营"
|
||||
type="error"
|
||||
/>
|
||||
<span>{{ item.content.storeName || '暂无' }}</span>
|
||||
</div>
|
||||
<span>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</span>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-loadmore
|
||||
style="padding: 10px 0"
|
||||
bg-color="#f8f8f8"
|
||||
:status="loadStatus"
|
||||
@loadmore="getData"
|
||||
></u-loadmore>
|
||||
</view>
|
||||
<u-empty
|
||||
v-else
|
||||
class="mt20"
|
||||
style="margin-top: 20%"
|
||||
text="暂无数据"
|
||||
mode="data"
|
||||
></u-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getGoodsList } from '@/api/goods.js';
|
||||
export default {
|
||||
props: {
|
||||
keywords: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
flag: 1, // 在tabs中的索引
|
||||
loadStatus: 'loadmore',
|
||||
flowList: [],
|
||||
page: 0,
|
||||
totalPage: 0,
|
||||
search: ''
|
||||
// 查询商品参数
|
||||
// params: {
|
||||
// pageNumber: 1,
|
||||
// pageSize: 10,
|
||||
// keyword: "",
|
||||
// }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
async getData() {
|
||||
if (this.loadStatus != 'loadmore') return;
|
||||
console.log('加载商品数据');
|
||||
this.page += 1;
|
||||
var params = {
|
||||
pageNumber: this.page,
|
||||
pageSize: 10,
|
||||
keyword: this.search
|
||||
};
|
||||
var res = await getGoodsList(params);
|
||||
console.log(res);
|
||||
if (res.data.result.content.length < 10) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.loadStatus = 'loadmore';
|
||||
}
|
||||
this.flowList.push(...res.data.result.content);
|
||||
},
|
||||
initData() {
|
||||
this.search = this.keywords;
|
||||
this.page = 0;
|
||||
this.totalPage = 0;
|
||||
this.flowList = [];
|
||||
this.loadStatus = 'loadmore';
|
||||
console.log('初始化商品数据');
|
||||
this.getData();
|
||||
},
|
||||
formatPrice(val) {
|
||||
if (typeof val == 'undefined') {
|
||||
return val;
|
||||
}
|
||||
return val.toFixed(2).split('.');
|
||||
},
|
||||
// 数据去重一下 只显示一次 减免 劵 什么的
|
||||
getPromotion(item) {
|
||||
if (item.promotionMap) {
|
||||
let array = [];
|
||||
Object.keys(item.promotionMap).forEach((child) => {
|
||||
if (!array.includes(child.split('-')[0])) {
|
||||
array.push(child.split('-')[0]);
|
||||
}
|
||||
});
|
||||
|
||||
return array;
|
||||
}
|
||||
},
|
||||
removeOssStyle(url) {
|
||||
return url.split('?')[0];
|
||||
},
|
||||
// 跳转到商品详情
|
||||
navigateToDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`
|
||||
});
|
||||
},
|
||||
// 跳转地址
|
||||
navigateToStoreDetailPage(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/shopPage?id=${item.content.storeId}`
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mt20 {
|
||||
margin-top: 20% !important;
|
||||
}
|
||||
.sort-active {
|
||||
border: 1px solid $light-color;
|
||||
color: $light-color;
|
||||
background: $price-light-color !important;
|
||||
}
|
||||
|
||||
.oldKeyList {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 3%;
|
||||
> .oldKeyItem {
|
||||
padding: 4rpx 24rpx;
|
||||
background: #f0f2f5;
|
||||
margin-right: 20rpx;
|
||||
max-width: 200rpx;
|
||||
border-radius: 100px;
|
||||
font-size: 24rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.promotion {
|
||||
margin-top: 4rpx;
|
||||
display: flex;
|
||||
div {
|
||||
span {
|
||||
font-size: 24rpx;
|
||||
color: $light-color;
|
||||
margin-right: 10rpx;
|
||||
padding: 0 4rpx;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.status_bar {
|
||||
height: var(--status-bar-height);
|
||||
background: #fff !important;
|
||||
width: 100%;
|
||||
}
|
||||
page {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
.sort-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background: #f7f7f7;
|
||||
.sort-list {
|
||||
margin: 20rpx 0;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 30rpx;
|
||||
> .sort-item {
|
||||
> .sort-title {
|
||||
margin: 20rpx 0;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.null-view {
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.sort-btn {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
border-top: 1px solid #f7f7f7;
|
||||
height: 100rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
align-items: center;
|
||||
> view {
|
||||
width: 50%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
margin: 0 20rpx;
|
||||
border-radius: 1000px;
|
||||
}
|
||||
> .sort-btn-repick {
|
||||
border: 1px solid #ededed;
|
||||
}
|
||||
> .sort-btn-confim {
|
||||
color: #fff;
|
||||
background-image: linear-gradient(90deg, #ff6b35, #ff9f28, #ffcc03);
|
||||
}
|
||||
}
|
||||
.uinput {
|
||||
width: 50% !important;
|
||||
> .sort-radius {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
/deep/ .uni-input-input {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.sort-radius {
|
||||
margin: 0 12rpx;
|
||||
background: #f7f7f7;
|
||||
height: 65rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 1000px;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.flex {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
> .sort-brand-item {
|
||||
width: 33%;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
.scoll-page {
|
||||
overflow: auto;
|
||||
}
|
||||
.content {
|
||||
background-color: $bg-color;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.index-nav-arrow:last-child {
|
||||
margin-top: -22rpx;
|
||||
}
|
||||
.line1-store-name {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.to-store {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.img {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
.goods-row {
|
||||
background: #fff;
|
||||
padding: 16rpx;
|
||||
|
||||
> .goods-col {
|
||||
display: flex;
|
||||
> .goods-img {
|
||||
flex: 4;
|
||||
}
|
||||
> .goods-detail {
|
||||
flex: 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add1 {
|
||||
background: #fff;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.oldKeyRow {
|
||||
background: #fff;
|
||||
padding: 34rpx 3%;
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
.clamp3 {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 400;
|
||||
display: -webkit-box;
|
||||
height: 80rpx;
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2 !important;
|
||||
|
||||
overflow: hidden;
|
||||
> span {
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
view {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.store-seller-name {
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
|
||||
> div {
|
||||
float: left;
|
||||
}
|
||||
|
||||
> span {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.count-config {
|
||||
padding: 10rpx 0;
|
||||
color: #666;
|
||||
display: flex;
|
||||
font-size: 24rpx;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
z-index: 99;
|
||||
width: 100%;
|
||||
background: $light-color;
|
||||
padding: 20rpx 2.5%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.search-box .mSearch-input-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-box .input-box {
|
||||
width: 85%;
|
||||
flex-shrink: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-box .search-btn {
|
||||
width: 15%;
|
||||
margin: 0 0 0 2%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(to right, #ff9801, #ff570a);
|
||||
border-radius: 60rpx;
|
||||
}
|
||||
|
||||
.search-box .input-box > input {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
font-size: 32rpx;
|
||||
border: 0;
|
||||
border-radius: 60rpx;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
padding: 0 3%;
|
||||
margin: 0;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.uni-scroll-view-content {
|
||||
background: #ededed !important;
|
||||
}
|
||||
|
||||
.placeholder-class {
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
.search-keyword {
|
||||
width: 100%;
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
.keyword-list-box {
|
||||
height: calc(100vh - 110rpx);
|
||||
padding-top: 10rpx;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.keyword-entry-tap {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.keyword-entry {
|
||||
width: 94%;
|
||||
height: 80rpx;
|
||||
margin: 0 3%;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: solid 1rpx #e7e7e7;
|
||||
}
|
||||
|
||||
.keyword-entry image {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.keyword-entry .keyword-text,
|
||||
.keyword-entry .keyword-img {
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.keyword-entry .keyword-text {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.keyword-entry .keyword-img {
|
||||
width: 10%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.keyword-box {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.keyword-box .keyword-block {
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
.keyword-box .keyword-block .keyword-list-header {
|
||||
width: 100%;
|
||||
padding: 20rpx 3%;
|
||||
font-size: 27rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.keyword-box .keyword-block .keyword-list-header image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.keyword-box .keyword-block .keyword > view {
|
||||
width: 50%;
|
||||
line-height: 1.75;
|
||||
overflow: hidden;
|
||||
padding: 0 3% 0 3% !important;
|
||||
}
|
||||
|
||||
.u-tips {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.keyword {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.keyword-box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.clear {
|
||||
color: #666666;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
font-size: 28rpx;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.keyword-box .keyword-block .hide-hot-tis {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
color: #6b6b6b;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
|
||||
z-index: 10;
|
||||
// position: fixed;
|
||||
// left: 0;
|
||||
// top: var(--status-bar-height);
|
||||
.nav-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
font-size: 30rpx;
|
||||
color: $font-color-dark;
|
||||
position: relative;
|
||||
}
|
||||
.current {
|
||||
color: $light-color;
|
||||
position: relative;
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
transform: translateX(-50%);
|
||||
width: 40rpx;
|
||||
height: 0;
|
||||
border-bottom: 4rpx solid $light-color;
|
||||
}
|
||||
}
|
||||
.p-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.yticon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30rpx;
|
||||
height: 14rpx;
|
||||
line-height: 1;
|
||||
margin-left: 4rpx;
|
||||
font-size: 26rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.xia {
|
||||
transform: scaleY(-1);
|
||||
}
|
||||
}
|
||||
|
||||
.cate-item {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 80rpx;
|
||||
position: relative;
|
||||
font-size: 44rpx;
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
border-left: 1px solid #ddd;
|
||||
width: 0;
|
||||
height: 36rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 分类 */
|
||||
.cate-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: var(--window-top);
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
z-index: 95;
|
||||
transition: 0.3s;
|
||||
|
||||
.cate-content {
|
||||
width: 630rpx;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
float: right;
|
||||
transform: translateX(100%);
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
&.none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.show {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
|
||||
.cate-content {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cate-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
|
||||
.cate-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 90rpx;
|
||||
padding-left: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: #555;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.two {
|
||||
height: 64rpx;
|
||||
color: #303133;
|
||||
font-size: 30rpx;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
}
|
||||
.price-box {
|
||||
margin-top: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-right: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: $font-color-light;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 26rpx;
|
||||
line-height: 1;
|
||||
color: $main-color;
|
||||
font-weight: bold;
|
||||
/deep/ span:nth-of-type(1) {
|
||||
font-size: 38rpx;
|
||||
}
|
||||
}
|
||||
/* 商品列表 */
|
||||
.goods-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 10rpx 20rpx 0;
|
||||
|
||||
// background: #fff;
|
||||
width: 100%;
|
||||
.goods-item {
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
border-radius: 16rpx;
|
||||
flex-direction: column;
|
||||
width: calc(50% - 30rpx);
|
||||
margin-bottom: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
|
||||
&:nth-child(2n + 1) {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.goods-detail {
|
||||
margin: 0 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
width: 100%;
|
||||
height: 330rpx;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: $font-base;
|
||||
color: $font-color-dark;
|
||||
line-height: 1.5;
|
||||
height: 84rpx;
|
||||
padding: 10rpx 0 0;
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.count-config,
|
||||
.store-seller-name {
|
||||
font-size: $font-sm;
|
||||
}
|
||||
|
||||
.text-hidden {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
background: $light-color;
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding-top: 300rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
/deep/ .u-image {
|
||||
width: 346rpx;
|
||||
height: 304rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
288
pages/search/tuangou.vue
Normal file
288
pages/search/tuangou.vue
Normal file
@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<view class="wrapper">
|
||||
<!-- 商品栏 -->
|
||||
<div class="swiper">
|
||||
<div v-if="groupBuy.length != 0">
|
||||
<view
|
||||
class="view-item"
|
||||
v-for="(groupItem, groupIndex) in groupBuy"
|
||||
:key="groupIndex"
|
||||
>
|
||||
<view class="view-left">
|
||||
<u-image
|
||||
border-radius="10"
|
||||
shape="square"
|
||||
:src="groupItem.thumbnail"
|
||||
width="186rpx"
|
||||
height="186rpx"
|
||||
>
|
||||
<view
|
||||
slot="error"
|
||||
style="font-size: 24rpx"
|
||||
>
|
||||
加载失败
|
||||
</view>
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="view-content">
|
||||
<view class="view-content-name">
|
||||
{{ groupItem.goodsName }}
|
||||
</view>
|
||||
<view class="view-content-bottom">
|
||||
<view>
|
||||
<view class="view-content-price">
|
||||
<!-- ¥{{groupItem.sales_price | unitPrice }} <span v-if="groupItem.point">+{{groupItem.point}}积分</span> -->
|
||||
¥{{ groupItem.price | unitPrice }}
|
||||
</view>
|
||||
<view class="view-content-original_price">¥{{ groupItem.originalPrice | unitPrice }}</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view
|
||||
class="btn-group"
|
||||
@click="toHref(groupItem)"
|
||||
>
|
||||
去拼团
|
||||
</view>
|
||||
<view class="buy-content">已售{{ groupItem.num || 0 }}件</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore
|
||||
style="padding: 10px 0"
|
||||
bg-color="#f8f8f8"
|
||||
:status="status"
|
||||
/>
|
||||
</div>
|
||||
<u-empty
|
||||
v-else
|
||||
style="margin-top: 20%"
|
||||
text="暂无数据"
|
||||
mode="data"
|
||||
></u-empty>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as API_Promotions from '@/api/promotions';
|
||||
import * as API_Goods from '@/api/goods';
|
||||
export default {
|
||||
props: {
|
||||
keywords: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
flag: 3, //tabs中的索引
|
||||
status: 'loadmore',
|
||||
is_empty: false,
|
||||
search: false,
|
||||
title: '拼团活动',
|
||||
background: {
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
empty: false,
|
||||
params: {
|
||||
pageNumber: 0,
|
||||
pageSize: 10,
|
||||
categoryPath: '',
|
||||
goodsName: ''
|
||||
},
|
||||
groupBuy: [],
|
||||
search: ''
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
initData() {
|
||||
this.search = this.keywords;
|
||||
this.status = 'loadmore';
|
||||
this.params = {
|
||||
pageNumber: 0,
|
||||
pageSize: 10,
|
||||
categoryPath: '',
|
||||
goodsName: this.search
|
||||
};
|
||||
this.groupBuy = [];
|
||||
console.log('初始化团购数据');
|
||||
this.getData();
|
||||
},
|
||||
|
||||
toHref(goods) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`
|
||||
});
|
||||
},
|
||||
|
||||
// 请求拼团数据
|
||||
getData() {
|
||||
if (this.status !== 'loadmore') return;
|
||||
this.params.pageNumber++;
|
||||
this.status = 'loading';
|
||||
this.params.goodsName = this.search;
|
||||
const params = JSON.parse(JSON.stringify(this.params));
|
||||
if (params.category_id === 0) delete params.category_id;
|
||||
|
||||
API_Promotions.getAssembleList(params)
|
||||
.then((response) => {
|
||||
const data = response.data.result.records;
|
||||
|
||||
if (!data || !data.length) {
|
||||
this.is_empty = true;
|
||||
this.status = 'nomore';
|
||||
} else {
|
||||
if (data.length < this.params.pageSize) {
|
||||
this.status = 'nomore';
|
||||
} else {
|
||||
this.status = 'loadmore';
|
||||
}
|
||||
this.is_empty = false;
|
||||
this.groupBuy.push(...(data || []));
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.view-item {
|
||||
background: #fff;
|
||||
border-radius: 0.4em;
|
||||
margin: 20rpx 30rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.nodata {
|
||||
text-align: center;
|
||||
margin: 40rpx 0 20rpx 0;
|
||||
}
|
||||
|
||||
.container-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
.white_class {
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.popupTips {
|
||||
font-size: 22rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #999999;
|
||||
margin: 0 20rpx;
|
||||
|
||||
/deep/ view {
|
||||
line-height: 1.75;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
margin: 30rpx 20rpx !important;
|
||||
}
|
||||
|
||||
.view-left,
|
||||
.view-content,
|
||||
.view-right,
|
||||
.view-item {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.view-left {
|
||||
width: 226rpx;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.view-content {
|
||||
width: calc((100% - 240rpx));
|
||||
padding-left: 20rpx;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
.buy-content {
|
||||
font-size: 22rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
margin-top: 15rpx;
|
||||
text-align: center;
|
||||
color: #999999;
|
||||
}
|
||||
.view-content-bottom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.group-wrapper {
|
||||
padding: 16rpx 32rpx;
|
||||
}
|
||||
.view-content-name {
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
.view-content-price {
|
||||
margin: 10rpx 0;
|
||||
letter-spacing: 0px;
|
||||
overflow: hidden;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
color: #ff5a10;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.view-content-original_price {
|
||||
font-size: 22rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
text-align: left;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
background: $aider-light-color;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 6rpx 16rpx;
|
||||
}
|
||||
/deep/ .empty {
|
||||
position: relative;
|
||||
padding-top: 20%;
|
||||
> .empty-content {
|
||||
position: relative;
|
||||
padding-top: 20%;
|
||||
}
|
||||
}
|
||||
</style>
|
220
pages/search/user.vue
Normal file
220
pages/search/user.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view v-if="flowList.length">
|
||||
<view
|
||||
class="flex-box"
|
||||
v-for="i in flowList"
|
||||
v-if="i.id != id"
|
||||
:key="i.id"
|
||||
>
|
||||
<u-image
|
||||
:src="i.face"
|
||||
class="flxleft"
|
||||
width="120"
|
||||
height="120"
|
||||
shape="circle"
|
||||
loading-icon="/static/missing-face.png"
|
||||
error-icon="/static/missing-face.png"
|
||||
style="display: flex; align-items: center"
|
||||
></u-image>
|
||||
|
||||
<view class="flxcenter">
|
||||
<view class="nkname">{{ i.nickname }}</view>
|
||||
<!-- <view class="fans">粉丝:125.2万</view> -->
|
||||
</view>
|
||||
<view class="flxright">
|
||||
<u-button
|
||||
type="error"
|
||||
@click="follow(i)"
|
||||
size="mini"
|
||||
v-if="i.followStatus == '未关注'"
|
||||
>
|
||||
关注
|
||||
</u-button>
|
||||
<u-button
|
||||
v-else
|
||||
type="plain"
|
||||
@click="cancelFollow(i)"
|
||||
size="mini"
|
||||
>
|
||||
{{ i.followStatus }}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore
|
||||
style="padding: 10px 0"
|
||||
bg-color="#f8f8f8"
|
||||
:status="loadStatus"
|
||||
@loadmore="getData"
|
||||
></u-loadmore>
|
||||
</view>
|
||||
<u-empty
|
||||
v-else
|
||||
style="margin-top: 20%"
|
||||
text="暂无数据"
|
||||
mode="data"
|
||||
></u-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import { vlogSearchUser, vlogFansFollow, vlogFansCancel } from '@/api/vlog';
|
||||
export default {
|
||||
props: {
|
||||
keywords: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
flag: 2, // 在tabs中的索引
|
||||
loadStatus: 'loadmore',
|
||||
flowList: [],
|
||||
page: 0,
|
||||
totalPage: 0,
|
||||
search: '',
|
||||
id: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
async getData() {
|
||||
if (this.loadStatus !== 'loadmore') return;
|
||||
var info = storage.getVlogUserInfo();
|
||||
var id = '';
|
||||
if (info != null) {
|
||||
id = info.id;
|
||||
}
|
||||
this.id = id;
|
||||
this.loadStatus = 'loading';
|
||||
this.page += 1;
|
||||
console.log('加载用户数据');
|
||||
|
||||
var params = {
|
||||
id: id,
|
||||
nickname: this.search,
|
||||
page: this.page,
|
||||
pageSize: 10
|
||||
};
|
||||
console.log(params);
|
||||
var result = await vlogSearchUser(params);
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
var data = result.data.data || [];
|
||||
if (!data.length) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
if (data.length < 10) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.loadStatus = 'loadmore';
|
||||
}
|
||||
data.forEach((i) => {
|
||||
i.doIflow = false;
|
||||
this.flowList.push(i);
|
||||
});
|
||||
// this.flowList.push(...data);
|
||||
}
|
||||
}
|
||||
},
|
||||
initData() {
|
||||
this.search = this.keywords;
|
||||
this.page = 0;
|
||||
this.totalPage = 0;
|
||||
this.flowList = [];
|
||||
this.loadStatus = 'loadmore';
|
||||
console.log('初始化用户数据');
|
||||
this.getData();
|
||||
},
|
||||
async follow(item) {
|
||||
let userInfo = storage.getVlogUserInfo();
|
||||
if (userInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let data = {
|
||||
myId: userInfo.id,
|
||||
vlogerId: item.id
|
||||
};
|
||||
var result = await vlogFansFollow(data);
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
item.followStatus = '已关注';
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
async cancelFollow(item) {
|
||||
let userInfo = storage.getVlogUserInfo();
|
||||
if (userInfo == null) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/passport/login',
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let data = {
|
||||
myId: userInfo.id,
|
||||
vlogerId: item.id
|
||||
};
|
||||
var result = await vlogFansCancel(data);
|
||||
console.log(result);
|
||||
if (result.data.status == 200) {
|
||||
item.doIflow = false;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result.data.msg,
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.flex-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
}
|
||||
.flxleft {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.flxcenter {
|
||||
flex: 1;
|
||||
}
|
||||
.nkname {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.fans {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.flxright {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<div class="jolkp">
|
||||
<div class="fan" :style="{ marginRight: statue == 0 ? '50%' : '50%' }">
|
||||
<div
|
||||
class="fan"
|
||||
:style="{ marginRight: statue == 0 ? '50%' : '50%' }"
|
||||
>
|
||||
<div
|
||||
@click="hui(0)"
|
||||
:style="{ marginTop: '35px', color: '#fff' }"
|
||||
@ -85,7 +88,10 @@
|
||||
|
||||
<!-- </div> -->
|
||||
<!-- 会话 -->
|
||||
<TUIConversation style="height: 100%" v-else />
|
||||
<TUIConversation
|
||||
style="height: 100%"
|
||||
v-else
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -157,7 +163,52 @@ export default {
|
||||
userSig: par.userSig,
|
||||
useUploadPlugin: true, // If you need to send rich media messages, please set to true.
|
||||
framework: `vue${vueVersion}`, // framework used vue2 / vue3
|
||||
}).then(()=>{
|
||||
Push.setRegistrationID(par.userID, () => {
|
||||
console.log('设置id设置id设置id设置id设置id设置id设置id设置id设置id设置id', par.userID);
|
||||
|
||||
Push.registerPush(
|
||||
par.sdkAppId,
|
||||
'vkFpe55aYqfV7Sk5uGaoxhEstJ3tcI9dquk7JwG1GloDSLD2HeMWeQweWWXgNlhC',
|
||||
(data) => {
|
||||
console.log('registerPush ok', data);
|
||||
Push.getRegistrationID((registrationID) => {
|
||||
console.log('getRegistrationID ok', registrationID);
|
||||
});
|
||||
},
|
||||
(errCode, errMsg) => {
|
||||
console.error('registerPush failed', errCode, errMsg);
|
||||
}
|
||||
);
|
||||
});
|
||||
// 监听通知栏点击事件,获取推送扩展信息
|
||||
Push.addPushListener(Push.EVENT.NOTIFICATION_CLICKED, (res) => {
|
||||
console.log('notification clicked', res);
|
||||
// 解析扩展信息,跳转到相应的会话(代码仅供参考,发布前需要完善)
|
||||
try {
|
||||
const data = JSON.parse(res.data);
|
||||
const conv_type = data?.entity?.chatType === 1 ? 'C2C' : 'GROUP';
|
||||
// 根据推送信息拼的 conversationID
|
||||
const conversationID = `${conv_type}${data.entity.sender}`;
|
||||
// 切换会话
|
||||
TUIConversationService.switchConversation(conversationID);
|
||||
const chatPath = '/TUIKit/components/TUIChat/index';
|
||||
uni.navigateTo({ url: chatPath });
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
});
|
||||
// 监听在线推送
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_RECEIVED, (res) => {
|
||||
// res 为消息内容
|
||||
console.log('message received', res);
|
||||
});
|
||||
// 监听在线推送被撤回
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_REVOKED, (res) => {
|
||||
// res 为被撤回的消息 ID
|
||||
console.log('message revoked', res);
|
||||
});
|
||||
})
|
||||
} else {
|
||||
// 接口返回非 200 状态码,跳转登录页面
|
||||
uni.navigateTo({
|
||||
@ -328,7 +379,7 @@ page {
|
||||
font-size: 15px;
|
||||
justify-content: end;
|
||||
/* 设置背景图 */
|
||||
background-image: url("@/static/im/Rectangle.png");
|
||||
background-image: url('@/static/im/Rectangle.png');
|
||||
/* 让背景图覆盖整个元素 */
|
||||
background-size: cover;
|
||||
/* 背景图不重复 */
|
||||
@ -338,7 +389,7 @@ page {
|
||||
.jolkp_l {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
background-image: url("@/static/im/Frame.png");
|
||||
background-image: url('@/static/im/Frame.png');
|
||||
/* 让背景图覆盖整个元素 */
|
||||
background-size: cover;
|
||||
/* 背景图不重复 */
|
||||
@ -350,7 +401,7 @@ page {
|
||||
.jolkp_h {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
background-image: url("@/static/im/user.png");
|
||||
background-image: url('@/static/im/user.png');
|
||||
/* 让背景图覆盖整个元素 */
|
||||
background-size: cover;
|
||||
/* 背景图不重复 */
|
||||
@ -361,7 +412,7 @@ page {
|
||||
.jolkp_z {
|
||||
width: 2rem;
|
||||
height: 1.5rem;
|
||||
background-image: url("@/static/im/znx.png");
|
||||
background-image: url('@/static/im/znx.png');
|
||||
/* 让背景图覆盖整个元素 */
|
||||
background-size: cover;
|
||||
/* 背景图不重复 */
|
||||
@ -405,7 +456,7 @@ page {
|
||||
|
||||
.fan {
|
||||
width: 10%;
|
||||
height: "100%";
|
||||
height: '100%';
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
|
||||
@ -415,7 +466,7 @@ page {
|
||||
.fan {
|
||||
margin-right: 56% !important;
|
||||
width: 10%;
|
||||
height: "100%";
|
||||
height: '100%';
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
margin-top: 85%;
|
||||
@ -441,7 +492,7 @@ page {
|
||||
.three_div1 {
|
||||
height: 3rem;
|
||||
width: 40%;
|
||||
background-image: url("@/static/im/kf.png");
|
||||
background-image: url('@/static/im/kf.png');
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
display: flex;
|
||||
@ -452,7 +503,7 @@ page {
|
||||
.three_div2 {
|
||||
width: 40%;
|
||||
height: 3rem;
|
||||
background-image: url("@/static/im/hy.png");
|
||||
background-image: url('@/static/im/hy.png');
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
width: 40%;
|
||||
@ -460,7 +511,7 @@ page {
|
||||
|
||||
.three_div3 {
|
||||
height: 3rem;
|
||||
background-image: url("@/static/im/da.png");
|
||||
background-image: url('@/static/im/da.png');
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
width: 40%;
|
||||
|
@ -1,142 +1,221 @@
|
||||
<template>
|
||||
<view class="page" :id="pageId">
|
||||
<!-- <list :id="pageId" class="page" :bounce="true" isSwiperList="true"> -->
|
||||
<!-- 左中右的三个页面切换, 依次是: 附近 - 关注 - 推荐 -->
|
||||
<swiper ref="swiper1" id="tab-bar-view" style="my-swiper" :style="{height: screenHeight + 'px'}"
|
||||
:current="curIndex" @change="changeTopTab" @transition="onswiperscroll" @animationfinish="animationfinish"
|
||||
@onAnimationEnd="animationfinish">
|
||||
<!-- <swiper-item>
|
||||
<view class="near-by" :style="{height: screenHeight+'px'}">
|
||||
<text ref="fujin" :pid="0" :parentId="pageId" class="warn-info">暂未开放,敬请期待!</text>
|
||||
</view>
|
||||
</swiper-item> -->
|
||||
<view
|
||||
class="page"
|
||||
:id="pageId"
|
||||
>
|
||||
<swiper
|
||||
ref="swiper1"
|
||||
id="tab-bar-view"
|
||||
style="my-swiper"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
:current="curIndex"
|
||||
@change="changeTopTab"
|
||||
@transition="onswiperscroll"
|
||||
@animationfinish="animationfinish"
|
||||
@onAnimationEnd="animationfinish"
|
||||
>
|
||||
<swiper-item>
|
||||
<view v-if="myUserInfo == null" ref="videoFollowComp" class="my-follow" :style="{height: screenHeight+'px'}">
|
||||
<text class="warn-info">请登录后查看!</text>
|
||||
</view>
|
||||
<video-follow-comp ref="videoFollowComp" :pid="1" :parentId="pageId" :screenHeight="screenHeight"
|
||||
:playFollowStatus="playFollowStatus" :videoList="videoList" :refreshList="refreshList"
|
||||
:pagingList="pagingList" @showLoading="showLoading" @hideLoading="hideLoading"
|
||||
@letFollowVideoPause="letFollowVideoPause"
|
||||
@displayVideoPaging="displayVideoPaging"></video-follow-comp>
|
||||
<video-local
|
||||
ref="videoLocal"
|
||||
:pid="1"
|
||||
:parentId="pageId"
|
||||
:screenHeight="screenHeight"
|
||||
:progressFlag="isDraw_lo"
|
||||
:playStatus="playLocalStatus"
|
||||
:videoList="videoList"
|
||||
:refreshList="refreshList"
|
||||
:pagingList="pagingList"
|
||||
@showLoading="showLoading"
|
||||
@hideLoading="hideLoading"
|
||||
@displayVideoPaging="displayVideoPaging"
|
||||
></video-local>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<video-comp ref="videoComp" :pid="2" :parentId="pageId" :screenHeight="screenHeight"
|
||||
:playStatus="playStatus" :videoList="videoList" :refreshList="refreshList" :pagingList="pagingList"
|
||||
@showLoading="showLoading" @hideLoading="hideLoading"
|
||||
@displayVideoPaging="displayVideoPaging"></video-comp>
|
||||
<view
|
||||
v-if="myUserInfo == null"
|
||||
ref="videoFollowComp"
|
||||
class="my-follow"
|
||||
:style="{ height: screenHeight + 'px' }"
|
||||
>
|
||||
<text class="warn-info">请登录后查看!</text>
|
||||
</view>
|
||||
<video-follow-comp
|
||||
ref="videoFollowComp"
|
||||
:pid="2"
|
||||
:parentId="pageId"
|
||||
:screenHeight="screenHeight"
|
||||
:progressFlag="isDraw_gz"
|
||||
:playFollowStatus="playFollowStatus"
|
||||
:videoList="videoList"
|
||||
:refreshList="refreshList"
|
||||
:pagingList="pagingList"
|
||||
@showLoading="showLoading"
|
||||
@hideLoading="hideLoading"
|
||||
@letFollowVideoPause="letFollowVideoPause"
|
||||
@displayVideoPaging="displayVideoPaging"
|
||||
></video-follow-comp>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<video-comp
|
||||
ref="videoComp"
|
||||
:pid="3"
|
||||
:parentId="pageId"
|
||||
:screenHeight="screenHeight"
|
||||
:progressFlag="isDraw_tj"
|
||||
:playStatus="playStatus"
|
||||
:videoList="videoList"
|
||||
:refreshList="refreshList"
|
||||
:pagingList="pagingList"
|
||||
@showLoading="showLoading"
|
||||
@hideLoading="hideLoading"
|
||||
@displayVideoPaging="displayVideoPaging"
|
||||
></video-comp>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<view class="header" id="head" :style="{marginTop:statusBarHeight+'px'}" v-if="!isLoading">
|
||||
<view
|
||||
class="header"
|
||||
id="head"
|
||||
:style="{ marginTop: statusBarHeight + 'px' }"
|
||||
v-if="!isLoading"
|
||||
>
|
||||
<text class="header-left"></text>
|
||||
<view class="header-center">
|
||||
<!-- <view class="header-item" @click="tapFollow(0)">
|
||||
<text class="header-item-title">附近</text>
|
||||
<view class="header-item-line" :class="{'activate-line': curIndex === 0}"></view>
|
||||
</view>
|
||||
<view class="header-item" @click="tapFollow(1)">
|
||||
<text class="header-item-title">关注</text>
|
||||
<view class="header-item-line" :class="{'activate-line': curIndex === 1}"></view>
|
||||
</view>
|
||||
<view class="header-item" @click="tapFollow(2)">
|
||||
<text class="header-item-title">推荐</text>
|
||||
<view class="header-item-line" :class="{'activate-line': curIndex === 2}"></view>
|
||||
</view> -->
|
||||
|
||||
<scroll-view ref="tabbar1" id="tab-bar" class="tab-bar" :scroll="false" :scroll-x="true"
|
||||
:show-scrollbar="false" :scroll-into-view="scrollInto">
|
||||
<view style="flex-direction: column;flex: 1;">
|
||||
<view style="flex-direction: row;flex: 1;justify-content: space-around;">
|
||||
<view class="uni-tab-item" v-for="(tab,index) in tabList" :key="tab.id" :id="tab.id"
|
||||
:ref="'tabitem'+index" :data-id="index" :data-current="index" @click="ontabtap">
|
||||
<text class="uni-tab-item-title scroll-view-animation"
|
||||
:class="tabIndex==index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
||||
<scroll-view
|
||||
ref="tabbar1"
|
||||
id="tab-bar"
|
||||
class="tab-bar"
|
||||
:scroll="false"
|
||||
:scroll-x="true"
|
||||
:show-scrollbar="false"
|
||||
:scroll-into-view="scrollInto"
|
||||
>
|
||||
<view style="flex-direction: column; flex: 1">
|
||||
<view style="flex-direction: row; flex: 1; justify-content: space-around">
|
||||
<view
|
||||
class="uni-tab-item"
|
||||
v-for="(tab, index) in tabList"
|
||||
:key="tab.id"
|
||||
:id="tab.id"
|
||||
:ref="'tabitem' + index"
|
||||
:data-id="index"
|
||||
:data-current="index"
|
||||
@click="ontabtap"
|
||||
>
|
||||
<text
|
||||
class="uni-tab-item-title scroll-view-animation"
|
||||
:class="tabIndex == index ? 'uni-tab-item-title-active' : ''"
|
||||
>
|
||||
{{ tab.name }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="scroll-view-indicator">
|
||||
<view ref="underline" class="scroll-view-underline" :class="'scroll-view-animation'"
|
||||
:style="{left: indicatorLineLeft + 'px', width: indicatorLineWidth + 'px'}"></view>
|
||||
<view
|
||||
ref="underline"
|
||||
class="scroll-view-underline"
|
||||
:class="isTap ? 'scroll-view-animation' : ''"
|
||||
:style="{ left: indicatorLineLeft + 'px', width: indicatorLineWidth + 'px' }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- <view class="tab-bar-line">tab-bar-line</view> -->
|
||||
|
||||
</view>
|
||||
<image class="header-right-search normal-img" src="/static/images/icon-search.png" @click="goSearch">
|
||||
<image
|
||||
class="header-right-search normal-img"
|
||||
src="/static/images/icon-search.png"
|
||||
@click="goSearch"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="header" :style="{marginTop:statusBarHeight+'px'}" v-if="isLoading">
|
||||
<view
|
||||
class="header"
|
||||
:style="{ marginTop: statusBarHeight + 'px' }"
|
||||
v-if="isLoading"
|
||||
>
|
||||
<text class="header-left"></text>
|
||||
<view class="header-center">
|
||||
<view class="header-item">
|
||||
<text class="header-refresh-title">下拉刷新视频</text>
|
||||
</view>
|
||||
</view>
|
||||
<image class="header-right-search normal-img" src="/static/images/loading.gif">
|
||||
<image
|
||||
class="header-right-search normal-img"
|
||||
src="/static/images/loading.gif"
|
||||
/>
|
||||
</view>
|
||||
<!-- 顶部切换的导航 end -->
|
||||
|
||||
</view>
|
||||
<!-- </list> -->
|
||||
</template>
|
||||
<script>
|
||||
let animation = weex.requireModule('animation')
|
||||
let animation = weex.requireModule('animation');
|
||||
let dom = weex.requireModule('dom');
|
||||
let system = uni.getSystemInfoSync();
|
||||
console.log(system);
|
||||
// 缓存每页最多
|
||||
const MAX_CACHE_DATA = 100;
|
||||
// 缓存页签数量
|
||||
const MAX_CACHE_PAGE = 3;
|
||||
const TAB_PRELOAD_OFFSET = 1;
|
||||
import storage from "@/utils/storage.js"; //缓存
|
||||
import {
|
||||
vlogList
|
||||
} from "@/api/vlog"
|
||||
import {
|
||||
isStrEmpty
|
||||
} from '@/utils/tools.js'
|
||||
import storage from '@/utils/storage.js'; //缓存
|
||||
import { vlogList } from '@/api/vlog';
|
||||
import { isStrEmpty } from '@/utils/tools.js';
|
||||
import videoComp from '@/components/vlog/videoComp';
|
||||
import videoLocal from '@/components/vlog/videoLocal';
|
||||
import videoFollowComp from '@/components/vlog/videoFollowComp';
|
||||
import config from '@/config/config';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
videoLocal,
|
||||
videoComp,
|
||||
videoFollowComp
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isTap: false,
|
||||
isLoading: false,
|
||||
statusBarHeight: system.statusBarHeight,
|
||||
screenHeight: system.screenHeight,
|
||||
curIndex: 1,
|
||||
playStatus: false,
|
||||
playFollowStatus: false,
|
||||
curIndex: 2,
|
||||
cityCode: '',
|
||||
playStatus: false, // 推荐
|
||||
playFollowStatus: false, // 关注
|
||||
playLocalStatus: false, // 同城
|
||||
videoList: [], // 首页一开始查询所得的默认视频列表
|
||||
refreshList: [], // 下拉刷新后获得的新的列表
|
||||
pagingList: [], // 分页list
|
||||
refresh: 0, // 从me页面传来的refresh,用于退出登录后重新刷新当前页的视频
|
||||
/////////////////
|
||||
pageList: ['videoFollowComp', 'videoComp'],
|
||||
pageList: ['videoLocal', 'videoFollowComp', 'videoComp'],
|
||||
tabList: [
|
||||
{
|
||||
id: "tab" + 0,
|
||||
name: '关注',
|
||||
id: 'tab' + 0,
|
||||
name: '同城',
|
||||
pageid: 1
|
||||
},
|
||||
{
|
||||
id: "tab" + 1,
|
||||
name: '推荐',
|
||||
id: 'tab' + 1,
|
||||
name: '关注',
|
||||
pageid: 2
|
||||
},
|
||||
{
|
||||
id: 'tab' + 2,
|
||||
name: '推荐',
|
||||
pageid: 3
|
||||
}
|
||||
], //tabs内容,'fujin','videoFollowComp','videoComp'
|
||||
indicatorLineLeft: 0,
|
||||
indicatorLineWidth: 0,
|
||||
cacheTab: [],
|
||||
scrollInto: "",
|
||||
pageId: "page",
|
||||
tabIndex: 1,
|
||||
}
|
||||
scrollInto: '',
|
||||
pageId: 'page',
|
||||
tabIndex: 2,
|
||||
isDraw_lo: false,
|
||||
isDraw_tj: false,
|
||||
isDraw_gz: false
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
onReady() {
|
||||
this._lastTabIndex = 0;
|
||||
this.swiperWidth = 0;
|
||||
@ -146,29 +225,39 @@
|
||||
this._headHeight = 100;
|
||||
var timer = setTimeout(() => {
|
||||
this.selectorQuery();
|
||||
clearTimeout(timer)
|
||||
clearTimeout(timer);
|
||||
}, 300);
|
||||
|
||||
},
|
||||
onTabItemTap: function (e) {
|
||||
console.log(e)
|
||||
// console.log(e);
|
||||
// let tabIndex = e.index;
|
||||
// this.playStatus = tabIndex === 0 ? true : false;
|
||||
// 切换视频要做暂停或播放的判断
|
||||
// let me = this;
|
||||
// if (tabIndex == 0) {
|
||||
// me.playStatus = false;
|
||||
// me.playFollowStatus = true;
|
||||
// } else if (tabIndex == 2) {
|
||||
// me.playStatus = true;
|
||||
// me.playFollowStatus = false;
|
||||
// }
|
||||
let me = this;
|
||||
let curIndex = me.curIndex;
|
||||
if (curIndex == 0) {
|
||||
me.playLocalStatus = true;
|
||||
me.playFollowStatus = false;
|
||||
me.playStatus = false;
|
||||
} else if (curIndex == 1) {
|
||||
me.playLocalStatus = false;
|
||||
me.playFollowStatus = true;
|
||||
me.playStatus = false;
|
||||
} else if (curIndex == 2) {
|
||||
me.playLocalStatus = false;
|
||||
me.playFollowStatus = false;
|
||||
me.playStatus = true;
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getLocation();
|
||||
let me = this;
|
||||
me.myUserInfo = storage.getVlogUserInfo();
|
||||
if (uni.getStorageSync('refreshVlogIndex') == '1') {
|
||||
storage.setRefreshVlogIndex('0') //不需要刷新
|
||||
storage.setRefreshVlogIndex('0'); //不需要刷新
|
||||
this.$refs.videoComp.displayVideoPaging(1, true);
|
||||
this.$refs.videoFollowComp.displayVideoPaging(1, true);
|
||||
this.$refs.videoLocal.displayVideoPaging(1, true);
|
||||
}
|
||||
|
||||
// 如果当前没有list, 则relaunch
|
||||
@ -179,35 +268,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断如果当前是tab为1或2,则播放,否则不播放
|
||||
if (me.curIndex == 0) {
|
||||
me.playLocalStatus = true;
|
||||
}
|
||||
if (me.curIndex == 1) {
|
||||
me.playFollowStatus = true;
|
||||
} else if (me.curIndex == 1) {
|
||||
}
|
||||
if (me.curIndex == 2) {
|
||||
me.playStatus = true;
|
||||
}
|
||||
|
||||
// onShow的时候,关注的话,则重新刷一下list
|
||||
var justFollowVlogerId = uni.getStorageSync("justFollowVlogerId") || '';
|
||||
console.log('我是justFollowVlogerId', justFollowVlogerId)
|
||||
if (!isStrEmpty(justFollowVlogerId)) {
|
||||
this.$refs.videoComp.reFollowPlayList(justFollowVlogerId);
|
||||
uni.setStorageSync("justFollowVlogerId", "");
|
||||
}
|
||||
// 取消关注也要重新刷一下list
|
||||
var justCancelVlogerId = uni.getStorageSync("justCancelVlogerId");
|
||||
if (!isStrEmpty(justCancelVlogerId)) {
|
||||
this.$refs.videoComp.reCancelPlayList(justCancelVlogerId);
|
||||
uni.setStorageSync("justCancelVlogerId", "");
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
var me = this;
|
||||
// 显示和隐藏,需要判断根据不同tab做暂停或者隐藏
|
||||
if (me.curIndex == 0) {
|
||||
me.playLocalStatus = false;
|
||||
me.isDraw_lo = false;
|
||||
}
|
||||
if (me.curIndex == 1) {
|
||||
me.playFollowStatus = false;
|
||||
} else if (me.curIndex == 1) {
|
||||
me.isDraw_gz = false;
|
||||
}
|
||||
if (me.curIndex == 2) {
|
||||
me.playStatus = false;
|
||||
me.isDraw_tj = false;
|
||||
}
|
||||
},
|
||||
|
||||
@ -223,54 +307,132 @@
|
||||
|
||||
// },
|
||||
methods: {
|
||||
getLocation() {
|
||||
uni.getLocation({
|
||||
type: 'wg84',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
var latitude = res.latitude;
|
||||
var longitude = res.longitude;
|
||||
var location = latitude + ',' + longitude;
|
||||
var key = config.aMapKey;
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/',
|
||||
method: 'GET',
|
||||
data: {
|
||||
location,
|
||||
key
|
||||
},
|
||||
success: (address) => {
|
||||
console.log(address);
|
||||
var ad_info = address.data.result.ad_info;
|
||||
var cityCode = ad_info.adcode; // 城市编码cityCode
|
||||
storage.setCityCode(cityCode);
|
||||
this.cityCode = cityCode;
|
||||
var address_name = ad_info.district || ad_info.city;
|
||||
this.tabList.forEach((i, index) => {
|
||||
if (index == 0) {
|
||||
i.name = address_name;
|
||||
// this.selectorQuery();
|
||||
var timer = setTimeout(() => {
|
||||
this.selectorQuery();
|
||||
clearTimeout(timer);
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '获取位置信息失败'
|
||||
});
|
||||
// uni.showModal({
|
||||
// title:'提示',
|
||||
// content:'获取位置信息失败',
|
||||
// showCancel:false,
|
||||
// success: (res) => {
|
||||
// if(res.confirm){
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 前往搜索页面
|
||||
goSearch() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/search/search"
|
||||
})
|
||||
url: '/pages/search/search'
|
||||
});
|
||||
},
|
||||
// ----------头部区域点击tabs
|
||||
ontabtap(e) {
|
||||
console.log(e);
|
||||
let index = e.target.dataset.current || e.currentTarget.dataset.current;
|
||||
this.tapFollow(index)
|
||||
this.isTap = true;
|
||||
var currentSize = this.tabListSize[index];
|
||||
|
||||
this.updateIndicator(currentSize.left, currentSize.width);
|
||||
this._touchTabIndex = index;
|
||||
this.switchTab(index);
|
||||
},
|
||||
//
|
||||
selectorQuery() {
|
||||
uni.createSelectorQuery().in(this).select('#head').boundingClientRect().exec(rect => {
|
||||
var dm = uni.createSelectorQuery().in(this);
|
||||
dm.select('#head')
|
||||
.boundingClientRect()
|
||||
.exec((rect) => {
|
||||
this._headHeight = rect[0].height;
|
||||
});
|
||||
|
||||
// 查询 tabbar 宽度
|
||||
uni.createSelectorQuery().in(this).select('#tab-bar').boundingClientRect().exec(rect => {
|
||||
dm.in(this)
|
||||
.select('#tab-bar')
|
||||
.boundingClientRect()
|
||||
.exec((rect) => {
|
||||
this.tabbarWidth = rect[0].width;
|
||||
console.log(this.tabbarWidth)
|
||||
console.log(this.tabbarWidth);
|
||||
});
|
||||
// 查询 tabview 宽度
|
||||
uni.createSelectorQuery().in(this).select('#tab-bar-view').boundingClientRect().exec(rect => {
|
||||
dm.in(this)
|
||||
.select('#tab-bar-view')
|
||||
.boundingClientRect()
|
||||
.exec((rect) => {
|
||||
this.swiperWidth = rect[0].width;
|
||||
console.log(this.swiperWidth)
|
||||
console.log(this.swiperWidth);
|
||||
});
|
||||
|
||||
// 因 nvue 暂不支持 class 查询
|
||||
var queryTabSize = uni.createSelectorQuery().in(this);
|
||||
// var queryTabSize = uni.createSelectorQuery().in(this);
|
||||
var queryTabSize = dm;
|
||||
for (var i = 0; i < this.tabList.length; i++) {
|
||||
queryTabSize.select('#' + this.tabList[i].id).boundingClientRect();
|
||||
}
|
||||
queryTabSize.exec(rects => {
|
||||
queryTabSize.exec((rects) => {
|
||||
rects.forEach((rect) => {
|
||||
rect.left = rect.left - 40; //修正 left 值,减去 padding-left: 40px
|
||||
this.tabListSize[rect.dataset.id] = rect;
|
||||
})
|
||||
console.log(this.tabListSize[this.tabIndex])
|
||||
this.updateIndicator(this.tabListSize[this.tabIndex].left, this.tabListSize[this.tabIndex]
|
||||
.width);
|
||||
});
|
||||
console.log(this.tabListSize[this.tabIndex]);
|
||||
this.updateIndicator(this.tabListSize[this.tabIndex].left, this.tabListSize[this.tabIndex].width);
|
||||
this.switchTab(this.tabIndex);
|
||||
});
|
||||
},
|
||||
|
||||
onswiperscroll(e) {
|
||||
// if(!this.tabListSize[this._lastTabIndex]) return
|
||||
this.isDraw_gz = false;
|
||||
this.isDraw_lo = false;
|
||||
this.isDraw_tj = false;
|
||||
// if (this.playStatus == true) {
|
||||
// this.playStatus = this._lastTabIndex == 2 ? false : true;
|
||||
// }
|
||||
|
||||
// this.playFollowStatus = this._lastTabIndex == 1 ? false : true;
|
||||
// this.playLocalStatus = this._lastTabIndex == 0 ? false : true;
|
||||
|
||||
var offsetX = e.detail.dx;
|
||||
var preloadIndex = this._lastTabIndex;
|
||||
if (offsetX > TAB_PRELOAD_OFFSET) {
|
||||
@ -278,14 +440,29 @@
|
||||
} else if (offsetX < -TAB_PRELOAD_OFFSET) {
|
||||
preloadIndex--;
|
||||
}
|
||||
if (preloadIndex === this._lastTabIndex || preloadIndex < 0 || preloadIndex > this.pageList.length - 1) {
|
||||
let prop = this.pageList[preloadIndex];
|
||||
let obj = this.$refs[prop];
|
||||
if (!obj) return;
|
||||
// 点击切换
|
||||
if (this.isTap) {
|
||||
return;
|
||||
}
|
||||
let prop = this.pageList[preloadIndex]
|
||||
let obj = this.$refs[prop]
|
||||
// 切换失败
|
||||
if (preloadIndex === this._lastTabIndex || preloadIndex < 0 || preloadIndex > this.pageList.length - 1) {
|
||||
// 是否有视频数据
|
||||
if (obj.playerList.length === 0) {
|
||||
// this.loadTabData(preloadIndex);
|
||||
this.isDraw_gz = false;
|
||||
this.isDraw_lo = false;
|
||||
this.isDraw_tj = false;
|
||||
} else {
|
||||
this.isDraw_gz = preloadIndex == 1 ? true : false;
|
||||
this.isDraw_lo = preloadIndex == 0 ? true : false;
|
||||
this.isDraw_tj = preloadIndex == 2 ? true : false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(this.tabListSize)
|
||||
var percentage = Math.abs(this.swiperWidth / offsetX);
|
||||
var currentSize = this.tabListSize[this._lastTabIndex];
|
||||
@ -296,27 +473,41 @@
|
||||
},
|
||||
animationfinish(e) {
|
||||
let index = e.detail.current;
|
||||
console.log('当前索引' + index);
|
||||
console.log('之前的索引' + this._lastTabIndex);
|
||||
this._lastTabIndex = index;
|
||||
if (this._touchTabIndex === index) {
|
||||
this.isTap = false;
|
||||
}
|
||||
this.switchTab(index);
|
||||
if (!this.tabListSize[index]) {
|
||||
return
|
||||
return;
|
||||
} else {
|
||||
// this.playStatus = index == 2 ? false : true;
|
||||
// this.playFollowStatus = index == 1 ? true : false;
|
||||
// this.playLocalStatus = index == 0 ? true : false;
|
||||
this.isDraw_gz = index == 1 ? true : false;
|
||||
this.isDraw_lo = index == 0 ? true : false;
|
||||
this.isDraw_tj = index == 2 ? true : false;
|
||||
|
||||
this.updateIndicator(this.tabListSize[index].left, this.tabListSize[index].width);
|
||||
}
|
||||
|
||||
},
|
||||
updateIndicator(left, width) {
|
||||
// console.log(left)
|
||||
this.indicatorLineLeft = left;
|
||||
this.indicatorLineWidth = width;
|
||||
},
|
||||
|
||||
switchTab(index) {
|
||||
|
||||
if (this.tabIndex === index) {
|
||||
return;
|
||||
}
|
||||
// console.dir(this.$refs)
|
||||
let props = this.pageList[index]
|
||||
console.log(props)
|
||||
console.log(index)
|
||||
let obj = this.$refs[props]
|
||||
let props = this.pageList[index];
|
||||
console.log(props);
|
||||
console.log(index);
|
||||
let obj = this.$refs[props];
|
||||
// if (obj.playerList.length === 0) {
|
||||
// var info = storage.getVlogUserInfo() || null
|
||||
// if(info!=null&&index==0){
|
||||
@ -324,14 +515,9 @@
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
obj.setScrollRef(this._headHeight);
|
||||
|
||||
if (this.tabIndex === index) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(this.cacheTab)
|
||||
console.log(this.cacheTab);
|
||||
// 缓存 tabId
|
||||
if (obj.playerList.length > MAX_CACHE_DATA) {
|
||||
let isExist = this.cacheTab.indexOf(this.tabIndex);
|
||||
@ -358,6 +544,7 @@
|
||||
// });
|
||||
},
|
||||
scrollTabTo(index) {
|
||||
console.log(index);
|
||||
const el = this.$refs['tabitem' + index][0];
|
||||
let offset = 0;
|
||||
// TODO fix ios offset
|
||||
@ -377,18 +564,14 @@
|
||||
// 左滑右滑选项卡改变选中状态
|
||||
changeTopTab: function (e) {
|
||||
var current = e.detail.current;
|
||||
this.switchTab(current)
|
||||
this.curIndex = current;
|
||||
this.tabIndex = current
|
||||
this.playFollowStatus = this.curIndex === 0 ? true : false;
|
||||
this.playStatus = this.curIndex === 1 ? true : false;
|
||||
},
|
||||
// 点击头部选项卡,切换页面
|
||||
tapFollow: function(current) {
|
||||
this.curIndex = current;
|
||||
this.tabIndex = current
|
||||
this.playFollowStatus = this.curIndex === 0 ? true : false;
|
||||
this.playStatus = this.curIndex === 1 ? true : false;
|
||||
this.tabIndex = current;
|
||||
let timer = setTimeout(() => {
|
||||
this.playLocalStatus = this.curIndex === 0 ? true : false;
|
||||
this.playFollowStatus = this.curIndex === 1 ? true : false;
|
||||
this.playStatus = this.curIndex === 2 ? true : false;
|
||||
clearTimeout(timer);
|
||||
}, 10);
|
||||
},
|
||||
|
||||
// 下拉刷新,改变head的字样显示
|
||||
@ -402,7 +585,7 @@
|
||||
this.playFollowStatus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -465,7 +648,7 @@
|
||||
text-align: center;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
@ -475,7 +658,7 @@
|
||||
text-align: center;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
@ -512,7 +695,7 @@
|
||||
|
||||
/* 选项卡轮播组件 end */
|
||||
.warn-info {
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
@ -552,7 +735,7 @@
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.scroll-view-indicator {
|
||||
@ -567,7 +750,7 @@
|
||||
bottom: 0;
|
||||
width: 0;
|
||||
/* background-color: #007AFF; */
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.scroll-view-animation {
|
||||
|
BIN
static/images/playvd.png
Normal file
BIN
static/images/playvd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
29
uni_modules/TencentCloud-Push/changelog.md
Normal file
29
uni_modules/TencentCloud-Push/changelog.md
Normal file
@ -0,0 +1,29 @@
|
||||
## 1.2.0(2025-03-31)
|
||||
- 适配出海手机支持 FCM 推送。
|
||||
## 1.1.0(2024-12-11)
|
||||
- 大幅减小插件包体积,优化产品体验。
|
||||
- 兼容 HBuilderX 4.36 的 Breaking changes。如果您需要 vivo/荣耀 的厂商推送,请参考 [文档](https://cloud.tencent.com/document/product/269/103522),正确配置 `manifestPlaceholders.json` 和 `mcn-services.json`。
|
||||
|
||||
## 1.0.0(2024-11-29)
|
||||
- 优化和 [TencentCloud-TUICallKit 插件](https://ext.dcloud.net.cn/plugin?id=9035) 融合时的产品体验。
|
||||
- 新增点击通知栏事件 NOTIFICATION_CLICKED,支持获取推送扩展信息。
|
||||
- 在线通道支持自定义铃音功能。
|
||||
|
||||
## 0.5.1(2024-11-07)
|
||||
- 优化和 [@tencentcloud/chat-uikit-uniapp](https://cloud.tencent.com/document/product/269/64507) 融合时的产品体验。
|
||||
- 优化和 [TencentCloud-TUICallKit 插件](https://ext.dcloud.net.cn/plugin?id=9035) 融合时的产品体验。
|
||||
- 新增接口 disablePostNotificationInForeground,此接口可实现应用在前台时,开/关通知栏通知(默认开)。
|
||||
- 新增接口 createNotificationChannel,支持 FCM/OPPO 自定义铃音。
|
||||
|
||||
## 0.4.0(2024-10-17)
|
||||
- 支持与 [TencentCloud-TUICallKit 插件](https://ext.dcloud.net.cn/plugin?id=9035) 融合打包。
|
||||
|
||||
## 0.3.0(2024-10-12)
|
||||
- 新增接口 addPushListener/removePushListener,支持获取在线推送消息,支持推送消息撤回通知。
|
||||
|
||||
## 0.2.0(2024-09-18)
|
||||
- 支持 FCM
|
||||
- 支持 hihonor
|
||||
|
||||
## 0.1.0(2024-09-10)
|
||||
- 使用 uts 开发,基于腾讯云推送服务(Push),支持 iOS 和 Android 推送,同时适配各大厂商推送。
|
0
pages/me/vlogerInfo.vue → uni_modules/TencentCloud-Push/index.js
Executable file → Normal file
0
pages/me/vlogerInfo.vue → uni_modules/TencentCloud-Push/index.js
Executable file → Normal file
90
uni_modules/TencentCloud-Push/package.json
Normal file
90
uni_modules/TencentCloud-Push/package.json
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
"name": "@tencentcloud/uni-app-push",
|
||||
"id": "TencentCloud-Push",
|
||||
"main": "index.js",
|
||||
"displayName": "【官方】uni-app 腾讯云推送服务(Push)",
|
||||
"version": "1.2.0",
|
||||
"description": "使用 uts 开发,基于腾讯云推送服务(Push),支持 iOS 和 Android 推送,同时适配各大厂商推送。",
|
||||
"license": "ISC",
|
||||
"keywords": [
|
||||
"腾讯云",
|
||||
"Push",
|
||||
"推送",
|
||||
"Android/iOS",
|
||||
"谷歌FCM"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.6.8"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "uts",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "腾讯云即时通信IM隐私保护指引: https://web.sdk.qcloud.com/document/Tencent-IM-Privacy-Protection-Guidelines.html\n移动推送隐私保护指引: https://privacy.qq.com/document/preview/8565a4a2d26e480187ed86b0cc81d727",
|
||||
"permissions": "本地存储空间"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y",
|
||||
"alipay": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-android": "y",
|
||||
"app-ios": "y",
|
||||
"app-harmony": "u"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "u",
|
||||
"Android Browser": "u",
|
||||
"微信浏览器(Android)": "u",
|
||||
"QQ浏览器(Android)": "u"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "u",
|
||||
"IE": "u",
|
||||
"Edge": "u",
|
||||
"Firefox": "u",
|
||||
"Safari": "u"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "u",
|
||||
"阿里": "u",
|
||||
"百度": "u",
|
||||
"字节跳动": "u",
|
||||
"QQ": "u",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
299
uni_modules/TencentCloud-Push/readme-npm.md
Normal file
299
uni_modules/TencentCloud-Push/readme-npm.md
Normal file
@ -0,0 +1,299 @@
|
||||
# TencentCloud-Push
|
||||
|
||||
## 简介
|
||||
|
||||
使用 uts 开发,基于腾讯云推送服务(Push),支持 iOS 和 Android 推送,同时适配各大厂商推送。
|
||||
|
||||
腾讯云推送服务(Push)提供一站式 App 推送解决方案,助您轻松提升用户留存和互动活跃度,支持与腾讯云即时通信 IM SDK、实时音视频 TRTC SDK、音视频通话 SDK、直播 SDK等音视频终端产品协同集成,在不同场景联合使用,提升业务整体功能体验。
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/60d714484e54b284cfa440adcc885349.png" width="618" height="456">
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/864c391ecf6f2724d26e368e4f09e466.png" width="618" height="444">
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/6af60f4b20dd46323e8f901a161a80a9.png" width="618" height="454">
|
||||
|
||||
#### 数据可视化,辅助运营策略
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/6c422f64900053c38a6bf66fe1103b3f.png" width="618" height="334">
|
||||
|
||||
#### 支持推送消息全链路问题排查
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/156d43ed48971f9bf865ad0c4e2342e3.png" width="618" height="443">
|
||||
|
||||
#### 六地服务部署,严守数据安全
|
||||
|
||||
提供了中国、东南亚(新加坡、印尼雅加达)、东北亚(韩国首尔)、欧洲(德国法兰克福)以及北美(美国硅谷)数据存储中心供选择,每个数据中心均支持全球接入。如果您的应用在境外上线且用户主要在境外,您可以根据消息传输需求及合规要求,选择适合您业务的境外数据中心,保障您的数据安全。
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/2ffc1a103a42d9c01cfb819cd92bbd1d.png" widht="618" height="308">
|
||||
|
||||
## 快速跑通
|
||||
|
||||
### 步骤1:创建应用
|
||||
|
||||
进入 [控制台](https://console.cloud.tencent.com/im) ,单击创建应用,填写应用名称,选择数据中心,单击确定,完成应用创建。
|
||||
|
||||

|
||||
|
||||
### 步骤2:开通推送服务 Push
|
||||
|
||||
进入 [推送服务 Push](https://console.cloud.tencent.com/im/push-plugin-push-identifier),单击立即购买或免费试用 。(每个应用可免费试用一次,有效期7天)
|
||||
|
||||

|
||||
|
||||
### 步骤3:下载腾讯云推送服务(Push)并复制 Push SDK 到您的项目中
|
||||
|
||||
1. 下载腾讯云推送服务(Push)。
|
||||
```
|
||||
npm install @tencentcloud/uni-app-push
|
||||
```
|
||||
|
||||
2. 复制 Push SDK 到您的项目中。
|
||||
|
||||
【macOS 端】
|
||||
|
||||
``` bash
|
||||
mkdir -p ./uni_modules/TencentCloud-Push && rsync -av ./node_modules/@tencentcloud/uni-app-push/ ./uni_modules/TencentCloud-Push
|
||||
```
|
||||
【Window 端】
|
||||
|
||||
``` bash
|
||||
xcopy .\node_modules\@tencentcloud\uni-app-push .\uni_modules\TencentCloud-Push /i /e
|
||||
```
|
||||
|
||||
### 步骤4:在 App.vue 中引入并注册腾讯云推送服务(Push)
|
||||
|
||||
将 SDKAppID 和 appKey 替换为您在IM 控制台 - 推送服务 Push - 接入设置页面 获取的应用的信息。如图所示:
|
||||
|
||||

|
||||
|
||||
```ts
|
||||
// 集成 TencentCloud-Push
|
||||
import * as Push from '@/uni_modules/TencentCloud-Push';
|
||||
const SDKAppID = 0; // 您的 SDKAppID
|
||||
const appKey = ''; // 客户端密钥
|
||||
Push.registerPush(SDKAppID, appKey, (data) => {
|
||||
console.log('registerPush ok', data);
|
||||
Push.getRegistrationID((registrationID) => {
|
||||
console.log('getRegistrationID ok', registrationID);
|
||||
});
|
||||
}, (errCode, errMsg) => {
|
||||
console.error('registerPush failed', errCode, errMsg);
|
||||
}
|
||||
);
|
||||
|
||||
// 监听通知栏点击事件,获取推送扩展信息
|
||||
Push.addPushListener(Push.EVENT.NOTIFICATION_CLICKED, (res) => {
|
||||
// res 为推送扩展信息
|
||||
console.log('notification clicked', res);
|
||||
});
|
||||
|
||||
// 监听在线推送
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_RECEIVED, (res) => {
|
||||
// res 为消息内容
|
||||
console.log('message received', res);
|
||||
});
|
||||
|
||||
// 监听在线推送被撤回
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_REVOKED, (res) => {
|
||||
// res 为被撤回的消息 ID
|
||||
console.log('message revoked', res);
|
||||
});
|
||||
```
|
||||
|
||||
### <span id="step5">步骤5:测试推送(测试前请务必打开手机通知权限,允许应用通知。)</span>
|
||||
|
||||
单击 HBuilderX 的 【运行 > 运行到手机或模拟器 > 制作自定义调试基座】,使用云端证书制作 Android 或 iOS 自定义调试基座。
|
||||
|
||||

|
||||
|
||||
自定义调试基座打好后,安装到手机运行。
|
||||
|
||||
[登录](https://console.cloud.tencent.com/im/push-plugin-push-check) 控制台,使用测试工具进行在线推送测试。
|
||||

|
||||
|
||||
## 厂商推送配置
|
||||
> - 请注意!HBuilderX 4.36 发布了不向下兼容的更新,如果您使用的是 HBuilderX 4.36 或者更高版本,且需要 vivo/荣耀 的厂商推送,
|
||||
请升级推送版本到 1.1.0 或更高版本,并参考文档正确配置 `manifestPlaceholders.json` 和 `mcs-services.json`。
|
||||
> - 请在 `nativeResources` 目录下进行推送配置。若项目根目录尚未创建该文件夹,请新建一个名为 `nativeResources` 的文件夹。
|
||||
> - 离线推送厂商配置完成后,需要打包自定义基座。参考:[[快速跑通]>[步骤5:测试推送(测试前请务必打开手机通知权限,允许应用通知。)]](#user-content-step5)
|
||||
|
||||
### 【Android】
|
||||
|
||||
1. 新建 nativeResources/android/assets 目录。
|
||||
|
||||
2. 在 [推送服务 Push > 接入设置 > 一键式快速配置](https://console.cloud.tencent.com/im/push-plugin-push-identifier) 下载 `timpush-configs.json` 文件,配置到 nativeResources/android/assets 目录下。
|
||||
|
||||
3. For 华为:
|
||||
|
||||
配置 `agconnect-services.json` (此文件获取详见 [厂商配置 > uniapp > 华为 > 步骤4:获取应用信息](https://cloud.tencent.com/document/product/269/103769))到 nativeResources/android 目录下。
|
||||
|
||||
4. For Google FCM:
|
||||
|
||||
4.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `project.plugins`,添加 `"com.google.gms.google-services"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"project": {
|
||||
"plugins": [
|
||||
...
|
||||
"com.google.gms.google-services"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4.2. 配置 `google-services.json` 文件到 nativeResources/android/ 目录。
|
||||
|
||||
5. For 荣耀:
|
||||
|
||||
5.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `dependencies`,添加 `"com.tencent.timpush:honor:8.3.6498"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"dependencies": [
|
||||
...
|
||||
"com.tencent.timpush:honor:8.3.6498"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
5.2. 配置 `mcs-services.json` 文件到 nativeResources/android 目录下。
|
||||
|
||||
5.3. 配置 `appID` 到 nativeResources/android/manifestPlaceholders.json 中的 `"HONOR_APPID"`,如下:
|
||||
```
|
||||
{
|
||||
"HONOR_APPID": ""
|
||||
}
|
||||
```
|
||||
|
||||
6. For vivo:
|
||||
|
||||
6.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `dependencies`,添加 `"com.tencent.timpush:vivo:8.3.6498"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"dependencies": [
|
||||
...
|
||||
"com.tencent.timpush:vivo:8.3.6498"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
6.2. 配置 `appID` 和 `appKey` 到 nativeResources/android/manifestPlaceholders.json 中的 `VIVO_APPKEY` 和 `VIVO_APPID`,如下:
|
||||
```
|
||||
{
|
||||
"VIVO_APPKEY": "",
|
||||
"VIVO_APPID": "",
|
||||
}
|
||||
```
|
||||
|
||||
### 【iOS】
|
||||
|
||||
1. 新建 nativeResources/ios/Resources 目录。
|
||||
|
||||
2. 在 nativeResources/ios/Resources 中**新建 timpush-configs.json 文件**。
|
||||
|
||||
3. 并将在 [IM控制台 > 推送服务 Push > 接入设置](https://console.cloud.tencent.com/im/push-plugin-push-identifier) 获取的证书ID,补充到 timpush-configs.json 文件中。
|
||||
|
||||
```
|
||||
{
|
||||
"businessID":"xxx"
|
||||
}
|
||||
```
|
||||
|
||||
## 接口
|
||||
|
||||
| API | 描述|
|
||||
|----|---|
|
||||
| registerPush | 注册推送服务 (必须在 App 用户同意了隐私政策,并且允许为 App 用户提供推送服务后,再调用该接口使用推送服务)。<br>首次注册成功后,TencentCloud-Push SDK 生成该设备的标识 - RegistrationID。<br> 业务侧可以把这个 RegistrationID 保存到业务服务器。业务侧根据 RegistrationID 向设备推送消息或者通知。|
|
||||
| unRegisterPush | 反注册关闭推送服务。|
|
||||
| setRegistrationID | 设置注册推送服务使用的推送 ID 标识,即 RegistrationID。<br/>如果业务侧期望业务账号 ID 和推送 ID 一致,方便使用,可使用此接口,此时需注意,此接口需在 registerPush(注册推送服务)之前调用。|
|
||||
| getRegistrationID | 注册推送服务成功后,获取推送 ID 标识,即 RegistrationID。|
|
||||
| getNotificationExtInfo | 获取推送扩展信息。|
|
||||
| getNotificationExtInfo | 收到离线推送时,点击通知栏拉起 app,调用此接口可获取推送扩展信息。|
|
||||
| addPushListener | 添加 Push 监听器。|
|
||||
| removePushListener | 移除 Push 监听器。|
|
||||
| disablePostNotificationInForeground | 应用在前台时,开/关通知栏通知。|
|
||||
| createNotificationChannel | 创建客户端通知 channel。|
|
||||
|
||||
|
||||
```ts
|
||||
registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|SDKAppID|number|是|推送(Push)应用 ID|
|
||||
|appKey|string|是|推送(Push)应用客户端密钥|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|onError|function|否|接口调用失败的回调函数|
|
||||
|
||||
```ts
|
||||
unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|onError|function|否|接口调用失败的回调函数|
|
||||
|
||||
```ts
|
||||
setRegistrationID(registrationID: string, onSuccess: () => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|registrationID|string|是|设备的推送标识 ID,卸载重装会改变。|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
|
||||
```ts
|
||||
getRegistrationID(onSuccess: (registrationID: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
```ts
|
||||
getNotificationExtInfo(onSuccess: (extInfo: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
```ts
|
||||
addPushListener(eventName: string, listener: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|eventName|string|是|推送事件类型|
|
||||
|listener|function|是|推送事件处理方法|
|
||||
|
||||
```ts
|
||||
removePushListener(eventName: string, listener?: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|eventName|string|是|推送事件类型|
|
||||
|listener|function|否|推送事件处理方法|
|
||||
|
||||
```ts
|
||||
disablePostNotificationInForeground(disable: boolean);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|disable|boolean|是|应用在前台时,开/关通知栏通知,默认开<br/> - true: 应用在前台时,关闭通知栏通知。<br/> - false: 应用在前台时,开启通知栏通知。|
|
||||
|
||||
```ts
|
||||
createNotificationChannel(options: any, listener: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|options.channelID|string|是|自定义 channel 的 ID|
|
||||
|options.channelName|string|是|自定义 channel 的名称|
|
||||
|options.channelDesc|string|否|自定义 channel 的描述|
|
||||
|options.channelSound|string|否|自定义 channel 的铃音,音频文件名,不带后缀,音频文件需要放到 xxx/nativeResources/android/res/raw 中。<br/> 例如:<br/> `options.channelSound = private_ring`,即设置 `xxx/nativeResources/android/res/raw/private_ring.mp3` 为自定义铃音|
|
||||
|listener|function|是|接口调用成功的回调函数|
|
285
uni_modules/TencentCloud-Push/readme.md
Normal file
285
uni_modules/TencentCloud-Push/readme.md
Normal file
@ -0,0 +1,285 @@
|
||||
# TencentCloud-Push
|
||||
|
||||
## 简介
|
||||
|
||||
使用 uts 开发,基于腾讯云推送服务(Push),支持 iOS 和 Android 推送,同时适配各大厂商推送。
|
||||
|
||||
腾讯云推送服务(Push)提供一站式 App 推送解决方案,助您轻松提升用户留存和互动活跃度,支持与腾讯云即时通信 IM SDK、实时音视频 TRTC SDK、音视频通话 SDK、直播 SDK等音视频终端产品协同集成,在不同场景联合使用,提升业务整体功能体验。
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/60d714484e54b284cfa440adcc885349.png" width="618" height="456">
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/864c391ecf6f2724d26e368e4f09e466.png" width="618" height="444">
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/6af60f4b20dd46323e8f901a161a80a9.png" width="618" height="454">
|
||||
|
||||
#### 数据可视化,辅助运营策略
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/6c422f64900053c38a6bf66fe1103b3f.png" width="618" height="334">
|
||||
|
||||
#### 支持推送消息全链路问题排查
|
||||
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/156d43ed48971f9bf865ad0c4e2342e3.png" width="618" height="443">
|
||||
|
||||
#### 六地服务部署,严守数据安全
|
||||
|
||||
提供了中国、东南亚(新加坡、印尼雅加达)、东北亚(韩国首尔)、欧洲(德国法兰克福)以及北美(美国硅谷)数据存储中心供选择,每个数据中心均支持全球接入。如果您的应用在境外上线且用户主要在境外,您可以根据消息传输需求及合规要求,选择适合您业务的境外数据中心,保障您的数据安全。
|
||||
<img src="https://qcloudimg.tencent-cloud.cn/image/document/2ffc1a103a42d9c01cfb819cd92bbd1d.png" widht="618" height="308">
|
||||
|
||||
## 快速跑通
|
||||
|
||||
### 步骤1:创建应用
|
||||
|
||||
进入 [控制台](https://console.cloud.tencent.com/im) ,单击创建应用,填写应用名称,选择数据中心,单击确定,完成应用创建。
|
||||
|
||||

|
||||
|
||||
### 步骤2:开通推送服务 Push
|
||||
|
||||
进入 [推送服务 Push](https://console.cloud.tencent.com/im/push-plugin-push-identifier),单击立即购买或免费试用 。(每个应用可免费试用一次,有效期7天)
|
||||
|
||||

|
||||
|
||||
### 步骤3:将 [uni-app 腾讯云推送服务(Push)](https://ext.dcloud.net.cn/plugin?id=20169)插件导入 HbuilderX 中的工程。如图所示:
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
### 步骤4:在 App.vue 中引入并注册腾讯云推送服务(Push)
|
||||
|
||||
将 SDKAppID 和 appKey 替换为您在IM 控制台 - 推送服务 Push - 接入设置页面 获取的应用的信息。如图所示:
|
||||
|
||||

|
||||
|
||||
```ts
|
||||
// 集成 TencentCloud-Push
|
||||
import * as Push from '@/uni_modules/TencentCloud-Push';
|
||||
const SDKAppID = 0; // 您的 SDKAppID
|
||||
const appKey = ''; // 客户端密钥
|
||||
Push.registerPush(SDKAppID, appKey, (data) => {
|
||||
console.log('registerPush ok', data);
|
||||
Push.getRegistrationID((registrationID) => {
|
||||
console.log('getRegistrationID ok', registrationID);
|
||||
});
|
||||
}, (errCode, errMsg) => {
|
||||
console.error('registerPush failed', errCode, errMsg);
|
||||
}
|
||||
);
|
||||
|
||||
// 监听通知栏点击事件,获取推送扩展信息
|
||||
Push.addPushListener(Push.EVENT.NOTIFICATION_CLICKED, (res) => {
|
||||
// res 为推送扩展信息
|
||||
console.log('notification clicked', res);
|
||||
});
|
||||
|
||||
// 监听在线推送
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_RECEIVED, (res) => {
|
||||
// res 为消息内容
|
||||
console.log('message received', res);
|
||||
});
|
||||
|
||||
// 监听在线推送被撤回
|
||||
Push.addPushListener(Push.EVENT.MESSAGE_REVOKED, (res) => {
|
||||
// res 为被撤回的消息 ID
|
||||
console.log('message revoked', res);
|
||||
});
|
||||
```
|
||||
|
||||
### <span id="step5">步骤5:测试推送(测试前请务必打开手机通知权限,允许应用通知。)</span>
|
||||
|
||||
单击 HBuilderX 的 【运行 > 运行到手机或模拟器 > 制作自定义调试基座】,使用云端证书制作 Android 或 iOS 自定义调试基座。
|
||||
|
||||

|
||||
|
||||
自定义调试基座打好后,安装到手机运行。
|
||||
|
||||
[登录](https://console.cloud.tencent.com/im/push-plugin-push-check) 控制台,使用测试工具进行在线推送测试。
|
||||

|
||||
|
||||
|
||||
## 厂商推送配置
|
||||
|
||||
> - 请注意!HBuilderX 4.36 发布了不向下兼容的更新,如果您使用的是 HBuilderX 4.36 或者更高版本,且需要 vivo/荣耀 的厂商推送,
|
||||
请升级推送版本到 1.1.0 或更高版本,并参考文档正确配置 `manifestPlaceholders.json` 和 `mcs-services.json`。
|
||||
> - 请在 `nativeResources` 目录下进行推送配置。若项目根目录尚未创建该文件夹,请新建一个名为 `nativeResources` 的文件夹。
|
||||
> - 厂商推送配置完成后,需要打包自定义基座。参考:[[快速跑通]>[步骤5:测试推送(测试前请务必打开手机通知权限,允许应用通知。)]](#step5)
|
||||
|
||||
#### 【Android】
|
||||
|
||||
1. 新建 nativeResources/android/assets 目录。
|
||||
|
||||
2. 在 [推送服务 Push > 接入设置 > 一键式快速配置](https://console.cloud.tencent.com/im/push-plugin-push-identifier) 下载 `timpush-configs.json` 文件,配置到 nativeResources/android/assets 目录下。
|
||||
|
||||
3. For 华为:
|
||||
|
||||
配置 `agconnect-services.json` (此文件获取详见 [厂商配置 > uniapp > 华为 > 步骤4:获取应用信息](https://cloud.tencent.com/document/product/269/103769))到 nativeResources/android 目录下。
|
||||
|
||||
4. For Google FCM:
|
||||
|
||||
4.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `project.plugins`,添加 `"com.google.gms.google-services"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"project": {
|
||||
"plugins": [
|
||||
...
|
||||
"com.google.gms.google-services"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4.2. 配置 `google-services.json` 文件到 nativeResources/android/ 目录。
|
||||
|
||||
5. For 荣耀:
|
||||
|
||||
5.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `dependencies`,添加 `"com.tencent.timpush:honor:8.3.6498"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"dependencies": [
|
||||
...
|
||||
"com.tencent.timpush:honor:8.3.6498"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
5.2. 配置 `mcs-services.json` 文件到 nativeResources/android 目录下。
|
||||
|
||||
5.3. 配置 `appID` 到 nativeResources/android/manifestPlaceholders.json 中的 `"HONOR_APPID"`,如下:
|
||||
```
|
||||
{
|
||||
"HONOR_APPID": ""
|
||||
}
|
||||
```
|
||||
|
||||
6. For vivo:
|
||||
|
||||
6.1. 编辑 uni_modules/TencentCloud-Push/utssdk/app-android/config.json 的 `dependencies`,添加 `"com.tencent.timpush:vivo:8.3.6498"`,如下:
|
||||
```
|
||||
{
|
||||
...
|
||||
"dependencies": [
|
||||
...
|
||||
"com.tencent.timpush:vivo:8.3.6498"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
6.2. 配置 `appID` 和 `appKey` 到 nativeResources/android/manifestPlaceholders.json 中的 `VIVO_APPKEY` 和 `VIVO_APPID`,如下:
|
||||
```
|
||||
{
|
||||
"VIVO_APPKEY": "",
|
||||
"VIVO_APPID": "",
|
||||
}
|
||||
```
|
||||
|
||||
#### 【iOS】
|
||||
|
||||
1. 新建 nativeResources/ios/Resources 目录。
|
||||
|
||||
2. 在 nativeResources/ios/Resources 目录下新建 `timpush-configs.json` 文件。
|
||||
|
||||
3. 将在 [IM控制台 > 推送服务 Push > 接入设置](https://console.cloud.tencent.com/im/push-plugin-push-identifier) 获取的证书ID,补充到 `timpush-configs.json` 文件中。
|
||||
|
||||
```
|
||||
{
|
||||
"businessID":"xxx"
|
||||
}
|
||||
```
|
||||
|
||||
## 接口
|
||||
|
||||
| API | 描述|
|
||||
|----|---|
|
||||
| registerPush | 注册推送服务 (必须在 App 用户同意了隐私政策,并且允许为 App 用户提供推送服务后,再调用该接口使用推送服务)。<br>首次注册成功后,TencentCloud-Push SDK 生成该设备的标识 - RegistrationID。<br> 业务侧可以把这个 RegistrationID 保存到业务服务器。业务侧根据 RegistrationID 向设备推送消息或者通知。|
|
||||
| unRegisterPush | 反注册关闭推送服务。|
|
||||
| setRegistrationID | 设置注册推送服务使用的推送 ID 标识,即 RegistrationID。<br/>如果业务侧期望业务账号 ID 和推送 ID 一致,方便使用,可使用此接口,此时需注意,此接口需在 registerPush(注册推送服务)之前调用。|
|
||||
| getRegistrationID | 注册推送服务成功后,获取推送 ID 标识,即 RegistrationID。|
|
||||
| getNotificationExtInfo | 收到离线推送时,点击通知栏拉起 app,调用此接口可获取推送扩展信息。|
|
||||
| addPushListener | 添加 Push 监听器。|
|
||||
| removePushListener | 移除 Push 监听器。|
|
||||
| disablePostNotificationInForeground | 应用在前台时,开/关通知栏通知(默认开)。|
|
||||
| createNotificationChannel | 创建客户端通知 channel。|
|
||||
|
||||
```ts
|
||||
registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|SDKAppID|number|是|推送(Push)应用 ID|
|
||||
|appKey|string|是|推送(Push)应用客户端密钥|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|onError|function|否|接口调用失败的回调函数|
|
||||
|
||||
```ts
|
||||
unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|onError|function|否|接口调用失败的回调函数|
|
||||
|
||||
```ts
|
||||
setRegistrationID(registrationID: string, onSuccess: () => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|registrationID|string|是|设备的推送标识 ID,卸载重装会改变。|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
|
||||
```ts
|
||||
getRegistrationID(onSuccess: (registrationID: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
```ts
|
||||
getNotificationExtInfo(onSuccess: (extInfo: string) => void): void;
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|onSuccess|function|是|接口调用成功的回调函数|
|
||||
|
||||
```ts
|
||||
addPushListener(eventName: string, listener: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|eventName|string|是|推送事件类型|
|
||||
|listener|function|是|推送事件处理方法|
|
||||
|
||||
```ts
|
||||
removePushListener(eventName: string, listener?: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|eventName|string|是|推送事件类型|
|
||||
|listener|function|否|推送事件处理方法|
|
||||
|
||||
```ts
|
||||
disablePostNotificationInForeground(disable: boolean);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|disable|boolean|是|应用在前台时,开/关通知栏通知,默认开<br/> - true: 应用在前台时,关闭通知栏通知。<br/> - false: 应用在前台时,开启通知栏通知。|
|
||||
|
||||
```ts
|
||||
createNotificationChannel(options: any, listener: (data: any) => void);
|
||||
```
|
||||
|
||||
|属性|类型|必填|说明|
|
||||
|----|---|----|----|
|
||||
|options.channelID|string|是|自定义 channel 的 ID|
|
||||
|options.channelName|string|是|自定义 channel 的名称|
|
||||
|options.channelDesc|string|否|自定义 channel 的描述|
|
||||
|options.channelSound|string|否|自定义 channel 的铃音,音频文件名,不带后缀,音频文件需要放到 xxx/nativeResources/android/res/raw 中。<br/> 例如:<br/> `options.channelSound = private_ring`,即设置 `xxx/nativeResources/android/res/raw/private_ring.mp3` 为自定义铃音|
|
||||
|listener|function|是|接口调用成功的回调函数|
|
29
uni_modules/TencentCloud-Push/utssdk/app-android/config.json
Normal file
29
uni_modules/TencentCloud-Push/utssdk/app-android/config.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"minSdkVersion": "21",
|
||||
"dependencies": [
|
||||
"com.google.android.material:material:1.3.0",
|
||||
"com.google.code.gson:gson:2.9.1",
|
||||
"commons-codec:commons-codec:1.15",
|
||||
"com.github.bumptech.glide:glide:4.12.0",
|
||||
"com.tencent.timpush:timpush:8.5.6864",
|
||||
"com.tencent.liteav.tuikit:tuicore:8.5.6864",
|
||||
"com.tencent.timpush:huawei:8.5.6864",
|
||||
"com.tencent.timpush:xiaomi:8.5.6864",
|
||||
"com.tencent.timpush:oppo:8.5.6864",
|
||||
"com.tencent.timpush:meizu:8.5.6864",
|
||||
"com.tencent.timpush:fcm:8.5.6864",
|
||||
"com.tencent.timpush:honor:8.5.6864",
|
||||
"com.tencent.timpush:vivo:8.5.6864"
|
||||
],
|
||||
"project": {
|
||||
"plugins": [
|
||||
"com.huawei.agconnect",
|
||||
"com.hihonor.mcs.asplugin"
|
||||
],
|
||||
"dependencies": [
|
||||
"com.huawei.agconnect:agcp:1.9.1.301",
|
||||
"com.google.gms:google-services:4.3.15",
|
||||
"com.hihonor.mcs:asplugin:2.0.1.300"
|
||||
]
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user