diff --git a/package.json b/package.json
index b1c170d..e83ad60 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "serve": "npm run dev:h5",
+ "serve": "node env.config.js & npm run dev:h5",
+ "serve:bate": "node env.config.js --ENV:beta & npm run dev:h5",
+ "serve:prod": "node env.config.js --ENV:prod & npm run dev:h5",
"build": "npm run build:h5",
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
diff --git a/src/App.vue b/src/App.vue
index 4efbe61..dc5b413 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-23 20:13:23
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 20:53:56
+ * @LastEditTime: 2022-05-24 10:00:15
* @Description: file content
-->
-
diff --git a/src/common/api/index.js b/src/common/api/index.js
index 6ec6581..6ca029b 100644
--- a/src/common/api/index.js
+++ b/src/common/api/index.js
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-17 16:37:45
* @LastEditors: ch
- * @LastEditTime: 2022-05-16 15:52:57
+ * @LastEditTime: 2022-05-24 17:25:25
* @Description: file content
*/
@@ -18,7 +18,7 @@ export const ApiPostLogin = (data) => ToAsyncAwait(MsbRequest.post(`${BASE_URL}/
* 退出登录
* @param {*} data
*/
-export const ApiGetLogout= () => ToAsyncAwait(MsbRequest.post(`${BASE_URL}/user/logout`));
+export const ApiGetLogout= () => ToAsyncAwait(MsbRequest.get(`${BASE_URL}/user/logout`));
/**
* 获取手机验证码
* @param {*} params
diff --git a/src/common/plugins/msbIm.js b/src/common/plugins/msbIm.js
index a7cf50b..75986a4 100644
--- a/src/common/plugins/msbIm.js
+++ b/src/common/plugins/msbIm.js
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-18 14:54:47
* @LastEditors: ch
- * @LastEditTime: 2022-05-21 19:32:49
+ * @LastEditTime: 2022-05-24 22:51:47
* @Description: file content
*/
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
@@ -52,6 +52,9 @@ export default class MsbIm {
this.socket.onOpen(() => {
this.socket.onMessage(async (res) => {
const result = JSON.parse(res.data);
+ if (result.content?.payload) {
+ result.content.payload = JSON.parse(result.content.payload);
+ }
// 401主动退出
if (result.code === 401) {
this.logout();
@@ -109,7 +112,6 @@ export default class MsbIm {
return false;
}
let ctx = data.content;
- ctx.payload = JSON.parse(ctx.payload || {});
let historyData = [...this.sessionData],
newData = [];
const hisIndex = historyData.findIndex(i => i.id === ctx.sessionId);
@@ -263,30 +265,72 @@ export default class MsbIm {
* @param {*} params
*/
async sendMsg(params) {
- let curSession = this.sessionData.find(i => i.id === this.curSessionId);
-
- curSession.messageList.push({
+ const index = this.sessionData.findIndex(i => i.id === this.curSessionId)
+ let curSession = this.sessionData[index];
+ // 临时消息体
+ let par = {
+ ...params,
+ traceId: CreateUUID(),
+ traceType: 20,
+ }
+ let msgCtx = {
...params.content,
+ ...par,
fromId: params.fromId,
createTimeStamp : (new Date()).getTime(),
sendStatus : 'loading'
- });
- const { error, result } = await ToAsyncAwait(this[send]({
- traceId: CreateUUID(),
- traceType: 20,
- ...params
- }));
- for (let item of curSession.messageList) {
- if (item[this.option.ioKey] === params[this.option.ioKey]) {
- item.sendStatus = error ? 'fail' : 'success';
+ }
+ // 点发送,立即把消息加入消息列表,标记为发送中状态
+ curSession.messageList.push(msgCtx);
+ // 超过时间未返回视为发送失败
+ this.timerStatus(msgCtx);
+ const { error, result } = await ToAsyncAwait(this[send](par));
+ // 接到通知,标记消息是否发送成功
+ for (let i = curSession.messageList.length; i--;) {
+ const item = curSession.messageList[i];
+ if (item[this.option.ioKey] === par[this.option.ioKey]) {
+ curSession.messageList[i].sendStatus = msgCtx.sendStatus = error ? 'fail' : 'success';
break;
}
}
+ let newData = [...this.sessionData];
+ newData[index] = curSession;
+ this.setSessionData(newData);
+ if (error) {
+ return Promise.reject(error);
+ }
+
+ return Promise.resolve(result);
+ }
+ /**
+ * 发送失败时,重新发送
+ * @param {*} params
+ */
+ async resend(params) {
+ params.sendStatus = 'loading';
+ this.timerStatus(params)
+ const { error, result } = await ToAsyncAwait(this[send]({
+ traceId: params.traceId,
+ traceType: params.traceType,
+ content : params.content
+ }));
+ params.createTimeStamp = result.createTimeStamp;
if (error) {
+ params.sendStatus = 'fail';
return Promise.reject(error);
}
+ params.sendStatus = 'success';
return Promise.resolve(result);
}
+ timerStatus(msg) {
+
+ setTimeout(() => {
+ if (msg.sendStatus === 'loading') {
+ msg.sendStatus = 'fail';
+ delete this.queue[msg.traceId];
+ }
+ }, 3000);
+ }
/**
* 主动创建会话
* @param {*} params
diff --git a/src/components/UiGoodsGroup.vue b/src/components/UiGoodsGroup.vue
index e124f8a..e74bc98 100644
--- a/src/components/UiGoodsGroup.vue
+++ b/src/components/UiGoodsGroup.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-07 17:22:44
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:28
+ * @LastEditTime: 2022-05-24 09:57:03
* @Description: file content
-->
@@ -175,7 +175,7 @@ export default {
}
}
}
-::deep {
+::v-deep {
.goods-item--pirce{
text{
font-size: $font-size-lg;
diff --git a/src/components/UiGoodsInfo.vue b/src/components/UiGoodsInfo.vue
index d942509..9399d95 100644
--- a/src/components/UiGoodsInfo.vue
+++ b/src/components/UiGoodsInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-31 14:49:33
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:30
+ * @LastEditTime: 2022-05-24 09:57:04
* @Description: file content
-->
@@ -88,7 +88,7 @@ export default {
}
}
}
-::deep{
+::v-deep{
.ui-money{
text{
font-size: $font-size-base;
diff --git a/src/components/UiGoodsInfoMax.vue b/src/components/UiGoodsInfoMax.vue
index 24fd6cb..da6f9b1 100644
--- a/src/components/UiGoodsInfoMax.vue
+++ b/src/components/UiGoodsInfoMax.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-22 16:48:11
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:32
+ * @LastEditTime: 2022-05-24 09:57:05
* @Description: file content
-->
@@ -81,7 +81,7 @@ export default {
margin-left: 60rpx;
}
}
-::deep{
+::v-deep{
.ui-money{
text{
font-size: $font-size-base;
diff --git a/src/pages/account/address/create.vue b/src/pages/account/address/create.vue
index 2cec171..c7e0879 100644
--- a/src/pages/account/address/create.vue
+++ b/src/pages/account/address/create.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 14:12:18
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:36
+ * @LastEditTime: 2022-05-24 09:57:08
* @Description: file content
-->
@@ -126,7 +126,7 @@ page {
left: 30rpx;
width: 670rpx;
}
-::deep {
+::v-deep {
.form--city .ui-cell{
padding: 0 40rpx;
}
diff --git a/src/pages/account/address/edit.vue b/src/pages/account/address/edit.vue
index 0867a20..ae37840 100644
--- a/src/pages/account/address/edit.vue
+++ b/src/pages/account/address/edit.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 14:12:18
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:37
+ * @LastEditTime: 2022-05-24 09:57:10
* @Description: file content
-->
@@ -160,7 +160,7 @@ page {
left: 30rpx;
width: 670rpx;
}
-::deep {
+::v-deep {
.del-address .ui-cell--title{
color: $color-yellow3;
}
diff --git a/src/pages/account/index.vue b/src/pages/account/index.vue
index 231f5e4..7dad490 100644
--- a/src/pages/account/index.vue
+++ b/src/pages/account/index.vue
@@ -3,7 +3,7 @@
components: { UiCell },: ch
* @Date: 2019-08-22 19:41:20
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:35
+ * @LastEditTime: 2022-05-24 09:57:07
* @Description: file content
-->
@@ -209,7 +209,7 @@ page {
border: 0;
}
}
-::deep{
+::v-deep{
.header--cell .ui-cell--title{
font-weight: bold;
font-size: $font-size-lg;
diff --git a/src/pages/account/message/chat/components/Footer.vue b/src/pages/account/message/chat/components/Footer.vue
index 2af4841..8302dfb 100644
--- a/src/pages/account/message/chat/components/Footer.vue
+++ b/src/pages/account/message/chat/components/Footer.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-11 11:45:08
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 11:29:13
+ * @LastEditTime: 2022-05-24 22:54:29
* @Description: file content
-->
@@ -134,6 +134,7 @@ export default {
break;
}
+ this.msgCtx = '';
const {error, result} = await ToAsyncAwait(Im.sendMsg({
fromId : this.$store.state.userInfo.id,
content: {
@@ -147,7 +148,6 @@ export default {
uni.$u.toast(error.message);
return false
}
- this.msgCtx = '';
this.focus = false;
this.$nextTick(() => {
this.focus = true;
diff --git a/src/pages/account/message/chat/components/GoodsInfo.vue b/src/pages/account/message/chat/components/GoodsInfo.vue
index 89685e7..6732c36 100644
--- a/src/pages/account/message/chat/components/GoodsInfo.vue
+++ b/src/pages/account/message/chat/components/GoodsInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-13 15:57:31
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:38
+ * @LastEditTime: 2022-05-24 09:57:11
* @Description: file content
-->
@@ -85,7 +85,7 @@ export default {
right:30rpx;
}
}
-::deep{
+::v-deep{
.product--con-price{
text{
color: #FF512B;
diff --git a/src/pages/account/message/chat/components/OrderInfo.vue b/src/pages/account/message/chat/components/OrderInfo.vue
index b201732..fc73a45 100644
--- a/src/pages/account/message/chat/components/OrderInfo.vue
+++ b/src/pages/account/message/chat/components/OrderInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-14 14:00:14
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:39
+ * @LastEditTime: 2022-05-24 09:57:12
* @Description: file content
-->
@@ -78,7 +78,7 @@ export default {
margin-top: 26rpx;
}
}
-::deep{
+::v-deep{
.order--con-price{
text{
color: #FF512B;
diff --git a/src/pages/account/message/chat/index.vue b/src/pages/account/message/chat/index.vue
index ac16c86..c1d384c 100644
--- a/src/pages/account/message/chat/index.vue
+++ b/src/pages/account/message/chat/index.vue
@@ -2,13 +2,15 @@
* @Author: ch
* @Date: 2022-03-26 14:32:03
* @LastEditors: ch
- * @LastEditTime: 2022-05-21 16:08:32
+ * @LastEditTime: 2022-05-24 22:42:35
* @Description: file content
-->
+ 发送中
+ 重发
@@ -105,24 +107,26 @@ export default {
this.goodsId = this.$Route.query.goodsId;
this.orderId = this.$Route.query.orderId;
this.sessionId = this.$Route.query.sessionId;
-
- if(this.goodsId){
- this.createSessionMain();
- this.getGoodsInfo();
- }else if(this.orderId){
- this.createSessionMain();
- this.getOrderInfo();
- }else if(this.sessionId){
+
+ if(this.sessionId){
this.getHistoryMsg();
this.readMsg();
}else{
this.createSessionMain();
}
+ if(this.goodsId){
+ this.getGoodsInfo();
+ }
+ if(this.orderId){
+ this.getOrderInfo();
+ }
+ this.$nextTick(()=>{
+ uni.pageScrollTo({
+ scrollTop : 99999,
+ duration : 0
+ });
+ })
- uni.pageScrollTo({
- scrollTop : 99999,
- duration : 0
- });
},
methods:{
/**
@@ -151,25 +155,36 @@ export default {
async getHistoryMsg(){
this.loading = true;
const lastMsg = this.msgData?.length ? this.msgData[0] : {};
- await Im.getHistoryMsg({
+ const {error, result} = await ToAsyncAwait(Im.getHistoryMsg({
content : {
sessionId : this.sessionId,
topMessageId : lastMsg.id || null
}
- });
+ }));
+ if(error){
+ uni.$u.toast(error.errMsg || error.message);
+ return false
+ }
this.loading = false;
},
/**
* 把当前会话消息置为已读
*/
- readMsg(){
- Im.setRead({
+ async readMsg(){
+ const {error, result} = await ToAsyncAwait(Im.setRead({
content: {
sessionId : this.sessionId
}
- })
+ }));
+ if(error){
+ uni.$u.toast(error.errMsg || error.message);
+ return false
+ }
},
+ resend(item){
+ Im.resend(item)
+ },
/**
* 从订单页进来查询订单信息
*/
@@ -247,8 +262,19 @@ page{
display: flex;
justify-content: flex-end;
margin-top:30rpx ;
+ &--status{
+ font-size: $font-size-sm;
+ color: $color-grey3;
+ display: flex;
+ align-items: center;
+ line-height: 46rpx;
+ margin-right: 10rpx;
+ &__fail{
+ color: $color-yellow4;
+ }
+ }
&--box{
- max-width: 552rpx;
+ max-width: 480rpx;
margin-right:30rpx;
&__txt{
padding: 20rpx 30rpx;
diff --git a/src/pages/account/setting/index.vue b/src/pages/account/setting/index.vue
index 1f3da1f..1da4689 100644
--- a/src/pages/account/setting/index.vue
+++ b/src/pages/account/setting/index.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 15:09:06
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:40
+ * @LastEditTime: 2022-05-24 17:24:35
* @Description: file content
-->
@@ -37,10 +37,13 @@ export default {
confirmColor : '#3A83FB',
success:async ({confirm})=>{
if(confirm){
- await ApiGetLogout();
+ const {error} = await ApiGetLogout();
+ if(error){
+ uni.$u.toast(error.message);
+ return false;
+ }
this.$store.commit('SET_TOKEN');
Im.logout();
- console.log(Im, this.$store.state);
this.$Router.replace('/login');
}
}
@@ -91,7 +94,7 @@ page {
font-size: $font-size-lg;
}
-::deep{
+::v-deep{
.userInfo .uiCell--title{
font-size: $font-size-lg;
}
diff --git a/src/pages/account/setting/setUserInfo.vue b/src/pages/account/setting/setUserInfo.vue
index a106697..bf8dd5c 100644
--- a/src/pages/account/setting/setUserInfo.vue
+++ b/src/pages/account/setting/setUserInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-28 15:38:23
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:41
+ * @LastEditTime: 2022-05-24 09:57:14
* @Description: file content
-->
@@ -143,7 +143,7 @@ page {
border: 0;
}
}
-::deep{
+::v-deep{
.userInfo .uiCell--title{
font-size: $font-size-lg;
}
diff --git a/src/pages/cart/components/PageCtx.vue b/src/pages/cart/components/PageCtx.vue
index 7160caa..e3804a7 100644
--- a/src/pages/cart/components/PageCtx.vue
+++ b/src/pages/cart/components/PageCtx.vue
@@ -573,7 +573,7 @@ export default {
}
-::deep{
+::v-deep{
.cart-item--price{
text{
font-size: $font-size-lg;
diff --git a/src/pages/index/components/Pick.vue b/src/pages/index/components/Pick.vue
index 8d6e0b6..180e7f3 100644
--- a/src/pages/index/components/Pick.vue
+++ b/src/pages/index/components/Pick.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-23 10:29:07
* @LastEditors: ch
- * @LastEditTime: 2022-05-06 11:20:23
+ * @LastEditTime: 2022-05-24 09:57:02
* @Description: file content
-->
@@ -165,16 +165,19 @@ export default {
margin-top: 0;
}
}
-::deep .price{
- text{
- color: $color-yellow4;
- font-size: $font-size-lg;
- line-height: $font-size-lg;
- font-weight: bold;
- }
- .ui-money--prefix{
- font-size: $font-size-sm;
- line-height: $font-size-sm;
+::v-deep {
+ .price{
+ text{
+ color: $color-yellow4;
+ font-size: $font-size-lg;
+ line-height: $font-size-lg;
+ font-weight: bold;
+ }
+ .ui-money--prefix{
+ font-size: $font-size-sm;
+ line-height: $font-size-sm;
+ }
}
+
}
\ No newline at end of file
diff --git a/src/pages/index/components/Seckill.vue b/src/pages/index/components/Seckill.vue
index d271a88..be5817d 100644
--- a/src/pages/index/components/Seckill.vue
+++ b/src/pages/index/components/Seckill.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-23 10:07:48
* @LastEditors: ch
- * @LastEditTime: 2022-04-21 16:45:14
+ * @LastEditTime: 2022-05-24 09:57:16
* @Description: file content
-->
@@ -204,8 +204,8 @@ export default {
}
-::deep {
- .seckill--item-pirce{
+
+ .seckill--item-pirce ::v-deep{
text{
color: $color-yellow4;
font-size: $font-size-lg;
@@ -215,6 +215,6 @@ export default {
font-size: $font-size-base;
}
}
-}
+
\ No newline at end of file
diff --git a/src/pages/login.vue b/src/pages/login.vue
index e06c612..69b5125 100644
--- a/src/pages/login.vue
+++ b/src/pages/login.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 15:36:46
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:33
+ * @LastEditTime: 2022-05-24 09:57:06
* @Description: file content
-->
@@ -220,7 +220,7 @@ export default {
}
}
}
-::deep{
+::v-deep{
.input-placeholder{
color: $color-grey3;
}
diff --git a/src/pages/order/detail/components/LogisitcsInfo.vue b/src/pages/order/detail/components/LogisitcsInfo.vue
index 409c010..548c920 100644
--- a/src/pages/order/detail/components/LogisitcsInfo.vue
+++ b/src/pages/order/detail/components/LogisitcsInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-15 16:36:02
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:46
+ * @LastEditTime: 2022-05-24 09:57:18
* @Description: file content
-->
@@ -81,7 +81,7 @@ export default {
}
}
-::deep{
+::v-deep{
.u-cell__body__content{
padding: 10rpx 0;
}
diff --git a/src/pages/order/detail/components/OrderInfo.vue b/src/pages/order/detail/components/OrderInfo.vue
index d2f762b..3ee577d 100644
--- a/src/pages/order/detail/components/OrderInfo.vue
+++ b/src/pages/order/detail/components/OrderInfo.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-04-15 16:04:28
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:50
+ * @LastEditTime: 2022-05-24 09:57:19
* @Description: file content
-->
@@ -103,7 +103,7 @@ export default {
color: $color-yellow4;
font-size: $font-size-lg;
}
-::deep {
+::v-deep {
.ui-money--price{
font-size: 36rpx;
color: $color-yellow4;
diff --git a/src/pages/order/list.vue b/src/pages/order/list.vue
index 5b3ba74..e07b5de 100644
--- a/src/pages/order/list.vue
+++ b/src/pages/order/list.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 10:58:24
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:44
+ * @LastEditTime: 2022-05-24 09:57:16
* @Description: file content
-->
@@ -240,7 +240,7 @@ page {
}
}
-::deep{
+::v-deep{
.orders--footer{
.ui-btn{
margin: 0 0 0 20rpx;
diff --git a/src/pages/order/saleAfter/saleAfterDetail/components/SubmitLogistics.vue b/src/pages/order/saleAfter/saleAfterDetail/components/SubmitLogistics.vue
index 7615e76..d21a154 100644
--- a/src/pages/order/saleAfter/saleAfterDetail/components/SubmitLogistics.vue
+++ b/src/pages/order/saleAfter/saleAfterDetail/components/SubmitLogistics.vue
@@ -191,7 +191,7 @@ export default {
padding: 0 30rpx;
}
.address{
- ::deep.u-cell__body__content{
+ ::v-deep.u-cell__body__content{
padding: 10rpx 0;
}
diff --git a/src/pages/order/submit.vue b/src/pages/order/submit.vue
index 362462a..aabddb5 100644
--- a/src/pages/order/submit.vue
+++ b/src/pages/order/submit.vue
@@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-20 14:14:53
* @LastEditors: ch
- * @LastEditTime: 2022-05-23 18:17:45
+ * @LastEditTime: 2022-05-24 09:57:17
* @Description: file content
-->
@@ -198,7 +198,7 @@ page {