This commit is contained in:
luyuan 2020-08-07 11:40:13 +08:00
parent 9f444ad070
commit eb0d648f6a
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
5 changed files with 60 additions and 22 deletions

View File

@ -318,6 +318,10 @@ export default {
addFavoriteStore({ id }) { addFavoriteStore({ id }) {
return vm.$u.post('member/addFavoriteStore',{ fid: id }) return vm.$u.post('member/addFavoriteStore',{ fid: id })
}, },
//店家id获取用户信息
getAtwillUserInfo({ id }) {
return vm.$u.post('Specialci/getAtwillUserInfo',{ store_id: id })
},
} }
} }

View File

@ -4,7 +4,7 @@ const install = (Vue, vm) => {
baseUrl: 'https://dmmall.sdbairui.com/api', baseUrl: 'https://dmmall.sdbairui.com/api',
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 800, loadingTime: 800,
// originalData: true originalData: true
}); });
// 请求拦截配置Token等参数 // 请求拦截配置Token等参数
@ -20,12 +20,12 @@ const install = (Vue, vm) => {
// 响应拦截,如配置,每次请求结束都会执行本方法 // 响应拦截,如配置,每次请求结束都会执行本方法
Vue.prototype.$u.http.interceptor.response = (res) => { Vue.prototype.$u.http.interceptor.response = (res) => {
if(parseInt(res.errCode) == 0) { if(parseInt(res.data.errCode) == 0) {
// res为服务端返回值可能有errCoderesult等字段 // res为服务端返回值可能有errCoderesult等字段
// 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到 // 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到
// 如果配置了originalData为true请留意这里的返回值 // 如果配置了originalData为true请留意这里的返回值
return res; return res.data;
} else if(res.errCode == 401) { } else if(res.data.errCode == 401) {
// 假设201为token失效这里跳转登录 // 假设201为token失效这里跳转登录
vm.$u.toast('验证失败,请重新登录'); vm.$u.toast('验证失败,请重新登录');
setTimeout(() => { setTimeout(() => {

View File

@ -139,7 +139,7 @@
<image src="/static/image/common/18.png"></image> <image src="/static/image/common/18.png"></image>
店铺 店铺
</view> </view>
<view class="navs" style="margin-right:30rpx"> <view @click="customers()" class="navs" style="margin-right:30rpx">
<image src="/static/image/common/19.png"></image> <image src="/static/image/common/19.png"></image>
客服 客服
</view> </view>
@ -159,7 +159,7 @@
<image src="/static/image/common/18.png"></image> <image src="/static/image/common/18.png"></image>
<text>店铺</text> <text>店铺</text>
</view> </view>
<view> <view @click="customers()">
<image src="/static/image/common/19.png"></image> <image src="/static/image/common/19.png"></image>
<text>客服</text> <text>客服</text>
</view> </view>
@ -204,6 +204,7 @@ export default {
sel: "", // sel: "", //
quanxuan: false, // quanxuan: false, //
debounce: true, debounce: true,
storeid:0 //id
} }
}, },
components: { components: {
@ -238,6 +239,34 @@ export default {
clearInterval(this.timer); clearInterval(this.timer);
}, },
methods: { methods: {
customers(){
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
this.uuid = uuid;
this.name = name;
this.avatar = avatar;
this.online = false;
this.unReadMessage = 0;
this.text = text;
this.time = time;
this.date = date
}
console.log(123)
this.$u.api.getAtwillUserInfo({
id:this.storeid
}).then((res)=>{
console.log(res)
let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar)
this.$u.route({
url:"/pageD/privateChat/privateChat",
params:{
id:JSON.stringify(user)
}
})
}).catch((err)=>{
console.log(err)
})
},
setSwiperList(list) { setSwiperList(list) {
let img = []; let img = [];
list.forEach(item => { list.forEach(item => {
@ -309,12 +338,14 @@ export default {
// //
ordinaryDetails(id) { ordinaryDetails(id) {
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{ this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
console.log(res)
if (res.errCode == 0) { if (res.errCode == 0) {
this.evaluate = res.data.goods_evaluate_info; this.evaluate = res.data.goods_evaluate_info;
this.goodsInfo = res.data.goods; this.goodsInfo = res.data.goods;
this.storeInfo = res.data.store; this.storeInfo = res.data.store;
this.setSwiperList(res.data.goods_image); this.setSwiperList(res.data.goods_image);
this.glist = res.data.spec_list; this.glist = res.data.spec_list;
this.storeid = res.data.store.store_id
// console.log(this.goodsInfo.mobile_body); // console.log(this.goodsInfo.mobile_body);
} }
}) })

View File

@ -231,6 +231,23 @@
this.tabLiveList(); this.tabLiveList();
this.getFollowList(); this.getFollowList();
}, },
onLoad(){
if(this.$store.state.hasLogin){
const user = uni.getStorageSync('user_info');
console.log(user)
this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
this.imService.connectIM()
let that = this
setTimeout(function(){
that.imService.disconnect()
console.log("guanbi")
},1000)
setTimeout(function(){
console.log("lianjie")
that.imService.connectIM()
},2000)
}
},
onPullDownRefresh() { onPullDownRefresh() {
this.getArticlelist(); this.getArticlelist();
// this.getManicureList({ load: 'reload' }); // this.getManicureList({ load: 'reload' });
@ -356,4 +373,4 @@
}, },
}, },
} }
</script> </script>

View File

@ -100,21 +100,7 @@
if (this.hasLogin) { if (this.hasLogin) {
this.messageIndex(); this.messageIndex();
} }
if(this.$store.state.hasLogin){
const user = uni.getStorageSync('user_info');
console.log(user)
this.imService.login(user.member.member_id,user.member.member_nickname,user.member.member_avatar)
this.imService.connectIM()
let that = this
setTimeout(function(){
that.imService.disconnect()
console.log("guanbi")
},1000)
setTimeout(function(){
console.log("lianjie")
that.imService.connectIM()
},2000)
}
}, },
methods: { methods: {
gochat(id){ gochat(id){