京东标题技术
V:ads1994y
Q:485591720
|
2 d) w0 m$ s" U' i将检测标题入口开始转化为关闭$ g3 J L8 W9 F+ w
% h7 m8 B& |' L; U1 c8 v//敏感词入口关闭需求" a7 y9 r2 G2 V
initTitle: function() {
5 N/ Q a8 _1 {" v8 n# ] if($("#info-attr").closest(".J-con").find(".J-drag").find('.J-model-name')[0].innerText=="商品属性"){//商品属性
: P. B% s) [9 l$ }( t /* if(!globalAttr.isMedicine){
# M( B+ M: h4 L- i& e; z $("#info-attr").closest(".J-con").find(".J-drag").append('<p class="title-right">' +" B7 v. R% K7 w5 ^# [7 o
this.$t('user.widget_ware_attr.attrNotBusinessNeed')+
0 G) u+ d+ o) {( E& h2 f7 ^7 d '<a href="/rest/shop/wareAttriBackRest/toAttriPage/' + globalAttr.categoryId1 + '/' + globalAttr.categoryId2 + '/' + globalAttr.categoryId3 +
. ^: Q% ^$ x$ v- _; w/ ]. s/ {8 T '" target="_blank">'+this.$t('user.widget_ware_attr.clickFeedback')+'</a>' +- R$ Q- r6 J+ t0 P" A1 h; W
'</p>');; {) g: O9 G; @3 e) X& Y2 q
};*/% R( {* s7 f# H. Q0 m
$("#info-attr").closest(".J-con").find(".J-drag").append('<div style="float: right;margin-right: 222px"" class="tipEffect3" clstag="pageclick|keycount|newWare|43"><img src="/common/images/effect.png"/ class="eye"><span class="effect">'+this.$t('user.widget_ware_attr.showResults')+'</span></div>')/ S8 n+ v: Y4 S3 a5 S9 j1 }
}
# v5 }1 V0 K" C) F },$ ~0 i0 N( Q) i4 F/ ?) E
showImg: function(src){/ M. d" O# |5 z1 c& x8 [) ]
this.tipImg = src;
8 ]6 F% ~5 p2 ` },
; {5 N1 I# w) h' R; U loadCategoryAttrList: function () {
$ q" G0 o& F4 _5 l1 ~9 ^ var _this = this;
7 ?# _+ _3 D N! g. ~$ } shopLayer.lockWindow();
; n% _& ]0 r) O5 ^ var subData="";
( x+ Y/ K5 e$ k if(this.lastCategoryId){
9 l; T$ H$ ^/ v% M( }- G subData=this.lastCategoryId;8 f3 T) A7 ~& J# s2 I
}else{
3 Q# G/ s) z6 b subData=this.catId;3 M1 H7 W8 S/ o g/ M# p4 E
}
' b" ~1 ~4 B/ O- u. j/ \+ W% o6 } PublishApi.loadCategoryAttrList(subData, function (res) {' ]- ~! g& r: H6 d1 g
shopLayer.unlockWindow();
- U, Y- e. n- _# g* b& j8 n" B1 _% r if (res.status == 200) {
, ?$ \+ J$ q& b1 `3 v res.data.forEach(function (group) {% p) c; t& b9 }3 I+ |" K2 U
group.catAttrList.forEach(function (attr) {: z, T$ s8 s" }: w, W) j! g1 A
if(attr.inputType==2&&attr.attrValueList.length>5){% I) K/ A0 M8 r# M3 k- u
attr.attrValueList.forEach(function(item){
% y9 a; Y3 b# X% i item.actions = false;1 r% [( l9 f. u3 j, V D
})0 Y$ g' Z( \% C
}
' T* h6 n f( X, t8 T1 V2 v attr["choseName"]=false;
0 _8 }: y( \1 R) M' T attr["tipwarn"]="";: G m. t# a k# o/ R
attr["choseNum"]=[];
0 p7 C' Z* i9 N" [ //添加空数组存2 U( q1 u) R3 o/ N
if(attr.inputType==2){, T8 t, ]7 w1 H7 A! @
attr.checkedName=[];
/ y- y3 N G+ J7 @ attr.checked=false;1 H g5 f7 ]3 c/ W: x; E: B, Y
}
) U* ?' B/ b. X });
$ r- q& u+ y: O0 x) p) @4 [6 p+ s1 t& i })
7 W1 ]# _! L5 e$ i. d5 D" K var categoryGroupList = res.data;6 a: e, @/ C" v9 [% v
categoryGroupList.forEach(function (group) {
( Y- O. w! b# t: v1 v" c var titShow = false;
' V! O! l5 N# R1 [9 B6 t# l; ] group.catAttrList.forEach(function (attr) {5 t& f+ L8 f& }" B3 e8 [0 {0 t
attr.val = []; // 默认值
$ [# y) N6 b- ~$ N6 C$ u // 构造验证规则
1 b5 }' X* c6 e3 z/ x) M attr.rule = [{
$ O4 Q% K& Q2 D( x, K+ U1 h required: attr.required,
9 I7 W; U3 G, i& A2 \8 c message: _this.$t('user.widget_ware_attr.enterTheValue')
! R2 X/ ~. ?0 G' l. d& q, J }];: F+ {0 S- F3 C
' S, Q4 o" I; z5 w( }4 {
if(attr.featureMap && attr.featureMap.attrLevel === '1'){/ ^) ?6 j( [3 ?# {- c
attr.show = false;9 g1 j8 R3 [# O9 m! C
}else{
" Z! [: _8 H$ B1 _2 z( H attr.show = true;
' q. A$ m @4 ?( w4 ~ titShow = true;
3 O4 R4 I% Q" _$ h2 }2 C( Y( \2 P8 g }
7 q: h5 t6 b9 D; G3 v- M6 E+ K; a' E% `' k6 T# V
// 回显取值字段
2 H- E r1 y# T; X _this.attrType[attr.categoryAttributeId] = 0;
1 l9 h1 B, y1 F* K5 R" A9 b if(attr.inputType == 1 || attr.inputType == 2){# B! P* p& q6 r5 t- z3 B
_this.attrType[attr.categoryAttributeId] = 1;
# s' l7 ?1 h, L; J* q }
% O5 [8 c/ Z. D# a- n$ D
4 W! n/ J, n8 G0 A P5 l attr.errMsg = "";$ h, q. _, O0 B3 O0 q# \2 J
K- ?; R1 W* B# Q
if(!attr.features){
, J, s" z' g J8 D0 Y$ h# ~5 e return;
) o1 g/ z) {0 }0 A/ [; g } p* U* g7 W- p$ n; U% X
3 q% t; p9 h" c
if(attr.features.indexOf("xznum")>-1){
/ w' O3 |+ ] p. y0 T attr.rule.push({, Y* q1 r' \& K& J" }% t. p
pattern: /(^[1-9](\d+)?(\.\d{1,2})?$)|(^0\.[1-9])|(^0\.\d[1-9])/,# H' m2 h$ W6 ~
max: parseInt(attr.featureMap.xznum),
6 X* D- v; m+ Z, O message: _this.$t('user.widget_ware_attr.onlyNum')+ attr.featureMap.xznum, m( I$ Z7 s6 h4 U
});3 i3 d- D) s# X
} else if(attr.features.indexOf("xzns")>-1){0 @3 @+ U: m$ D/ w
attr.rule.push({
0 y/ i; _2 r/ |1 x pattern: /^[A-Za-z0-9]*$/,* l7 |7 k/ h1 |2 [, J7 H7 f
max: parseInt(attr.featureMap.xzns),
0 _& `2 b/ Y$ M' J6 ] message: _this.$t('user.widget_ware_attr.onlyCharactersAndNumbers')+ attr.featureMap.xzns
* S7 m! u* q, Y0 a [- a9 w; j; v });% }: a9 }7 P6 C* w6 ]8 k3 I* C
} else if(attr.features.indexOf("xzchi")>-1){
8 t' ^3 V5 U8 f5 D' [6 {! ^4 N attr.rule.push({! Z5 a5 @$ C* o2 D. A* Y* W
pattern: /^[\u4e00-\u9fa5]*$/,
6 b" s8 h2 Z1 G3 n max: parseInt(attr.featureMap.xzchi),
& `* ] @: ~/ q0 S message: _this.$t('user.widget_ware_attr.onlyChinese')+ attr.featureMap.xzchi0 S/ F3 |3 @# _
});0 x5 b) {! G$ X# t- u1 R" F9 q
} else if(attr.features.indexOf("xzstr")>-1){2 Z% H& v" W' T* v T( {$ I
attr.rule.push({! V* _9 X% f- [( a5 I
max: parseInt(attr.featureMap.xzstr),
8 W: U5 \0 z8 ^9 S+ v$ c% a message: _this.$t('user.widget_ware_attr.overLength') + attr.featureMap.xzstr
1 M% ^8 W) Z: E/ |/ t; O6 T& u });* q6 m4 r( A' n# E
}
, k% O8 c6 C; t2 \% L$ b1 l; J });
6 c& `+ I8 i# m+ C" a group.titShow = titShow;' D# K" g% O7 I% e
});
D _! S x5 n: Y) ]1 ?+ }
% M) n, Y' e3 Z
1 M; j P6 D5 d" P# R1 R) b5 p& _9 u* ?9 }+ T
//构造响应函数
0 c7 M1 V3 Y n; _
# m; ?# P, u) ] (function () {
+ z# E- p7 f, G5 X4 k Y, X4 z
& p* o3 t$ K) q( Y& I1 z) z) o // 获取 wangEditor 构造函数和 jquery9 i0 c1 Y6 M' R1 f( W
var E = window.wangEditor;/ w3 V: a' {- p2 R% L
var jQuery = window.jQuery;
9 v& H9 h3 C9 z* ^ [$ o1 ]3 ` //wangEditor编辑器实现多语言% t0 }. H+ o3 j. L# I- K
if (i18nUtil.getCurrentLocale()&&E.langs[i18nUtil.getCurrentLocale()]) {
+ F! X3 P ~! {/ l. C$ b E.config.lang = E.langs[i18nUtil.getCurrentLocale()];
4 r# m) V1 d% h/ p8 b3 i5 H' A }
, I0 |9 ]4 g/ t Z // 用 createMenu 方法创建菜单$ V) `4 S0 [7 N
E.createMenu(function (check) {
* i) ^& U# @. x$ R& T& I( [2 e; J9 `, ^. V
// 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看
& o d Y1 I" f, l: e4 `$ ^3 J: h var menuId = 'hanyi';
& W$ Y8 m. }$ `& P8 ^& g
3 H& _" I {6 f+ E" I // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。- o6 a8 K4 Z1 j
if (!check(menuId)) {
" u- O( b& C0 ~; l return;
2 k# |% e4 [, q h. S6 W }
3 f' m; V& [- Y+ S/ c5 ~
+ l+ D5 P9 a# x# V1 E( x // this 指向 editor 对象自身; O+ @9 P! O! I0 ^8 B4 f
var editor = this;
* X l* n% A5 B: c/ D2 X5 M. T1 F
* P7 \3 m( Z, A+ T // 创建 menu 对象5 r5 X. s, O$ j ]
var menu = new E.Menu({+ w( s2 B! q& Z* [
editor: editor, // 编辑器对象
1 R. Y* A9 d) h! ]$ i2 Y. h/ t id: menuId, // 菜单id
2 M. s+ b/ m. C5 l title: E.config.lang.hanYiCharacter, // 菜单标题
' C/ C: x! ^: l6 } e! D+ g commandName: 'fontName', // 命令名称
! Y6 X2 `2 w$ u# `9 ~
& ]! Y7 M u( Z- A5 |7 g9 I // 正常状态和选中装下的dom对象,样式需要自定义, l4 ^: ?/ r# {
$domNormal: jQuery('<a href="#" tabindex="-1"><i class="wangeditor-menu-img-font2"></i></a>'),+ l! W4 B" R1 l2 f# C! x; k
$domSelected: jQuery('<a href="#" tabindex="-1" class="selected"><i class="wangeditor-menu-img-font2"></i></a>')
* z# R: C$ _3 o d& x& [ });
, a3 N9 ^: `0 K; u* e. m' {
& @1 S; k& ]& h. Y& @/ K // 定义 update selected 事件$ v+ R3 k K/ S8 p/ G6 \
menu.updateSelectedEvent = function () { {0 Y3 k% k7 ~5 n9 O+ S. X O
var rangeElem = editor.getRangeElem();
2 M [8 [+ v( B3 J" ` rangeElem = editor.getSelfOrParentByName(rangeElem, 'font[face]');
& M2 X: f( ]* s' `8 V: E5 A+ `& N if (rangeElem) {
% v8 n; e1 n v& H" Z8 A+ H return true;
0 ]5 J- f% K$ J5 r% i+ }! P' E }
, ]& J; p' j' W9 |7 l3 B return false;
6 w, A* S" N$ q( o% ]6 o7 @) M };1 N: S5 [( |' G/ `
O' q$ o+ v& x
2 {1 X9 E" j* k( ~. w5 O1 P- J9 D7 R* S/ {% R
8 p" N2 i% v/ D9 E' h
) [. _# Z) ?$ K( s7 [
' J& u/ }0 H" G2 M
6 V' Q+ o. H( b9 Q0 P |
评分
-
查看全部评分
|