合并代码
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
|
||||
|
|
|
@ -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
|
||||
|
@ -44,9 +56,9 @@ export const news = {
|
|||
*/
|
||||
addFriend(param) {
|
||||
return util.request({
|
||||
url: `/user/friend/addFriend`,
|
||||
url: `/user/chat/relation/addFriend`,
|
||||
method: 'POST',
|
||||
path: param.path,
|
||||
data: param.data,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -1484,6 +1484,10 @@ const util = {
|
|||
if (rs.code === 200) {
|
||||
reslove(rs.data)
|
||||
const userinfo = rs.data
|
||||
// 如果开启了青少年模式
|
||||
if (userinfo.teenTime) {
|
||||
// 青少年模式验证 如果到了限制去锁定页
|
||||
}
|
||||
// 提交
|
||||
store.commit('setState', {
|
||||
key: 'userinfo',
|
||||
|
|
|
@ -19,14 +19,10 @@
|
|||
|
||||
// 开启青少年模式
|
||||
function handleUpdate() {
|
||||
api.mine.updateUserInfo({
|
||||
data: {
|
||||
youth: 1,
|
||||
}
|
||||
}).then(rs => {
|
||||
api.mine.adolescentOpen({}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// 设置闹铃
|
||||
setAlarm()
|
||||
// 更新用户信息
|
||||
util.getUserinfo()
|
||||
return
|
||||
}
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -14,12 +14,18 @@
|
|||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
getCurrentInstance
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onReachBottom,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
// 代理
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
|
@ -35,6 +41,17 @@
|
|||
total: 0,
|
||||
})
|
||||
const keyword = ref('')
|
||||
// 表单
|
||||
const form = reactive({
|
||||
Remark: '',
|
||||
AddWording: '',
|
||||
})
|
||||
// 朋友
|
||||
const friend = ref({})
|
||||
|
||||
onReady(() => {
|
||||
// proxy.$refs.friendRef.open()
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
// 获取更多列表
|
||||
|
@ -52,15 +69,14 @@
|
|||
return
|
||||
}
|
||||
|
||||
api.news.searchFriendByName({
|
||||
path: [keyword.value],
|
||||
api.news.searchUsers({
|
||||
query: {
|
||||
searchValue: keyword.value,
|
||||
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 => {
|
||||
|
@ -94,89 +110,6 @@
|
|||
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) {
|
||||
uni.navigateTo({
|
||||
|
@ -191,8 +124,25 @@
|
|||
* @param {Object} 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({
|
||||
path: [userinfo.value.userId, item.userId],
|
||||
data: [{
|
||||
toAccount: friend.value.userId,
|
||||
addWording: friend.value.AddWording,
|
||||
remark: friend.value.Remark,
|
||||
}],
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('已发送好友申请,请等待对方同意')
|
||||
|
@ -210,27 +160,27 @@
|
|||
<view class="searchBox ptb20 bfff">
|
||||
<view class="search rows mlr20 ptb10 plr30 bar">
|
||||
<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>
|
||||
</view>
|
||||
|
||||
<view class="listArea plr30 bfff">
|
||||
<!-- -->
|
||||
<view class="item rows ptb30 c333 f32" v-for="(item,index) in userList.data" :key="index" @click="handleUser(item)">
|
||||
<view class="item rows ptb30 c333 f32" v-for="(item,index) in userList.data" :key="index"
|
||||
@click="handleUser(item)">
|
||||
<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 class="content f1 mlr20">
|
||||
<view class="name">{{item.userNickname}}</view>
|
||||
<view class="time c999 f22">{{item.createTime}}</view>
|
||||
<view class="name">{{item.userName}}</view>
|
||||
<!-- <view class="time c999 f22">{{item.createTime}}</view> -->
|
||||
</view>
|
||||
|
||||
<template v-if="0">
|
||||
<view class="btns rows fs0" v-if="item.friendState == 1">
|
||||
<view class="btn black plr20" @click.stop="agreeFriend(item)">同意</view>
|
||||
<view class="btn cancel plr20 ml20" @click.stop="refuseFriend(item)">拒绝</view>
|
||||
<view class="btn black plr20" @click.stop="">同意</view>
|
||||
<view class="btn cancel plr20 ml20" @click.stop="">拒绝</view>
|
||||
</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>
|
||||
|
||||
<!-- 设置备注 -->
|
||||
<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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -14,21 +14,19 @@ export default defineConfig({
|
|||
changeOrigin: true,
|
||||
},
|
||||
"/user": {
|
||||
target: "http://192.168.1.235:8080",
|
||||
// target: "http://7fee92ac.r22.cpolar.top",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/coreplay": {
|
||||
target: "http://192.168.1.235:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/file": {
|
||||
target: "http://192.168.1.235:8080",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/video": {
|
||||
target: "http://192.168.1.235:8080",
|
||||
// target: "http://7fee92ac.r22.cpolar.top",
|
||||
target: "http://192.168.0.133:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue