Merge branch 'master' into Bulbasaur

master
pikachu1995@126.com 2023-03-08 18:42:17 +08:00
commit 72fb11d3d3
29 changed files with 1264 additions and 656 deletions

View File

@ -0,0 +1,44 @@
<template>
<div></div>
</template>
<script>
import { getIMDetail } from "@/api/common";
import Storage from "@/plugins/storage";
import { getMemberMsg } from "@/api/login";
export default {
data() {
return {
Storage,
IMLink: "",
};
},
methods: {
// im
async IMService(id) {
// 访Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
const userInfo = await getMemberMsg();
if (userInfo.success) {
window.open(
this.IMLink + "?token=" + accessToken + "&id=" + id || this.storeMsg.storeId
);
} else {
this.$Message.error("请登录后再联系客服");
return;
}
},
// im
async getIMDetailMethods() {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
},
};
</script>
<style lang="scss" scoped></style>

View File

@ -22,7 +22,7 @@
<Icon type="ios-heart" :color="storeCollected ? '#ed3f14' : '#666'" /> <Icon type="ios-heart" :color="storeCollected ? '#ed3f14' : '#666'" />
{{ storeCollected? "已收藏店铺": "收藏店铺" }} {{ storeCollected? "已收藏店铺": "收藏店铺" }}
</span> </span>
<span class="ml_10" @click="IMService()"></span> <span class="ml_10" @click="IMService(goodsMsg.data.storeId)"></span>
</div> </div>
</div> </div>
</div> </div>
@ -50,8 +50,7 @@ import {
getGoodsDistribution, getGoodsDistribution,
} from "@/api/member"; } from "@/api/member";
import { getDetailById } from "@/api/shopentry"; import { getDetailById } from "@/api/shopentry";
import { getIMDetail } from "@/api/common"; import imTalk from '@/components/mixes/talkIm'
import Storage from "../plugins/storage";
export default { export default {
name: "GoodsDetail", name: "GoodsDetail",
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
@ -61,6 +60,7 @@ export default {
created () { created () {
this.getGoodsDetail(); this.getGoodsDetail();
}, },
mixins: [imTalk],
data () { data () {
return { return {
goodsMsg: {}, // goodsMsg: {}, //
@ -68,49 +68,11 @@ export default {
categoryBar: [], // categoryBar: [], //
storeCollected: false, // storeCollected: false, //
storeMsg: {}, // storeMsg: {}, //
IMLink: "",
}; };
}, },
methods: { methods: {
// im
async IMService () {
// 访Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
if (!accessToken) {
this.$Message.error("请登录后再联系客服");
return;
}
window.open(
this.IMLink +
"?token=" +
accessToken +
"&id=" +
this.goodsMsg.data.storeId +
"&goodsId=" +
this.goodsMsg.data.goodsId +
"&skuId=" +
this.goodsMsg.data.id
);
// window.open(
// 'http://192.168.0.139:8000/' +
// "?token=" +
// accessToken +
// "&id=" +
// this.goodsMsg.data.storeId +
// "&goodsId=" +
// this.goodsMsg.data.goodsId +
// "&skuId=" +
// this.goodsMsg.data.id
// );
},
// im
async getIMDetailMethods () {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
// //
targetClickSku (val) { targetClickSku (val) {
this.getGoodsDetail(val); this.getGoodsDetail(val);
@ -165,11 +127,13 @@ export default {
} }
}); });
} }
if (!this.storeMsg) { if (!this.storeMsg) {
// //
getDetailById(this.goodsMsg.data.storeId).then((res) => { getDetailById(this.goodsMsg.data.storeId).then((res) => {
if (res.success) { if (res.success) {
this.storeMsg = res.result; this.storeMsg = res.result;
} }
}); });
} }

View File

@ -14,7 +14,7 @@
:color="storeCollected ? '#ed3f14' : '#fff'"/>{{ :color="storeCollected ? '#ed3f14' : '#fff'"/>{{
storeCollected ? '已收藏店铺' : '收藏店铺' storeCollected ? '已收藏店铺' : '收藏店铺'
}}</span> }}</span>
<span style="width:80px" class="hover-pointer ml_10" @click="IMService()"><Icon <span style="width:80px" class="hover-pointer ml_10" @click="IMService(storeMsg.storeId)"><Icon
custom="icomoon icon-customer-service"/>联系客服</span> custom="icomoon icon-customer-service"/>联系客服</span>
</div> </div>
</div> </div>
@ -106,8 +106,7 @@
</template> </template>
<script> <script>
import {getIMDetail} from "@/api/common";
import Storage from "../plugins/storage";
import {getDetailById, getCateById} from "@/api/shopentry"; import {getDetailById, getCateById} from "@/api/shopentry";
import {cancelCollect, collectGoods, isCollection} from "@/api/member"; import {cancelCollect, collectGoods, isCollection} from "@/api/member";
import {goodsList} from "@/api/goods"; import {goodsList} from "@/api/goods";
@ -117,6 +116,7 @@ import HoverSearch from "@/components/header/hoverSearch";
import storage from "@/plugins/storage"; import storage from "@/plugins/storage";
import {getFloorStoreData} from "@/api/index.js"; import {getFloorStoreData} from "@/api/index.js";
import {seckillByDay} from "@/api/promotion"; import {seckillByDay} from "@/api/promotion";
import imTalk from '@/components/mixes/talkIm'
export default { export default {
name: "Merchant", name: "Merchant",
@ -125,6 +125,7 @@ export default {
ModelForm, ModelForm,
HoverSearch, HoverSearch,
}, },
mixins: [imTalk],
data() { data() {
return { return {
// //
@ -140,7 +141,6 @@ export default {
cateList: [], // cateList: [], //
goodsList: [], // goodsList: [], //
total: 0, // total: 0, //
IMLink: "",
params: { params: {
// //
pageNumber: 1, pageNumber: 1,
@ -187,30 +187,8 @@ export default {
} }
); );
}, },
// im
async IMService() {
// 访Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
if (!accessToken) {
this.$Message.error("请登录后再联系客服");
return;
}
window.open(
this.IMLink +
"?token=" +
accessToken +
"&id=" +
this.storeMsg.storeId
);
},
// im
async getIMDetailMethods() {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
// getStoreMsg () { // // getStoreMsg () { //
// getDetailById(this.$route.query.id).then(res => { // getDetailById(this.$route.query.id).then(res => {
// if (res.success) { // if (res.success) {
@ -242,6 +220,7 @@ export default {
if (res.success) { if (res.success) {
this.storeMsg = res.result; this.storeMsg = res.result;
console.log(this.storeMsg)
// //
if (this.storeMsg.pageShow && this.storeMsg.pageShow === '1') { if (this.storeMsg.pageShow && this.storeMsg.pageShow === '1') {

View File

@ -527,7 +527,7 @@ export default {
top: -200px; top: -200px;
left: 200px; left: 200px;
} }
/depp/ .ivu-alert-message { /deep/ .ivu-alert-message {
p { p {
margin: 4px 0; margin: 4px 0;
} }

View File

@ -58,16 +58,21 @@
{{ item.float == "right" ? name : toUser.name }} | {{ item.float == "right" ? name : toUser.name }} |
{{ unixToDate(item.createTime, "MM月dd日 hh:mm") }} {{ unixToDate(item.createTime, "MM月dd日 hh:mm") }}
</span> </span>
<!-- 文本消息 --> <div class="flex flex-a-c">
<div v-if="item.messageType == 'MESSAGE'" style="background-color: #d0e9ff;color: black;" <i @click="againSendMessage(item)" v-if="item.webSocketStatus" class="el-icon-refresh-left again main-color"></i>
class="text-message" :class="{ <!-- 文本消息 -->
left: item.float == 'left', <div v-if="item.messageType == 'MESSAGE'" style="background-color: #d0e9ff;color: black;"
right: item.float == 'right', class="text-message" :class="{
}"> left: item.float == 'left',
<div class="arrow"></div> right: item.float == 'right',
<pre v-if="!emojistwo.includes(item.text)" v-html="item.text" /> }">
<pre v-if="emojistwo.includes(item.text)" v-html="textReplaceEmoji(item.text)" /> <div class="arrow"></div>
<pre v-if="!emojistwo.includes(item.text)" v-html="item.text" />
<pre v-if="emojistwo.includes(item.text)" v-html="textReplaceEmoji(item.text)" />
</div>
</div> </div>
<div v-if="item.webSocketStatus" class="tips"></div>
<div v-if="item.messageType == 'GOODS' && item.text != null" class="goodsStyle " :class="{ <div v-if="item.messageType == 'GOODS' && item.text != null" class="goodsStyle " :class="{
left: item.float == 'left', left: item.float == 'left',
@ -93,17 +98,24 @@
left: item.float == 'left', left: item.float == 'left',
right: item.float == 'right', right: item.float == 'right',
}" @click="linkToOrders(item.text.sn)"> }" @click="linkToOrders(item.text.sn)">
<div class="oedersn"> <div class="oedersn">
<el-tooltip class="item" effect="dark" :content="item.text.sn" placement="top-start"> <el-tooltip class="item" effect="dark" :content="item.text.sn" placement="top-start">
<a> 订单号:{{ item.text.sn }} </a> <a> 订单号:{{ item.text.sn }} </a>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="goods-shared-box"> <div class="goods-shared-box">
<div>
<img :src="item.text.groupImages" style="height: 100px;width: 100px;" /> <div class="goods-item" v-for="(order,orderIndex) in item.text.orderItems" :key="orderIndex">
<img :src="order.image" style="height: 100px;width: 100px;" />
<div>
<span class="orderGoodsName">{{ order.name }}</span>
<div class="goods-item-price">
<span>{{ order.goodsPrice | unitPrice('¥') }}</span>
</div>
</div>
</div> </div>
<div class="shared-goods"> <div class="shared-goods">
<span class="orderGoodsName">{{ item.text.groupName }}</span>
<div class="orderGoodsTime">{{ item.text.paymentTime }}</div> <div class="orderGoodsTime">{{ item.text.paymentTime }}</div>
<span class="orderFlowPrice"> <span class="orderFlowPrice">
订单金额<span>{{ item.text.flowPrice | unitPrice('¥') }}</span> 订单金额<span>{{ item.text.flowPrice | unitPrice('¥') }}</span>
@ -395,6 +407,12 @@ export default {
}, },
// # // #
//
againSendMessage(val){
this.submitSendMessage(val.text)
},
// //
submitSendMessage (content) { submitSendMessage (content) {
const record = { const record = {
@ -848,7 +866,21 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.flex-a-c{
align-items: center;
>div{
margin-left: 10px;
}
}
.tips{
margin-top:10px;
color: #999;
font-size: 12px;
}
.again{
margin-top: 5px;
cursor: pointer;
}
.oderStyle { .oderStyle {
border: 1px solid #f2f2f2; border: 1px solid #f2f2f2;
@ -926,13 +958,18 @@ export default {
.orderFlowPrice { .orderFlowPrice {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
>span{ >span{
color: red; color: red;
font-size: 18px; font-size: 18px;
} }
} }
.goods-item-price{
margin-top: 10px;
font-size: 13px;
color: red;
}
.main-box { .main-box {
position: relative; position: relative;
@ -1247,7 +1284,14 @@ export default {
} }
} }
.goods-shared-box{ .goods-shared-box{
display: flex; cursor: pointer;
>.goods-item{
margin: 10px 0;
display: flex;
border-bottom: 1px solid #ededed;
align-items: center;
}
>.shared-goods{ >.shared-goods{
padding-left: 10px; padding-left: 10px;
display: flex; display: flex;

View File

@ -3,7 +3,7 @@
<div class="tab"> <div class="tab">
<el-tabs v-model="activeName" @tab-click="handleClick" :stretch=true> <el-tabs v-model="activeName" @tab-click="handleClick" :stretch=true>
<el-tab-pane label="最近浏览" name="goods"> <el-tab-pane label="最近浏览" name="goods">
<dl> <dl v-if='list.length' class='base-list'>
<dd :key="index" @click="linkToGoods(item.goodsId, item.id)" v-for="(item,index) in list" v-infinite-scroll="loadMore"> <dd :key="index" @click="linkToGoods(item.goodsId, item.id)" v-for="(item,index) in list" v-infinite-scroll="loadMore">
<div class="base"> <div class="base">
<div> <div>
@ -27,32 +27,38 @@
</dd> </dd>
</dl> </dl>
<div v-else class='no-more'>
{{noMoreList.goods.title}}
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="订单列表" name="orders"> <el-tab-pane label="订单列表" name="orders">
<dl> <dl class='base-order-list' v-if='orderList.length'>
<dd v-for="(item, index) in orderList" v-infinite-scroll="loadMore" :key="index"> <dd v-for="(item, index) in orderList" v-infinite-scroll="loadMore" :key="index">
<div class="order-list"> <div class="order-list">
<div class="order-top order-padding"> <div class="order-top order-padding">
<span class="order-sn" @click="linkToOrders(item.sn)">:{{ item.sn }}</span> <span class="order-sn" @click="linkToOrders(item.sn)">:{{ item.sn }}</span>
</div> </div>
<div class="order-section order-padding"> <div class="order-section order-padding">
<img :src="item.groupImages" alt=""> <div class="order-items" v-for="(order,orderIndex) in item.orderItems" :key="orderIndex">
<span class="order-goods-name" @click="linkToOrders(item.sn)"> {{ item.groupName }}</span> <img :src="order.image" alt="">
<span class="order-goods-name" @click="linkToOrders(item.sn)"> {{ order.name }}</span>
<span class="price">{{order.goodsPrice | unitPrice("¥")}}</span>
</div>
<!-- <img :src="item.groupImages" alt=""> -->
<div class="order-btn "> <div class="order-btn ">
<el-button class="store-button" v-if="item.btnHide == 1 && toUser.storeFlag" <el-button class="store-button" v-if="item.btnHide == 1 && toUser.storeFlag"
size="mini" @click="submitSendOrderMessage(item, index)" plain>发送</el-button> size="mini" @click="submitSendOrderMessage(item, index)" plain>发送</el-button>
</div> </div>
</div> </div>
<div class="order-footer order-padding"> <div class="order-footer order-padding">
<span> 订单金额 <span style="color: red;">{{ <span></span>
item.orderItems[0].goodsPrice | unitPrice("¥")
}}</span></span>
<el-tag size='mini' :type="col[item.orderStatus]">{{ <el-tag size='mini' :type="col[item.orderStatus]">{{
item.orderStatus == 'STAY_PICKED_UP' ? '待自提' item.orderStatus == 'STAY_PICKED_UP' ? '待自提'
: item.orderStatus == 'CANCELLED' ? '已取消' : item.orderStatus == 'UNPAID' ? '未付款' : item.orderStatus : item.orderStatus == 'CANCELLED' ? '已取消' : item.orderStatus == 'UNPAID' ? '未付款' : item.orderStatus
== ==
'PAID' ? '已付款' : item.orderStatus == 'UNDELIVERED' ? '待发货' : item.orderStatus == 'DELIVERED' 'PAID' ? '已付款' : item.orderStatus == 'UNDELIVERED' ? '待发货' : item.orderStatus == 'DELIVERED'
? '已发货' : item.orderStatus == 'COMPLETED' ? '已完成' : item.orderStatus == 'TAKE' ? '待校验' : ? '已发货' : item.orderStatus == 'COMPLETED' ? '已完成' : item.orderStatus == 'TAKE' ? '待核销' :
'' ''
}}</el-tag> }}</el-tag>
</div> </div>
@ -61,6 +67,9 @@
</dd> </dd>
</dl> </dl>
<div v-else class='no-more'>
{{noMoreList.orders.title}}
</div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@ -78,12 +87,16 @@ export default {
}, },
data () { data () {
return { return {
noMoreList:{
'goods':{title:'暂无最近浏览',value:false},
'orders':{title:'暂无订单信息',value:false},
},
activeName: 'goods', activeName: 'goods',
btnHide: undefined, btnHide: undefined,
hide: true, hide: true,
col: { col: {
CANCELLED: 'error', CANCELLED: 'danger',
PAID: 'error', PAID: 'danger',
TAKE: '', TAKE: '',
COMPLETED: 'success', COMPLETED: 'success',
DELIVERED: 'danger', DELIVERED: 'danger',
@ -142,12 +155,14 @@ export default {
// //
submitSendOrderMessage (item, index) { submitSendOrderMessage (item, index) {
console.log(item, 'item'); console.log(item, 'item');
const context = { const context = {
sn: item.sn, sn: item.sn,
groupImages: item.groupImages, groupImages: item.groupImages,
paymentTime: item.paymentTime, paymentTime: item.paymentTime,
groupName: item.groupName, groupName: item.groupName,
flowPrice: item.flowPrice, flowPrice: item.flowPrice,
orderItems:item.orderItems,
orderStatus: item.orderStatus orderStatus: item.orderStatus
} }
const record = { const record = {
@ -163,7 +178,7 @@ export default {
item.btnHide = 0 item.btnHide = 0
}, },
handleClick (tab, event) { handleClick (tab, event) {
console.log(tab, event);
} }
}, },
props: { props: {
@ -178,7 +193,7 @@ export default {
}, },
mounted () { mounted () {
// state.user.toUser // state.user.toUser
console.log(this.orderList, ' this.$store.state.user.toUser this.$store.state.user.toUser this.$store.state.user.toUser'); // console.log(this.orderList, ' this.$store.state.user.toUser this.$store.state.user.toUser this.$store.state.user.toUser');
this.btnHide = localStorage.getItem('btnHide') this.btnHide = localStorage.getItem('btnHide')
} }
} }
@ -193,7 +208,12 @@ export default {
white-space: nowrap; white-space: nowrap;
width: 200px; width: 200px;
} }
.no-more{
font-size: 12px;
color: #999;
text-align: center;
margin-top: 20px;
}
.box { .box {
max-width: 362px; max-width: 362px;
@ -374,4 +394,18 @@ export default {
// height: calc(100vh - 110px); // height: calc(100vh - 110px);
// overflow-y: auto; // overflow-y: auto;
// } // }
.base-list{
padding-bottom: 120px;
}
.base-order-list{
padding-bottom: 100px;
}
.price{
color: red;
margin-left: 10px;
margin-bottom: 10px;
}
.order-items{
margin-bottom: 10px;
}
</style> </style>

View File

@ -173,7 +173,6 @@ export default {
methods: { methods: {
// 稿 // 稿
getDraftText (index_name) { getDraftText (index_name) {
console.log("findTalk(index_name)", findTalk(index_name));
return findTalk(index_name)?.draft_text || ""; return findTalk(index_name)?.draft_text || "";
}, },

View File

@ -1,5 +1,5 @@
<template> <template>
<img :src="text" alt=""/> <img :src="text || 'https://avatars.dicebear.com/api/initials/'+name+'.svg?fontSize=38'" alt=""/>
</template> </template>
<script> <script>
@ -8,7 +8,11 @@
text:{ text:{
type:null, type:null,
default:'' default:''
} },
name:{
type:null,
default:''
},
} }
} }
</script> </script>

View File

@ -85,5 +85,4 @@ Vue.prototype.$alert = MessageBox.alert
import Contextmenu from 'vue-contextmenujs' import Contextmenu from 'vue-contextmenujs'
Vue.use(Contextmenu) Vue.use(Contextmenu)
process.env.NODE_ENV !== 'production' &&
console.warn('[Lumen-IM] NOTICE: element-ui use lazy-load.')

View File

@ -1,3 +1,6 @@
import { Notification, MessageBox } from "element-ui";
let wsSignIn; // ws 是否是掉线状态
import store from "@/store";
class WsSocket { class WsSocket {
/** /**
* Websocket 连接 * Websocket 连接
@ -25,7 +28,7 @@ class WsSocket {
reconnect: { reconnect: {
lockReconnect: false, lockReconnect: false,
setTimeout: null, // 计时器对象 setTimeout: null, // 计时器对象
time: 5000, // 重连间隔时间 time: 1000, // 重连间隔时间
number: 1000, // 重连次数 number: 1000, // 重连次数
}, },
}; };
@ -49,9 +52,9 @@ class WsSocket {
// 定义 WebSocket 原生方法 // 定义 WebSocket 原生方法
this.events = Object.assign( this.events = Object.assign(
{ {
onError: (evt) => { }, onError: (evt) => {},
onOpen: (evt) => { }, onOpen: (evt) => {},
onClose: (evt) => { }, onClose: (evt) => {},
}, },
events events
); );
@ -63,7 +66,7 @@ class WsSocket {
* @param {String} event 事件名 * @param {String} event 事件名
* @param {Function} callBack 回调方法 * @param {Function} callBack 回调方法
*/ */
on (event, callBack) { on(event, callBack) {
// 对应 socket-instance.js // 对应 socket-instance.js
this.onCallBacks[event] = callBack; this.onCallBacks[event] = callBack;
return this; return this;
@ -72,7 +75,23 @@ class WsSocket {
/** /**
* 加载 WebSocket * 加载 WebSocket
*/ */
loadSocket () { loadSocket() {
/**
* 判断当前如果是掉线提示
* 重连成功后关闭掉线提示新增重连提示
*/
if (wsSignIn) {
store.commit('SET_WS_STATUS',true);
wsSignIn.close();
Notification({
title: "成功",
message: "重连成功",
type: "success",
position: "top-right",
duration: 1000,
});
}
// 判断当前是否已经连接 // 判断当前是否已经连接
if (this.connect != null) { if (this.connect != null) {
this.connect.close(); this.connect.close();
@ -85,41 +104,74 @@ class WsSocket {
connect.onopen = this.onOpen.bind(this); connect.onopen = this.onOpen.bind(this);
connect.onmessage = this.onMessage.bind(this); connect.onmessage = this.onMessage.bind(this);
connect.onclose = this.onClose.bind(this); connect.onclose = this.onClose.bind(this);
this.connect = connect; this.connect = connect;
store.commit('SET_WS_STATUS',false);
} }
/** /**
* 连接 Websocket * 连接 Websocket
*/ */
connection () { connection() {
this.loadSocket(); this.loadSocket();
} }
/** /**
* 掉线重连 Websocket * 掉线重连 Websocket
*/ */
reconnect () { reconnect() {
console.log("掉线重连接");
/**
* 长时间挂载页面中并且重连次数为空的时候进行提示
*/
if (this.config.reconnect.number == 0) {
MessageBox("当前对话链接已失效,请从关闭重新进入。", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnPressEscape: false,
closeOnClickModal: false,
type: "warning",
})
.then(() => {
window.close();
Notification({
title: "对话链接已失效提示",
message: "请手动关闭当前页面",
type: "error",
position: "top-right",
});
})
.catch(() => {
Notification({
title: "对话链接已失效提示",
message: "请手动关闭当前页面",
type: "error",
position: "top-right",
});
});
return false;
}
// 掉线重连提示
wsSignIn = Notification({
title: "掉线重连接提示",
message: `网络连接已断开,正在尝试重新连接......`,
type: "error",
position: "top-right",
duration: 0,
});
// 掉线更改消息状态
store.commit('SET_WS_STATUS',true);
let reconnect = this.config.reconnect; let reconnect = this.config.reconnect;
if (reconnect.lockReconnect || reconnect.number == 0) { if (reconnect.lockReconnect || reconnect.number == 0) {
return; return;
} }
this.config.reconnect.lockReconnect = true; this.config.reconnect.lockReconnect = true;
// 没连接上会一直重连,设置延迟避免请求过多 // 没连接上会一直重连,设置延迟避免请求过多
reconnect.setTimeout && clearTimeout(reconnect.setTimeout); reconnect.setTimeout && clearTimeout(reconnect.setTimeout);
this.config.reconnect.setTimeout = setTimeout(() => { this.config.reconnect.setTimeout = setTimeout(() => {
this.connection(); this.connection();
this.config.reconnect.lockReconnect = false; this.config.reconnect.lockReconnect = false;
this.config.reconnect.number--; this.config.reconnect.number--;
console.log(
`网络连接已断开,正在尝试重新连接(${this.config.reconnect.number})...`
);
}, reconnect.time); }, reconnect.time);
} }
@ -128,8 +180,7 @@ class WsSocket {
* *
* @param {Object} evt Websocket 消息 * @param {Object} evt Websocket 消息
*/ */
onParse (evt) { onParse(evt) {
const res = JSON.parse(evt.data).result; const res = JSON.parse(evt.data).result;
//如果创建时间是时间戳类型则转换为 日期类型,否则新压入栈的消息的创建时间和从数据库读取出来的创建时间格式对不上,处理的时候会出异常。 //如果创建时间是时间戳类型则转换为 日期类型,否则新压入栈的消息的创建时间和从数据库读取出来的创建时间格式对不上,处理的时候会出异常。
@ -145,7 +196,7 @@ class WsSocket {
* @param format 转换格式 * @param format 转换格式
* @returns {*|string} * @returns {*|string}
*/ */
unixToDate (unix, format) { unixToDate(unix, format) {
if (!unix) return unix; if (!unix) return unix;
let _format = format || "yyyy-MM-dd hh:mm:ss"; let _format = format || "yyyy-MM-dd hh:mm:ss";
const d = new Date(unix); const d = new Date(unix);
@ -179,7 +230,7 @@ class WsSocket {
* *
* @param {Object} evt Websocket 消息 * @param {Object} evt Websocket 消息
*/ */
onOpen (evt) { onOpen(evt) {
this.events.onOpen(evt); this.events.onOpen(evt);
if (this.config.heartbeat.enabled) { if (this.config.heartbeat.enabled) {
@ -192,7 +243,7 @@ class WsSocket {
* *
* @param {Object} evt Websocket 消息 * @param {Object} evt Websocket 消息
*/ */
onClose (evt) { onClose(evt) {
console.log("关闭连接", evt); console.log("关闭连接", evt);
if (this.config.heartbeat.enabled) { if (this.config.heartbeat.enabled) {
clearInterval(this.config.heartbeat.setInterval); clearInterval(this.config.heartbeat.setInterval);
@ -211,7 +262,7 @@ class WsSocket {
* *
* @param {Object} evt Websocket 消息 * @param {Object} evt Websocket 消息
*/ */
onError (evt) { onError(evt) {
this.events.onError(evt); this.events.onError(evt);
} }
@ -220,28 +271,30 @@ class WsSocket {
* *
* @param {Object} evt Websocket 消息 * @param {Object} evt Websocket 消息
*/ */
onMessage (evt) { onMessage(evt) {
let result = this.onParse(evt); let result = this.onParse(evt);
if (this.onParse(evt).text.includes('goodsName') || this.onParse(evt).text.includes('groupName')) { if (
this.onParse(evt).text.includes("goodsName") ||
this.onParse(evt).text.includes("groupName")
) {
let params = { let params = {
...this.onParse(evt), ...this.onParse(evt),
text: JSON.parse(this.onParse(evt).text) text: JSON.parse(this.onParse(evt).text),
} };
this.onCallBacks["event_talk"](params); this.onCallBacks["event_talk"](params);
} else { } else {
let params = { let params = {
...this.onParse(evt), ...this.onParse(evt),
text: this.onParse(evt).text text: this.onParse(evt).text,
} };
this.onCallBacks["event_talk"](params); this.onCallBacks["event_talk"](params);
} }
// 指定推送消息 // 指定推送消息
} }
/** /**
* WebSocket心跳检测 * WebSocket心跳检测
*/ */
heartbeat () { heartbeat() {
console.log("WebSocket心跳检测"); console.log("WebSocket心跳检测");
this.config.heartbeat.setInterval = setInterval(() => { this.config.heartbeat.setInterval = setInterval(() => {
this.connect.send("PING"); this.connect.send("PING");
@ -253,14 +306,14 @@ class WsSocket {
* *
* @param {Object} message * @param {Object} message
*/ */
send (message) { send(message) {
this.connect.send(JSON.stringify(message)); this.connect.send(JSON.stringify(message));
} }
/** /**
* 关闭连接 * 关闭连接
*/ */
close () { close() {
this.connect.close(); this.connect.close();
} }
@ -270,7 +323,7 @@ class WsSocket {
* @param {String} event 事件名 * @param {String} event 事件名
* @param {Object} data 数据 * @param {Object} data 数据
*/ */
emit (event, data) { emit(event, data) {
if (this.connect && this.connect.readyState === 1) { if (this.connect && this.connect.readyState === 1) {
this.connect.send(JSON.stringify(data)); this.connect.send(JSON.stringify(data));
} else { } else {

View File

@ -21,11 +21,15 @@ export default {
float: "", float: "",
}, },
], ],
webSocketWithOut:false, // ws 是否是掉线 无输出状态
// 对话索引(聊天对话的唯一索引) // 对话索引(聊天对话的唯一索引)
index_name: null, index_name: null,
}, },
mutations: { mutations: {
// 设置ws状态
SET_WS_STATUS: (state,resource) =>{
state.webSocketWithOut = resource
},
// 更新对话 // 更新对话
UPDATE_DIALOGUE_MESSAGE (state, resource) { UPDATE_DIALOGUE_MESSAGE (state, resource) {
state.records = []; state.records = [];
@ -56,6 +60,8 @@ export default {
// 推送对话记录 // 推送对话记录
PUSH_DIALOGUE (state, record) { PUSH_DIALOGUE (state, record) {
record = {...record,webSocketStatus:state.webSocketWithOut}
console.log("推送对话",)
state.records.push(record); state.records.push(record);
}, },

View File

@ -37,6 +37,7 @@ const Talk = {
talkNum: (state) => state.items.length, talkNum: (state) => state.items.length,
}, },
mutations: { mutations: {
// 设置对话列表 // 设置对话列表
SET_TALK_ITEMS (state, resource) { SET_TALK_ITEMS (state, resource) {
Vue.set(state, 'items', resource.items) Vue.set(state, 'items', resource.items)

View File

@ -19,7 +19,6 @@ let state = {
// 判断用户是否登录 // 判断用户是否登录
if (getToken()) { if (getToken()) {
let userInfo = getUserInfo(); let userInfo = getUserInfo();
console.error(userInfo)
state.name = userInfo.name; state.name = userInfo.name;
state.id = userInfo.id; state.id = userInfo.id;
state.face = userInfo.face ? userInfo.face : state.avatar; state.face = userInfo.face ? userInfo.face : state.avatar;

View File

@ -4,8 +4,6 @@ const defaultAvatar = require('@/assets/image/detault-avatar.jpg')
const state = { const state = {
socketStatus: false, socketStatus: false,
website_name: process.env.VUE_APP_WEBSITE_NAME, website_name: process.env.VUE_APP_WEBSITE_NAME,
copyright: `©2020 - 2021 ${process.env.VUE_APP_WEBSITE_NAME} 在线聊天 <a href="https://github.com/gzydong/LumenIM" style="color: #777272;font-weight: 400;" target="_blank">Github源码</a>`,
// 头像加载失败后的默认头像 // 头像加载失败后的默认头像
defaultAvatar: "this.src='" + defaultAvatar + "'", defaultAvatar: "this.src='" + defaultAvatar + "'",
} }

View File

@ -14,6 +14,7 @@ const request = axios.create({
timeout: 20000, timeout: 20000,
}); });
let isRefreshing = false
/** /**
* 异常拦截处理器 * 异常拦截处理器
* *
@ -27,10 +28,12 @@ const errorHandler = (error) => {
removeAll(); removeAll();
location.reload(); location.reload();
} else if (error.response.status == 403) { } else if (error.response.status == 403) {
if(!isRefreshing){
/** /**
* 403提示将重新从商家移动端进入当前页面 * 403提示将重新从商家移动端进入当前页面
*/ */
MessageBox("当前登录已失效,请从商家管理后台重新登录。", "提示", { MessageBox("当前登录已失效,请从关闭重新进入。", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
closeOnPressEscape: false, closeOnPressEscape: false,
@ -38,6 +41,7 @@ const errorHandler = (error) => {
type: "warning", type: "warning",
}) })
.then(() => { .then(() => {
isRefreshing = true
window.close(); window.close();
Notification({ Notification({
title:"登录失效提示", title:"登录失效提示",
@ -45,9 +49,10 @@ const errorHandler = (error) => {
type:"error", type:"error",
position: "top-right", position: "top-right",
}); });
}) })
.catch(() => { .catch(() => {
isRefreshing = true
Notification({ Notification({
title:"登录失效提示", title:"登录失效提示",
message: "请手动关闭当前页面", message: "请手动关闭当前页面",
@ -55,6 +60,8 @@ const errorHandler = (error) => {
position: "top-right", position: "top-right",
}); });
}); });
isRefreshing = false
}
} else if(error.response.status == 400){ } else if(error.response.status == 400){
Notification({ Notification({
message: error.response.data.message, message: error.response.data.message,

View File

@ -9,7 +9,7 @@
<el-header height="60px" class="header"> <el-header height="60px" class="header">
<div class="user-login" v-popover:usercard> <div class="user-login" v-popover:usercard>
<div class="user-box"> <div class="user-box">
<face :text="face" class="user-face"></face> <face :text="face" :name="name" class="user-face"></face>
</div> </div>
</div> </div>
<p class="user-status"> <p class="user-status">
@ -263,7 +263,7 @@ export default {
}, },
unreadNum (value) { unreadNum (value) {
clearInterval(this.interval); clearInterval(this.interval);
console.log("%c 更新未读消息", "color:#32ccbc"); // console.log("%c ", "color:#32ccbc");
this.$store.commit("SET_UNREAD_NUM", value); this.$store.commit("SET_UNREAD_NUM", value);
if (value > 0) { if (value > 0) {

View File

@ -5,21 +5,40 @@
<RadioGroup v-model="formValidate.type" type="button"> <RadioGroup v-model="formValidate.type" type="button">
<Radio label="KDNIAO">快递鸟</Radio> <Radio label="KDNIAO">快递鸟</Radio>
<Radio label="KUAIDI100">快递100</Radio> <Radio label="KUAIDI100">快递100</Radio>
<Radio label="SHUNFENG">顺丰</Radio>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem v-if="formValidate.type==='KDNIAO'" label="快递鸟 商户ID" prop="kdniaoEbusinessID"> <FormItem v-if="formValidate.type === 'KDNIAO'" label="快递鸟 商户ID" prop="kdniaoEbusinessID">
<Input v-model="formValidate.kdniaoEbusinessID" /> <Input v-model="formValidate.kdniaoEbusinessID" />
</FormItem> </FormItem>
<FormItem v-if="formValidate.type==='KDNIAO'" label="快递鸟 AppKey" prop="kdniaoAppKey"> <FormItem v-if="formValidate.type === 'KDNIAO'" label="快递鸟 AppKey" prop="kdniaoAppKey">
<Input class="label-appkey" v-model="formValidate.kdniaoAppKey" /> <Input class="label-appkey" v-model="formValidate.kdniaoAppKey" />
</FormItem> </FormItem>
<FormItem v-if="formValidate.type==='KUAIDI100'" label="快递100 授权码" prop="kuaidi100Customer"> <FormItem v-if="formValidate.type === 'KUAIDI100'" label="快递100 授权码" prop="kuaidi100Customer">
<Input class="label-appkey" v-model="formValidate.kuaidi100Customer" /> <Input class="label-appkey" v-model="formValidate.kuaidi100Customer" />
</FormItem> </FormItem>
<FormItem v-if="formValidate.type==='KUAIDI100'" label="快递100 Key" prop="kuaidi100Key"> <FormItem v-if="formValidate.type === 'KUAIDI100'" label="快递100 Key" prop="kuaidi100Key">
<Input class="label-appkey" v-model="formValidate.kuaidi100Key" /> <Input class="label-appkey" v-model="formValidate.kuaidi100Key" />
</FormItem> </FormItem>
<div v-if="formValidate.type === 'SHUNFENG'">
<FormItem label="顾客编码" prop="clientCode">
<Input v-model="formValidate.clientCode" />
</FormItem>
<FormItem label="校验码" prop="checkWord">
<Input v-model="formValidate.checkWord" />
</FormItem>
<FormItem label="请求地址" prop="callUrl">
<Input class="label-appkey" v-model="formValidate.callUrl" />
</FormItem>
<FormItem label="打印模板" prop="templateCode">
<Input class="label-appkey" v-model="formValidate.templateCode" />
</FormItem>
<FormItem label="月结号" prop="monthlyCardNo">
<Input class="label-appkey" v-model="formValidate.monthlyCardNo" />
</FormItem>
</div>
<div class="label-btns"> <div class="label-btns">
<Button type="primary" @click="submit('formValidate')"></Button> <Button type="primary" @click="submit('formValidate')"></Button>
</div> </div>
@ -36,12 +55,13 @@ export default {
formValidate: { // formValidate: { //
type: "", type: "",
kdniaoEbusinessID: "", kdniaoEbusinessID: "",
kdniaoAppKey: "" , kdniaoAppKey: "",
kuaidi100Customer: "" , kuaidi100Customer: "",
kuaidi100Key: "" ,}, kuaidi100Key: "",
},
}; };
}, },
props: ["res",'type'], props: ["res", 'type'],
created() { created() {
this.init(); this.init();
}, },
@ -49,7 +69,7 @@ export default {
// //
submit(name) { submit(name) {
let that = this; let that = this;
if( handleSubmit(that, name )){ if (handleSubmit(that, name)) {
this.setupSetting() this.setupSetting()
} }
}, },
@ -83,15 +103,17 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; @import "./style.scss";
.label-item { .label-item {
display: flex; display: flex;
} }
/deep/ .ivu-input { /deep/ .ivu-input {
width: 300px !important; width: 300px !important;
margin: 0 10px; margin: 0 10px;
} }
.ivu-input-wrapper { .ivu-input-wrapper {
width: 300px; width: 300px;
margin-right: 10px; margin-right: 10px;
} }</style>
</style>

View File

@ -1,4 +1,4 @@
import { commonUrl, getRequest, uploadFileRequest ,uploadFile} from "@/libs/axios"; import { commonUrl, getRequest, uploadFileRequest, uploadFile, request} from "@/libs/axios";
// 通过id获取子地区 // 通过id获取子地区
export const getChildRegion = (id) => { export const getChildRegion = (id) => {
@ -25,3 +25,10 @@ export const upLoadFileMethods = (bold) => {
console.log(bold) console.log(bold)
return uploadFileRequest(uploadFile, bold); return uploadFileRequest(uploadFile, bold);
}; };
/**
* 发送短信验证码
*/
export function sendSms (params) {
return getRequest(`${commonUrl}/common/common/sms/${params.verificationEnums}/${params.mobile}`,params);
}

View File

@ -37,6 +37,11 @@ export const login = params => {
return postRequestWithNoTokenData("/passport/login/userLogin", params); return postRequestWithNoTokenData("/passport/login/userLogin", params);
}; };
// 手机登陆
export const storeSmsLogin = params => {
return postRequestWithNoToken("/passport/login/smsLogin", params);
};
// 登出 // 登出
export const logout = () => { export const logout = () => {
return postRequest("/passport/login/logout"); return postRequest("/passport/login/logout");
@ -50,7 +55,10 @@ export const userInfo = params => {
export const userMsg = params => { export const userMsg = params => {
return getRequest('/settings/storeSettings', params) return getRequest('/settings/storeSettings', params)
} }
//验证短信验证码
export const validateCode = params => {
return postRequestWithNoToken("/passport/login/resetByMobile", params);
};
// 初始化验证码 // 初始化验证码
export const initCaptcha = params => { export const initCaptcha = params => {
return getRequestWithNoToken("/common/captcha/init", params); return getRequestWithNoToken("/common/captcha/init", params);
@ -107,6 +115,10 @@ export const sendCodeEmail = (email, params) => {
export const editEmail = params => { export const editEmail = params => {
return postRequest("/email/editEmail", params); return postRequest("/email/editEmail", params);
}; };
// 忘记密码并修改
export const forgetAndModify = params => {
return postRequest("/passport/login/resetPassword", params);
};
// 个人中心修改密码 // 个人中心修改密码
export const changePass = params => { export const changePass = params => {
return postRequest("/passport/login/modifyPass", params); return postRequest("/passport/login/modifyPass", params);

View File

@ -4,6 +4,7 @@ import {
postRequest, postRequest,
putRequest, putRequest,
deleteRequest, deleteRequest,
getRequestHasHeader,
importRequest, importRequest,
getRequestWithNoToken getRequestWithNoToken
} from "@/libs/axios"; } from "@/libs/axios";
@ -35,4 +36,13 @@ export const getCheckedOn = params =>{
return getRequest(`/other/logistics/getCheckedFaceSheet`,params); return getRequest(`/other/logistics/getCheckedFaceSheet`,params);
} }
//获取物流设置
export const getLogisticsSetting = () =>{
return getRequest(`/other/logistics/setting`);
}
export const getShunFengFaceSheet = (url,headers) =>{
return getRequestHasHeader(`${url}`,null,headers);
}

View File

@ -81,6 +81,11 @@ export const orderDelivery = (sn, params) => {
return postRequest(`/order/order/${sn}/delivery`, params); return postRequest(`/order/order/${sn}/delivery`, params);
}; };
// 订单发货
export const orderShunFengDelivery = (sn) => {
return postRequest(`/order/order/${sn}/shunfeng/delivery`);
};
// 获取商家选中的物流公司 // 获取商家选中的物流公司
export const getLogisticsChecked = () => { export const getLogisticsChecked = () => {
return getRequest(`/other/logistics/getChecked`); return getRequest(`/other/logistics/getChecked`);

View File

@ -188,6 +188,38 @@ export const getRequest = (url, params, resBlob) => {
return service(data); return service(data);
}; };
export const getRequestHasHeader = (url, params, headers) => {
let accessToken = getStore("accessToken");
let data = {
method: "get",
url: `${url}`,
params: params,
transformRequest: headers
? undefined
: [
function(data) {
let ret = "";
for (let it in data) {
ret +=
encodeURIComponent(it) +
"=" +
encodeURIComponent(data[it]) +
"&";
}
ret = ret.substring(0, ret.length - 1);
return ret;
}
],
headers: {
"Content-Type": "application/x-www-form-urlencoded",
accessToken: accessToken,
...headers
},
responseType: "blob"
};
return service(data);
};
export const postRequest = (url, params, headers) => { export const postRequest = (url, params, headers) => {
let accessToken = getStore("accessToken"); let accessToken = getStore("accessToken");
return service({ return service({

View File

@ -3,7 +3,7 @@ import ViewUI from 'view-design';
import Util from '../libs/util'; import Util from '../libs/util';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import {routers} from './router'; import { routers } from './router';
Vue.use(VueRouter); Vue.use(VueRouter);
@ -16,10 +16,10 @@ const RouterConfig = {
/** /**
* 解决重复点击菜单会控制台报错bug * 解决重复点击菜单会控制台报错bug
*/ */
const routerPush = VueRouter.prototype.push const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) { VueRouter.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error) return routerPush.call(this, location).catch(error => error)
} }
export const router = new VueRouter(RouterConfig); export const router = new VueRouter(RouterConfig);
@ -32,10 +32,15 @@ router.beforeEach((to, from, next) => {
const name = to.name; const name = to.name;
if (!Cookies.get('userInfoSeller') && name !== 'login') { if (!Cookies.get('userInfoSeller') && name !== 'login') {
// 判断是否已经登录且前往的页面不是登录页 if (name === 'forgetPassword') {
next({ console.log(name)
name: 'login' Util.toDefaultPage([...routers], name, router, next);
}); } else {
// 判断是否已经登录且前往的页面不是登录页
next({
name: 'login'
});
}
} else if (Cookies.get('userInfoSeller') && name === 'login') { } else if (Cookies.get('userInfoSeller') && name === 'login') {
// 判断是否已经登录且前往的是登录页 // 判断是否已经登录且前往的是登录页
Util.title(); Util.title();

View File

@ -10,6 +10,11 @@ export const loginRouter = {
}, },
component: () => import("@/views/login.vue") component: () => import("@/views/login.vue")
}; };
export const forgetPasswordRouter = {
path: "/forgetPassword",
name: "forgetPassword",
component: () => import("@/views/ForgetPassword.vue")
};
// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里 // 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = { export const otherRouter = {
@ -193,4 +198,4 @@ export const page500 = {
component: () => import("@/views/error-page/500.vue") component: () => import("@/views/error-page/500.vue")
}; };
// 所有上面定义的路由都要写在下面的routers里 // 所有上面定义的路由都要写在下面的routers里
export const routers = [loginRouter, otherRouter, page500, page403]; export const routers = [loginRouter, forgetPasswordRouter, otherRouter, page500, page403];

View File

@ -0,0 +1,331 @@
<template>
<div class="forget-password" @click='$refs.verify.show = false'>
<div style="height:50px;"></div>
<!-- 顶部logo -->
<div class="logo-box">
<img
:src="$store.state.logoImg" width='150'
@click="$router.push('/')"
/>
<div>修改密码</div>
</div>
<div class="login-container">
<!-- 验证手机号 -->
<Form
ref="formFirst"
:model="formFirst"
:rules="ruleInline"
style="width:300px;"
v-show="step === 0"
>
<FormItem prop="mobile">
<i-input
type="text"
v-model="formFirst.mobile"
clearable
placeholder="手机号"
>
<Icon type="md-phone-portrait" slot="prepend"></Icon>
</i-input>
</FormItem>
<FormItem prop="code">
<i-input
type="text"
v-model="formFirst.code"
clearable
placeholder="手机验证码"
>
<Icon
type="ios-text-outline"
style="font-weight: bold"
slot="prepend"
/>
<Button slot="append" @click="sendCode">{{ codeMsg }}</Button>
</i-input>
</FormItem>
<FormItem>
<Button @click="verifyBtnClick" long :type="verifyStatus?'success':'default'">{{verifyStatus?'验证通过':'点击完成安全验证'}}</Button>
</FormItem>
<FormItem>
<Button type="error" @click="next" :loading="loading" long>下一步</Button>
</FormItem>
</Form>
<Form
ref="form"
:model="form"
:rules="ruleInline"
style="width:300px;"
v-show="step === 1"
>
<FormItem prop="password">
<i-input
type="password"
v-model="form.password"
clearable
placeholder="请输入至少六位密码"
>
<Icon type="md-lock" slot="prepend"></Icon>
</i-input>
</FormItem>
<FormItem prop="password">
<i-input
type="password"
v-model="form.oncePasd"
clearable
placeholder="请再次输入密码"
>
<Icon type="md-lock" slot="prepend"></Icon>
</i-input>
</FormItem>
<FormItem>
<Button type="error" size="large" @click="handleSubmit" :loading="loading1" long>提交</Button>
</FormItem>
</Form>
<!-- 拼图验证码 -->
<verify
ref="verify"
class="verify-con"
:verifyType="verifyType"
@change="verifyChange"
></verify>
<div class="login-btn"><a @click="$router.push('login')"></a></div>
</div>
<div class="foot">
<Row type="flex" justify="space-around" class="help">
<a class="item" href="https://pickmall.cn/" target="_blank">帮助</a>
<a class="item" href="https://pickmall.cn/" target="_blank">隐私</a>
<a class="item" href="https://pickmall.cn/" target="_blank">条款</a>
</Row>
<Row type="flex" justify="center" class="copyright">
Copyright © {{year}} - Present
<a href="https://pickmall.cn/" target="_blank" style="margin: 0 5px"
>{{config.title}}</a
>
版权所有
</Row>
</div>
</div>
</template>
<script>
import * as RegExp from '@/utils/regular.js';
import * as apiLogin from '@/api/index.js';
import { sendSms } from '@/api/common.js';
import verify from "@/views/my-components/verify";
export default {
name: 'ForgetPassword',
components: { verify },
data () {
return {
config:require('@/config'),
loading: false, //
loading1: false, //
formFirst: { //
//
mobile: '',
code: ''
},
form: { //
password: '',
oncePasd: ''
},
year: new Date().getFullYear(), //
step: 0, //
ruleInline: {
//
mobile: [
{ required: true, message: '请输入手机号码' },
{
pattern: RegExp.mobile,
trigger: 'blur',
message: '请输入正确的手机号'
}
],
code: [{ required: true, message: '请输入手机验证码' }],
password: [{required: true, message: '密码不能为空'}, {pattern: RegExp.password, message: '密码不能少于6位'}]
},
verifyStatus: false, //
verifyType: 'FIND_USER', //
codeMsg: '发送验证码', //
interval: '', //
time: 60 //
};
},
methods: {
//
next () {
this.$refs.formFirst.validate((valid) => {
if (valid) {
this.loading = true;
let data = JSON.parse(JSON.stringify(this.formFirst));
apiLogin.validateCode(data).then((res) => {
this.loading = false;
if (res.success) {
// this.$Message.success('');
this.step = 1;
} else {
this.$Message.warning(res.message);
}
}).catch(() => { this.loading = false; });
} else {}
});
},
handleSubmit () { //
this.$refs.form.validate(valid => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.form));
if (params.password !== params.oncePasd) {
this.$Message.warning('两次输入密码不一致');
return;
};
params.mobile = this.formFirst.mobile;
params.password = this.md5(params.password);
delete params.oncePasd;
this.loading1 = true;
apiLogin.forgetAndModify(params).then(res => {
this.loading1 = false;
console.log(res);
if (res.success) {
this.$Message.success('修改密码成功');
this.$router.push('login');
}
}).catch(() => { this.loading = false; });
};
});
},
sendCode () { //
if (this.time === 60) {
if (this.formFirst.mobile === '') {
this.$Message.warning('请先填写手机号');
return;
}
if (!this.verifyStatus) {
this.$Message.warning('请先完成安全验证');
return;
}
let params = {
mobile: this.formFirst.mobile,
verificationEnums: 'FIND_USER'
};
sendSms(params).then(res => {
if (res.success) {
this.$Message.success('验证码发送成功');
let that = this;
this.interval = setInterval(() => {
that.time--;
if (that.time === 0) {
that.time = 60;
that.codeMsg = '重新发送';
that.verifyStatus = false;
clearInterval(that.interval);
} else {
that.codeMsg = that.time;
}
}, 1000);
} else {
this.$Message.warning(res.message);
}
});
}
},
verifyChange (con) { //
if (!con.status) return;
this.$refs.verify.show = false;
this.verifyStatus = true;
},
verifyBtnClick () {
if (!this.verifyStatus) {
this.$refs.verify.init();
}
}
},
mounted () {
document.querySelector('.forget-password').style.height = window.innerHeight + 'px'
this.$refs.formFirst.resetFields();
},
watch: {
}
};
</script>
<style scoped lang="scss">
.forget-password{
min-height: 700px;
}
.logo-box {
width: 600px;
height: 80px;
margin: 0 auto;
display: flex;
align-items: center;
img {
width: 150px;
cursor: pointer;
}
div {
font-size: 20px;
margin-top: 10px;
}
}
.login-container {
border-top: 2px solid $theme_color;
position: relative;
margin: 0 auto;
width: 600px;
background-color: #fff;
padding: 20px 150px;
.login-btn{
position: absolute;
right: 20px;
top: -45px;
}
}
.verify-con{
position: absolute;
left: 140px;
top: -30px;
z-index: 10;
}
.other-login {
margin: 0 auto;
.ivu-icon {
font-size: 24px;
}
}
.regist {
display: flex;
justify-content: flex-end;
margin-top: -10px;
span {
margin-left: 10px;
&:hover {
cursor: pointer;
color: $theme_color;
}
}
}
.foot {
position: fixed;
bottom: 4vh;
width: 368px;
left: calc(50% - 184px);
color: rgba(0, 0, 0, 0.45);
font-size: 14px;
.help {
margin: 0 auto;
margin-bottom: 1vh;
width: 60%;
.item {
color: rgba(0, 0, 0, 0.45);
}
:hover {
color: rgba(0, 0, 0, 0.65);
}
}
}
</style>

View File

@ -21,7 +21,7 @@
<div>店铺状态{{ userData.storeDisable == 'OPEN' ? '开启中' : '关闭' }}</div> <div>店铺状态{{ userData.storeDisable == 'OPEN' ? '开启中' : '关闭' }}</div>
</div> </div>
<div class="box-item" @click="im()"> <div class="box-item" @click="im()">
<Button type="info">点击登录客服</Button> <Button type="info" :loading='load'>点击登录客服</Button>
</div> </div>
</div> </div>
@ -207,7 +207,7 @@ import { getSellerHomeData, getHomeNotice } from "@/api/index";
import { getIMDetail } from "@/api/common" import { getIMDetail } from "@/api/common"
import { seeArticle } from "@/api/pages"; import { seeArticle } from "@/api/pages";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import { userMsg } from "@/api/index";
export default { export default {
name: "home", name: "home",
data () { data () {
@ -221,8 +221,10 @@ export default {
title: "", title: "",
}, },
IMLink: "", IMLink: "",
load:false, //Im
}; };
}, },
methods: { methods: {
// //
navigateTo (name) { navigateTo (name) {
@ -249,16 +251,24 @@ export default {
this.noticeFlage = true; this.noticeFlage = true;
} }
}, },
/**
* 点击登录im的时候需要去判断一下当前店铺信息是否失效
* 失效的话重新请求刷新token保证最新的token去访问im
*/
async im () { async im () {
// 访Token // 访Token
let accessToken = this.getStore("accessToken"); let accessToken = this.getStore("accessToken");
this.load = true
await this.getIMDetailMethods(); await this.getIMDetailMethods();
let res = await getIMDetail(); const userInfo = await userMsg();
if (!accessToken) { this.load = false
this.$Message.error("请登录后再联系客服"); if (userInfo.success && this.IMLink) {
return; window.open(`${this.IMLink}?token=` + accessToken);
}
else{
this.$Message.error("请登录后再联系客服");
} }
window.open(`${res.result}?token=` + accessToken);
}, },
// im // im

View File

@ -2,59 +2,58 @@
<div class="login" @click="$refs.verify.show = false"> <div class="login" @click="$refs.verify.show = false">
<Row type="flex" @keydown.enter.native="submitLogin"> <Row type="flex" @keydown.enter.native="submitLogin">
<Col style="width: 368px"> <Col style="width: 368px">
<Header /> <Header />
<Row style="flex-direction: column"> <Row style="flex-direction: column">
<Form <Tabs v-model="loginType">
ref="usernameLoginForm" <Tab-pane label="账号密码登录" name="passwordLogin">
:model="form" <!--账号密码登录-->
:rules="rules" <Form ref="usernameLoginForm" :model="form" :rules="rules" class="form">
class="form" <FormItem prop="username">
> <Input v-model="form.username" prefix="ios-contact" size="large" clearable placeholder="请输入用户名"
<FormItem prop="username"> autocomplete="off" />
<Input </FormItem>
v-model="form.username" <FormItem prop="password">
prefix="ios-contact" <Input type="password" v-model="form.password" prefix="ios-lock" size="large" password placeholder="请输入密码"
size="large" autocomplete="off" />
clearable </FormItem>
placeholder="请输入用户名" </Form>
autocomplete="off" <div class="register">
/> <a @click="$router.push('forgetPassword')"></a>
</FormItem>
<FormItem prop="password">
<Input
type="password"
v-model="form.password"
prefix="ios-lock"
size="large"
password
placeholder="请输入密码"
autocomplete="off"
/>
</FormItem>
</Form>
<Row>
<div
class="login-btn"
type="primary"
size="large"
:loading="loading"
@click="submitLogin"
long
>
<span v-if="!loading"></span>
<span v-else></span>
</div> </div>
</Row> </Tab-pane>
<Tab-pane label="验证码登录" name="mobileLogin">
<!-- 验证码登录 -->
<Form ref="formSms" :model="formSms" :rules="ruleInline" @click.self='$refs.verify.show = false'>
<FormItem prop="mobile">
<i-input type="text" v-model="formSms.mobile" clearable placeholder="手机号">
<Icon type="md-lock" slot="prepend"></Icon>
</i-input>
</FormItem>
<FormItem prop="code">
<i-input type="text" v-model="formSms.code" placeholder="手机验证码">
<Icon type="ios-text-outline" style="font-weight: bold" slot="prepend" />
<Button slot="append" @click="sendCode">{{ codeMsg }}</Button>
</i-input>
</FormItem>
<FormItem>
<Button @click.stop="verifyBtnClick" long :type="verifyStatus ? 'success' : 'default'">{{ verifyStatus ?
'验证通过' :
'点击完成安全验证' }}
</Button>
</FormItem>
</Form>
</Tab-pane>
</Tabs>
<Row>
<div class="login-btn" type="primary" size="large" :loading="loading" @click="submitLogin" long>
<span v-if="!loading"></span>
<span v-else></span>
</div>
</Row> </Row>
<Footer /> </Row>
<!-- 拼图验证码 --> <Footer />
<verify <!-- 拼图验证码 -->
ref="verify" <verify ref="verify" class="verify-con" verifyType="LOGIN" @change="verifyChange"></verify>
class="verify-con"
verifyType="LOGIN"
@change="verifyChange"
></verify>
</Col> </Col>
</Row> </Row>
</div> </div>
@ -62,7 +61,8 @@
<script> <script>
import { getCurrentPermissionList } from "@/api/index"; import { getCurrentPermissionList } from "@/api/index";
import { login, userMsg } from "@/api/index"; import { login, userMsg, storeSmsLogin } from "@/api/index";
import { sendSms } from "@/api/common.js";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import Header from "@/views/main-components/header"; import Header from "@/views/main-components/header";
import Footer from "@/views/main-components/footer"; import Footer from "@/views/main-components/footer";
@ -78,6 +78,9 @@ export default {
return { return {
saveLogin: true, // saveLogin: true, //
loading: false, // loading: false, //
verifyStatus: false, //
time: 60, //
loginType: 'passwordLogin', //
form: { form: {
// //
username: "", username: "",
@ -85,6 +88,10 @@ export default {
mobile: "", mobile: "",
code: "", code: "",
}, },
formSms: {
mobile: '',
code: '',
},
rules: { rules: {
// //
username: [ username: [
@ -102,6 +109,23 @@ export default {
}, },
], ],
}, },
ruleInline: {
//
username: [{ required: true, message: "请输入用户名" }],
password: [
{ required: true, message: "请输入密码" },
{ type: "string", min: 6, message: "密码不能少于6位" },
],
mobile: [
{ required: true, message: "请输入手机号码" },
{
pattern: RegExp.mobile,
message: "请输入正确的手机号",
},
],
code: [{ required: true, message: "请输入手机验证码" }],
},
codeMsg: "发送验证码", //
}; };
}, },
created() { created() {
@ -142,35 +166,92 @@ export default {
} }
}); });
}, },
//
sendCode() {
if (this.time === 60) {
if (this.formSms.mobile === "") {
this.$Message.warning("请先填写手机号");
return;
}
if (!this.verifyStatus) {
this.$Message.warning("请先完成安全验证");
return;
}
let params = {
mobile: this.formSms.mobile,
verificationEnums: "LOGIN",
};
sendSms(params).then((res) => {
if (res.success) {
this.$Message.success("验证码发送成功");
let that = this;
this.interval = setInterval(() => {
that.time--;
if (that.time === 0) {
that.time = 60;
that.codeMsg = "重新发送";
that.verifyStatus = false;
clearInterval(that.interval);
} else {
that.codeMsg = that.time;
}
}, 1000);
} else {
this.$Message.warning(res.message);
}
});
}
},
submitLogin() { submitLogin() {
// //
this.$refs.usernameLoginForm.validate((valid) => { if (this.loginType == 'passwordLogin') {
if (valid) { this.$refs.usernameLoginForm.validate((valid) => {
this.$refs.verify.init(); if (valid) {
} this.$refs.verify.init();
}); }
});
} else if (this.loginType == 'mobileLogin') {
this.$refs['formSms'].validate((valid) => {
if (valid) {
storeSmsLogin(this.formSms).then(res => {
if (res.success) {
this.afterLogin(res)
}
})
}
})
}
}, },
verifyChange(con) { verifyChange(con) {
// //
if (!con.status) return; if (!con.status) return;
this.loading = true; if (this.loginType == 'passwordLogin') {
this.loading = true;
let fd = new FormData(); let fd = new FormData();
fd.append("username", this.form.username); fd.append("username", this.form.username);
fd.append("password", this.md5(this.form.password)); fd.append("password", this.md5(this.form.password));
login(fd) login(fd)
.then((res) => { .then((res) => {
this.loading = false; this.loading = false;
if (res && res.success) { if (res && res.success) {
this.afterLogin(res); this.afterLogin(res);
} }
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
}); });
}
this.verifyStatus = true;
this.$refs.verify.show = false; this.$refs.verify.show = false;
}, },
//
verifyBtnClick() {
if (!this.verifyStatus) {
this.$refs.verify.init();
}
},
}, },
}; };
</script> </script>
@ -184,12 +265,14 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.verify-con { .verify-con {
position: absolute; position: absolute;
top: 126px; top: 126px;
z-index: 10; z-index: 10;
left: 20px; left: 20px;
} }
.form { .form {
padding-top: 1vh; padding-top: 1vh;
} }
@ -208,9 +291,11 @@ export default {
text-align: center; text-align: center;
transition: 0.35s; transition: 0.35s;
} }
.login-btn:hover { .login-btn:hover {
opacity: 0.9; opacity: 0.9;
border-radius: 10px; border-radius: 10px;
} }
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -329,7 +329,7 @@ export default {
content: "您确认关闭此物流公司?", content: "您确认关闭此物流公司?",
loading: true, loading: true,
onOk: () => { onOk: () => {
API_Shop.logisticsUnChecked(v.selected).then((res) => { API_Shop.logisticsUnChecked(v.logisticsId).then((res) => {
this.$Modal.remove(); this.$Modal.remove();
if (res.success) { if (res.success) {
this.$Message.success("物流公司关闭成功"); this.$Message.success("物流公司关闭成功");