Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp
commit
071599074c
10
api/login.js
10
api/login.js
|
@ -14,6 +14,16 @@ export function resetByMobile(params) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取自动发券
|
||||||
|
export function getAutoCoup(){
|
||||||
|
return http.request({
|
||||||
|
url:`/promotion/coupon/activity`,
|
||||||
|
method:"GET",
|
||||||
|
needToken: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号密码登陆
|
* 账号密码登陆
|
||||||
* @params password
|
* @params password
|
||||||
|
|
|
@ -22,4 +22,5 @@ export default {
|
||||||
mainColor: "#ff3c2a", // 主题色
|
mainColor: "#ff3c2a", // 主题色
|
||||||
lightColor: "#ff6b35", // 高亮主题色
|
lightColor: "#ff6b35", // 高亮主题色
|
||||||
aiderLightColor: "#ff9f28", // 辅助高亮颜色
|
aiderLightColor: "#ff9f28", // 辅助高亮颜色
|
||||||
|
defaultUserPhoto:"/static/missing-face.png" // 默认用户头像
|
||||||
};
|
};
|
||||||
|
|
4
main.js
4
main.js
|
@ -5,13 +5,14 @@ import uView from "uview-ui";
|
||||||
import store from "./store";
|
import store from "./store";
|
||||||
import config from '@/config/config';
|
import config from '@/config/config';
|
||||||
import airBtn from "@/components/m-airbtn/index.vue";
|
import airBtn from "@/components/m-airbtn/index.vue";
|
||||||
|
import socketIO from './pages/mine/im/socket';
|
||||||
/**
|
/**
|
||||||
* 仅在h5中显示唤醒app功能
|
* 仅在h5中显示唤醒app功能
|
||||||
* 在h5页面手动挂载
|
* 在h5页面手动挂载
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if(config.enableMiniBarStartUpApp){
|
if (config.enableMiniBarStartUpApp) {
|
||||||
let btn = Vue.component("airBtn", airBtn); //全局注册
|
let btn = Vue.component("airBtn", airBtn); //全局注册
|
||||||
document.body.appendChild(new btn().$mount().$el);
|
document.body.appendChild(new btn().$mount().$el);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +32,7 @@ Object.keys(filters).forEach((key) => {
|
||||||
|
|
||||||
// 引入Vuex
|
// 引入Vuex
|
||||||
Vue.prototype.$store = store;
|
Vue.prototype.$store = store;
|
||||||
|
// Vue.prototype.socketIo = new socketIO();
|
||||||
Vue.use(uView);
|
Vue.use(uView);
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name" : "lili商城",
|
"name" : "lili商城",
|
||||||
"appid" : "__UNI__EC9FD60",
|
"appid" : "__UNI__ED807EA",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "4.2.7",
|
"versionName" : "4.2.8",
|
||||||
"versionCode" : 4000270,
|
"versionCode" : 4000280,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"compatible" : {
|
"compatible" : {
|
||||||
|
|
|
@ -2,28 +2,63 @@
|
||||||
<view class="b-content">
|
<view class="b-content">
|
||||||
<view class="navbar">
|
<view class="navbar">
|
||||||
<!-- 循环出头部tab栏 -->
|
<!-- 循环出头部tab栏 -->
|
||||||
<view v-for="(item, index) in navList" :key="index" class="nav-item" @click="handleTabClick(index)"><text
|
<view
|
||||||
:class="{ current: tabCurrentIndex === index }">{{
|
v-for="(item, index) in navList"
|
||||||
|
:key="index"
|
||||||
|
class="nav-item"
|
||||||
|
@click="handleTabClick(index)"
|
||||||
|
><text :class="{ current: tabCurrentIndex === index }">{{
|
||||||
item.text
|
item.text
|
||||||
}}</text></view>
|
}}</text></view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
|
<swiper
|
||||||
<swiper-item class="tab-content" v-for="(navItem, navIndex) in navList" :key="navIndex">
|
:current="tabCurrentIndex"
|
||||||
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
|
class="swiper-box"
|
||||||
|
duration="300"
|
||||||
|
@change="changeTab"
|
||||||
|
>
|
||||||
|
<swiper-item
|
||||||
|
class="tab-content"
|
||||||
|
v-for="(navItem, navIndex) in navList"
|
||||||
|
:key="navIndex"
|
||||||
|
>
|
||||||
|
<scroll-view
|
||||||
|
class="list-scroll-content"
|
||||||
|
scroll-y
|
||||||
|
@scrolltolower="loadData"
|
||||||
|
>
|
||||||
<!-- 空白页 -->
|
<!-- 空白页 -->
|
||||||
<u-empty mode="coupon" text="暂无优惠券了" v-if="navItem.wheterEmpty"></u-empty>
|
<u-empty
|
||||||
|
mode="coupon"
|
||||||
|
text="暂无优惠券了"
|
||||||
|
v-if="navItem.wheterEmpty"
|
||||||
|
></u-empty>
|
||||||
|
|
||||||
<!-- 数据 -->
|
<!-- 数据 -->
|
||||||
<view v-if="navItem.dataList && coupon" class="coupon-item" :class="{ 'coupon-used': navIndex != 0 }"
|
<view
|
||||||
v-for="(coupon, index) in navItem.dataList" :key="index">
|
v-if="navItem.dataList && coupon"
|
||||||
|
class="coupon-item"
|
||||||
|
:class="{ 'coupon-used': navIndex != 0 }"
|
||||||
|
v-for="(coupon, index) in navItem.dataList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="wave-line">
|
<view class="wave-line">
|
||||||
<view class="wave" v-for="(item, index) in 12" :key="index"></view>
|
<view
|
||||||
|
class="wave"
|
||||||
|
v-for="(item, index) in 12"
|
||||||
|
:key="index"
|
||||||
|
></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="message">
|
<view class="message">
|
||||||
<view class="price" v-if="coupon.couponType == 'DISCOUNT'">{{ coupon.discount }}折</view>
|
<view class="price" v-if="coupon.couponType == 'DISCOUNT'"
|
||||||
|
>{{ coupon.discount }}折</view
|
||||||
|
>
|
||||||
<view class="price" v-else>{{ coupon.price }}元</view>
|
<view class="price" v-else>{{ coupon.price }}元</view>
|
||||||
<view class="sub-price">满{{ coupon.consumeThreshold | unitPrice }}可用</view>
|
<view class="sub-price"
|
||||||
|
>满{{ coupon.consumeThreshold | unitPrice }}可用</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
<view class="circle circle-top"></view>
|
<view class="circle circle-top"></view>
|
||||||
<view class="circle circle-bottom"></view>
|
<view class="circle circle-bottom"></view>
|
||||||
|
@ -31,27 +66,47 @@
|
||||||
<view class="right" v-if="coupon">
|
<view class="right" v-if="coupon">
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="title-1">{{ coupon.title }}</view>
|
<view class="title-1">{{ coupon.title }}</view>
|
||||||
<view class="title-2">使用平台:{{
|
<view class="title-2"
|
||||||
coupon.scopeType == 'ALL' && coupon.storeId == '0'
|
>使用平台:{{
|
||||||
|
coupon.scopeType == "ALL" && coupon.storeId == "0"
|
||||||
? "全平台"
|
? "全平台"
|
||||||
: coupon.scopeType == "PORTION_CATEGORY"
|
: coupon.scopeType == "PORTION_CATEGORY"
|
||||||
? "仅限品类"
|
? "仅限品类"
|
||||||
: coupon.storeName == 'platform' ? '全平台' :coupon.storeName+''
|
: coupon.storeName == "platform"
|
||||||
}}使用</view>
|
? "全平台"
|
||||||
<view v-if="coupon.endTime">{{
|
: coupon.storeName + ""
|
||||||
coupon.endTime
|
}}使用</view
|
||||||
}}</view>
|
>
|
||||||
<view @click="couponDetail(coupon)">详细说明
|
<view v-if="coupon.endTime">{{ coupon.endTime }}</view>
|
||||||
<u-icon style="float: right; margin-top: 10rpx" name="arrow-right"></u-icon>
|
<view @click="couponDetail(coupon)"
|
||||||
|
>详细说明
|
||||||
|
<u-icon
|
||||||
|
style="float: right; margin-top: 10rpx"
|
||||||
|
name="arrow-right"
|
||||||
|
></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="jiao-1" v-if="navIndex == 0">
|
<view class="jiao-1" v-if="navIndex == 0">
|
||||||
<text class="text-1">新到</text>
|
<text class="text-1">新到</text>
|
||||||
<text class="text-2" v-if="coupon.used_status == 1">将过期</text>
|
<text class="text-2" v-if="coupon.used_status == 1"
|
||||||
|
>将过期</text
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
<image class="no-icon" v-if="navIndex == 1" src="@/static/img/used.png"></image>
|
<image
|
||||||
<image class="no-icon" v-if="navIndex == 2" src="@/static/img/overdue.png"></image>
|
class="no-icon"
|
||||||
<view class="receive" v-if="navIndex == 0" @click="useItNow(coupon)">
|
v-if="navIndex == 1"
|
||||||
|
src="@/static/img/used.png"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
class="no-icon"
|
||||||
|
v-if="navIndex == 2"
|
||||||
|
src="@/static/img/overdue.png"
|
||||||
|
></image>
|
||||||
|
<view
|
||||||
|
class="receive"
|
||||||
|
v-if="navIndex == 0"
|
||||||
|
@click="useItNow(coupon)"
|
||||||
|
>
|
||||||
<text>立即</text><br />
|
<text>立即</text><br />
|
||||||
<text>使用</text>
|
<text>使用</text>
|
||||||
</view>
|
</view>
|
||||||
|
@ -116,7 +171,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.navList[this.tabCurrentIndex].params.pageNumber = 1
|
this.navList[this.tabCurrentIndex].params.pageNumber = 1;
|
||||||
this.navList[this.tabCurrentIndex].dataList = [];
|
this.navList[this.tabCurrentIndex].dataList = [];
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
|
@ -188,15 +243,9 @@ export default {
|
||||||
* 立即使用优惠券
|
* 立即使用优惠券
|
||||||
*/
|
*/
|
||||||
useItNow(item) {
|
useItNow(item) {
|
||||||
if (item.storeId && item.storeId!='0') {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/product/shopPage?id=${item.storeId}`,
|
url: `/pages/navigation/search/searchPage?promotionsId=${item.couponId}&promotionType=COUPON`,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
uni.switchTab({
|
|
||||||
url: "/pages/navigation/search/searchPage",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
<!-- 消息 -->
|
<!-- 消息 -->
|
||||||
<view class="flex-column-start" v-if="msgList.length" v-for="(item, index) in msgList" :key="index">
|
<view class="flex-column-start" v-if="msgList.length" v-for="(item, index) in msgList" :key="index">
|
||||||
<view class="flex-row-start column-time">
|
<view class="flex-row-start column-time">
|
||||||
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text"
|
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 用户消息 头像可选加入-->
|
<!-- 用户消息 头像可选加入-->
|
||||||
|
@ -20,97 +19,103 @@
|
||||||
<view>
|
<view>
|
||||||
<view class="user-name">{{ user.nickName }}</view>
|
<view class="user-name">{{ user.nickName }}</view>
|
||||||
<view class="margin-left padding-chat bg-user-orang" style="border-radius: 35rpx; ">
|
<view class="margin-left padding-chat bg-user-orang" style="border-radius: 35rpx; ">
|
||||||
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
|
<text style="word-break: break-all;"
|
||||||
<!-- <view v-if="item.messageType == 'GOODS'">
|
v-if="item.messageType === 'MESSAGE' && !emojistwo.includes(item.text)">{{ item.text }}</text>
|
||||||
|
<view v-if="item.messageType === 'MESSAGE' && emojistwo.includes(item.text)"
|
||||||
|
v-html="textReplaceEmoji(item.text)"></view>
|
||||||
|
<view v-if="item.messageType == 'GOODS'">
|
||||||
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
||||||
<view class="imagebox" @click="jumpGoodDelic">
|
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||||
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||||
<view class="goodsdesc-name">
|
<view class="goodsdesc-name">
|
||||||
<text class="goodsCard_goodNmae">{{
|
<text class="goodsCard_goodNmae">{{
|
||||||
JSON.parse(item.text)['goodsName']
|
JSON.parse(item.text)['goodsName']
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
||||||
style="font-size:20rpx;">¥{{
|
style="font-size:20rpx;">¥{{
|
||||||
JSON.parse(item.text)['price']
|
JSON.parse(item.text)['price']
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view>
|
||||||
<!-- <view v-if="item.messageType === 'ORDER'">
|
<view v-if="item.messageType == 'ORDER'">
|
||||||
<view class="orderSn">
|
<view class="orderSn">
|
||||||
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
||||||
<view class="oederList">
|
<view class="oederList">
|
||||||
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
||||||
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
||||||
<view class="groupNameOrTime">
|
<view class="groupNameOrTime">
|
||||||
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
|
<text @click="linkTosOrders(item.text)">{{
|
||||||
}}</text>
|
JSON.parse(item.text)['groupName']
|
||||||
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
|
}}</text>
|
||||||
|
<view class="orderTime">
|
||||||
|
<text>{{ JSON.parse(item.text)['paymentTime'] }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<u-avatar :src="user.face" :text="user.face ? '' : user.name" bg-color="#DDDDDD"></u-avatar>
|
<u-avatar :src="user.face" :text="user.face ? '' : user.name" bg-color="#DDDDDD"></u-avatar>
|
||||||
<!-- <u-image class="chat-img margin-left" style="height: 100rpx;width: 100rpx;" shape="circle"
|
|
||||||
:src="user.face || 'https://avatars.dicebear.com/api/initials/' + user.nickName + '.svg?fontSize=38'"
|
|
||||||
mode="aspectFill"></u-image> -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 接收人消息 -->
|
<!-- 接收人消息 -->
|
||||||
<view v-else class="flex-row-start margin-left margin-top one-show">
|
<view v-else class="flex-row-start margin-left margin-top one-show">
|
||||||
<view class="chat-img flex-row-center">
|
<view class="chat-img flex-row-center">
|
||||||
<u-avatar :src="toUser.face" :text="toUser.face ? '' : toUser.name" bg-color="#DDDDDD"></u-avatar>
|
<u-avatar :src="toUser.face" :text="toUser.face ? '' : toUser.name" bg-color="#DDDDDD">
|
||||||
<!-- <u-image style="height: 100rpx;width: 100rpx;" shape="circle"
|
</u-avatar>
|
||||||
:src="toUser.face || 'https://avatars.dicebear.com/api/initials/' + toUser.name + '.svg?fontSize=38'"
|
|
||||||
mode="aspectFit"></u-image> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex" style="width: 500rpx;">
|
<view class="flex" style="width: 500rpx;">
|
||||||
<view>
|
<view>
|
||||||
<view class="other-name">{{ toUser.name }}</view>
|
<view class="other-name">{{ toUser.name }}</view>
|
||||||
<view class="margin-left padding-chat flex-column-start bg-to-color" style="border-radius: 35rpx;">
|
<view class="margin-left padding-chat flex-column-start bg-to-color" style="border-radius: 35rpx;">
|
||||||
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
|
<text style="word-break: break-all;"
|
||||||
|
v-if="item.messageType === 'MESSAGE' && !emojistwo.includes(item.text)">{{ item.text }}</text>
|
||||||
|
<view v-if="item.messageType === 'MESSAGE' && emojistwo.includes(item.text)"
|
||||||
|
v-html="textReplaceEmoji(item.text)"></view>
|
||||||
<view v-if="item.messageType === 'GOODS'">
|
<view v-if="item.messageType === 'GOODS'">
|
||||||
<!-- <view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
|
||||||
<view class="imagebox" @click="jumpGoodDelic">
|
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||||
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
<image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||||
<view class="goodsdesc-name">
|
<view class="goodsdesc-name">
|
||||||
<text class="goodsCard_goodNmae">{{
|
<text class="goodsCard_goodNmae">{{
|
||||||
JSON.parse(item.text)['goodsName']
|
JSON.parse(item.text)['goodsName']
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
|
||||||
style="font-size:20rpx;">¥{{
|
style="font-size:20rpx;">¥{{
|
||||||
JSON.parse(item.text)['price']
|
JSON.parse(item.text)['price']
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
<!-- <view v-if="item.messageType === 'ORDER'">
|
</view>
|
||||||
|
<view v-if="item.messageType === 'ORDER'">
|
||||||
<view class="orderSn">
|
<view class="orderSn">
|
||||||
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
<text>订单号:{{ JSON.parse(item.text)['sn'] }}</text>
|
||||||
<view class="oederList">
|
<view class="oederList">
|
||||||
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
|
||||||
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
|
||||||
<view class="groupNameOrTime">
|
<view class="groupNameOrTime">
|
||||||
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
|
<text @click="linkTosOrders(item.text)">{{
|
||||||
}}</text>
|
JSON.parse(item.text)['groupName']
|
||||||
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
|
}}</text>
|
||||||
|
<view class="orderTime">
|
||||||
|
<text>{{ JSON.parse(item.text)['paymentTime'] }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -122,18 +127,18 @@
|
||||||
:style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '50px' : '', width: msgList.length == 0 ? '100%' : '' }">
|
:style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '50px' : '', width: msgList.length == 0 ? '100%' : '' }">
|
||||||
<view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel">
|
<view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel">
|
||||||
<view class="goodsCard u-flex u-row-between u-p-b-0">
|
<view class="goodsCard u-flex u-row-between u-p-b-0">
|
||||||
<view class="imagebox" @click="jumpGoodDelic">
|
<view class="imagebox" @click="jumpGoodDelic(item)">
|
||||||
<image class="image" :src="goodListData.thumbnail" mode="widthFix"></image>
|
<image class="image" :src="goodListData.thumbnail" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc" @click="jumpGoodDelic">
|
<view class="goodsdesc" @click="jumpGoodDelic(item)">
|
||||||
<view class="goodsdesc-name">
|
<view class="goodsdesc-name">
|
||||||
<text class="goodsCard_goodNmae">{{
|
<text class="goodsCard_goodNmae">{{
|
||||||
goodListData.goodsName
|
goodListData.goodsName
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text style="font-size:20rpx;">¥{{
|
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text style="font-size:20rpx;">¥{{
|
||||||
goodListData.price
|
goodListData.price
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cancel" @click="cancelModel">X</view>
|
<view class="cancel" @click="cancelModel">X</view>
|
||||||
|
@ -151,9 +156,9 @@
|
||||||
<view class="flex" style="width: 500rpx;">
|
<view class="flex" style="width: 500rpx;">
|
||||||
<view class="margin-left padding-chat flex-column-start"
|
<view class="margin-left padding-chat flex-column-start"
|
||||||
style="border-radius: 35rpx;background-color: #f9f9f9;">
|
style="border-radius: 35rpx;background-color: #f9f9f9;">
|
||||||
<view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
|
<!-- <view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
|
||||||
|
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -194,20 +199,38 @@ var l
|
||||||
var wh
|
var wh
|
||||||
// 顶部空盒子的高度
|
// 顶部空盒子的高度
|
||||||
var mgUpHeight
|
var mgUpHeight
|
||||||
import { getTalkMessage, getTalkByUser, jumpObtain } from "@/api/im.js";
|
import {
|
||||||
|
getTalkMessage,
|
||||||
|
getTalkByUser,
|
||||||
|
jumpObtain
|
||||||
|
} from "@/api/im.js";
|
||||||
import SocketService from "@/utils/socket_service.js";
|
import SocketService from "@/utils/socket_service.js";
|
||||||
import storage from "@/utils/storage.js";
|
import storage from "@/utils/storage.js";
|
||||||
import { beautifyTime } from "@/utils/filters.js"
|
import {
|
||||||
|
beautifyTime
|
||||||
|
} from "@/utils/filters.js"
|
||||||
|
import config from '@/config/config.js'
|
||||||
|
import { textReplaceEmoji, emojistwo } from '@/utils/emojis.js';
|
||||||
export default {
|
export default {
|
||||||
// 页面卸载后清除imGoodId
|
// 页面卸载后清除imGoodId
|
||||||
onUnload () {
|
onUnload () {
|
||||||
storage.setImGoodsLink('')
|
// #ifdef H5
|
||||||
|
uni.setStorageSync("imGoodId", '');
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
if (this.socketOpen == true) {
|
||||||
|
uni.closeSocket();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onLoad (options) {
|
onLoad (options) {
|
||||||
|
console.log(5555555555555555);
|
||||||
|
console.log(emojistwo);
|
||||||
// 没有goodsid则不显示 发送商品弹窗
|
// 没有goodsid则不显示 发送商品弹窗
|
||||||
this.showHideModel = options.goodsid
|
this.showHideModel = options.goodsid
|
||||||
// 发送后刷新页面不显示 发送商品弹窗 local里面imGoodId不为空显示
|
// 发送后刷新页面不显示 发送商品弹窗 local里面imGoodId不为空显示
|
||||||
this.localImGoodsId = storage.getImGoodsLink()
|
// #ifdef H5
|
||||||
|
this.localImGoodsId = uni.getStorageSync("imGoodId");
|
||||||
|
// #endif
|
||||||
this.resolve = options
|
this.resolve = options
|
||||||
// 请求商品信息
|
// 请求商品信息
|
||||||
if (this.resolve.goodsid) {
|
if (this.resolve.goodsid) {
|
||||||
|
@ -249,8 +272,10 @@ export default {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ws.connect();
|
// this.ws.connect();
|
||||||
|
this.sokcet();
|
||||||
},
|
},
|
||||||
|
|
||||||
onPullDownRefresh () {
|
onPullDownRefresh () {
|
||||||
this.params.pageNumber = this.params.pageNumber + 1
|
this.params.pageNumber = this.params.pageNumber + 1
|
||||||
this.getTalkMessage()
|
this.getTalkMessage()
|
||||||
|
@ -261,6 +286,9 @@ export default {
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
textReplaceEmoji,
|
||||||
|
emojistwo,
|
||||||
|
socketOpen: false, //是否连接
|
||||||
storage,
|
storage,
|
||||||
fixed: 'fixed',
|
fixed: 'fixed',
|
||||||
bottom: '50px',
|
bottom: '50px',
|
||||||
|
@ -290,38 +318,54 @@ export default {
|
||||||
goodListData: {}
|
goodListData: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
// watch: {
|
||||||
'ws.callBackMapping': {
|
// 'ws.callBackMapping': {
|
||||||
handler: function (val) {
|
// handler: function (val) {
|
||||||
val = JSON.parse(val)
|
// val = JSON.parse(val)
|
||||||
if (val.messageResultType == 'MESSAGE') {
|
// if (val.messageResultType == 'MESSAGE') {
|
||||||
this.msgList.push(val.result)
|
// this.msgList.push(val.result)
|
||||||
}
|
// }
|
||||||
this.newMessageNum++;
|
// this.newMessageNum++;
|
||||||
//接收到消息后发送已读
|
// //接收到消息后发送已读
|
||||||
let msg = val
|
// let msg = val
|
||||||
msg.operation_type = 'READ'
|
// msg.operation_type = 'READ'
|
||||||
this.ws.send(JSON.stringify(msg))
|
// this.ws.send(JSON.stringify(msg))
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
beautifyTime,
|
sendMessage () {
|
||||||
//订单详情
|
if (this.msg == "") {
|
||||||
linkTosOrders (val) {
|
return 0;
|
||||||
console.log(val);
|
}
|
||||||
uni.navigateTo({
|
if (this.socketOpen == false) {
|
||||||
url: '/pages/order/orderDetail?sn=' + val,
|
return
|
||||||
|
}
|
||||||
|
let msg = {
|
||||||
|
operation_type: "MESSAGE",
|
||||||
|
to: this.toUser.userId,
|
||||||
|
from: this.user.id,
|
||||||
|
message_type: "MESSAGE",
|
||||||
|
context: this.msg,
|
||||||
|
talk_id: this.params.talkId,
|
||||||
|
}
|
||||||
|
let data = JSON.stringify(msg);
|
||||||
|
try {
|
||||||
|
uni.sendSocketMessage({
|
||||||
|
data: data
|
||||||
});
|
});
|
||||||
|
this.msgList.push({
|
||||||
|
"text": this.msg,
|
||||||
|
"my": true,
|
||||||
|
"messageType": 'MESSAGE'
|
||||||
|
})
|
||||||
|
let type = 'down';
|
||||||
|
this.msgGo(type)
|
||||||
|
this.msg = ""
|
||||||
|
} catch (e) {
|
||||||
|
uni.closeSocket();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 跳转商品详情页
|
|
||||||
jumpGoodDelic () {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/product/goods?id=${this.resolve.skuid}&goodsId=${this.resolve.goodsid}`,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
//发送商品
|
|
||||||
sendGoodsMessage () {
|
sendGoodsMessage () {
|
||||||
let msg = {
|
let msg = {
|
||||||
operation_type: "MESSAGE",
|
operation_type: "MESSAGE",
|
||||||
|
@ -331,19 +375,101 @@ export default {
|
||||||
context: this.goodListData,
|
context: this.goodListData,
|
||||||
talk_id: this.params.talkId,
|
talk_id: this.params.talkId,
|
||||||
}
|
}
|
||||||
this.ws.send(JSON.stringify(msg))
|
let data = JSON.stringify(msg);
|
||||||
this.msgList.push({ "text": JSON.stringify(this.goodListData), "my": true, "messageType": 'GOODS' })
|
uni.sendSocketMessage({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
this.msgList.push({
|
||||||
|
"text": JSON.stringify(this.goodListData),
|
||||||
|
"my": true,
|
||||||
|
"messageType": 'GOODS'
|
||||||
|
})
|
||||||
this.showHide = false
|
this.showHide = false
|
||||||
storage.setImGoodsLink(this.params.talkId)
|
// #ifdef H5
|
||||||
//成功发送商品连接后,滚动到底部
|
uni.setStorageSync("imGoodId", 1111111);
|
||||||
|
// #endif
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
uni.pageScrollTo({
|
uni.pageScrollTo({
|
||||||
scrollTop: 2000000,
|
scrollTop: 2000000,
|
||||||
duration: 0
|
duration: 300
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
sokcet () {
|
||||||
|
var _this = this;
|
||||||
|
uni.closeSocket();
|
||||||
|
this.socketOpen = false;
|
||||||
|
try {
|
||||||
|
//WebSocket的地址
|
||||||
|
var url = config.baseWsUrl + '/' + storage.getAccessToken();
|
||||||
|
// 连接
|
||||||
|
uni.connectSocket({
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
// 监听WebSocket连接已打开
|
||||||
|
uni.onSocketOpen(function (res) {
|
||||||
|
_this.socketOpen = true;
|
||||||
|
});
|
||||||
|
if (!this.socketOpen) {
|
||||||
|
// 监听连接失败
|
||||||
|
uni.onSocketError(function (err) {
|
||||||
|
let count = 0;
|
||||||
|
if (count < 3) {
|
||||||
|
if (err && err.code !== 1000) {
|
||||||
|
_this.socketOpen = true;
|
||||||
|
uni.connectSocket({
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
count = count + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 监听连接关闭
|
||||||
|
uni.onSocketClose(function (err) {
|
||||||
|
if (err && err.code !== 1000) {
|
||||||
|
setTimeout(function () {
|
||||||
|
_this.socketOpen = true;
|
||||||
|
uni.connectSocket({
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
}, 5 * 1000)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 监听收到信息
|
||||||
|
uni.onSocketMessage(function (res) {
|
||||||
|
console.log(res.data);
|
||||||
|
res.data = JSON.parse(res.data)
|
||||||
|
console.log(res.data.result);
|
||||||
|
if (res.data.messageResultType == 'MESSAGE') {
|
||||||
|
_this.msgList.push(res.data.result)
|
||||||
|
console.log(_this.msgList)
|
||||||
|
}
|
||||||
|
console.log(res.data)
|
||||||
|
_this.msgGo()
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
beautifyTime,
|
||||||
|
//订单详情
|
||||||
|
linkTosOrders (val) {
|
||||||
|
let order = JSON.parse(val)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/order/orderDetail?sn=' + order.sn,
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
// 跳转商品详情页
|
||||||
|
jumpGoodDelic (item) {
|
||||||
|
let info = JSON.parse(item.text)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/product/goods?id=${info.id}&goodsId=${info.goodsId}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
//取消发送
|
//取消发送
|
||||||
cancelModel () {
|
cancelModel () {
|
||||||
this.showHide = false
|
this.showHide = false
|
||||||
|
@ -423,30 +549,35 @@ export default {
|
||||||
// 这里应该传入问题的id,模拟就用index代替了
|
// 这里应该传入问题的id,模拟就用index代替了
|
||||||
|
|
||||||
},
|
},
|
||||||
sendMessage () {
|
// sendMessage() {
|
||||||
// 消息为空不做任何操作
|
// // 消息为空不做任何操作
|
||||||
if (this.msg == "") {
|
// if (this.msg == "") {
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
// 显示消息 msg消息文本,my鉴别是谁发的消息(不能用俩个消息数组循环,否则消息不会穿插)
|
// // 显示消息 msg消息文本,my鉴别是谁发的消息(不能用俩个消息数组循环,否则消息不会穿插)
|
||||||
let msg = {
|
// let msg = {
|
||||||
operation_type: "MESSAGE",
|
// operation_type: "MESSAGE",
|
||||||
to: this.toUser.userId,
|
// to: this.toUser.userId,
|
||||||
from: this.user.id,
|
// from: this.user.id,
|
||||||
message_type: "MESSAGE",
|
// message_type: "MESSAGE",
|
||||||
context: this.msg,
|
// context: this.msg,
|
||||||
talk_id: this.params.talkId,
|
// talk_id: this.params.talkId,
|
||||||
}
|
// }
|
||||||
this.ws.send(JSON.stringify(msg))
|
// this.ws.send(JSON.stringify(msg))
|
||||||
this.msgList.push({ "text": this.msg, "my": true, "messageType": 'MESSAGE' })
|
// this.msgList.push({
|
||||||
// 保证消息可见
|
// "text": this.msg,
|
||||||
let type = 'down';
|
// "my": true,
|
||||||
this.msgGo(type)
|
// "messageType": 'MESSAGE'
|
||||||
// 回答问题
|
// })
|
||||||
// this.msgKf(this.msg)
|
// console.log(this.msgList, 'this.msgListthis.msgListthis.msgListthis.msgListthis.msgList')
|
||||||
// 清除消息
|
// // 保证消息可见
|
||||||
this.msg = ""
|
// let type = 'down';
|
||||||
},
|
// this.msgGo(type)
|
||||||
|
// // 回答问题
|
||||||
|
// // this.msgKf(this.msg)
|
||||||
|
// // 清除消息
|
||||||
|
// this.msg = ""
|
||||||
|
// },
|
||||||
// msgKf(x) {
|
// msgKf(x) {
|
||||||
// // loading
|
// // loading
|
||||||
// // this.msgLoad = true
|
// // this.msgLoad = true
|
||||||
|
@ -503,7 +634,7 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log(this.msgList);
|
||||||
this.msgGo(type)
|
this.msgGo(type)
|
||||||
},
|
},
|
||||||
touchMoreMessage (e) {
|
touchMoreMessage (e) {
|
||||||
|
@ -534,8 +665,10 @@ export default {
|
||||||
if (this.msgList[index].is_revoke == 1) {
|
if (this.msgList[index].is_revoke == 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (datetime) {
|
||||||
datetime = datetime.replace(/-/g, "/");
|
datetime = datetime.replace(/-/g, "/");
|
||||||
|
}
|
||||||
|
|
||||||
let time = Math.floor(Date.parse(datetime) / 1000);
|
let time = Math.floor(Date.parse(datetime) / 1000);
|
||||||
let currTime = Math.floor(new Date().getTime() / 1000);
|
let currTime = Math.floor(new Date().getTime() / 1000);
|
||||||
|
|
||||||
|
@ -546,7 +679,7 @@ export default {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let nextDate
|
let nextDate
|
||||||
if (this.msgList[index + 1]) {
|
if (this.msgList[index + 1] && this.msgList[index + 1].createTime) {
|
||||||
nextDate = this.msgList[index + 1].createTime.replace(/-/g, "/");
|
nextDate = this.msgList[index + 1].createTime.replace(/-/g, "/");
|
||||||
if (nextDate - datetime < 300) return false;
|
if (nextDate - datetime < 300) return false;
|
||||||
}
|
}
|
||||||
|
@ -585,9 +718,9 @@ export default {
|
||||||
if (new RegExp("(" + k + ")").test(_format))
|
if (new RegExp("(" + k + ")").test(_format))
|
||||||
_format = _format.replace(
|
_format = _format.replace(
|
||||||
RegExp.$1,
|
RegExp.$1,
|
||||||
RegExp.$1.length === 1
|
RegExp.$1.length === 1 ?
|
||||||
? o[k]
|
o[k] :
|
||||||
: ("00" + o[k]).substr(("" + o[k]).length)
|
("00" + o[k]).substr(("" + o[k]).length)
|
||||||
);
|
);
|
||||||
return _format;
|
return _format;
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
import config from '@/config/config.js'
|
||||||
|
import storage from '@/utils/storage';
|
||||||
|
class socketIO {
|
||||||
|
constructor(data, time, url) {
|
||||||
|
this.socketTask = null
|
||||||
|
this.is_open_socket = false //避免重复连接
|
||||||
|
this.url = config.baseWsUrl + '/' + storage.getAccessToken() //连接地址
|
||||||
|
this.data = data ? data : null
|
||||||
|
this.connectNum = 1 // 重连次数
|
||||||
|
this.traderDetailIndex = 100 // traderDetailIndex ==2 重连
|
||||||
|
this.accountStateIndex = 100 // traderDetailIndex ==1 重连
|
||||||
|
this.followFlake = false // traderDetailIndex == true 重连
|
||||||
|
//心跳检测
|
||||||
|
this.timeout = time ? time : 15000 //多少秒执行检测
|
||||||
|
this.heartbeatInterval = null //检测服务器端是否还活着
|
||||||
|
this.reconnectTimeOut = null //重连之后多久再次重连
|
||||||
|
}
|
||||||
|
// 进入这个页面的时候创建websocket连接【整个页面随时使用】
|
||||||
|
connectSocketInit (data) {
|
||||||
|
this.data = data
|
||||||
|
this.socketTask = uni.connectSocket({
|
||||||
|
url: this.url,
|
||||||
|
success: () => {
|
||||||
|
console.log("正准备建立websocket中...");
|
||||||
|
// 返回实例
|
||||||
|
return this.socketTask
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.socketTask.onOpen((res) => {
|
||||||
|
this.connectNum = 1
|
||||||
|
console.log("WebSocket连接正常!");
|
||||||
|
this.send(data)
|
||||||
|
clearInterval(this.reconnectTimeOut)
|
||||||
|
clearInterval(this.heartbeatInterval)
|
||||||
|
this.is_open_socket = true;
|
||||||
|
this.start();
|
||||||
|
// 注:只有连接正常打开中 ,才能正常收到消息
|
||||||
|
this.socketTask.onMessage((e) => {
|
||||||
|
// 字符串转json
|
||||||
|
let res = JSON.parse(e.data);
|
||||||
|
console.log("res---------->", res) // 这里 查看 推送过来的消息
|
||||||
|
if (res.data) {
|
||||||
|
uni.$emit('getPositonsOrder', res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
// 监听连接失败,这里代码我注释掉的原因是因为如果服务器关闭后,和下面的onclose方法一起发起重连操作,这样会导致重复连接
|
||||||
|
uni.onSocketError((res) => {
|
||||||
|
console.log('WebSocket连接打开失败,请检查!');
|
||||||
|
this.socketTask = null
|
||||||
|
this.is_open_socket = false;
|
||||||
|
clearInterval(this.heartbeatInterval)
|
||||||
|
clearInterval(this.reconnectTimeOut)
|
||||||
|
uni.$off('getPositonsOrder')
|
||||||
|
if (this.connectNum < 6) {
|
||||||
|
uni.showToast({
|
||||||
|
title: `WebSocket连接失败,正尝试第${this.connectNum}次连接`,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
this.reconnect();
|
||||||
|
this.connectNum += 1
|
||||||
|
} else {
|
||||||
|
uni.$emit('connectError');
|
||||||
|
this.connectNum = 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 这里仅是事件监听【如果socket关闭了会执行】
|
||||||
|
this.socketTask.onClose(() => {
|
||||||
|
console.log("已经被关闭了-------")
|
||||||
|
clearInterval(this.heartbeatInterval)
|
||||||
|
clearInterval(this.reconnectTimeOut)
|
||||||
|
this.is_open_socket = false;
|
||||||
|
this.socketTask = null
|
||||||
|
uni.$off('getPositonsOrder')
|
||||||
|
if (this.connectNum < 6) {
|
||||||
|
this.reconnect();
|
||||||
|
} else {
|
||||||
|
uni.$emit('connectError');
|
||||||
|
this.connectNum = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 主动关闭socket连接
|
||||||
|
Close () {
|
||||||
|
if (!this.is_open_socket) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.socketTask.close({
|
||||||
|
success () {
|
||||||
|
uni.showToast({
|
||||||
|
title: 'SocketTask 关闭成功',
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//发送消息
|
||||||
|
send (data) {
|
||||||
|
console.log("data---------->", data);
|
||||||
|
// 注:只有连接正常打开中 ,才能正常成功发送消息
|
||||||
|
if (this.socketTask) {
|
||||||
|
this.socketTask.send({
|
||||||
|
data: JSON.stringify(data),
|
||||||
|
async success () {
|
||||||
|
console.log("消息发送成功");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//开启心跳检测
|
||||||
|
start () {
|
||||||
|
this.heartbeatInterval = setInterval(() => {
|
||||||
|
this.send({
|
||||||
|
"traderid": 10260,
|
||||||
|
"type": "Ping"
|
||||||
|
});
|
||||||
|
}, this.timeout)
|
||||||
|
}
|
||||||
|
//重新连接
|
||||||
|
reconnect () {
|
||||||
|
//停止发送心跳
|
||||||
|
clearInterval(this.heartbeatInterval)
|
||||||
|
//如果不是人为关闭的话,进行重连
|
||||||
|
if (!this.is_open_socket && (this.traderDetailIndex == 2 || this.accountStateIndex == 0 || this
|
||||||
|
.followFlake)) {
|
||||||
|
this.reconnectTimeOut = setInterval(() => {
|
||||||
|
this.connectSocketInit(this.data);
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description 将 scoket 数据进行过滤
|
||||||
|
* @param {array} array
|
||||||
|
* @param {string} type 区分 弹窗 openposition 分为跟随和我的
|
||||||
|
*/
|
||||||
|
arrayFilter (array, type = 'normal', signalId = 0) {
|
||||||
|
let arr1 = []
|
||||||
|
let arr2 = []
|
||||||
|
let obj = {
|
||||||
|
arr1: [],
|
||||||
|
arr2: []
|
||||||
|
}
|
||||||
|
arr1 = array.filter(v => v.flwsig == true)
|
||||||
|
arr2 = array.filter(v => v.flwsig == false)
|
||||||
|
if (type == 'normal') {
|
||||||
|
if (signalId) {
|
||||||
|
arr1 = array.filter(v => v.flwsig == true && v.sigtraderid == signalId)
|
||||||
|
return arr1
|
||||||
|
} else {
|
||||||
|
return arr1.concat(arr2)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (signalId > 0) {
|
||||||
|
arr1 = array.filter(v => v.flwsig == true && v.sigtraderid == signalId)
|
||||||
|
obj.arr1 = arr1
|
||||||
|
} else {
|
||||||
|
obj.arr1 = arr1
|
||||||
|
}
|
||||||
|
obj.arr2 = arr2
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
socketIO
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="person" @click="checkUserInfo()">
|
<view class="person" @click="checkUserInfo()">
|
||||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || '/static/missing-face.png'" mode="">
|
<u-image width=140 height="140" shape="circle" :src="userInfo.face || userImage" mode="">
|
||||||
</u-image>
|
</u-image>
|
||||||
<view class="user-name">
|
<view class="user-name">
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
config,
|
config,
|
||||||
|
userImage:config.defaultUserPhoto,
|
||||||
lightColor: this.$lightColor,
|
lightColor: this.$lightColor,
|
||||||
quitShow: false,
|
quitShow: false,
|
||||||
isCertificate: false,
|
isCertificate: false,
|
||||||
|
|
|
@ -1,39 +1,40 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<u-navbar :background="navObj" :is-back="false">
|
<u-navbar :background="navObj" :is-back="false">
|
||||||
<mSearch ref="mSearch" class="mSearch-input-box" @clickLeft="back" :mode="2" :placeholder="defaultKeyword"
|
<mSearch
|
||||||
@search="doSearch(false)" @confirm="doSearch(false)" @SwitchType="doSearchSwitch()" v-model="keyword"
|
ref="mSearch"
|
||||||
:isFocusVal="!isShowSeachGoods"></mSearch>
|
class="mSearch-input-box"
|
||||||
|
@clickLeft="back"
|
||||||
|
:mode="2"
|
||||||
|
:placeholder="defaultKeyword"
|
||||||
|
@search="doSearch(false)"
|
||||||
|
@confirm="doSearch(false)"
|
||||||
|
@SwitchType="doSearchSwitch()"
|
||||||
|
v-model="keyword"
|
||||||
|
:isFocusVal="!isShowSeachGoods"
|
||||||
|
></mSearch>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
|
|
||||||
<view class="search-keyword" v-if="!isShowSeachGoods">
|
<view class="search-keyword" v-if="!isShowSeachGoods">
|
||||||
<scroll-view class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
|
<scroll-view class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
|
||||||
<block v-for="(row, index) in keywordList" :key="index">
|
<block v-for="(row, index) in keywordList" :key="index">
|
||||||
<view class="keyword-entry" hover-class="keyword-entry-tap">
|
<view class="keyword-entry" hover-class="keyword-entry-tap">
|
||||||
<view class="keyword-text" @tap.stop="doSearch(keywordList[index].words)">
|
<view class="keyword-text" @tap.stop="doSearch(keywordList[index].words)"><rich-text :nodes="row.words"></rich-text></view>
|
||||||
<rich-text :nodes="row.words"></rich-text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<div class="keyword-box" v-show="!isShowKeywordList">
|
<div class="keyword-box" v-show="!isShowKeywordList">
|
||||||
<view class="keyword-block add1">
|
<view class="keyword-block add1">
|
||||||
<view class="keyword-list-header">
|
<view class="keyword-list-header"><view class="u-tips">热门搜索</view></view>
|
||||||
<view class="u-tips">热门搜索</view>
|
|
||||||
</view>
|
|
||||||
<view class="keyword keywordBox">
|
<view class="keyword keywordBox">
|
||||||
<view class="wes" v-for="(keyword, index) in hotKeywordList" @tap="doSearch(keyword)" :key="index">
|
<view class="wes" v-for="(keyword, index) in hotKeywordList" @tap="doSearch(keyword)" :key="index">{{ keyword }}</view>
|
||||||
{{ keyword }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="keyword-block" v-if="oldKeywordList.length > 0">
|
<view class="keyword-block" v-if="oldKeywordList.length > 0">
|
||||||
<view class="keyword-list-header">
|
<view class="keyword-list-header"><view class="u-tips">搜索历史</view></view>
|
||||||
<view class="u-tips">搜索历史</view>
|
|
||||||
</view>
|
|
||||||
<div class="oldKeyList">
|
<div class="oldKeyList">
|
||||||
<div class="oldKeyItem" v-if="keyword" v-for="(keyword, index) in oldKeywordList" :key="index"
|
<div class="oldKeyItem" v-if="keyword" v-for="(keyword, index) in oldKeywordList" :key="index" @click="doSearch(keyword)">
|
||||||
@click="doSearch(keyword)">
|
<span>{{ keyword }}</span>
|
||||||
<span>{{ keyword }} </span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div @click="showMore" v-if="oldKeywordIndex > loadIndex" class="oldKeyItem">展示更多</div>
|
<div @click="showMore" v-if="oldKeywordIndex > loadIndex" class="oldKeyItem">展示更多</div>
|
||||||
|
@ -51,13 +52,11 @@
|
||||||
<text>销量</text>
|
<text>销量</text>
|
||||||
<view class="p-box">
|
<view class="p-box">
|
||||||
<view class="index-nav-arrow">
|
<view class="index-nav-arrow">
|
||||||
<image class="img" src="/static/index/arrow-up-1.png"
|
<image class="img" src="/static/index/arrow-up-1.png" v-if="params.sort === 'buyCount' && params.order === 'asc'" mode="aspectFit"></image>
|
||||||
v-if="params.sort === 'buyCount' && params.order === 'asc'" mode="aspectFit"></image>
|
|
||||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="index-nav-arrow">
|
<view class="index-nav-arrow">
|
||||||
<image class="img" src="/static/index/arrow-down.png"
|
<image class="img" src="/static/index/arrow-down.png" v-if="params.sort === 'buyCount' && params.order === 'desc'" mode="aspectFit"></image>
|
||||||
v-if="params.sort === 'buyCount' && params.order === 'desc'" mode="aspectFit"></image>
|
|
||||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -66,13 +65,11 @@
|
||||||
<text>价格</text>
|
<text>价格</text>
|
||||||
<view class="p-box">
|
<view class="p-box">
|
||||||
<view class="index-nav-arrow">
|
<view class="index-nav-arrow">
|
||||||
<image class="img" src="/static/index/arrow-up-1.png"
|
<image class="img" src="/static/index/arrow-up-1.png" v-if="params.sort === 'price' && params.order === 'asc'" mode="aspectFit"></image>
|
||||||
v-if="params.sort === 'price' && params.order === 'asc'" mode="aspectFit"></image>
|
|
||||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="index-nav-arrow">
|
<view class="index-nav-arrow">
|
||||||
<image class="img" src="/static/index/arrow-down.png"
|
<image class="img" src="/static/index/arrow-down.png" v-if="params.sort === 'price' && params.order === 'desc'" mode="aspectFit"></image>
|
||||||
v-if="params.sort === 'price' && params.order === 'desc'" mode="aspectFit"></image>
|
|
||||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -81,20 +78,32 @@
|
||||||
</view>
|
</view>
|
||||||
<!-- 一行一个商品展示 -->
|
<!-- 一行一个商品展示 -->
|
||||||
<div v-if="isSWitch">
|
<div v-if="isSWitch">
|
||||||
<scroll-view :style="{ height: goodsHeight }" enableBackToTop="true" lower-threshold="250"
|
<scroll-view
|
||||||
@scrolltolower="loadmore()" scroll-with-animation scroll-y class="scoll-page">
|
:style="{ height: goodsHeight }"
|
||||||
<goodsList :res='goodsList' type='oneColumns' :keyword='keyword' />
|
enableBackToTop="true"
|
||||||
|
lower-threshold="250"
|
||||||
|
@scrolltolower="loadmore()"
|
||||||
|
scroll-with-animation
|
||||||
|
scroll-y
|
||||||
|
class="scoll-page"
|
||||||
|
>
|
||||||
|
<goodsList :res="goodsList" type="oneColumns" :keyword="keyword" />
|
||||||
<uni-load-more :status="loadingType" @loadmore="loadmore()"></uni-load-more>
|
<uni-load-more :status="loadingType" @loadmore="loadmore()"></uni-load-more>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</div>
|
</div>
|
||||||
<!-- 一行两个商品展示 -->
|
<!-- 一行两个商品展示 -->
|
||||||
<div v-if="
|
<div v-if="!isSWitch && !(goodsList == [] || goodsList == '' || goodsList == null)">
|
||||||
!isSWitch &&
|
<scroll-view
|
||||||
!(goodsList == [] || goodsList == '' || goodsList == null)
|
:style="{ height: goodsHeight }"
|
||||||
">
|
scroll-anchoring
|
||||||
<scroll-view :style="{ height: goodsHeight }" scroll-anchoring enableBackToTop="true"
|
enableBackToTop="true"
|
||||||
@scrolltolower="loadmore()" scroll-with-animation scroll-y lower-threshold="250" class="scoll-page">
|
@scrolltolower="loadmore()"
|
||||||
<goodsList :res='goodsList' :keyword='keyword' />
|
scroll-with-animation
|
||||||
|
scroll-y
|
||||||
|
lower-threshold="250"
|
||||||
|
class="scoll-page"
|
||||||
|
>
|
||||||
|
<goodsList :res="goodsList" :keyword="keyword" />
|
||||||
<uni-load-more :status="loadingType"></uni-load-more>
|
<uni-load-more :status="loadingType"></uni-load-more>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</div>
|
</div>
|
||||||
|
@ -105,13 +114,15 @@
|
||||||
<view class="sort-box ">
|
<view class="sort-box ">
|
||||||
<view class="sort-list">
|
<view class="sort-list">
|
||||||
<view class="sort-item">
|
<view class="sort-item">
|
||||||
<view class="sort-title"> 品牌 </view>
|
<view class="sort-title">品牌</view>
|
||||||
<view class="flex" v-if="sortData.brands">
|
<view class="flex" v-if="sortData.brands">
|
||||||
<view class="sort-brand-item" :key="brandsIndex" v-for="(brand, brandsIndex) in sortData.brands"
|
<view class="sort-brand-item" :key="brandsIndex" v-for="(brand, brandsIndex) in sortData.brands" @click="handleSort(brand, brandsIndex, 'brand')">
|
||||||
@click="handleSort(brand, brandsIndex, 'brand')">
|
<view
|
||||||
<view class="sort-radius" :class="{
|
class="sort-radius"
|
||||||
'sort-active': brand.__selected,
|
:class="{
|
||||||
}">
|
'sort-active': brand.__selected
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ brand.name }}
|
{{ brand.name }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -119,14 +130,20 @@
|
||||||
<!-- <u-empty v-else text="暂无品牌" mode="list"></u-empty> -->
|
<!-- <u-empty v-else text="暂无品牌" mode="list"></u-empty> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="sort-item">
|
<view class="sort-item">
|
||||||
<view class="sort-title"> 全部分类 </view>
|
<view class="sort-title">全部分类</view>
|
||||||
<view class="flex" style="flex-wrap: wrap;" v-if="sortData.categories">
|
<view class="flex" style="flex-wrap: wrap;" v-if="sortData.categories">
|
||||||
<view class="sort-brand-item" :key="categoriesIndex"
|
<view
|
||||||
|
class="sort-brand-item"
|
||||||
|
:key="categoriesIndex"
|
||||||
v-for="(categoryId, categoriesIndex) in sortData.categories"
|
v-for="(categoryId, categoriesIndex) in sortData.categories"
|
||||||
@click="handleSort(categoryId, categoriesIndex, 'categoryId')">
|
@click="handleSort(categoryId, categoriesIndex, 'categoryId')"
|
||||||
<view class="sort-radius" :class="{
|
>
|
||||||
'sort-active': categoryId.__selected,
|
<view
|
||||||
}">
|
class="sort-radius"
|
||||||
|
:class="{
|
||||||
|
'sort-active': categoryId.__selected
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ categoryId.name }}
|
{{ categoryId.name }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -136,18 +153,14 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="sort-list">
|
<view class="sort-list">
|
||||||
<view class="sort-item">
|
<view class="sort-item">
|
||||||
<view class="sort-title"> 价格区间 </view>
|
<view class="sort-title">价格区间</view>
|
||||||
<view style="display:flex; margin-top:20rpx; align-items: center;">
|
<view style="display:flex; margin-top:20rpx; align-items: center;">
|
||||||
<view class="sort-brand-item uinput">
|
<view class="sort-brand-item uinput">
|
||||||
<view class="sort-radius">
|
<view class="sort-radius"><u-input v-model="minPrice" type="number" placeholder="最低价" input-align="center" /></view>
|
||||||
<u-input v-model="minPrice" type="number" placeholder="最低价" input-align="center" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view>-</view>
|
<view>-</view>
|
||||||
<view class="sort-brand-item uinput">
|
<view class="sort-brand-item uinput">
|
||||||
<view class="sort-radius">
|
<view class="sort-radius"><u-input v-model="maxPrice" type="number" placeholder="最高价" input-align="center" /></view>
|
||||||
<u-input v-model="maxPrice" type="number" placeholder="最高价" input-align="center" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -155,13 +168,15 @@
|
||||||
|
|
||||||
<view class="sort-list" v-if="sortData.paramOptions">
|
<view class="sort-list" v-if="sortData.paramOptions">
|
||||||
<view class="sort-item" :key="paramIndex" v-for="(param, paramIndex) in sortData.paramOptions">
|
<view class="sort-item" :key="paramIndex" v-for="(param, paramIndex) in sortData.paramOptions">
|
||||||
<view class="sort-title"> {{ param.key }} </view>
|
<view class="sort-title">{{ param.key }}</view>
|
||||||
<view class="flex" style="flex-warp:warp" v-if="param.values">
|
<view class="flex" style="flex-warp:warp" v-if="param.values">
|
||||||
<view class="sort-brand-item" :key="i" v-for="(value, i) in param.values"
|
<view class="sort-brand-item" :key="i" v-for="(value, i) in param.values" @click="handleSort(value, i, 'prop', param)">
|
||||||
@click="handleSort(value, i, 'prop', param)">
|
<view
|
||||||
<view class="sort-radius" :class="{
|
class="sort-radius"
|
||||||
'sort-active': value.__selected,
|
:class="{
|
||||||
}">
|
'sort-active': value.__selected
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ value.title }}
|
{{ value.title }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -177,11 +192,7 @@
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<div class="empty" v-if="empty">
|
<div class="empty" v-if="empty">
|
||||||
<view>
|
<view><image style="width: 320rpx; height: 240rpx" src="/static/nodata.png"></image></view>
|
||||||
<image style="width: 320rpx; height: 240rpx" src="/static/nodata.png">
|
|
||||||
|
|
||||||
</image>
|
|
||||||
</view>
|
|
||||||
<view>
|
<view>
|
||||||
<p>没有找到相关的商品信息</p>
|
<p>没有找到相关的商品信息</p>
|
||||||
<p>请换一个关键词试试吧</p>
|
<p>请换一个关键词试试吧</p>
|
||||||
|
@ -192,49 +203,49 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getGoodsList, getGoodsRelated } from "@/api/goods.js";
|
import { getGoodsList, getGoodsRelated } from '@/api/goods.js';
|
||||||
import goodsList from '@/components/m-goods-list/list.vue'
|
import goodsList from '@/components/m-goods-list/list.vue';
|
||||||
import { getHotKeywords } from "@/api/home.js";
|
import { getHotKeywords } from '@/api/home.js';
|
||||||
import mSearch from "@/components/m-search-revision/m-search-revision.vue";
|
import mSearch from '@/components/m-search-revision/m-search-revision.vue';
|
||||||
import storage from "@/utils/storage";
|
import storage from '@/utils/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
empty:false,
|
empty: false,
|
||||||
scrollTop: 0,
|
scrollTop: 0,
|
||||||
loadIndex: 10,
|
loadIndex: 10,
|
||||||
oldKeywordIndex: 0,
|
oldKeywordIndex: 0,
|
||||||
selectedWay: {
|
selectedWay: {
|
||||||
brand: [],
|
brand: [],
|
||||||
categoryId: [],
|
categoryId: [],
|
||||||
prop: [],
|
prop: []
|
||||||
},
|
},
|
||||||
|
|
||||||
sortPopup: false, //筛选的开关
|
sortPopup: false, //筛选的开关
|
||||||
navObj: {
|
navObj: {
|
||||||
background: "#fff",
|
background: '#fff'
|
||||||
},
|
},
|
||||||
typeSortData: {
|
typeSortData: {
|
||||||
type: "",
|
type: '',
|
||||||
index: "",
|
index: ''
|
||||||
},
|
},
|
||||||
goodsHeight: "",
|
goodsHeight: '',
|
||||||
defaultKeyword: "",
|
defaultKeyword: '',
|
||||||
keyword: "",
|
keyword: '',
|
||||||
oldKeywordList: [],
|
oldKeywordList: [],
|
||||||
hotKeywordList: [],
|
hotKeywordList: [],
|
||||||
keywordList: [],
|
keywordList: [],
|
||||||
goodsList: [],
|
goodsList: [],
|
||||||
|
|
||||||
cateMaskState: 0, //分类面板展开状态
|
cateMaskState: 0, //分类面板展开状态
|
||||||
loadingType: "more", //加载更多状态
|
loadingType: 'more', //加载更多状态
|
||||||
filterIndex: 0,
|
filterIndex: 0,
|
||||||
cateId: 0, //已选三级分类id
|
cateId: 0, //已选三级分类id
|
||||||
priceOrder: 0, //1 价格从低到高 2价格从高到低
|
priceOrder: 0, //1 价格从低到高 2价格从高到低
|
||||||
cateList: [],
|
cateList: [],
|
||||||
isShowSeachGoods: false,
|
isShowSeachGoods: false,
|
||||||
isShowKeywordList: false,
|
isShowKeywordList: false,
|
||||||
sortData: "",
|
sortData: '',
|
||||||
isSWitch: false,
|
isSWitch: false,
|
||||||
|
|
||||||
params: {
|
params: {
|
||||||
|
@ -242,10 +253,10 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
// sort: 'grade_asc',
|
// sort: 'grade_asc',
|
||||||
|
|
||||||
keyword: "",
|
keyword: ''
|
||||||
},
|
},
|
||||||
minPrice: "",
|
minPrice: '',
|
||||||
maxPrice: "",
|
maxPrice: '',
|
||||||
sortParams: {
|
sortParams: {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -253,10 +264,10 @@ export default {
|
||||||
// price: "", //价格,示例值(10_30)
|
// price: "", //价格,示例值(10_30)
|
||||||
// prop: "", //属性:参数名_参数值@参数名_参数值,示例值(屏幕类型_LED@屏幕尺寸_15英寸)
|
// prop: "", //属性:参数名_参数值@参数名_参数值,示例值(屏幕类型_LED@屏幕尺寸_15英寸)
|
||||||
// brandId:"", //品牌,可以多选 品牌Id@品牌Id@品牌Id
|
// brandId:"", //品牌,可以多选 品牌Id@品牌Id@品牌Id
|
||||||
categoryId: "",
|
categoryId: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
routerVal: "",
|
routerVal: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -276,9 +287,9 @@ export default {
|
||||||
this.params.categoryId = this.routerVal.category;
|
this.params.categoryId = this.routerVal.category;
|
||||||
this.sortParams.categoryId = this.routerVal.category;
|
this.sortParams.categoryId = this.routerVal.category;
|
||||||
this.isShowSeachGoods = true;
|
this.isShowSeachGoods = true;
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
this.$refs.mSearch.isShowSeachGoods = true;
|
this.$refs.mSearch.isShowSeachGoods = true;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (this.routerVal.keyword) {
|
if (this.routerVal.keyword) {
|
||||||
this.params.keyword = this.routerVal.keyword;
|
this.params.keyword = this.routerVal.keyword;
|
||||||
|
@ -288,6 +299,14 @@ export default {
|
||||||
this.params.storeId = this.routerVal.storeId;
|
this.params.storeId = this.routerVal.storeId;
|
||||||
this.isShowSeachGoods = true;
|
this.isShowSeachGoods = true;
|
||||||
}
|
}
|
||||||
|
if (this.routerVal.promotionType) {
|
||||||
|
this.params.promotionType = this.routerVal.promotionType;
|
||||||
|
this.isShowSeachGoods = true;
|
||||||
|
}
|
||||||
|
if (this.routerVal.promotionsId) {
|
||||||
|
this.params.promotionsId = this.routerVal.promotionsId;
|
||||||
|
this.isShowSeachGoods = true;
|
||||||
|
}
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -304,15 +323,14 @@ export default {
|
||||||
this.defaultKeyword = val;
|
this.defaultKeyword = val;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.defaultKeyword = "请输入搜索商品";
|
this.defaultKeyword = '请输入搜索商品';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortPopup(val) {
|
sortPopup(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.selectedWay = { brand: [], categoryId: [], prop: [] };
|
this.selectedWay = { brand: [], categoryId: [], prop: [] };
|
||||||
console.log(this.selectedWay);
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
@ -327,34 +345,30 @@ export default {
|
||||||
let navHeight = 0;
|
let navHeight = 0;
|
||||||
|
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
// res - 各种参数
|
// res - 各种参数
|
||||||
|
|
||||||
let top = uni.createSelectorQuery().select(".u-navbar");
|
let top = uni.createSelectorQuery().select('.u-navbar');
|
||||||
top
|
top.boundingClientRect(function(data) {
|
||||||
.boundingClientRect(function (data) {
|
|
||||||
if (data && data.height) {
|
if (data && data.height) {
|
||||||
//data - 各种参数
|
//data - 各种参数
|
||||||
topHeight = data.height; // 获取元素宽度
|
topHeight = data.height; // 获取元素宽度
|
||||||
}
|
}
|
||||||
})
|
}).exec();
|
||||||
.exec();
|
let nav = uni.createSelectorQuery().select('.navbar');
|
||||||
let nav = uni.createSelectorQuery().select(".navbar");
|
nav.boundingClientRect(function(data) {
|
||||||
nav
|
|
||||||
.boundingClientRect(function (data) {
|
|
||||||
if (data && data.height) {
|
if (data && data.height) {
|
||||||
//data - 各种参数
|
//data - 各种参数
|
||||||
navHeight = data.height; // 获取元素宽度
|
navHeight = data.height; // 获取元素宽度
|
||||||
}
|
}
|
||||||
})
|
}).exec();
|
||||||
.exec();
|
}
|
||||||
},
|
|
||||||
});
|
});
|
||||||
this.goodsHeight = windowHeight - navHeight - topHeight;
|
this.goodsHeight = windowHeight - navHeight - topHeight;
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
this.goodsHeight = this.goodsHeight - 100;
|
this.goodsHeight = this.goodsHeight - 100;
|
||||||
// #endif
|
// #endif
|
||||||
this.goodsHeight += "px";
|
this.goodsHeight += 'px';
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -362,9 +376,9 @@ export default {
|
||||||
getPromotion(item) {
|
getPromotion(item) {
|
||||||
if (item.promotionMap) {
|
if (item.promotionMap) {
|
||||||
let array = [];
|
let array = [];
|
||||||
Object.keys(item.promotionMap).forEach((child) => {
|
Object.keys(item.promotionMap).forEach(child => {
|
||||||
if (!array.includes(child.split("-")[0])) {
|
if (!array.includes(child.split('-')[0])) {
|
||||||
array.push(child.split("-")[0]);
|
array.push(child.split('-')[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -386,18 +400,17 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果选中品牌 赋值
|
// 如果选中品牌 赋值
|
||||||
this.selectedWay["brand"].forEach((item) => {
|
this.selectedWay['brand'].forEach(item => {
|
||||||
if (item.__selected) {
|
if (item.__selected) {
|
||||||
this.params.brandId.push(item.value);
|
this.params.brandId.push(item.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.params.brandId = this.params.brandId.join("@") || "";
|
this.params.brandId = this.params.brandId.join('@') || '';
|
||||||
|
|
||||||
console.log(this.params.brandId);
|
|
||||||
// 处理分类 (单选)
|
// 处理分类 (单选)
|
||||||
if (this.selectedWay["categoryId"][0]) {
|
if (this.selectedWay['categoryId'][0]) {
|
||||||
this.params.categoryId = this.selectedWay["categoryId"][0].value;
|
this.params.categoryId = this.selectedWay['categoryId'][0].value;
|
||||||
}
|
}
|
||||||
if (!this.params.prop) {
|
if (!this.params.prop) {
|
||||||
this.params.prop = [];
|
this.params.prop = [];
|
||||||
|
@ -405,12 +418,12 @@ export default {
|
||||||
this.params.prop = [this.params.prop];
|
this.params.prop = [this.params.prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedWay["prop"].forEach((item) => {
|
this.selectedWay['prop'].forEach(item => {
|
||||||
if (item.__selected) {
|
if (item.__selected) {
|
||||||
this.params.prop.push(`${item.parent}_${item.title}`);
|
this.params.prop.push(`${item.parent}_${item.title}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.params.prop = this.params.prop.join("@");
|
this.params.prop = this.params.prop.join('@');
|
||||||
// 处理价格
|
// 处理价格
|
||||||
if (this.minPrice || this.maxPrice) {
|
if (this.minPrice || this.maxPrice) {
|
||||||
this.params.price = `${this.minPrice}_${this.maxPrice}`;
|
this.params.price = `${this.minPrice}_${this.maxPrice}`;
|
||||||
|
@ -423,7 +436,6 @@ export default {
|
||||||
this.params.pageNumber = 1;
|
this.params.pageNumber = 1;
|
||||||
this.sortParams = this.params;
|
this.sortParams = this.params;
|
||||||
|
|
||||||
|
|
||||||
this.loadData();
|
this.loadData();
|
||||||
this.sortPopup = false;
|
this.sortPopup = false;
|
||||||
},
|
},
|
||||||
|
@ -433,16 +445,16 @@ export default {
|
||||||
this.sortParams = {
|
this.sortParams = {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
categoryId: this.routerVal.category || "",
|
categoryId: this.routerVal.category || ''
|
||||||
};
|
};
|
||||||
this.sortPopup = false;
|
this.sortPopup = false;
|
||||||
this.initSortGoods();
|
this.initSortGoods();
|
||||||
this.minPrice = "";
|
this.minPrice = '';
|
||||||
this.maxPrice = "";
|
this.maxPrice = '';
|
||||||
this.params = {
|
this.params = {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
categoryId: this.routerVal.category || "",
|
categoryId: this.routerVal.category || ''
|
||||||
};
|
};
|
||||||
this.goodsList = [];
|
this.goodsList = [];
|
||||||
this.loadData();
|
this.loadData();
|
||||||
|
@ -450,12 +462,12 @@ export default {
|
||||||
|
|
||||||
// 点击筛选的内容
|
// 点击筛选的内容
|
||||||
handleSort(val, index, type, parent) {
|
handleSort(val, index, type, parent) {
|
||||||
if (type == "prop") {
|
if (type == 'prop') {
|
||||||
val.parent = parent.key;
|
val.parent = parent.key;
|
||||||
}
|
}
|
||||||
this.selectedWay[type].push(val);
|
this.selectedWay[type].push(val);
|
||||||
if (type == "categoryId") {
|
if (type == 'categoryId') {
|
||||||
this.sortData.categories.forEach((item) => {
|
this.sortData.categories.forEach(item => {
|
||||||
item.__selected = false;
|
item.__selected = false;
|
||||||
});
|
});
|
||||||
val.__selected = true;
|
val.__selected = true;
|
||||||
|
@ -475,19 +487,19 @@ export default {
|
||||||
},
|
},
|
||||||
back() {
|
back() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 跳转到商品详情
|
// 跳转到商品详情
|
||||||
navigateToDetailPage(item) {
|
navigateToDetailPage(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
|
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 跳转地址
|
// 跳转地址
|
||||||
navigateToStoreDetailPage(item) {
|
navigateToStoreDetailPage(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/product/shopPage?id=${item.content.storeId}`,
|
url: `/pages/product/shopPage?id=${item.content.storeId}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadmore() {
|
loadmore() {
|
||||||
|
@ -495,17 +507,17 @@ export default {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
initSortGoods() {
|
initSortGoods() {
|
||||||
getGoodsRelated(this.sortParams).then((res) => {
|
getGoodsRelated(this.sortParams).then(res => {
|
||||||
if (res.data.success) {
|
if (res.data.success) {
|
||||||
for (let item of Object.keys(res.data.result)) {
|
for (let item of Object.keys(res.data.result)) {
|
||||||
res.data.result[item].forEach((child) => {
|
res.data.result[item].forEach(child => {
|
||||||
child.__selected = false;
|
child.__selected = false;
|
||||||
|
|
||||||
// 循环出和品牌分类一样的数据格式
|
// 循环出和品牌分类一样的数据格式
|
||||||
if (child.values) {
|
if (child.values) {
|
||||||
child.values = child.values.map((item) => ({
|
child.values = child.values.map(item => ({
|
||||||
title: item,
|
title: item,
|
||||||
__selected: false,
|
__selected: false
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -525,30 +537,28 @@ export default {
|
||||||
this.params.pageSize = 10;
|
this.params.pageSize = 10;
|
||||||
// this.params.order = "desc";
|
// this.params.order = "desc";
|
||||||
if (this.params.sort == type) {
|
if (this.params.sort == type) {
|
||||||
this.params.order == "asc"
|
this.params.order == 'asc' ? (this.params.order = 'desc') : (this.params.order = 'asc');
|
||||||
? (this.params.order = "desc")
|
|
||||||
: (this.params.order = "asc");
|
|
||||||
|
|
||||||
this.$set(this.params, "sort", type);
|
this.$set(this.params, 'sort', type);
|
||||||
} else {
|
} else {
|
||||||
this.params.order = "desc";
|
this.params.order = 'desc';
|
||||||
this.$set(this.params, "sort", type);
|
this.$set(this.params, 'sort', type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
this.params.sort = "releaseTime";
|
this.params.sort = 'releaseTime';
|
||||||
this.params.order = "desc";
|
this.params.order = 'desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.filterIndex = index;
|
this.filterIndex = index;
|
||||||
|
|
||||||
uni.pageScrollTo({
|
uni.pageScrollTo({
|
||||||
duration: 300,
|
duration: 300,
|
||||||
scrollTop: 0,
|
scrollTop: 0
|
||||||
});
|
});
|
||||||
this.loadData("refresh", 1);
|
this.loadData('refresh', 1);
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "正在加载",
|
title: '正在加载'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//加载默认搜索关键字
|
//加载默认搜索关键字
|
||||||
|
@ -561,21 +571,21 @@ export default {
|
||||||
//
|
//
|
||||||
this.defaultKeyword = this.hotKeywordList[0];
|
this.defaultKeyword = this.hotKeywordList[0];
|
||||||
} else {
|
} else {
|
||||||
this.defaultKeyword = "请输入搜索商品";
|
this.defaultKeyword = '请输入搜索商品';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//加载历史搜索,自动读取本地Storage
|
//加载历史搜索,自动读取本地Storage
|
||||||
loadOldKeyword(index) {
|
loadOldKeyword(index) {
|
||||||
this.oldKeywordList = [];
|
this.oldKeywordList = [];
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: "OldKeys",
|
key: 'OldKeys',
|
||||||
success: (res) => {
|
success: res => {
|
||||||
var OldKeys = JSON.parse(res.data);
|
var OldKeys = JSON.parse(res.data);
|
||||||
this.oldKeywordIndex = OldKeys.length;
|
this.oldKeywordIndex = OldKeys.length;
|
||||||
for (let i = 0; i < index; i++) {
|
for (let i = 0; i < index; i++) {
|
||||||
this.oldKeywordList.push(OldKeys[i]);
|
this.oldKeywordList.push(OldKeys[i]);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -586,27 +596,24 @@ export default {
|
||||||
*/
|
*/
|
||||||
async loadHotKeyword() {
|
async loadHotKeyword() {
|
||||||
this.hotKeywordList = [];
|
this.hotKeywordList = [];
|
||||||
if (
|
if (!storage.getHotWords().time || storage.getHotWords().time <= new Date().getTime() / 1000) {
|
||||||
!storage.getHotWords().time ||
|
|
||||||
storage.getHotWords().time <= new Date().getTime() / 1000
|
|
||||||
) {
|
|
||||||
// 没有缓存或者第一次进入请求接口保存缓存
|
// 没有缓存或者第一次进入请求接口保存缓存
|
||||||
let res = await getHotKeywords(10);
|
let res = await getHotKeywords(10);
|
||||||
let keywords = res.data.result;
|
let keywords = res.data.result;
|
||||||
|
|
||||||
keywords.forEach((item) => {
|
keywords.forEach(item => {
|
||||||
this.hotKeywordList.push(item);
|
this.hotKeywordList.push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
let hotData = {
|
let hotData = {
|
||||||
time: new Date().getTime() / 1000 + 30 * 5,
|
time: new Date().getTime() / 1000 + 30 * 5,
|
||||||
keywords: keywords,
|
keywords: keywords
|
||||||
};
|
};
|
||||||
storage.setHotWords(hotData);
|
storage.setHotWords(hotData);
|
||||||
} else {
|
} else {
|
||||||
let keywords = storage.getHotWords().keywords;
|
let keywords = storage.getHotWords().keywords;
|
||||||
|
|
||||||
keywords.forEach((item) => {
|
keywords.forEach(item => {
|
||||||
this.hotKeywordList.push(item);
|
this.hotKeywordList.push(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -614,18 +621,18 @@ export default {
|
||||||
},
|
},
|
||||||
//加载商品 ,带下拉刷新和上滑加载
|
//加载商品 ,带下拉刷新和上滑加载
|
||||||
async loadData(type, loading) {
|
async loadData(type, loading) {
|
||||||
this.loadingType = "loading";
|
this.loadingType = 'loading';
|
||||||
if (type == "refresh") {
|
if (type == 'refresh') {
|
||||||
this.goodsList = [];
|
this.goodsList = [];
|
||||||
}
|
}
|
||||||
//没有更多直接返回 #TODO
|
//没有更多直接返回 #TODO
|
||||||
let goodsList = await getGoodsList(this.params);
|
let goodsList = await getGoodsList(this.params);
|
||||||
|
|
||||||
if (goodsList.data.result.content.length < 10) {
|
if (goodsList.data.result.content.length < 10) {
|
||||||
this.loadingType = "noMore";
|
this.loadingType = 'noMore';
|
||||||
this.empty = true
|
this.empty = true;
|
||||||
} else {
|
} else {
|
||||||
this.empty = false
|
this.empty = false;
|
||||||
}
|
}
|
||||||
this.goodsList.push(...goodsList.data.result.content);
|
this.goodsList.push(...goodsList.data.result.content);
|
||||||
this.initSortGoods();
|
this.initSortGoods();
|
||||||
|
@ -639,14 +646,11 @@ export default {
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var row = keywords[i];
|
var row = keywords[i];
|
||||||
//定义高亮#9f9f9f
|
//定义高亮#9f9f9f
|
||||||
var html = row[0].replace(
|
var html = row[0].replace(keyword, "<span style='color: #9f9f9f;'>" + keyword + '</span>');
|
||||||
keyword,
|
html = '<div>' + html + '</div>';
|
||||||
"<span style='color: #9f9f9f;'>" + keyword + "</span>"
|
|
||||||
);
|
|
||||||
html = "<div>" + html + "</div>";
|
|
||||||
var tmpObj = {
|
var tmpObj = {
|
||||||
keyword: row[0],
|
keyword: row[0],
|
||||||
htmlStr: html,
|
htmlStr: html
|
||||||
};
|
};
|
||||||
keywordArr.push(tmpObj);
|
keywordArr.push(tmpObj);
|
||||||
}
|
}
|
||||||
|
@ -659,15 +663,15 @@ export default {
|
||||||
//清除历史搜索
|
//清除历史搜索
|
||||||
oldDelete() {
|
oldDelete() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: "确定清除历史搜索记录?",
|
content: '确定清除历史搜索记录?',
|
||||||
success: (res) => {
|
success: res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.oldKeywordList = [];
|
this.oldKeywordList = [];
|
||||||
uni.removeStorage({
|
uni.removeStorage({
|
||||||
key: "OldKeys",
|
key: 'OldKeys'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -675,9 +679,9 @@ export default {
|
||||||
doSearchSwitch() {
|
doSearchSwitch() {
|
||||||
this.isSWitch = !this.isSWitch;
|
this.isSWitch = !this.isSWitch;
|
||||||
this.isShowSeachGoods = true;
|
this.isShowSeachGoods = true;
|
||||||
this.params.pageNumber = 1
|
this.params.pageNumber = 1;
|
||||||
this.params.pageSize = 10
|
this.params.pageSize = 10;
|
||||||
this.loadData("refresh", 1);
|
this.loadData('refresh', 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -693,25 +697,25 @@ export default {
|
||||||
* 第一次搜索如果没有关键词会将热门搜索中第一个热词进行判定
|
* 第一次搜索如果没有关键词会将热门搜索中第一个热词进行判定
|
||||||
* 如果没有热词则会展示一个空词搜索
|
* 如果没有热词则会展示一个空词搜索
|
||||||
*/
|
*/
|
||||||
keyword = (this.hotKeywordList.length && this.hotKeywordList[0]) || "";
|
keyword = (this.hotKeywordList.length && this.hotKeywordList[0]) || '';
|
||||||
}
|
}
|
||||||
this.defaultKeyword == "请输入搜索商品" ? (keyword = "") : "";
|
this.defaultKeyword == '请输入搜索商品' ? (keyword = '') : '';
|
||||||
// this.keyword = keyword;
|
// this.keyword = keyword;
|
||||||
keyword ? (this.keyword = keyword) : "";
|
keyword ? (this.keyword = keyword) : '';
|
||||||
this.saveKeyword(keyword); //保存为历史
|
this.saveKeyword(keyword); //保存为历史
|
||||||
this.isShowSeachGoods = true;
|
this.isShowSeachGoods = true;
|
||||||
this.$refs.mSearch.isShowSeachGoods = true;
|
this.$refs.mSearch.isShowSeachGoods = true;
|
||||||
this.params.keyword = this.keyword;
|
this.params.keyword = this.keyword;
|
||||||
this.params.pageNumber = 1;
|
this.params.pageNumber = 1;
|
||||||
this.$set(this.sortParams, "keyword", keyword);
|
this.$set(this.sortParams, 'keyword', keyword);
|
||||||
this.loadData("refresh", 1);
|
this.loadData('refresh', 1);
|
||||||
},
|
},
|
||||||
//保存关键字到历史记录
|
//保存关键字到历史记录
|
||||||
saveKeyword(keyword) {
|
saveKeyword(keyword) {
|
||||||
if (!keyword) return false;
|
if (!keyword) return false;
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: "OldKeys",
|
key: 'OldKeys',
|
||||||
success: (res) => {
|
success: res => {
|
||||||
var OldKeys = JSON.parse(res.data);
|
var OldKeys = JSON.parse(res.data);
|
||||||
var findIndex = OldKeys.indexOf(keyword);
|
var findIndex = OldKeys.indexOf(keyword);
|
||||||
if (findIndex == -1) {
|
if (findIndex == -1) {
|
||||||
|
@ -724,24 +728,24 @@ export default {
|
||||||
OldKeys.length > 10 && OldKeys.pop();
|
OldKeys.length > 10 && OldKeys.pop();
|
||||||
|
|
||||||
uni.setStorage({
|
uni.setStorage({
|
||||||
key: "OldKeys",
|
key: 'OldKeys',
|
||||||
data: JSON.stringify(OldKeys),
|
data: JSON.stringify(OldKeys)
|
||||||
});
|
});
|
||||||
this.oldKeywordList = OldKeys; //更新历史搜索
|
this.oldKeywordList = OldKeys; //更新历史搜索
|
||||||
},
|
},
|
||||||
fail: (e) => {
|
fail: e => {
|
||||||
var OldKeys = [keyword];
|
var OldKeys = [keyword];
|
||||||
uni.setStorage({
|
uni.setStorage({
|
||||||
key: "OldKeys",
|
key: 'OldKeys',
|
||||||
data: JSON.stringify(OldKeys),
|
data: JSON.stringify(OldKeys)
|
||||||
});
|
});
|
||||||
this.oldKeywordList = OldKeys; //更新历史搜索
|
this.oldKeywordList = OldKeys; //更新历史搜索
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "./search.scss";
|
@import './search.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<view class="exaluate-member-view">
|
<view class="exaluate-member-view">
|
||||||
<view class="member-view">
|
<view class="member-view">
|
||||||
<view class="member-img">
|
<view class="member-img">
|
||||||
<u-image width="82rpx" style="border: 1px solid #ededed" height="82rpx" shape="circle" :src="comment.memberProfile || '/static/missing-face.png'"></u-image>
|
<u-image width="82rpx" style="border: 1px solid #ededed" height="82rpx" shape="circle" :src="comment.memberProfile || userImage"></u-image>
|
||||||
</view>
|
</view>
|
||||||
<view class="member-info">
|
<view class="member-info">
|
||||||
<view class="memName">{{ comment.memberName }}</view>
|
<view class="memName">{{ comment.memberName }}</view>
|
||||||
|
@ -41,9 +41,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import configs from '@/config/config'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
configs,
|
||||||
|
userImage:configs.defaultUserPhoto,
|
||||||
|
|
||||||
comment: {}, //评论信息
|
comment: {}, //评论信息
|
||||||
gradeList: {
|
gradeList: {
|
||||||
//评价grade
|
//评价grade
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<view class="group">
|
<view class="group">
|
||||||
<view>
|
<view>
|
||||||
<u-image borderRadius="50%" shape="square" class="head-img" width="81rpx" height="81rpx"
|
<u-image borderRadius="50%" shape="square" class="head-img" width="81rpx" height="81rpx"
|
||||||
:src="masterWay.face || '/static/missing-face.png'"></u-image>
|
:src="masterWay.face || userImage"></u-image>
|
||||||
<view class="btn-one">团长</view>
|
<view class="btn-one">团长</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"> </view>
|
<view class="line"> </view>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
<view slot="loading"></view>
|
<view slot="loading"></view>
|
||||||
</u-image>
|
</u-image>
|
||||||
<u-image class="head-img" borderRadius="50%" shape="square" v-else width="81rpx" height="81rpx"
|
<u-image class="head-img" borderRadius="50%" shape="square" v-else width="81rpx" height="81rpx"
|
||||||
:src="endWay.face || '/static/missing-face.png'"></u-image>
|
:src="endWay.face || userImage"></u-image>
|
||||||
|
|
||||||
<view class="wait">{{ endWay.nickname || "等待参团" }}</view>
|
<view class="wait">{{ endWay.nickname || "等待参团" }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -265,7 +265,7 @@ import * as API_Order from "@/api/order";
|
||||||
import invoices from "@/pages/order/invoice/setInvoice";
|
import invoices from "@/pages/order/invoice/setInvoice";
|
||||||
|
|
||||||
import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js";
|
import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js";
|
||||||
|
import configs from '@/config/config'
|
||||||
export default {
|
export default {
|
||||||
onLoad: function (val) {
|
onLoad: function (val) {
|
||||||
this.routerVal = val;
|
this.routerVal = val;
|
||||||
|
@ -277,6 +277,8 @@ export default {
|
||||||
watch: {},
|
watch: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
configs,
|
||||||
|
userImage:configs.defaultUserPhoto,
|
||||||
invoiceFlag: false, //开票开关
|
invoiceFlag: false, //开票开关
|
||||||
shippingText: "LOGISTICS",
|
shippingText: "LOGISTICS",
|
||||||
shippingFlag: false,
|
shippingFlag: false,
|
||||||
|
|
|
@ -343,7 +343,7 @@ export default {
|
||||||
this.orderGoodsList = order.orderItems;
|
this.orderGoodsList = order.orderItems;
|
||||||
this.orderDetail = res.data.result;
|
this.orderDetail = res.data.result;
|
||||||
if (this.order.deliveryMethod === 'LOGISTICS') {
|
if (this.order.deliveryMethod === 'LOGISTICS') {
|
||||||
this.loadLogistics()
|
this.loadLogistics(sn)
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
});
|
});
|
||||||
|
|
|
@ -564,6 +564,7 @@
|
||||||
*/
|
*/
|
||||||
storage.setUserInfo(user.data.result);
|
storage.setUserInfo(user.data.result);
|
||||||
storage.setHasLogin(true);
|
storage.setHasLogin(true);
|
||||||
|
storage.setAutoCp(0)
|
||||||
// 登录成功
|
// 登录成功
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "登录成功!",
|
title: "登录成功!",
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
<view class="eva-box" v-for="(item, index) in commDetail" :key="index">
|
<view class="eva-box" v-for="(item, index) in commDetail" :key="index">
|
||||||
<view class="section-info">
|
<view class="section-info">
|
||||||
<image class="portrait" :src="item.memberProfile || '/static/missing-face.png'" mode="aspectFill"></image>
|
<image class="portrait" :src="item.memberProfile || userImage" mode="aspectFill"></image>
|
||||||
<view class="star-content">
|
<view class="star-content">
|
||||||
<text class="name">{{ item.memberName | noPassByName }}</text>
|
<text class="name">{{ item.memberName | noPassByName }}</text>
|
||||||
<text class="time">{{ item.createTime }}</text>
|
<text class="time">{{ item.createTime }}</text>
|
||||||
|
@ -65,11 +65,13 @@
|
||||||
<script>
|
<script>
|
||||||
// import { getGoodsDetail } from '@/api/goods.js';
|
// import { getGoodsDetail } from '@/api/goods.js';
|
||||||
import * as membersApi from "@/api/members.js";
|
import * as membersApi from "@/api/members.js";
|
||||||
|
import configs from '@/config/config'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
configs,
|
||||||
status: "loadmore", //底部刷新状态
|
status: "loadmore", //底部刷新状态
|
||||||
|
userImage:configs.defaultUserPhoto,
|
||||||
commentDetail: "", //评价详情
|
commentDetail: "", //评价详情
|
||||||
selectIndex: "0", //检索条件
|
selectIndex: "0", //检索条件
|
||||||
params: { // 评论分页提交数据
|
params: { // 评论分页提交数据
|
||||||
|
|
|
@ -601,10 +601,10 @@ export default {
|
||||||
|
|
||||||
linkMsgDetail () {
|
linkMsgDetail () {
|
||||||
// lili 基础客服
|
// lili 基础客服
|
||||||
this.$options.filters.talkIm(this.storeDetail.storeId)
|
// this.$options.filters.talkIm(this.storeDetail.storeId)
|
||||||
// uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
|
url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
|
||||||
// });
|
});
|
||||||
|
|
||||||
// udesk 代码
|
// udesk 代码
|
||||||
// if (this.storeDetail.merchantEuid) {
|
// if (this.storeDetail.merchantEuid) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<view v-if="assembleOrder.length != 0">
|
<view v-if="assembleOrder.length != 0">
|
||||||
<view class="group-item" v-for="(order, index) in assembleOrder" :key="index">
|
<view class="group-item" v-for="(order, index) in assembleOrder" :key="index">
|
||||||
<view class="group-item-user">
|
<view class="group-item-user">
|
||||||
<u-image shape="circle" width="40px" height="40px" :src="order.face"></u-image>
|
<u-image shape="circle" width="40px" height="40px" :src="order.face || userImage"></u-image>
|
||||||
<span class="group-item-name">{{ order.nickName | noPassByName }}</span>
|
<span class="group-item-name">{{ order.nickName | noPassByName }}</span>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
|
@ -25,9 +25,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as API_Promotions from "@/api/promotions";
|
import * as API_Promotions from "@/api/promotions";
|
||||||
|
import configs from '@/config/config'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
configs,
|
||||||
|
userImage:configs.defaultUserPhoto,
|
||||||
|
|
||||||
customStyle: {
|
customStyle: {
|
||||||
background: this.$lightColor,
|
background: this.$lightColor,
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
|
|
|
@ -14,6 +14,14 @@ export default {
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.$refs.tpl.firstGetAuto();
|
||||||
|
},1000)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
},
|
},
|
||||||
onReachBottom(){
|
onReachBottom(){
|
||||||
// 给子级监听触底加载
|
// 给子级监听触底加载
|
||||||
|
|
|
@ -187,7 +187,6 @@ $w_94: 94%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
transition: 0.35s;
|
transition: 0.35s;
|
||||||
display: flex;
|
display: flex;
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
> .goods-item-title {
|
> .goods-item-title {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
<u-popup v-model="showCp" mode="center" width="550rpx" height="400px">
|
||||||
|
<view style="height:130rpx;">
|
||||||
|
<view style="width:200rpx;height:120rpx;float:left;line-height:120rpx;font-size:35rpx;color:#28A4F2;font-weight:600;margin-left:20rpx;">优惠券活动</view>
|
||||||
|
<view style="width:120rpx;height:120rpx;float:right;">
|
||||||
|
<image @click="showCp = false" src="/static/cpauto1.png" style="width:100%;height:100%;"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y="true" style="height: 620rpx;">
|
||||||
|
<!-- {{coupList}} -->
|
||||||
|
<view v-for="(item,index) in coupList" :key="index" >
|
||||||
|
<view class="grad1">
|
||||||
|
<view style="float:right;">
|
||||||
|
<view v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}折</view>
|
||||||
|
<view v-else>优惠金额:<span style="color:red;font-size:32rpx;">{{ item.price | unitPrice}}</span>元</view>
|
||||||
|
<view>满<span style="color:red;font-size:32rpx;">{{ item.consumeThreshold | unitPrice }}元</span>可用</view>
|
||||||
|
<view v-if="item.scopeType == 'ALL' && item.storeId == '0'">全平台</view>
|
||||||
|
<view v-if="item.scopeType == 'PORTION_GOODS_CATEGORY'">仅限品类</view>
|
||||||
|
<view v-else>{{ item.storeName == 'platform' ? '全平台' :item.storeName+'店铺' }}使用
|
||||||
|
</view>
|
||||||
|
<view v-if="item.endTime">有效期至:{{ item.endTime.split(" ")[0] }}</view>
|
||||||
|
</view>
|
||||||
|
<view style="color:white;font-size:28rpx;font-weight:500;float:left;writing-mode:vertical-rl;flex: auto;height:100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;" @click="showCp = false">
|
||||||
|
立即使用
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</u-popup>
|
||||||
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
||||||
<div v-for="(item, index) in pageData.list" :key="index">
|
<div v-for="(item, index) in pageData.list" :key="index">
|
||||||
<!-- 搜索栏,如果在楼层装修顶部则会自动浮动,否则不浮动 -->
|
<!-- 搜索栏,如果在楼层装修顶部则会自动浮动,否则不浮动 -->
|
||||||
|
@ -59,13 +91,19 @@ import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类
|
||||||
import { getFloorData } from "@/api/home"; //获取楼层装修接口
|
import { getFloorData } from "@/api/home"; //获取楼层装修接口
|
||||||
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
|
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
|
||||||
import config from "@/config/config";
|
import config from "@/config/config";
|
||||||
|
import {getAutoCoup} from "@/api/login"
|
||||||
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
|
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
|
||||||
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
|
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
|
||||||
|
import storage from "@/utils/storage.js";
|
||||||
|
// import {receiveCoupons} from "@/api/members"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
config,
|
config,
|
||||||
|
storage,
|
||||||
|
coupList:[],
|
||||||
|
showCp:false,
|
||||||
pageData: "", //楼层页面数据
|
pageData: "", //楼层页面数据
|
||||||
isIos: "",
|
isIos: "",
|
||||||
enableLoad: false, //触底加载 针对于商品模块
|
enableLoad: false, //触底加载 针对于商品模块
|
||||||
|
@ -98,9 +136,58 @@ export default {
|
||||||
// 小程序默认分享
|
// 小程序默认分享
|
||||||
uni.showShareMenu({ withShareTicket: true });
|
uni.showShareMenu({ withShareTicket: true });
|
||||||
// #endif
|
// #endif
|
||||||
|
this.firstGetAuto()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
firstGetAuto(){
|
||||||
|
// console.log(123123213)
|
||||||
|
let data = new Date()
|
||||||
|
let datas = data.getDate()
|
||||||
|
let huors = data.getHours()
|
||||||
|
let flagCoup = storage.getAutoCp()
|
||||||
|
console.log(flagCoup)
|
||||||
|
console.log(datas)
|
||||||
|
if(storage.getAutoCp() && storage.getAutoCp() != '' && storage.getAutoCp() != undefined && storage.getAutoCp() != null){
|
||||||
|
if(Number(datas) > Number(flagCoup)){
|
||||||
|
if(Number(huors) >= 6){
|
||||||
|
storage.setAutoCp(datas)
|
||||||
|
this.getAutoCp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getAutoCp()
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
getAutoCp(){
|
||||||
|
let data = new Date()
|
||||||
|
let datas = data.getDate()
|
||||||
|
getAutoCoup().then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
if(res.data.success){
|
||||||
|
this.coupList.push(...res.data.result)
|
||||||
|
if(this.coupList != ''){
|
||||||
|
this.showCp = true
|
||||||
|
}else{
|
||||||
|
this.showCp = false
|
||||||
|
}
|
||||||
|
storage.setAutoCp(datas)
|
||||||
|
let objs = {};
|
||||||
|
this.coupList = this.coupList.reduce((cur, next) => {
|
||||||
|
//对象去重
|
||||||
|
if (next.id != undefined) {
|
||||||
|
objs[next.id]
|
||||||
|
? ""
|
||||||
|
: (objs[next.id] = true && cur.push(next));
|
||||||
|
}
|
||||||
|
return cur;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// receiveCoupons(v){
|
||||||
|
|
||||||
|
// },
|
||||||
/**
|
/**
|
||||||
* 实例化首页数据楼层
|
* 实例化首页数据楼层
|
||||||
*/
|
*/
|
||||||
|
@ -234,4 +321,30 @@ export default {
|
||||||
.navbar-right {
|
.navbar-right {
|
||||||
padding: 0 16rpx 0 0;
|
padding: 0 16rpx 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grad1 {
|
||||||
|
width: 500rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) top left / 120rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom left /120rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right /380rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom right /380rpx 51% no-repeat;
|
||||||
|
filter: drop-shadow(6rpx 6rpx 6rpx rgba(0,0,0,.3));
|
||||||
|
margin: 30rpx auto;
|
||||||
|
padding-top: 2rpx;
|
||||||
|
padding-bottom: 10rpx;
|
||||||
|
padding-left: 38rpx;
|
||||||
|
padding-right: 30rpx;
|
||||||
|
}
|
||||||
|
// .grad2 {
|
||||||
|
// width: 100px;
|
||||||
|
// height: 120px;
|
||||||
|
// background:
|
||||||
|
// radial-gradient(circle at left bottom, transparent 10px, #28A4F2 0) top left /60px 30px no-repeat,
|
||||||
|
// radial-gradient(circle at right bottom, transparent 10px, #28A4F2 0) top right /60px 30px no-repeat,
|
||||||
|
// radial-gradient(circle at left top, transparent 10px, #EFEFF4 0) bottom left /60px 90px no-repeat,
|
||||||
|
// radial-gradient(circle at right top, transparent 10px, #EFEFF4 0) bottom right /60px 90px no-repeat;
|
||||||
|
// filter: drop-shadow(3rpx 3rpx 3rpx rgba(0,0,0,.3));
|
||||||
|
// }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="header" @click="userDetail">
|
<view class="header" @click="userDetail">
|
||||||
<view class="head-1">
|
<view class="head-1">
|
||||||
<image :src="userInfo.face || '/static/missing-face.png'"></image>
|
<image :src="userInfo.face || userImage"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="head-2" v-if="userInfo.id">
|
<view class="head-2" v-if="userInfo.id">
|
||||||
<view class="user-name">{{ userInfo.nickName }}</view>
|
<view class="user-name">{{ userInfo.nickName }}</view>
|
||||||
|
@ -78,12 +78,15 @@
|
||||||
import tool from "@/pages/tabbar/user/utils/tool.vue";
|
import tool from "@/pages/tabbar/user/utils/tool.vue";
|
||||||
import { getCouponsNum, getFootprintNum } from "@/api/members.js";
|
import { getCouponsNum, getFootprintNum } from "@/api/members.js";
|
||||||
import { getUserWallet } from "@/api/members";
|
import { getUserWallet } from "@/api/members";
|
||||||
|
import configs from '@/config/config'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tool,
|
tool,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
configs,
|
||||||
|
userImage:configs.defaultUserPhoto,
|
||||||
coverTransform: "translateY(0px)",
|
coverTransform: "translateY(0px)",
|
||||||
coverTransition: "0s",
|
coverTransition: "0s",
|
||||||
moving: false,
|
moving: false,
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 129 KiB |
|
@ -0,0 +1,145 @@
|
||||||
|
/**
|
||||||
|
* 动态表情
|
||||||
|
*/
|
||||||
|
const emojis = {
|
||||||
|
"[微笑]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/0.gif'>",
|
||||||
|
"[撇嘴]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/1.gif'>",
|
||||||
|
"[色]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/2.gif'>",
|
||||||
|
"[发呆]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/3.gif'>",
|
||||||
|
"[得意]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/4.gif'>",
|
||||||
|
"[流泪]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/5.gif'>",
|
||||||
|
"[害羞]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/6.gif'>",
|
||||||
|
"[闭嘴]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/7.gif'>",
|
||||||
|
"[睡]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/8.gif'>",
|
||||||
|
"[大哭]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/9.gif'>",
|
||||||
|
"[尴尬]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/10.gif'>",
|
||||||
|
"[发怒]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/11.gif'>",
|
||||||
|
"[调皮]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/12.gif'>",
|
||||||
|
"[呲牙]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/13.gif'>",
|
||||||
|
"[惊讶]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/14.gif'>",
|
||||||
|
"[难过]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/15.gif'>",
|
||||||
|
"[酷]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/16.gif'>",
|
||||||
|
"[冷汗]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/17.gif'>",
|
||||||
|
"[抓狂]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/18.gif'>",
|
||||||
|
"[吐]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/19.gif'>",
|
||||||
|
"[偷笑]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/20.gif'>",
|
||||||
|
"[可爱]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/21.gif'>",
|
||||||
|
"[白眼]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/22.gif'>",
|
||||||
|
"[傲慢]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/23.gif'>",
|
||||||
|
"[饥饿]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/24.gif'>",
|
||||||
|
"[困]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/25.gif'>",
|
||||||
|
"[惊恐]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/26.gif'>",
|
||||||
|
"[流汗]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/27.gif'>",
|
||||||
|
"[憨笑]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/28.gif'>",
|
||||||
|
"[大兵]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/29.gif'>",
|
||||||
|
"[奋斗]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/30.gif'>",
|
||||||
|
"[咒骂]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/31.gif'>",
|
||||||
|
"[疑问]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/32.gif'>",
|
||||||
|
"[嘘]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/33.gif'>",
|
||||||
|
"[晕]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/34.gif'>",
|
||||||
|
"[折磨]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/35.gif'>",
|
||||||
|
"[衰]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/36.gif'>",
|
||||||
|
"[骷髅]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/37.gif'>",
|
||||||
|
"[敲打]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/38.gif'>",
|
||||||
|
"[再见]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/39.gif'>",
|
||||||
|
"[擦汗]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/40.gif'>",
|
||||||
|
"[抠鼻]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/41.gif'>",
|
||||||
|
"[鼓掌]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/42.gif'>",
|
||||||
|
"[糗大了]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/43.gif'>",
|
||||||
|
"[坏笑]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/44.gif'>",
|
||||||
|
"[左哼哼]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/45.gif'>",
|
||||||
|
"[右哼哼]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/46.gif'>",
|
||||||
|
"[哈欠]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/47.gif'>",
|
||||||
|
"[鄙视]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/48.gif'>",
|
||||||
|
"[委屈]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/49.gif'>",
|
||||||
|
"[快哭了]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/50.gif'>",
|
||||||
|
"[阴险]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/51.gif'>",
|
||||||
|
"[亲亲]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/52.gif'>",
|
||||||
|
"[吓]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/53.gif'>",
|
||||||
|
"[可怜]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/54.gif'>",
|
||||||
|
"[菜刀]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/55.gif'>",
|
||||||
|
"[西瓜]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/56.gif'>",
|
||||||
|
"[啤酒]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/57.gif'>",
|
||||||
|
"[篮球]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/58.gif'>",
|
||||||
|
"[乒乓]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/59.gif'>",
|
||||||
|
"[咖啡]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/60.gif'>",
|
||||||
|
"[饭]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/61.gif'>",
|
||||||
|
"[猪头]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/62.gif'>",
|
||||||
|
"[玫瑰]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/63.gif'>",
|
||||||
|
"[凋谢]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/64.gif'>",
|
||||||
|
"[示爱]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/65.gif'>",
|
||||||
|
"[爱心]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/66.gif'>",
|
||||||
|
"[心碎]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/67.gif'>",
|
||||||
|
"[蛋糕]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/68.gif'>",
|
||||||
|
"[闪电]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/69.gif'>",
|
||||||
|
"[炸弹]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/70.gif'>",
|
||||||
|
"[刀]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/71.gif'>",
|
||||||
|
"[足球]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/72.gif'>",
|
||||||
|
"[瓢虫]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/73.gif'>",
|
||||||
|
"[便便]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/74.gif'>",
|
||||||
|
"[月亮]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/75.gif'>",
|
||||||
|
"[太阳]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/76.gif'>",
|
||||||
|
"[礼物]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/77.gif'>",
|
||||||
|
"[拥抱]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/78.gif'>",
|
||||||
|
"[强]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/79.gif'>",
|
||||||
|
"[弱]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/80.gif'>",
|
||||||
|
"[握手]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/81.gif'>",
|
||||||
|
"[胜利]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/82.gif'>",
|
||||||
|
"[抱拳]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/83.gif'>",
|
||||||
|
"[勾引]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/84.gif'>",
|
||||||
|
"[拳头]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/85.gif'>",
|
||||||
|
"[差劲]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/86.gif'>",
|
||||||
|
"[爱你]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/87.gif'>",
|
||||||
|
"[NO]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/88.gif'>",
|
||||||
|
"[OK]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/89.gif'>",
|
||||||
|
"[爱情]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/90.gif'>",
|
||||||
|
"[飞吻]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/91.gif'>",
|
||||||
|
"[跳跳]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/92.gif'>",
|
||||||
|
"[发抖]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/93.gif'>",
|
||||||
|
"[怄火]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/94.gif'>",
|
||||||
|
"[转圈]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/95.gif'>",
|
||||||
|
"[磕头]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/96.gif'>",
|
||||||
|
"[回头]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/97.gif'>",
|
||||||
|
"[跳绳]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/98.gif'>",
|
||||||
|
"[挥手]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/99.gif'>",
|
||||||
|
"[激动]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/100.gif'>",
|
||||||
|
"[街舞]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/101.gif'>",
|
||||||
|
"[献吻]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/102.gif'>",
|
||||||
|
"[左太极]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/103.gif'>",
|
||||||
|
"[右太极]": "<img src='https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/104.gif'>",
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 符号表情
|
||||||
|
*/
|
||||||
|
const symbol = [
|
||||||
|
"😠", "😩", "😲", "😞", "😵", "😰", "😒", "😍", "😤", "😜", "😝", "😋", "😘", "😚", "😷",
|
||||||
|
"😳", "😃", "😅", "😆", "😁", "😂", "😊", "☺", "😄", "😢",
|
||||||
|
"😭", "😨", "😣", "😡", "😌", "😖", "😔", "😱", "😪", "😏", "😓", "😥", "😫", "😉",
|
||||||
|
"✊", "✋", "✌", "👊", "👍", "☝", "👆", "👇", "👈", "👉",
|
||||||
|
"👋", "👏", "👌", "👎"
|
||||||
|
];
|
||||||
|
|
||||||
|
const emojisKeys = Object.keys(emojis);
|
||||||
|
|
||||||
|
export const emojiList = {
|
||||||
|
symbol,
|
||||||
|
emojis
|
||||||
|
}
|
||||||
|
|
||||||
|
const regEmoji = emojisKeys.map((value) => '|\\' + value).join('').replace('|', '')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 替换表情文字
|
||||||
|
*
|
||||||
|
* @param {String} content 需要替换的字符串
|
||||||
|
*/
|
||||||
|
export function textReplaceEmoji (content) {
|
||||||
|
if (!content) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return content.replace(new RegExp(`(${regEmoji})`, 'gi'), ($0, $1) => {
|
||||||
|
return emojis[$1];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export const emojistwo = Object.keys(emojis)
|
|
@ -6,7 +6,7 @@ export default class SocketService {
|
||||||
* 单例
|
* 单例
|
||||||
*/
|
*/
|
||||||
static instance = null;
|
static instance = null;
|
||||||
static get Instance() {
|
static get Instance () {
|
||||||
if (!this.instance) {
|
if (!this.instance) {
|
||||||
this.instance = new SocketService();
|
this.instance = new SocketService();
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ export default class SocketService {
|
||||||
connectRetryCount = 0;
|
connectRetryCount = 0;
|
||||||
|
|
||||||
// 定义连接服务器的方法
|
// 定义连接服务器的方法
|
||||||
connect() {
|
connect () {
|
||||||
// 连接服务器
|
// 连接服务器
|
||||||
if (!window.WebSocket) {
|
if (!window.WebSocket) {
|
||||||
return console.log("您的浏览器不支持WebSocket");
|
return console.log("您的浏览器不支持WebSocket");
|
||||||
}
|
}
|
||||||
this.ws = new WebSocket(config.baseWsUrl+'/'+storage.getAccessToken());
|
this.ws = new WebSocket(config.baseWsUrl + '/' + storage.getAccessToken());
|
||||||
// 连接成功的事件
|
// 连接成功的事件
|
||||||
this.ws.onopen = () => {
|
this.ws.onopen = () => {
|
||||||
console.log("连接服务端成功");
|
console.log("连接服务端成功");
|
||||||
|
@ -54,24 +54,23 @@ export default class SocketService {
|
||||||
};
|
};
|
||||||
// 得到服务端发送过来的数据
|
// 得到服务端发送过来的数据
|
||||||
this.ws.onmessage = (msg) => {
|
this.ws.onmessage = (msg) => {
|
||||||
// console.log(msg.data)
|
|
||||||
this.registerCallBack(msg.data);
|
this.registerCallBack(msg.data);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// 回调函数的注册
|
// 回调函数的注册
|
||||||
registerCallBack(callBack) {
|
registerCallBack (callBack) {
|
||||||
// console.log("回调函数的注册", callBack);
|
// console.log("回调函数的注册", callBack);
|
||||||
this.callBackMapping = callBack;
|
this.callBackMapping = callBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消某一个回调函数
|
// 取消某一个回调函数
|
||||||
unRegisterCallBack(callBack) {
|
unRegisterCallBack (callBack) {
|
||||||
console.log("取消某一个回调函数", callBack);
|
console.log("取消某一个回调函数", callBack);
|
||||||
this.callBackMapping = null;
|
this.callBackMapping = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送数据的方法
|
// 发送数据的方法
|
||||||
send(data) {
|
send (data) {
|
||||||
// 判断此时此刻有没有连接成功
|
// 判断此时此刻有没有连接成功
|
||||||
if (this.connected) {
|
if (this.connected) {
|
||||||
this.sendRetryCount = 0;
|
this.sendRetryCount = 0;
|
||||||
|
|
|
@ -10,6 +10,14 @@ const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
|
||||||
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
|
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
|
||||||
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
|
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
|
||||||
export default {
|
export default {
|
||||||
|
//写入自动发券
|
||||||
|
setAutoCp(val){
|
||||||
|
uni.setStorageSync('autoCp', val)
|
||||||
|
},
|
||||||
|
//获取自动发券时间
|
||||||
|
getAutoCp(){
|
||||||
|
return uni.getStorageSync('autoCp');
|
||||||
|
},
|
||||||
// 写入热门搜索时间戳
|
// 写入热门搜索时间戳
|
||||||
setHotWords(val) {
|
setHotWords(val) {
|
||||||
uni.setStorageSync("hotWords", val);
|
uni.setStorageSync("hotWords", val);
|
||||||
|
|
Loading…
Reference in New Issue