Commit 29d5d981 by 张立顺

订阅模块功能开发

1 parent af1a02ba
......@@ -10,9 +10,9 @@
"integrity": "sha512-hFJ48SCSvRgcwT/9TcxwNnNnWSpy2BpaBfwQwVdU6uwgFH+2OqGL435VQN7EDpIMH8YjHbiM84hueTyxAzIPqQ=="
},
"glsx-applet-component": {
"version": "1.0.26",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.26.tgz",
"integrity": "sha512-piMTmDIUq4x7fpE3/GgZI1pIFV6SlmsJdtm/TxBqM5VG4i38+7bXZSkjqvu3xdb2TIXw6FuA4lq6I/QfVVX7LQ=="
"version": "1.0.32",
"resolved": "https://registry.npmmirror.com/glsx-applet-component/-/glsx-applet-component-1.0.32.tgz",
"integrity": "sha512-1YnE+r/tHpQS0FYLN/YV7EHvhOhY3leprkghtSpl3jjNP6KkMzrQoRuTatSIe3AWzVOKeXVP6ZsCIm9cdtB4pQ=="
}
}
}
......@@ -5,7 +5,7 @@
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.10.9",
"glsx-applet-component": "^1.0.26"
"glsx-applet-component": "^1.0.32"
},
"devDependencies": {},
"scripts": {
......
......@@ -54,6 +54,7 @@ Page({
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
// console.log( options);
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0, phone, cardInfo } = options
console.log(options)
......
const systemData = [
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/'
const subscriptionIMG_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/subscription/'
const IMG_URL2 = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/'
const subscriptionBannerUrl = IMG_URL2 + 'banner/banner4.webp'
const productImgs0 = [`${IMG_URL}index/productImgs/product00.webp`, `${IMG_URL}index/productImgs/product01.webp`, `${IMG_URL}index/productImgs/product02.webp`, `${IMG_URL}index/productImgs/product03.webp`]
// 车损升级
const sceneImgs5 = [`${IMG_URL}index/scene/scene00.png`, `${IMG_URL}index/scene/scene01.png`, `${IMG_URL}index/scene/scene02.png`, `${IMG_URL}index/scene/scene03.png`]
const videoList0 = [
{
videoUrl: `${IMG_URL2}video/digital_card_30s.mp4`,
posterUrl: `${IMG_URL}index/poster/subscribeVideoPoster-0.webp`,
name: 'SOP数字化管理提升门店效率',
manufacturer: '嘀加智慧',
view: 188
},
{
videoUrl: `${IMG_URL2}video/digital_card_money3.mp4`,
posterUrl: `${IMG_URL}index/poster/subscribeVideoPoster-1.webp`,
name: '1分钟告诉你数字化招揽的核心优势',
manufacturer: '嘀加智慧云',
view: 188
}
// {
// videoUrl: `${IMG_URL2}video/digital_card.mp4`,
// posterUrl: `${IMG_URL}index/poster/digital_card_bitmap.png`,
// name: '数字无忧卡服务',
// manufacturer: '嘀加智慧',
// view: 1320
// },
// {
// videoUrl: `${IMG_URL2}video/digital_card_reason6.mp4`,
// posterUrl: `${IMG_URL}index/poster/digital_card_reason6_bitmap.png`,
// name: '数字无忧卡6大理由',
// manufacturer: '嘀加智慧',
// view: 1485
// }
]
// const posterList0 = [
// {
// src: `${IMG_URL}index/poster/poster3-0.webp`,
// name: '劲爆来袭'
// },
// {
// src: `${IMG_URL}index/poster/poster3-1.webp`,
// name: '疯狂让利'
// },
// {
// src: `${IMG_URL}index/poster/poster3-2.webp`,
// name: '娱乐系统'
// },
// {
// src: `${IMG_URL}index/poster/poster3-3.webp`,
// name: 'AR实景导航'
// }
// ]
const subscriptionSystemData = [
{
id: 100,
name: '客户沉淀',
bannerUrl: '',
//场景详情图片
sceneImgs: sceneImgs5,
// 产品详情图片
productImgs: productImgs0,
productList: [
{
id: 0,
img: 'product-img1',
proName: '私域用户活跃代运营',
price: '100',
profit: '1200000',
type: 'service',
productType: 'benefitCard',
path: 'equity',
sale: 100, //销量
varType: 0,
flow: 10000,
productCode: 'PC011',
productName: '私域用户活跃代运营',
category: '代运营',
prodImg: `${IMG_URL2}/prod2/prod4-0.webp`
},
{
id: 0,
img: 'product-img1',
proName: '定保/续保数字化招揽',
price: '100',
profit: '1200000',
type: 'service',
productType: 'benefitCard',
path: 'equity',
sale: 100, //销量
varType: 0,
flow: 10000,
productCode: 'PC012',
productName: '定保/续保数字化招揽',
category: '招揽',
prodImg: `${IMG_URL}index/prod2/prod4-1.webp`
}
],
videoList: videoList0
// posterList: posterList0
},
{
name: '客户活跃',
//场景详情图片
sceneImgs: sceneImgs5,
// 产品详情图片
productImgs: productImgs0,
productList: [
{
id: 101,
proName: '私欲用户活跃代运营',
img: ''
id: 0,
img: 'product-img1',
proName: '事故车救援服务',
price: '100',
profit: '1200000',
type: 'service',
productType: 'benefitCard',
path: 'equity',
sale: 100, //销量
varType: 0,
flow: 10000,
productCode: 'PC001',
productName: '事故车救援服务',
category: '救援',
prodImg: `${IMG_URL}index/prod2/prod4-2.webp`
}
]
],
videoList: videoList0
// posterList: posterList0
}
]
module.exports = {
systemData
}
\ No newline at end of file
// systemData,
subscriptionBannerUrl,
subscriptionSystemData
}
<!-- pages/tab/index/index.wxml -->
<view class="loadding" wx:if="{{!cardInfo}}">
<glsx-image custom-class="loadding-img" src="home/loadding.webp"></glsx-image>
<glsx-image custom-class="loadding-img" src="home/loadding.webp" />
<view>努力加载中</view>
</view>
<block wx:if="{{!!cardInfo}}">
<view class="main-box">
<user-info shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info>
<user-info shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}" />
<view class="main-bottom">
<!-- tab介绍 -->
<view class="tab-list">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{curTabIndex === index ? 'tab-item-active' : '' }}" data-name="{{item}}" data-index="{{index}}" bindtap="introduce">
<image wx:if="{{curTabIndex !== index}}" class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon1}}.png?v={{img_version}}"></image>
<image wx:else class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon}}.png?v={{img_version}}"></image>
<image wx:if="{{curTabIndex !== index}}" class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon1}}.png?v={{img_version}}" />
<image wx:else class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon}}.png?v={{img_version}}" />
<view class="tab-text">{{item.name}}</view>
</view>
</block>
......@@ -20,34 +20,34 @@
<view class="main-content">
<block wx:if="{{curTabIndex == 0}}">
<!-- 增值转化 -->
<gl-scenario productData="{{productData}}" senceData="{{senceData}}" activityList="{{activityList}}" bindactivityClick="activityClick" bind:proClick="proClick" bind:videoClick="videoClick" bind:senceClick="senceClick" bindcurrentScen="getCurrentScen">
</gl-scenario>
<gl-scenario productData="{{productData}}" senceData="{{senceData}}" activityList="{{activityList}}" bindactivityClick="activityClick" bind:proClick="proClick" bind:videoClick="videoClick" bind:senceClick="senceClick" bindcurrentScen="getCurrentScen" />
<!-- <scenario productData="{{productData}}" senceData="{{senceData}}">
<activity-info slot="swiper"></activity-info>
</scenario> -->
</block>
<block wx:if="{{curTabIndex == 1}}">
<gl-subscription list="{{productData[0]}}" menuClick="sysMenuClick" bannerUrl="{{'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/banner/banner0.png'}}"></gl-subscription>
<!-- menuClick="sysMenuClick" -->
<gl-subscription list="{{subscriptionSystemData}}" bannerUrl="{{subscriptionBannerUrl}}" bindactivityClick="activityClick" bind:proClick="proClick" bind:videoClick="videoClick" bind:senceClick="senceClick" bindcurrentScen="getCurrentScen" />
</block>
<block wx-if="{{curTabIndex == 2}}">
<company-introduce autoplay="{{autoplay}}"></company-introduce>
<company-introduce autoplay="{{autoplay}}" />
</block>
</view>
</view>
<!-- 服务咨询 -->
<view class="floating-box">
<image class="floating-icon" style="margin-bottom: 10rpx;" webp bindtap="toStoreMiniProgram" src="{{IMGURL}}home/icon-store.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}"></image>
<image class="floating-icon" style="margin-bottom: 10rpx;" webp bindtap="toStoreMiniProgram" src="{{IMGURL}}home/icon-store.png?v={{img_version}}" />
<image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}" />
<image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}" />
</view>
</view>
<!-- 服务咨询 -->
<view class="floating-box">
<image class="floating-icon" style="margin-bottom: 10rpx;" webp bindtap="toStoreMiniProgram" src="{{IMGURL}}home/icon-store.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}"></image>
<image class="floating-icon" style="margin-bottom: 10rpx;" webp bindtap="toStoreMiniProgram" src="{{IMGURL}}home/icon-store.png?v={{img_version}}" />
<image class="floating-icon" bindtap="toBusinessMiniProgram" webp src="{{IMGURL}}home/icon-business.png?v={{img_version}}" />
<image class="floating-icon" bindtap="handleOpen" webp src="{{IMGURL}}home/custom.png?v={{img_version}}" />
</view>
<phone-number type="{{'home'}}" bindtoApplication="toApplication" hasPhoneNumber="{{hasPhoneNumber}}"></phone-number>
<phone-number type="{{'home'}}" bindtoApplication="toApplication" hasPhoneNumber="{{hasPhoneNumber}}" />
<!-- 客服咨询 -->
<customer wx:if="{{showCustomer}}" qrCode="{{cardInfo.qrCode}}" bindcloseQR="closeQR"></customer>
<customer wx:if="{{showCustomer}}" qrCode="{{cardInfo.qrCode}}" bindcloseQR="closeQR" />
</block>
\ No newline at end of file
const _routeHooks = Symbol("_routeHooks");
const _query = Symbol("_query");
const _routerList = Symbol("_routerList");
import util from "../utils/util.js";
const generateRoutList = (routerList) => {
let _routerList = routerList;
const tabBarList = __wxConfig?.tabBar?.list || []
const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import util from '../utils/util.js'
const generateRoutList = routerList => {
let _routerList = routerList
const tabBarList = __wxConfig?.tabBar?.list || []
try {
_routerList = routerList.map((item) => {
let obj = {};
if (item.parent != "__plugin__") {
obj = {
...item,
isTab: tabBarList.some(({ pagePath }) =>
item.url.includes(pagePath.replace(".html", ""))
),
};
if (item.parent !== "pages") {
let parentList = item.url.split(`/`);
if (parentList.length > 5) {
item.url = item.url.replace(/\/__plugin__\/[a-z0-9A-Z]+/, "");
obj.subPages = item.url
.split(`/${item.parent}/pages/`)[1]
.split("/")[0];
}
_routerList = routerList.map(item => {
let obj = {}
if (item.parent != '__plugin__') {
obj = {
...item,
isTab: tabBarList.some(({ pagePath }) => item.url.includes(pagePath.replace('.html', '')))
}
if (item.parent !== 'pages') {
let parentList = item.url.split(`/`)
if (parentList.length > 5) {
item.url = item.url.replace(/\/__plugin__\/[a-z0-9A-Z]+/, '')
obj.subPages = item.url.split(`/${item.parent}/pages/`)[1].split('/')[0]
}
}
return obj;
});
}
return obj
})
} catch (err) {}
return _routerList;
};
return _routerList
}
class Router {
[_query] = {};
[_routeHooks] = [];
[_routerList] = [];
[_routerList] = []
constructor(router) {
this[_routerList] = generateRoutList(router);
this[_routerList] = generateRoutList(router)
wx.onAppRoute &&
wx.onAppRoute((e) => {
let thisPage = this.getPageInstance();
wx.onAppRoute(e => {
let thisPage = this.getPageInstance()
if (thisPage) {
if (!wx.$version)
util.getMockConfig().then(({ version }) => {
wx.$version = version || "1.0.0";
wx.$version = version || '1.0.0'
thisPage.setData({
img_version: wx.$version,
});
});
else{
img_version: wx.$version
})
})
else {
thisPage.setData({
img_version: wx.$version,
});
img_version: wx.$version
})
}
thisPage.setData({
IMGURL: wx.$imgUrl,
});
IMGURL: wx.$imgUrl
})
wx.hideHomeButton()
this.setNavigationBarTitleText(thisPage);
let onRoute = thisPage.onRoute;
thisPage.$query = this[_query];
typeof onRoute === "function" && onRoute(this[_query]);
let userInfo = util.getUserInfo();
this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
thisPage.$query = this[_query]
typeof onRoute === 'function' && onRoute(this[_query])
let userInfo = util.getUserInfo()
if (userInfo && userInfo.phone) {
if (wx.$authStatus) {
thisPage.setData({
userInfo: null,
});
userInfo: null
})
} else {
thisPage.setData({
userInfo,
});
if (thisPage.init) thisPage.init(userInfo);
userInfo
})
if (thisPage.init) thisPage.init(userInfo)
}
}
}
this[_routeHooks].forEach((fn) => {
this[_routeHooks].forEach(fn => {
try {
typeof fn === "function" && fn(e, this[_query], this[_routerList]);
typeof fn === 'function' && fn(e, this[_query], this[_routerList])
} catch (err) {
console.log(err);
console.log(err)
}
});
this[_query] = {};
});
})
this[_query] = {}
})
}
/**设置标题栏 */
setNavigationBarTitleText(thisPage) {
let title = wx.$util.getNavigationBarTitleText();
if (wx.$util.getUserInfo()) title = wx.$util.getUserInfo().merchantName;
const router = `${thisPage.__route__}.html`;
let title = wx.$util.getNavigationBarTitleText()
if (wx.$util.getUserInfo()) title = wx.$util.getUserInfo().merchantName
const router = `${thisPage.__route__}.html`
if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) {
let { navigationBarTitleText, navigationStyle } = __wxConfig.page[
router
].window;
if (!title) title = "";
let { navigationBarTitleText, navigationStyle } = __wxConfig.page[router].window
if (!title) title = ''
if (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({
title,
});
title
})
}
}
/**获取页面对象实例 */
getPageInstance = (size = 1) => {
const pages = getCurrentPages();
return pages[pages.length - size];
};
const pages = getCurrentPages()
return pages[pages.length - size]
}
checkRouter(route, events) {
this[_query] = events || {}
const [_parent, _name, last_name] = route.split('.')
......@@ -144,87 +138,86 @@ class Router {
/**跳转至H5 */
jumpH5(url) {
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
});
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
}
/**页面跳转
*
*/
jump(e) {
const item = e.currentTarget.dataset;
this.go(item.url, item);
const item = e.currentTarget.dataset
this.go(item.url, item)
}
/**
* 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 ||
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go(route, events) {
console.log(route, events)
let { routerMapItem, query } = this.checkRouter(route, events);
console.log(routerMapItem)
// console.log(route, events)
let { routerMapItem, query } = this.checkRouter(route, events)
// console.log(routerMapItem)
if (routerMapItem.isTab) {
wx.switchTab({
url: routerMapItem.url,
});
url: routerMapItem.url
})
} else {
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: (res) => events && res.eventChannel.emit("getData", events),
});
success: res => events && res.eventChannel.emit('getData', events)
})
}
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events);
let { routerMapItem, query } = this.checkRouter(route, events)
wx.reLaunch({
url: `${routerMapItem.url}${query}`,
});
url: `${routerMapItem.url}${query}`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events);
let { routerMapItem, query } = this.checkRouter(route, events)
wx.redirectTo({
url: `${routerMapItem.url}${query}`,
});
url: `${routerMapItem.url}${query}`
})
}
/**prevPageSize = 1
* 返回上prevPageSize页
* callBack返回上prevPageSize页对象 */
back(callBack, prevPageSize = 1) {
let prevPage = this.getPageInstance(Number(prevPageSize) + 1);
if (callBack && "function" === typeof callBack) callBack(prevPage);
let prevPage = this.getPageInstance(Number(prevPageSize) + 1)
if (callBack && 'function' === typeof callBack) callBack(prevPage)
wx.navigateBack({
delta: prevPageSize,
}).catch((err) => {
this.goHome();
});
delta: prevPageSize
}).catch(err => {
this.goHome()
})
}
goHome() {
let [index] = this[_routerList];
let [index] = this[_routerList]
wx.switchTab({
url: index.url,
});
url: index.url
})
}
/**获取上一个页面传的数据 */
getData(callBack) {
const data = this.getPageInstance().getOpenerEventChannel();
if (Object.keys(data).length !== 0)
data.on("getData", (res) => callBack(res));
const data = this.getPageInstance().getOpenerEventChannel()
if (Object.keys(data).length !== 0) data.on('getData', res => callBack(res))
}
onRoute(fn) {
this[_routeHooks].push(fn);
this[_routeHooks].push(fn)
return () => {
const i = list.indexOf(fn);
if (i > -1) list.splice(i, 1);
};
const i = list.indexOf(fn)
if (i > -1) list.splice(i, 1)
}
}
async intercept() {
const isAuth = !!wx.$authStatus;
const isAuth = !!wx.$authStatus
this.getPageInstance().setData({
showLogin: isAuth,
});
return isAuth;
showLogin: isAuth
})
return isAuth
}
}
export default Router;
export default Router
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!