zan-choose-dialog
Advanced tools
Comparing version 4.3.17 to 4.4.0-beta1
@@ -44,2 +44,6 @@ 'use strict'; | ||
var _includes = require('lodash/includes'); | ||
var _includes2 = _interopRequireDefault(_includes); | ||
var _zanPcAjax = require('zan-pc-ajax'); | ||
@@ -101,2 +105,6 @@ | ||
var _multiStore = require('./dialogs/multi-store'); | ||
var _multiStore2 = _interopRequireDefault(_multiStore); | ||
var _url = require('./url'); | ||
@@ -132,3 +140,5 @@ | ||
weappfeature: '小程序微页面', | ||
weapplink: '小程序路径' | ||
weapplink: '小程序路径', | ||
offlinelist: '网点列表', | ||
offlinepage: '某网点主页' | ||
}; | ||
@@ -151,2 +161,8 @@ | ||
Link: '自定义链接', | ||
// 只有多网点时才有效 | ||
OfflineList: '网点列表', | ||
OfflinePage: '某网点主页', | ||
// 小程序专用 | ||
WeappGoodsAndTag: '商品及分类', | ||
@@ -166,2 +182,4 @@ WeappFeature: '小程序微页面', | ||
UserCenter: '会员主页', | ||
OfflineList: '网点列表', | ||
OfflinePage: '某网点主页', | ||
PaidColumn: '知识专栏', | ||
@@ -179,5 +197,5 @@ PaidContent: '知识内容', | ||
var ITEM_LINK_TYPE = ['feature', 'category', 'goods', 'tag', 'guaguale', 'wheel', 'zodiac', 'crazyguess', 'survey', 'paidcolumn', 'paidcontent', 'weappfeature']; | ||
var ITEM_LINK_TYPE = ['feature', 'category', 'goods', 'tag', 'guaguale', 'wheel', 'zodiac', 'crazyguess', 'survey', 'paidcolumn', 'paidcontent', 'weappfeature', 'offlinepage']; | ||
var STATIC_LINK_TYPE = ['history', 'homepage', 'usercenter', 'mypaidcontent']; | ||
var STATIC_LINK_TYPE = ['history', 'homepage', 'usercenter', 'mypaidcontent', 'offlinelist']; | ||
var CUSTOM_LINK_TYPE = ['link']; | ||
@@ -194,2 +212,3 @@ var CUSTOM_WEAPP_LINK_TYPE = ['weapplink']; | ||
// 联系商家 type: contact | ||
// 网点列表 type: offlinelist | ||
function getStaticLinkUrl(type, config) { | ||
@@ -229,8 +248,13 @@ return new Promise(function (resolve, reject) { | ||
// 获取小程序微页面的url,需要保存但不可点击 | ||
// 小程序微页面 type: weappfeature | ||
function getLinkUrl(type, value) { | ||
function getLinkUrl(type, value, config) { | ||
// 获取小程序微页面的url,需要保存但不可点击 | ||
// 小程序微页面 type: weappfeature | ||
if (type === 'weappfeature') { | ||
return 'pages/home/feature/index?id=' + value.id; | ||
} | ||
if (type === 'offlinepage') { | ||
return (0, _url2['default'])('/showcase/homepage?alias=' + value.homepage_alias + '&oid=' + value.id, 'wap', config.url); | ||
} | ||
return value.url; | ||
@@ -246,4 +270,4 @@ } | ||
link_type: type, | ||
link_title: value.title || '', | ||
link_url: getLinkUrl(type, value) || '', | ||
link_title: value.title || value.name || '', | ||
link_url: getLinkUrl(type, value, config) || '', | ||
alias: value.alias || '' | ||
@@ -406,15 +430,29 @@ }); | ||
typeMap: 'weapplink' | ||
}), | ||
OfflineList: createMenuItemHandler({ | ||
typeMap: 'offlinelist' | ||
}), | ||
OfflinePage: createMenuItemHandler({ | ||
choose: _multiStore2['default'], | ||
typeMap: 'offlinepage' | ||
}) | ||
}; | ||
function filterMenuItems(itemKeys, isWeapp) { | ||
var allMenuItems = isWeapp ? defaultWeappMenuItems : AllMenuItems; | ||
function filterMenuItems(itemKeys, isMultiStore) { | ||
return itemKeys.reduce(function (items, key) { | ||
if ((0, _has2['default'])(allMenuItems, key)) { | ||
items.push({ | ||
title: allMenuItems[key], | ||
key: key | ||
}); | ||
if ((0, _has2['default'])(AllMenuItems, key)) { | ||
if (isMultiStore) { | ||
items.push({ | ||
title: AllMenuItems[key], | ||
key: key | ||
}); | ||
} else if (!(0, _includes2['default'])(['OfflineList', 'OfflinePage'], key)) { | ||
items.push({ | ||
title: AllMenuItems[key], | ||
key: key | ||
}); | ||
} | ||
} | ||
return items; | ||
@@ -471,3 +509,3 @@ }, []); | ||
_this.state = { | ||
items: filterMenuItems(allMenuItems, isWeapp) | ||
items: filterMenuItems(allMenuItems, props.isMultiStore) | ||
}; | ||
@@ -511,5 +549,5 @@ return _this; | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (!(0, _isEqual2['default'])(nextProps.menuItems, this.props.menuItems)) { | ||
if (!(0, _isEqual2['default'])(nextProps.menuItems, this.props.menuItems) || nextProps.isMultiStore !== this.props.isMultiStore) { | ||
this.setState({ | ||
items: filterMenuItems(nextProps.menuItems, this.props.isWeapp) | ||
items: filterMenuItems(nextProps.menuItems, nextProps.isMultiStore) | ||
}); | ||
@@ -539,2 +577,6 @@ } | ||
isWeapp: _propTypes2['default'].bool, | ||
// 多门店开启的时候有两个额外的菜单项 | ||
isMultiStore: _propTypes2['default'].bool, | ||
// choose-link-menu 是否有popover触发 | ||
@@ -546,2 +588,3 @@ hasPopoverTrigger: _propTypes2['default'].bool | ||
isWeapp: false, | ||
isMultiStore: false, | ||
hasPopoverTrigger: true | ||
@@ -548,0 +591,0 @@ }, _temp); |
{ | ||
"name": "zan-choose-dialog", | ||
"version": "4.3.17", | ||
"version": "4.4.0-beta1", | ||
"description": "这是一个React组件", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1180220
66
33105
2
23