From eb0d648f6aab155c22f88d9f03b40acc29d2d977 Mon Sep 17 00:00:00 2001
From: luyuan <1162963624@qq.com>
Date: Fri, 7 Aug 2020 11:40:13 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/api/shop.js | 4 ++++
common/http.interceptor.js | 8 +++----
pageB/sdetails/index.vue | 35 +++++++++++++++++++++++++++++--
pages/index/index.vue | 19 ++++++++++++++++-
pages/information/information.vue | 16 +-------------
5 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/common/api/shop.js b/common/api/shop.js
index 2db23d5..d3c4551 100644
--- a/common/api/shop.js
+++ b/common/api/shop.js
@@ -318,6 +318,10 @@ export default {
addFavoriteStore({ id }) {
return vm.$u.post('member/addFavoriteStore',{ fid: id })
},
+ //店家id获取用户信息
+ getAtwillUserInfo({ id }) {
+ return vm.$u.post('Specialci/getAtwillUserInfo',{ store_id: id })
+ },
}
}
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 5484ac8..c1b271c 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -4,7 +4,7 @@ const install = (Vue, vm) => {
baseUrl: 'https://dmmall.sdbairui.com/api',
loadingText: '努力加载中~',
loadingTime: 800,
- // originalData: true
+ originalData: true
});
// 请求拦截,配置Token等参数
@@ -20,12 +20,12 @@ const install = (Vue, vm) => {
// 响应拦截,如配置,每次请求结束都会执行本方法
Vue.prototype.$u.http.interceptor.response = (res) => {
- if(parseInt(res.errCode) == 0) {
+ if(parseInt(res.data.errCode) == 0) {
// res为服务端返回值,可能有errCode,result等字段
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
// 如果配置了originalData为true,请留意这里的返回值
- return res;
- } else if(res.errCode == 401) {
+ return res.data;
+ } else if(res.data.errCode == 401) {
// 假设201为token失效,这里跳转登录
vm.$u.toast('验证失败,请重新登录');
setTimeout(() => {
diff --git a/pageB/sdetails/index.vue b/pageB/sdetails/index.vue
index 8b3237f..15b5768 100644
--- a/pageB/sdetails/index.vue
+++ b/pageB/sdetails/index.vue
@@ -139,7 +139,7 @@
店铺
-
+
客服
@@ -159,7 +159,7 @@
店铺
-
+
客服
@@ -204,6 +204,7 @@ export default {
sel: "", // 拼接的规格
quanxuan: false, // 规格是否选择
debounce: true,
+ storeid:0 //店铺id
}
},
components: {
@@ -238,6 +239,34 @@ export default {
clearInterval(this.timer);
},
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) {
let img = [];
list.forEach(item => {
@@ -309,12 +338,14 @@ export default {
// 普通商品详情
ordinaryDetails(id) {
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
+ console.log(res)
if (res.errCode == 0) {
this.evaluate = res.data.goods_evaluate_info;
this.goodsInfo = res.data.goods;
this.storeInfo = res.data.store;
this.setSwiperList(res.data.goods_image);
this.glist = res.data.spec_list;
+ this.storeid = res.data.store.store_id
// console.log(this.goodsInfo.mobile_body);
}
})
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 6107732..97074b8 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -231,6 +231,23 @@
this.tabLiveList();
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() {
this.getArticlelist();
// this.getManicureList({ load: 'reload' });
@@ -356,4 +373,4 @@
},
},
}
-
+
diff --git a/pages/information/information.vue b/pages/information/information.vue
index d901848..5f7d672 100644
--- a/pages/information/information.vue
+++ b/pages/information/information.vue
@@ -100,21 +100,7 @@
if (this.hasLogin) {
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: {
gochat(id){