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 d6dff14e
authored
Oct 24, 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
0e97ecd0
a0ba21c7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
91 deletions
api/usersApi/UsersApi.js
login/loading/loading.json
pages/checkProduct/checkProduct.js
pages/tab/index/components/product/product.js
pages/tab/index/components/product/product.scss
pages/tab/index/index.wxml
utils/share.js
api/usersApi/UsersApi.js
View file @
d6dff14
import
api
from
'~/utils/request/request'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
const
CODE
=
{
platformEntrance
:
'BUSINESS_ASSISTANT'
,
productCode
:
'PC00c3'
...
...
@@ -7,20 +9,27 @@ const CODE = {
class
UsersApi
{
/**调用后台接口获取用户信息js_code换取sessionId */
async
wxCodeLogin
()
{
const
{
code
}
=
await
this
.
getWxCode
()
return
await
api
.
post
(
{
method
:
'scrm.api.sso.wechat.applets.jscode.login'
,
appId
,
const
appEnter
=
wx
.
getEnterOptionsSync
()
try
{
if
(
appEnter
.
scene
===
1154
&&
appEnter
.
mode
===
'singlePage'
)
throw
'login:fail rejected due to no permission currently'
const
{
code
},
true
)
}
=
await
this
.
getWxCode
()
return
await
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.jscode.login'
,
appId
,
code
},
true
)
}
catch
(
error
)
{
console
.
log
(
error
)
return
Promise
.
reject
()
}
}
/**退出登录 */
logout
()
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.logout'
},
true
...
...
@@ -46,8 +55,7 @@ class UsersApi {
delete
detail
.
errMsg
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
detail
.
loginToken
=
loginToken
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.auth.phone'
,
...
detail
,
platformEntrance
:
'BUSINESS_ASSISTANT'
// 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
...
...
@@ -58,8 +66,7 @@ class UsersApi {
}
/**账号密码登录 */
async
accountLogin
(
data
=
{})
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.password.login'
,
...
data
,
...
CODE
...
...
@@ -69,8 +76,7 @@ class UsersApi {
}
/** 手机号获取短信验证码 */
getSmsCode
(
mobile
)
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.sms.get.code'
,
mobile
},
...
...
@@ -79,8 +85,7 @@ class UsersApi {
}
/** 手机号短信验证码登录 */
phoneSmsLogin
(
data
=
{})
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.sms.login'
,
...
data
,
source
:
'MINIAPP'
,
...
...
@@ -91,8 +96,7 @@ class UsersApi {
}
/** 获取登录账号列表 */
getAccountList
(
sessionId
)
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.listSelectAccount'
,
...
CODE
,
sessionId
...
...
@@ -103,8 +107,7 @@ class UsersApi {
/**
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin
(
data
)
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.wechat.applets.selectAccountLogin'
,
...
CODE
,
...
data
...
...
@@ -114,8 +117,7 @@ class UsersApi {
}
/**检查sessionId 是否过期 */
checkSession
()
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.login.status.check'
},
true
...
...
@@ -123,8 +125,7 @@ class UsersApi {
}
/** 超级管理员切换账号 */
adminSelectLogin
(
data
)
{
return
api
.
post
(
{
return
api
.
post
({
method
:
'scrm.api.sso.super.administrator.select.login'
,
...
CODE
,
...
data
...
...
@@ -143,14 +144,13 @@ class UsersApi {
/**获取微信用户信息 */
async
getWXUserInfo
()
{
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
)
console
.
log
(
wx_user_info
)
if
(
!
wx_user_info
)
{
const
data
=
await
this
.
getUserProfile
()
wx
.
$storage
.
set
(
'wx_user_info'
,
data
)
return
data
}
else
return
wx_user_info
}
/** 手机号授权解析(单纯解析内容返回前端)
/** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
*/
...
...
@@ -169,4 +169,4 @@ class UsersApi {
})
}
}
export
default
UsersApi
export
default
UsersApi
\ No newline at end of file
login/loading/loading.json
View file @
d6dff14
{
"usingComponents"
:
{},
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
,
"disableScroll"
:
true
}
\ No newline at end of file
pages/checkProduct/checkProduct.js
View file @
d6dff14
...
...
@@ -3,6 +3,7 @@
const
navStyle
=
"background-color: #fff"
;
import
{
senceData
}
from
"~/pages/tab/index/constant/data"
;
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
import
{
productBysceneApi
}
from
'~/api/index.js'
import
Draw
from
"~/utils/Draw.js"
;
import
{
createQrCodeApi
,
sceneByIdApi
}
from
"~/api/checkProduct.js"
;
import
utils
from
"~/utils/util.js"
;
...
...
@@ -17,7 +18,7 @@ Page({
headerHeight
:
0
,
senceData
,
// 模态框
isShow
:
tru
e
,
isShow
:
fals
e
,
// IMG_URL: `${IMG_URL}index`,
btnList
:
[
{
...
...
@@ -93,6 +94,45 @@ Page({
isShow
:
true
,
});
},
//如果是直接查看页面,获取合成apiData
getData
()
{
console
.
log
(
123456
)
// 看产品
productBysceneApi
().
then
(
res
=>
{
let
{
code
,
data
}
=
res
if
(
code
==
0
&&
data
)
{
// this.setData({
// apiData: data
// })
this
.
compositionData
(
senceData
,
data
)
// this.getFirstSenceIndex();
}
})
},
//接口数据,本地数据对接
compositionData
(
localData
,
apiData
)
{
localData
.
forEach
((
item
,
index
)
=>
{
apiData
.
forEach
((
inner
,
idx
)
=>
{
if
(
item
.
name
==
inner
.
stage
)
{
item
.
sceneStatus
=
inner
.
sceneStatus
item
.
productList
.
forEach
((
outChild
,
outIndex
)
=>
{
inner
.
productList
.
forEach
((
innerChild
,
innerIndex
)
=>
{
if
(
outChild
.
proName
==
innerChild
.
productName
)
{
outChild
.
productStatus
=
innerChild
.
productStatus
}
})
})
}
})
})
// console.log('localData, apiData: ', localData);
this
.
setData
({
senceData
:
localData
})
},
//接受跳转的路由参数(小程序页面跳转)
onRoute
(
options
)
{
console
.
log
(
"分享options: "
,
options
);
...
...
@@ -102,7 +142,7 @@ Page({
let
{
actNum
,
activeNavIdx
,
apiData
,
//
apiData,
outshowVideo
,
// origin //跳转来源 home
}
=
options
;
...
...
@@ -110,24 +150,25 @@ Page({
// 设置标题
this
.
shareTitle
=
`给你分享一个
${
senceData
[
actNum
]?.
productList
[
activeNavIdx
].
proName
}
~
`;
this.getImgInfo(actNum)
this.setData({
actNum,
activeNavIdx,
apiData,
//
apiData,
outshowVideo,
// origin
// isShare
});
let apiDataJson = JSON.stringify(apiData);
let item =
api
Data[actNum]?.productList[activeNavIdx];
this.shareQuery = `
sceneCode
=
$
{
api
Data
[
actNum
].
sceneCode
}
&
productCode
=
$
{
//
let apiDataJson = JSON.stringify(apiData);
let item =
sence
Data[actNum]?.productList[activeNavIdx];
this.shareQuery = `
sceneCode
=
$
{
sence
Data
[
actNum
].
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
apiData
=
$
{
apiDataJson
}
`;
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`;
this.shareTrackData = {
sceneCode:
api
Data[actNum]?.sceneCode,
sceneCode:
sence
Data[actNum]?.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
...
...
@@ -156,7 +197,7 @@ Page({
},
// 下载海报
async download() {
let { actNum, activeNavIdx, imgHeightArr } = this.data;
let { actNum, activeNavIdx, imgHeightArr
,imgPath
} = this.data;
let wx_user_info = wx.$storage.get("wx_user_info");
// console.log('wx_user_info: ', wx_user_info.appId);
let params = {
...
...
@@ -165,59 +206,22 @@ Page({
isShare: true,
};
console.log(' wx_user_info.appId', wx_user_info)
let res = await createQrCodeApi({
appId: wx_user_info.appId,
// appId:'wx2c28337db96364d2',
path: "pages/checkProduct/checkProduct",
scene: JSON.stringify(params),
});
// console.log('res: ', res);
// let { actNum, imgHeightArr } = this.data;
//所有的长度
let imgAllHeight = imgHeightArr[actNum].reduce((total, current) => {
return total + current;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let erCodeHeight =
imgHeightArr[actNum].slice(0, 4).reduce((total, current) => {
return total + current;
}) +
98 * 2;
let _this = this;
wx.getImageInfo({
src: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum
+
1
}.
png
`,
src: imgPath,
success: async () => {
// // console.log("imgAllHeight: ", imgAllHeight);
// let drawFun = new Draw({
// width: 750,
// height: imgAllHeight,
// });
let drawFun = new Draw({
width: _this.data.imgWidth,
height: _this.data.imgHeight,
});
// let imgList = [
// {
// x: 0,
// y: 0,
// width: 750,
// height: imgAllHeight,
// url: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
// actNum + 1
// }.png`,
// },
// {
// x: 245 * 2,
// y: erCodeHeight + 30,
// width: 120 * 2,
// height: 120 * 2,
// url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
// },
// ];
let arr = [456, 222, 0, 496];
let imgList = [
...
...
@@ -269,16 +273,35 @@ Page({
// },
// 图片加载事件
onloadFn(event) {
console.log("event.detail", event.detail);
wx.hideLoading();
// this.setData({
// imgHeight: (event.detail.height * 0.2).toFixed(0),
// });
// console.log("event.detail", event.detail);
this.setData({
imgHeight: event.detail.height / 5,
imgWidth: event.detail.width / 5,
});
},
// 图片视频加载回调拿到url
getImgInfo(actNum){
wx.showLoading({
title: "加载中",
});
let _this = this;
wx.getImageInfo({
src: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum
+
1
}.
png
`,
success: async (res) => {
console.log('res: ', res)
wx.hideLoading()
wx.nextTick(() => {
_this.setData({
isShow: true,
imgPath:res.path
})
})
}
})
},
// 分享获取懂得用户数
authorizedFn(e) {
let res = e.detail;
...
...
@@ -297,6 +320,7 @@ Page({
* 生命周期函数--监听页面加载 (扫码,分享链接)
*/
async onLoad(options) {
this.getData()
console.log("分享options12255565: ", options);
// actNum,activeNavIdx isShare
if (!options || utils.isEmptyObj(options)) return;
...
...
pages/tab/index/components/product/product.js
View file @
d6dff14
...
...
@@ -58,7 +58,6 @@ Component({
activeNavIdx
:
this
.
data
.
wrapactiveNavIdx
})
}
console
.
log
(
'outshowVideo'
,
this
.
data
.
outshowVideo
)
if
(
!
this
.
data
.
outshowVideo
){
this
.
setData
({
...
...
@@ -77,7 +76,6 @@ Component({
},
observers
:
{
actNum
:
function
(
newval
,
oldval
)
{
console
.
log
(
'newval, oldval: '
,
newval
,
oldval
);
let
navList
;
let
tab
=
[
"场景说明"
,
...
...
pages/tab/index/components/product/product.scss
View file @
d6dff14
...
...
@@ -18,7 +18,6 @@
}
.prod-wrap
.nav-wrap
.nav
{
display
:
inline-block
;
width
:
188rpx
;
height
:
64rpx
;
border-radius
:
12rpx
;
font-weight
:
600
;
...
...
@@ -31,6 +30,7 @@
background
:
#ffffff
;
border
:
2rpx
solid
#dde3f0
;
color
:
#323436
;
padding
:
0
16rpx
;
}
.prod-wrap
.nav-wrap
.active-nav
{
color
:
#ffffff
;
...
...
@@ -44,9 +44,8 @@
}
.prod-item
{
padding
-bottom
:
32rpx
;
padding
:
0
32rpx
32rpx
;
margin
:
16rpx
auto
0
;
width
:
343px
;
background-color
:
#f5f7fb
;
border-radius
:
48rpx
48rpx
0
0
;
}
...
...
pages/tab/index/index.wxml
View file @
d6dff14
...
...
@@ -23,7 +23,7 @@
</view>
</view>
</view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" origin="home"
apiData="{{apiData}}"
bindsharehandle="sharehandle" />
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" senceData="{{senceData}}" origin="home" bindsharehandle="sharehandle" />
</view>
<!-- 看线索内容 -->
<view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false">
...
...
utils/share.js
View file @
d6dff14
...
...
@@ -52,7 +52,7 @@ class Share {
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
path
+=
that
.
setCommonShareQuery
()
if
(
shareQuery
)
path
+=
`&
${
shareQuery
}
`
console
.
log
(
'
::
'
,
path
)
console
.
log
(
'
===============
'
,
path
)
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
shareFun
)
shareFun
()
if
(
shareTrackData
)
that
.
reportShareData
(
shareTrackData
)
...
...
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