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 1f1dd645
authored
Dec 19, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交产品详情
1 parent
aaaf1704
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
274 additions
and
16 deletions
package-lock.json
package.json
packagesList/pages/productDetail/components/proDetail/proDetail.js
packagesList/pages/productDetail/components/proDetail/proDetail.json
packagesList/pages/productDetail/components/proDetail/proDetail.wxml
packagesList/pages/productDetail/productDetail.js
packagesList/pages/productDetail/productDetail.json
packagesList/pages/productDetail/productDetail.wxml
pages/tab/index/index.js
utils/lib/miniprogram-computed.js
utils/util.js
package-lock.json
View file @
1f1dd64
...
...
@@ -4,10 +4,15 @@
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"@vant/weapp"
:
{
"version"
:
"1.10.9"
,
"resolved"
:
"https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.9.tgz"
,
"integrity"
:
"sha512-hFJ48SCSvRgcwT/9TcxwNnNnWSpy2BpaBfwQwVdU6uwgFH+2OqGL435VQN7EDpIMH8YjHbiM84hueTyxAzIPqQ=="
},
"glsx-applet-component"
:
{
"version"
:
"1.0.2
1
"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.2
1
.tgz"
,
"integrity"
:
"sha512-
XtdGqZitLxiMRd4NxtZnHd9mwh/RHcTxNgBUFvK15V0fkffoWuWLzsfN1wm65/GQkHl7ltgumonUsYOwYmCsN
Q=="
"version"
:
"1.0.2
2
"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.0.2
2
.tgz"
,
"integrity"
:
"sha512-
zI2MPI3/xA4OLMA3z0WyILfjXIN2XSs2rtAGN2j1jbLH3tRcE6BL1LqPNv7xc2jFmPBNrrf+kywBBVJhoPOf4
Q=="
}
}
}
package.json
View file @
1f1dd64
...
...
@@ -4,7 +4,8 @@
"description"
:
""
,
"main"
:
"app.js"
,
"dependencies"
:
{
"glsx-applet-component"
:
"^1.0.23"
"@vant/weapp"
:
"^1.10.9"
,
"glsx-applet-component"
:
"^1.0.22"
},
"devDependencies"
:
{},
"scripts"
:
{
...
...
packagesList/pages/productDetail/components/proDetail/proDetail.js
View file @
1f1dd64
// packagesList/pages/productDetail/components/proDetail/proDetail.js
import
{
senceData
,
productData
}
from
"~/pages/tab/index/constant/senceData"
Component
({
/**
* 组件的属性列表
*/
properties
:
{
// 场景值下标
actNum
:
{
type
:
Number
,
value
:
-
1
,
observer
(
n
)
{
this
.
getInfo
()
this
.
getImgHeight
()
}
},
// 选中的产品
activeNavIdx
:
{
type
:
Number
,
value
:
0
}
},
/**
* 组件的初始数据
*/
data
:
{
IMG_URL
:
'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/'
,
productData
,
proInfo
:
{},
prodItemVideo
:
''
,
//选中的场景下的video的第一个
tabAct
:
0
,
scrollTop
:
0
},
/**
* 组件的方法列表
*/
methods
:
{
getInfo
()
{
let
{
activeNavIdx
,
actNum
}
=
this
.
data
console
.
log
(
actNum
)
console
.
log
(
activeNavIdx
)
const
senceList
=
productData
[
actNum
].
filter
(
item
=>
item
.
name
!=
'全部'
)
for
(
let
i
=
0
;
i
<
senceList
.
length
;
i
++
)
{
let
item
=
senceList
[
i
]
let
proIdList
=
item
?.
productList
.
map
(
k
=>
k
.
id
)
if
(
proIdList
.
includes
(
activeNavIdx
))
{
console
.
log
(
item
,
'item----'
)
console
.
log
(
item
.
productList
.
find
(
k
=>
k
.
id
==
activeNavIdx
))
this
.
setData
({
proInfo
:
item
.
productList
.
find
(
k
=>
k
.
id
==
activeNavIdx
),
productImgs
:
item
.
productImgs
,
prodItemVideo
:
item
.
videoList
.
length
?
item
.
videoList
[
activeNavIdx
]
:
item
.
noVideoPicture
[
0
]
})
console
.
log
(
this
.
data
.
prodItemVideo
,
'prodItemVideo--------'
)
break
}
}
},
getImgHeight
()
{
let
query
=
wx
.
createSelectorQuery
().
in
(
this
);
let
heightArr
=
[];
let
imgTopArr
=
[];
let
s
=
0
;
let
top
;
let
{
scrollTop
}
=
this
.
data
let
_this
=
this
;
query
.
selectAll
(
".img-item"
)
.
boundingClientRect
((
react
)
=>
{
react
.
forEach
((
item
,
index
)
=>
{
//44 tab的高度
// console.log('item',item)
s
=
item
.
top
-
44
+
scrollTop
;
imgTopArr
.
push
(
s
);
});
_this
.
setData
({
imgTopArr
,
});
})
.
exec
();
// setTimeout(() => {
// console.log('imgTopArr',this.data.imgTopArr)
// },500)
},
onClickTab
(
event
)
{
// console.log('event: ', event);
let
{
index
}
=
event
.
detail
;
// console.log('index: ', index);
this
.
setData
({
tabAct
:
index
,
});
let
{
imgTopArr
}
=
this
.
data
wx
.
pageScrollTo
({
scrollTop
:
imgTopArr
[
index
]
+
5
});
},
pageSroll
(
e
)
{
let
{
imgTopArr
}
=
this
.
data
wx
.
nextTick
(()
=>
{
let
idx
if
(
imgTopArr
[
0
]
>
e
.
scrollTop
)
{
idx
=
0
}
else
if
(
imgTopArr
[
imgTopArr
.
length
-
1
]
>
e
.
scrollTop
&&
imgTopArr
[
0
]
<
e
.
scrollTop
)
{
idx
=
imgTopArr
.
findIndex
((
item
)
=>
item
>
e
.
scrollTop
)
-
1
}
else
{
idx
=
imgTopArr
.
length
-
1
}
this
.
setData
({
tabAct
:
idx
,
scrollTop
:
e
.
scrollTop
});
});
},
}
})
packagesList/pages/productDetail/components/proDetail/proDetail.json
View file @
1f1dd64
{
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"van-tab"
:
"@vant/weapp/tab/index"
,
"van-tabs"
:
"@vant/weapp/tabs/index"
}
}
\ No newline at end of file
packagesList/pages/productDetail/components/proDetail/proDetail.wxml
View file @
1f1dd64
...
...
@@ -23,7 +23,7 @@
</van-tabs>
</view>
<view class="prod-detail">
<block wx:for="{{
senceData[actNum].
productImgs}}" wx:key="index">
<block wx:for="{{productImgs}}" wx:key="index">
<image wx:if="{{ index < 3}}" webp class="img-item img-item{{index}} img-item{{actNum}}{{index}}" src="{{item}}?v={{img_version}}">
<block wx:if="{{ index == 0}}">
<!-- && phone -->
...
...
@@ -59,6 +59,6 @@
</view>
</view>
<!-- 申请按钮 不是分享出去的显示按钮 -->
<
apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button
>
<
!-- <apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button> --
>
<!-- 授权昵称 -->
<
view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view
>
<
!-- <view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view> --
>
packagesList/pages/productDetail/productDetail.js
View file @
1f1dd64
// packagesList/pages/productDetail/productDetail.js
import
{
behavior
as
computedBehavior
}
from
'~/utils/lib/miniprogram-computed'
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
import
{
senceData
,
productData
}
from
"~/pages/tab/index/constant/senceData"
// import USERAPI from '~/api/usersApi/index'
import
utils
from
'~/utils/util'
// import {getActiveApi} from "~/api/viewprod"
Page
({
/**
* 页面的初始数据
*/
noPageAuth
:
true
,
behaviors
:
[
computedBehavior
],
data
:
{
IMG_URL
,
senceData
,
productData
,
proInfo
:
{},
isShare
:
false
,
//是否是分享出去的
actNum
:
0
,
tabAct
:
0
,
showLeft
:
false
,
//更多按钮显示的内容
scrollTop
:
0
,
img_version
:
'0.1.0'
,
// 是否授权昵称
hasUserInfo
:
false
,
prodItemVideo
:
''
,
//选中的场景下的video的第一个
activeUrl
:
''
,
// 1.3场景才有的活动配置
sharephone
:
''
//主要微信用户,服务商
},
// 计算属性
computed
:
{
showLeftFlag
(
data
)
{
// 1.分享出去
// 2.点击可以改变状态
return
data
.
isShare
&&
!
data
.
showLeft
},
prodItemVideo
(
data
)
{
let
{
senceData
,
actNum
,
activeNavIdx
}
=
data
// if(actNum == 2){
// return senceData[actNum]?.noVideoPicture[0]
// }
// return senceData[actNum]?.videoList[activeNavIdx]
},
// 授权昵称弹框显示
authNcknameShow
(
data
){
return
data
.
isShare
&&
!
data
.
hasUserInfo
}
},
//接受跳转的路由参数(小程序页面跳转)
onRoute
(
options
)
{
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
actNum
=
0
,
activeNavIdx
=
0
,
phone
}
=
options
this
.
setData
({
actNum
,
//选中的场景下标
activeNavIdx
,
//选中的产品
sharephone
:
phone
//联系电话 (登陆的用户)
})
// console.log(this.data.senceData, 'senceData-----')
const
senceList
=
productData
[
this
.
data
.
actNum
].
filter
(
item
=>
item
.
name
!=
'全部'
)
var
proInfo
=
{}
for
(
let
i
=
0
;
i
<
senceList
.
length
;
i
++
)
{
let
proIdList
=
senceList
[
i
]?.
productList
.
map
(
k
=>
k
.
id
)
if
(
proIdList
.
includes
(
activeNavIdx
))
{
proInfo
=
senceList
[
i
].
productList
.
find
(
k
=>
k
.
id
==
activeNavIdx
)
break
}
}
this
.
setData
({
proInfo
})
// console.log(this.data.proInfo, '---------proInfo')
// 设置转发标题
let
userInfoObj
=
wx
.
$storage
.
get
(
"userInfo"
)
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let
name
=
userInfoObj
.
merchantName
this
.
shareTitle
=
`
${
name
}
给你分享一个活动
${
proInfo
.
productName
}
,戳我参与~`
//分享数据
let
item
=
proInfo
// console.log('title2',item.productName)
setTimeout
(()
=>
{
utils
.
setNavigationBarTitle
(
item
.
productName
)
},
100
)
//分享人openId
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
),
shareOpenId
=
wx_user_info
.
openId
||
''
this
.
shareQuery
=
`sceneCode=
${
senceData
[
actNum
].
sceneCode
}
&productCode=
${
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
sharephone
=
$
{
phone
}
`
this.shareTrackData = {
sceneCode: senceData[actNum]?.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName,
shareOpenId:shareOpenId
}
},
onPageScroll: (function () {
let timer = null;
return function (e) {
// console.log(e)
// console.log("在滚动");
// 监听页面的滚动开始和结束
clearTimeout(timer);
timer = setTimeout(() => {
let proDetail = this.selectComponent("#pro-detail")
proDetail.pageSroll(e)
}, 100);
};
})(),
/**
* 生命周期函数--监听页面加载
...
...
packagesList/pages/productDetail/productDetail.json
View file @
1f1dd64
{
"usingComponents"
:
{}
"usingComponents"
:
{
"pro-detail"
:
"./components/proDetail/proDetail"
}
}
\ No newline at end of file
packagesList/pages/productDetail/productDetail.wxml
View file @
1f1dd64
<!--packagesList/pages/productDetail/productDetail.wxml-->
<
text>packagesList/pages/productDetail/productDetail.wxml</text
>
<
pro-detail id="pro-detail" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}"></pro-detail
>
pages/tab/index/index.js
View file @
1f1dd64
...
...
@@ -110,14 +110,18 @@ Page({
},
proClick
(
e
)
{
console
.
log
(
e
,
'pro'
)
let
{
detail
}
=
e
//登录的用户手机号
let
userInfo
=
wx
.
$storage
.
get
(
"userInfo"
);
// let userInfo = wx.$storage.get("userInfo")
let
obj
=
{
phone
:
userInfo
.
phone
// actNum: tabActive, //选中的场景
// activeNavIdx: 0, //选中的产品
actNum
:
detail
.
scenIndex
,
//选中的场景
activeNavIdx
:
detail
.
id
//选中的产品
// phone: userInfo.phone
}
//
wx.$router.go("/packagesList/pages/productDetail/productDetail", obj)
wx
.
$router
.
go
(
"/packagesList/pages/productDetail/productDetail"
,
obj
)
},
// 跳转视频详情
videoClick
(
e
)
{
...
...
utils/lib/miniprogram-computed.js
0 → 100644
View file @
1f1dd64
var
_
=
(
t
,
e
)
=>
()
=>
(
e
||
t
((
e
=
{
exports
:{}}).
exports
,
e
),
e
.
exports
);
var
S
=
_
((
le
,
M
)
=>
{
"use strict"
;
M
.
exports
=
N
;
function
y
(
t
){
return
t
instanceof
Buffer
?
Buffer
.
from
(
t
):
new
t
.
constructor
(
t
.
buffer
.
slice
(),
t
.
byteOffset
,
t
.
length
)}
function
N
(
t
){
if
(
t
=
t
||
{},
t
.
circles
)
return
Q
(
t
);
return
t
.
proto
?
s
:
a
;
function
e
(
f
,
i
){
for
(
var
r
=
Object
.
keys
(
f
),
n
=
new
Array
(
r
.
length
),
u
=
0
;
u
<
r
.
length
;
u
++
){
var
o
=
r
[
u
],
p
=
f
[
o
];
typeof
p
!=
"object"
||
p
===
null
?
n
[
o
]
=
p
:
p
instanceof
Date
?
n
[
o
]
=
new
Date
(
p
):
ArrayBuffer
.
isView
(
p
)?
n
[
o
]
=
y
(
p
):
n
[
o
]
=
i
(
p
)}
return
n
}
function
a
(
f
){
if
(
typeof
f
!=
"object"
||
f
===
null
)
return
f
;
if
(
f
instanceof
Date
)
return
new
Date
(
f
);
if
(
Array
.
isArray
(
f
))
return
e
(
f
,
a
);
if
(
f
instanceof
Map
)
return
new
Map
(
e
(
Array
.
from
(
f
),
a
));
if
(
f
instanceof
Set
)
return
new
Set
(
e
(
Array
.
from
(
f
),
a
));
var
i
=
{};
for
(
var
r
in
f
)
if
(
Object
.
hasOwnProperty
.
call
(
f
,
r
)
!==!
1
){
var
n
=
f
[
r
];
typeof
n
!=
"object"
||
n
===
null
?
i
[
r
]
=
n
:
n
instanceof
Date
?
i
[
r
]
=
new
Date
(
n
):
n
instanceof
Map
?
i
[
r
]
=
new
Map
(
e
(
Array
.
from
(
n
),
a
)):
n
instanceof
Set
?
i
[
r
]
=
new
Set
(
e
(
Array
.
from
(
n
),
a
)):
ArrayBuffer
.
isView
(
n
)?
i
[
r
]
=
y
(
n
):
i
[
r
]
=
a
(
n
)}
return
i
}
function
s
(
f
){
if
(
typeof
f
!=
"object"
||
f
===
null
)
return
f
;
if
(
f
instanceof
Date
)
return
new
Date
(
f
);
if
(
Array
.
isArray
(
f
))
return
e
(
f
,
s
);
if
(
f
instanceof
Map
)
return
new
Map
(
e
(
Array
.
from
(
f
),
s
));
if
(
f
instanceof
Set
)
return
new
Set
(
e
(
Array
.
from
(
f
),
s
));
var
i
=
{};
for
(
var
r
in
f
){
var
n
=
f
[
r
];
typeof
n
!=
"object"
||
n
===
null
?
i
[
r
]
=
n
:
n
instanceof
Date
?
i
[
r
]
=
new
Date
(
n
):
n
instanceof
Map
?
i
[
r
]
=
new
Map
(
e
(
Array
.
from
(
n
),
s
)):
n
instanceof
Set
?
i
[
r
]
=
new
Set
(
e
(
Array
.
from
(
n
),
s
)):
ArrayBuffer
.
isView
(
n
)?
i
[
r
]
=
y
(
n
):
i
[
r
]
=
s
(
n
)}
return
i
}}
function
Q
(
t
){
var
e
=
[],
a
=
[];
return
t
.
proto
?
i
:
f
;
function
s
(
r
,
n
){
for
(
var
u
=
Object
.
keys
(
r
),
o
=
new
Array
(
u
.
length
),
p
=
0
;
p
<
u
.
length
;
p
++
){
var
c
=
u
[
p
],
l
=
r
[
c
];
if
(
typeof
l
!=
"object"
||
l
===
null
)
o
[
c
]
=
l
;
else
if
(
l
instanceof
Date
)
o
[
c
]
=
new
Date
(
l
);
else
if
(
ArrayBuffer
.
isView
(
l
))
o
[
c
]
=
y
(
l
);
else
{
var
h
=
e
.
indexOf
(
l
);
h
!==-
1
?
o
[
c
]
=
a
[
h
]:
o
[
c
]
=
n
(
l
)}}
return
o
}
function
f
(
r
){
if
(
typeof
r
!=
"object"
||
r
===
null
)
return
r
;
if
(
r
instanceof
Date
)
return
new
Date
(
r
);
if
(
Array
.
isArray
(
r
))
return
s
(
r
,
f
);
if
(
r
instanceof
Map
)
return
new
Map
(
s
(
Array
.
from
(
r
),
f
));
if
(
r
instanceof
Set
)
return
new
Set
(
s
(
Array
.
from
(
r
),
f
));
var
n
=
{};
e
.
push
(
r
),
a
.
push
(
n
);
for
(
var
u
in
r
)
if
(
Object
.
hasOwnProperty
.
call
(
r
,
u
)
!==!
1
){
var
o
=
r
[
u
];
if
(
typeof
o
!=
"object"
||
o
===
null
)
n
[
u
]
=
o
;
else
if
(
o
instanceof
Date
)
n
[
u
]
=
new
Date
(
o
);
else
if
(
o
instanceof
Map
)
n
[
u
]
=
new
Map
(
s
(
Array
.
from
(
o
),
f
));
else
if
(
o
instanceof
Set
)
n
[
u
]
=
new
Set
(
s
(
Array
.
from
(
o
),
f
));
else
if
(
ArrayBuffer
.
isView
(
o
))
n
[
u
]
=
y
(
o
);
else
{
var
p
=
e
.
indexOf
(
o
);
p
!==-
1
?
n
[
u
]
=
a
[
p
]:
n
[
u
]
=
f
(
o
)}}
return
e
.
pop
(),
a
.
pop
(),
n
}
function
i
(
r
){
if
(
typeof
r
!=
"object"
||
r
===
null
)
return
r
;
if
(
r
instanceof
Date
)
return
new
Date
(
r
);
if
(
Array
.
isArray
(
r
))
return
s
(
r
,
i
);
if
(
r
instanceof
Map
)
return
new
Map
(
s
(
Array
.
from
(
r
),
i
));
if
(
r
instanceof
Set
)
return
new
Set
(
s
(
Array
.
from
(
r
),
i
));
var
n
=
{};
e
.
push
(
r
),
a
.
push
(
n
);
for
(
var
u
in
r
){
var
o
=
r
[
u
];
if
(
typeof
o
!=
"object"
||
o
===
null
)
n
[
u
]
=
o
;
else
if
(
o
instanceof
Date
)
n
[
u
]
=
new
Date
(
o
);
else
if
(
o
instanceof
Map
)
n
[
u
]
=
new
Map
(
s
(
Array
.
from
(
o
),
i
));
else
if
(
o
instanceof
Set
)
n
[
u
]
=
new
Set
(
s
(
Array
.
from
(
o
),
i
));
else
if
(
ArrayBuffer
.
isView
(
o
))
n
[
u
]
=
y
(
o
);
else
{
var
p
=
e
.
indexOf
(
o
);
p
!==-
1
?
n
[
u
]
=
a
[
p
]:
n
[
u
]
=
i
(
o
)}}
return
e
.
pop
(),
a
.
pop
(),
n
}}});
var
V
=
_
((
ce
,
I
)
=>
{
"use strict"
;
var
C
=
Array
.
isArray
,
W
=
Object
.
keys
,
Z
=
Object
.
prototype
.
hasOwnProperty
;
I
.
exports
=
function
t
(
e
,
a
){
if
(
e
===
a
)
return
!
0
;
if
(
e
&&
a
&&
typeof
e
==
"object"
&&
typeof
a
==
"object"
){
var
s
=
C
(
e
),
f
=
C
(
a
),
i
,
r
,
n
;
if
(
s
&&
f
){
if
(
r
=
e
.
length
,
r
!=
a
.
length
)
return
!
1
;
for
(
i
=
r
;
i
--!=
0
;)
if
(
!
t
(
e
[
i
],
a
[
i
]))
return
!
1
;
return
!
0
}
if
(
s
!=
f
)
return
!
1
;
var
u
=
e
instanceof
Date
,
o
=
a
instanceof
Date
;
if
(
u
!=
o
)
return
!
1
;
if
(
u
&&
o
)
return
e
.
getTime
()
==
a
.
getTime
();
var
p
=
e
instanceof
RegExp
,
c
=
a
instanceof
RegExp
;
if
(
p
!=
c
)
return
!
1
;
if
(
p
&&
c
)
return
e
.
toString
()
==
a
.
toString
();
var
l
=
W
(
e
);
if
(
r
=
l
.
length
,
r
!==
W
(
a
).
length
)
return
!
1
;
for
(
i
=
r
;
i
--!=
0
;)
if
(
!
Z
.
call
(
a
,
l
[
i
]))
return
!
1
;
for
(
i
=
r
;
i
--!=
0
;)
if
(
n
=
l
[
i
],
!
t
(
e
[
n
],
a
[
n
]))
return
!
1
;
return
!
0
}
return
e
!==
e
&&
a
!==
a
}});
var
q
=
_
(
A
=>
{
"use strict"
;
Object
.
defineProperty
(
A
,
"__esModule"
,{
value
:
!
0
}),
A
.
parseMultiDataPaths
=
ee
,
A
.
getDataOnPath
=
void
0
;
var
E
=
/^
\s
/
,
b
=
function
(
t
,
e
){
throw
new
Error
(
'Parsing data path "'
+
t
+
'" failed at char "'
+
t
[
e
]
+
'" (index '
+
e
+
")"
)},
L
=
function
(
t
,
e
){
for
(
var
a
=
e
.
index
;
e
.
index
<
e
.
length
;){
var
s
=
t
[
e
.
index
];
if
(
/^
[
0-9
]
/
.
test
(
s
)){
e
.
index
++
;
continue
}
break
}
return
a
===
e
.
index
&&
b
(
t
,
e
.
index
),
parseInt
(
t
.
slice
(
a
,
e
.
index
),
10
)},
R
=
function
(
t
,
e
){
var
a
=
e
.
index
,
s
=
t
[
a
];
if
(
/^
[
_a-zA-Z$
]
/
.
test
(
s
))
for
(
e
.
index
++
;
e
.
index
<
e
.
length
;){
var
f
=
t
[
e
.
index
];
if
(
/^
[
_a-zA-Z0-9$
]
/
.
test
(
f
)){
e
.
index
++
;
continue
}
break
}
else
b
(
t
,
e
.
index
);
return
t
.
slice
(
a
,
e
.
index
)},
B
=
function
(
t
,
e
){
for
(
var
a
=
[
R
(
t
,
e
)],
s
=
{
deepCmp
:
!
1
};
e
.
index
<
e
.
length
;){
var
f
=
t
[
e
.
index
];
if
(
f
===
"["
)
e
.
index
++
,
a
.
push
(
L
(
t
,
e
)),
t
[
e
.
index
]
!==
"]"
&&
b
(
t
,
e
.
index
),
e
.
index
++
;
else
if
(
f
===
"."
){
if
(
e
.
index
++
,
t
[
e
.
index
]
===
"*"
){
if
(
e
.
index
++
,
t
[
e
.
index
]
===
"*"
){
e
.
index
++
,
s
.
deepCmp
=!
0
;
break
}
b
(
t
,
e
.
index
)}
a
.
push
(
R
(
t
,
e
))}
else
break
}
return
{
path
:
a
,
options
:
s
}},
X
=
function
(
t
,
e
){
for
(;
E
.
test
(
t
[
e
.
index
]);)
e
.
index
++
;
for
(
var
a
=
[
B
(
t
,
e
)],
s
=!
1
;
e
.
index
<
e
.
length
;){
var
f
=
t
[
e
.
index
];
E
.
test
(
f
)?
e
.
index
++
:
f
===
","
?(
s
=!
0
,
e
.
index
++
):
s
?(
s
=!
1
,
a
.
push
(
B
(
t
,
e
))):
b
(
t
,
e
.
index
)}
return
a
},
k
=
function
(
t
,
e
){
e
.
index
<
e
.
length
&&
b
(
t
,
e
.
index
)};
function
ee
(
t
){
var
e
=
{
length
:
t
.
length
,
index
:
0
},
a
=
X
(
t
,
e
);
return
k
(
t
,
e
),
a
}
var
te
=
function
(
t
,
e
){
var
a
=
t
;
return
e
.
forEach
(
function
(
s
){
a
=
typeof
a
!=
"object"
||
a
===
null
?
void
0
:
a
[
s
]}),
a
};
A
.
getDataOnPath
=
te
});
var
H
=
_
(
m
=>
{
"use strict"
;
Object
.
defineProperty
(
m
,
"__esModule"
,{
value
:
!
0
}),
m
.
create
=
re
,
m
.
unwrap
=
ne
;
var
z
=
function
(
t
,
e
,
a
){
if
(
typeof
t
!=
"object"
||
t
===
null
)
return
t
;
var
s
=
{
get
:
function
(
f
,
i
){
if
(
i
===
"__rawObject__"
)
return
t
;
var
r
=
a
.
concat
(
i
),
n
=
t
[
i
];
return
e
.
push
({
path
:
r
,
value
:
n
}),
z
(
n
,
e
,
r
)}};
return
new
Proxy
(
t
,
s
)};
function
re
(
t
,
e
){
return
z
(
t
,
e
,[])}
function
ne
(
t
){
return
typeof
t
!=
"object"
||
t
===
null
||
typeof
t
.
__rawObject__
!=
"object"
?
t
:
t
.
__rawObject__
}});
var
K
=
_
(
x
=>
{
"use strict"
;
Object
.
defineProperty
(
x
,
"__esModule"
,{
value
:
!
0
}),
x
.
behavior
=
void
0
;
var
$
,
ae
=
G
(
S
()),
ie
=
G
(
V
()),
w
=
U
(
q
()),
j
=
U
(
H
());
function
F
(
t
,
e
,
a
){
return
e
in
t
?
Object
.
defineProperty
(
t
,
e
,{
value
:
a
,
enumerable
:
!
0
,
configurable
:
!
0
,
writable
:
!
0
}):
t
[
e
]
=
a
,
t
}
function
G
(
t
){
return
t
&&
t
.
__esModule
?
t
:{
default
:
t
}}
function
U
(
t
){
if
(
t
&&
t
.
__esModule
)
return
t
;
var
e
=
{};
if
(
t
!=
null
){
for
(
var
a
in
t
)
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
t
,
a
)){
var
s
=
Object
.
defineProperty
&&
Object
.
getOwnPropertyDescriptor
?
Object
.
getOwnPropertyDescriptor
(
t
,
a
):{};
s
.
get
||
s
.
set
?
Object
.
defineProperty
(
e
,
a
,
s
):
e
[
a
]
=
t
[
a
]}}
return
e
.
default
=
t
,
e
}
var
T
=
ae
.
default
({
proto
:
!
0
}),
fe
=
0
,
oe
=
Behavior
({
lifetimes
:{
attached
:
function
(){
this
.
setData
({
_computedWatchInit
:
"attached"
})},
created
:
function
(){
this
.
setData
({
_computedWatchInit
:
"created"
})}},
definitionFilter
:
function
(
t
){
var
e
=
t
.
computed
,
a
=
t
.
watch
,
s
=
[],
f
=
fe
++
;
s
.
push
({
fields
:
"_computedWatchInit"
,
observer
:
function
(){
var
i
=
this
.
data
.
_computedWatchInit
;
if
(
i
===
"created"
){
var
r
=
{
computedUpdaters
:[],
computedRelatedPathValues
:{},
watchCurVal
:{}};
this
.
_computedWatchInfo
||
(
this
.
_computedWatchInfo
=
{}),
this
.
_computedWatchInfo
[
f
]
=
r
,
a
&&
Object
.
keys
(
a
).
forEach
(
function
(
u
){
var
o
=
w
.
parseMultiDataPaths
(
u
).
map
(
function
(
p
){
var
c
=
p
.
path
,
l
=
p
.
options
,
h
=
w
.
getDataOnPath
(
this
.
data
,
c
);
return
l
.
deepCmp
?
T
(
h
):
h
}.
bind
(
this
));
r
.
watchCurVal
[
u
]
=
o
}.
bind
(
this
))}
else
if
(
i
===
"attached"
){
var
n
=
this
.
_computedWatchInfo
[
f
];
e
&&
Object
.
keys
(
e
).
forEach
(
function
(
u
){
var
o
=
e
[
u
],
p
=
[],
c
=
o
(
j
.
create
(
this
.
data
,
p
)),
l
=
p
.
map
(
function
(
d
){
var
v
=
d
.
path
;
return
{
path
:
v
,
value
:
w
.
getDataOnPath
(
this
.
data
,
v
)}}.
bind
(
this
));
this
.
setData
(
F
({},
u
,
j
.
unwrap
(
c
))),
n
.
computedRelatedPathValues
[
u
]
=
l
;
var
h
=
function
(){
for
(
var
d
=
n
.
computedRelatedPathValues
[
u
],
v
=!
1
,
D
=
0
;
D
<
d
.
length
;
D
++
){
var
P
=
d
[
D
],
Y
=
P
.
path
;
if
(
P
.
value
!==
w
.
getDataOnPath
(
this
.
data
,
Y
)){
v
=!
0
;
break
}}
if
(
!
v
)
return
!
1
;
var
g
=
[],
J
=
o
(
j
.
create
(
this
.
data
,
g
));
return
this
.
setData
(
F
({},
u
,
j
.
unwrap
(
J
))),
n
.
computedRelatedPathValues
[
u
]
=
g
,
!
0
}.
bind
(
this
);
n
.
computedUpdaters
.
push
(
h
)}.
bind
(
this
))}}}),
e
&&
s
.
push
({
fields
:
"**"
,
observer
:
function
(){
if
(
this
.
_computedWatchInfo
){
var
i
,
r
=
this
.
_computedWatchInfo
[
f
];
if
(
r
)
do
i
=
r
.
computedUpdaters
.
some
(
function
(
n
){
return
n
.
call
(
this
)}.
bind
(
this
));
while
(
i
)}}}),
a
&&
Object
.
keys
(
a
).
forEach
(
function
(
i
){
var
r
=
w
.
parseMultiDataPaths
(
i
);
s
.
push
({
fields
:
i
,
observer
:
function
(){
if
(
this
.
_computedWatchInfo
){
var
n
=
this
.
_computedWatchInfo
[
f
];
if
(
n
){
var
u
=
n
.
watchCurVal
[
i
],
o
=
r
.
map
(
function
(
h
){
var
d
=
h
.
path
,
v
=
h
.
options
;
return
{
val
:
w
.
getDataOnPath
(
this
.
data
,
d
),
options
:
v
}}.
bind
(
this
)),
p
=
o
.
map
(
function
(
h
){
var
d
=
h
.
val
;
return
h
.
options
.
deepCmp
?
T
(
d
):
d
});
n
.
watchCurVal
[
i
]
=
p
;
for
(
var
c
=!
1
,
l
=
0
;
l
<
p
.
length
;
l
++
)
if
(
r
[
l
].
options
.
deepCmp
?
!
ie
.
default
(
u
[
l
],
p
[
l
]):
u
[
l
]
!==
p
[
l
]){
c
=!
0
;
break
}
c
&&
a
[
i
].
apply
(
this
,
o
.
map
(
function
(
h
){
return
h
.
val
}))}}}})}),
typeof
t
.
observers
!=
"object"
&&
(
t
.
observers
=
{}),
Array
.
isArray
(
t
.
observers
)?(
$
=
t
.
observers
).
push
.
apply
(
$
,
s
):
s
.
forEach
(
function
(
i
){
var
r
=
t
.
observers
[
i
.
fields
];
r
?
t
.
observers
[
i
.
fields
]
=
function
(){
i
.
observer
.
call
(
this
),
r
.
call
(
this
)}:
t
.
observers
[
i
.
fields
]
=
i
.
observer
})}});
x
.
behavior
=
oe
});
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,{
value
:
!
0
}),
Object
.
defineProperty
(
exports
,
"behavior"
,{
enumerable
:
!
0
,
get
:
function
(){
return
O
.
behavior
}}),
exports
.
ComponentWithComputed
=
se
,
exports
.
BehaviorWithComputed
=
ue
;
var
O
=
K
();
function
se
(
t
){
return
Array
.
isArray
(
t
.
behaviors
)
||
(
t
.
behaviors
=
[]),
t
.
behaviors
.
unshift
(
O
.
behavior
),
Component
(
t
)}
function
ue
(
t
){
return
Array
.
isArray
(
t
.
behaviors
)
||
(
t
.
behaviors
=
[]),
t
.
behaviors
.
unshift
(
O
.
behavior
),
Behavior
(
t
)}
utils/util.js
View file @
1f1dd64
...
...
@@ -447,6 +447,38 @@ const deepClone = (target) => {
return
clone
(
target
)
}
//设置标题
const
setNavigationBarTitle
=
(
title
)
=>
{
wx
.
getSystemInfo
({
success
:
(
res
)
=>
{
// console.log('++++++++++++++', res);
// console.log('title length',title.length)
let
width
=
res
.
safeArea
.
width
/
res
.
fontSizeSetting
;
// console.log('width: ', width);
let
space
=
''
;
// for (let i = 0; i <= width+4; i++) {
// space = space + ' ';
// }
width
=
width
-
(
title
.
length
)
/
2
for
(
let
i
=
0
;
i
<
width
;
i
++
)
{
space
=
space
+
' '
;
}
if
(
res
.
system
.
includes
(
'iOS'
)
===
false
)
{
wx
.
setNavigationBarTitle
({
title
:
space
+
title
});
}
else
{
wx
.
setNavigationBarTitle
({
title
:
title
});
}
}
});
}
/**
* 判断是否是空对象
* @param {*} obj 传进来的对象
...
...
@@ -507,6 +539,7 @@ const Util = {
decimal
,
timeago
,
deepClone
,
setNavigationBarTitle
,
isEmptyObj
,
parseString
,
}
...
...
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