perf: 🎨 改善促销部分荣誉代码 封装为组件使用 更加便捷以及好看。 优化部分页面显示问题

删除部分原有的老样式  更新新版促销样式 页面更加好看 删除冗余代码 封装多种方法以及组件
master
lemon橪 2022-09-15 15:40:50 +08:00
parent 8c8522c68e
commit 1e9df74034
70 changed files with 721 additions and 814 deletions

View File

@ -189,7 +189,7 @@
url: path, url: path,
}); });
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: path, url: path,
}); });
} }
@ -214,7 +214,7 @@
url: `/${path}`, url: `/${path}`,
}); });
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: `/${path}`, url: `/${path}`,
}); });
} }

View File

@ -263,7 +263,7 @@
buy(data) { buy(data) {
API_trade.addToCart(data).then((res) => { API_trade.addToCart(data).then((res) => {
if (res.data.success) { if (res.data.success) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/order/fillorder?way=${ url: `/pages/order/fillorder?way=${
data.cartType data.cartType
}&addr=${""}&parentOrder=${encodeURIComponent( }&addr=${""}&parentOrder=${encodeURIComponent(
@ -314,7 +314,7 @@
API_trade.addToCart(data).then((res) => { API_trade.addToCart(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/order/fillorder?way=${data.cartType}&addr=${ url: `/pages/order/fillorder?way=${data.cartType}&addr=${
this.addr.id || "" this.addr.id || ""
}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`, }&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`,

View File

@ -0,0 +1,160 @@
<template>
<div>
<div v-for="(item, index) in res" :key="index" class="goods-row" @click="navigateToDetailPage(item)">
<div class="flex goods-col">
<div class="goods-img">
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.goodsImage || item.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-detail">
<div class="title clamp3">{{ item.goodsName }}</div>
<div class='flex flex-a-c flex-j-sb'>
<view class="price-box">
<!-- 秒杀 / 拼团 -->
<div class="price" v-if="!type && item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}
</div>
<!-- 砍价 -->
<div class="price" v-if="type && item.purchasePrice!=undefined">
最低
¥<span>{{ formatPrice(item.purchasePrice )[0] }} </span>.{{
formatPrice(item.purchasePrice )[1]
}}
</div>
</view>
<div>
<image class='buy' :src="buy"></image>
</div>
</div>
<div class='count-config' v-if="!type">
<span>即将恢复{{ item.originalPrice}}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import commonTpl from '@/components/m-goods-list/common'
export default {
data() {
return {
lightColor: this.$mainColor,
buy: require('@/static/buy.png')
}
},
mixins: [commonTpl],
props: {
//
res: {
type: Array,
default: () => {
return []
}
},
type:{
type:null,
default:""
}
},
methods: {
//
navigateToDetailPage(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.skuId}&goodsId=${item.goodsId}`,
});
},
}
}
</script>
<style lang='scss' scoped>
.buy {
width: 152rpx;
height: 108rpx;
}
.flex-j-sb {
width: 100%;
}
.goods-row {
background: #fff;
padding: 16rpx;
>.goods-col {
display: flex;
>.goods-img {
overflow: hidden;
flex: 4;
}
>.goods-detail {
flex: 7;
}
}
}
.goods-detail {
margin: 0 20rpx;
>.title {
font-size: $font-base;
color: $font-color-dark;
line-height: 1.5;
height: 84rpx;
padding: 10rpx 0 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.promotion {
margin-top: 4rpx;
display: flex;
div {
span {
font-size: 24rpx;
color: $light-color;
margin-right: 10rpx;
padding: 0 4rpx;
border-radius: 2rpx;
}
}
}
.count-config {
padding: 5rpx 0;
color: #666;
display: flex;
font-size: 24rpx;
letter-spacing:2rpx;
padding-left: 10rpx;
}
}
.price-box {
margin-top: 10rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10rpx;
font-size: 24rpx;
color: $font-color-light;
>.price {
font-size: 26rpx;
line-height: 1;
color: $main-color;
font-weight: bold;
/deep/ span:nth-of-type(1) {
font-size: 48rpx;
}
}
}
</style>

View File

@ -1,190 +0,0 @@
<template>
<div>
<div v-for="(item, index) in res" :key="index" class="goods-row">
<div class="flex goods-col">
<div class="goods-img" @click="navigateToDetailPage(item)">
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.goodsImage">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-detail">
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.goodsName }}</div>
<view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}
</div>
</view>
<div class="promotion" @click="navigateToDetailPage(item)">
<div v-if="item.salesModel == 'WHOLESALE'">
<span></span>
</div>
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
<span v-if="promotionItem.indexOf('COUPON') != -1"></span>
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1"></span>
<span v-if="promotionItem.indexOf('SECKILL') != -1"></span>
</div>
</div>
<div style="overflow: hidden" @click="navigateToDetailPage(item)" class="count-config">
<span style="float: left; font-size: 22rpx">已售 {{ item.buyCount || '0' }}</span>
<span style="float: right; font-size: 22rpx">{{ item.commentNum || '0' }}条评论</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import commonTpl from '@/components/m-goods-list/common'
export default {
data() {
return {
lightColor: this.$mainColor
}
},
mixins: [commonTpl],
props: {
//
res: {
type: Array,
default: () => {
return []
}
},
}
}
</script>
<style lang='scss' scoped>
.goods-list {
display: flex;
flex-wrap: wrap;
margin: 10rpx 20rpx 284rpx;
width: 100%;
>.goods-item {
background-color: #ffffff;
display: flex;
border-radius: 16rpx;
flex-direction: column;
width: calc(50% - 30rpx);
margin-bottom: 20rpx;
padding-bottom: 20rpx;
&:nth-child(2n + 1) {
margin-right: 20rpx;
}
.image-wrapper {
width: 100%;
height: 330rpx;
border-radius: 16rpx 16rpx 0 0;
overflow: hidden;
padding: 0;
}
}
.count-config,
.store-seller-name {
font-size: $font-sm;
}
.text-hidden {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.goods-row {
background: #fff;
padding: 16rpx;
>.goods-col {
display: flex;
>.goods-img {
overflow: hidden;
flex: 4;
}
>.goods-detail {
flex: 7;
}
}
}
.goods-detail {
margin: 0 20rpx;
>.title {
font-size: $font-base;
color: $font-color-dark;
line-height: 1.5;
height: 84rpx;
padding: 10rpx 0 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.promotion {
margin-top: 4rpx;
display: flex;
div {
span {
font-size: 24rpx;
color: $light-color;
margin-right: 10rpx;
padding: 0 4rpx;
border-radius: 2rpx;
}
}
}
.store-seller-name {
color: #666;
overflow: hidden;
display: flex;
justify-content: space-between;
}
.count-config {
padding: 5rpx 0;
color: #666;
display: flex;
font-size: 24rpx;
justify-content: space-between;
}
>.price-box {
margin-top: 10rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10rpx;
font-size: 24rpx;
color: $font-color-light;
>.price {
font-size: 26rpx;
line-height: 1;
color: $main-color;
font-weight: bold;
/deep/ span:nth-of-type(1) {
font-size: 38rpx;
}
}
}
}
</style>

View File

@ -62,7 +62,7 @@ export default {
this.goodsList.push(...goodsList.data.result.content); this.goodsList.push(...goodsList.data.result.content);
}, },
handleClick(item) { handleClick(item) {
this.$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}`,
}); });
}, },

View File

@ -4,14 +4,8 @@
*/ */
// 开发环境 // 开发环境
const dev = { const dev = {
// common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",
// buyer: "https://buyer-api.pickmall.cn", buyer: "https://buyer-api.pickmall.cn",
common: "http://192.168.0.106:8890",
buyer: "http://192.168.0.106:8888",
}; };
// 生产环境 // 生产环境
const prod = { const prod = {

View File

@ -3,7 +3,7 @@ import App from "./App";
import * as filters from "./utils/filters.js"; // global filter import * as filters from "./utils/filters.js"; // global filter
import uView from "uview-ui"; import uView from "uview-ui";
import store from "./store"; import store from "./store";
import {navigateTo} from '@/utils/navigateRoute.js'
/** /**
* 仅在h5中显示唤醒app功能 * 仅在h5中显示唤醒app功能
@ -32,8 +32,6 @@ Object.keys(filters).forEach((key) => {
Vue.prototype.$store = store; Vue.prototype.$store = store;
// // 引入Vuex
Vue.prototype.$navigateTo = navigateTo;
Vue.use(uView); Vue.use(uView);
Vue.config.productionTip = false; Vue.config.productionTip = false;

View File

@ -465,7 +465,9 @@
"pages": [ { "pages": [ {
"path": "seckill", "path": "seckill",
"style": { "style": {
"navigationBarTitleText": "限时抢购", "navigationBarTitleText": "限时抢购",
"navigationStyle": "custom", //
"navigationBarTextStyle": "white" ,
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"homeButton":true "homeButton":true
@ -478,7 +480,8 @@
"path": "joinGroup", "path": "joinGroup",
"style": { "style": {
"navigationBarTitleText": "拼团活动", "navigationBarTitleText": "拼团活动",
"navigationStyle": "custom", // "navigationStyle": "custom", //
"navigationBarTextStyle": "white" ,
"app-plus": { "app-plus": {
// //
"bounce": "none" "bounce": "none"

View File

@ -145,7 +145,7 @@
}, },
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/cart/coupon/couponIntro", url: "/pages/cart/coupon/couponIntro",
}); });
}, },

View File

@ -189,7 +189,7 @@ export default {
*/ */
useItNow(item) { useItNow(item) {
if (item.storeId && item.storeId!='0') { if (item.storeId && item.storeId!='0') {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/shopPage?id=${item.storeId}`, url: `/pages/product/shopPage?id=${item.storeId}`,
}); });
} else { } else {
@ -203,7 +203,7 @@ export default {
* 优惠券详情 * 优惠券详情
*/ */
couponDetail(item) { couponDetail(item) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/cart/coupon/couponDetail?item=" + "/pages/cart/coupon/couponDetail?item=" +
encodeURIComponent(JSON.stringify(item)), encodeURIComponent(JSON.stringify(item)),

View File

@ -120,7 +120,7 @@
* 支付成功后跳转 * 支付成功后跳转
*/ */
callback(paymentMethod){ callback(paymentMethod){
this.$navigateTo({ uni.navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" + url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod + paymentMethod +
"&payPrice=" + "&payPrice=" +

View File

@ -162,7 +162,7 @@ export default {
delete this.form.updateTime; delete this.form.updateTime;
editAddress(this.form).then((res) => { editAddress(this.form).then((res) => {
if (res.data.success) { if (res.data.success) {
this.$navigateTo({ uni.navigateTo({
url: `/${beforePage.route}`, url: `/${beforePage.route}`,
}); });
} }

View File

@ -129,7 +129,7 @@ export default {
// //
addAddress(id) { addAddress(id) {
if (id) { if (id) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/mine/address/add?id=" + "/pages/mine/address/add?id=" +
id + id +
@ -138,7 +138,7 @@ export default {
"&type=order", "&type=order",
}); });
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/mine/address/add?way=" + this.routerVal.way + "&type=order", "/pages/mine/address/add?way=" + this.routerVal.way + "&type=order",
}); });

View File

@ -86,23 +86,9 @@ export default {
* 进入页面检测当前账户是否登录 * 进入页面检测当前账户是否登录
*/ */
onShow() { onShow() {
let that = this; if (this.$options.filters.tipsToLogin()) {
if (this.$options.filters.isLogin("auth")) {
this.getAddressList(); this.getAddressList();
} else { }
uni.showModal({
title: "提示",
content: "检测到您的账号还未登录,是否去登录?",
confirmColor: this.$lightColor,
success: function (res) {
if (res.confirm) {
that.$options.filters.navigateToLogin();
} else if (res.cancel) {
uni.navigateBack();
}
},
});
}
}, },
methods: { methods: {
// //
@ -145,7 +131,7 @@ export default {
}, },
// //
addAddress(id) { addAddress(id) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/mine/address/add${id ? "?id=" + id : ""}`, url: `/pages/mine/address/add${id ? "?id=" + id : ""}`,
}); });
}, },

View File

@ -50,7 +50,7 @@ export default {
* 跳转 * 跳转
*/ */
navgition(url) { navgition(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },

View File

@ -38,7 +38,7 @@ export default {
let res = await recharge({ price: this.price }); let res = await recharge({ price: this.price });
if (res.data.success) { if (res.data.success) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`, url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`,
}); });
} }

View File

@ -58,12 +58,12 @@ export default {
}, },
methods: { methods: {
handleClick(url) { handleClick(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },
queryGoods(src) { queryGoods(src) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/mine/distribution/${src}`, url: `/pages/mine/distribution/${src}`,
}); });
}, },

View File

@ -221,7 +221,7 @@ export default {
* 查看图片 * 查看图片
*/ */
handleNavgationGoods(val) { handleNavgationGoods(val) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${val.skuId}&goodsId=${val.goodsId}`, url: `/pages/product/goods?id=${val.skuId}&goodsId=${val.goodsId}`,
}); });
}, },

View File

@ -56,7 +56,7 @@
methods: { methods: {
...mapMutations(["logout"]), ...mapMutations(["logout"]),
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url url
}); });
}, },

View File

@ -45,7 +45,7 @@ export default {
}, },
methods: { methods: {
goDetail(sn,logi_id,ship_no){ goDetail(sn,logi_id,ship_no){
this.$navigateTo({ uni.navigateTo({
url:'/pages/msgTips/packagemsg/logisticsDetail?order_sn=' + sn +'&logi_id='+logi_id+'&ship_no='+ship_no, url:'/pages/msgTips/packagemsg/logisticsDetail?order_sn=' + sn +'&logi_id='+logi_id+'&ship_no='+ship_no,
}) })
}, },

View File

@ -174,7 +174,7 @@
*/ */
goGoodsDetail(val) { goGoodsDetail(val) {
// //
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
}); });
}, },
@ -184,7 +184,7 @@
*/ */
goStoreMainPage(id) { goStoreMainPage(id) {
// //
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + id, url: "/pages/product/shopPage?id=" + id,
}); });
}, },

View File

@ -84,7 +84,7 @@
* 导航到店铺 * 导航到店铺
*/ */
navgaiteToStore(val) { navgaiteToStore(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -100,7 +100,7 @@
* 跳转详情 * 跳转详情
*/ */
navgaiteToDetail(item) { navgaiteToDetail(item) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId, url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId,
}); });
}, },

View File

@ -88,7 +88,7 @@ export default {
}, },
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },

View File

@ -16,7 +16,7 @@ export default {
methods: { methods: {
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url: url, url: url,
}); });
}, },

View File

@ -49,7 +49,7 @@ export default {
if (url == "/pages/set/securityCenter/securityCenter") { if (url == "/pages/set/securityCenter/securityCenter") {
url += `?mobile=${this.userInfo.mobile}`; url += `?mobile=${this.userInfo.mobile}`;
} }
this.$navigateTo({ uni.navigateTo({
url: url, url: url,
}); });
}, },

View File

@ -488,13 +488,13 @@ export default {
}, },
// //
navigateToDetailPage(item) { navigateToDetailPage(item) {
this.$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) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/shopPage?id=${item.content.storeId}`, url: `/pages/product/shopPage?id=${item.content.storeId}`,
}); });
}, },

View File

@ -352,7 +352,7 @@ export default {
* 售后详情 * 售后详情
*/ */
afterDetails(order) { afterDetails(order) {
this.$navigateTo({ uni.navigateTo({
url: "./applyDetail?sn=" + order.sn, url: "./applyDetail?sn=" + order.sn,
}); });
}, },
@ -395,7 +395,7 @@ export default {
...sku, ...sku,
}; };
storage.setAfterSaleData(data); storage.setAfterSaleData(data);
this.$navigateTo({ uni.navigateTo({
url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}`, url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}`,
}); });
}, },
@ -411,7 +411,7 @@ export default {
}; };
storage.setAfterSaleData(data); storage.setAfterSaleData(data);
this.$navigateTo({ uni.navigateTo({
url: `./afterSalesDetailExpress?serviceSn=${order.sn}`, url: `./afterSalesDetailExpress?serviceSn=${order.sn}`,
}); });
}, },
@ -422,13 +422,13 @@ export default {
onDetail(goods, sku) { onDetail(goods, sku) {
// //
if (this.current == 0) { if (this.current == 0) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${ url: `/pages/product/goods?id=${sku.skuId}&goodsId=${
sku.goodsId || sku.goodsId sku.goodsId || sku.goodsId
}`, }`,
}); });
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${ url: `/pages/product/goods?id=${goods.skuId}&goodsId=${
goods.goodsId || goods.goodsId goods.goodsId || goods.goodsId
}`, }`,

View File

@ -94,7 +94,7 @@ export default {
* 跳转到商品信息 * 跳转到商品信息
*/ */
navigateToGoodsDetail(id) { navigateToGoodsDetail(id) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${id}&goodsId=${goodsId}`, url: `/pages/product/goods?id=${id}&goodsId=${goodsId}`,
}); });
}, },

View File

@ -381,7 +381,7 @@ export default {
* 访问商品详情 * 访问商品详情
*/ */
navgiateToGoodsDetail(item) { navgiateToGoodsDetail(item) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
}); });
}, },
@ -390,7 +390,7 @@ export default {
* 进度 * 进度
*/ */
onProgress() { onProgress() {
this.$navigateTo({ uni.navigateTo({
url: `./applyProgress?sn=${ url: `./applyProgress?sn=${
this.serviceDetail.sn this.serviceDetail.sn
}&createTime=${encodeURIComponent(this.serviceDetail.createTime)} }&createTime=${encodeURIComponent(this.serviceDetail.createTime)}

View File

@ -86,7 +86,7 @@ export default {
methods: { methods: {
// //
handleToGoods(val) { handleToGoods(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
}); });
}, },
@ -120,7 +120,7 @@ export default {
* 查看详情 * 查看详情
*/ */
handleInfo(val) { handleInfo(val) {
this.$navigateTo({ uni.navigateTo({
url: "./complainInfo?id=" + val.id, url: "./complainInfo?id=" + val.id,
}); });
}, },

View File

@ -219,7 +219,7 @@ export default {
*/ */
talkCommont(sku) { talkCommont(sku) {
console.log(sku); console.log(sku);
this.$navigateTo({ uni.navigateTo({
url: `./releaseEvaluate?sn=${sku.sn}&sku=${encodeURIComponent( url: `./releaseEvaluate?sn=${sku.sn}&sku=${encodeURIComponent(
JSON.stringify(sku) JSON.stringify(sku)
)}`, )}`,
@ -270,7 +270,7 @@ export default {
* 评价详情 * 评价详情
*/ */
onDetail(comment) { onDetail(comment) {
this.$navigateTo({ uni.navigateTo({
url: url:
"./evaluateDetail?comment=" + "./evaluateDetail?comment=" +
encodeURIComponent(JSON.stringify(comment)), encodeURIComponent(JSON.stringify(comment)),

View File

@ -481,7 +481,7 @@ export default {
// //
navigateToStore(val) { navigateToStore(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -555,7 +555,7 @@ export default {
* 跳转 * 跳转
*/ */
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },

View File

@ -326,10 +326,10 @@ export default {
// this.loadData(this.status); // this.loadData(this.status);
}, },
onShow() { onShow() {
if (!this.tabCurrentIndex) { if(this.$options.filters.tipsToLogin()){
this.initData(0); if (!this.tabCurrentIndex) {
} else { this.initData(0);
}
} }
// this.loadData(this.status); // this.loadData(this.status);
}, },
@ -364,14 +364,14 @@ export default {
methods: { methods: {
// //
applyService(order) { applyService(order) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/order/afterSales/afterSales?orderSn=${order.sn}`, url: `/pages/order/afterSales/afterSales?orderSn=${order.sn}`,
}); });
}, },
// //
navigateToStore(val) { navigateToStore(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -423,7 +423,7 @@ export default {
}).pay(); }).pay();
// #endif // #endif
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
this.$navigateTo({ uni.navigateTo({
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn, url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
}); });
// #endif // #endif
@ -522,7 +522,7 @@ export default {
* 跳转到订单详情 * 跳转到订单详情
*/ */
navigateToOrderDetail(sn) { navigateToOrderDetail(sn) {
this.$navigateTo({ uni.navigateTo({
url: "./orderDetail?sn=" + sn, url: "./orderDetail?sn=" + sn,
}); });
}, },
@ -588,7 +588,7 @@ export default {
* 评价商品 * 评价商品
*/ */
onComment(sn) { onComment(sn) {
this.$navigateTo({ uni.navigateTo({
url: "./evaluate/myEvaluate", url: "./evaluate/myEvaluate",
}); });
}, },
@ -599,7 +599,7 @@ export default {
reBuy(order) { reBuy(order) {
console.log(order); console.log(order);
return; return;
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId, "/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId,
}); });
@ -609,7 +609,7 @@ export default {
* 查看物流 * 查看物流
*/ */
navigateToLogistics(order) { navigateToLogistics(order) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn, "/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn,
}); });

View File

@ -277,7 +277,7 @@ export default {
}, },
methods: { methods: {
tostore(val) { tostore(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -294,7 +294,7 @@ export default {
}, },
// #TODO // #TODO
ByUserMessage(order) { ByUserMessage(order) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/cart/payment/shareOrderGoods?sn=" + "/pages/cart/payment/shareOrderGoods?sn=" +
order.sn + order.sn +
@ -318,12 +318,12 @@ export default {
}); });
}, },
onReceipt(val) { onReceipt(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/order/invoice/invoiceDetail?id=" + val.id, url: "/pages/order/invoice/invoiceDetail?id=" + val.id,
}); });
}, },
gotoGoodsDetail(sku) { gotoGoodsDetail(sku) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`, url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`,
}); });
}, },
@ -363,7 +363,7 @@ export default {
* 投诉 * 投诉
*/ */
complaint(sku) { complaint(sku) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/order/complain/complain?sn=" + "/pages/order/complain/complain?sn=" +
this.sn + this.sn +
@ -373,7 +373,7 @@ export default {
}, },
// //
onAfterSales(sn, sku) { onAfterSales(sn, sku) {
this.$navigateTo({ uni.navigateTo({
url: `./afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent( url: `./afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent(
JSON.stringify(sku) JSON.stringify(sku)
)}`, )}`,
@ -382,7 +382,7 @@ export default {
// //
toPay(val) { toPay(val) {
val.sn val.sn
? this.$navigateTo({ ? uni.navigateTo({
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn, url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
}) })
: false; : false;
@ -459,12 +459,12 @@ export default {
}, },
// //
onComment(sn) { onComment(sn) {
this.$navigateTo({ uni.navigateTo({
url: "./evaluate/myEvaluate", url: "./evaluate/myEvaluate",
}); });
}, // }, //
onLogistics(order) { onLogistics(order) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=" + "/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=" +
order.logi_id + order.logi_id +
@ -480,7 +480,7 @@ export default {
this.reason = reason; this.reason = reason;
}, },
reBuy(order) { reBuy(order) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId, "/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId,
}); });

View File

@ -545,7 +545,7 @@ export default {
if (user.data.result.mobile) { if (user.data.result.mobile) {
whetherNavigate(); whetherNavigate();
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: "/pages/passport/bindUserPhone", url: "/pages/passport/bindUserPhone",
}); });
} }
@ -639,13 +639,13 @@ export default {
}, },
// //
navigateToPrivacy(val) { navigateToPrivacy(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/mine/help/tips?type=" + val, url: "/pages/mine/help/tips?type=" + val,
}); });
console.log(val) console.log(val)
}, },
navigateToPrivacys(val){ navigateToPrivacys(val){
this.$navigateTo({ uni.navigateTo({
url:"/pages/mine/help/tips?type="+ val, url:"/pages/mine/help/tips?type="+ val,
}) })
}, },

View File

@ -710,13 +710,13 @@ export default {
linkMsgDetail() { linkMsgDetail() {
// lili // lili
this.$navigateTo({ uni.navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeDetail.storeId}`, url: `/pages/tabbar/home/web-view?IM=${this.storeDetail.storeId}`,
}); });
// udesk // udesk
// if (this.storeDetail.merchantEuid) { // if (this.storeDetail.merchantEuid) {
// this.$navigateTo({ // uni.navigateTo({
// url: `/pages/tabbar/home/web-view?src=${this.IM}`, // url: `/pages/tabbar/home/web-view?src=${this.IM}`,
// }); // });
// } // }
@ -736,7 +736,7 @@ export default {
// sign: this.storeDetail.yzfSign, // sign: this.storeDetail.yzfSign,
// mpSign: this.storeDetail.yzfMpSign, // mpSign: this.storeDetail.yzfMpSign,
// }; // };
// this.$navigateTo({ // uni.navigateTo({
// url: // url:
// "/pages/product/customerservice/index?params=" + // "/pages/product/customerservice/index?params=" +
// encodeURIComponent(JSON.stringify(params)), // encodeURIComponent(JSON.stringify(params)),
@ -744,7 +744,7 @@ export default {
// // #endif // // #endif
// // #ifndef MP-WEIXIN // // #ifndef MP-WEIXIN
// const sign = this.storeDetail.yzfSign; // const sign = this.storeDetail.yzfSign;
// this.$navigateTo({ // uni.navigateTo({
// url: // url:
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + // "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, // sign,
@ -908,7 +908,7 @@ export default {
* 跳转到店铺页面 * 跳转到店铺页面
*/ */
navigateToStore(store_id) { navigateToStore(store_id) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/shopPage?id=` + store_id, url: `/pages/product/shopPage?id=` + store_id,
}); });
}, },

View File

@ -94,7 +94,7 @@ export default {
); );
}, },
toComment(id, grade) { toComment(id, grade) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/comment?id=${id}&grade=${grade}`, url: `/pages/product/comment?id=${id}&grade=${grade}`,
}); });
}, },

View File

@ -54,7 +54,7 @@ export default {
this.getShippingAddress() this.getShippingAddress()
} }
else{ else{
this.$navigateTo({ uni.navigateTo({
url: 'pages/passport/login' url: 'pages/passport/login'
}); });
} }
@ -71,7 +71,7 @@ export default {
getpicker() { getpicker() {
// this.$refs.cityPicker.show(); // this.$refs.cityPicker.show();
this.$navigateTo({ uni.navigateTo({
url: "/pages/mine/address/add", url: "/pages/mine/address/add",
}); });
this.closeAddress(); this.closeAddress();

View File

@ -57,13 +57,13 @@ export default {
}, },
// //
clickGoods(val) { clickGoods(val) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`, url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
}); });
}, },
tostorePage(val) { tostorePage(val) {
this.$navigateTo({ uni.navigateTo({
url: "../product/shopPage?id=" + val.storeId, url: "../product/shopPage?id=" + val.storeId,
}); });
}, },

View File

@ -74,7 +74,7 @@ export default {
}, },
methods: { methods: {
handleClickStore(val){ handleClickStore(val){
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/shopPage?id=${val.id}` url: `/pages/product/shopPage?id=${val.id}`
}); });
}, },

View File

@ -152,7 +152,7 @@ export default {
methods: { methods: {
getStoreLicencePhoto() { getStoreLicencePhoto() {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/licencePhoto?id=${this.storeId}`, url: `/pages/product/licencePhoto?id=${this.storeId}`,
}); });
}, },
@ -190,7 +190,7 @@ export default {
// sign: this.storeInfo.yzfSign, // sign: this.storeInfo.yzfSign,
// mpSign: this.storeInfo.yzfMpSign, // mpSign: this.storeInfo.yzfMpSign,
// }; // };
// this.$navigateTo({ // uni.navigateTo({
// url: // url:
// "/pages/product/customerservice/index?params=" + // "/pages/product/customerservice/index?params=" +
// encodeURIComponent(JSON.stringify(params)), // encodeURIComponent(JSON.stringify(params)),
@ -198,14 +198,14 @@ export default {
// // #endif // // #endif
// // #ifndef MP-WEIXIN // // #ifndef MP-WEIXIN
// const sign = this.storeInfo.yzfSign; // const sign = this.storeInfo.yzfSign;
// this.$navigateTo({ // uni.navigateTo({
// url: // url:
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + // "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, // sign,
// }); // });
// // #endif // // #endif
this.$navigateTo({ uni.navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeId}`, url: `/pages/tabbar/home/web-view?IM=${this.storeId}`,
}); });
}, },
@ -227,7 +227,7 @@ export default {
/**商品分类中商品集合 */ /**商品分类中商品集合 */
getCategoryGoodsList(val) { getCategoryGoodsList(val) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/shopPageGoods?title=${val.labelName}&id=${val.id}&storeId=${this.storeId}`, url: `/pages/product/shopPageGoods?title=${val.labelName}&id=${val.id}&storeId=${this.storeId}`,
}); });
}, },
@ -237,7 +237,7 @@ export default {
*/ */
search() { search() {
console.log("点击") console.log("点击")
this.$navigateTo({ uni.navigateTo({
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`, url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
}); });
}, },

View File

@ -3,7 +3,7 @@
<u-navbar :custom-back="back" back-icon-color="#fff" :background="background" :border-bottom="false"> <u-navbar :custom-back="back" back-icon-color="#fff" :background="background" :border-bottom="false">
</u-navbar> </u-navbar>
<div class="wrapper"> <div class="wrapper-box">
<!-- 砍价列表 --> <!-- 砍价列表 -->
<div class="box box1"> <div class="box box1">
<div class="bargain"> <div class="bargain">
@ -106,10 +106,6 @@
<popupGoods ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail" <popupGoods ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail"
:goodsSpec="goodsSpec" v-if="bargainDetail.id " @handleClickSku="getGoodsDetail" /> :goodsSpec="goodsSpec" v-if="bargainDetail.id " @handleClickSku="getGoodsDetail" />
<!-- 产品详情 -->
<div class=" box4">
</div>
</div> </div>
</div> </div>
</template> </template>
@ -352,11 +348,11 @@ page {
align-items: center; align-items: center;
padding: 10rpx 0; padding: 10rpx 0;
} }
.wrapper { .wrapper-box {
background: url("https://lilishop-oss.oss-cn-beijing.aliyuncs.com/aac88f4e8eff452a8010af42c4560b04.png"); background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
height: 700rpx; height: 506rpx;
width: 100%; width: 100%;
} }
@ -371,16 +367,16 @@ page {
} }
} }
.box1 { .box1 {
top: 750rpx; top: 560rpx;
} }
.box2 { .box2 {
top: 770rpx; top: 580rpx;
} }
.box3 { .box3 {
top: 790rpx; top: 600rpx;
} }
.box4 { .box4 {
top: 810rpx; top: 620 rpx;
height: 200rpx; height: 200rpx;
} }
.bargain-item { .bargain-item {

View File

@ -6,22 +6,7 @@
<!-- 砍价列表 --> <!-- 砍价列表 -->
<div class="box"> <div class="box">
<!-- 已砍的商品 --> <!-- 已砍的商品 -->
<div class="bargain" v-if="bargainList.length!=0"> <goodsTemplate type="kanJia" v-if="bargainList.length!=0" :res="bargainList" />
<div class="flex bargain-item" v-for="(item,index) in bargainList" :key="index">
<div class="goods-img">
<u-image width="150" height="150" :src="item.thumbnail"></u-image>
</div>
<div class="goods-config">
<div class="goods-title wes-2">
{{item.goodsName}}
</div>
<div class="flex goods-buy">
<div class="max-price">最低<span>{{item.purchasePrice | unitPrice}}</span></div>
<div class="bargaining" @click="navigateToBargainDetail(item)"></div>
</div>
</div>
</div>
</div>
<div class="bargain empty" v-else> <div class="bargain empty" v-else>
<u-empty text="暂无活动" mode="list"></u-empty> <u-empty text="暂无活动" mode="list"></u-empty>
</div> </div>
@ -32,7 +17,9 @@
<script> <script>
import { getBargainList } from "@/api/promotions"; import { getBargainList } from "@/api/promotions";
import goodsTemplate from '@/components/m-goods-list/promotion'
export default { export default {
components:{goodsTemplate},
data() { data() {
return { return {
background: { background: {
@ -74,7 +61,7 @@ export default {
// //
navigateToBargainDetail(val) { navigateToBargainDetail(val) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/bargain/detail?id=${val.id}`, url: `/pages/promotion/bargain/detail?id=${val.id}`,
}); });
}, },
@ -91,7 +78,7 @@ page {
background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png"); background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
height: 600rpx; height: 506rpx;
width: 100%; width: 100%;
} }
@ -99,7 +86,7 @@ page {
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; position: relative;
top: 650rpx; top: 560rpx;
width: 94%; width: 94%;
margin: 0 auto; margin: 0 auto;
> .bargain { > .bargain {

View File

@ -67,7 +67,7 @@ export default {
}, },
// //
navigateToBargainDetail(val) { navigateToBargainDetail(val) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/bargain/detail?id=${val.kanjiaActivityGoodsId}`, url: `/pages/promotion/bargain/detail?id=${val.kanjiaActivityGoodsId}`,
}); });
}, },

View File

@ -1,155 +1,133 @@
<template> <template>
<view class="wrapper"> <view class="wrapper">
<u-navbar :border-bottom="false" :title="title">
<!-- 中间 -->
<view class="slot-wrap container-wrap">
<view v-if="search">
<u-search @search="searchFun()" @custom="searchFun()" v-model="params.goodsName"></u-search>
</view>
</view>
<!-- 右侧 -->
<view slot="right">
<view style="margin-right: 24rpx;" @click="searchFlag()">
<view v-if="search"></view>
<u-icon v-if="!search" size="44rpx" name="search"></u-icon>
</view>
</view>
</u-navbar>
<!-- 顶部栏 -->
<div class='header-wraper'>
<image src="/static/join-buy.png"></image>
</div>
<!-- 商品栏 -->
<div class="swiper">
<goodsTemplate v-if="goodsList.length" :res="goodsList" />
<u-empty v-else style="margin-top:20%" text="暂无拼团活动" mode="data"></u-empty>
</div>
<u-navbar :border-bottom="false" :background="background" class="unavbar" :title="title"> </view>
<!-- 中间 -->
<view class="slot-wrap container-wrap">
<view v-if="search">
<u-search @search="searchFun()" @custom="searchFun()" v-model="params.goodsName"></u-search>
</view>
</view>
<!-- 右侧 -->
<view slot="right">
<view style="margin-right: 24rpx;" @click="searchFlag()">
<view v-if="search"></view>
<u-icon v-if="!search" size="44rpx" name="search"></u-icon>
</view>
</view>
</u-navbar>
<!-- 顶部栏 -->
<!-- 商品栏 -->
<div class="swiper">
<div v-if="groupBuy.length !=0">
<view class="view-item" v-for="(groupItem, groupIndex) in groupBuy" :key="groupIndex">
<view class="view-left">
<u-image border-radius="10" shape="square" :src="groupItem.thumbnail" width="186rpx" height="186rpx">
<view slot="error" style="font-size: 24rpx;">加载失败</view>
</u-image>
</view>
<view class="view-content">
<view class="view-content-name">
{{ groupItem.goodsName }}
</view>
<view class="view-content-bottom">
<view>
<view class="view-content-price">
<!-- {{groupItem.sales_price | unitPrice }} <span v-if="groupItem.point">+{{groupItem.point}}</span> -->
{{groupItem.price | unitPrice }}
</view>
<view class="view-content-original_price">
{{ groupItem.originalPrice | unitPrice }}
</view>
</view>
<view>
<view class="btn-group" @click="toHref(groupItem)"> </view>
<view class="buy-content">已售{{groupItem.num || 0}}</view>
</view>
</view>
</view>
</view>
<u-loadmore bg-color='#f8f8f8' :status="status" />
</div>
<u-empty v-else style="margin-top:20%" text="暂无拼团活动" mode="data"></u-empty>
</div>
</view>
</template> </template>
<script> <script>
import * as API_Promotions from "@/api/promotions"; import * as API_Promotions from "@/api/promotions";
import * as API_Goods from "@/api/goods"; import * as API_Goods from "@/api/goods";
export default { import goodsTemplate from '@/components/m-goods-list/promotion.vue'
components: {}, export default {
data() { components: {
return { goodsTemplate
status: "loadmore", },
is_empty: false, data() {
search: false, return {
title: "拼团活动", is_empty: false,
background: { search: false,
backgroundColor: "#fff", title: "拼团活动",
},
empty: false,
params: {
pageNumber: 1,
pageSize: 10,
categoryPath: "",
goodsName: "",
},
groupBuy: [],
};
},
mounted() {},
watch: {
search(val) {
val ? (this.title = "") : (this.title = "拼团活动");
},
},
onReachBottom() {
this.loadMore();
},
//
onNavigationBarButtonTap(e) {
this.popupFlag = !this.popupFlag;
},
async onLoad() {
this.GET_AssembleGoods();
},
methods: { empty: false,
loadMore() { params: {
this.params.pageNumber++; pageNumber: 1,
this.GET_AssembleGoods(); pageSize: 10,
}, categoryPath: "",
searchFlag() { goodsName: "",
this.search = !this.search; },
}, goodsList: [],
};
},
mounted() {},
watch: {
search(val) {
val ? (this.title = "") : (this.title = "拼团活动");
},
},
onReachBottom() {
this.loadMore();
},
//
onNavigationBarButtonTap(e) {
this.popupFlag = !this.popupFlag;
},
async onLoad() {
this.GET_AssembleGoods();
},
toHref(goods) { methods: {
this.$navigateTo({ loadMore() {
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`, this.params.pageNumber++;
}); this.GET_AssembleGoods();
}, },
searchFun() { searchFlag() {
this.groupBuy = []; this.search = !this.search;
this.GET_AssembleGoods(); },
},
//
GET_AssembleGoods() {
this.status = "loading";
const params = JSON.parse(JSON.stringify(this.params));
if (params.category_id === 0) delete params.category_id;
API_Promotions.getAssembleList(params) toHref(goods) {
.then((response) => { uni.navigateTo({
const data = response.data.result.records; url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`,
});
},
searchFun() {
this.goodsList = [];
this.GET_AssembleGoods();
},
//
GET_AssembleGoods() {
if (!data || !data.length) { const params = JSON.parse(JSON.stringify(this.params));
this.is_empty = true; if (params.category_id === 0) delete params.category_id;
this.status = "nomore";
} else { API_Promotions.getAssembleList(params)
if (data.length <= this.params.pageSize) { .then((response) => {
this.status = "nomore"; const data = response.data.result.records;
} else {
this.status = "loadmore"; if (!data || !data.length) {
} this.is_empty = true;
this.is_empty = false;
this.groupBuy.push(...(data || [])); } else {
} if (data.length <= this.params.pageSize) {
})
.catch(() => {}); } else {
},
}, }
}; this.is_empty = false;
this.goodsList.push(...(data || []));
}
})
.catch(() => {});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; .header-wraper {
background: url('/static/bg.png');
height: 200rpx;
display: flex;
align-items: center;
justify-content: center;
>image{
width: 188rpx;
height: 60rpx;
}
}
</style> </style>

View File

@ -229,7 +229,7 @@ export default {
let customParams = encodeURIComponent( let customParams = encodeURIComponent(
JSON.stringify({ path: "pages/index/index", pid: 1 }) JSON.stringify({ path: "pages/index/index", pid: 1 })
); // 600 ); // 600
this.$navigateTo({ uni.navigateTo({
url: url:
"plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" +
roomId + roomId +

View File

@ -23,8 +23,8 @@
<u-loading slot="loading"></u-loading> <u-loading slot="loading"></u-loading>
</u-image> </u-image>
<view class="index-item-title">{{ item.goodsName }}</view> <view class="index-item-title">{{ item.goodsName }}</view>
<view class="index-item-price"> <view class="index-item-price flex flex-a-c flex-j-sb">
{{ item.points }}积分 <div class="point"><span>{{ item.points }}</span>积分</div>
<span class="tipsMkt">¥{{ item.originalPrice | unitPrice }}</span> <span class="tipsMkt">¥{{ item.originalPrice | unitPrice }}</span>
</view> </view>
</view> </view>
@ -137,14 +137,14 @@ export default {
methods: { methods: {
// //
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },
toGoods(item) { toGoods(item) {
// //
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/point/detail?id=${item.id}`, url: `/pages/promotion/point/detail?id=${item.id}`,
}); });
}, },
@ -194,46 +194,12 @@ page {
height: 100%; height: 100%;
} }
.tipsMkt { .tipsMkt {
float: right;
color: #c0c4cc; color: #c0c4cc;
font-size: 24rpx; font-size: 24rpx !important;
text-decoration: line-through; text-decoration: line-through;
margin-right: 20rpx; margin-right: 20rpx !important;
} }
.header {
background: $light-color;
position: relative;
color: #fff;
display: flex;
height: 80rpx;
align-items: center;
justify-content: center;
font-size: 26rpx;
font-size: 34rpx;
.left,
.right {
position: absolute;
width: max-content;
height: max-content;
top: 0;
bottom: 0;
margin: auto;
}
.left {
float: left;
top: 0;
bottom: 0;
left: 20rpx;
}
.right {
float: right;
right: 20rpx;
}
}
.index { .index {
height: 100vh; height: 100vh;
@ -341,15 +307,19 @@ page {
overflow: hidden; overflow: hidden;
} }
.index-item-title-desc {
font-size: 25rpx;
color: #999999;
margin-top: 10rpx;
}
.index-item-price { .index-item-price {
font-size: 28rpx; font-size: 28rpx;
color: #ff5a10; overflow: hidden;
color: $main-color;
padding: 20rpx 0 0 20rpx; padding: 20rpx 0 0 20rpx;
>.point{
>span{
font-size: 42rpx;
font-weight: bold;
margin-right:10rpx;
}
}
} }
</style> </style>

View File

@ -1,7 +1,8 @@
<template> <template>
<view class="sale"> <view class="sale">
<view class="sale-head"> <u-navbar title='限时抢购'></u-navbar>
<image src="@/pages/promotion/static/head-sample.png"></image> <view class="header-wraper">
<image mode="widthFix" src="/static/seckill.png"></image>
</view> </view>
<scroll-view scroll-x> <scroll-view scroll-x>
<view class="index-navs"> <view class="index-navs">
@ -14,10 +15,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="trailer" v-if="timeLine[nav] && times">
{{ timeLine[nav].distanceStartTime === 0 ? (onlyOne ? '距结束' : '距下一轮') : '距开始' }}
{{ times.hours == '00' ? '0' : times.hours }}小时{{ times.minutes }}{{ times.seconds }}
</view>
</scroll-view> </scroll-view>
<view class="sale-items" v-if="goodsList.length > 0"> <view class="sale-items" v-if="goodsList.length > 0">
<goodsTemplate :res="goodsList" /> <goodsTemplate :res="goodsList" />
@ -39,7 +37,7 @@
getSeckillTimeGoods getSeckillTimeGoods
} from "@/api/promotions.js"; } from "@/api/promotions.js";
import Foundation from "@/utils/Foundation.js"; import Foundation from "@/utils/Foundation.js";
import goodsTemplate from '@/components/m-goods-list/seckill.vue' import goodsTemplate from '@/components/m-goods-list/promotion.vue'
export default { export default {
components: { components: {
goodsTemplate goodsTemplate
@ -184,10 +182,15 @@
} }
} }
.sale-head { .header-wraper {
image { background: url('/static/bg.png');
width: 100%; height: 200rpx;
height: 280rpx; display: flex;
align-items: center;
justify-content: center;
>image{
width: 300rpx;
height: 100rpx;
} }
} }
@ -195,22 +198,8 @@
padding-top: 20rpx; padding-top: 20rpx;
} }
.trailer { .index-navs {
height: 100rpx; background: #fff;
background: #ffffff;
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: center;
align-items: center;
font-size: 22rpx;
color: #666666;
box-sizing: border-box;
position: relative;
z-index: 0;
}
.index-navs {
background-color: #f7f7f7; background-color: #f7f7f7;
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
@ -240,24 +229,26 @@
color: #bababa; color: #bababa;
height: 115rpx; height: 115rpx;
line-height: 1em; line-height: 1em;
position: relative; position: relative;
font-size: 32rpx;
font-weight: bold;
&-active { &-active {
background-image: url(/static/seckill/active.png); color: $main-color;
background-size: 100% 115rpx;
background-repeat: no-repeat;
color: #ffffff;
position: relative; position: relative;
z-index: 30; z-index: 30;
.index-nav-desc { .index-nav-desc {
color: #ffffff; color: #fff;
font-weight: bold;
background: $main-color;
padding: 6rpx 16rpx;
border-radius: 50px;
} }
} }
} }
.index-nav-desc { .index-nav-desc {
margin-top: 8rpx; margin-top: 8rpx;
font-size: 22rpx; font-size: 22rpx;
color: #bababa; color: #bababa;
} }

View File

@ -343,7 +343,7 @@ export default {
* 跳转到店铺 * 跳转到店铺
*/ */
navigateToStore(val) { navigateToStore(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -352,7 +352,7 @@ export default {
* 跳转到优惠券 * 跳转到优惠券
*/ */
navigateToConpon(val) { navigateToConpon(val) {
this.$navigateTo({ uni.navigateTo({
url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId, url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId,
}); });
}, },
@ -361,7 +361,7 @@ export default {
* 跳转到商品 * 跳转到商品
*/ */
navigateToGoods(val) { navigateToGoods(val) {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/product/goods?id=" + "/pages/product/goods?id=" +
val.goodsSku.id + val.goodsSku.id +
@ -437,7 +437,7 @@ export default {
* 跳转 * 跳转
*/ */
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },

View File

@ -57,7 +57,7 @@ export default {
* 查询 * 查询
*/ */
search() { search() {
this.$navigateTo({ uni.navigateTo({
url: "/pages/navigation/search/searchPage", url: "/pages/navigation/search/searchPage",
}); });
}, },
@ -90,7 +90,7 @@ export default {
}, },
navigateToList(sid, tid) { navigateToList(sid, tid) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/navigation/search/searchPage?category=${tid}`, url: `/pages/navigation/search/searchPage?category=${tid}`,
}); });
}, },

View File

@ -24,7 +24,9 @@
{{ item.title }} {{ item.title }}
</div> </div>
<div class="goods-bottom"> <div class="goods-bottom">
<div class="goods-price">{{ item.price | unitPrice }}</div> <div class="goods-price"> ¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -56,8 +58,15 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
handleClick(item) { handleClick(item) {
this.$navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
}); });
}, },
@ -163,13 +172,11 @@ $w_94: 94%;
> .goods-price { > .goods-price {
line-height: 2; line-height: 2;
color: $main-color; color: $main-color;
>span{
font-size: 42rpx;
}
} }
} }
} }
.goods-icon {
right: 10rpx;
top: 10rpx;
position: absolute;
}
</style> </style>

View File

@ -147,22 +147,22 @@ export default {
goToDetail(type) { goToDetail(type) {
switch(type) { switch(type) {
case "SECKILL": case "SECKILL":
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/seckill`, url: `/pages/promotion/seckill`,
}); });
break; break;
case "PINTUAN": case "PINTUAN":
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/joinGroup`, url: `/pages/promotion/joinGroup`,
}); });
break; break;
case "LIVE": case "LIVE":
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/lives`, url: `/pages/promotion/lives`,
}); });
break; break;
case "KANJIA": case "KANJIA":
this.$navigateTo({ uni.navigateTo({
url: `/pages/promotion/bargain/list`, url: `/pages/promotion/bargain/list`,
}); });
break; break;

View File

@ -12,7 +12,7 @@ export default {
props: ["res"], props: ["res"],
methods: { methods: {
handleSearch() { handleSearch() {
this.$navigateTo({ uni.navigateTo({
url: "/pages/navigation/search/searchPage", url: "/pages/navigation/search/searchPage",
}); });
}, },

View File

@ -150,18 +150,18 @@ export default {
// WX_CODE // WX_CODE
if (res.scanType == "WX_CODE") { if (res.scanType == "WX_CODE") {
console.log(res); console.log(res);
this.$navigateTo({ uni.navigateTo({
url: `/${res.path}`, url: `/${res.path}`,
}); });
} else { } else {
config.scanAuthNavigation.forEach((src) => { config.scanAuthNavigation.forEach((src) => {
if (res.result.indexOf(src) != -1) { if (res.result.indexOf(src) != -1) {
this.$navigateTo({ uni.navigateTo({
url: `/${res.result.substring(src.length)}`, url: `/${res.result.substring(src.length)}`,
}); });
} else { } else {
setTimeout(() => { setTimeout(() => {
this.$navigateTo({ uni.navigateTo({
url: "/pages/tabbar/home/web-view?src=" + path, url: "/pages/tabbar/home/web-view?src=" + path,
}); });
}, 100); }, 100);

View File

@ -45,14 +45,14 @@ export default {
// }, // },
methods: { methods: {
gotoLink() { gotoLink() {
this.$navigateTo({ uni.navigateTo({
// //
url: url:
"/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371992704333905920", "/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371992704333905920",
}); });
}, },
gotoB() { gotoB() {
this.$navigateTo({ uni.navigateTo({
url: url:
"/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371779927900160000", "/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371779927900160000",
}); });

View File

@ -122,7 +122,7 @@ export default {
* navigator标签现在默认没有转场动画所以用view * navigator标签现在默认没有转场动画所以用view
*/ */
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },

View File

@ -73,7 +73,7 @@
}) })
}, },
goDetail(item) { goDetail(item) {
this.$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
}) })
}, },

View File

@ -69,7 +69,7 @@ import { distribution } from "@/api/goods";
export default { export default {
methods: { methods: {
navigateTo(url) { navigateTo(url) {
this.$navigateTo({ uni.navigateTo({
url, url,
}); });
}, },
@ -78,11 +78,11 @@ export default {
if (res.data.result) { if (res.data.result) {
let type = res.data.result.distributionStatus; let type = res.data.result.distributionStatus;
if (type == "PASS") { if (type == "PASS") {
this.$navigateTo({ uni.navigateTo({
url: "/pages/mine/distribution/home", url: "/pages/mine/distribution/home",
}); });
} else if (type == "REFUSE") { } else if (type == "REFUSE") {
this.$navigateTo({ uni.navigateTo({
url: "/pages/mine/distribution/auth", url: "/pages/mine/distribution/auth",
}); });
} else if (type == "RETREAT") { } else if (type == "RETREAT") {
@ -106,7 +106,7 @@ export default {
}); });
} else { } else {
// //
this.$navigateTo({ uni.navigateTo({
url: "/pages/mine/distribution/auth", url: "/pages/mine/distribution/auth",
}); });
} }

BIN
static/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
static/bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
static/join-buy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
static/seckill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

View File

@ -149,6 +149,9 @@ $font-weight: 400;
} }
.flex-a-c{ .flex-a-c{
align-items: center; align-items: center;
}
.flex-j-sb{
justify-content: space-between;
} }
.relative { .relative {
position: relative; position: relative;

View File

@ -1,5 +1,7 @@
import Foundation from "./Foundation.js"; import Foundation from "./Foundation.js";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
import { getUserInfo } from '@/api/members';
import Vue from "vue";
/** /**
* 金钱单位置换 2999 --> 2,999.00 * 金钱单位置换 2999 --> 2,999.00
* @param val * @param val
@ -99,12 +101,46 @@ export function clearStrComma(str) {
export function isLogin(val) { export function isLogin(val) {
let userInfo = storage.getUserInfo(); let userInfo = storage.getUserInfo();
if (val == "auth") { if (val == "auth") {
return userInfo.id ? true : false; return userInfo && userInfo.id ? true : false;
} else { } else {
return storage.getUserInfo(); return storage.getUserInfo();
} }
} }
export function tipsToLogin(){
if(!isLogin('auth')){
uni.showModal({
title: "提示",
content: "当前用户未登录是否登录?",
confirmText: "确定",
cancelText: "取消",
confirmColor:Vue.prototype.$mainColor,
success: res => {
if (res.confirm) {
navigateToLogin()
} else if (res.cancel) {
uni.navigateBack()
}
},
})
return
}
}
/**
* 获取用户信息并重新添加到缓存里面
*/
export async function userInfo(){
let res = await getUserInfo();
if(res.data.success){
storage.setUserInfo(res.data.result);
return res.data.result
}
}
/** /**
* 验证是否登录如果没登录则去登录 * 验证是否登录如果没登录则去登录
* @param {*} val * @param {*} val
@ -113,7 +149,7 @@ export function isLogin(val) {
export function forceLogin() { export function forceLogin() {
let userInfo = storage.getUserInfo(); let userInfo = storage.getUserInfo();
if (!userInfo.id) { if (!userInfo || !userInfo.id) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.navigateTo({ uni.navigateTo({

View File

@ -1,24 +0,0 @@
export function navigateTo({url}) {
// #ifdef MP-WEIXIN
//判断当前页面栈的长度
if (getCurrentPages().length >= 8) {
//超过八层的时候跳转销毁当前页面,十层的时候手机应该会很卡;
uni.redirectTo({
url: url,
success: function (res) {},
fail: function (res) {},
complete: function (res) {},
});
} else {
uni.navigateTo({
url: url,
});
}
// #endif
// #ifndef MP-WEIXIN
uni.navigateTo({
url: url,
});
// #endif
}

View File

@ -1,194 +1,206 @@
import Request from "@/lib/request/index.js"; import Request from "@/lib/request/index.js";
import { refreshTokenFn } from "@/api/login.js"; import {
import storage from "@/utils/storage.js"; refreshTokenFn
import { md5 } from "@/utils/md5.js"; } from "@/api/login.js";
import Foundation from "@/utils/Foundation.js"; import storage from "@/utils/storage.js";
import api from "@/config/api.js"; import {
md5
import uuid from "@/utils/uuid.modified.js"; } from "@/utils/md5.js";
import Foundation from "@/utils/Foundation.js";
import api from "@/config/api.js";
let isNavigateTo = false
import uuid from "@/utils/uuid.modified.js";
function cleanStorage() {
uni.showToast({
title: "你的登录状态已过期,请重新登录", let isNavigateTo = false
icon: "none",
duration: 1500, function cleanStorage() {
}); uni.showToast({
if (uni.showLoading()) { title: "你的登录状态已过期,请重新登录",
uni.hideLoading(); icon: "none",
} duration: 1500,
});
storage.setHasLogin(false); if (uni.showLoading()) {
storage.setAccessToken(""); uni.hideLoading();
storage.setRefreshToken(""); }
console.log("清空token");
storage.setUuid(""); storage.setHasLogin(false);
storage.setUserInfo({}); storage.setAccessToken("");
storage.setRefreshToken("");
console.log("清空token");
if(!isNavigateTo){ storage.setUuid("");
isNavigateTo= true storage.setUserInfo({});
// 防抖处理跳转
// #ifdef MP-WEIXIN
uni.navigateTo({ if (!isNavigateTo) {
url: "/pages/passport/wechatMPLogin", isNavigateTo = true
}); // 防抖处理跳转
// #endif // #ifdef MP-WEIXIN
// #ifndef MP-WEIXIN uni.navigateTo({
uni.navigateTo({ url: "/pages/passport/wechatMPLogin",
url: "/pages/passport/login", });
}); // #endif
// #endif // #ifndef MP-WEIXIN
} uni.navigateTo({
} url: "/pages/passport/login",
});
let http = new Request(); // #endif
}
}
http.setConfig((config) => {
// 没有uuid创建 let http = new Request();
if (!storage.getUuid()) {
storage.setUuid(uuid.v1());
} http.setConfig((config) => {
// 没有uuid创建
/* 设置全局配置 */ if (!storage.getUuid()) {
config.baseURL = api.buyer; storage.setUuid(uuid.v1());
config.header = { }
...config.header,
}; /* 设置全局配置 */
config.validateStatus = (statusCode) => { config.baseURL = api.buyer;
// 不论什么状态,统一在正确中处理 config.header = {
return true; ...config.header,
}; };
return config; config.validateStatus = (statusCode) => {
}); // 不论什么状态,统一在正确中处理
return true;
http.interceptors.request.use( };
(config) => { return config;
/* 请求之前拦截器。可以使用async await 做异步操作 */ });
let accessToken = storage.getAccessToken();
if (accessToken) { http.interceptors.request.use(
const nonce = Foundation.randomString(6); (config) => {
const timestamp = parseInt(new Date().getTime() / 1000); /* 请求之前拦截器。可以使用async await 做异步操作 */
const sign = md5(nonce + timestamp + accessToken); let accessToken = storage.getAccessToken();
const _params = { if (accessToken) {
nonce, const nonce = Foundation.randomString(6);
timestamp, const timestamp = parseInt(new Date().getTime() / 1000);
sign, const sign = md5(nonce + timestamp + accessToken);
}; const _params = {
let params = config.params || {}; nonce,
params = { ...params, ..._params }; timestamp,
sign,
config.params = params; };
config.header.accessToken = accessToken; let params = config.params || {};
params = {
...params,
} ..._params
config.header = { };
...config.header,
uuid: storage.getUuid() || uuid.v1(), config.params = params;
}; config.header.accessToken = accessToken;
return config;
},
(config) => { }
return Promise.reject(config); config.header = {
} ...config.header,
); uuid: storage.getUuid() || uuid.v1(),
};
return config;
// 是否正在刷新的标记 },
let isRefreshing = false; (config) => {
//重试队列 return Promise.reject(config);
let requests = []; }
// 必须使用异步函数,注意 );
http.interceptors.response.use(
async (response) => {
isNavigateTo = false // 是否正在刷新的标记
/* 请求之后拦截器。可以使用async await 做异步操作 */ let isRefreshing = false;
// token存在并且token过期 //重试队列
// if (isRefreshing && response.statusCode === 403) { let requests = [];
// cleanStorage(); // 必须使用异步函数,注意
// isRefreshing = false; http.interceptors.response.use(
// } async (response) => {
isNavigateTo = false
let token = storage.getAccessToken(); /* 请求之后拦截器。可以使用async await 做异步操作 */
if ( // token存在并且token过期
(token && response.statusCode === 403) || // if (isRefreshing && response.statusCode === 403) {
response.data.status === 403 // cleanStorage();
) { // isRefreshing = false;
if (!isRefreshing) { // }
console.log('旧token',token)
isRefreshing = true; let token = storage.getAccessToken();
storage.setAccessToken('') if (
let oldRefreshToken = storage.getRefreshToken(); (token && response.statusCode === 403) ||
//调用刷新token的接口 response.data.status === 403
return refreshTokenFn(oldRefreshToken) ) {
.then((res) => { if (!isRefreshing) {
let { accessToken, refreshToken } = res.data.result; console.log('旧token', token)
storage.setAccessToken(accessToken); isRefreshing = true;
storage.setRefreshToken(refreshToken); storage.setAccessToken('')
let oldRefreshToken = storage.getRefreshToken();
response.header.accessToken = `${accessToken}`; //调用刷新token的接口
// token 刷新后将数组的方法重新执行 return refreshTokenFn(oldRefreshToken)
console.log('接口队列',requests,'新token',accessToken) .then((res) => {
requests.forEach((cb) => cb(accessToken)); let {
requests = []; // 重新请求完清空 accessToken,
return http.request(response.config); refreshToken
}) } = res.data.result;
.catch((err) => { storage.setAccessToken(accessToken);
console.log('刷新token报错'+oldRefreshToken,err) storage.setRefreshToken(refreshToken);
cleanStorage();
return Promise.reject(err); response.header.accessToken = `${accessToken}`;
}) // token 刷新后将数组的方法重新执行
.finally(() => { console.log('接口队列', requests, '新token', accessToken)
isRefreshing = false; requests.forEach((cb) => cb(accessToken));
}); requests = []; // 重新请求完清空
} else { return http.request(response.config);
// 返回未执行 resolve 的 Promise })
return new Promise((resolve) => { .catch((err) => {
// 用函数形式将 resolve 存入,等待刷新后再执行 console.log('刷新token报错' + oldRefreshToken, err)
requests.push((token) => { cleanStorage();
response.header.accessToken = `${token}`; return Promise.reject(err);
resolve(http.request(response.config)); })
}); .finally(() => {
}); isRefreshing = false;
} });
} else {
// 如果当前返回没登录 // 返回未执行 resolve 的 Promise
} else if ( return new Promise((resolve) => {
(!token && !storage.getRefreshToken() && response.statusCode === 403) || // 用函数形式将 resolve 存入,等待刷新后再执行
response.data.code === 403 requests.push((token) => {
) { response.header.accessToken = `${token}`;
console.log('没有token 以及刷新token 内容',token,storage.getRefreshToken()) resolve(http.request(response.config));
cleanStorage(); });
});
// 如果当前状态码为正常但是success为不正常时 }
} else if (
(response.statusCode == 200 && !response.data.success) || // 如果当前返回没登录
response.statusCode == 400 } else if (
) { (!token && !storage.getRefreshToken() && response.statusCode === 403) ||
if (response.data.message) { response.data.code === 403
uni.showToast({ ) {
title: response.data.message, console.log('没有token 以及刷新token 内容', token, storage.getRefreshToken())
icon: "none", cleanStorage();
duration: 1500,
}); // 如果当前状态码为正常但是success为不正常时
} } else if (
} (response.statusCode == 200 && !response.data.success) ||
return response; response.statusCode == 400
}, ) {
(error) => { if (response.data.message) {
return error; uni.showToast({
} title: response.data.message,
); icon: "none",
duration: 1500,
export { http }; });
}
export const Method = { }
GET: "GET", return response;
POST: "POST", },
PUT: "PUT", (error) => {
DELETE: "DELETE", return error;
}
);
export {
http
};
export const Method = {
GET: "GET",
POST: "POST",
PUT: "PUT",
DELETE: "DELETE",
}; };

View File

@ -215,7 +215,7 @@
if (jump) { if (jump) {
// #ifdef MP // #ifdef MP
if (attrs['app-id']) { if (attrs['app-id']) {
return this.$navigateToMiniProgram({ return uni.navigateToMiniProgram({
appId: attrs['app-id'], appId: attrs['app-id'],
path: attrs.path path: attrs.path
}) })
@ -241,7 +241,7 @@
}) })
// #endif // #endif
} else } else
this.$navigateTo({ uni.navigateTo({
url: attrs.href, url: attrs.href,
fail() { fail() {
uni.switchTab({ uni.switchTab({

View File

@ -331,7 +331,7 @@
} else if (href.indexOf('http') == 0 || href.indexOf('//') == 0) } else if (href.indexOf('http') == 0 || href.indexOf('//') == 0)
return true; return true;
else else
this.$navigateTo({ uni.navigateTo({
url: href url: href
}) })
} }
@ -578,7 +578,7 @@
} else if (href.includes('://')) } else if (href.includes('://'))
plus.runtime.openWeb(href); plus.runtime.openWeb(href);
else else
this.$navigateTo({ uni.navigateTo({
url: href url: href
}) })
} }

View File

@ -114,7 +114,7 @@
url: this.config.url url: this.config.url
}); });
} else { } else {
this.$navigateTo({ uni.navigateTo({
url: this.config.url url: this.config.url
}); });
} }