Commit f8ca9b35 by 杨北旺

Merge branch 'v1.0.0' of http://192.168.3.233:8090/saas/mini-program/zhwy into v1.0.0

2 parents 8b432327 00f48990
...@@ -21,5 +21,18 @@ module.exports = { ...@@ -21,5 +21,18 @@ module.exports = {
method: 'scrm.api.shopmall.discover.category.merchant.list', method: 'scrm.api.shopmall.discover.category.merchant.list',
...data ...data
}) })
},
getDiscoverConfig(data) {
return api.post({
method: 'scrm.api.shopmall.weapp.discover.channel.merchant.getconfig',
...data
})
},
/**查询小程序发现频道-配置升级的商品 */
getDiscoverChannelCategoryGoods(data) {
return api.post({
method: 'scrm.api.shopmall.goods.configuration.list.mini',
...data
})
} }
} }
\ No newline at end of file \ No newline at end of file
import api from "../request/http"; import api from "../request/http";
const path = 'scrm.api.shopmall.weapp.'
module.exports = { module.exports = {
/** 分页查询商城专区的商品信息 */ /** 分页查询商城专区的商品信息 */
getGoodsList(data) { getGoodsList(data) {
...@@ -10,6 +10,15 @@ module.exports = { ...@@ -10,6 +10,15 @@ module.exports = {
...data, ...data,
}); });
}, },
//评论列表
getCommentList(data) {
return api.post({
method: `${path}orderGoodsComment.page`,
...data
},
true
)
},
/** 添加购物车 */ /** 添加购物车 */
addShoppingcart(data) { addShoppingcart(data) {
return api.post({ return api.post({
......
...@@ -68,7 +68,7 @@ class UsersApi { ...@@ -68,7 +68,7 @@ class UsersApi {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject() if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
wx.$api.showLoading() wx.p.wxApi.showLoading()
detail.sessionId = sessionId detail.sessionId = sessionId
wx.p.storage.rm('userInfo') wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId') wx.p.storage.rm('sessionId')
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
import sentryInit from "~/utils/sentryConfig/sentryInit"; import sentryInit from "~/utils/sentryConfig/sentryInit";
sentryInit(); sentryInit();
import api from "./api/index"; import api from "./api/index";
import { router } from "./router/index"; // import { router } from "./router/index";
import router from "./router/index.js";
// 判断小程序是否需要更新 // 判断小程序是否需要更新
import { getUpdateManager } from "./lib/index"; import { getUpdateManager } from "./lib/index";
import {IMG_URL} from '~/config' import {IMG_URL} from '~/config'
...@@ -25,15 +26,15 @@ App({ ...@@ -25,15 +26,15 @@ App({
$Track: new TRACK(options), $Track: new TRACK(options),
IMGURL:IMG_URL IMGURL:IMG_URL
}; };
console.log(wx.p); // console.log(wx.p);
const { // const {
scene, // scene,
query, // query,
query: { // query: {
pageType // pageType
} // }
} = wx.getEnterOptionsSync() // } = wx.getEnterOptionsSync()
console.log(scene,query,pageType,'二次扫码'); // console.log(scene,query,pageType,'二次扫码');
// 存储设备信息 // 存储设备信息
utils.cache.storageApi.setSystem_info(); utils.cache.storageApi.setSystem_info();
......
...@@ -71,7 +71,8 @@ ...@@ -71,7 +71,8 @@
"pages/shoppingCart/shoppingCart", "pages/shoppingCart/shoppingCart",
"pages/pay/pay", "pages/pay/pay",
"pages/detail/detail", "pages/detail/detail",
"pages/getCoupon/getCoupon" "pages/getCoupon/getCoupon",
"pages/goodsVideo/goodsVideo"
] ]
}, },
{ {
...@@ -149,7 +150,8 @@ ...@@ -149,7 +150,8 @@
"root": "packageEquity", "root": "packageEquity",
"pages": [ "pages": [
"pages/road/index/index", "pages/road/index/index",
"pages/road/roadInfo/roadInfo" "pages/road/roadInfo/roadInfo",
"pages/freecard/freecard"
] ]
} }
], ],
......
@import "assets/style/common.wxss"; @import "assets/style/common.wxss";
@import "style/sprite.wxss";
page { page {
background-color: #F8F8F8 !important; background-color: #F8F8F8 !important;
......
// components/GoodsAction/GoodsAction.js // components/GoodsAction/GoodsAction.js
Component({ Component({
options: {
styleIsolation: 'shared'
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<view class="goods-action"> <view class="goods-action">
<view class="navigation-box"> <view class="navigation-box">
<view class="item" bindtap="jump" data-url="home"> <view class="item" bindtap="jump" data-url="home">
<view class="sprite-icon"> <view class="sprite-icon icon-goods-home">
<glsx-image src="mall/goods-home.png"></glsx-image> <!-- <glsx-image src="mall/goods-home.png"></glsx-image> -->
</view> </view>
首页 首页
</view> </view>
<view class="item" wx:if="{{!hideShop}}" bindtap="jump"> <view class="item" wx:if="{{!hideShop}}" bindtap="jump">
<view class="sprite-icon" > <view class="sprite-icon icon-goods-shopping" >
<glsx-image src="mall/goods-shopping.png"></glsx-image> <!-- <glsx-image src="mall/goods-shopping.png"></glsx-image> -->
</view> </view>
购物车 购物车
</view> </view>
......
...@@ -16,7 +16,7 @@ Page({ ...@@ -16,7 +16,7 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
console.log(options,123355); console.log(options,123355);
wx.$api.showLoading('加载中') wx.p.wxApi.showLoading('加载中')
if (options && options.orderCode) { if (options && options.orderCode) {
this.checkPay(options.orderCode) this.checkPay(options.orderCode)
this.query = JSON.parse(options.query) this.query = JSON.parse(options.query)
...@@ -46,7 +46,7 @@ Page({ ...@@ -46,7 +46,7 @@ Page({
}, },
pay() { pay() {
let _this = this let _this = this
wx.$api.showLoading('加载中') wx.p.wxApi.showLoading('加载中')
shopmallApi shopmallApi
.createOrder(this.query) .createOrder(this.query)
.then(data => { .then(data => {
......
import { couponsApi, shopmallApi, ssoApi } from '~/api/index'
import USER from '~/api/usersApi/index'
import { defaultMerchantId } from '~/api/env/index'
Page({
data: {
IMGURL: wx.p.IMGURL,
freeDay: 0,
paddingH: 86,
textpadding: 508,
showAuthBtn: true
},
toPostFreeCard(merchantId, phone, userInfo) {
let para = {
merchantId,
phone
}
couponsApi.tolqFreecard(para).then(res => {
wx.hideLoading()
const { errId, code, message } = res
if ((code == -1 && errId == 20313) || (code == -1 && errId == 20322)) {
wx.showModal({
title: '提示',
content: res.message,
confirmText: '确定',
showCancel: false,
confirmColor: '#F13C3D'
})
return
}
let bindInfo = {
code,
errId,
message,
data: {
sessionId: userInfo.sessionId
}
}
let temp = encodeURIComponent(JSON.stringify(bindInfo))
//埋点
let trackobj = {
...this.data.tempOptions,
phone: para.phone
}
if (this.data.tempOptions) {
wx.p.util.reportData(trackobj, false, true)
}
wx.$storage.set('bindInfo', temp)
wx.$router.reLaunch('/pages/tab/shopMall/index?tabIndex=1', { notIntercept: true })
})
},
toGetFreeCardDay(merchantId) {
couponsApi
.getFreeCardDay({
merchantId
})
.then(res => {
if (res) {
this.setData({
freeDay: res.freeDay || 0
})
}
})
},
tofreeReceive() {
if(this.op){
wx.$api.showLoading()
this.freeLogin()
return
}
let { loginInfo } = this.data
let { merchantId, phone } = loginInfo
if (!phone) {
return
}
wx.$api.showLoading()
this.toPostFreeCard(merchantId, phone, loginInfo)
},
login() {
USER.login().then(res => {
if (res.data) {
console.log(res.data)
let { phone, sessionId } = res.data
wx.$authStatus = phone ? false : true
if (res.data.isLogin) {
wx.p.util.setUserInfo(res.data)
wx.p.util.setSessionId(res.data.sessionId)
this.handlerCustomerId()
}
this.setData({
loginInfo: res.data,
showAuthBtn: phone ? false : true,
sessionId
})
}
})
},
getPhoneNumber({ detail }) {
const { sessionId } = this.data
if (!sessionId) return
USER.authUserPhone(detail, sessionId).then(({ data, code, message }) => {
wx.hideLoading()
if (code == '0') {
wx.$authStatus = false
wx.p.util.setUserInfo(data)
wx.p.util.setSessionId(data.sessionId)
let { merchantId, phone } = data
this.toPostFreeCard(merchantId, phone, data)
this.handlerCustomerId()
} else wx.$api.showToast(message)
})
},
onLoad(options) {
let system = wx.getSystemInfoSync()
// const merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
const merchantId = wx.$merchant_id
let newMerchantId = merchantId || defaultMerchantId
if (options && options.scene) {
this.getLiveActivityId(decodeURIComponent(options.scene))
} else {
this.toGetFreeCardDay(newMerchantId)
this.login()
}
this.setData({
paddingH: system.windowHeight * 0.11,
textpadding: system.windowHeight * 0.31
})
// 埋点---定保
if (options.activity_id) {
this.data.tempOptions = options
wx.p.util.reportData(options, true, false)
}
},
// 获取scene
getLiveActivityId(str) {
shopmallApi
.getLiveActivityId({
id: str.split('=')[1]
})
.then(({ code, data }) => {
if (code == 0) {
let op = {}
data.scene.split('&').map(item => {
const [key, val] = item.split('=')
op[key] = val
})
if (op.merchantId) wx.$storage.set('srcm_shopmall_merchant_id', op.merchantId)
if (op.openId) {
wx.setStorageSync('showServicesMerchantId', op.merchantId);
wx.$eventbus.emit('SERVICES', true)
this.phone = op.phone
this.merchantId = op.merchantId
this.setData({
showAuthBtn: false,
})
this.op = op
} else {
this.login()
}
this.toGetFreeCardDay(op.merchantId)
}
})
},
// 客户id
handlerCustomerId() {
let customerId = wx.$storage.get('srcm_shopmall_customer_id')
if (customerId) USER.updataCustomerPhone()
},
freeLogin() {
let op = this.op
// wx.clearStorageSync();
ssoApi.loginByOpenId({
openId: op.openId
}).then(({
code,
data,
message
}) => {
wx.$authStatus = code != 0
if (code == '0') {
wx.p.util.setUserInfo(data)
wx.p.util.setSessionId(data.sessionId)
wx.$authStatus = false
this.sessionId = data.sessionId
this.toPostFreeCard(op.merchantId, op.phone, data)
// wx.$storage.set('srcm_shopmall_merchant_id', op.merchantId)
// wx.setStorageSync('showServicesMerchantId', op.merchantId);
// wx.$eventbus.emit('SERVICES', true)
// wx.$storage.set('bindInfo', temp)
// wx.$router.reLaunch('/pages/tab/shopMall/index?tabIndex=1', { notIntercept: true })
} else {
wx.$api.showToast(message || '系统异常')
}
})
},
onUnload: function () {
wx.p.util.customerbehavior(2)
}
})
{
"navigationStyle": "custom"
}
\ No newline at end of file \ No newline at end of file
/* packageEquity/pages/freecard/freecard.wxss */
\ No newline at end of file \ No newline at end of file
<view class="freecard_container" style="padding-bottom:{{paddingH}}rpx;box-sizing: border-box;">
<image webp class="bgIcon"src="{{IMGURL}}equity/freecard_bg_icon.png?v={{img_version}}" />
<view class="wrapper2" style="top:{{textpadding}}rpx">
<view class="dayText">
{{freeDay}}
<text class="mintext">天</text>
</view>
<image webp class="bottomIcon" mode="widthFix" src="{{IMGURL}}equity/mini_new_freecard_icon_text.png?v={{img_version}}" />
</view>
<view class="wrapper1">
<!-- <view class="btnText" bind:tap="tofreeReceive">免费领取</view> -->
<block wx:if="{{showAuthBtn}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="auth-button"></button>
</block>
<image webp bind:tap="tofreeReceive" webp class="bottomIcon animaiton" mode="widthFix" src="{{IMGURL}}equity/freecard_btn_icon_new.png?v={{img_version}}" />
</view>
<view style="height:22rpx"></view>
<view class="wrapper1">
<image webp class="bottomIcon" webp mode="widthFix" src="{{IMGURL}}equity/new_freecard_icon.png?v={{img_version}}" />
</view>
</view>
<services/>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
.freecard_container {
width: 100%;
height: 100vh;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
.bgIcon {
width: 100%;
height: 100%;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.wrapper1 {
box-sizing: border-box;
padding: 0 52rpx 0 54rpx;
width: 100%;
position: relative;
z-index: 100;
}
.wrapper2 {
box-sizing: border-box;
padding: 0 78rpx 0 96rpx;
position: absolute;
left: 0;
right: 0;
top: 238rpx;
width: 100%;
z-index: 100;
}
.auth-button {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
opacity: 0;
z-index: 102;
}
.btnText {
position: absolute;
left: 50%;
bottom: 30rpx;
transform: translate(-50%, 0);
font-size: 44rpx;
font-weight: 600;
color: #FD6037;
letter-spacing: 2rpx;
z-index: 101;
}
.dayText {
font-size: 80rpx;
font-weight: 600;
color: #FFF8E4;
text-shadow: 0rpx 4rpx 8rpx #E3612C;
position: absolute;
left: 265rpx;
bottom: 70rpx;
display: flex;
align-items: center;
justify-content: center;
width: 180rpx;
}
.mintext {
font-size: 56rpx;
font-weight: 600;
color: #FFF8E4;
text-shadow: 0rpx 4rpx 8rpx #E3612C;
margin-left: 10rpx;
margin-top: 8rpx;
}
.bottomIcon {
width: 100%;
/* height: 414rpx; */
}
.animaiton {
animation: scaleDrew 2.5s infinite;
}
@keyframes scaleDrew {
/* 定义关键帧、scaleDrew是需要绑定到选择器的关键帧名称 */
0% {
transform: scale(1);
}
25% {
transform: scale(0.9);
}
50% {
transform: scale(1);
}
75% {
transform: scale(0.9);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ Page({ ...@@ -8,6 +8,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMGURL: wx.p.IMGURL,
navStyle, navStyle,
bannerIndex: 0, bannerIndex: 0,
contactInfo: {}, contactInfo: {},
...@@ -396,6 +397,8 @@ Page({ ...@@ -396,6 +397,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onRoute: function (options) { onRoute: function (options) {
// debugger
console.log(options,'options');
if(options&&options.openId){ if(options&&options.openId){
this.shareOpenId = options.openId this.shareOpenId = options.openId
} }
...@@ -521,7 +524,7 @@ Page({ ...@@ -521,7 +524,7 @@ Page({
} = this.data } = this.data
let target = isActivity ? 'getActivitylink' : 'getGoodslink' let target = isActivity ? 'getActivitylink' : 'getGoodslink'
wx.$api.showLoading('加载中...') wx.p.wxApi.showLoading('加载中...')
wx.p.api.shopmallApi[target](id).then(res => { wx.p.api.shopmallApi[target](id).then(res => {
if (res.code == '0') { if (res.code == '0') {
posterUrl = res.data.posterUrl posterUrl = res.data.posterUrl
...@@ -543,7 +546,7 @@ Page({ ...@@ -543,7 +546,7 @@ Page({
isLive isLive
} = this.data } = this.data
let target = isActivity ? 'getActivityDetail' : 'getGoodsDetail' let target = isActivity ? 'getActivityDetail' : 'getGoodsDetail'
wx.$api.showLoading('加载中...') wx.p.wxApi.showLoading('加载中...')
if (isLive) { if (isLive) {
wx.p.api.shopmallApi wx.p.api.shopmallApi
.getLiveActivityDetail({ .getLiveActivityDetail({
...@@ -571,7 +574,7 @@ Page({ ...@@ -571,7 +574,7 @@ Page({
...data, ...data,
goodsId: data.id goodsId: data.id
} }
wx.$Track.setTrack(trackobj, 6) // wx.$Track.setTrack(trackobj, 6)
let activeSku = null let activeSku = null
if (data.expressFee != null) data.expressFee = wx.p.format.centsToyuan(data.expressFee) if (data.expressFee != null) data.expressFee = wx.p.format.centsToyuan(data.expressFee)
if (isActivity) { if (isActivity) {
...@@ -764,11 +767,14 @@ Page({ ...@@ -764,11 +767,14 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {}, onReady: function () {
// debugger
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
// debugger
// let { // let {
// id, // id,
// isActivity // isActivity
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<view class="back text-center y-center" bindtap="back"> <view class="back text-center y-center" bindtap="back">
<image webp src="{{IMGURL}}mall/{{showHomeBtn?'home':'back'}}.png" class="icon"></image> <image webp src="{{IMGURL}}mall/{{showHomeBtn?'home':'back'}}.png" class="icon"></image>
</view> </view>
</view>
</navigation-bar>
<!-- <view class="text box-center"> <!-- <view class="text box-center">
{{isActivity?goodsInfo.activityName:goodsInfo.goodsName}} {{isActivity?goodsInfo.activityName:goodsInfo.goodsName}}
</view> --> </view> -->
</view>
</navigation-bar>
</view> </view>
<view class="empty-page" wx:if="{{!goodsFlag && !isLoading}}"> <view class="empty-page" wx:if="{{!goodsFlag && !isLoading}}">
<image webp class="empty-img" src="{{IMGURL}}mall/active-empty.png?v={{img_version}}" /> <image webp class="empty-img" src="{{IMGURL}}mall/active-empty.png?v={{img_version}}" />
......
...@@ -3,7 +3,7 @@ import { couponsApi,userApi } from "~/api/index"; ...@@ -3,7 +3,7 @@ import { couponsApi,userApi } from "~/api/index";
import { centsToyuan } from '~/utils/format' import { centsToyuan } from '~/utils/format'
// import USER from '~/api/usersApi/index' // import USER from '~/api/usersApi/index'
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
console.log(couponsApi,'couponsApi'); // console.log(couponsApi,'couponsApi');
Page({ Page({
/** /**
...@@ -66,7 +66,8 @@ Page({ ...@@ -66,7 +66,8 @@ Page({
}) })
}, },
getMerchantCouponList(){ getMerchantCouponList(){
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') // const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id')
const merchantId = wx.$merchant_id
couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => { couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
if(res?.length) { if(res?.length) {
res.forEach(item =>{ res.forEach(item =>{
...@@ -79,7 +80,8 @@ Page({ ...@@ -79,7 +80,8 @@ Page({
}) })
}, },
receiveCoupon(){ receiveCoupon(){
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') // const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id')
const merchantId = wx.$merchant_id
let couponIds = this.data.couponList?.map(item => item.couponId) let couponIds = this.data.couponList?.map(item => item.couponId)
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
couponsApi.batchGetMerchantCouponsApi({merchantId,couponIds,discoverGoodsType:this.options.discoverGoodsType}).then(res => { couponsApi.batchGetMerchantCouponsApi({merchantId,couponIds,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
...@@ -112,7 +114,8 @@ Page({ ...@@ -112,7 +114,8 @@ Page({
}, 1 * 1000) }, 1 * 1000)
}, },
JumpDiscoverPage(){ JumpDiscoverPage(){
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') // const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id')
const merchantId = wx.$merchant_id
const channel = this.options.discoverGoodsType==1 ? 5 : 6 const channel = this.options.discoverGoodsType==1 ? 5 : 6
wx.$router.reLaunch(`/packageDiscovery/pages/index/index?merchantId=${merchantId}&channel=${channel}`, { notIntercept: true }) wx.$router.reLaunch(`/packageDiscovery/pages/index/index?merchantId=${merchantId}&channel=${channel}`, { notIntercept: true })
}, },
...@@ -149,7 +152,8 @@ Page({ ...@@ -149,7 +152,8 @@ Page({
this.setData({ this.setData({
sessionId: '', sessionId: '',
}) })
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') // const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id')
const merchantId = wx.$merchant_id
couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => { couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
if(res?.length) { if(res?.length) {
this.receiveCoupon() this.receiveCoupon()
......
// packageShopmall/packageMall/pages/goodsVideo/goodsVideo.js
Page({
/**
* 页面的初始数据
*/
data: {
goodsInfo:{},
navStyle: "background-color: transparent;"
},
/**
* 生命周期函数--监听页面加载
*/
onRoute(options) {
this.setData({
goodsInfo: options
})
// let videoContext = wx.createVideoContext('myVideo'); //获取video的dom
// videoContext.requestFullScreen({ direction: 0 });
// videoContext.play() //视频播放
},
goDetailPage(){
wx.$router.go('/packageShopmall/packageMall/pages/detail/detail', {
id: this.data.goodsInfo.id,
isCarOwner: true,
notIntercept: true,
hasCouponFlag: this.data.goodsInfo.hasCouponFlag
})
},
toBack() {
wx.$router.back()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom"
}
\ No newline at end of file \ No newline at end of file
/* packageShopmall/packageMall/pages/goodsVideo/goodsVideo.wxss */
.bar-text {
font-weight: 600;
font-size: 34rpx;
color: #fff;
}
.nav-func-icon {
width: 44rpx;
height: 44rpx;
position: absolute;
left: 16rpx;
top: 50%;
transform: translateY(-50%);
}
.video-ctnr{
height: 100vh;
position: relative;
overflow: hidden;
.my-video{
height: 100%;
width: 100%;
}
.content-ctnr{
position: absolute;
bottom: 278rpx;
left: 24rpx;
z-index: 2;
}
.goods-ctnr{
position: relative;
width: 436rpx;
height: 208rpx;
background-color: #fff;
border-radius: 16rpx;
.title{
background-image: linear-gradient(-88deg, #FFBDC2 8%, #FFD7E2 98%);
height: 44rpx;
line-height: 44rpx;
font-size: 20rpx;
color: #FF3C5E;
padding: 0 20rpx;
border-radius: 16rpx 16rpx 0 0;
}
.goods-wrap{
display: flex;
padding: 12rpx;
.goods-img{
width: 140rpx;
height: 140rpx;
flex-shrink: 0;
border-radius: 12rpx;
}
.goods-info{
flex: 1;
margin-left: 12rpx;
position: relative;
.name{
width: 260rpx;
height: 28rpx;
font-weight: 400;
font-size: 20rpx;
color: #0A0D14;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.new-price{
font-weight: 600;
font-size: 26rpx;
color: #FF6038;
height: 36rpx;
line-height: 36rpx;
margin-top: 46rpx;
}
.old-price{
font-weight: 400;
font-size: 20rpx;
color: #3F444D;
// margin-top: 4rpx;
text-decoration: line-through;
}
.buy-btn{
position: absolute;
right: 0;
bottom: 0;
width: 100rpx;
line-height: 40rpx;
height: 40rpx;
background-image: linear-gradient(-88deg, #FF1261 8%, #FF5C5D 98%);
border-radius: 32rpx;
font-size: 20rpx;
color: #FFFFFF;
text-align: center;
}
}
}
}
.desc{
color: #fff;
margin-top: 18rpx;
font-weight: 500;
font-size: 24rpx;
line-height: 36rpx;
text-shadow: 0 2rpx 8rpx #00000080;
}
}
\ No newline at end of file \ No newline at end of file
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现专区">
<view class="bar-nav">
<glsx-image class="nav-func-icon" bind:tap="toBack" webp src="glsx/discover/version/3_13_0/back_icon_white.png"></glsx-image>
<view class="bar-text">发现专区</view>
</view>
</navigation-bar>
<view class="video-ctnr">
<video
class="my-video"
id="myVideo"
src="{{goodsInfo.commerceVideo}}"
binderror="videoErrorCallback"
autoplay
loop
show-fullscreen-btn="{{false}}"
show-center-play-btn="{{true}}"
show-play-btn="{{true}}"
controls="{{true}}"
></video>
<view class="content-ctnr">
<view class="goods-ctnr" bindtap="goDetailPage">
<view class="title">商品热卖中</view>
<view class="goods-wrap">
<image class="goods-img" src="{{goodsInfo.coverUrl}}" mode=""/>
<view class="goods-info">
<view class="name">{{goodsInfo.goodsName}}</view>
<view class="new-price">¥{{goodsInfo.activityPrice}}</view>
<view class="old-price">¥{{goodsInfo.originalPrice}}</view>
<view class="buy-btn">购买</view>
</view>
</view>
</view>
<view class="desc">
{{goodsInfo.commerceDescribe}}
</view>
</view>
</view>
...@@ -183,7 +183,7 @@ Page({ ...@@ -183,7 +183,7 @@ Page({
}) })
}, },
comfirmBuyItem() { comfirmBuyItem() {
wx.$api.showLoading() wx.p.wxApi.showLoading()
let para = { let para = {
supplier: this.data.query.supplier supplier: this.data.query.supplier
} }
...@@ -291,7 +291,7 @@ Page({ ...@@ -291,7 +291,7 @@ Page({
}, },
// 广汇赠送权益直充 // 广汇赠送权益直充
toRechargeFill(phone){ toRechargeFill(phone){
wx.$api.showLoading() wx.p.wxApi.showLoading()
const {productId,orderCode,productName,discount} = this.data.ghOption const {productId,orderCode,productName,discount} = this.data.ghOption
wx.p.api.equityApi.toRechargeByPhone({orderCode,phone,productId}).then(res=>{ wx.p.api.equityApi.toRechargeByPhone({orderCode,phone,productId}).then(res=>{
if(res){ if(res){
......
// pages/loading/loading.js // pages/loading/loading.js
import { import { systemApi } from '~/api/index'
systemApi
} from '~/api/index'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {},
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
...@@ -29,18 +24,17 @@ Page({ ...@@ -29,18 +24,17 @@ Page({
this.login(options) this.login(options)
}, },
async login(options = {}) { async login(options = {}) {
if (options.merchantId) wx.$merchant_id = options.merchantId console.log(options, 'options.merchantId')
// wx.p.router.goHome()
if (options.merchantId) wx.$merchant_id = options.merchantId
try { try {
const { const { code, data, message } = await wx.p.api.userApi.login()
code,
data,
message
} = await wx.p.api.userApi.login()
wx.$LoginStatus = code != 0 wx.$LoginStatus = code != 0
if (data) wx.p.storage.set('merchant_info', { if (data)
merchantId: data.merchantId, wx.p.storage.set('merchant_info', {
merchantName: data.merchantName merchantId: data.merchantId,
}) merchantName: data.merchantName
})
if (code == '0') { if (code == '0') {
wx.p.storage.set('userInfo', data) wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId) wx.p.storage.set('sessionId', data.sessionId)
...@@ -48,7 +42,6 @@ Page({ ...@@ -48,7 +42,6 @@ Page({
} else { } else {
wx.p.storage.rm('userInfo') wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId') wx.p.storage.rm('sessionId')
} }
console.log('登陆信息:', data) console.log('登陆信息:', data)
if (options.url) { if (options.url) {
...@@ -65,11 +58,9 @@ Page({ ...@@ -65,11 +58,9 @@ Page({
}, },
async getSceneById(scene) { async getSceneById(scene) {
const id = decodeURIComponent(scene).split('=').at(-1) const id = decodeURIComponent(scene).split('=').at(-1)
console.log(decodeURIComponent(scene),'decodeURIComponent(scene)');
try { try {
const { const { code, data } = await wx.p.api.wechatApi.getSceneById({
code,
data
} = await wx.p.api.wechatApi.getSceneById({
id id
}) })
const params = data.scene.split('url='), const params = data.scene.split('url='),
...@@ -84,11 +75,7 @@ Page({ ...@@ -84,11 +75,7 @@ Page({
}, },
jumpPage(val) { jumpPage(val) {
const targetPath = decodeURIComponent(val), const targetPath = decodeURIComponent(val),
{ { url, events } = this.setRouteData(targetPath),
url,
events
} = this.setRouteData(targetPath),
routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo' routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo'
events.notIntercept = true events.notIntercept = true
wx.p.router[routeName](url, events) wx.p.router[routeName](url, events)
...@@ -111,4 +98,4 @@ Page({ ...@@ -111,4 +98,4 @@ Page({
events events
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -102,11 +102,12 @@ Page({ ...@@ -102,11 +102,12 @@ Page({
getMerchantList() { getMerchantList() {
const merchantObj = { const merchantObj = {
'develop': [44211227, 44209845], 'develop': [44211227, 44209845],
'test': [44212577, 44212578], 'test': [44212577,44210895, 44212578,44210956],
'beta': [], 'beta': [],
'production': [44209566, 44209565], 'production': [44209566, 44209565],
} }
const MerchantList = merchantObj[env] const MerchantList = merchantObj[env]
console.log(MerchantList,'MerchantList');
let storeList = [],index = 0 let storeList = [],index = 0
MerchantList.forEach((el,i) => { MerchantList.forEach((el,i) => {
wx.$merchant_id = el wx.$merchant_id = el
...@@ -125,11 +126,13 @@ Page({ ...@@ -125,11 +126,13 @@ Page({
}) })
if(storeList.length==2){ if(storeList.length==2){
storeList.forEach((ele,i)=>{ storeList.forEach((ele,i)=>{
console.log(i,this.defaultMerchant);
if( this.defaultMerchant==i){ if( this.defaultMerchant==i){
index = i index = i
} }
}) })
const currentStore = storeList[index] const currentStore = storeList[index]
console.log(currentStore,index,'currentStore');
wx.$merchant_id = currentStore.merchantId wx.$merchant_id = currentStore.merchantId
this.setData({ this.setData({
storeList, storeList,
......
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
decimal, decimal,
centsToyuan centsToyuan
} from '~/utils/format' } from '~/utils/format'
import {eventbus} from '~/utils/index'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -21,6 +22,15 @@ Component({ ...@@ -21,6 +22,15 @@ Component({
} }
}, },
}, },
merchantid: {
type: [String,Number],
observer: function (val) {
if (val) {
this.init()
// this.setList(val);
}
},
},
}, },
/** /**
...@@ -61,7 +71,7 @@ Component({ ...@@ -61,7 +71,7 @@ Component({
}, },
//获取分类 //获取分类
getCategoryList() { getCategoryList() {
const merchantId = wx.p.storage.get("srcm_shopmall_merchant_id"); const merchantId = wx.$merchant_id
const _params = { const _params = {
merchantId, merchantId,
categoryType: '2' categoryType: '2'
...@@ -73,13 +83,14 @@ Component({ ...@@ -73,13 +83,14 @@ Component({
categoryStyle: res[0].categoryStyle || 0 categoryStyle: res[0].categoryStyle || 0
}) })
this.triggerEvent('showShoppingCar', res[0].categoryStyle) this.triggerEvent('showShoppingCar', res[0].categoryStyle)
console.log(res[0].id,'res[0].id');
this.getCategoryGoodsList(res[0].id) this.getCategoryGoodsList(res[0].id)
} }
}) })
}, },
//获取商品列表 //获取商品列表
async getCategoryGoodsList(categoryId) { async getCategoryGoodsList(categoryId) {
const merchantId = wx.p.storage.get("srcm_shopmall_merchant_id"); const merchantId = wx.$merchant_id
let _para = { let _para = {
merchantId, merchantId,
categoryId, categoryId,
...@@ -138,6 +149,7 @@ Component({ ...@@ -138,6 +149,7 @@ Component({
}, },
// 跳转商品详情 // 跳转商品详情
toGoodsDetail(e) { toGoodsDetail(e) {
// debugger
const { const {
item item
} = e.currentTarget.dataset } = e.currentTarget.dataset
...@@ -150,7 +162,7 @@ Component({ ...@@ -150,7 +162,7 @@ Component({
} }
if(item.commerceVideo){ if(item.commerceVideo){
const {coverUrl, commerceVideo, commerceDescribe, activityPrice, originalPrice, goodsName, goodsImage,id} = item const {coverUrl, commerceVideo, commerceDescribe, activityPrice, originalPrice, goodsName, goodsImage,id} = item
wx.$router.go(`/packageShopmall/packageMall/pages/goodsVideo/goodsVideo`, { wx.p.router.go(`packageMall/pages/goodsVideo/goodsVideo`, {
id, id,
notIntercept:true, notIntercept:true,
coverUrl: goodsImage, coverUrl: goodsImage,
...@@ -162,7 +174,7 @@ Component({ ...@@ -162,7 +174,7 @@ Component({
hasCouponFlag: this.data.hasCarOwnerCouponFlag hasCouponFlag: this.data.hasCarOwnerCouponFlag
}); });
}else{ }else{
wx.$router.go('/packageShopmall/packageMall/pages/detail/detail', { wx.p.router.go('/packageMall/pages/detail/detail', {
id: item.id, id: item.id,
hasCouponFlag: this.data.hasCarOwnerCouponFlag, hasCouponFlag: this.data.hasCarOwnerCouponFlag,
isCarOwner: true, isCarOwner: true,
...@@ -200,21 +212,21 @@ Component({ ...@@ -200,21 +212,21 @@ Component({
async getBuyCarList() { async getBuyCarList() {
const B_userInfo = wx.p.storage.get('userInfo') const B_userInfo = wx.p.storage.get('userInfo')
if (B_userInfo && B_userInfo.userType) return; if (B_userInfo && B_userInfo.userType) return;
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') const merchantId = wx.$merchant_id
const res = await shopmallApi.getShoppingcartList({ const res = await shopmallApi.getShoppingcartList({
cartType: 4, cartType: 4,
merchantId merchantId
}) })
wx.$eventbus.emit('getBuyCarList', res) eventbus.emit('getBuyCarList', res)
}, },
// 加入购物车 // 加入购物车
async toAddBuuCar(e) { async toAddBuuCar(e) {
if (wx.$authStatus) { if (wx.$authStatus) {
if(this.data.hasCarOwnerCouponFlag){ if(this.data.hasCarOwnerCouponFlag){
wx.$router.go(`/packageShopmall/packageMall/pages/getCoupon/getCoupon?discoverGoodsType=2&from=2`, { notIntercept:true }); wx.p.router.go(`packageMall/pages/getCoupon/getCoupon?discoverGoodsType=2&from=2`, { notIntercept:true });
}else{ }else{
wx.navigateTo({ wx.navigateTo({
url: '/pages/Login/Login' url: 'pages/Login/Login'
}) })
} }
return return
...@@ -234,7 +246,7 @@ Component({ ...@@ -234,7 +246,7 @@ Component({
} }
}, },
getCarOwnerCouponList(){ getCarOwnerCouponList(){
const merchantId = wx.p.storage.get('srcm_shopmall_merchant_id') const merchantId = wx.$merchant_id
couponsApi.getMerchantCouponsListApi({merchantId, discoverGoodsType: 2}).then(res => { couponsApi.getMerchantCouponsListApi({merchantId, discoverGoodsType: 2}).then(res => {
if(res?.length){ if(res?.length){
this.setData({ this.setData({
...@@ -245,15 +257,18 @@ Component({ ...@@ -245,15 +257,18 @@ Component({
}, },
onShow(){ onShow(){
this.getBuyCarList() this.getBuyCarList()
},
init () {
this.getCategoryList()
const B_userInfo = wx.p.storage.get('userInfo')
if(B_userInfo && B_userInfo.userType)return
this.getBuyCarList()
this.getCarOwnerCouponList()
} }
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
this.getCategoryList() // this.init()
const B_userInfo = wx.p.storage.get('userInfo')
if(B_userInfo && B_userInfo.userType)return
this.getBuyCarList()
this.getCarOwnerCouponList()
} }
} }
}) })
...@@ -7,8 +7,8 @@ page{ ...@@ -7,8 +7,8 @@ page{
height: 184rpx; height: 184rpx;
background: #F8F9FC; background: #F8F9FC;
box-sizing: border-box; box-sizing: border-box;
padding-left: 20rpx; padding-left: 52rpx;
padding-top: 8rpx; padding-top: 30rpx;
.inner { .inner {
width: calc(100% - 20rpx); width: calc(100% - 20rpx);
height: 184rpx; height: 184rpx;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view id="toCategory-{{index}}" data-item="{{item}}" bind:tap="toSelectCategory" data-index="{{index}}" class="image_text"> <view id="toCategory-{{index}}" data-item="{{item}}" bind:tap="toSelectCategory" data-index="{{index}}" class="image_text">
<view class="box {{curCategoryIdx==index?'box_active':''}}"> <view class="box {{curCategoryIdx==index?'box_active':''}}">
<image mode="aspectFill" class="icon" webp src="{{item.categoryImage}}"></image> <image mode="aspectFill" class="icon" webp src="{{item.categoryImage}}"></image>
<glsx-image wx:if="{{curCategoryIdx==index}}" class="icon_active" webp src="/glsx/discover/version/3_13_0/select_seri.png"></glsx-image> <glsx-image wx:if="{{curCategoryIdx==index}}" class="icon_active" webp src="discover/version/1_0_0/select_seri.png"></glsx-image>
</view> </view>
<view class="text hide {{curCategoryIdx==index?'text_active':''}}"> <view class="text hide {{curCategoryIdx==index?'text_active':''}}">
{{item.categoryName}} {{item.categoryName}}
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<text class="new_price">{{item.activityPrice}}</text> <text class="new_price">{{item.activityPrice}}</text>
<text class="old_price">{{item.originalPrice}}</text> <text class="old_price">{{item.originalPrice}}</text>
</text> </text>
<glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="glsx/discover/version/3_13_0/add_buyCar_icon.png"></glsx-image> <glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_13_0/add_buyCar_icon.png"></glsx-image>
</view> </view>
<block wx:if="{{!categoryStyle}}"> <block wx:if="{{!categoryStyle}}">
<text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<text class="new_price">{{item.activityPrice}}</text> <text class="new_price">{{item.activityPrice}}</text>
<text class="old_price">{{item.originalPrice}}</text> <text class="old_price">{{item.originalPrice}}</text>
</text> </text>
<glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="glsx/discover/version/3_13_0/add_buyCar_icon.png"></glsx-image> <glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_0_0/add_buyCar_icon.png"></glsx-image>
</view> </view>
</view> </view>
</view> </view>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</block> </block>
</view> </view>
</block> </block>
<view style="height: 116rpx;"> <!-- <view style="height: 116rpx;">
</view> </view> -->
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
import { discoveryApi } from "~/api/index"
Page({ Page({
data:{ data: {
showCarFlag: false, showCarFlag: false,
currentChannel:{ currentChannel: {
id:6 id: 6
}
},
onShow() {
let {
merchantId
} = this.data
let newMerchantId = wx.$merchant_id
// debugger
console.log(newMerchantId, 'wx.$merchant_id');
if (newMerchantId != merchantId && newMerchantId ) {
this.setData({
merchantId: newMerchantId
})
this.getDiscoverInfo(newMerchantId, 6)
}
},
getDiscoverInfo(merchantId, channel) {
console.log(merchantId,'merchantId');
discoveryApi.getDiscoverConfig({
merchantId
}).then(res => {
if (res && res.length) {
// console.log(JSON.stringify(res), channel);
this.handlerDiscoverSetting(JSON.stringify(res), channel)
}
})
},
// 处理发现配置数据
handlerDiscoverSetting(query, channel) {
const list = JSON.parse(query)
let {
currentChannel,
curTabIndex
} = this.data
if (list && list.length) {
if (channel) {
list.forEach((el, index) => {
if (el.channelType == channel) {
curTabIndex = index
currentChannel = el
}
})
} else {
currentChannel = list[0]
} }
}, // this.computeBannerHeight(list.length)
}
this.setData({
discoverSettingList: list,
showPage: true,
currentChannel,
curTabIndex
})
},
// 计算高度
computeBannerHeight(len) {
let query = wx.createSelectorQuery().in(this)
query
.select('.banner_wrapper')
.boundingClientRect(res => {
this.setData({
'heightInfo.bannerH': res.height
})
})
.exec()
query
.select('.tab_wrapper')
.boundingClientRect(react => {
if (len == 1) {
this.setData({
'heightInfo.tabH': 20
})
} else {
this.setData({
'heightInfo.tabH': react.height
})
}
})
.exec()
},
//隐藏购物车 //隐藏购物车
showShoppingCarFn(e){ showShoppingCarFn(e) {
this.setData({ this.setData({
showCarFlag: e.detail!=2 showCarFlag: e.detail != 2
}) })
}, },
}) })
\ No newline at end of file \ No newline at end of file
page{
background-color: #f8f8f8;
}
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
background: #ffffff;
}
.bg {
width: 690rpx;
height: 280rpx;
border-radius: 10rpx;
margin: 24rpx auto 30rpx;
}
.layout{
padding-top: 84px;
}
\ No newline at end of file \ No newline at end of file
<!-- <view class=""></view> --> <!-- <view class=""></view> -->
<view class="navigation-bar">
<navigation-bar bindnavbarReady="navbarReady" page-title="甄选专区">甄选专区</navigation-bar>
</view>
<!-- 优选 --> <!-- 优选 -->
<carOwner id="currentChannel_6" bindshowShoppingCar="showShoppingCarFn" channelID="{{currentChannel.id}}"></carOwner>
\ No newline at end of file \ No newline at end of file
<view class="layout">
<glsx-image webp class="bg" src="mall/bg.png"></glsx-image>
<carOwner id="currentChannel_6" bindshowShoppingCar="showShoppingCarFn" merchantid="{{merchantId}}" channelID="{{currentChannel.id}}"></carOwner>
</view>
\ No newline at end of file \ No newline at end of file
import router from "./router.js";
import routerBefore from './routerBefore'
module.exports={
router,
routerBefore
}
\ No newline at end of file \ No newline at end of file
import Router from './router.js'
import routes from './routers.js'
export default new Router(routes)
\ No newline at end of file \ No newline at end of file
class RouterBefore {
constructor(options) {
console.log('---------------- 路由初始化 ----------------')
this.initPageProxy()
}
/**监听页面 */
pageLeaveProxy(thisPage) {
let onLoad = thisPage.onLoad,
onShow = thisPage.onShow
thisPage.onLoad = function () {
const event = getApp().globalData.ROUTE_QUERY
const userInfo = wx.p.storage.get('userInfo')
let options = {
...event,
...arguments[0]
}
getApp().globalData.ROUTE_QUERY = {}
this.setData({
userInfo
})
onLoad && onLoad.apply(this, [options]), (this.options = options)
}
thisPage.onShow = function () {
const userInfo = wx.p.storage.get('userInfo')
onShow && onShow.apply(this, arguments), (this.setData({
userInfo
}))
}
}
/**全局注册事件 */
initPageProxy() {
let thisPage = Page
let _this = this
Page = function (el) {
try {
el || (el = {}), _this.pageLeaveProxy(el), thisPage.apply(this, arguments)
} catch (el) {
thisPage.apply(this, arguments)
}
}
}
}
export default new RouterBefore()
\ No newline at end of file \ No newline at end of file
export default __wxConfig.pages.map(item => ({
url: `/${item}`,
name: item.split('/').pop(),
parent: item.split('/')[0]
}))
\ No newline at end of file \ No newline at end of file
// import util from '../utils/util.js'
// import {
// getUserInfo
// } from '~/utils/cache/userInfo'
/**
* wx.onAppRoute钩子方法,
* 所有的参数都是路由类上的参数
* @param {*} obj.query
* @param {*} obj.routeHooks
* @param {*} obj.routerList
* @param {*} obj.getPageInstance
* @param {*} obj.getRootName
* @param {*} obj.setNavigationBarTitleText
* @param {*} obj.getRouterList
*/
/**
* 生成特定格式路由
*
* @param {*} routerList 路由参数
* @returns
*/
export const generateRoutList = routerList => {
let _routerList = routerList
try {
__wxConfig &&
__wxConfig.tabBar &&
__wxConfig.tabBar.list &&
(_routerList = routerList.map(item => {
let obj = {
...item
}
if (item.parent != '__plugin__') {
if (item.parent !== 'pages') {
// debugger
// console.log(__wxConfig)
let parentList = item.url.split(`/`)
// console.log(parentList)
if (parentList.length > 3) {
item.url = item.url.replace(/\/__plugin__\/[a-z0-9A-Z]+/, '')
// debugger
// console.log(item.url.split(`/${item.parent}/pages/`))
// console.log(item.url.split(`/${item.parent}/pages/`)[1])
// console.log(item.url.split(`/${item.parent}/pages/`)[1].split('/'))
obj.subPages = item.url.split('/')[2]
// console.log(obj.subPages)
}
}
}
return obj
}))
} catch (err) {}
return _routerList
}
// import {
// Storage
// } from '~/utils/cache/storage'
import Storage from '~/utils/cache/storage'
const $Storage = new Storage()
/** /**
* 日期格式化 * 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss') //log 2020-07-31 10:00:00 * let time = new Date().format('yyyy-MM-dd hh:mm:ss') //log 2020-07-31 10:00:00
...@@ -132,8 +137,24 @@ const setNavigationBarTitle = (title) =>{ ...@@ -132,8 +137,24 @@ const setNavigationBarTitle = (title) =>{
} }
}); });
} }
/** 小程序扫码进来的sceneId */
const getSceneId = path => {
let [_route_, _options_] = path.split('?')
let [target] = _route_.split('/')
let name = _route_.split('/').pop()
let scene = _options_ ? _options_.split('=')[1] : ''
return {
name,
scene,
target
}
}
const setUserInfo = userInfo => {
$Storage.set('srcm_shopmall_user_info', userInfo)
}
const Util = { const Util = {
setUserInfo,
getSceneId,
onReachBottom, onReachBottom,
clearObjNull, clearObjNull,
throttle, throttle,
......
...@@ -133,7 +133,7 @@ wx.p.storage.get('key值',false).then((result)=>console.log(result)).catch((erro ...@@ -133,7 +133,7 @@ wx.p.storage.get('key值',false).then((result)=>console.log(result)).catch((erro
使用方法:在/router/index.js下 使用方法:在/router/index.js下
```javascript ```javascript
import routerBefore from "./routerBefore.js"; // import routerBefore from "./routerBefore.js";
// 添加路由前置后置钩子 // 添加路由前置后置钩子
let routerInstance = () => { let routerInstance = () => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!