Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
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 0087f45d
authored
Oct 21, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'develop' of 192.168.3.233:saas_plus/business-assistant into develop
2 parents
2dd11d00
290b4a12
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
182 additions
and
103 deletions
api/checkProduct.js
login/index/components/Agree/Agree.scss
login/index/components/Box/Box.js
login/index/components/Box/Box.scss
login/index/components/TypeList/TypeList.scss
login/lib/index.js
login/loading/loading.js
pages/checkProduct/checkProduct.js
pages/tab/index/components/product/product.js
utils/util.js
api/checkProduct.js
View file @
0087f45
import
api
from
"~/utils/request/request"
;
const
serverApi
=
{
createQrCode
:
"scrm.api.busassistant.activity.createQrCode"
,
//生成二维码
createQrCode
:
"scrm.api.wechat.miniprogram.createQrcode"
,
// 解析二维码参数
sceneById
:
'scrm.api.wechat.get.scene.by.id'
};
// 拓客户
export
const
createQrCodeApi
=
(
data
)
=>
{
return
api
.
post
(
{
...
...
@@ -13,4 +15,12 @@ export const createQrCodeApi = (data) => {
},
true
);
};
export
const
sceneByIdApi
=
(
data
)
=>
{
return
api
.
post
(
{
method
:
serverApi
.
sceneById
,
...
data
,
}
);
};
\ No newline at end of file
login/index/components/Agree/Agree.scss
View file @
0087f45
/* login/index/components/Agree/Agree.wxss */
.agree
{
margin-top
:
274rpx
;
position
:
fixed
;
left
:
0
;
bottom
:
100rpx
;
width
:
100%
;
text
{
color
:
#5092FF
;
}
...
...
login/index/components/Box/Box.js
View file @
0087f45
...
...
@@ -186,7 +186,7 @@ Component({
}
=
data
,
validTime
=
3600
*
24
*
7
*
1
e3
,
autoLoginFailureTime
=
Date
.
now
()
+
validTime
if
(
autoLogin
)
{
if
(
autoLogin
&&
loginUserInfoList
[
0
]
)
{
wx
.
$storage
.
set
(
'auto_login_object'
,
{
failureTime
:
autoLoginFailureTime
,
userName
:
formData
.
account
,
...
...
login/index/components/Box/Box.scss
View file @
0087f45
/* login/index/components/LoginBox.wxss */
.box
{
height
:
800rpx
;
// height: 800rpx;
height
:
750rpx
;
.opacity-view
{
animation
:
opacity-view
.5s
forwards
;
...
...
@@ -11,12 +12,14 @@
height
:
458rpx
;
position
:
absolute
;
left
:
151rpx
;
top
:
264rpx
;
// top: 264rpx;
top
:
214rpx
;
}
.input-box
{
width
:
540rpx
;
padding-top
:
352rpx
;
// padding-top: 352rpx;
padding-top
:
302rpx
;
margin
:
0
auto
;
.title
{
...
...
login/index/components/TypeList/TypeList.scss
View file @
0087f45
/* login/index/components/TypeList.wxss */
.tips
{
padding-top
:
1
2
0rpx
;
padding-top
:
1
0
0rpx
;
text-align
:
center
;
margin-bottom
:
40rpx
;
}
...
...
login/lib/index.js
View file @
0087f45
...
...
@@ -28,6 +28,10 @@ const selectAccountLogin = ({ id, sessionId }) => {
}
/**设置登录信息 */
const
setLoginInfo
=
(
userInfo
,
sessionId
)
=>
{
if
(
!
userInfo
)
{
wx
.
$api
.
showToast
(
'仅支持服务商类型账户登录'
)
return
}
setUserInfo
(
userInfo
)
setSessionId
(
sessionId
)
loginSuccess
()
...
...
login/loading/loading.js
View file @
0087f45
...
...
@@ -21,7 +21,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
},
/**
...
...
@@ -107,7 +107,7 @@ Page({
code
,
message
})
=>
{
if
(
code
==
'0'
)
{
if
(
code
==
'0'
&&
data
.
loginUserInfoList
.
length
)
{
const
{
sessionId
,
loginUserInfoList
...
...
@@ -116,11 +116,12 @@ Page({
}
else
{
try
{
const
reload
=
await
loginModal
({
message
:
message
||
'登录失败请重试'
,
message
:
data
.
loginUserInfoList
.
length
?
message
:
'登录失败请重试'
,
cancelText
:
'返回'
})
if
(
reload
)
this
.
onShow
()
}
catch
(
error
)
{
wx
.
$storage
.
rm
(
'auto_login_object'
)
wx
.
$router
.
reLaunch
(
'login.index'
,
obj
)
}
}
...
...
pages/checkProduct/checkProduct.js
View file @
0087f45
...
...
@@ -4,7 +4,9 @@ const navStyle = "background-color: #fff";
import
{
senceData
}
from
"~/pages/tab/index/constant/data"
;
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
import
Draw
from
"~/utils/Draw.js"
;
import
{
createQrCodeApi
}
from
"~/api/checkProduct.js"
;
import
{
createQrCodeApi
,
sceneByIdApi
}
from
"~/api/checkProduct.js"
;
import
utils
from
'~/utils/util.js'
Page
({
/**
* 页面的初始数据
...
...
@@ -86,12 +88,15 @@ Page({
isShow
:
true
,
});
},
//接受跳转的路由参数
//接受跳转的路由参数
(小程序页面跳转)
onRoute
(
options
)
{
console
.
log
(
"分享options: "
,
options
);
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
//选中场景的index,和产品的index
let
{
actNum
,
activeNavIdx
,
apiData
}
=
options
;
if
(
actNum
&&
activeNavIdx
)
return
//
if(actNum&&activeNavIdx)return
this
.
setData
({
actNum
,
activeNavIdx
,
...
...
@@ -132,11 +137,21 @@ Page({
// 下载海报
async download() {
let { actNum, activeNavIdx, imgHeightArr } = this.data;
let res = await createQrCodeApi({
let wx_user_info = wx.$storage.get('wx_user_info')
// console.log('wx_user_info: ', wx_user_info.appId);
let params = {
actNum,
activeNavIdx,
isShare: true,
}
let res = await createQrCodeApi({
appId:wx_user_info.appId,
path:'pages/checkProduct/checkProduct',
scene:JSON.stringify(params)
});
// console.log('res: ', res);
// let { actNum, imgHeightArr } = this.data;
//所有的长度
...
...
@@ -251,7 +266,7 @@ Page({
wx.nextTick(()=>{
this.setData({
isShare: res.isShare,
//
phone: res.phone,
phone: res.phone,
});
})
...
...
@@ -259,27 +274,29 @@ Page({
},
/**
* 生命周期函数--监听页面加载 ()
* 生命周期函数--监听页面加载 (
扫码,分享链接
)
*/
onLoad(options) {
async onLoad(options) {
console.log('分享options12255565: ', options);
// actNum,activeNavIdx isShare
if(!options){
return
}
// 扫码进来
let { actNum, activeNavIdx, isShare, merchantId } = options;
console.log('isShare: ', isShare);
if (merchantId) {
if(!options || utils.isEmptyObj(options))return
// 解析二维码参数
if(options.scene){
this.setData({
isShow: false,
isShare:true,
});
isShare:true
})
let ercodeParams = await this.analysisQRcode(options.scene)
// console.log('ercodeParams: ', ercodeParams.scene);
options = utils.parseString(ercodeParams.scene)
// console.log('ercodeParams: ', options);
}
if (isShare) {
// 扫码进来
let { actNum, activeNavIdx, isShare } = options;
if (isShare == 'true') {
this.setData({
isShow: false,
isShare:true,
});
} else {
wx.showLoading({
...
...
@@ -289,12 +306,13 @@ Page({
this.setData({
actNum,
activeNavIdx
activeNavIdx,
isShare:true
})
// 发请求
let senceItem = senceData[actNum];
let item = senceData[actNum]?.productList[activeNavIdx];
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
isShar
e
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`;
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
tru
e
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`;
this.shareTrackData = {
sceneCode: senceItem?.sceneCode,
productCode: item?.productCode,
...
...
@@ -305,11 +323,20 @@ Page({
// activeNavIdx,
};
},
// 解析扫码进来参数
async analysisQRcode(str){
let id = str.split('%3D')[1]
let res = await sceneByIdApi({id})
// console.log('res: ', res);
return res
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
onReady() {
},
/**
* 生命周期函数--监听页面显示
...
...
pages/tab/index/components/product/product.js
View file @
0087f45
...
...
@@ -173,12 +173,12 @@ Component({
USERAPI
.
getUserProfile
(
this
.
loginToken
,
detail
)
.
then
((
result
)
=>
{
// console.log(result)
//
let { phone } = result;
let
{
phone
}
=
result
;
// let {
wx
.
$storage
.
set
(
'wx_user_info'
,
result
);
// }
this
.
triggerEvent
(
"authorized"
,
{
//
phone,
phone
,
isShare
:
false
,
});
// this.
...
...
utils/util.js
View file @
0087f45
import
{
commonApi
,
equityApi
}
from
'../api/api'
import
{
commonApi
,
equityApi
}
from
"../api/api"
;
// import {
// sopApi,
...
...
@@ -6,7 +6,7 @@ import { commonApi, equityApi } from '../api/api'
// bigdatautilApi,
// equityApi
// } from '../api/api'
import
$router
from
'../router/index'
import
$router
from
"../router/index"
;
/**
* 日期格式化
...
...
@@ -14,115 +14,147 @@ import $router from '../router/index'
*/
Date
.
prototype
.
format
=
function
(
fmt
)
{
let
o
=
{
'M+'
:
this
.
getMonth
()
+
1
,
//月份
'd+'
:
this
.
getDate
(),
//日
'h+'
:
this
.
getHours
(),
//小时
'm+'
:
this
.
getMinutes
(),
//分
's+'
:
this
.
getSeconds
(),
//秒
"M+"
:
this
.
getMonth
()
+
1
,
//月份
"d+"
:
this
.
getDate
(),
//日
"h+"
:
this
.
getHours
(),
//小时
"m+"
:
this
.
getMinutes
(),
//分
"s+"
:
this
.
getSeconds
(),
//秒
//季度
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
S
:
this
.
getMilliseconds
()
//毫秒
}
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
"q+"
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
S
:
this
.
getMilliseconds
(),
//毫秒
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
)
);
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
'('
+
k
+
')'
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]
:
(
'00'
+
o
[
k
]).
substr
((
''
+
o
[
k
]).
length
))
if
(
new
RegExp
(
"("
+
k
+
")"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]
:
(
"00"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)
);
}
return
fmt
}
return
fmt
;
}
;
/**触底加载 */
const
onReachBottom
=
(
obj
,
callBack
)
=>
{
let
_this
=
$router
.
getPageInstance
()
let
{
pageNum
,
total
,
pageSize
,
nothing
}
=
obj
let
_this
=
$router
.
getPageInstance
()
;
let
{
pageNum
,
total
,
pageSize
,
nothing
}
=
obj
;
if
(
!
total
&&
!
pageNum
)
{
console
.
error
(
'total&&pageNum为必传'
)
return
console
.
error
(
"total&&pageNum为必传"
);
return
;
}
if
(
!
pageSize
)
pageSize
=
10
if
(
!
nothing
)
nothing
=
'nothing'
if
(
!
pageSize
)
pageSize
=
10
;
if
(
!
nothing
)
nothing
=
"nothing"
;
if
(
Math
.
ceil
(
total
/
pageSize
)
>
pageNum
)
{
_this
.
setData
({
pageNum
:
pageNum
+
1
})
callBack
()
pageNum
:
pageNum
+
1
,
})
;
callBack
()
;
}
else
{
_this
.
setData
({
[
nothing
]:
true
})
[
nothing
]:
true
,
})
;
}
}
}
;
/**是否全面屏 */
const
isFullSucreen
=
isComponents
=>
{
const
thisPage
=
$router
.
getPageInstance
()
const
routerList
=
$router
.
getRouterList
()
const
router
=
routerList
.
find
(
item
=>
item
.
url
===
`/
${
thisPage
.
route
}
`
)
let
key
=
`
${
router
.
url
.
replace
(
'/'
,
''
)}
.html`
let
val
=
false
const
isFullSucreen
=
(
isComponents
)
=>
{
const
thisPage
=
$router
.
getPageInstance
()
;
const
routerList
=
$router
.
getRouterList
()
;
const
router
=
routerList
.
find
(
(
item
)
=>
item
.
url
===
`/
${
thisPage
.
route
}
`
);
let
key
=
`
${
router
.
url
.
replace
(
"/"
,
""
)}
.html`
;
let
val
=
false
;
if
(
__wxConfig
&&
__wxConfig
.
page
&&
__wxConfig
.
page
[
key
])
{
let
{
navigationStyle
}
=
__wxConfig
.
page
[
key
].
window
let
{
navigationStyle
}
=
__wxConfig
.
page
[
key
].
window
;
wx
.
getSystemInfo
({
success
(
res
)
{
if
(
res
.
platform
!=
'android'
)
{
let
{
statusBarHeight
,
screenHeight
,
windowHeight
}
=
res
if
(
navigationStyle
&&
navigationStyle
==
'custom'
)
{
windowHeight
=
windowHeight
-
thisPage
.
data
.
navHeight
||
0
if
(
res
.
platform
!=
"android"
)
{
let
{
statusBarHeight
,
screenHeight
,
windowHeight
}
=
res
;
if
(
navigationStyle
&&
navigationStyle
==
"custom"
)
{
windowHeight
=
windowHeight
-
thisPage
.
data
.
navHeight
||
0
;
}
//兼容自定义标题
val
=
router
.
isTab
?
screenHeight
-
windowHeight
-
statusBarHeight
-
32
>
72
:
screenHeight
-
windowHeight
>
72
if
(
isComponents
)
val
=
screenHeight
-
windowHeight
>
72
val
=
router
.
isTab
?
screenHeight
-
windowHeight
-
statusBarHeight
-
32
>
72
:
screenHeight
-
windowHeight
>
72
;
if
(
isComponents
)
val
=
screenHeight
-
windowHeight
>
72
;
}
},
fail
(
err
)
{
return
false
}
})
return
false
;
}
,
})
;
}
return
val
}
return
val
;
}
;
/**节流 */
const
throttle
=
(
fn
,
gapTime
)
=>
{
if
(
gapTime
==
null
||
gapTime
==
undefined
)
{
gapTime
=
1500
gapTime
=
1500
;
}
let
_lastTime
=
null
let
_lastTime
=
null
;
// 返回新的函数
return
function
()
{
let
_nowTime
=
+
new
Date
()
let
_nowTime
=
+
new
Date
()
;
if
(
_nowTime
-
_lastTime
>
gapTime
||
!
_lastTime
)
{
fn
.
apply
(
this
,
arguments
)
//将this和参数传给原函数
_lastTime
=
_nowTime
fn
.
apply
(
this
,
arguments
)
;
//将this和参数传给原函数
_lastTime
=
_nowTime
;
}
}
}
}
;
}
;
/**删除对象里的null值 */
const
clearObjNull
=
options
=>
{
let
obj
=
{}
Object
.
keys
(
options
).
map
(
e
=>
{
const
clearObjNull
=
(
options
)
=>
{
let
obj
=
{}
;
Object
.
keys
(
options
).
map
(
(
e
)
=>
{
if
(
options
[
e
]
!=
null
&&
options
[
e
]
!=
undefined
)
{
if
(
typeof
options
[
e
]
==
'object'
)
{
Object
.
keys
(
options
[
e
]).
map
(
key
=>
{
if
(
options
[
e
][
key
]
==
null
||
options
[
e
][
key
]
==
undefined
)
delete
options
[
e
][
key
]
})
if
(
typeof
options
[
e
]
==
"object"
)
{
Object
.
keys
(
options
[
e
]).
map
((
key
)
=>
{
if
(
options
[
e
][
key
]
==
null
||
options
[
e
][
key
]
==
undefined
)
delete
options
[
e
][
key
];
});
}
obj
[
e
]
=
options
[
e
]
obj
[
e
]
=
options
[
e
]
;
}
})
return
obj
}
});
return
obj
;
};
/**
* 判断是否是空对象
* @param {*} obj 传进来的对象
* @returns
*/
const
isEmptyObj
=
(
obj
)
=>
{
return
JSON
.
stringify
(
obj
)
===
"{}"
;
};
// 解析参数成对象 "actNum=1&activeNavIdx=0&isShare=true"
const
parseString
=
(
str
)
=>
{
if
(
!
str
)
return
;
let
obj
=
{};
let
strArr
=
str
.
split
(
"&"
);
strArr
.
forEach
((
item
)
=>
{
console
.
log
(
"item: "
,
item
);
let
keyArr
=
item
.
split
(
"="
);
obj
[
keyArr
[
0
]]
=
keyArr
[
1
];
});
return
obj
;
};
/**获取图片版本号 */
const
getImgVersion
=
()
=>
{
}
const
getImgVersion
=
()
=>
{};
const
Util
=
{
getImgVersion
,
onReachBottom
,
isFullSucreen
,
clearObjNull
,
throttle
}
export
default
Util
throttle
,
isEmptyObj
,
parseString
,
};
export
default
Util
;
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