作者 xuqiang

提交

... ... @@ -14,12 +14,6 @@
}
},
{
"path":"pages/index/loginTim",
"style":{
"navigationStyle":"custom"
}
},
{
"path":"pages/index/landList",
"style":{
"navigationStyle":"custom"
... ... @@ -341,7 +335,8 @@
"path" : "pages/findWonderful/findWonderful",
"style" :
{
"navigationStyle":"custom"
"navigationStyle":"custom",
"enablePullDownRefresh": true
}
},
{
... ...
... ... @@ -222,17 +222,23 @@
...mapState({
userinfo: state => state.userinfo,
isLogin: state => state.isLogin,
isSDKReady: state => state.isSDKReady,
currentMessageList:state=>state.currentMessageList,
})
},
watch:{
currentMessageList(newVal,oldVal){
console.log('222222222222222222222222',newVal)
this.msgList = newVal
this.screenMsg(newVal,oldVal)
},
},
onLoad(option) {
if(!this.isSDKReady){
uni.switchTab({
url:'/pages/index/index'
})
return
}
this.showRoom = false
//监听键盘高度变化
uni.onKeyboardHeightChange(res => {
... ... @@ -264,14 +270,16 @@
},
onUnload(){
//退出页面 将所有的会话内的消息设置为已读
let promise = this.tim.setMessageRead({conversationID: this.conversationActive.conversationID});
promise.then(function(imResponse) {
console.log('全部已读')
// 已读上报成功
}).catch(function(imError) {
// 已读上报失败
console.warn('setMessageRead error:', imError);
});
if(this.isSDKReady){
let promise = this.tim.setMessageRead({conversationID: this.conversationActive.conversationID});
promise.then(function(imResponse) {
console.log('全部已读')
// 已读上报成功
}).catch(function(imError) {
// 已读上报失败
console.warn('setMessageRead error:', imError);
});
}
},
methods:{
//聊天的节点加上外层的div
... ...
... ... @@ -219,6 +219,18 @@
this.showWaterFalls = false
this.getData()
},
onPullDownRefresh(){
this.param.page = 1
this.last_page = 0
this.current_page = 1
this.list = []
this.showWaterFalls = false
this.getData()
console.log('refresh');
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
},
onReachBottom(){
if(this.current_page == this.last_page){
uni.showToast({
... ...
<template>
<view :style="{width: '750rpx',height:mapHeight + 'rpx'}">
<map id="around-food-map" @regionchange="regionchange" :style="{width: '750rpx',height:mapHeight + 'rpx'}" :scale="scale" @markertap="markertap" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
<view :style="{width: '750rpx',height:mapHeight + 'px'}">
<map id="around-food-map" @regionchange="regionchange" :style="{width: '750rpx',height:mapHeight + 'px'}" :scale="scale" @markertap="markertap" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
<!-- layer-style="d5f046428dcc29769f0256117754064b" -->
<!-- 查询地址区域 -->
<view class="searchWrap" :style="{top:statusBarHeight + 'rpx'}">
... ... @@ -30,7 +30,7 @@
<view class="positionWrap" @click="position" :style="{bottom:'400rpx'}">
<image style="width: 90rpx;height: 90rpx;" src="../../static/image/dingwei.png" mode=""></image>
</view>
<!-- <touch-slide v-if="landList.length > 0" style="background-color: #509d94;" :landIndex="0" :showSlide="landList[0].showSlide" @callback="callback" :top="mapHeight - platFormH" :bottom="mapHeight - (landList.length > 1 ? 40 : 10)" :titleHeight="30">
<touch-slide v-if="landList.length > 0" style="background-color: #509d94;" :landIndex="0" :showSlide="landList[0].showSlide" @callback="callback" :top="mapHeight - platFormH" :bottom="mapHeight - (landList.length > 1 ? 40 : 10)" :titleHeight="30">
<view class="handleLine" slot="title">
<view class="line"></view>
</view>
... ... @@ -224,7 +224,7 @@
<view class="rightEmp"></view>
</view>
</view>
</touch-slide> -->
</touch-slide>
<!-- 查询地址列表弹框区域 -->
<view class="searchLandWrap" v-if="showSearchLand" @click="showSearchLand = false">
... ... @@ -325,15 +325,13 @@
},
components:{touchSlide},
created() {
if(!this.isLogin || !this.isSDKReady){
uni.navigateTo({
url:'loginTim'
})
}
//获取状态栏高度
uni.getSystemInfo({
success: (res) => {
this.mapHeight = res.windowHeight * 2 + res.statusBarHeight*2
this.mapHeight = res.screenHeight - res.statusBarHeight
// #ifdef APP-NVUE || MP-WEIXIN
this.mapHeight = this.mapHeight - 45
// #endif
this.statusBarHeight = res.statusBarHeight*2
}
})
... ... @@ -361,7 +359,6 @@
this.city = res.address.city
},
fail: (err) => {
console.log('定位出错',err)
this.city = '北京市'
this.longitude = 116.39747
this.latitude = 39.908823
... ... @@ -412,11 +409,12 @@
iconPath: '../../static/image/Group_673.png'
})
this.landList.forEach(item => {
if(index == 0){
/* if(index == 0){
item.showSlide = true
}else{
item.showSlide = false
}
} */
item.showSlide = false
let starList = []
if(item.star > 0){
for(let i = 0; i < item.star; i ++){
... ... @@ -441,7 +439,6 @@
});
},
onLoad(option) {
console.log('当前系统是:'+plus.os.name.toLowerCase())
if(plus.os.name.toLowerCase() == 'ios'){
this.platFormH = 200
}else{
... ... @@ -454,7 +451,6 @@
version:version
},
success: (res) => {
console.log('版本',res)
if(res.data.data.versiondata != null){
this.versiondata = res.data.data.versiondata
this.showUpdateVersion = true
... ... @@ -476,7 +472,6 @@
},
watch:{
conversationList(newVal,oldVal){
console.log('conversationList变化了!!!!',oldVal,newVal)
this.getSysNoReadNum()
}
},
... ... @@ -641,7 +636,6 @@
let landArr = []
_this.scale = 12.9
_this.landList = []
console.log('222222222222222222',_this.allLandList.length)
if(_this.allLandList.length > 0){
uni.showLoading({
title:'加载中...'
... ... @@ -668,13 +662,14 @@
parseFloat(item.latitude) > regionRes.southwest.latitude &&
parseFloat(item.latitude) < regionRes.northeast.latitude &&
parseFloat(item.longitude) > regionRes.southwest.longitude &&
parseFloat(item.longitude) < regionRes.northeast.longitude
parseFloat(item.longitude) < regionRes.northeast.longitude
){
if(index == 0){
/* if(index == 0){
item.showSlide = true
}else{
item.showSlide = false
}
} */
item.showSlide = false
let starList = []
if(item.star > 0){
for(let i = 0; i < item.star; i ++){
... ... @@ -728,7 +723,6 @@
//点击标记点
markertap(e){
let landArr = this.landList
console.log('=======变更前======',this.landList)
let coverArr = []
let index = 0
this.landList = []
... ... @@ -754,7 +748,6 @@
landArr[i].showSlide = false
}
}
console.log('=======变更后======',landArr)
this.covers = coverArr
setTimeout(()=>{
this.landList = landArr
... ...
... ... @@ -236,14 +236,7 @@
...mapState(["landParam","userinfo","isLogin","noReadNum","isSDKReady","conversationList"])
},
watch: {
isSDKReady(val) {
//isSDKReady == true 请求会话列表
if (val) {
this.getConversationList()
}
},
conversationList(newVal,oldVal){
console.log('conversationList变化了!!!!',oldVal,newVal)
this.getSysNoReadNum()
}
},
... ... @@ -258,11 +251,6 @@
})
},
onShow() {
if(!this.isLogin || !this.isSDKReady){
uni.navigateTo({
url:'loginTim'
})
}
this.getSysNoReadNum()
},
onLoad() {
... ... @@ -270,7 +258,6 @@
type: 'wgs84',
geocode: true,
success: (res) => {
console.log('当前位置信息',res)
let param = this.landParam
param.page = 1
param.latitude = res.latitude
... ... @@ -306,7 +293,6 @@
getSysNoReadNum(){
//获取未读消息数量
this.$request('/system_notice/notReadNumber').then((res)=>{
console.log('系统通知未读数量',res)
let unReadCount = 0
if (this.conversationList.length) {
this.conversationList.forEach(item=>{
... ... @@ -327,7 +313,6 @@
this.landList = this.landList.concat(retCheckList.data.data)
},
scrolltolower(){
console.log('滚动到底部了')
if(this.current_page == this.last_page){
uni.showToast({
title:'无更多数据',
... ... @@ -348,14 +333,12 @@
getLandList(){
return new Promise((reslove)=>{
this.$request('/user/info').then((res)=>{
console.log('11111111111111111',res)
reslove(res)
})
})
},
reqCheckList(retUserInfo){
return new Promise((reslove)=>{
console.log('this.landParam================',this.landParam)
this.$request('/user_check/lis',this.landParam).then((res)=>{
this.current_page = res.data.current_page
this.last_page = res.data.last_page
... ... @@ -445,7 +428,7 @@
latitude: parseFloat(latitude),
longitude: parseFloat(longitude),
fail: (error) => {
console.log('导航失败',error)
}
});
},
... ... @@ -465,12 +448,10 @@
this.getData()
}
if(type == 'region'){
console.log('111111111111111',res)
this.landList = []
let param = this.landParam
let city = res.obj.city.label.substring(0,res.obj.city.label.length-1)
let cityTxt = ''
console.log('city11111111111',city)
if(res.result == '全部'){
param.province = ''
param.city = '',
... ... @@ -500,7 +481,6 @@
},
phone(phone){
this.$request('/user/getMiddleNumber',{mobile:phone}).then((res)=>{
console.log('获取虚拟小号',res)
if(res.code == 1){
uni.makePhoneCall({
phoneNumber:res.data
... ...
<template>
</template>
<script>
import {mapState} from "vuex"
export default{
computed:{
...mapState(["isLogin","isSDKReady","userinfo"])
},
onShow() {
if(!this.isLogin || !this.isSDKReady){
let userID = this.userinfo.id.toString()
let userSig = this.userinfo.user_sign
let userInfo = {
user: this.userinfo.nickname,
userId:this.userinfo.id,
img:this.userinfo.avatar,
userSig:this.userinfo.user_sign
}
//登录腾讯IM及时通讯
let promise = this.tim.login({
userID: userID,
userSig: userSig
});
promise.then((res) => {
console.warn('腾讯云即时通讯登录成功', res);
//登录成功后 更新登录状态
this.$store.commit("toggleIsLogin", true);
//自己平台的用户基础信息
uni.setStorageSync('userInfo', JSON.stringify(userInfo))
//tim 返回的用户信息
uni.setStorageSync('userTIMInfo', JSON.stringify(res.data))
uni.hideLoading()
uni.switchTab({
url:'/pages/index/index'
})
}).catch((err) => {
// 登录失败的相关信息
uni.switchTab({
url:'/pages/index/index'
})
console.warn('腾讯云即时通讯登录报错', err);
});
}else{
uni.switchTab({
url:'/pages/index/index'
})
}
}
}
</script>
<style>
</style>
... ... @@ -62,6 +62,7 @@
},
computed: {
...mapState({
userinfo: state => state.userinfo,
isLogin: state => state.isLogin,
isSDKReady: state => state.isSDKReady,
conversationList: state => state.conversationList,
... ... @@ -72,6 +73,8 @@
//isSDKReady == true 请求会话列表
if (val) {
this.getConversationList()
}else{
this.loginTim()
}
},
conversationList(val){
... ... @@ -80,7 +83,11 @@
},
onShow() {
this.getConversationList()
if (this.isSDKReady) {
this.getConversationList()
}else{
this.loginTim()
}
},
onLoad(){
if(this.isLogin){
... ... @@ -99,6 +106,32 @@
this.$href('/pages/my/aboutUs?navTitle='+item.title+'&noticeId='+item.id)
}
},
loginTim(){
let userID = this.userinfo.id.toString()
let userSig = this.userinfo.user_sign
let userInfo = {
user: this.userinfo.nickname,
userId:this.userinfo.id,
img:this.userinfo.avatar,
userSig:this.userinfo.user_sign
}
//登录腾讯IM及时通讯
let promise = this.tim.login({
userID: userID,
userSig: userSig
});
promise.then((res) => {
console.warn('腾讯云即时通讯登录成功', res);
//登录成功后 更新登录状态
this.$store.commit("toggleIsLogin", true);
//自己平台的用户基础信息
uni.setStorageSync('userInfo', JSON.stringify(userInfo))
//tim 返回的用户信息
uni.setStorageSync('userTIMInfo', JSON.stringify(res.data))
}).catch((err) => {
console.warn('腾讯云即时通讯登录报错', err);
});
},
changeTab(index){
this.tabIndex = index
if(index == 0){
... ... @@ -138,6 +171,7 @@
},
//获取消息列表
getConversationList() {
this.userAddConversationList = []
// 拉取会话列表
let promise = this.tim.getConversationList();
promise.then((res) => {
... ... @@ -157,7 +191,7 @@
this.setConversationList(conversationList)
},
async setConversationList(conversationList){
this.userAddConversationList = []
let tempArr = []
for(let i = 0;i < conversationList.length; i++){
let item = conversationList[i]
let obj = {}
... ... @@ -170,8 +204,9 @@
userSig:retUserInfo.data.user_sign
}
obj.user = userInfo
this.userAddConversationList.push(JSON.parse(JSON.stringify(obj)))
tempArr.push(JSON.parse(JSON.stringify(obj)))
}
this.userAddConversationList = tempArr
},
reqUserInfo(item){
return new Promise((reslove)=>{
... ...
... ... @@ -431,7 +431,7 @@
this.$request('/user/logout').then((res)=>{
if(res.code == 1){
/* =================================== 腾讯云即时通讯退出 开始 ==================================== */
if(this.isLogin && this.isSDKReady){
if(this.isSDKReady){
let promise = this.tim.logout();
promise.then(res=> {
console.log('即时通讯退出成功',res)
... ...