Merge pull request 'xbx' (#130) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/130
This commit is contained in:
commit
26254aba84
@ -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 })
|
||||
},
|
||||
// 收藏商品
|
||||
addFavoriteGoods({ fid }) {
|
||||
return vm.$u.post('member/addFavoriteGoods',{ fid: fid })
|
||||
|
@ -1,10 +1,11 @@
|
||||
var md5 = require("../static/js/md5.min.js")
|
||||
const install = (Vue, vm) => {
|
||||
// 此为自定义配置参数,具体参数见上方说明
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
baseUrl: 'https://dmmall.sdbairui.com/api',
|
||||
loadingText: '努力加载中~',
|
||||
loadingTime: 800,
|
||||
// originalData: true
|
||||
originalData: true
|
||||
});
|
||||
|
||||
// 请求拦截,配置Token等参数
|
||||
@ -13,19 +14,36 @@ const install = (Vue, vm) => {
|
||||
const token = uni.getStorageSync('token');
|
||||
|
||||
config.header.Authorization = 'Bearer' + " " + token;
|
||||
|
||||
Date.prototype.Format = function (fmt) { // author: meizz
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, // 月份
|
||||
"d+": this.getDate(), // 日
|
||||
"h+": this.getHours(), // 小时
|
||||
"m+": this.getMinutes(), // 分
|
||||
"s+": this.getSeconds(), // 秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), // 季度
|
||||
"S": this.getMilliseconds() // 毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
let time = new Date().Format("yyyyMMddhhmmss")
|
||||
config.header.Sign = md5('DBCA4F8DA7BC0BA2' + time) + '-' + time
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
// 响应拦截,如配置,每次请求结束都会执行本方法
|
||||
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('您还没有登录哦,请先去登录!');
|
||||
if (res.data.action != "memberinfo") {
|
||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -4,6 +4,11 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"blueimp-md5": {
|
||||
"version": "2.17.0",
|
||||
"resolved": "https://registry.npm.taobao.org/blueimp-md5/download/blueimp-md5-2.17.0.tgz?cache=0&sync_timestamp=1595922448921&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fblueimp-md5%2Fdownload%2Fblueimp-md5-2.17.0.tgz",
|
||||
"integrity": "sha1-9PysCIsRX3tARfGfXaWenQGxu5Y="
|
||||
},
|
||||
"uview-ui": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.5.0.tgz",
|
||||
|
@ -13,6 +13,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"blueimp-md5": "^2.17.0",
|
||||
"uview-ui": "^1.5.0",
|
||||
"vuex": "^3.5.1"
|
||||
}
|
||||
|
@ -146,7 +146,7 @@
|
||||
<image src="/static/image/common/18.png"></image>
|
||||
店铺
|
||||
</view>
|
||||
<view class="navs" style="margin-right:30rpx" v-if="!showSpec">
|
||||
<view class="navs" style="margin-right:30rpx" v-if="!showSpec" @click="customers()">
|
||||
<image src="/static/image/common/19.png"></image>
|
||||
客服
|
||||
</view>
|
||||
@ -166,7 +166,7 @@
|
||||
<image src="/static/image/common/18.png"></image>
|
||||
<text>店铺</text>
|
||||
</view>
|
||||
<view>
|
||||
<view @click="customers()">
|
||||
<image src="/static/image/common/19.png"></image>
|
||||
<text>客服</text>
|
||||
</view>
|
||||
@ -211,6 +211,7 @@ export default {
|
||||
sel: "", // 拼接的规格
|
||||
quanxuan: false, // 规格是否选择
|
||||
debounce: true,
|
||||
storeid:0 //店铺id
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@ -247,6 +248,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 => {
|
||||
@ -314,12 +343,15 @@ 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);
|
||||
this.type = res.data.view_type;
|
||||
this.setTitle();
|
||||
if(this.type == 1) {
|
||||
|
@ -134,8 +134,8 @@
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.setNavigationBarColor({
|
||||
backgroundColor : '#D02129',
|
||||
frontColor : '#ffffff'
|
||||
backgroundColor : '#FF780F',
|
||||
frontColor : '#333333'
|
||||
});
|
||||
}, 10);
|
||||
|
||||
@ -567,7 +567,7 @@
|
||||
}
|
||||
.chatInterface .message-item.self .content span{
|
||||
color: #ffffff;
|
||||
background:#D02129;
|
||||
background:#FF780F;
|
||||
word-break: break-all;
|
||||
text-align: left;
|
||||
max-width: 520rpx;
|
||||
|
@ -233,6 +233,23 @@
|
||||
this.getArticlelist();
|
||||
this.getSwiper();
|
||||
},
|
||||
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' });
|
||||
|
@ -23,6 +23,8 @@
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="contentes u-line-1">{{item.text}}</view>
|
||||
<view class="times">{{item.time}}</view>
|
||||
<view class="tishi" v-if="item.unReadMessage"></view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -100,21 +102,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){
|
||||
@ -173,10 +161,14 @@
|
||||
},
|
||||
// 清空消息
|
||||
delMessage(){
|
||||
|
||||
this.$u.api.delMessage({
|
||||
type : "all"
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.imService.friends = {};
|
||||
this.information_dl = [];
|
||||
uni.setStorageSync('imlist',JSON.stringify([]));
|
||||
if(res.errCode == 0){
|
||||
this.$refs.uToast.show({
|
||||
title: '清除成功',
|
||||
@ -194,6 +186,15 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tishi{
|
||||
position: absolute;
|
||||
bottom: 30rpx;
|
||||
right: 30rpx;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #FF0000;
|
||||
}
|
||||
.sousuo {
|
||||
height: 113rpx;
|
||||
border: 1px #f00 solid;
|
||||
@ -236,6 +237,7 @@
|
||||
padding-bottom: 23rpx;
|
||||
border-bottom: 1px #ececec solid;
|
||||
padding: 20rpx 5rpx 23rpx 5rpx;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 84rpx;
|
||||
|
@ -8,12 +8,12 @@
|
||||
import GoEasyIM from './goeasy-im-1.0.9';
|
||||
import restApi from './restapi';
|
||||
|
||||
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
|
||||
function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.avatar = avatar;
|
||||
this.online = false;
|
||||
this.unReadMessage = 0;
|
||||
this.unReadMessage = parseInt(unReadMessage);
|
||||
this.text = text;
|
||||
this.time = time;
|
||||
this.date = date
|
||||
@ -106,7 +106,7 @@ IMService.prototype.initialContacts = function (friendList) {
|
||||
},
|
||||
success(res){
|
||||
console.log(res)
|
||||
that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1],i[2]);
|
||||
that.friends[i[0]] = new Friend(res.data.data.member_id, res.data.data.member_nickname, res.data.data.member_avatar,i[1],i[2],i[3]);
|
||||
console.log(that.friends)
|
||||
let sorts = function (friends){
|
||||
let paixu = function (a,b){
|
||||
@ -299,7 +299,7 @@ IMService.prototype.initialIMListeners = function () {
|
||||
sorts(that.friendsarr)
|
||||
let arr = []
|
||||
for(let i in that.friends){
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date])
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,that.friends[i].unReadMessage])
|
||||
}
|
||||
console.log(arr)
|
||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||
@ -323,7 +323,7 @@ IMService.prototype.initialIMListeners = function () {
|
||||
sorts(that.friendsarr)
|
||||
let arr = []
|
||||
for(let i in that.friends){
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date])
|
||||
arr.push([that.friends[i].uuid,that.friends[i].time,that.friends[i].text,that.friends[i].date,that.friends[i].unReadMessage])
|
||||
}
|
||||
console.log(arr)
|
||||
uni.setStorageSync('imlist',JSON.stringify(arr))
|
||||
|
2
static/js/md5.min.js
vendored
Normal file
2
static/js/md5.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
!function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d((c=d(d(t,n),d(e,u)))<<(f=o)|c>>>32-f,r);var c,f}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function i(n,t){var r,e,o,u;n[t>>5]|=128<<t%32,n[14+(t+64>>>9<<4)]=t;for(var c=1732584193,f=-271733879,i=-1732584194,a=271733878,h=0;h<n.length;h+=16)c=l(r=c,e=f,o=i,u=a,n[h],7,-680876936),a=l(a,c,f,i,n[h+1],12,-389564586),i=l(i,a,c,f,n[h+2],17,606105819),f=l(f,i,a,c,n[h+3],22,-1044525330),c=l(c,f,i,a,n[h+4],7,-176418897),a=l(a,c,f,i,n[h+5],12,1200080426),i=l(i,a,c,f,n[h+6],17,-1473231341),f=l(f,i,a,c,n[h+7],22,-45705983),c=l(c,f,i,a,n[h+8],7,1770035416),a=l(a,c,f,i,n[h+9],12,-1958414417),i=l(i,a,c,f,n[h+10],17,-42063),f=l(f,i,a,c,n[h+11],22,-1990404162),c=l(c,f,i,a,n[h+12],7,1804603682),a=l(a,c,f,i,n[h+13],12,-40341101),i=l(i,a,c,f,n[h+14],17,-1502002290),c=v(c,f=l(f,i,a,c,n[h+15],22,1236535329),i,a,n[h+1],5,-165796510),a=v(a,c,f,i,n[h+6],9,-1069501632),i=v(i,a,c,f,n[h+11],14,643717713),f=v(f,i,a,c,n[h],20,-373897302),c=v(c,f,i,a,n[h+5],5,-701558691),a=v(a,c,f,i,n[h+10],9,38016083),i=v(i,a,c,f,n[h+15],14,-660478335),f=v(f,i,a,c,n[h+4],20,-405537848),c=v(c,f,i,a,n[h+9],5,568446438),a=v(a,c,f,i,n[h+14],9,-1019803690),i=v(i,a,c,f,n[h+3],14,-187363961),f=v(f,i,a,c,n[h+8],20,1163531501),c=v(c,f,i,a,n[h+13],5,-1444681467),a=v(a,c,f,i,n[h+2],9,-51403784),i=v(i,a,c,f,n[h+7],14,1735328473),c=g(c,f=v(f,i,a,c,n[h+12],20,-1926607734),i,a,n[h+5],4,-378558),a=g(a,c,f,i,n[h+8],11,-2022574463),i=g(i,a,c,f,n[h+11],16,1839030562),f=g(f,i,a,c,n[h+14],23,-35309556),c=g(c,f,i,a,n[h+1],4,-1530992060),a=g(a,c,f,i,n[h+4],11,1272893353),i=g(i,a,c,f,n[h+7],16,-155497632),f=g(f,i,a,c,n[h+10],23,-1094730640),c=g(c,f,i,a,n[h+13],4,681279174),a=g(a,c,f,i,n[h],11,-358537222),i=g(i,a,c,f,n[h+3],16,-722521979),f=g(f,i,a,c,n[h+6],23,76029189),c=g(c,f,i,a,n[h+9],4,-640364487),a=g(a,c,f,i,n[h+12],11,-421815835),i=g(i,a,c,f,n[h+15],16,530742520),c=m(c,f=g(f,i,a,c,n[h+2],23,-995338651),i,a,n[h],6,-198630844),a=m(a,c,f,i,n[h+7],10,1126891415),i=m(i,a,c,f,n[h+14],15,-1416354905),f=m(f,i,a,c,n[h+5],21,-57434055),c=m(c,f,i,a,n[h+12],6,1700485571),a=m(a,c,f,i,n[h+3],10,-1894986606),i=m(i,a,c,f,n[h+10],15,-1051523),f=m(f,i,a,c,n[h+1],21,-2054922799),c=m(c,f,i,a,n[h+8],6,1873313359),a=m(a,c,f,i,n[h+15],10,-30611744),i=m(i,a,c,f,n[h+6],15,-1560198380),f=m(f,i,a,c,n[h+13],21,1309151649),c=m(c,f,i,a,n[h+4],6,-145523070),a=m(a,c,f,i,n[h+11],10,-1120210379),i=m(i,a,c,f,n[h+2],15,718787259),f=m(f,i,a,c,n[h+9],21,-343485551),c=d(c,r),f=d(f,e),i=d(i,o),a=d(a,u);return[c,f,i,a]}function a(n){for(var t="",r=32*n.length,e=0;e<r;e+=8)t+=String.fromCharCode(n[e>>5]>>>e%32&255);return t}function h(n){var t=[];for(t[(n.length>>2)-1]=void 0,e=0;e<t.length;e+=1)t[e]=0;for(var r=8*n.length,e=0;e<r;e+=8)t[e>>5]|=(255&n.charCodeAt(e/8))<<e%32;return t}function e(n){for(var t,r="0123456789abcdef",e="",o=0;o<n.length;o+=1)t=n.charCodeAt(o),e+=r.charAt(t>>>4&15)+r.charAt(15&t);return e}function r(n){return unescape(encodeURIComponent(n))}function o(n){return a(i(h(t=r(n)),8*t.length));var t}function u(n,t){return function(n,t){var r,e,o=h(n),u=[],c=[];for(u[15]=c[15]=void 0,16<o.length&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(h(t)),512+8*t.length),a(i(c.concat(e),640))}(r(n),r(t))}function t(n,t,r){return t?r?u(t,n):e(u(t,n)):r?o(n):e(o(n))}"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:n.md5=t}(this);
|
||||
//# sourceMappingURL=md5.min.js.map
|
Loading…
x
Reference in New Issue
Block a user