Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
854bacf6
Commit
854bacf6
authored
Aug 25, 2018
by
Menethil
Browse files
添加Renard小程序
parent
a50998e6
Changes
222
Expand all
Hide whitespace changes
Inline
Side-by-side
renard-wx/images/tabbar/user-o.png
0 → 100644
View file @
854bacf6
6.92 KB
renard-wx/lib/wxParse/html2json.js
0 → 100644
View file @
854bacf6
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
var
__placeImgeUrlHttps
=
"
https
"
;
var
__emojisReg
=
''
;
var
__emojisBaseSrc
=
''
;
var
__emojis
=
{};
var
wxDiscode
=
require
(
'
wxDiscode.js
'
);
var
HTMLParser
=
require
(
'
htmlparser.js
'
);
// Empty Elements - HTML 5
var
empty
=
makeMap
(
"
area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr
"
);
// Block Elements - HTML 5
var
block
=
makeMap
(
"
br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video
"
);
// Inline Elements - HTML 5
var
inline
=
makeMap
(
"
abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
"
);
// Elements that you can, intentionally, leave open
// (and which close themselves)
var
closeSelf
=
makeMap
(
"
colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr
"
);
// Attributes that have their values filled in disabled="disabled"
var
fillAttrs
=
makeMap
(
"
checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected
"
);
// Special Elements (can contain anything)
var
special
=
makeMap
(
"
wxxxcode-style,script,style,view,scroll-view,block
"
);
function
makeMap
(
str
)
{
var
obj
=
{},
items
=
str
.
split
(
"
,
"
);
for
(
var
i
=
0
;
i
<
items
.
length
;
i
++
)
obj
[
items
[
i
]]
=
true
;
return
obj
;
}
function
q
(
v
)
{
return
'
"
'
+
v
+
'
"
'
;
}
function
removeDOCTYPE
(
html
)
{
return
html
.
replace
(
/<
\?
xml.*
\?
>
\n
/
,
''
)
.
replace
(
/<!doctype.*
\>\n
/
,
''
)
.
replace
(
/<!DOCTYPE.*
\>\n
/
,
''
);
}
function
html2json
(
html
,
bindName
)
{
//处理字符串
html
=
removeDOCTYPE
(
html
);
html
=
wxDiscode
.
strDiscode
(
html
);
//生成node节点
var
bufArray
=
[];
var
results
=
{
node
:
bindName
,
nodes
:
[],
images
:[],
imageUrls
:[]
};
HTMLParser
(
html
,
{
start
:
function
(
tag
,
attrs
,
unary
)
{
//debug(tag, attrs, unary);
// node for this element
var
node
=
{
node
:
'
element
'
,
tag
:
tag
,
};
if
(
block
[
tag
])
{
node
.
tagType
=
"
block
"
;
}
else
if
(
inline
[
tag
])
{
node
.
tagType
=
"
inline
"
;
}
else
if
(
closeSelf
[
tag
])
{
node
.
tagType
=
"
closeSelf
"
;
}
if
(
attrs
.
length
!==
0
)
{
node
.
attr
=
attrs
.
reduce
(
function
(
pre
,
attr
)
{
var
name
=
attr
.
name
;
var
value
=
attr
.
value
;
if
(
name
==
'
class
'
)
{
// console.dir(value);
// value = value.join("")
node
.
classStr
=
value
;
}
// has multi attibutes
// make it array of attribute
if
(
name
==
'
style
'
)
{
// console.dir(value);
// value = value.join("")
node
.
styleStr
=
value
;
}
if
(
value
.
match
(
/ /
))
{
value
=
value
.
split
(
'
'
);
}
// if attr already exists
// merge it
if
(
pre
[
name
])
{
if
(
Array
.
isArray
(
pre
[
name
]))
{
// already array, push to last
pre
[
name
].
push
(
value
);
}
else
{
// single value, make it array
pre
[
name
]
=
[
pre
[
name
],
value
];
}
}
else
{
// not exist, put it
pre
[
name
]
=
value
;
}
return
pre
;
},
{});
}
//对img添加额外数据
if
(
node
.
tag
===
'
img
'
)
{
node
.
imgIndex
=
results
.
images
.
length
;
var
imgUrl
=
node
.
attr
.
src
;
imgUrl
=
wxDiscode
.
urlToHttpUrl
(
imgUrl
,
__placeImgeUrlHttps
);
node
.
attr
.
src
=
imgUrl
;
node
.
from
=
bindName
;
results
.
images
.
push
(
node
);
results
.
imageUrls
.
push
(
imgUrl
);
}
if
(
unary
)
{
// if this tag dosen't have end tag
// like <img src="hoge.png"/>
// add to parents
var
parent
=
bufArray
[
0
]
||
results
;
if
(
parent
.
nodes
===
undefined
)
{
parent
.
nodes
=
[];
}
parent
.
nodes
.
push
(
node
);
}
else
{
bufArray
.
unshift
(
node
);
}
},
end
:
function
(
tag
)
{
//debug(tag);
// merge into parent tag
var
node
=
bufArray
.
shift
();
if
(
node
.
tag
!==
tag
)
console
.
error
(
'
invalid state: mismatch end tag
'
);
if
(
bufArray
.
length
===
0
)
{
results
.
nodes
.
push
(
node
);
}
else
{
var
parent
=
bufArray
[
0
];
if
(
parent
.
nodes
===
undefined
)
{
parent
.
nodes
=
[];
}
parent
.
nodes
.
push
(
node
);
}
},
chars
:
function
(
text
)
{
//debug(text);
var
node
=
{
node
:
'
text
'
,
text
:
text
,
textArray
:
transEmojiStr
(
text
)
};
if
(
bufArray
.
length
===
0
)
{
results
.
nodes
.
push
(
node
);
}
else
{
var
parent
=
bufArray
[
0
];
if
(
parent
.
nodes
===
undefined
)
{
parent
.
nodes
=
[];
}
parent
.
nodes
.
push
(
node
);
}
},
comment
:
function
(
text
)
{
//debug(text);
var
node
=
{
node
:
'
comment
'
,
text
:
text
,
};
var
parent
=
bufArray
[
0
];
if
(
parent
.
nodes
===
undefined
)
{
parent
.
nodes
=
[];
}
parent
.
nodes
.
push
(
node
);
},
});
return
results
;
};
function
transEmojiStr
(
str
){
// var eReg = new RegExp("["+__reg+' '+"]");
// str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
var
emojiObjs
=
[];
//如果正则表达式为空
if
(
__emojisReg
.
length
==
0
||
!
__emojis
){
var
emojiObj
=
{}
emojiObj
.
node
=
"
text
"
;
emojiObj
.
text
=
str
;
array
=
[
emojiObj
];
return
array
;
}
//这个地方需要调整
str
=
str
.
replace
(
/
\[([^\[\]]
+
)\]
/g
,
'
:$1:
'
)
var
eReg
=
new
RegExp
(
"
[:]
"
);
var
array
=
str
.
split
(
eReg
);
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
){
var
ele
=
array
[
i
];
var
emojiObj
=
{};
if
(
__emojis
[
ele
]){
emojiObj
.
node
=
"
element
"
;
emojiObj
.
tag
=
"
emoji
"
;
emojiObj
.
text
=
__emojis
[
ele
];
emojiObj
.
baseSrc
=
__emojisBaseSrc
;
}
else
{
emojiObj
.
node
=
"
text
"
;
emojiObj
.
text
=
ele
;
}
emojiObjs
.
push
(
emojiObj
);
}
return
emojiObjs
;
}
function
emojisInit
(
reg
=
''
,
baseSrc
=
"
/wxParse/emojis/
"
,
emojis
){
__emojisReg
=
reg
;
__emojisBaseSrc
=
baseSrc
;
__emojis
=
emojis
;
}
module
.
exports
=
{
html2json
:
html2json
,
emojisInit
:
emojisInit
};
renard-wx/lib/wxParse/htmlparser.js
0 → 100644
View file @
854bacf6
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
// Regular Expressions for parsing tags and attributes
var
startTag
=
/^<
([
-A-Za-z0-9_
]
+
)((?:\s
+
[
a-zA-Z_:
][
-a-zA-Z0-9_:.
]
*
(?:\s
*=
\s
*
(?:(?:
"
[^
"
]
*"
)
|
(?:
'
[^
'
]
*'
)
|
[^
>
\s]
+
))?)
*
)\s
*
(\/?)
>/
,
endTag
=
/^<
\/([
-A-Za-z0-9_
]
+
)[^
>
]
*>/
,
attr
=
/
([
a-zA-Z_:
][
-a-zA-Z0-9_:.
]
*
)(?:\s
*=
\s
*
(?:(?:
"
((?:\\
.|
[^
"
])
*
)
"
)
|
(?:
'
((?:\\
.|
[^
'
])
*
)
'
)
|
([^
>
\s]
+
)))?
/g
;
// Empty Elements - HTML 5
var
empty
=
makeMap
(
"
area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr
"
);
// Block Elements - HTML 5
var
block
=
makeMap
(
"
a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video
"
);
// Inline Elements - HTML 5
var
inline
=
makeMap
(
"
abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
"
);
// Elements that you can, intentionally, leave open
// (and which close themselves)
var
closeSelf
=
makeMap
(
"
colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr
"
);
// Attributes that have their values filled in disabled="disabled"
var
fillAttrs
=
makeMap
(
"
checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected
"
);
// Special Elements (can contain anything)
var
special
=
makeMap
(
"
wxxxcode-style,script,style,view,scroll-view,block
"
);
function
HTMLParser
(
html
,
handler
)
{
var
index
,
chars
,
match
,
stack
=
[],
last
=
html
;
stack
.
last
=
function
()
{
return
this
[
this
.
length
-
1
];
};
while
(
html
)
{
chars
=
true
;
// Make sure we're not in a script or style element
if
(
!
stack
.
last
()
||
!
special
[
stack
.
last
()])
{
// Comment
if
(
html
.
indexOf
(
"
<!--
"
)
==
0
)
{
index
=
html
.
indexOf
(
"
-->
"
);
if
(
index
>=
0
)
{
if
(
handler
.
comment
)
handler
.
comment
(
html
.
substring
(
4
,
index
));
html
=
html
.
substring
(
index
+
3
);
chars
=
false
;
}
// end tag
}
else
if
(
html
.
indexOf
(
"
</
"
)
==
0
)
{
match
=
html
.
match
(
endTag
);
if
(
match
)
{
html
=
html
.
substring
(
match
[
0
].
length
);
match
[
0
].
replace
(
endTag
,
parseEndTag
);
chars
=
false
;
}
// start tag
}
else
if
(
html
.
indexOf
(
"
<
"
)
==
0
)
{
match
=
html
.
match
(
startTag
);
if
(
match
)
{
html
=
html
.
substring
(
match
[
0
].
length
);
match
[
0
].
replace
(
startTag
,
parseStartTag
);
chars
=
false
;
}
}
if
(
chars
)
{
index
=
html
.
indexOf
(
"
<
"
);
var
text
=
index
<
0
?
html
:
html
.
substring
(
0
,
index
);
html
=
index
<
0
?
""
:
html
.
substring
(
index
);
if
(
handler
.
chars
)
handler
.
chars
(
text
);
}
}
else
{
html
=
html
.
replace
(
new
RegExp
(
"
([
\\
s
\\
S]*?)<
\
/
"
+
stack
.
last
()
+
"
[^>]*>
"
),
function
(
all
,
text
)
{
text
=
text
.
replace
(
/<!--
([\s\S]
*
?)
-->|<!
\[
CDATA
\[([\s\S]
*
?)
]]>/g
,
"
$1$2
"
);
if
(
handler
.
chars
)
handler
.
chars
(
text
);
return
""
;
});
parseEndTag
(
""
,
stack
.
last
());
}
if
(
html
==
last
)
throw
"
Parse Error:
"
+
html
;
last
=
html
;
}
// Clean up any remaining tags
parseEndTag
();
function
parseStartTag
(
tag
,
tagName
,
rest
,
unary
)
{
tagName
=
tagName
.
toLowerCase
();
if
(
block
[
tagName
])
{
while
(
stack
.
last
()
&&
inline
[
stack
.
last
()])
{
parseEndTag
(
""
,
stack
.
last
());
}
}
if
(
closeSelf
[
tagName
]
&&
stack
.
last
()
==
tagName
)
{
parseEndTag
(
""
,
tagName
);
}
unary
=
empty
[
tagName
]
||
!!
unary
;
if
(
!
unary
)
stack
.
push
(
tagName
);
if
(
handler
.
start
)
{
var
attrs
=
[];
rest
.
replace
(
attr
,
function
(
match
,
name
)
{
var
value
=
arguments
[
2
]
?
arguments
[
2
]
:
arguments
[
3
]
?
arguments
[
3
]
:
arguments
[
4
]
?
arguments
[
4
]
:
fillAttrs
[
name
]
?
name
:
""
;
attrs
.
push
({
name
:
name
,
value
:
value
,
escaped
:
value
.
replace
(
/
(
^|
[^\\])
"/g
,
'
$1
\\\
"
'
)
//"
});
});
if
(
handler
.
start
)
{
handler
.
start
(
tagName
,
attrs
,
unary
);
}
}
}
function
parseEndTag
(
tag
,
tagName
)
{
// If no tag name is provided, clean shop
if
(
!
tagName
)
var
pos
=
0
;
// Find the closest opened tag of the same type
else
for
(
var
pos
=
stack
.
length
-
1
;
pos
>=
0
;
pos
--
)
if
(
stack
[
pos
]
==
tagName
)
break
;
if
(
pos
>=
0
)
{
// Close all the open elements, up the stack
for
(
var
i
=
stack
.
length
-
1
;
i
>=
pos
;
i
--
)
if
(
handler
.
end
)
handler
.
end
(
stack
[
i
]);
// Remove the open elements from the stack
stack
.
length
=
pos
;
}
}
};
function
makeMap
(
str
)
{
var
obj
=
{},
items
=
str
.
split
(
"
,
"
);
for
(
var
i
=
0
;
i
<
items
.
length
;
i
++
)
obj
[
items
[
i
]]
=
true
;
return
obj
;
}
module
.
exports
=
HTMLParser
;
renard-wx/lib/wxParse/showdown.js
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/lib/wxParse/wxDiscode.js
0 → 100644
View file @
854bacf6
// HTML 支持的数学符号
function
strNumDiscode
(
str
){
str
=
str
.
replace
(
/∀/g
,
'
∀
'
);
str
=
str
.
replace
(
/∂/g
,
'
∂
'
);
str
=
str
.
replace
(
/&exists;/g
,
'
∃
'
);
str
=
str
.
replace
(
/∅/g
,
'
∅
'
);
str
=
str
.
replace
(
/∇/g
,
'
∇
'
);
str
=
str
.
replace
(
/∈/g
,
'
∈
'
);
str
=
str
.
replace
(
/∉/g
,
'
∉
'
);
str
=
str
.
replace
(
/∋/g
,
'
∋
'
);
str
=
str
.
replace
(
/∏/g
,
'
∏
'
);
str
=
str
.
replace
(
/∑/g
,
'
∑
'
);
str
=
str
.
replace
(
/−/g
,
'
−
'
);
str
=
str
.
replace
(
/∗/g
,
'
∗
'
);
str
=
str
.
replace
(
/√/g
,
'
√
'
);
str
=
str
.
replace
(
/∝/g
,
'
∝
'
);
str
=
str
.
replace
(
/∞/g
,
'
∞
'
);
str
=
str
.
replace
(
/∠/g
,
'
∠
'
);
str
=
str
.
replace
(
/∧/g
,
'
∧
'
);
str
=
str
.
replace
(
/∨/g
,
'
∨
'
);
str
=
str
.
replace
(
/∩/g
,
'
∩
'
);
str
=
str
.
replace
(
/∩/g
,
'
∪
'
);
str
=
str
.
replace
(
/∫/g
,
'
∫
'
);
str
=
str
.
replace
(
/∴/g
,
'
∴
'
);
str
=
str
.
replace
(
/∼/g
,
'
∼
'
);
str
=
str
.
replace
(
/≅/g
,
'
≅
'
);
str
=
str
.
replace
(
/≈/g
,
'
≈
'
);
str
=
str
.
replace
(
/≠/g
,
'
≠
'
);
str
=
str
.
replace
(
/≤/g
,
'
≤
'
);
str
=
str
.
replace
(
/≥/g
,
'
≥
'
);
str
=
str
.
replace
(
/⊂/g
,
'
⊂
'
);
str
=
str
.
replace
(
/⊃/g
,
'
⊃
'
);
str
=
str
.
replace
(
/⊄/g
,
'
⊄
'
);
str
=
str
.
replace
(
/⊆/g
,
'
⊆
'
);
str
=
str
.
replace
(
/⊇/g
,
'
⊇
'
);
str
=
str
.
replace
(
/⊕/g
,
'
⊕
'
);
str
=
str
.
replace
(
/⊗/g
,
'
⊗
'
);
str
=
str
.
replace
(
/⊥/g
,
'
⊥
'
);
str
=
str
.
replace
(
/⋅/g
,
'
⋅
'
);
return
str
;
}
//HTML 支持的希腊字母
function
strGreeceDiscode
(
str
){
str
=
str
.
replace
(
/Α/g
,
'
Α
'
);
str
=
str
.
replace
(
/Β/g
,
'
Β
'
);
str
=
str
.
replace
(
/Γ/g
,
'
Γ
'
);
str
=
str
.
replace
(
/Δ/g
,
'
Δ
'
);
str
=
str
.
replace
(
/Ε/g
,
'
Ε
'
);
str
=
str
.
replace
(
/Ζ/g
,
'
Ζ
'
);
str
=
str
.
replace
(
/Η/g
,
'
Η
'
);
str
=
str
.
replace
(
/Θ/g
,
'
Θ
'
);
str
=
str
.
replace
(
/Ι/g
,
'
Ι
'
);
str
=
str
.
replace
(
/Κ/g
,
'
Κ
'
);
str
=
str
.
replace
(
/Λ/g
,
'
Λ
'
);
str
=
str
.
replace
(
/Μ/g
,
'
Μ
'
);
str
=
str
.
replace
(
/Ν/g
,
'
Ν
'
);
str
=
str
.
replace
(
/Ξ/g
,
'
Ν
'
);
str
=
str
.
replace
(
/Ο/g
,
'
Ο
'
);
str
=
str
.
replace
(
/Π/g
,
'
Π
'
);
str
=
str
.
replace
(
/Ρ/g
,
'
Ρ
'
);
str
=
str
.
replace
(
/Σ/g
,
'
Σ
'
);
str
=
str
.
replace
(
/Τ/g
,
'
Τ
'
);
str
=
str
.
replace
(
/Υ/g
,
'
Υ
'
);
str
=
str
.
replace
(
/Φ/g
,
'
Φ
'
);
str
=
str
.
replace
(
/Χ/g
,
'
Χ
'
);
str
=
str
.
replace
(
/Ψ/g
,
'
Ψ
'
);
str
=
str
.
replace
(
/Ω/g
,
'
Ω
'
);
str
=
str
.
replace
(
/α/g
,
'
α
'
);
str
=
str
.
replace
(
/β/g
,
'
β
'
);
str
=
str
.
replace
(
/γ/g
,
'
γ
'
);
str
=
str
.
replace
(
/δ/g
,
'
δ
'
);
str
=
str
.
replace
(
/ε/g
,
'
ε
'
);
str
=
str
.
replace
(
/ζ/g
,
'
ζ
'
);
str
=
str
.
replace
(
/η/g
,
'
η
'
);
str
=
str
.
replace
(
/θ/g
,
'
θ
'
);
str
=
str
.
replace
(
/ι/g
,
'
ι
'
);
str
=
str
.
replace
(
/κ/g
,
'
κ
'
);
str
=
str
.
replace
(
/λ/g
,
'
λ
'
);
str
=
str
.
replace
(
/μ/g
,
'
μ
'
);
str
=
str
.
replace
(
/ν/g
,
'
ν
'
);
str
=
str
.
replace
(
/ξ/g
,
'
ξ
'
);
str
=
str
.
replace
(
/ο/g
,
'
ο
'
);
str
=
str
.
replace
(
/π/g
,
'
π
'
);
str
=
str
.
replace
(
/ρ/g
,
'
ρ
'
);
str
=
str
.
replace
(
/ς/g
,
'
ς
'
);
str
=
str
.
replace
(
/σ/g
,
'
σ
'
);
str
=
str
.
replace
(
/τ/g
,
'
τ
'
);
str
=
str
.
replace
(
/υ/g
,
'
υ
'
);
str
=
str
.
replace
(
/φ/g
,
'
φ
'
);
str
=
str
.
replace
(
/χ/g
,
'
χ
'
);
str
=
str
.
replace
(
/ψ/g
,
'
ψ
'
);
str
=
str
.
replace
(
/ω/g
,
'
ω
'
);
str
=
str
.
replace
(
/ϑ/g
,
'
ϑ
'
);
str
=
str
.
replace
(
/ϒ/g
,
'
ϒ
'
);
str
=
str
.
replace
(
/ϖ/g
,
'
ϖ
'
);
str
=
str
.
replace
(
/·/g
,
'
·
'
);
return
str
;
}
//
function
strcharacterDiscode
(
str
){
// 加入常用解析
str
=
str
.
replace
(
/ /g
,
'
'
);
str
=
str
.
replace
(
/"/g
,
'
"
'
);
str
=
str
.
replace
(
/&/g
,
'
&
'
);
// str = str.replace(/</g, '‹');
// str = str.replace(/>/g, '›');
str
=
str
.
replace
(
/</g
,
'
<
'
);
str
=
str
.
replace
(
/>/g
,
'
>
'
);
return
str
;
}
// HTML 支持的其他实体
function
strOtherDiscode
(
str
){
str
=
str
.
replace
(
/Œ/g
,
'
Œ
'
);
str
=
str
.
replace
(
/œ/g
,
'
œ
'
);
str
=
str
.
replace
(
/Š/g
,
'
Š
'
);
str
=
str
.
replace
(
/š/g
,
'
š
'
);
str
=
str
.
replace
(
/Ÿ/g
,
'
Ÿ
'
);
str
=
str
.
replace
(
/ƒ/g
,
'
ƒ
'
);
str
=
str
.
replace
(
/ˆ/g
,
'
ˆ
'
);
str
=
str
.
replace
(
/˜/g
,
'
˜
'
);
str
=
str
.
replace
(
/ /g
,
''
);
str
=
str
.
replace
(
/ /g
,
''
);
str
=
str
.
replace
(
/ /g
,
''
);
str
=
str
.
replace
(
/‌/g
,
''
);
str
=
str
.
replace
(
/‍/g
,
''
);
str
=
str
.
replace
(
/‎/g
,
''
);
str
=
str
.
replace
(
/‏/g
,
''
);
str
=
str
.
replace
(
/–/g
,
'
–
'
);
str
=
str
.
replace
(
/—/g
,
'
—
'
);
str
=
str
.
replace
(
/‘/g
,
'
‘
'
);
str
=
str
.
replace
(
/’/g
,
'
’
'
);
str
=
str
.
replace
(
/‚/g
,
'
‚
'
);
str
=
str
.
replace
(
/“/g
,
'
“
'
);
str
=
str
.
replace
(
/”/g
,
'
”
'
);
str
=
str
.
replace
(
/„/g
,
'
„
'
);
str
=
str
.
replace
(
/†/g
,
'
†
'
);
str
=
str
.
replace
(
/‡/g
,
'
‡
'
);
str
=
str
.
replace
(
/•/g
,
'
•
'
);
str
=
str
.
replace
(
/…/g
,
'
…
'
);
str
=
str
.
replace
(
/‰/g
,
'
‰
'
);
str
=
str
.
replace
(
/′/g
,
'
′
'
);
str
=
str
.
replace
(
/″/g
,
'
″
'
);
str
=
str
.
replace
(
/‹/g
,
'
‹
'
);
str
=
str
.
replace
(
/›/g
,
'
›
'
);
str
=
str
.
replace
(
/‾/g
,
'
‾
'
);
str
=
str
.
replace
(
/€/g
,
'
€
'
);
str
=
str
.
replace
(
/™/g
,
'
™
'
);
str
=
str
.
replace
(
/←/g
,
'
←
'
);
str
=
str
.
replace
(
/↑/g
,
'
↑
'
);
str
=
str
.
replace
(
/→/g
,
'
→
'
);
str
=
str
.
replace
(
/↓/g
,
'
↓
'
);
str
=
str
.
replace
(
/↔/g
,
'
↔
'
);
str
=
str
.
replace
(
/↵/g
,
'
↵
'
);
str
=
str
.
replace
(
/⌈/g
,
'
⌈
'
);
str
=
str
.
replace
(
/⌉/g
,
'
⌉
'
);
str
=
str
.
replace
(
/⌊/g
,
'
⌊
'
);
str
=
str
.
replace
(
/⌋/g
,
'
⌋
'
);
str
=
str
.
replace
(
/◊/g
,
'
◊
'
);
str
=
str
.
replace
(
/♠/g
,
'
♠
'
);
str
=
str
.
replace
(
/♣/g
,
'
♣
'
);
str
=
str
.
replace
(
/♥/g
,
'
♥
'
);
str
=
str
.
replace
(
/♦/g
,
'
♦
'
);
return
str
;
}
function
strMoreDiscode
(
str
){
str
=
str
.
replace
(
/
\r\n
/g
,
""
);
str
=
str
.
replace
(
/
\n
/g
,
""
);
str
=
str
.
replace
(
/code/g
,
"
wxxxcode-style
"
);
return
str
;
}
function
strDiscode
(
str
){
str
=
strNumDiscode
(
str
);
str
=
strGreeceDiscode
(
str
);
str
=
strcharacterDiscode
(
str
);
str
=
strOtherDiscode
(
str
);
str
=
strMoreDiscode
(
str
);
return
str
;
}
function
urlToHttpUrl
(
url
,
rep
){
var
patt1
=
new
RegExp
(
"
^//
"
);
var
result
=
patt1
.
test
(
url
);
if
(
result
){
url
=
rep
+
"
:
"
+
url
;
}
return
url
;
}
module
.
exports
=
{
strDiscode
:
strDiscode
,
urlToHttpUrl
:
urlToHttpUrl
}
\ No newline at end of file
renard-wx/lib/wxParse/wxParse.js
0 → 100644
View file @
854bacf6
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
/**
* utils函数引入
**/
import
showdown
from
'
showdown.js
'
;
import
HtmlToJson
from
'
html2json.js
'
;
/**
* 配置及公有属性
**/
/**
* 主函数入口区
**/
function
wxParse
(
bindName
=
'
wxParseData
'
,
type
=
'
html
'
,
data
=
'
<div class="color:red;">数据不能为空</div>
'
,
target
,
imagePadding
)
{
var
that
=
target
;
var
transData
=
{};
//存放转化后的数据
if
(
type
==
'
html
'
)
{
transData
=
HtmlToJson
.
html2json
(
data
,
bindName
);
// console.log(JSON.stringify(transData, ' ', ' '));
}
else
if
(
type
==
'
md
'
||
type
==
'
markdown
'
)
{
var
converter
=
new
showdown
.
Converter
();
var
html
=
converter
.
makeHtml
(
data
);
transData
=
HtmlToJson
.
html2json
(
html
,
bindName
);
// console.log(JSON.stringify(transData, ' ', ' '));
}
transData
.
view
=
{};
transData
.
view
.
imagePadding
=
0
;
if
(
typeof
(
imagePadding
)
!=
'
undefined
'
){
transData
.
view
.
imagePadding
=
imagePadding
}
var
bindData
=
{};
bindData
[
bindName
]
=
transData
;
that
.
setData
(
bindData
)
that
.
wxParseImgLoad
=
wxParseImgLoad
;
that
.
wxParseImgTap
=
wxParseImgTap
;
}
// 图片点击事件
function
wxParseImgTap
(
e
)
{
var
that
=
this
;
var
nowImgUrl
=
e
.
target
.
dataset
.
src
;
var
tagFrom
=
e
.
target
.
dataset
.
from
;
if
(
typeof
(
tagFrom
)
!=
'
undefined
'
&&
tagFrom
.
length
>
0
)
{
wx
.
previewImage
({
current
:
nowImgUrl
,
// 当前显示图片的http链接
urls
:
that
.
data
[
tagFrom
].
imageUrls
// 需要预览的图片http链接列表
})
}
}
/**
* 图片视觉宽高计算函数区
**/
function
wxParseImgLoad
(
e
)
{
var
that
=
this
;
var
tagFrom
=
e
.
target
.
dataset
.
from
;
var
idx
=
e
.
target
.
dataset
.
idx
;
if
(
typeof
(
tagFrom
)
!=
'
undefined
'
&&
tagFrom
.
length
>
0
)
{
calMoreImageInfo
(
e
,
idx
,
that
,
tagFrom
)
}
}
// 假循环获取计算图片视觉最佳宽高
function
calMoreImageInfo
(
e
,
idx
,
that
,
bindName
)
{
var
temData
=
that
.
data
[
bindName
];
if
(
temData
.
images
.
length
==
0
)
{
return
;
}
var
temImages
=
temData
.
images
;
//因为无法获取view宽度 需要自定义padding进行计算,稍后处理
var
recal
=
wxAutoImageCal
(
e
.
detail
.
width
,
e
.
detail
.
height
,
that
,
bindName
);
temImages
[
idx
].
width
=
recal
.
imageWidth
;
temImages
[
idx
].
height
=
recal
.
imageheight
;
temData
.
images
=
temImages
;
var
bindData
=
{};
bindData
[
bindName
]
=
temData
;
that
.
setData
(
bindData
);
}
// 计算视觉优先的图片宽高
function
wxAutoImageCal
(
originalWidth
,
originalHeight
,
that
,
bindName
)
{
//获取图片的原始长宽
var
windowWidth
=
0
,
windowHeight
=
0
;
var
autoWidth
=
0
,
autoHeight
=
0
;
var
results
=
{};
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
var
padding
=
that
.
data
[
bindName
].
view
.
imagePadding
;
windowWidth
=
res
.
windowWidth
-
2
*
padding
;
windowHeight
=
res
.
windowHeight
;
//判断按照那种方式进行缩放
// console.log("windowWidth" + windowWidth);
if
(
originalWidth
>
windowWidth
)
{
//在图片width大于手机屏幕width时候
autoWidth
=
windowWidth
;
// console.log("autoWidth" + autoWidth);
autoHeight
=
(
autoWidth
*
originalHeight
)
/
originalWidth
;
// console.log("autoHeight" + autoHeight);
results
.
imageWidth
=
autoWidth
;
results
.
imageheight
=
autoHeight
;
}
else
{
//否则展示原来的数据
results
.
imageWidth
=
originalWidth
;
results
.
imageheight
=
originalHeight
;
}
}
})
return
results
;
}
function
wxParseTemArray
(
temArrayName
,
bindNameReg
,
total
,
that
){
var
array
=
[];
var
temData
=
that
.
data
;
var
obj
=
null
;
for
(
var
i
=
0
;
i
<
total
;
i
++
){
var
simArr
=
temData
[
bindNameReg
+
i
].
nodes
;
array
.
push
(
simArr
);
}
temArrayName
=
temArrayName
||
'
wxParseTemArray
'
;
obj
=
JSON
.
parse
(
'
{"
'
+
temArrayName
+
'
":""}
'
);
obj
[
temArrayName
]
=
array
;
that
.
setData
(
obj
);
}
/**
* 配置emojis
*
*/
function
emojisInit
(
reg
=
''
,
baseSrc
=
"
/wxParse/emojis/
"
,
emojis
){
HtmlToJson
.
emojisInit
(
reg
,
baseSrc
,
emojis
);
}
module
.
exports
=
{
wxParse
:
wxParse
,
wxParseTemArray
:
wxParseTemArray
,
emojisInit
:
emojisInit
}
renard-wx/lib/wxParse/wxParse.wxml
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/lib/wxParse/wxParse.wxss
0 → 100644
View file @
854bacf6
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
.wxParse{
margin: 0 5px;
font-family: Helvetica,sans-serif;
font-size: 28rpx;
color: #666;
line-height: 1.8;
}
view{
word-break:break-all; overflow:auto;
}
.wxParse-inline{
display: inline;
margin: 0;
padding: 0;
}
/*//标题 */
.wxParse-div{margin: 0;padding: 0;}
.wxParse-h1{ font-size:2em; margin: .67em 0 }
.wxParse-h2{ font-size:1.5em; margin: .75em 0 }
.wxParse-h3{ font-size:1.17em; margin: .83em 0 }
.wxParse-h4{ margin: 1.12em 0}
.wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
.wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
.wxParse-h1 {
font-size: 18px;
font-weight: 400;
margin-bottom: .9em;
}
.wxParse-h2 {
font-size: 16px;
font-weight: 400;
margin-bottom: .34em;
}
.wxParse-h3 {
font-weight: 400;
font-size: 15px;
margin-bottom: .34em;
}
.wxParse-h4 {
font-weight: 400;
font-size: 14px;
margin-bottom: .24em;
}
.wxParse-h5 {
font-weight: 400;
font-size: 13px;
margin-bottom: .14em;
}
.wxParse-h6 {
font-weight: 400;
font-size: 12px;
margin-bottom: .04em;
}
.wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
.wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
.wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
.wxParse-pre{white-space:pre}
.wxParse-big{font-size:1.17em}
.wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
.wxParse-sub{vertical-align:sub}
.wxParse-sup{vertical-align:super}
.wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
/*wxparse-自定义个性化的css样式*/
/*增加video的css样式*/
.wxParse-strong,wxParse-s{display: inline}
.wxParse-a{
color: deepskyblue;
word-break:break-all;
overflow:auto;
}
.wxParse-video{
text-align: center;
margin: 10px 0;
}
.wxParse-video-video{
width:100%;
}
.wxParse-img{
background-color: #efefef;
overflow: hidden;
width:40px;
height: 40px;
}
.wxParse-blockquote {
margin: 0;
padding:10px 0 10px 5px;
font-family:Courier, Calibri,"宋体";
background:#f5f5f5;
border-left: 3px solid #dbdbdb;
}
.wxParse-code,.wxParse-wxxxcode-style{
display: inline;
background:#f5f5f5;
}
.wxParse-ul{
margin: 20rpx 10rpx;
}
.wxParse-li,.wxParse-li-inner{
display: flex;
align-items: baseline;
margin: 10rpx 0;
}
.wxParse-li-text{
align-items: center;
line-height: 20px;
}
.wxParse-li-circle{
display: inline-flex;
width: 5px;
height: 5px;
background-color: #333;
margin-right: 5px;
}
.wxParse-li-square{
display: inline-flex;
width: 10rpx;
height: 10rpx;
background-color: #333;
margin-right: 5px;
}
.wxParse-li-ring{
display: inline-flex;
width: 10rpx;
height: 10rpx;
border: 2rpx solid #333;
border-radius: 50%;
background-color: #fff;
margin-right: 5px;
}
/*.wxParse-table{
width: 100%;
height: 400px;
}
.wxParse-thead,.wxParse-tfoot,.wxParse-tr{
display: flex;
flex-direction: row;
}
.wxParse-th,.wxParse-td{
display: flex;
width: 580px;
overflow: auto;
}*/
.wxParse-u {
text-decoration: underline;
}
.wxParse-hide{
display: none;
}
.WxEmojiView{
align-items: center;
}
.wxEmoji{
width: 16px;
height:16px;
}
.wxParse-tr{
display: flex;
border-right:1px solid #e0e0e0;
border-bottom:1px solid #e0e0e0;
}
.wxParse-th,
.wxParse-td{
flex:1;
padding:5px;
font-size:28rpx;
border-left:1px solid #e0e0e0;
word-break: break-all;
}
.wxParse-td:last{
border-top:1px solid #e0e0e0;
}
.wxParse-th{
background:#f0f0f0;
border-top:1px solid #e0e0e0;
}
renard-wx/pages/auth/login/login.js
0 → 100644
View file @
854bacf6
var
api
=
require
(
'
../../../config/api.js
'
);
var
util
=
require
(
'
../../../utils/util.js
'
);
var
user
=
require
(
'
../../../utils/user.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
username
:
''
,
password
:
''
,
code
:
''
,
loginErrorCount
:
0
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady
:
function
()
{
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
wxLogin
:
function
(
e
)
{
if
(
e
.
detail
.
userInfo
==
undefined
){
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
微信登录失败
'
);
return
;
}
user
.
checkLogin
().
catch
(()
=>
{
user
.
loginByWeixin
(
e
.
detail
.
userInfo
).
then
(
res
=>
{
app
.
globalData
.
hasLogin
=
true
;
wx
.
navigateBack
({
delta
:
1
})
}).
catch
((
err
)
=>
{
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
微信登录失败
'
);
});
});
},
accountLogin
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
password
.
length
<
1
||
this
.
data
.
username
.
length
<
1
)
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
'
请输入用户名和密码
'
,
showCancel
:
false
});
return
false
;
}
wx
.
request
({
url
:
api
.
AuthLoginByAccount
,
data
:
{
username
:
that
.
data
.
username
,
password
:
that
.
data
.
password
},
method
:
'
POST
'
,
header
:
{
'
content-type
'
:
'
application/json
'
},
success
:
function
(
res
)
{
if
(
res
.
data
.
errno
==
0
){
that
.
setData
({
loginErrorCount
:
0
});
app
.
globalData
.
hasLogin
=
true
;
wx
.
setStorageSync
(
'
userInfo
'
,
res
.
data
.
data
.
userInfo
);
wx
.
setStorage
({
key
:
"
token
"
,
data
:
res
.
data
.
data
.
token
,
success
:
function
(){
wx
.
switchTab
({
url
:
'
/pages/ucenter/index/index
'
});
}
});
}
else
{
that
.
setData
({
loginErrorCount
:
that
.
data
.
loginErrorCount
+
1
});
app
.
globalData
.
hasLogin
=
false
;
util
.
showErrorToast
(
'
账户登录失败
'
);
}
}
});
},
bindUsernameInput
:
function
(
e
)
{
this
.
setData
({
username
:
e
.
detail
.
value
});
},
bindPasswordInput
:
function
(
e
)
{
this
.
setData
({
password
:
e
.
detail
.
value
});
},
bindCodeInput
:
function
(
e
)
{
this
.
setData
({
code
:
e
.
detail
.
value
});
},
clearInput
:
function
(
e
)
{
switch
(
e
.
currentTarget
.
id
)
{
case
'
clear-username
'
:
this
.
setData
({
username
:
''
});
break
;
case
'
clear-password
'
:
this
.
setData
({
password
:
''
});
break
;
case
'
clear-code
'
:
this
.
setData
({
code
:
''
});
break
;
}
}
})
\ No newline at end of file
renard-wx/pages/auth/login/login.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"登录"
}
\ No newline at end of file
renard-wx/pages/auth/login/login.wxml
0 → 100644
View file @
854bacf6
<view class="container">
<view class="form-box">
<!-- <view class="form-item">
<input class="username" value="{{username}}" bindinput="bindUsernameInput" placeholder="账号"/>
<image wx:if="{{ username.length > 0 }}" id="clear-username" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码"/>
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item-code" wx-if="{{loginErrorCount >= 3}}">
<view class="form-item code-item">
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码"/>
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<image class="code-img" src="https://dl.reg.163.com/cp?pd=yanxuan_web&pkid=SkeBZeG&random=1489903563234"></image>
</view>
<button type="default" class="login-btn" bindtap="accountLogin">账号登录</button>
<view class="form-item-text">
<navigator url="/pages/auth/register/register" class="register">注册账号</navigator>
<navigator url="/pages/auth/reset/reset" class="reset">忘记密码</navigator>
</view> -->
<button type="primary" open-type="getUserInfo" class="login-btn" bindgetuserinfo="wxLogin">微信直接登录</button>
</view>
</view>
\ No newline at end of file
renard-wx/pages/auth/login/login.wxss
0 → 100644
View file @
854bacf6
.form-box{
width: 100%;
height: auto;
overflow: hidden;
padding: 0 40rpx;
margin-top: 96rpx;
background: #fff;
}
.form-item{
position: relative;
background: #fff;
height: 96rpx;
border-bottom: 1px solid #a78845;
}
.form-item .username, .form-item .password, .form-item .code{
position: absolute;
top: 26rpx;
left: 0;
display: block;
width: 100%;
height: 44rpx;
background: #fff;
color: #a78845;
font-size: 30rpx;
}
.form-item-code{
margin-top:32rpx;
height: auto;
overflow: hidden;
width: 100%;
}
.form-item-code .form-item{
float: left;
width: 350rpx;
}
.form-item-code .code-img{
float: right;
margin-top: 4rpx;
height: 88rpx;
width: 236rpx;
}
.form-item .clear{
position: absolute;
top: 26rpx;
right: 18rpx;
z-index: 2;
display: block;
background: #fff;
height: 44rpx;
width: 44rpx;
}
.login-btn{
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
color: #a78845;
font-size: 30rpx;
width: 100%;
background: #b4282d;
border-radius: 6rpx;
}
.form-item-text{
height: 35rpx;
width: 100%;
color: #a78845;
}
.form-item-text .register{
display: block;
height: 34rpx;
float: left;
font-size: 28rpx;
color: #a78845;
}
.form-item-text .reset{
display: block;
height: 34rpx;
float: right;
font-size: 28rpx;
color: #a78845;
}
\ No newline at end of file
renard-wx/pages/auth/register/register.js
0 → 100644
View file @
854bacf6
var
api
=
require
(
'
../../../config/api.js
'
);
var
check
=
require
(
'
../../../utils/check.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
username
:
''
,
password
:
''
,
confirmPassword
:
''
,
mobile
:
''
,
code
:
''
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady
:
function
()
{
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
sendCode
:
function
()
{
wx
.
showModal
({
title
:
'
注意
'
,
content
:
'
由于目前不支持手机短信发送,因此验证码任意值都可以
'
,
showCancel
:
false
});
},
startRegister
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
password
.
length
<
3
||
this
.
data
.
username
.
length
<
3
)
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
'
用户名和密码不得少于3位
'
,
showCancel
:
false
});
return
false
;
}
if
(
this
.
data
.
password
!=
this
.
data
.
confirmPassword
)
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
'
确认密码不一致
'
,
showCancel
:
false
});
return
false
;
}
if
(
this
.
data
.
mobile
.
length
==
0
||
this
.
data
.
code
.
length
==
0
)
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
'
手机号和验证码不能为空
'
,
showCancel
:
false
});
return
false
;
}
if
(
!
check
.
isValidPhone
(
this
.
data
.
mobile
))
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
'
手机号输入不正确
'
,
showCancel
:
false
});
return
false
;
}
wx
.
request
({
url
:
api
.
AuthRegister
,
data
:
{
username
:
that
.
data
.
username
,
password
:
that
.
data
.
password
,
mobile
:
that
.
data
.
mobile
,
code
:
that
.
data
.
code
},
method
:
'
POST
'
,
header
:
{
'
content-type
'
:
'
application/json
'
},
success
:
function
(
res
)
{
if
(
res
.
data
.
errno
==
0
)
{
app
.
globalData
.
hasLogin
=
true
;
wx
.
setStorageSync
(
'
userInfo
'
,
res
.
data
.
data
.
userInfo
);
wx
.
setStorage
({
key
:
"
token
"
,
data
:
res
.
data
.
data
.
token
,
success
:
function
()
{
wx
.
switchTab
({
url
:
'
/pages/ucenter/index/index
'
});
}
});
}
else
{
wx
.
showModal
({
title
:
'
错误信息
'
,
content
:
res
.
data
.
errmsg
,
showCancel
:
false
});
}
}
});
},
bindUsernameInput
:
function
(
e
)
{
this
.
setData
({
username
:
e
.
detail
.
value
});
},
bindPasswordInput
:
function
(
e
)
{
this
.
setData
({
password
:
e
.
detail
.
value
});
},
bindConfirmPasswordInput
:
function
(
e
)
{
this
.
setData
({
confirmPassword
:
e
.
detail
.
value
});
},
bindMobileInput
:
function
(
e
)
{
this
.
setData
({
mobile
:
e
.
detail
.
value
});
},
bindCodeInput
:
function
(
e
)
{
this
.
setData
({
code
:
e
.
detail
.
value
});
},
clearInput
:
function
(
e
)
{
switch
(
e
.
currentTarget
.
id
)
{
case
'
clear-username
'
:
this
.
setData
({
username
:
''
});
break
;
case
'
clear-password
'
:
this
.
setData
({
password
:
''
});
break
;
case
'
clear-confirm-password
'
:
this
.
setData
({
confirmPassword
:
''
});
break
;
case
'
clear-mobile
'
:
this
.
setData
({
mobile
:
''
});
break
;
case
'
clear-code
'
:
this
.
setData
({
code
:
''
});
break
;
}
}
})
\ No newline at end of file
renard-wx/pages/auth/register/register.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"注册"
}
\ No newline at end of file
renard-wx/pages/auth/register/register.wxml
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/pages/auth/register/register.wxss
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/pages/auth/reset/reset.js
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/pages/auth/reset/reset.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"密码重置"
}
\ No newline at end of file
renard-wx/pages/auth/reset/reset.wxml
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
renard-wx/pages/auth/reset/reset.wxss
0 → 100644
View file @
854bacf6
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
6
7
8
…
12
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment