合并代码
This commit is contained in:
parent
7c1c2af676
commit
3c27a4a274
|
@ -27,6 +27,19 @@ const mine = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启青少年模式
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
adolescentOpen(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/adolescent/open`,
|
||||||
|
data: param.data,
|
||||||
|
method: 'GET',
|
||||||
|
load: 1,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取我的评论
|
* 获取我的评论
|
||||||
* @param {Object} param
|
* @param {Object} param
|
||||||
|
|
|
@ -14,6 +14,18 @@ export const news = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索用户
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
searchUsers(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/searchUsers`,
|
||||||
|
method: 'GET',
|
||||||
|
query: param.query
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置好友备注
|
* 设置好友备注
|
||||||
* @param {Object} param
|
* @param {Object} param
|
||||||
|
@ -44,9 +56,9 @@ export const news = {
|
||||||
*/
|
*/
|
||||||
addFriend(param) {
|
addFriend(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/user/friend/addFriend`,
|
url: `/user/chat/relation/addFriend`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
path: param.path,
|
data: param.data,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1484,6 +1484,10 @@ const util = {
|
||||||
if (rs.code === 200) {
|
if (rs.code === 200) {
|
||||||
reslove(rs.data)
|
reslove(rs.data)
|
||||||
const userinfo = rs.data
|
const userinfo = rs.data
|
||||||
|
// 如果开启了青少年模式
|
||||||
|
if (userinfo.teenTime) {
|
||||||
|
// 青少年模式验证 如果到了限制去锁定页
|
||||||
|
}
|
||||||
// 提交
|
// 提交
|
||||||
store.commit('setState', {
|
store.commit('setState', {
|
||||||
key: 'userinfo',
|
key: 'userinfo',
|
||||||
|
|
|
@ -19,14 +19,10 @@
|
||||||
|
|
||||||
// 开启青少年模式
|
// 开启青少年模式
|
||||||
function handleUpdate() {
|
function handleUpdate() {
|
||||||
api.mine.updateUserInfo({
|
api.mine.adolescentOpen({}).then(rs => {
|
||||||
data: {
|
|
||||||
youth: 1,
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
// 设置闹铃
|
// 更新用户信息
|
||||||
setAlarm()
|
util.getUserinfo()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
@ -35,44 +31,6 @@
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置时间
|
|
||||||
function setAlarm() {
|
|
||||||
// 当前时间+40分钟
|
|
||||||
let endTime = new Date().getTime()
|
|
||||||
//
|
|
||||||
endTime = util.strtotime('+40 minute', endTime)
|
|
||||||
//
|
|
||||||
const maxDateTime = new Date().setHours(20, 0, 0).valueOf()
|
|
||||||
// console.log(new Date(endTime).valueOf(), maxDateTime)
|
|
||||||
endTime = util.formatTime('yyyy-MM-dd HH:mm:ss', Math.min(new Date(endTime).valueOf(), maxDateTime))
|
|
||||||
|
|
||||||
// 40分之后的
|
|
||||||
api.video.setAlarm({
|
|
||||||
query: {
|
|
||||||
//
|
|
||||||
endTime,
|
|
||||||
// 1倒计时闹钟 2时间闹钟 3青少年闹钟
|
|
||||||
type: 3,
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 200) {
|
|
||||||
util.alert('设置成功')
|
|
||||||
// 设置
|
|
||||||
util.setAlarm({
|
|
||||||
"userId": userinfo.value.userId,
|
|
||||||
"endTime": endTime,
|
|
||||||
"type": 3
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -14,12 +14,18 @@
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
computed,
|
computed,
|
||||||
|
getCurrentInstance
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
|
onReady,
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
onPullDownRefresh
|
onPullDownRefresh
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
|
// 代理
|
||||||
|
const {
|
||||||
|
proxy
|
||||||
|
} = getCurrentInstance()
|
||||||
// vuex
|
// vuex
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
// 用户信息
|
// 用户信息
|
||||||
|
@ -35,6 +41,17 @@
|
||||||
total: 0,
|
total: 0,
|
||||||
})
|
})
|
||||||
const keyword = ref('')
|
const keyword = ref('')
|
||||||
|
// 表单
|
||||||
|
const form = reactive({
|
||||||
|
Remark: '',
|
||||||
|
AddWording: '',
|
||||||
|
})
|
||||||
|
// 朋友
|
||||||
|
const friend = ref({})
|
||||||
|
|
||||||
|
onReady(() => {
|
||||||
|
// proxy.$refs.friendRef.open()
|
||||||
|
})
|
||||||
|
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
// 获取更多列表
|
// 获取更多列表
|
||||||
|
@ -52,15 +69,14 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
api.news.searchFriendByName({
|
api.news.searchUsers({
|
||||||
path: [keyword.value],
|
|
||||||
query: {
|
query: {
|
||||||
|
searchValue: keyword.value,
|
||||||
pageNum: userList.pageNum,
|
pageNum: userList.pageNum,
|
||||||
pageSize: userList.pageSize,
|
pageSize: userList.pageSize,
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
|
|
||||||
if (userList.pageNum) userList.data.length = 0
|
if (userList.pageNum) userList.data.length = 0
|
||||||
// 追加朋友列表
|
// 追加朋友列表
|
||||||
userList.data.push(...rs.rows.map(item => {
|
userList.data.push(...rs.rows.map(item => {
|
||||||
|
@ -94,89 +110,6 @@
|
||||||
getSearchFriendList()
|
getSearchFriendList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同意好友申请
|
|
||||||
function agreeFriend(item) {
|
|
||||||
api.video.agreeFriend({
|
|
||||||
path: [userinfo.value.userId, item.userId],
|
|
||||||
query: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '同意成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: rs.msg,
|
|
||||||
icon: 'error',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 拒绝好友申请
|
|
||||||
function refuseFriend(item) {
|
|
||||||
api.video.refuseFriend({
|
|
||||||
path: [userinfo.value.userId, item.userId],
|
|
||||||
query: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '拒绝成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: rs.msg,
|
|
||||||
icon: 'error',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}).finally(() => {
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取朋友列表
|
|
||||||
function getFriendList() {
|
|
||||||
api.news.getFriendListPage({
|
|
||||||
path: [userinfo.value.userId],
|
|
||||||
query: {
|
|
||||||
pageNum: userList.pageNum,
|
|
||||||
pageSize: userList.pageSize,
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 200) {
|
|
||||||
if (userList.pageNum) userList.data.length = 0
|
|
||||||
// 追加朋友列表
|
|
||||||
userList.data.push(...rs.rows.map(item => {
|
|
||||||
item.format_userPortrait = util.format_url(item.userPortrait, 'img')
|
|
||||||
return item
|
|
||||||
}))
|
|
||||||
// 视频列表
|
|
||||||
userList.total = rs.total
|
|
||||||
return
|
|
||||||
}
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
}).finally(() => {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点击用户
|
// 点击用户
|
||||||
function handleUser(item) {
|
function handleUser(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -191,8 +124,25 @@
|
||||||
* @param {Object} item 用户信息
|
* @param {Object} item 用户信息
|
||||||
*/
|
*/
|
||||||
function handleAdd(item) {
|
function handleAdd(item) {
|
||||||
|
friend.value.userId = item.userId
|
||||||
|
friend.value.userName = item.userName
|
||||||
|
friend.value.AddWording = `你好,我是${userinfo.value.userNickname}`
|
||||||
|
proxy.$refs.friendRef.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填入对方昵称
|
||||||
|
function pushNickname() {
|
||||||
|
friend.value.Remark = friend.value.userName
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送好友申请
|
||||||
|
function addFriendConfirm() {
|
||||||
api.news.addFriend({
|
api.news.addFriend({
|
||||||
path: [userinfo.value.userId, item.userId],
|
data: [{
|
||||||
|
toAccount: friend.value.userId,
|
||||||
|
addWording: friend.value.AddWording,
|
||||||
|
remark: friend.value.Remark,
|
||||||
|
}],
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
util.alert('已发送好友申请,请等待对方同意')
|
util.alert('已发送好友申请,请等待对方同意')
|
||||||
|
@ -210,27 +160,27 @@
|
||||||
<view class="searchBox ptb20 bfff">
|
<view class="searchBox ptb20 bfff">
|
||||||
<view class="search rows mlr20 ptb10 plr30 bar">
|
<view class="search rows mlr20 ptb10 plr30 bar">
|
||||||
<uni-icons type="search" />
|
<uni-icons type="search" />
|
||||||
<input type="text" v-model="keyword" placeholder="用户名" class="f1 ml10" confirm-type="search" />
|
<input type="text" v-model="keyword" placeholder="输入手机号/账号" class="f1 ml10" confirm-type="search" />
|
||||||
<view class="btn bar sm colourful w120" @click="refreshFriendList">搜索</view>
|
<view class="btn bar sm colourful w120" @click="refreshFriendList">搜索</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="listArea plr30 bfff">
|
<view class="listArea plr30 bfff">
|
||||||
<!-- -->
|
<view class="item rows ptb30 c333 f32" v-for="(item,index) in userList.data" :key="index"
|
||||||
<view class="item rows ptb30 c333 f32" v-for="(item,index) in userList.data" :key="index" @click="handleUser(item)">
|
@click="handleUser(item)">
|
||||||
<view class="avatar fs0">
|
<view class="avatar fs0">
|
||||||
<image class="wh100 cir" :src="item.format_userPortrait" mode="aspectFill" />
|
<image class="wh100 cir" :src="item.imageUrl" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="content f1 mlr20">
|
<view class="content f1 mlr20">
|
||||||
<view class="name">{{item.userNickname}}</view>
|
<view class="name">{{item.userName}}</view>
|
||||||
<view class="time c999 f22">{{item.createTime}}</view>
|
<!-- <view class="time c999 f22">{{item.createTime}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template v-if="0">
|
<template v-if="0">
|
||||||
<view class="btns rows fs0" v-if="item.friendState == 1">
|
<view class="btns rows fs0" v-if="item.friendState == 1">
|
||||||
<view class="btn black plr20" @click.stop="agreeFriend(item)">同意</view>
|
<view class="btn black plr20" @click.stop="">同意</view>
|
||||||
<view class="btn cancel plr20 ml20" @click.stop="refuseFriend(item)">拒绝</view>
|
<view class="btn cancel plr20 ml20" @click.stop="">拒绝</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="result fs0 c999" v-else-if="item.friendState == 2">已拒绝</view>
|
<view class="result fs0 c999" v-else-if="item.friendState == 2">已拒绝</view>
|
||||||
|
@ -245,6 +195,32 @@
|
||||||
<!-- 填充 -->
|
<!-- 填充 -->
|
||||||
<view class="fill" style="height: 60rpx;"></view>
|
<view class="fill" style="height: 60rpx;"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 设置备注 -->
|
||||||
|
<uni-popup ref="friendRef" type="bottom">
|
||||||
|
<view class="friendAlt popBot plr20 bfff">
|
||||||
|
<view class="header rows ptb30 f32">
|
||||||
|
<view class="">发送好友申请</view>
|
||||||
|
<uni-icons type="closeempty" @click="$refs.friendRef.close()" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="main mlr30">
|
||||||
|
<view class="txtplus inputBox mtb30 ptb20 plr20 br10">
|
||||||
|
<input type="text" v-model="friend.AddWording" placeholder="填写招呼语" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="txtplus inputBox mtb30 ptb20 plr20 br10">
|
||||||
|
<input type="text" v-model="friend.Remark" placeholder="设置备注" />
|
||||||
|
</view>
|
||||||
|
<view class=" mt10 c666 f28" @click="pushNickname">
|
||||||
|
<text class="push">填入</text>
|
||||||
|
<text>对方昵称</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn lg bar black mtb30" @click="addFriendConfirm">确定</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -14,21 +14,19 @@ export default defineConfig({
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/user": {
|
"/user": {
|
||||||
target: "http://192.168.1.235:8080",
|
target: "http://192.168.0.133:8080",
|
||||||
// target: "http://7fee92ac.r22.cpolar.top",
|
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/coreplay": {
|
"/coreplay": {
|
||||||
target: "http://192.168.1.235:8080",
|
target: "http://192.168.0.133:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/file": {
|
"/file": {
|
||||||
target: "http://192.168.1.235:8080",
|
target: "http://192.168.0.133:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/video": {
|
"/video": {
|
||||||
target: "http://192.168.1.235:8080",
|
target: "http://192.168.0.133:8080",
|
||||||
// target: "http://7fee92ac.r22.cpolar.top",
|
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue