Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0fac62f1
authored
Oct 27, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交路由
1 parent
26282ce4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
64 deletions
api/api.js
pages/tab/index/index.js
pages/tab/index/index.wxml
pages/tab/index/index.wxss
router/router.js
utils/util.js
api/api.js
View file @
0fac62f
...
...
@@ -46,7 +46,7 @@ module.exports = {
},
true
)
},
/**获取图片版本号 */
get
ImgVersion
()
{
get
MockConfig
()
{
return
api
.
getMock
()
},
}
...
...
pages/tab/index/index.js
View file @
0fac62f
...
...
@@ -92,16 +92,49 @@ Page({
}
},
// 跳转咨询页面
goConsult
()
{
console
.
log
(
"跳转到咨询页面"
);
wx
.
openCustomerServiceChat
({
extInfo
:
{
url
:
'https://work.weixin.qq.com/kfid/kfcf7b721472201345e'
},
corpId
:
'ww047bdc0f1e76cc13'
,
complete
:
r
=>
{
console
.
log
(
r
)
}
})
// 跳转其他内容
handleOpen
(
e
)
{
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
({
extInfo
:
{
url
:
'https://work.weixin.qq.com/kfid/kfcf7b721472201345e'
},
corpId
:
'ww047bdc0f1e76cc13'
,
complete
:
r
=>
{
console
.
log
(
r
)
}
})
break
}
},
// 更新手机号
...
...
pages/tab/index/index.wxml
View file @
0fac62f
...
...
@@ -32,21 +32,14 @@
<!-- 方案介绍 -->
<block wx:if="{{curTabIndex === 1 }}">
<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>
</view>
<view wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></view>
<!-- 服务咨询 -->
<view bindtap="goConsult">
<image class="icon-consult" src="{{IMGURL}}home/custom.png?v={{img_version}}"></image>
<view class="floating-box">
<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>
\ No newline at end of file
pages/tab/index/index.wxss
View file @
0fac62f
...
...
@@ -104,13 +104,7 @@ page {
width: 100%;
}
.icon-consult {
width: 128rpx;
height: 128rpx;
position: fixed;
right: 6rpx;
bottom: 90rpx;
}
.main-box {
box-sizing: border-box;
...
...
@@ -165,4 +159,16 @@ page {
position: absolute;
width: 100%;
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
router/router.js
View file @
0fac62f
...
...
@@ -41,7 +41,7 @@ class Router {
let
thisPage
=
this
.
getPageInstance
();
if
(
thisPage
)
{
if
(
!
wx
.
$version
)
util
.
get
ImgVersion
().
then
(({
version
})
=>
{
util
.
get
MockConfig
().
then
(({
version
})
=>
{
wx
.
$version
=
version
||
"1.0.0"
;
thisPage
.
setData
({
img_version
:
wx
.
$version
,
...
...
@@ -147,11 +147,8 @@ class Router {
}
/**跳转至H5 */
jumpH5
(
url
)
{
this
.
intercept
().
then
((
response
)
=>
{
if
(
response
)
return
;
wx
.
navigateTo
({
url
:
`/pages/webView/webView?url=
${
encodeURIComponent
(
url
)}
`
,
});
wx
.
navigateTo
({
url
:
`/pages/webView/webView?url=
${
encodeURIComponent
(
url
)}
`
,
});
}
/**页面跳转
...
...
@@ -166,48 +163,32 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/
go
(
route
,
events
)
{
console
.
log
(
route
)
console
.
log
(
route
,
events
)
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
);
console
.
log
(
routerMapItem
)
if
(
routerMapItem
.
isTab
)
{
wx
.
switchTab
({
url
:
routerMapItem
.
url
,
});
}
else
{
if
(
events
&&
events
.
notIntercept
)
{
wx
.
navigateTo
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
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
),
});
});
}
wx
.
navigateTo
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
success
:
(
res
)
=>
events
&&
res
.
eventChannel
.
emit
(
"getData"
,
events
),
});
}
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
);
this
.
intercept
().
then
((
response
)
=>
{
if
(
response
)
return
;
wx
.
reLaunch
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
});
wx
.
reLaunch
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
});
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo
(
route
,
events
)
{
let
{
routerMapItem
,
query
}
=
this
.
checkRouter
(
route
,
events
);
this
.
intercept
().
then
((
response
)
=>
{
if
(
response
)
return
;
wx
.
redirectTo
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
});
wx
.
redirectTo
({
url
:
`
${
routerMapItem
.
url
}${
query
}
`
,
});
}
/**prevPageSize = 1
...
...
utils/util.js
View file @
0fac62f
...
...
@@ -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
*/
const
get
ImgVersion
=
()
=>
{
return
commonApi
.
get
ImgVersion
()
const
get
MockConfig
=
()
=>
{
return
commonApi
.
get
MockConfig
()
}
Date
.
prototype
.
format
=
function
(
fmt
)
{
let
o
=
{
...
...
@@ -467,7 +467,7 @@ const Util = {
setUserInfo
,
showLoading
,
hideLoading
,
get
ImgVersion
,
get
MockConfig
,
getViewInfo
,
setCopyData
,
getSceneId
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment