Commit a6ac5827 by 严立

Merge branch 'master' of http://120.77.182.185/yanl/mini-shimao

# Conflicts:
#	app.js
#	pages/mine/home/home.js
#	pages/mine/home/home.wxml
#	pages/play/service-detail/service-detail.wxml
#	pages/play/service-detail/service-detail.wxss

Signed-off-by: 严立 <yanl@xmmakeit.com>
parent b8006dfd
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</block> </block>
</swiper> </swiper>
<view class="all_activity_nothing"> <view class="all_activity_nothing" wx:if="{{childActivity.length === 0}}">
<image src="{{resourcesBase + 'campsite/all-activities-nothing.png'}}"></image> <image src="{{resourcesBase + 'campsite/all-activities-nothing.png'}}"></image>
</view> </view>
</view> </view>
......
...@@ -182,6 +182,7 @@ ...@@ -182,6 +182,7 @@
.swiper { .swiper {
width: 750rpx; width: 750rpx;
height: 1160rpx; height: 1160rpx;
padding: 40rpx 0 0 0;
background-color: #FCF8F0; background-color: #FCF8F0;
} }
......
...@@ -46,21 +46,21 @@ ...@@ -46,21 +46,21 @@
<!-- 活动价 - 暂无 --> <!-- 活动价 - 暂无 -->
<block wx:if="{{item.priceType === 1}}"> <block wx:if="{{item.priceType === 1}}">
<text class="discount-mark">活动价</text> <text class="discount-mark">活动价</text>
<text>{{'¥ ' + item.priceDiscountText}}</text> <text>{{item.priceDiscountText === '0.00' ? '免费' : '¥ ' + item.priceDiscountText}}</text>
<text>{{' + item.priceText}}</text> <text>{{item.priceText === '0.00' ? '免费' : '¥' + item.priceText}}</text>
</block> </block>
<!-- 业主价 --> <!-- 业主价 -->
<block wx:if="{{item.priceType === 2}}"> <block wx:if="{{item.priceType === 2}}">
<text class="owner-mark">业主价</text> <text class="owner-mark">业主价</text>
<text>{{'¥' + item.priceSpecialText}}</text> <text>{{item.priceSpecialText === '0.00' ? '免费' : '¥' + item.priceSpecialText}}</text>
<text>{{'¥' + item.priceText}}</text> <text>{{item.priceText === '0.00' ? '免费' : '¥' + item.priceText}}</text>
</block> </block>
<!-- 普通价 --> <!-- 普通价 -->
<block wx:if="{{item.priceType === 3}}"> <block wx:if="{{item.priceType === 3}}">
<text></text> <text></text>
<text>{{item.priceText}}</text> <text>{{item.priceText === '0.00' ? '免费' : '¥' + item.priceText}}</text>
<text></text> <text></text>
</block> </block>
</view> </view>
......
...@@ -35,65 +35,35 @@ Page({ ...@@ -35,65 +35,35 @@ Page({
userInfo: wx.getStorageSync('userInfo'), userInfo: wx.getStorageSync('userInfo'),
cssGreeting: wx.getStorageSync('navStatusHeight') + wx.getStorageSync('navTitleHeight') + 20 * wx.getStorageSync('unitProportion'), cssGreeting: wx.getStorageSync('navStatusHeight') + wx.getStorageSync('navTitleHeight') + 20 * wx.getStorageSync('unitProportion'),
}) })
this.setGreetingMessage() this.setDefaultGreetingMessage()
this.queryFestivalGreeting()
this.queryShopCover() this.queryShopCover()
this.queryRecommend() this.queryRecommend()
this.queryIntegralMallGoods() this.queryIntegralMallGoods()
}, },
queryShopCover: function () {
function shopCover(funcType, funcIndex) {
App.wxRequest({
url: 'v1/banner/getOfficeByBanner',
data: {
'smColumnId': funcType,
},
success: (response) => {
let funcResponse = response.data
let funcBanner = This.data.banner
if (funcResponse.length) {
funcBanner[funcIndex] = funcResponse[0].img
} else {
funcBanner[funcIndex] = ''
}
This.setData({
banner: funcBanner
})
}
})
}
let This = this
// 0 首页,1 所有服务,2 儿童营地,3 海错图,4 元养水韵,5 儿童营地接待,6 拾光花坊, 7 商品
let funcShopList = [2, 3, 4, 5, 6]
for (let i = 0, l = funcShopList.length; i < l; i++) {
shopCover(funcShopList[i], i)
}
},
/** /**
* 问候消息 * 问候消息
* @function * @function
* @param {object} - funcEvent * @param {object} - funcEvent
* @returns * @returns
*/ */
setGreetingMessage: function () { setDefaultGreetingMessage: function () {
let funcHour = Number(App.modular.miment().format('hh')) let funcHour = Number(App.modular.miment().format('hh'))
let funcMinute = Number(App.modular.miment().format('mm')) let funcMinute = Number(App.modular.miment().format('mm'))
let funcTime = [{ let funcTime = [{
'min': 0, 'min': 0,
'max': 12, 'max': 12,
'message': '上午好!' 'message': '上午好!'
}, { }, {
'min': 12, 'min': 12,
'max': 18, 'max': 18,
'message': '下午好!' 'message': '下午好!'
}, { }, {
'min': 18, 'min': 18,
'max': 24, 'max': 24,
'message': '晚上好!' 'message': '晚上好!'
}] }]
let funcIndex = 0 let funcIndex = 0
...@@ -110,14 +80,87 @@ Page({ ...@@ -110,14 +80,87 @@ Page({
} }
} }
let funcGreetingName = this.data.userInfo.name let funcUserName = this.data.userInfo.name ? this.data.userInfo.name : 'Hello'
if (funcGreetingName.length > 5) funcGreetingName = funcGreetingName.substring(0, 5) + '...' let funcGreetingMessage = funcTime[funcIndex].message
if (funcGreetingName === '') funcGreetingName = 'Hello'
let funcUserNameChar = App.modular.utils.countStringChar(funcUserName)
let funcGreetingMessageChar = App.modular.utils.countStringChar(funcGreetingMessage)
let funcUserNameSubstring = funcUserName
let funcUserNameSubstringChar = funcUserNameChar
if (funcUserNameChar + funcGreetingMessageChar > 60 && funcGreetingMessageChar < 40) {
while (funcUserNameSubstringChar + funcGreetingMessageChar > 60) {
funcUserNameSubstring = funcUserNameSubstring.substring(0, funcUserNameSubstring.length - 1)
funcUserNameSubstringChar = App.modular.utils.countStringChar(funcUserNameSubstring) + 3
}
funcUserNameSubstring = funcUserNameSubstring + '...'
}
this.setData({
greetingName: funcUserNameSubstring,
greetingMessage: funcGreetingMessage
})
},
queryFestivalGreeting: function () {
App.request({
url: 'v1/common/getGreet',
}).then((response) => {
let funcData = response.data
let funcDateNow = App.modular.miment().stamp()
if (funcData.startTime < funcDateNow && funcDateNow < funcData.endTime) {
let funcUserName = this.data.userInfo.name ? this.data.userInfo.name : 'Hello'
let funcGreetingMessage = ',' + funcData.content
let funcUserNameChar = App.modular.utils.countStringChar(funcUserName)
let funcGreetingMessageChar = App.modular.utils.countStringChar(funcGreetingMessage)
let funcUserNameSubstring = funcUserName
let funcUserNameSubstringChar = funcUserNameChar
if (funcUserNameChar + funcGreetingMessageChar > 60 && funcGreetingMessageChar < 40) {
while (funcUserNameSubstringChar + funcGreetingMessageChar > 60) {
funcUserNameSubstring = funcUserNameSubstring.substring(0, funcUserNameSubstring.length - 1)
funcUserNameSubstringChar = App.modular.utils.countStringChar(funcUserNameSubstring) + 3
}
funcUserNameSubstring = funcUserNameSubstring + '...'
}
this.setData({ this.setData({
greetingName: funcGreetingName, greetingName: funcUserNameSubstring,
greetingMessage: funcTime[funcIndex].message greetingMessage: funcGreetingMessage
})
}
})
},
queryShopCover: function () {
function shopCover(funcType, funcIndex) {
App.request({
url: 'v1/banner/getOfficeByBanner',
params: {
'smColumnId': funcType,
}
}).then((response) => {
let funcResponse = response.data
let funcBanner = This.data.banner
if (funcResponse.length) {
funcBanner[funcIndex] = funcResponse[0].img
} else {
funcBanner[funcIndex] = ''
}
This.setData({
banner: funcBanner
}) })
})
}
let This = this
// 0 首页,1 所有服务,2 儿童营地,3 海错图,4 元养水韵,5 儿童营地接待,6 拾光花坊, 7 商品
let funcShopList = [2, 3, 4, 5, 6]
for (let i = 0, l = funcShopList.length; i < l; i++) {
shopCover(funcShopList[i], i)
}
}, },
/** /**
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<block wx:if="{{!appStatus}}"> <block wx:if="{{!appStatus}}">
<!-- 问候订制 --> <!-- 问候订制 -->
<view class="greeting" style="{{'padding-bottom: 0; padding-top:' + cssGreeting + 'px;'}}"> <view class="greeting" style="{{'padding-bottom: 0; padding-top:' + cssGreeting + 'px;'}}">
<text>{{greetingName + ',' + greetingMessage}}</text> <text>{{greetingName + greetingMessage}}</text>
</view> </view>
</block> </block>
<block wx:if="{{appStatus}}"> <block wx:if="{{appStatus}}">
<!-- 问候订制 --> <!-- 问候订制 -->
<view class="greeting" style="{{'padding-top:' + cssGreeting + 'px;'}}"> <view class="greeting" style="{{'padding-top:' + cssGreeting + 'px;'}}">
<text>{{greetingName + ',' + greetingMessage}}</text> <text>{{greetingName + greetingMessage}}</text>
</view> </view>
<!-- 商店 --> <!-- 商店 -->
......
...@@ -398,6 +398,7 @@ Page({ ...@@ -398,6 +398,7 @@ Page({
* @returns * @returns
*/ */
setEntryTime: function (funcEntryId) { setEntryTime: function (funcEntryId) {
console.log(funcEntryId)
let funcItem = wx.getStorageSync('shoppingCartBuffer')[0] let funcItem = wx.getStorageSync('shoppingCartBuffer')[0]
App.request({ App.request({
url: 'v1/activity/getEnrollView', url: 'v1/activity/getEnrollView',
...@@ -480,6 +481,8 @@ Page({ ...@@ -480,6 +481,8 @@ Page({
let funcTimeBegin = '' let funcTimeBegin = ''
let funcTimeEnd = '' let funcTimeEnd = ''
console.log('funcTimetable')
console.log(funcTimetable)
for (let i = 0, l = funcTimetable.length; i < l; i++) { for (let i = 0, l = funcTimetable.length; i < l; i++) {
if (funcEntryId === funcTimetable[i].id) { if (funcEntryId === funcTimetable[i].id) {
funcDateBegin = App.modular.miment(funcTimetable[i].beginTime).format('MM月DD日') funcDateBegin = App.modular.miment(funcTimetable[i].beginTime).format('MM月DD日')
...@@ -487,7 +490,7 @@ Page({ ...@@ -487,7 +490,7 @@ Page({
funcTimeEnd = App.modular.miment(funcTimetable[i].endTime).format('hh:mm') funcTimeEnd = App.modular.miment(funcTimetable[i].endTime).format('hh:mm')
this.setData({ this.setData({
quantityTipNumber: funcDate[0][i].residue, quantityTipNumber: funcTimetable[i].residue,
buyContentTime: funcDateBegin + ' ' + funcTimeBegin + ' - ' + funcTimeEnd buyContentTime: funcDateBegin + ' ' + funcTimeBegin + ' - ' + funcTimeEnd
}) })
break break
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
top: 0 !important; top: 0 !important;
left: 0 !important; left: 0 !important;
width: 750rpx; width: 750rpx;
height: 800rpx; height: 792rpx;
} }
.banner-swiper-point { .banner-swiper-point {
......
...@@ -63,9 +63,8 @@ Page({ ...@@ -63,9 +63,8 @@ Page({
'cover': funcData[i].cover, 'cover': funcData[i].cover,
'banner': funcData[i].playImg, 'banner': funcData[i].playImg,
'describe': funcData[i].summary, 'describe': funcData[i].summary,
'timeDateMM': [funcData[i].activeDate.match(/[0-9]+/g)[0], funcData[i].activeDate.match(/[0-9]+/g)[2]], 'timeDate': funcData[i].activeDate,
'timeDateDD': [funcData[i].activeDate.match(/[0-9]+/g)[1], funcData[i].activeDate.match(/[0-9]+/g)[3]], 'timePeriod': funcData[i].activeTime,
'timePeriod': funcData[i].activeTime.replace(/-/, ' - '),
'ownerPrice': funcData[i].ownerPrice, 'ownerPrice': funcData[i].ownerPrice,
'visitorPrice': funcData[i].visitorPrice, 'visitorPrice': funcData[i].visitorPrice,
'tagId': funcData[i].tagIds, 'tagId': funcData[i].tagIds,
...@@ -300,9 +299,8 @@ Page({ ...@@ -300,9 +299,8 @@ Page({
}, },
onReachBottom: function () { onReachBottom: function () {
console.log('onReachBottom')
this.setData({ this.setData({
pageNo: this.data.pageNo + 1 touristRoutePageNo: this.data.touristRoutePageNo + 1
}) })
this.routeList() this.routeList()
......
...@@ -25,24 +25,15 @@ ...@@ -25,24 +25,15 @@
<view class="recent_activities_list row" wx:if="{{recentActivitiesList.length > 0}}" bindchange="swiperRecentChange"> <view class="recent_activities_list row" wx:if="{{recentActivitiesList.length > 0}}" bindchange="swiperRecentChange">
<block wx:for="{{recentActivitiesList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{recentActivitiesList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="recent_activities_item" data-item="{{item}}" bindtap="onActivityDetail"> <view class="recent_activities_item" data-item="{{item}}" bindtap="onActivityDetail">
<view class="recent_activities_item_wrap column"> <view class="recent_activities_item_wrap">
<view class="recent_activities_item_date row ac"> <image class="recent_activities_item_cover" mode="aspectFill" src="{{item.banner}}"></image>
<text class="font_normal_42 color_regular">{{item.timeDateMM[0]}}</text>
<text class="font_normal_50 color_regular">/</text>
<text class="font_normal_42 color_regular">{{item.timeDateDD[0]}}</text>
</view>
<view class="recent_activities_item_date row ac">
<text class="font_normal_42 color_regular">{{item.timeDateMM[1]}}</text>
<text class="font_normal_50 color_regular">/</text>
<text class="font_normal_42 color_regular">{{item.timeDateDD[1]}}</text>
</view>
<view class="recent_activities_item_line"></view>
<text class="recent_activities_item_time font_bold_30 color_regular">{{item.timePeriod}}</text>
<view class="recent_activities_item_name row ac"> <view class="recent_activities_item_name row ac">
<text class="font_bold_54 color_regular overflow_point_2">{{item.name}}</text> <text class="font_bold_54 color_regular overflow_point_2">{{item.name}}</text>
</view> </view>
<view class="recent_activities_item_date row ac">
<text class="recent_activities_item_time font_normal_30 color_cancel">{{item.timeDate + item.timePeriod}}</text>
</view>
</view> </view>
<image class="recent_activities_item_cover" mode="aspectFill" src="{{item.banner}}"></image>
</view> </view>
</block> </block>
<view class="recent_activities_item"></view> <view class="recent_activities_item"></view>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
/* 近期活动 */ /* 近期活动 */
.recent_activities_list { .recent_activities_list {
width: 750rpx; width: 750rpx;
margin: 80rpx 0 0 0; margin: 90rpx 0 0 0;
padding: 0 0 0 40rpx; padding: 0 0 0 40rpx;
overflow-x: scroll; overflow-x: scroll;
} }
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
.recent_activities_item { .recent_activities_item {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 648rpx; width: 650rpx;
height: 720rpx; min-height: 720rpx;
margin: 0 24rpx 0 0; margin: 0 24rpx 0 0;
padding: 48rpx 0 0 0; padding: 48rpx 0 0 0;
} }
...@@ -96,37 +96,28 @@ ...@@ -96,37 +96,28 @@
} }
.recent_activities_item_wrap { .recent_activities_item_wrap {
width: 648rpx; width: 650rpx;
height: 672rpx; min-height: 672rpx;
padding: 50rpx 0 0 50rpx; padding: 0 40rpx;
border-radius: 2px; border-radius: 2px;
background: #EEF3F9; background: #EEF3F9;
} }
.recent_activities_item_date { .recent_activities_item_cover {
margin: 0 0 12rpx 0; position: relative;
} top: -48rpx;
left: 0;
.recent_activities_item_line { width: 568rpx;
width: 1px; height: 464rpx;
height: 128rpx; border-radius: 2px;
margin: 8rpx 0 22rpx 10rpx;
background: #000000;
} }
.recent_activities_item_name { .recent_activities_item_name {
width: 560rpx; margin: -6rpx 0 0 0;
height: 168rpx;
margin: 60rpx 0 0 0;
} }
.recent_activities_item_cover { .recent_activities_item_date {
position: absolute; margin: 30rpx 0 0 0;
top: 0;
left: 260rpx;
width: 340rpx;
height: 464rpx;
border-radius: 2px;
} }
.item-nothing { .item-nothing {
......
...@@ -32,7 +32,7 @@ Page({ ...@@ -32,7 +32,7 @@ Page({
isBlack: false, isBlack: false,
cssTabContentTop: wx.getStorageSync('navHeight'), cssTabContentTop: 0,
sideHeight: 550, sideHeight: 550,
winSide: true, winSide: true,
...@@ -60,13 +60,24 @@ Page({ ...@@ -60,13 +60,24 @@ Page({
}, },
onLoad: function(options) { onLoad: function(options) {
console.log(options)
this.setData({ this.setData({
option: options, option: options,
cssTabContentTop: wx.getStorageSync('navHeight'),
}) })
this.setActivityTypeTag() this.setActivityTypeTag()
},
onShow: function() {
this.setData({
appStatus: App.globalData.appStatus
})
},
setViewContent: function () {
// 根据商店查询相关订制内容 // 根据商店查询相关订制内容
switch (Number(options.id)) { switch (Number(this.data.option.id)) {
case 1: case 1:
this.queryCommodity() this.queryCommodity()
this.queryActivity() this.queryActivity()
...@@ -129,12 +140,6 @@ Page({ ...@@ -129,12 +140,6 @@ Page({
} }
}, },
onShow: function() {
this.setData({
appStatus: App.globalData.appStatus
})
},
/** /**
* 设置电影类型标签 * 设置电影类型标签
* @function * @function
...@@ -159,7 +164,7 @@ Page({ ...@@ -159,7 +164,7 @@ Page({
this.setData({ this.setData({
activityTypeTag: funcList, activityTypeTag: funcList,
}) })
this.queryDetail(Number(this.data.options.id)) this.queryDetail(Number(this.data.option.id))
}) })
}, },
...@@ -327,7 +332,6 @@ Page({ ...@@ -327,7 +332,6 @@ Page({
App.request({ App.request({
url: 'v1/park/getList', url: 'v1/park/getList',
}).then((response) => { }).then((response) => {
console.log(response)
let funcData = response.data let funcData = response.data
funcDetail.forEach(shop => { funcDetail.forEach(shop => {
funcData.forEach(item => { funcData.forEach(item => {
...@@ -377,6 +381,7 @@ Page({ ...@@ -377,6 +381,7 @@ Page({
this.setData({ this.setData({
shopInfo: funcItem shopInfo: funcItem
}) })
this.setViewContent()
break break
} }
} }
...@@ -389,6 +394,8 @@ Page({ ...@@ -389,6 +394,8 @@ Page({
* @returns * @returns
*/ */
queryActivity: function() { queryActivity: function() {
console.log('this.data.shopInfo.id')
console.log(this.data.shopInfo.id)
App.wxRequest({ App.wxRequest({
url: 'v1/activity/getList', url: 'v1/activity/getList',
data: { data: {
...@@ -411,11 +418,12 @@ Page({ ...@@ -411,11 +418,12 @@ Page({
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式 'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价 'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式 'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'tagIds': funcResponse[i].tagIds, 'tagIds': funcResponse[i].tagIds.split(','),
'tagNames': this.ignoreActivityTypeTag([]), 'tagNames': [],
'date': funcResponse[i].activeDate + ' ' + funcResponse[i].activeTime, // 活动时间 'date': funcResponse[i].activeDate + ' ' + funcResponse[i].activeTime, // 活动时间
'priceType': 1, 'priceType': 1,
} }
funcItem.tagNames = this.insertActivityTypeTag(funcItem.tagIds)
let funcUserType = wx.getStorageSync('userInfo').userType let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型 // 根据后台判断价格显示类型
...@@ -437,8 +445,6 @@ Page({ ...@@ -437,8 +445,6 @@ Page({
winActivity: true, winActivity: true,
detailActivity: funcList detailActivity: funcList
}) })
console.log(JSON.stringify(this.data.detailActivity))
} }
}) })
}, },
...@@ -956,16 +962,16 @@ Page({ ...@@ -956,16 +962,16 @@ Page({
}, },
/** /**
* 过滤活动标签 * 插入活动标签
* @function * @function
* @param {array} - funcIgnoreTag * @param {array} - funcIgnoreTag
* @returns * @returns
*/ */
ignoreActivityTypeTag: function (funcIgnoreTag) { insertActivityTypeTag: function (funcInsertTag) {
let funcRemainTag = [] let funcRemainTag = []
let funcActivityTypeTag = this.data.activityTypeTag let funcActivityTypeTag = this.data.activityTypeTag
for (let i = 0, l = funcActivityTypeTag.length; i < l; i++) { for (let i = 0, l = funcActivityTypeTag.length; i < l; i++) {
if (!funcIgnoreTag.includes(funcActivityTypeTag[i].value)) funcRemainTag.push(funcActivityTypeTag[i].text) if (funcInsertTag.includes(funcActivityTypeTag[i].value)) funcRemainTag.push(funcActivityTypeTag[i].text)
} }
return funcRemainTag return funcRemainTag
}, },
......
...@@ -319,6 +319,7 @@ ...@@ -319,6 +319,7 @@
} }
.commodity-card-item-title text:nth-child(1) { .commodity-card-item-title text:nth-child(1) {
flex-grow: 1;
font-size: 30rpx; font-size: 30rpx;
font-weight: 400; font-weight: 400;
line-height: 44rpx; line-height: 44rpx;
...@@ -328,16 +329,6 @@ ...@@ -328,16 +329,6 @@
white-space: nowrap; white-space: nowrap;
} }
.movie-card-item-title text:nth-child(1) {
font-size: 26rpx;
font-weight: 400;
line-height: 37rpx;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.commodity-card-item-title text:nth-child(2) { .commodity-card-item-title text:nth-child(2) {
width: 96rpx; width: 96rpx;
height: 32rpx; height: 32rpx;
...@@ -351,6 +342,16 @@ ...@@ -351,6 +342,16 @@
color: #86c5e1; color: #86c5e1;
} }
.movie-card-item-title text:nth-child(1) {
font-size: 26rpx;
font-weight: 400;
line-height: 37rpx;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.commodity-card-item-date { .commodity-card-item-date {
width: 498rpx; width: 498rpx;
height: 40rpx; height: 40rpx;
......
...@@ -42,6 +42,22 @@ let output = { ...@@ -42,6 +42,22 @@ let output = {
} }
}, },
countStringChar: function (funcCountString) {
let funcCountDoubleByte = funcCountString.match(/[\uff00-\uffff]/ig)
let funcCountSingleByte = funcCountString.match(/[\u0000-\u00ff]/ig)
let funcCountChinese = funcCountString.match(/[\u4e00-\u9fa5]/ig)
let funcCountEmoji = funcCountString.match(/[\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]|\uD83D[\uDE80-\uDEFF]|[\u2700-\u27BF]\uFE0F]/ig)
if (funcCountDoubleByte === null) funcCountDoubleByte = []
if (funcCountSingleByte === null) funcCountSingleByte = []
if (funcCountChinese === null) funcCountChinese = []
if (funcCountEmoji === null) funcCountEmoji = []
let funcCountStringChar = funcCountDoubleByte.length * 2 + funcCountSingleByte.length * 1 + funcCountChinese.length * 2 + funcCountEmoji.length * 1
console.log(funcCountStringChar)
return funcCountStringChar
},
} }
export default output export default output
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment