Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-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 865db9cf
authored
Oct 14, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
存session
1 parent
f242494c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
262 additions
and
89 deletions
pages/authentication/accountItems/accountItems.js
pages/authentication/lib/index.js
pages/authentication/login/login.js
pages/tab/discovery/components/product/product.js
pages/tab/discovery/components/product/product.scss
pages/tab/discovery/components/product/product.wxml
pages/tab/discovery/discovery.scss
pages/tab/discovery/discovery.wxml
utils/cache/storage.js
utils/cache/storageApi.js
utils/cache/userInfo.js
utils/constantData.js
utils/request/environment.js
pages/authentication/accountItems/accountItems.js
View file @
865db9c
...
...
@@ -80,13 +80,13 @@ Page({
},
choiceAccountLogin
()
{
let
{
loginUserInfoList
}
=
this
.
data
,
{
sessionId
}
=
this
;
let
id
=
loginUserInfoList
[
this
.
data
.
checkedId
]
let
id
=
loginUserInfoList
[
this
.
data
.
checkedId
]
.
uuid
if
(
!
id
)
{
wx
.
$api
.
showToast
(
'请选择账号'
)
return
}
console
.
log
(
sessionId
,
id
,
'sssss'
)
wx
.
$api
.
showLoading
()
//
wx.$api.showLoading()
selectAccountLogin
({
id
,
sessionId
...
...
pages/authentication/lib/index.js
View file @
865db9c
...
...
@@ -31,12 +31,14 @@ const selectAccountLogin = ({
message
})
=>
{
if
(
code
==
'0'
)
{
console
.
log
(
'选择账号登录'
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
}
else
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
})
}
/**设置登录信息 */
const
setLoginInfo
=
(
userInfo
,
sessionId
)
=>
{
console
.
log
(
111222222233333
)
setUserInfo
(
userInfo
)
setSessionId
(
sessionId
)
loginSuccess
()
...
...
pages/authentication/login/login.js
View file @
865db9c
...
...
@@ -13,7 +13,7 @@ Page({
padHeight
:
0
,
loginMethod
:
0
,
formData
:{
phone
:
'1
8778545361
'
,
phone
:
'1
3097951885
'
,
code
:
'8888'
},
authorized
:
false
...
...
pages/tab/discovery/components/product/product.js
View file @
865db9c
...
...
@@ -6,7 +6,6 @@ Component({
* 组件的属性列表
*/
properties
:
{
},
/**
...
...
@@ -63,6 +62,23 @@ Component({
this
.
data
.
heightArr
=
heightArr
console
.
log
(
this
.
data
.
heightArr
)
}).
exec
()
}
},
// 显示测算弹窗
showCalculate
()
{
this
.
setData
({
visible
:
!
this
.
data
.
visible
,
isReset
:
false
});
},
clickDialog
(
e
)
{
console
.
log
(
e
.
changedTouches
[
0
].
clientY
);
if
(
e
.
changedTouches
[
0
].
clientY
<
352
)
{
this
.
setData
({
visible
:
false
,
isReset
:
false
,
formData
:
this
.
data
.
lastFormData
});
}
},
}
})
pages/tab/discovery/components/product/product.scss
View file @
865db9c
.header
{
position
:
relative
;
width
:
100%
;
margin-bottom
:
80rpx
;
box-shadow
:
0
16rpx
16rpx
0
rgba
(
230
,
236
,
245
,
0
.6
);
}
.scene-wrap
{
position
:
absolute
;
bottom
:
0
;
transform
:
translateY
(
75rpx
);
white-space
:
nowrap
;
}
.scene-item
{
width
:
672rpx
;
height
:
180rpx
;
margin-bottom
:
16rpx
;
.scene-img
{
width
:
100%
;
}
}
// 特色产品
.prod-wrap
.big-title
{
...
...
@@ -35,7 +27,7 @@
width
:
188rpx
;
height
:
64rpx
;
border-radius
:
12rpx
;
font-weight
:
6
00
;
font-weight
:
5
00
;
font-size
:
24rpx
;
letter-spacing
:
0
;
text-align
:
center
;
...
...
@@ -49,6 +41,7 @@
background-image
:
linear-gradient
(
0deg
,
#EBEFFF
8%
,
#FCFDFF
85%
);
border
:
2rpx
solid
rgba
(
68
,
97
,
240
,
0
.50
);
box-shadow
:
0
8rpx
16rpx
0
rgba
(
175
,
187
,
219
,
0
.35
);
color
:
#4466F0
;
}
.prod-wrap
.nav-wrap
.nav
:last-child
{
margin-right
:
0
;
...
...
@@ -86,7 +79,7 @@
background
:
#D7F5EB
;
border-radius
:
4rpx
;
font-family
:
PingFangSC-Medium
;
font-weight
:
6
00
;
font-weight
:
5
00
;
font-size
:
24rpx
;
color
:
#24B38C
;
letter-spacing
:
0
;
...
...
@@ -107,7 +100,7 @@
}
.prod-info
.title
{
font-family
:
PingFangSC-Medium
;
font-weight
:
6
00
;
font-weight
:
5
00
;
font-size
:
28rpx
;
color
:
#323436
;
}
...
...
@@ -158,4 +151,131 @@
.img-item
{
height
:
300rpx
;
}
}
/* 测算 */
.calculate
{
position
:
fixed
;
right
:
16rpx
;
bottom
:
160rpx
;
}
.icon-calculate
{
width
:
216rpx
;
height
:
228rpx
;
}
/* 测算弹窗 */
.dialog-wrapper
{
position
:
fixed
;
height
:
100vh
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
background-color
:
rgba
(
45
,
45
,
51
,
0
.50
);
}
.dialog-box
{
position
:
fixed
;
bottom
:
0
;
width
:
100%
;
height
:
744rpx
;
background-color
:
#fff
;
box-shadow
:
0
-8rpx
20rpx
0
rgba
(
180
,
186
,
204
,
0
.32
);
border-radius
:
32rpx
32rpx
0
0
;
}
.dialog-header
{
display
:
flex
;
justify-content
:
space-between
;
padding
:
32rpx
48rpx
;
border-bottom
:
1rpx
solid
#eee
;
}
.header-btn
{
display
:
inline-block
;
font-size
:
32rpx
;
line-height
:
48rpx
;
}
.btn-gray
{
color
:
#6C737A
;
}
.btn-primary
{
background-color
:
#fff
;
border
:
none
;
margin
:
0
;
padding
:
0
;
font-weight
:
500
;
color
:
#5850FF
;
}
.
btn-primary
:
:
after
{
border
:
none
;
}
.dialog-content
{
padding
:
40rpx
24rpx
60rpx
;
}
.dialog-title
{
font-weight
:
600
;
font-size
:
36rpx
;
color
:
#333333
;
letter-spacing
:
0
;
text-align
:
center
;
line-height
:
56rpx
;
margin-bottom
:
24rpx
;
}
.dialog-form
{
width
:
100%
;
height
:
384rpx
;
background-image
:
linear-gradient
(
179deg
,
rgba
(
123
,
112
,
255
,
0
.02
)
15%
,
rgba
(
99
,
92
,
255
,
0
.10
)
100%
);
border-radius
:
8rpx
;
padding
:
32rpx
;
box-sizing
:
border-box
;
}
.form-item
{
display
:
flex
;
align-items
:
center
;
height
:
80rpx
;
margin-bottom
:
24rpx
;
justify-content
:
space-between
;
}
.form-label
{
width
:
256rpx
;
font-size
:
28rpx
;
color
:
#2D2D33
;
}
.form-input
{
width
:
216rpx
;
padding
:
16rpx
20rpx
;
border
:
2rpx
solid
#E6E6E6
;
border-radius
:
4rpx
;
margin-left
:
64rpx
;
margin-right
:
16rpx
;
}
.form-unit
{
font-size
:
28rpx
;
color
:
#6E6E7A
;
}
.dialog-btn
{
width
:
100%
;
padding
:
24rpx
0
;
box-sizing
:
border-box
;
background
:
#5850FF
;
border-radius
:
8rpx
;
font-weight
:
500
;
font-size
:
32rpx
;
color
:
#FFFFFF
;
letter-spacing
:
0
.8rpx
;
text-align
:
center
;
line-height
:
48rpx
;
margin-top
:
40rpx
;
}
/* 了解更多 */
.understand-more
{
position
:
absolute
;
bottom
:
0
;
width
:
100%
;
height
:
700rpx
;
background-image
:
linear-gradient
(
180deg
,
rgba
(
255
,
255
,
255
,
0
.00
)
0%
,
#FFFFFF
68%
);
border-radius
:
0
0
12rpx
12rpx
;
}
.understand-more
.more-btn
{
width
:
100%
;
position
:
absolute
;
bottom
:
104rpx
;
}
\ No newline at end of file
pages/tab/discovery/components/product/product.wxml
View file @
865db9c
<view style="height: {{btnHeight}}" class="header">
<image style="width: 100%;height: 100%" src="{{IMGURL}}discovery_center_bg.png"></image>
<scroll-view class="scene-wrap" scroll-x="{{true}}">
<view class="header">
<swiper class="scene-wrap" circular="{{true}}" previousMargin="40rpx" nextMargin="40rpx">
<block wx:for="{{sceneList}}" wx:key="index">
<image class="scene-item" src="{{IMGURL}}{{item}}"></image>
<swiper-item>
<image class="scene-img" src="{{IMGURL}}{{item}}"></image>
</swiper-item>
</block>
</s
croll-view
>
</s
wiper
>
</view>
<view class="prod-wrap">
<text class="big-title">特色产品</text>
...
...
@@ -43,3 +44,35 @@
</block>
</scroll-view>
</view>
<!-- 测算按钮 -->
<view class="calculate" bindtap="showCalculate">
<image class="icon-calculate" webp src="{{IMGURL}}customer_service.png"></image>
</view>
<!-- 测算弹窗 -->
<view class="dialog-wrapper" bindtap="clickDialog" hidden="{{!visible}}">
<view class="dialog-box">
<form bindsubmit="submit">
<view class="dialog-header">
<view hidden="{{isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view hidden="{{!isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
<view class="dialog-content">
<view class="dialog-title">输入您门店的基本情况</view>
<view class="dialog-form">
<view class="form-item">
<view class="form-label">门店月平均新车销量</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="sales" value="{{formData.sales}}" type="number" />
<!-- <view class="form-unit">台</view> -->
</view>
<view class="form-item">
<view class="form-label">3年内售后存量用户</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="flow" type="number" value="{{formData.flow}}" />
<!-- <view class="form-unit">人</view> -->
</view>
<button class="dialog-btn" form-type="submit">提交测算</button>
</view>
</view>
</form>
</view>
</view>
\ No newline at end of file
pages/tab/discovery/discovery.scss
View file @
865db9c
/* pages/tab/output/output.wxss */
.container
{
position
:
relative
;
.bg-img
{
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
304rpx
;
box-shadow
:
0
16rpx
16rpx
0
rgba
(
230
,
236
,
245
,
0
.6
);
}
}
pages/tab/discovery/discovery.wxml
View file @
865db9c
<view style="background: #fff;">
<view style="background:#fff;" class="container">
<image style="height: {{btnHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
</navigation-bar>
<view>
<view
style="padding-top: {{btnHeight}}px;"
>
<product></product>
</view>
</view>
\ No newline at end of file
utils/cache/storage.js
View file @
865db9c
...
...
@@ -2,8 +2,7 @@
* 微信小程序标准版:统一封装的 storage 操作类
*/
import
{
DEFAULT_GET_STORAGEKEY
,
GET_STORAGE_OBJECTkEY
}
from
'~/utils/constantData'
import
{
DEFAULT_GET_STORAGEKEY
,
STORAGE_OBJECTkEY
}
from
'~/utils/constantData'
class
Storage
{
types
=
{
1
:
'get'
,
// get
...
...
@@ -15,7 +14,7 @@ class Storage {
trial
:
'体验版'
,
release
:
'正式版'
}
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */
constructor
()
{
/** 获取当前小程序环境变量 */
...
...
@@ -40,6 +39,7 @@ class Storage {
throw
new
Error
(
`Storage
${
this
.
types
[
type
]}
func: key can not be empty`
)
return
false
}
// if STORAGE_OBJECTkEY[key]
return
tmpKey
}
return
key
...
...
@@ -51,31 +51,32 @@ class Storage {
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
get
=
(
key
,
syncFlag
=
true
)
=>
{
// 有key值
// 有
值默认取
key值
if
(
key
)
{
// 判断值是否是指定的对象值
let
tmpKey
=
this
.
checkKeyType
(
key
,
1
)
//
判断值是否是指定的对象值 是取定义的好的映射值
let
isObjectKey
=
GET_STORAGE_OBJECTkEY
[
key
]
let
isObjectKey
=
STORAGE_OBJECTkEY
[
tmpKey
]
//
console.log(key)
// console.log(isObjectKey)
if
(
isObjectKey
)
{
return
this
.
getObjectKeyValue
(
isObjectKey
)
}
else
{
return
this
.
getKeyValue
(
tmpKey
,
syncFlag
)
throw
new
Error
(
`Storage
${
this
.
types
[
1
]}
${
key
}
: key must be register`
)
}
}
else
{
// 为空取默认定义好的数组值
return
this
.
getObjectKeyValue
(
DEFAULT_GET_STORAGEKEY
)
}
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
* @param {*} 空key返回默认定义数组的值
*/
getKeyValue
(
tmpKey
,
syncFlag
)
{
if
(
syncFlag
)
{
let
res
=
wx
.
getStorageSync
(
tmpKey
)
getObjectKeyValue
(
key
)
{
// ObjectList
if
(
typeof
key
==
'string'
)
{
key
=
this
.
addEvnToKey
(
key
)
let
res
=
wx
.
getStorageSync
(
key
)
if
(
res
)
{
return
JSON
.
parse
(
res
)
}
else
{
...
...
@@ -83,35 +84,15 @@ class Storage {
return
''
}
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getStorage
({
key
:
tmpKey
,
success
:
res
=>
{
resolve
(
JSON
.
parse
(
res
.
data
))
},
fail
:
err
=>
{
// console.log(err)
// reject(errMsg)
resolve
(
''
)
}
})
let
Obj
=
{}
key
.
forEach
(
key
=>
{
let
defaultKey
=
this
.
addEvnToKey
(
key
)
let
res
=
wx
.
getStorageSync
(
defaultKey
)
Obj
[
key
]
=
res
?
JSON
.
parse
(
res
)
:
''
})
return
Obj
}
}
/**
*
* @param {*} 空key返回默认定义数组的值
*/
getObjectKeyValue
(
ObjectList
)
{
let
Obj
=
{}
ObjectList
.
forEach
(
key
=>
{
let
defaultKey
=
this
.
addEvnToKey
(
key
)
let
res
=
wx
.
getStorageSync
(
defaultKey
)
Obj
[
key
]
=
res
?
JSON
.
parse
(
res
)
:
''
})
return
Obj
}
/**
*
* @param {*} key | 要操作的键值
...
...
utils/cache/storageApi.js
View file @
865db9c
...
...
@@ -4,20 +4,26 @@ const $Storage = new Storage()
// console.log($Storage)
/** */
export
function
getSessionId
()
{
return
$Storage
.
get
(
's
crm_shopmall_s
essionId'
)
return
$Storage
.
get
(
'sessionId'
)
}
export
function
setSessionId
(
sessionId
)
{
$Storage
.
set
(
'scrm_shopmall_sessionId'
,
sessionId
)
$Storage
.
set
(
'sessionId'
,
sessionId
)
}
export
function
getUserInfo
()
{
return
$Storage
.
get
(
'userInfo'
)
}
export
function
setUserInfo
(
data
)
{
$Storage
.
set
(
'userInfo'
,
data
)
}
export
function
removeSystemStorage
()
{
$Storage
.
rm
(
'srcm_shopmall_user_info'
)
$Storage
.
rm
(
'scrm_shopmall_sessionId'
)
$Storage
.
rm
(
'guest_no'
)
$Storage
.
rm
(
'equity_info'
)
$Storage
.
rm
(
'packageList'
)
$Storage
.
rm
(
'isVIP'
)
$Storage
.
rm
(
'bizjiaUrl'
)
$Storage
.
rm
(
'vip_card_info'
)
//
$Storage.rm('srcm_shopmall_user_info')
//
$Storage.rm('scrm_shopmall_sessionId')
//
$Storage.rm('guest_no')
//
$Storage.rm('equity_info')
//
$Storage.rm('packageList')
//
$Storage.rm('isVIP')
//
$Storage.rm('bizjiaUrl')
//
$Storage.rm('vip_card_info')
}
export
function
setStorageSync
(
key
,
data
)
{
$Storage
.
set
(
key
,
JSON
.
stringify
(
data
))
...
...
@@ -29,22 +35,22 @@ export function getStorageSync(key) {
/**设置标题栏 */
export
function
setNavigationBarTitleText
(
title
)
{
$Storage
.
set
(
'
dj_shopmall_
app_title'
,
title
)
$Storage
.
set
(
'app_title'
,
title
)
}
/**获取app标题 */
export
function
getNavigationBarTitleText
()
{
return
$Storage
.
get
(
'
dj_shopmall_
app_title'
)
return
$Storage
.
get
(
'app_title'
)
}
/** 存储设备信息 */
export
function
setSystem_info
(
that
)
{
let
info
=
$Storage
.
get
(
's
rcm_shopmall_s
ystem_info'
)
let
info
=
$Storage
.
get
(
'system_info'
)
!
info
&&
wx
.
getSystemInfo
({
success
(
res
)
{
// console.log(res)
$Storage
.
set
(
's
rcm_shopmall_s
ystem_info'
,
res
)
$Storage
.
set
(
'system_info'
,
res
)
}
})
}
utils/cache/userInfo.js
View file @
865db9c
/**获取用户信息 */
export
function
getUserInfo
()
{
let
user
=
wx
.
$storage
.
get
(
'
srcm_shopmall_user_i
nfo'
)
||
null
let
user
=
wx
.
$storage
.
get
(
'
userI
nfo'
)
||
null
return
user
}
/**设置用户信息 */
export
function
setUserInfo
(
userInfo
)
{
wx
.
$storage
.
set
(
'
srcm_shopmall_user_i
nfo'
,
userInfo
)
wx
.
$storage
.
set
(
'
userI
nfo'
,
userInfo
)
}
export
function
isMember
(
isNeedToHttp
,
callBack
)
{
...
...
utils/constantData.js
View file @
865db9c
...
...
@@ -4,6 +4,10 @@ export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/sto
export
const
DEFAULT_GET_STORAGEKEY
=
[
'sessionId'
,
'merchantId'
,
'userInfo'
]
// 缓存get方法key的对应才映射值
export
const
GET_STORAGE_OBJECTkEY
=
{
super
:
[
'sessionId'
,
'merchantId'
,
'userInfo'
]
}
export
const
STORAGE_OBJECTkEY
=
{
DEFAULT_GET_STORAGEKEY
,
sessionId
:
'sessionId'
,
userInfo
:
'userInfo'
,
system_info
:
'systemInfo'
,
app_title
:
'appTitle'
}
\ No newline at end of file
utils/request/environment.js
View file @
865db9c
...
...
@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod']
2测试
3生产
*/
const
index
=
1
const
index
=
0
const
secretKey
=
{
ip
:
{},
dev
:
{
...
...
@@ -32,7 +32,7 @@ const secretKey = {
const
domain
=
{
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip
:
'http://192.168.
3.181:8394
'
,
ip
:
'http://192.168.
1.170:8315
'
,
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev
:
'https://scrm.dev.glsx.com.cn'
,
...
...
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