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 83ff14ec
authored
Sep 09, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化代码
1 parent
e28e4aaf
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
22 deletions
app.js
components/UserInfo/UserInfo.wxml
pages/addTransform/addTransformDetail/addTransformDetail.js
pages/addTransform/addTransformDetail/addTransformDetail.wxml
utils/Draw.js
utils/Track.js
utils/util.js
app.js
View file @
83ff14e
...
@@ -14,12 +14,10 @@ App({
...
@@ -14,12 +14,10 @@ App({
wx
.
$router
=
router
wx
.
$router
=
router
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
const
systemInfo
=
wx
.
getStorageSync
(
'aicard_system_info'
)
this
.
globalData
.
appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
const
systemInfo
=
wx
.
getStorageSync
(
'srcm_shopmall_system_info'
)
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
success
(
res
)
{
success
(
res
)
{
util
.
setStorageSync
(
'
srcm_shopmall
_system_info'
,
res
)
util
.
setStorageSync
(
'
aicard
_system_info'
,
res
)
}
}
})
})
if
(
options
.
path
!=
'pages/tab/index/index'
)
{
if
(
options
.
path
!=
'pages/tab/index/index'
)
{
...
@@ -36,7 +34,7 @@ App({
...
@@ -36,7 +34,7 @@ App({
})
{
})
{
ssoApi
.
jsCodeLogin
({
ssoApi
.
jsCodeLogin
({
code
,
code
,
appId
:
_this
.
globalData
.
appId
appId
:
wx
.
$
appId
}).
then
(
res
=>
{
}).
then
(
res
=>
{
wx
.
$authStatus
=
res
.
code
!=
0
wx
.
$authStatus
=
res
.
code
!=
0
util
.
setSessionId
(
res
.
data
.
sessionId
)
util
.
setSessionId
(
res
.
data
.
sessionId
)
...
@@ -47,13 +45,11 @@ App({
...
@@ -47,13 +45,11 @@ App({
if
(
returnResponse
)
{
if
(
returnResponse
)
{
resolve
(
result
)
resolve
(
result
)
}
else
{
}
else
{
if
(
result
.
code
!=
-
1
)
{
if
(
result
.
code
==
0
)
{
if
(
result
.
code
==
0
)
{
util
.
setUserInfo
(
result
.
data
)
util
.
setUserInfo
(
result
.
data
)
}
else
{
}
else
{
util
.
showToast
(
result
.
message
||
'网络异常'
)
util
.
showToast
(
result
.
message
||
'网络异常'
)
}
}
}
resolve
(
result
)
resolve
(
result
)
}
}
})
})
...
@@ -63,10 +59,9 @@ App({
...
@@ -63,10 +59,9 @@ App({
})
})
if
(
wx
.
$trackData
.
scene
)
{
if
(
wx
.
$trackData
.
scene
)
{
_this
.
getScene
(
wx
.
$trackData
.
scene
).
then
(
res
=>
{
_this
.
getScene
(
wx
.
$trackData
.
scene
).
then
(
res
=>
{
console
.
log
(
'scene'
,
wx
.
$trackData
.
scene
)
wx
.
$trackData
.
merchant
=
res
.
merchantId
wx
.
$trackData
.
merchant
=
res
.
merchantId
wx
.
$trackData
.
cardId
=
res
.
cardId
wx
.
$trackData
.
cardId
=
res
.
cardId
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
srcm_shopmall
_system_info'
))
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
aicard
_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
)
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
)
})
})
...
...
components/UserInfo/UserInfo.wxml
View file @
83ff14e
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
<block wx:if="{{!showWechant}}">
<block wx:if="{{!showWechant}}">
<view class="user-company">
<view class="user-company">
<image class="company-logo" src="{{IMGURL}}home/logo.png"></image>
<image class="company-logo" src="{{IMGURL}}home/logo.png"></image>
<!-- <text>汽车流通行业数字化运营服务商</text> -->
</view>
</view>
<view class="user-name">
<view class="user-name">
<view class="name">{{cardInfo.staffName || ''}}</view>
<view class="name">{{cardInfo.staffName || ''}}</view>
...
...
pages/addTransform/addTransformDetail/addTransformDetail.js
View file @
83ff14e
// pages/addTransform/detail/detail.js
// pages/addTransform/detail/detail.js
import
pageData
from
'../constant/data'
import
pageData
from
'../constant/data'
import
util
from
'../../../utils/util'
Page
({
Page
({
/**
/**
...
@@ -10,13 +11,20 @@ Page({
...
@@ -10,13 +11,20 @@ Page({
attrName
:
''
,
attrName
:
''
,
proName
:
''
,
proName
:
''
,
addDatailObj
:
pageData
.
addDatailObj
,
addDatailObj
:
pageData
.
addDatailObj
,
detailObj
:
{}
detailObj
:
{},
hasShare
:
false
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
console
.
log
(
util
.
getUserInfo
())
if
(
util
.
getUserInfo
().
phone
)
{
this
.
setData
({
hasShare
:
true
})
}
wx
.
$router
.
getData
(({
wx
.
$router
.
getData
(({
attrName
,
attrName
,
proName
proName
...
...
pages/addTransform/addTransformDetail/addTransformDetail.wxml
View file @
83ff14e
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
<video class="video" wx:for="{{detailObj.videoList}}" wx:key="index" title="案例视频:{{proName}}" src="{{IMGURL}}{{item.url}}?v={{img_version}}"></video>
<video class="video" wx:for="{{detailObj.videoList}}" wx:key="index" title="案例视频:{{proName}}" src="{{IMGURL}}{{item.url}}?v={{img_version}}"></video>
</view>
</view>
<view class="fixed-btn">
<view class="fixed-btn"
wx:if="{{hasShare}}"
>
<
view class="btn-share" bindtap="handleS
hare">
<
button class="btn-share" open-type="s
hare">
<image class="btn-icon" src="{{IMGURL}}addTransform/detail/share.png?v={{img_version}}"/>
<image class="btn-icon" src="{{IMGURL}}addTransform/detail/share.png?v={{img_version}}"/>
<text>分享此页面</text>
<text>分享此页面</text>
</
view
>
</
button
>
</view>
</view>
</view>
</view>
\ No newline at end of file
\ No newline at end of file
utils/Draw.js
View file @
83ff14e
...
@@ -10,7 +10,7 @@ class Draw {
...
@@ -10,7 +10,7 @@ class Draw {
constructor
(
_this_
,
canvasObject
)
{
constructor
(
_this_
,
canvasObject
)
{
let
{
let
{
pixelRatio
pixelRatio
}
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
srcm_shopmall
_system_info'
))
}
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
aicard
_system_info'
))
this
[
_canvasObject_
]
=
canvasObject
this
[
_canvasObject_
]
=
canvasObject
this
[
_pixelRatio_
]
=
canvasObject
.
pixelRatio
||
pixelRatio
||
2
this
[
_pixelRatio_
]
=
canvasObject
.
pixelRatio
||
pixelRatio
||
2
const
height
=
this
.
toRpx
(
canvasObject
.
height
),
const
height
=
this
.
toRpx
(
canvasObject
.
height
),
...
...
utils/Track.js
View file @
83ff14e
...
@@ -176,7 +176,7 @@ class TRACK {
...
@@ -176,7 +176,7 @@ class TRACK {
model
,
model
,
system
,
system
,
version
version
}
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
srcm_shopmall
_system_info'
))
}
=
JSON
.
parse
(
wx
.
getStorageSync
(
'
aicard
_system_info'
))
return
{
return
{
SDK_version
:
SDKVersion
,
SDK_version
:
SDKVersion
,
brand
,
brand
,
...
...
utils/util.js
View file @
83ff14e
...
@@ -246,14 +246,14 @@ const isFullSucreen = (isComponents) => {
...
@@ -246,14 +246,14 @@ const isFullSucreen = (isComponents) => {
}
}
/** */
/** */
const
getSessionId
=
()
=>
{
const
getSessionId
=
()
=>
{
return
wx
.
getStorageSync
(
'
scrm_shopmall
_sessionId'
)
return
wx
.
getStorageSync
(
'
aicard
_sessionId'
)
}
}
const
setSessionId
=
sessionId
=>
{
const
setSessionId
=
sessionId
=>
{
wx
.
setStorageSync
(
'
scrm_shopmall
_sessionId'
,
sessionId
)
wx
.
setStorageSync
(
'
aicard
_sessionId'
,
sessionId
)
}
}
const
removeSystemStorage
=
()
=>
{
const
removeSystemStorage
=
()
=>
{
wx
.
removeStorageSync
(
'
srcm_shopmall
_user_info'
)
wx
.
removeStorageSync
(
'
aicard
_user_info'
)
wx
.
removeStorageSync
(
'
scrm_shopmall
_sessionId'
)
wx
.
removeStorageSync
(
'
aicard
_sessionId'
)
wx
.
removeStorageSync
(
'guest_no'
)
wx
.
removeStorageSync
(
'guest_no'
)
wx
.
removeStorageSync
(
'equity_info'
)
wx
.
removeStorageSync
(
'equity_info'
)
wx
.
removeStorageSync
(
'packageList'
)
wx
.
removeStorageSync
(
'packageList'
)
...
@@ -303,12 +303,12 @@ const phoneCall = phoneNumber => {
...
@@ -303,12 +303,12 @@ const phoneCall = phoneNumber => {
}
}
/**获取用户信息 */
/**获取用户信息 */
const
getUserInfo
=
()
=>
{
const
getUserInfo
=
()
=>
{
let
user
=
wx
.
getStorageSync
(
'
srcm_shopmall
_user_info'
)
||
null
let
user
=
wx
.
getStorageSync
(
'
aicard
_user_info'
)
||
null
return
JSON
.
parse
(
user
)
return
JSON
.
parse
(
user
)
}
}
/**设置用户信息 */
/**设置用户信息 */
const
setUserInfo
=
userInfo
=>
{
const
setUserInfo
=
userInfo
=>
{
wx
.
setStorageSync
(
'
srcm_shopmall
_user_info'
,
JSON
.
stringify
(
userInfo
))
wx
.
setStorageSync
(
'
aicard
_user_info'
,
JSON
.
stringify
(
userInfo
))
}
}
/**IOS时间兼容 */
/**IOS时间兼容 */
const
iosTimeFormat
=
time
=>
{
const
iosTimeFormat
=
time
=>
{
...
...
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