Commit 0fac62f1 by 胡悦

提交路由

1 parent 26282ce4
...@@ -46,7 +46,7 @@ module.exports = { ...@@ -46,7 +46,7 @@ module.exports = {
}, true) }, true)
}, },
/**获取图片版本号 */ /**获取图片版本号 */
getImgVersion() { getMockConfig() {
return api.getMock() return api.getMock()
}, },
} }
......
...@@ -92,9 +92,40 @@ Page({ ...@@ -92,9 +92,40 @@ Page({
} }
}, },
// 跳转咨询页面 // 跳转其他内容
goConsult() { handleOpen(e) {
console.log("跳转到咨询页面"); console.log(e)
const name = e.target.dataset.name
switch(name) {
case 'store':
util.getMockConfig().then(({storeParams}) => {
console.log(storeParams)
wx.navigateToMiniProgram({
appId: 'wxc50d04ae5aa9984a',
path: 'pages/authentication/loading/loading',
extraData: storeParams,
envVersion: 'develop',
success(res) {
// 打开成功
}
})
})
break
case 'business':
util.getMockConfig().then(({businessParams}) => {
console.log(businessParams)
wx.navigateToMiniProgram({
appId: 'wx2c28337db96364d2',
path: 'login/loading/loading',
extraData: businessParams,
envVersion: 'develop',
success(res) {
// 打开成功
}
})
})
break
case 'custom':
wx.openCustomerServiceChat({ wx.openCustomerServiceChat({
extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcf7b721472201345e'}, extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcf7b721472201345e'},
corpId: 'ww047bdc0f1e76cc13', corpId: 'ww047bdc0f1e76cc13',
...@@ -102,6 +133,8 @@ Page({ ...@@ -102,6 +133,8 @@ Page({
console.log(r) console.log(r)
} }
}) })
break
}
}, },
// 更新手机号 // 更新手机号
......
...@@ -32,21 +32,14 @@ ...@@ -32,21 +32,14 @@
<!-- 方案介绍 --> <!-- 方案介绍 -->
<block wx:if="{{curTabIndex === 1 }}"> <block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType, hasPhoneNumber, IMGURL, img_version, clueCurrent, clueList}}"></template> <template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType, hasPhoneNumber, IMGURL, img_version, clueCurrent, clueList}}"></template>
<!-- <block wx:if="{{curIntroduceIndex === 0}}">
<template is="cube" data="{{IMGURL}}"></template>
</block>
<block wx:elif="{{curIntroduceIndex === 1}}">
<template is="equity"></template>
</block>
<block wx:elif="{{curIntroduceIndex == 2}}">
<template is="clue"></template>
</block> -->
</block> </block>
</view> </view>
<view wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></view> <view wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></view>
<!-- 服务咨询 --> <!-- 服务咨询 -->
<view bindtap="goConsult"> <view class="floating-box">
<image class="icon-consult" src="{{IMGURL}}home/custom.png?v={{img_version}}"></image> <image class="floating-icon" style="margin-bottom: 10rpx;" bindtap="handleOpen" data-name="store" src="{{IMGURL}}home/icon-store.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="handleOpen" data-name="business" src="{{IMGURL}}home/icon-business.png?v={{img_version}}"></image>
<image class="floating-icon" bindtap="handleOpen" data-name="custom" src="{{IMGURL}}home/custom.png?v={{img_version}}"></image>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -104,13 +104,7 @@ page { ...@@ -104,13 +104,7 @@ page {
width: 100%; width: 100%;
} }
.icon-consult {
width: 128rpx;
height: 128rpx;
position: fixed;
right: 6rpx;
bottom: 90rpx;
}
.main-box { .main-box {
box-sizing: border-box; box-sizing: border-box;
...@@ -166,3 +160,15 @@ page { ...@@ -166,3 +160,15 @@ page {
width: 100%; width: 100%;
bottom: 32rpx; bottom: 32rpx;
} }
/* 右下角图标 */
.floating-box {
position: fixed;
display: flex;
flex-direction: column;
right: 6rpx;
bottom: 90rpx;
}
.floating-icon {
width: 128rpx;
height: 128rpx;
}
\ No newline at end of file \ No newline at end of file
...@@ -41,7 +41,7 @@ class Router { ...@@ -41,7 +41,7 @@ class Router {
let thisPage = this.getPageInstance(); let thisPage = this.getPageInstance();
if (thisPage) { if (thisPage) {
if (!wx.$version) if (!wx.$version)
util.getImgVersion().then(({ version }) => { util.getMockConfig().then(({ version }) => {
wx.$version = version || "1.0.0"; wx.$version = version || "1.0.0";
thisPage.setData({ thisPage.setData({
img_version: wx.$version, img_version: wx.$version,
...@@ -147,12 +147,9 @@ class Router { ...@@ -147,12 +147,9 @@ class Router {
} }
/**跳转至H5 */ /**跳转至H5 */
jumpH5(url) { jumpH5(url) {
this.intercept().then((response) => {
if (response) return;
wx.navigateTo({ wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`, url: `/pages/webView/webView?url=${encodeURIComponent(url)}`,
}); });
});
} }
/**页面跳转 /**页面跳转
* *
...@@ -166,49 +163,33 @@ class Router { ...@@ -166,49 +163,33 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层 * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/ */
go(route, events) { go(route, events) {
console.log(route) console.log(route, events)
let { routerMapItem, query } = this.checkRouter(route, events); let { routerMapItem, query } = this.checkRouter(route, events);
console.log(routerMapItem)
if (routerMapItem.isTab) { if (routerMapItem.isTab) {
wx.switchTab({ wx.switchTab({
url: routerMapItem.url, url: routerMapItem.url,
}); });
} else { } else {
if (events && events.notIntercept) {
wx.navigateTo({ wx.navigateTo({
url: `${routerMapItem.url}${query}`, url: `${routerMapItem.url}${query}`,
success: (res) => events && res.eventChannel.emit("getData", events), success: (res) => events && res.eventChannel.emit("getData", events),
}); });
} else {
this.intercept().then((response) => {
if (response) return;
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: (res) =>
events && res.eventChannel.emit("getData", events),
});
});
}
} }
} }
/**关闭所有页面,打开到应用内的某个页面 */ /**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) { reLaunch(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events); let { routerMapItem, query } = this.checkRouter(route, events);
this.intercept().then((response) => {
if (response) return;
wx.reLaunch({ wx.reLaunch({
url: `${routerMapItem.url}${query}`, url: `${routerMapItem.url}${query}`,
}); });
});
} }
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */ /**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) { redirectTo(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events); let { routerMapItem, query } = this.checkRouter(route, events);
this.intercept().then((response) => {
if (response) return;
wx.redirectTo({ wx.redirectTo({
url: `${routerMapItem.url}${query}`, url: `${routerMapItem.url}${query}`,
}); });
});
} }
/**prevPageSize = 1 /**prevPageSize = 1
* 返回上prevPageSize页 * 返回上prevPageSize页
......
...@@ -8,8 +8,8 @@ const emojiReg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30- ...@@ -8,8 +8,8 @@ const emojiReg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-
* 日期格式化 * 日期格式化
* 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
*/ */
const getImgVersion = () => { const getMockConfig = () => {
return commonApi.getImgVersion() return commonApi.getMockConfig()
} }
Date.prototype.format = function (fmt) { Date.prototype.format = function (fmt) {
let o = { let o = {
...@@ -467,7 +467,7 @@ const Util = { ...@@ -467,7 +467,7 @@ const Util = {
setUserInfo, setUserInfo,
showLoading, showLoading,
hideLoading, hideLoading,
getImgVersion, getMockConfig,
getViewInfo, getViewInfo,
setCopyData, setCopyData,
getSceneId, getSceneId,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!