Commit f77009d6 authored by fanxuehui's avatar fanxuehui

feat: clear

parent 79c591ea
...@@ -3,7 +3,6 @@ const webpack = require('webpack') ...@@ -3,7 +3,6 @@ const webpack = require('webpack')
const webpackDevMiddleware = require('webpack-dev-middleware') const webpackDevMiddleware = require('webpack-dev-middleware')
const webpackHotMiddleware = require('webpack-hot-middleware') const webpackHotMiddleware = require('webpack-hot-middleware')
const path = require('path') const path = require('path')
const proxy = require('http-proxy-middleware')
const fs = require('fs') const fs = require('fs')
const app = express() const app = express()
...@@ -26,113 +25,35 @@ app.set('views', path.join(__dirname, '../dist/html')) ...@@ -26,113 +25,35 @@ app.set('views', path.join(__dirname, '../dist/html'))
app.engine('.html', require('ejs').__express) app.engine('.html', require('ejs').__express)
app.set('view engine', 'html') app.set('view engine', 'html')
app.use('/basics', function(req, res) {
res.sendFile(path.resolve(__dirname, '../dist/html/index.html'))
})
app.use('/pro', function(req, res) { app.use('/pro', function(req, res) {
res.sendFile(path.resolve(__dirname, '../dist/html/pro.html')) res.sendFile(path.resolve(__dirname, '../dist/html/pro.html'))
}) })
app.use('/render', function(req, res) {
res.setHeader('X-Frame-Options', 'allow-from *')
res.render('render-v1', {
env: process.env.NODE_ENV,
isTestLog: true
})
})
app.use('/render-v1', function(req, res) {
res.setHeader('X-Frame-Options', 'allow-from *')
res.render('render-v1', {
env: process.env.NODE_ENV,
isTestLog: true
})
})
app.use('/layers', function(req, res) {
res.sendFile(path.resolve(__dirname, '../dist/html/layers.html'))
})
app.use( app.use(
express.static('./', { express.static('./', {
extensions: ['html'] extensions: ['html']
}) })
) )
if (process.env.proxy) { // 本地mock数据
app.use( app.use((req, res) => {
['/api', '/sso/ssoIndex'], const path = req.path
proxy({ res.set('Content-Type', 'application/json')
target: 'http://localhost:3000'
}) console.log(path)
) try {
/* eslint no-path-concat: "off" */
// 代理到广告后台开发人员机器 res.send(fs.readFileSync(__dirname + '/../mock' + path + '.json'))
// TODO换前缀名称 } catch (e) {
app.use( res.send(
'/java', JSON.stringify({
proxy({ code: '0',
target: 'http://172.16.47.169:1112', desc: '无此mock数据',
// target: 'http://yapi.dui88.com/mock/66', data: {}
pathRewrite: {
'^/java': ''
},
changeOrigin: true
})
)
// 代理到活动后端开发人员机器
app.use(
'/activity',
proxy({
target: 'http://172.16.47.145:17792',
pathRewrite: {
'^/activity': ''
},
changeOrigin: true
})
)
} else if (process.env.proxy_api) {
// 将接口代理到对应环境
// 例如 `proxy_api=http://jimu.tuiatest.cn npm run dev:client` 可以将接口代理到测试环境
const { proxyAPI } = require('./proxyAPI')
console.log(`开启接口代理,代理到 ${process.env.proxy_api}`)
app.use(proxyAPI())
} else {
// 本地调开发环境
if (process.env.NODE_ENV === 'dev') {
app.use(
proxy('/', {
target: 'http://localhost:3000'
}) })
) )
} else {
app.use(
proxy('/api/system/upload', {
target: 'http://localhost:3000'
})
)
// 本地mock数据
app.use((req, res) => {
const path = req.path
res.set('Content-Type', 'application/json')
console.log(path)
try {
/* eslint no-path-concat: "off" */
res.send(fs.readFileSync(__dirname + '/../mock' + path + '.json'))
} catch (e) {
res.send(
JSON.stringify({
code: '0',
desc: '无此mock数据',
data: {}
})
)
}
})
} }
} })
const port = 3010 const port = 3010
app.listen(port, function() { app.listen(port, function() {
......
...@@ -87,7 +87,6 @@ const getStyle = isDev => { ...@@ -87,7 +87,6 @@ const getStyle = isDev => {
const getEntry = isDev => { const getEntry = isDev => {
let entry = { let entry = {
basics: ['./client/pages/basics/index.js'],
// fixme // fixme
pro: ['./client/pages/pro/index.js'] pro: ['./client/pages/pro/index.js']
} }
...@@ -111,24 +110,11 @@ const getEntry = isDev => { ...@@ -111,24 +110,11 @@ const getEntry = isDev => {
} }
const HTML_WEBPACK_PLUGINS = { const HTML_WEBPACK_PLUGINS = {
basics: {
alwaysWriteToDisk: true,
chunks: ['basics'],
filename: 'html/index.html',
template: path.resolve(__dirname, '../client/pages/basics/index.html')
},
pro: { pro: {
alwaysWriteToDisk: true, alwaysWriteToDisk: true,
chunks: ['pro-render', 'pro'], chunks: ['pro-render', 'pro'],
filename: 'html/pro.html', filename: 'html/pro.html',
template: path.resolve(__dirname, '../client/pages/pro/index.html') template: path.resolve(__dirname, '../client/pages/pro/index.html')
},
render: {
JIMU_ENV: process.env.NODE_ENV,
alwaysWriteToDisk: true,
chunks: ['render'],
filename: 'html/render.html',
template: path.resolve(__dirname, '../client/pages/pro/render/entry.ejs')
} }
} }
......
import React from 'react'
import { Link } from 'react-router'
import { hot } from 'react-hot-loader'
import { Icon, Layout, Menu } from 'antd'
import ajax from 'libs/ajax'
const { Header, Content, Footer } = Layout
const SubMenu = Menu.SubMenu
const App = class App extends React.Component {
constructor (props) {
super(props)
this.state = {
user: {}
}
}
componentWillMount () {
ajax({
url: '/system/user'
}).then(data => {
this.setState(state => {
state.user = data
return state
})
}).catch(err => err)
}
goIndex () {
this.props.router.push('activity')
}
logOut () {
ajax({
url: 'system/logout',
method: 'post'
}).then(() => {
this.props.router.push('login')
}).catch(err => err)
}
render () {
let { user } = this.state
return (
<Layout className='layout'>
<Header>
<div className='logo' onClick={this.goIndex.bind(this)}><span></span></div>
<div className='user'>
<Link to=''><div className='headimg'>{user.username} | </div></Link>
<Link to='' onClick={this.logOut.bind(this)}><div className='logOut'><Icon type='logout' /></div></Link>
</div>
<Menu
theme='light'
mode='horizontal'
defaultSelectedKeys={[]}
style={{ lineHeight: '64px' }}
>
<Menu.Item key='0'><Link to='/activity'><Icon type='book' />活动市场</Link></Menu.Item>
{/* <Menu.Item key='1'><Link to='/plugin'><Icon type='cloud' />模版市场</Link></Menu.Item> */}
<SubMenu title={<span><Icon type='appstore' />插件市场</span>}>
<Menu.Item key='setting:1'><Link to='/plugin'>插件列表</Link></Menu.Item>
<Menu.Item key='setting:2'><Link to='/plugin/cate'>插件分类</Link></Menu.Item>
</SubMenu>
<Menu.Item key='2'><Link to='/layout'><Icon type='shop' />模板市场</Link> </Menu.Item>
</Menu>
</Header>
<Content style={{ padding: '64px 50px 75px 50px' }}>{this.props.children}</Content>
<Footer style={{ textAlign: 'center' }}>
Jimu ©2018 Created by Tuia Frontend
</Footer>
</Layout>
)
}
}
export default hot(module)(App)
import React from 'react'
import { Input, Switch, Upload, InputNumber, Button, Icon } from 'antd'
import Styles from './index.less'
import { ChromePicker } from 'react-color'
const pluginAttrItem = ({ item = {}, option = {}, onChange }) => {
let value = option[item.key]
switch (item.type.toLowerCase()) {
case 'number':
return (<InputNumber onChange={e => onChange(e, item)} value={value} />)
case 'boolean':
return (<Switch checked={value} onChange={e => onChange(e, item)} />)
case 'image':
return (<Upload name='file' listType='picture' showUploadList={false} action='/api/system/upload' onChange={e => onChange(e, item)}>
{value ? <img className={Styles.editImage} src={value} /> : <Button><Icon type='upload' /> 上传图片</Button>}
</Upload>)
case 'color':
return (<ChromePicker onChangeComplete={e => onChange(e, item)} color={value} />)
default:
return (<Input onChange={e => onChange(e, item)} value={value} />)
}
}
export default pluginAttrItem
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
.editImage {
max-width: 100%;
}
\ No newline at end of file
import React from 'react'
import styles from './index.less'
import { Button, Icon } from 'antd'
const pluginItem = props => {
const { item, remove } = props
const thumb = item.thumb ? item.thumb : '//yun.dui88.com/jimo-web/b47235c0-9c84-11e8-8beb-b77a9f575a78.jpeg'
return (
<div className={styles.plugin} onClick={props.onClick}>
<div className={styles.thumb} style={{ backgroundImage: 'url(' + thumb + ')' }} />
<div className={styles.title}>{item.title}</div>
<div className={styles.cate}>#{item.basics_cate.title}#</div>
<div className={styles.line} />
<div className={styles.revisor}>{item.revisor || '佚名'}</div>
{/* <div className={styles.avatar} style={{ backgroundImage: 'url(' + item.avatar + ')' }} /> */}
<div className={styles.action}>
<a href={`#/plugin/edit/${item.id}`}><Button type='primary' ghost><Icon type='edit' />编辑</Button></a>
<a href='javascript:;' onClick={remove.bind(this, item.id)}><Button type='danger' ghost><Icon type='delete' />删除</Button></a>
</div>
</div>
)
}
export default pluginItem
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
@h: 302px;
.plugin {
position: relative;
width: 200px;
max-width: 100%;
height: @h;
background-color: #fff;
display: inline-block;
margin-right: 40px;
margin-bottom: 40px;
border-radius: 4px;
border: 1px solid #e5e5e5;
cursor: pointer;
&:hover {
// box-shadow: 0 0 10px 4px #ddd;
.action {
display: block;
}
}
.thumb{
.size(120,160);
.pos(40,20);
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.title{
.text(12,30);
.pos(13,198);
color: #333;
font-weight: bold;
}
.line{
.size(180,1);
background-color: #eaeaea;
.pos(10,257);
}
.cate{
.text(12,20);
.pos(10,227);
color: #333;
}
.revisor{
.text(12,20);
.pos(13,270);
color: #333;
}
.avatar{
.size(24,24);
background-color: @primary-color;
border-radius: 50%;
.pos(166,268);
}
.action{
background-color: #fff;
display: none;
z-index: 99;
width: 100%;
height: 250px;
position: absolute;
top: 0;
left: 0;
a{
display: block;
text-align: center;
}
button{
border-width: 2px;
.size(180,48);
margin: 50px 0 0 0;
}
}
}
import React from 'react'
import styles from './index.less'
const pluginItem = props => {
const item = props.item
const thumb = item.thumb ? item.thumb : '//yun.dui88.com/jimo-web/b47235c0-9c84-11e8-8beb-b77a9f575a78.jpeg'
return (
<div className={styles.plugin + ' plugin'} onClick={props.onClick}>
<div className={styles.thumb} style={{ backgroundImage: 'url(' + thumb + ')' }} />
<div className={styles.title}>{item.title}</div>
</div>
)
}
export default pluginItem
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
@h: 282px;
.plugin {
position: relative;
width: 80px;
height: 80px;
cursor: pointer;
border: 1px solid #e5e5e5;
border-left-width: 0;
// border-top-width: 0;
padding-top: 50px;
.thumb{
.size(28,28);
.pos(26,16);
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.title{
.text(12,16);
width: 100%;
overflow: hidden;
text-align: center;
color: #333;
font-weight: bold;
text-overflow: ellipsis;
white-space: nowrap;
}
}
import React from 'react'
import { hot } from 'react-hot-loader'
const container = class container extends React.Component {
render () {
return (
this.props.children
)
}
}
export default hot(module)(container)
import React from 'react'
import { hot } from 'react-hot-loader'
import { Layout, Input, Icon, Modal, Button, message, Select } from 'antd'
import ajax from 'libs/ajax'
import util from 'libs/util'
import PluginItemSimple from 'basics/components/pluginItemSimple/index'
import PluginAttrItem from 'basics/components/pluginAttrItem/index'
import Sortable from 'react-sortablejs'
import Styles from './index.less'
const { Option } = Select
const { Header, Content } = Layout
class ActivityList extends React.Component {
constructor (props) {
super(props)
this.state = {
layoutList: [],
undo: [],
redo: [],
hasUndo: false,
hasRedo: false,
cateList: [],
pluginList: {},
editList: {},
activity: {
title: null,
summary: null,
components: []
} // 整个活动相关配置项
}
}
componentWillMount () {
this.getCateList()
this.getActivityDetail()
this.getLayoutList()
}
getActivityDetail () {
let { id } = this.props.router.location.query
if (!id) return
ajax({
url: 'basics/activity/detail',
params: {
id
}
}).then(data => {
this.stateSet(function (state) {
state.activity = {
id: data.id,
title: data.title,
layoutId: data.layoutId,
summary: data.summary,
components: data.components
}
})
}).catch(err => err)
}
// 获取模板列表
getLayoutList () {
ajax({
url: '/basics/layout',
params: {
pageSize: 100
}
}).then(res => {
this.setState(state => {
return {
layoutList: res.lists
}
})
})
}
// 获取分类
getCateList () {
ajax({
url: 'basics/cate',
params: {
pageSize: 100
}
}).then(res => {
this.setState({
cateList: res.lists
})
res.lists && res.lists.forEach(item => {
this.getPluginList(item.id)
})
}).catch(err => err)
}
// 获取当前分类下的插件
getPluginList (cateId) {
const pluginList = this.state.pluginList
if (pluginList[cateId] && pluginList[cateId].loaded) {
return false
}
if (!pluginList[cateId]) {
pluginList[cateId] = {
data: [],
loaded: false
}
}
ajax({
url: 'basics/component',
params: {
pageSize: 100,
cateId
}
}).then(res => {
pluginList[cateId].data = res.lists
pluginList[cateId].loaded = true
this.setState({
pluginList
})
}).catch(err => err)
}
// 返回按钮
goBack () {
Modal.confirm({
title: '确定离开当前页面?',
onOk: () => {
this.props.router.push('/activity')
}
})
}
// 预览区组件变动
handleComponentsChange (items) {
items = items.map(i => {
i = JSON.parse(i)
return {
id: i.id,
title: i.title,
thumb: i.thumb,
html: i.html,
css: i.css,
js: i.js,
option: i.option || {},
config: i.config || []
}
})
this.setActivity(function (preState) {
preState.activity.components = items
return preState
})
}
// 更改state
stateSet (cb) {
this.setState(function (preState) {
cb(preState)
return preState
})
}
// 更改活动相关
setActivity (cb) {
let activity
let undo
this.setState((preState) => {
activity = util.copy(preState.activity, {})
preState.undo.push(activity)
undo = JSON.parse(JSON.stringify(preState.undo))
this.applyUndoRedo()
cb(preState)
return {
activity: preState.activity,
undo
}
})
}
// 删除指定index组件
deleteComponent (index) {
this.setActivity(function (preState) {
preState.activity.components.splice(index, 1)
})
}
// 展示可配置项
showConfig (option) {
let { config } = option
config = JSON.parse(config.replace(/\s/g, '').replace(/([a-zA-Z0-9]+?):/g, '"$1":'))
this.setState(function (preState) {
preState.editList = {
config: config,
title: option.title,
key: option.key
}
return preState
})
}
// 组件配置项变动
handleEditChange = (e, val) => {
let value
let type = val.type
let { key } = this.state.editList
if (type === 'number' || type === 'boolean') {
value = e
} else if (type === 'image') {
let res = e.file.response
if (res && res.code === 0) {
value = res.data
} else if (res && res.msg) {
message.error(res.msg)
}
} else if (type === 'color') {
value = e.hex
} else {
value = e.target.value
}
this.setActivity(function (preState) {
preState.activity.components[key].option[val.key] = value
})
}
// 活动配置项变动
handleEditChange2 = (e, key) => {
let value
switch (key) {
case 'layoutId':
value = e
break
default:
value = e.target.value
}
this.setActivity(function (preState) {
preState.activity[key] = value
})
}
// 保存活动
activitySave = () => {
let data = this.state.activity
if (!data.title) {
message.error('活动标题不能为空')
return null
}
if (!data.layoutId) {
message.error('活动模板不能为空')
return null
}
if (data.components.length <= 0) {
message.error('活动组件不能为空')
return null
}
data.components = data.components.map(item => {
return {
id: item.id,
option: item.option
}
})
ajax({
url: 'basics/activity',
method: data.id ? 'put' : 'post',
data
}).then(res => {
!data.id && this.props.router.push('/activity')
message.success('活动保存成功')
}).catch(err => err)
}
// 应用撤销前进
applyUndoRedo () {
this.stateSet(function (state) {
state.hasUndo = state.undo.length > 0
state.hasRedo = state.redo.length > 0
})
}
// 前进
activityRedo = () => {
const activity = util.copy(this.state.activity, {})
this.stateSet(function (state) {
state.undo.push(activity)
state.activity = state.redo.pop()
})
this.applyUndoRedo()
}
// 撤销
activityUndo = () => {
const activity = util.copy(this.state.activity, {})
this.stateSet(function (state) {
state.redo.push(activity)
state.activity = state.undo.pop()
})
this.applyUndoRedo()
}
activityPreview = () => {
window.open(`/api/basics/activity/preview/${this.state.activity.id}`)
}
activityPublish = () => {
let id = this.state.activity.id
Modal.confirm({
title: '确定发布该活动?',
confirmLoading: true,
okType: 'success',
onOk: () => {
return ajax({
url: `/basics/activity/publish`,
data: {
id
},
method: 'post'
}).then(data => {
message.success('发布成功')
}).catch(err => err)
}
})
}
// 渲染待选区插件项
renderPluginItem (list) {
return list.map(item => <Sortable className={Styles.pluginItemContainer} options={{ group: { name: 'simple', pull: 'clone', put: false } }} key={item.id} ><div data-id={JSON.stringify(item)}><PluginItemSimple item={item} /></div></Sortable>)
}
// 渲染待选区插件列表
renderPluginList (item) {
const { pluginList } = this.state
return (<div key={item.id} className={Styles.cateListContainer}><span className={Styles.listTitle}>{item.title}</span>{pluginList[item.id] && pluginList[item.id].data && this.renderPluginItem(pluginList[item.id].data)}</div>)
}
// 渲染预览区组件列表
renderComponentItem (val, key) {
return (val && <div key={key} data-id={JSON.stringify(val)} className={Styles.comItem} style={{ backgroundImage: 'url(' + val.thumb + ')' }}>
<div className={Styles.comItemAction} onClick={this.showConfig.bind(this, { config: val.config, title: val.title, key })}>
<Button type='danger' onClick={this.deleteComponent.bind(this, key)}><Icon type='delete' /></Button>
</div>
</div>)
}
// 渲染组件可配置项
renderPluginEdit () {
const { editList, activity } = this.state
const { config = [] } = editList
return config.map(item => {
return (<div key={item.key} className={Styles.editItem}>
<span className={Styles.editItemTitle}>{item.title}</span>
<div>
<PluginAttrItem item={item} option={activity.components[editList.key].option} onChange={this.handleEditChange} />
</div>
</div>)
})
}
render () {
const { layoutList, cateList = [], editList = {}, activity = {} } = this.state
return (
<Layout className='layout'>
<Header className={Styles.header}>
<span className={Styles.back} onClick={this.goBack.bind(this)}><Icon type='arrow-left' />返回</span>
<span className={Styles.action} onClick={this.activityUndo} disabled={!this.state.hasUndo}><Icon type='left-circle-o' />撤销</span>
<span className={Styles.action} onClick={this.activityRedo} disabled={!this.state.hasRedo}><Icon type='right-circle-o' />前进</span>
<div className={Styles.headerRight}>
<span className={Styles.action} onClick={this.activitySave}><Icon type='save' />保存</span>
<span className={Styles.action} onClick={this.activityPreview}><Icon type='eye-o' />预览</span>
<span className={Styles.action} onClick={this.activityPublish}><Icon type='sync' />发布</span>
</div>
</Header>
<Content style={{ padding: '72px 50px 75px 50px' }}>
<div className={Styles.left} id='pluginList'>
{
cateList.map(item => this.renderPluginList(item))
}
</div>
<div className={Styles.content}>
<div className={Styles.preview}>
<div className={Styles.previewContent} id='preview'>
<Sortable options={{ group: { name: 'simple', pull: 'false' } }} onChange={(items) => this.handleComponentsChange(items)}>
{activity.components && activity.components.map((val, key) => this.renderComponentItem(val, key))}
</Sortable>
</div>
</div>
</div>
<div className={Styles.right}>
<div className={Styles.rightTitle}>舞台</div>
<div className={Styles.editItem}>
<span className={Styles.editItemTitle}>标题</span>
<Input onChange={e => this.handleEditChange2(e, 'title')} value={activity['title']} />
</div>
<div className={Styles.editItem}>
<span className={Styles.editItemTitle}>模板</span>
<Select onChange={e => this.handleEditChange2(e, 'layoutId')} value={activity['layoutId']}>
{layoutList && layoutList.map(item => {
return (<Option key={item.id} value={item.id}>{item.title}</Option>)
})}
</Select>
</div>
<div className={Styles.editItem}>
<span className={Styles.editItemTitle}>简介</span>
<Input onChange={e => this.handleEditChange2(e, 'summary')} value={activity['summary']} />
</div>
<div className={Styles.rightTitle}>{editList.title}</div>
{this.renderPluginEdit()}
</div>
</Content>
</Layout>
)
}
}
export default hot(module)(ActivityList)
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
@leftWidth: 240px;
@rightWidth: 280px;
@headerHeight: 72;
.main {
position: relative;
margin-left: -50px;
margin-right: -50px;
}
.left {
position: absolute;
padding: @headerHeight *1px 0 15px 1px;
left: 0;
top: 0;
width: @leftWidth;
height: 100%;
overflow-x: visible;
overflow-y: scroll;
background-color: #fff;
}
.content {
padding: 30px;
width: 100%;
padding-left: @leftWidth;
padding-right: @rightWidth;
}
.right {
padding: @headerHeight *1px 0 0 0;
position: absolute;
right: 0;
top: 0;
width: @rightWidth;
height: 100%;
overflow-y: scroll;
background-color: #fff;
}
.header{
border-bottom: 1px solid @normal-color;
padding:0 0 0 @leftWidth;
height: @headerHeight *1px;
span {
display: inline-block;
color: #666;
cursor: pointer;
}
}
.headerRight{
.posr(192,0);
}
.back{
height: @headerHeight *1px;
line-height: @headerHeight *1px;
.pos(12,0);
i{
margin-right: 10px;
}
}
.action{
height: @headerHeight;
line-height: 2;
padding: 19px 10px 14px 10px;
user-select: none;
i{
display: block;
font-size: 18;
svg {
margin: 0 auto;
}
}
@disabled-color: #c2c2c2;
&[disabled]{
pointer-events: none;
color: @disabled-color;
}
}
.listTitle {
display: block;
font-size: bold;
color: #666;
.text(12,40);
padding-left: 20px;
width: 100%;
// border-bottom: 1px solid @normal-color;
}
.preview{
margin-top: 40px;
width: 395px;
padding: 10px 10px 10px 10px;
min-height: 643px;
.center;
background-color: #e0e0e0;
border:1px dashed rgba(224,224,224,1);
.previewContent{
width: 375px;
min-height: 603px;
background-color:#fff;
>div{
width: 375px;
min-height: 603px;
}
}
}
.rightTitle{
width: 100%;
padding-left: 28px;
color: @primary-color;
.text(12,40);
border-bottom: 1px solid @normal-color;
}
.comItem {
width: 100%;
height: 150px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
&:hover {
.comItemAction {
display: block;
}
}
}
.comItemAction {
width: 100%;
height: 100%;
position: relative;
// background-color: rgba(255, 255, 255, 1);
button {
.posr(10, 10);
}
}
.editItem {
width: 100%;
padding: 10px;
}
.editItemTitle {
.text(12,32);
display: block;
}
.pluginItemContainer{
float: left;
}
.cateListContainer{
width: @leftWidth * 1px;
.clearfix;
}
::-webkit-scrollbar {
width: 0;
height: 0;
}
\ No newline at end of file
import React from 'react'
import { Link } from 'react-router'
import { Select, Button, Modal, message, Icon, Pagination } from 'antd'
import styles from './index.less'
import { hot } from 'react-hot-loader'
import ajax from 'libs/ajax'
import util from 'libs/util'
const Option = Select.Option
class ActivityList extends React.Component {
constructor (props) {
super(props)
let self = this
this.state = {
actList: [
],
pagination: {
current: 0,
total: 0,
pageSize: 10,
onChange: this.handleChange.bind(self)
}
}
}
actClone (id) {
Modal.confirm({
title: '确定克隆该活动?',
confirmLoading: true,
onOk: () => {
return ajax({
url: `/basics/activity/clone/${id}`,
method: 'post'
}).then(data => {
message.success('克隆成功')
this.getActList()
}).catch(err => err)
}
})
}
actDelete (id) {
Modal.confirm({
title: '确定删除该活动?',
confirmLoading: true,
okType: 'danger',
onOk: () => {
return ajax({
url: `/basics/activity`,
params: {
id
},
method: 'delete'
}).then(data => {
message.success('删除成功')
this.getActList()
}).catch(err => err)
}
})
}
actPublish (id) {
Modal.confirm({
title: '确定发布该活动?',
confirmLoading: true,
okType: 'success',
onOk: () => {
return ajax({
url: `/basics/activity/publish`,
data: {
id
},
method: 'post'
}).then(data => {
message.success('发布成功')
this.getActList()
}).catch(err => err)
}
})
}
getActList (opts = {
pageIndex: 1
}) {
let { pageSize } = this.state.pagination
let { pageIndex, status } = opts
ajax({
url: 'basics/activity',
params: {
pageIndex,
pageSize: pageSize,
status
}
}).then(res => {
this.setState({
actList: res.lists
})
this.setState(function (prevState) {
prevState.pagination.current = res.pageIndex
prevState.pagination.total = res.count
return {
pagination: prevState.pagination
}
})
}).catch(err => err)
}
handleChange (page, pageSize) {
this.getActList({ pageIndex: page })
}
handleStatusChange (value) {
this.getActList({ pageIndex: this.state.pagination.pageIndex, status: value })
}
componentWillMount () {
this.getActList()
}
copyLink (str) {
util.copyToClipboard(str)
message.success('复制成功')
}
render () {
const { pagination } = this.state
return (
<div>
<div className={'jimu-tools ' + styles.tools}>
<Select
showSearch
style={{ width: 120 }}
placeholder='全部状态'
onChange={this.handleStatusChange.bind(this)}
>
<Option value={0}>全部状态</Option>
<Option value='1'>未发布</Option>
<Option value='2'>已上线</Option>
</Select>
<div className={styles.bars}>
<Button type='primary'><Link to='/activity/edit'>新建活动</Link></Button>
</div>
</div>
<div className='jimu-container'>
<div className={styles.list}>
{
this.state.actList.map(item => {
return (<div className={styles.item} key={item.id}>
<span className={styles.thumb} />
<span className={styles.id}>ID:{item.id}</span>
<span className={styles.revisor}><Icon type='user' />{item.revisor}</span>
<span className={styles.title}>{item.title}</span>
<span className={styles.summary}>#{item.summary}#</span>
<span className={styles.status}>{item.status === 2 ? <span><i className={styles.success} />已发布</span> : <span><i className={styles.failed} />未发布</span>}</span>
<div className={styles.right}>
<Link title='编辑' to={'/activity/edit?id=' + item.id} className={styles.link}>编辑</Link>
<a href={`/api/basics/activity/preview/${item.id}`} target='blank' className={styles.link}>预览</a>
<a href='javascript:;' className={styles.link} onClick={this.actClone.bind(this, item.id)}>克隆</a>
<a href='javascript:;' disabled={item.pageLink ? '' : 'disabled'} className={styles.link} onClick={this.copyLink.bind(this, item.pageLink)}>复制链接</a>
<Button type='primary' className={styles.publish} onClick={this.actPublish.bind(this, item.id)}>发布</Button>
<Button type='danger' className={styles.delete} onClick={this.actDelete.bind(this, item.id)}>删除</Button>
</div>
</div>
)
})
}
</div>
<Pagination className={styles.pagination} showTotal={(total, range) => `当前查看为 ${range[0]} - ${range[1]} , 共 ${total} 个`} onChange={pagination.onChange} current={pagination.current} pageSize={pagination.pageSize} total={pagination.total} />,
</div>
</div>
)
}
}
export default hot(module)(ActivityList)
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
.tools {
padding-top: 20px;
}
.bars {
float: right;
button {
margin-left: 8px;
}
}
.list{
}
.item{
height: 80px;
position: relative;
border-bottom: 1px solid #eaeaea;
span {
display: inline-block;
}
button{
margin-right: 20px;
font-size: 12px;
height: 24px;
}
&:hover{
background:rgba(87,140,254,0.08);
}
}
.thmub{
.size(45,60);
.pos(10,10);
}
.id{
color: #999;
.text(12,20);
.pos(75,5);
}
.revisor{
color: #999;
.text(12,20);
.pos(211,5);
i{
vertical-align: middle;
margin-right: 10px;
}
}
.title{
color: #333;
font-weight: bold;
.text(12,26);
.pos(75,25);
}
.summary{
color: #333;
.text(12,20);
.pos(75,56);
}
.status{
color: #666;
.text(12,20);
.pos(351,30);
i{
.size(8,8);
vertical-align: middle;
margin-right: 8px;
display: inline-block;
border-radius: 50%;
}
.success{
background-color: @success-color;
}
.failed{
background-color: @error-color;
}
}
.right{
position: relative;
.posr(0,0);
}
.link{
display: inline-block;
margin-right: 20px;
font-size: 12px;
line-height: 80px;
text-decoration: none;
}
.pagination{
text-align: center;
padding-top: 50px;
}
\ No newline at end of file
import React, { Component } from 'react'
import { hot } from 'react-hot-loader'
import styles from './index.less'
class guide extends Component {
constructor(props) {
super(props)
this.state = {
origin: window.location.origin
}
}
render() {
return (
<div className={styles.body}>
<div className={styles.content}>
<p className={styles.title}>选择下列功能版本</p>
<a href={`${this.state.origin}/layers#/template`}>创建弹层</a>
<a href={`${this.state.origin}/pro#/home`}>创建落地页</a>
</div>
</div>
)
}
}
export default hot(module)(guide)
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
.body {
width: 100%;
height: 100%;
background-color: @primary-color;
}
.title {
text-align: center;
font-size: 26px;
margin: 70px 0;
color: #fff;
}
.content {
.size(460, 400);
.middle;
text-align: center;
a {
@height: 50;
.size(130, @height);
background-color: #fff;
margin-right: 20px;
color: @primary-color;
display: inline-block;
border-radius: 5px;
line-height: @height*1px;
text-align: center;
font-size: 20px;
}
}
import { hot } from 'react-hot-loader'
import React from 'react'
import { Button, Form, Input, Tabs, message } from 'antd'
import { Controlled as CodeMirror } from 'react-codemirror2'
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/material.css'
import 'codemirror/mode/htmlembedded/htmlembedded'
import 'codemirror/mode/css/css'
import 'codemirror/mode/javascript/javascript'
import ajax from 'libs/ajax'
const FormItem = Form.Item
const TextArea = Input.TextArea
const TabPane = Tabs.TabPane
// import Styles from './index.less'
class layoutEdit extends React.Component {
constructor (props) {
super(props)
this.state = {
formData: {
id: '',
title: '',
summary: '',
template: `<html>
<head>
<title>{{injecttitle}}</title>
{{injectcss}}
</head>
<body>
<div id="app">
{{injecthtml}}
</div>
{{injectjs}}
</body>
</html>`
}
}
}
componentWillMount () {
let { id } = this.props.router.location.query
id && ajax({
url: '/basics/layout',
params: {
id
}
}).then(res => {
let data = res.lists[0]
this.setState(state => {
state.formData = {
id: data.id,
title: data.title,
summary: data.summary,
template: data.template
}
return state
})
})
}
handleSubmit () {
this.props.form.validateFields(
(err) => {
if (!err) {
const formData = this.props.form.getFieldsValue()
const { id, template } = this.state.formData
formData.id = id
formData.template = template
this.saveData(formData)
}
}
)
}
saveData (data) {
ajax({
url: '/basics/layout',
method: data.id ? 'put' : 'post',
data
}).then(res => {
message.success('保存成功')
this.props.router.push('layout')
})
}
// 编辑器改变
handCodeChange (key, value) {
this.setFormData(key, value)
}
// 设置表单值
setFormData (key, value) {
this.setState(prevState => {
let formData = prevState.formData
formData[key] = value
return {
formData
}
})
}
render () {
const { formData } = this.state
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 }
}
const options = {
html: {
mode: 'xml',
htmlMode: true,
theme: 'material',
lineNumbers: true,
tabSize: 2,
autofocus: true
}
}
const { getFieldDecorator } = this.props.form
return (<div><div className='jimu-tools'>
<div className={'jimu-bars'}>
<Button type='primary' onClick={this.handleSubmit.bind(this)}>保存</Button>
</div>
</div><div className='jimu-container'>
<Form onSubmit={this.handleSubmit}>
<FormItem {...formItemLayout} label='标题'>
{getFieldDecorator('title', {
initialValue: formData.title,
rules: [{
required: true, message: '请输入标题'
}]
})(<Input />
)}
</FormItem>
<FormItem {...formItemLayout} label='简介'>
{getFieldDecorator('summary', {
initialValue: formData.summary,
rules: [{
required: true, message: '请输入简介'
}]
})(<TextArea rows='4' />
)}
</FormItem>
<FormItem {...formItemLayout} label='模板代码'>
<Tabs defaultActiveKey='0' tabBarStyle={{ height: '40px' }}>
<TabPane tab='html' key='1'>
<CodeMirror value={formData.template} onBeforeChange={(editor, data, value) => this.handCodeChange('template', value)} options={options.html} />
</TabPane>
</Tabs>
</FormItem>
</Form>
</div></div>
)
}
}
const WrappedApp = Form.create()(layoutEdit)
export default hot(module)(WrappedApp)
import React from 'react'
import { hot } from 'react-hot-loader'
import { Button, Icon, Modal, message } from 'antd'
import { Link } from 'react-router'
import ajax from 'libs/ajax'
import styles from './index.less'
class layoutList extends React.Component {
constructor (props) {
super(props)
this.state = {
list: []
}
}
componentWillMount () {
this.getList()
}
getList () {
ajax({
url: '/basics/layout',
params: {
pageSize: 100
}
}).then(res => {
this.setState(state => {
state.list = res.lists
return state
})
})
}
layoutDelete (id) {
Modal.confirm({
title: `确定删除该模板吗?`,
okType: 'danger',
onOk: () => {
return ajax({
url: '/basics/layout',
method: 'delete',
params: {
id
}
}).then(res => {
message.success('删除成功')
this.getList()
})
},
onCancel() {
}
})
}
render () {
const { list } = this.state
return (<div><div className='jimu-tools'>
<div className={'jimu-bars'}>
<Link to='/layout/edit'><Button type='primary'>新建模板</Button></Link>
</div>
</div><div className='jimu-container'>
{
list && list.map(item => {
return (<div className={styles.item} key={item.id}>
<span className={styles.thumb} />
<span className={styles.id}>ID:{item.id}</span>
<span className={styles.revisor}><Icon type='user' />{item.revisor}</span>
<span className={styles.title}>{item.title}</span>
<span className={styles.summary}>#{item.summary}#</span>
<div className={styles.right}>
<Link title='编辑' to={'/layout/edit?id=' + item.id} className={styles.link}>编辑</Link>
<Button type='danger' className={styles.delete} onClick={this.layoutDelete.bind(this, item.id)}>删除</Button>
</div>
</div>
)
})
}
</div></div>)
}
}
export default hot(module)(layoutList)
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
.item{
height: 80px;
position: relative;
border-bottom: 1px solid #eaeaea;
span {
display: inline-block;
}
button{
margin-right: 20px;
font-size: 12px;
height: 24px;
}
&:hover{
background:rgba(87,140,254,0.08);
}
}
.thmub{
.size(45,60);
.pos(10,10);
}
.id{
color: #999;
.text(12,20);
.pos(75,5);
}
.revisor{
color: #999;
.text(12,20);
.pos(211,5);
i{
vertical-align: middle;
margin-right: 10px;
}
}
.title{
color: #333;
font-weight: bold;
.text(12,26);
.pos(75,25);
}
.summary{
color: #333;
.text(12,20);
.pos(75,56);
}
.status{
color: #666;
.text(12,20);
.pos(351,30);
i{
.size(8,8);
vertical-align: middle;
margin-right: 8px;
display: inline-block;
border-radius: 50%;
}
.success{
background-color: @success-color;
}
.failed{
background-color: @error-color;
}
}
.right{
position: relative;
.posr(0,0);
}
.link{
display: inline-block;
margin-right: 20px;
font-size: 12px;
line-height: 80px;
text-decoration: none;
}
import React from 'react'
import { hot } from 'react-hot-loader'
import ajax from 'libs/ajax'
import { Form } from 'antd'
import styles from './index.less'
class NormalLoginForm extends React.Component {
constructor (props) {
super(props)
const href = window.location.href
this.state = {
origin: window.location.origin,
isTest: href.indexOf('test') > -1 || href.indexOf('dev') > -1 || href.indexOf('localhost') > -1 || href.indexOf('127.0.0.1') > -1
}
}
handleSubmit (e) {
e.preventDefault()
this.props.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values)
}
})
}
componentWillMount () {
ajax({
url: '/system/user'
}).then(user => {
this.props.router.push('/')
}).catch(err => err)
}
render () {
return (
<div className={styles.login}>
<div className={styles.loginBody}>
<p className={styles.title}>选择下列登录方式</p>
<a className={styles.item} href={`http://sso.duiba${this.state.isTest ? 'test' : ''}.com.cn/login?redirect=${this.state.origin}/basics&systemId=29`}>SSO</a>
</div>
</div>
)
}
}
const login = Form.create()(NormalLoginForm)
export default hot(module)(login)
@import '~assets/styles/mixins.less';
@import '~assets/styles/theme.less';
.login{
width: 100%;
height: 100%;
background-color: @primary-color;
.loginBody{
.size(460,400);
border-radius: 5px;
.middle;
text-align: center;
}
.title{
text-align: center;
font-size: 26px;
margin: 70px 0;
color: #fff;
}
.item{
display: inline-block;
.size(60,60);
line-height: 60px;
font-size: 20px;
display: inline-block;
text-align: center;
border-radius: 50%;
color: #999;
background-color: #fff;
}
}
\ No newline at end of file
import React from 'react'
import { Tag, Button, Input, Modal } from 'antd'
import { hot } from 'react-hot-loader'
import styles from './index.less'
import ajax from 'libs/ajax'
class PluginCate extends React.Component {
constructor (props) {
super(props)
this.state = {
showEdit: false,
data: {},
cateList: []
}
}
componentWillMount () {
this.getCate()
}
getCate () {
ajax({
url: 'basics/cate',
params: {
pageSize: 100
}
}).then(res => {
this.setState({
cateList: res.lists
})
}).catch(err => err)
}
getColor () {
const colors = ['magenta', 'red', 'volcano', 'orange', 'gold', 'lime', 'green', 'cyan', 'blue', 'geekblue', 'purple']
return colors[parseInt(Math.random() * colors.length)]
}
toggleEdit (show) {
this.setState(prevState => ({
showEdit: show
}))
}
handleChange = (e) => {
let value = e.target.value
this.setState(preState => {
preState.data.title = value
return {
data: preState.data
}
})
}
handleCancel = (e) => {
this.setState({
showEdit: false
})
}
handleEdit = (data) => {
this.toggleEdit(true)
this.setState({
data: Object.assign({}, data)
})
}
handleSave = () => {
const { data } = this.state
ajax({
url: 'basics/cate',
method: data.id ? 'put' : 'post',
data: data
}).then(res => {
this.setState({
showEdit: false,
data: {}
})
this.getCate()
}).catch(err => err)
}
render () {
const { cateList, showEdit, data } = this.state
return (
<div>
<div className='jimu-tools'>
<div className={styles.bars}>
<Button type='primary' onClick={this.handleEdit.bind(this, {})}>添加分类</Button>
</div>
</div>
<div className='jimu-container'>
{
cateList.length === 0 ? null : cateList.map(item => <Tag color={this.getColor()} key={item.id} onClick={e => this.handleEdit(item, e)}>{item.title}</Tag>)
}
</div>
<Modal
title='添加分类'
visible={showEdit}
onCancel={this.handleCancel}
onOk={this.handleSave}>
<Input value={data.title} onChange={e => this.handleChange(e)} />
</Modal>
</div>
)
}
}
export default hot(module)(PluginCate)
@import '~assets/styles/mixins.less';
.bars {
float: right;
button {
margin-left: 8px;
}
}
\ No newline at end of file
import React from 'react'
import { Form, Select, Button, Input, Tabs, Upload, Icon, message } from 'antd'
import styles from './index.less'
import { hot } from 'react-hot-loader'
import ajax from 'libs/ajax'
import { Controlled as CodeMirror } from 'react-codemirror2'
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/material.css'
import 'codemirror/mode/htmlembedded/htmlembedded'
import 'codemirror/mode/css/css'
import 'codemirror/mode/javascript/javascript'
const Option = Select.Option
const FormItem = Form.Item
const TabPane = Tabs.TabPane
const TextArea = Input.TextArea
class PluginEdit extends React.Component {
constructor (props) {
super(props)
this.state = {
formData: {
id: 0,
cateId: 0,
title: '',
summary: '',
html: '<p>这是一个示例内容</p>',
css: 'body{background-color:#fff;}',
js: 'console.log(opts);',
config: `[{"title": "测试配置项","type": "string","key": "demo"}]`,
thumb: ''
},
cateList: [],
pluginId: props.params.id
}
}
// 初始化数据
componentWillMount () {
this.getCateList()
if (this.state.pluginId !== '0') {
this.getComponentInfo(this.state.pluginId)
}
}
beforeUpload (file) {
const isLt2M = file.size / 1024 / 1024 < 2
if (!isLt2M) {
message.error('文件不能超过2mb')
}
return isLt2M
}
// 获取插件信息
getComponentInfo (pluginId) {
ajax({
url: 'basics/component',
params: {
id: pluginId
}
}).then(res => {
this.props.form.setFieldsValue({
cateId: res.lists[0].cateId
})
this.setState({
formData: res.lists[0]
})
}).catch(err => err)
}
// 保存插件信息
saveComponentInfo (data) {
ajax({
url: 'basics/component',
method: data.id ? 'put' : 'post',
data: data
}).then(res => {
message.info('保存成功')
this.props.router.push('plugin')
}).catch(err => err)
}
// 获取分类
getCateList () {
ajax({
url: 'basics/cate',
params: {
pageSize: 100
}
}).then(res => {
this.setState({
cateList: res.lists
})
}).catch(err => err)
}
// 获取分类名称
getCateName (cateList, id) {
let name = '请选择类别'
cateList.forEach(item => {
if (item.id === id) {
name = item.title
}
})
return name
}
// 保存
handleSubmit () {
this.props.form.validateFields(
(err) => {
if (!err) {
const formData = this.props.form.getFieldsValue()
formData.html = this.state.formData.html
formData.css = this.state.formData.css
formData.js = this.state.formData.js
formData.config = this.state.formData.config
formData.thumb = this.state.formData.thumb
if (this.state.pluginId !== '0') {
formData.id = parseInt(this.state.pluginId)
}
this.saveComponentInfo(formData)
}
}
)
}
// 编辑器改变
handCodeChange (key, value) {
this.setFormData(key, value)
}
// 设置表单值
setFormData (key, value) {
this.setState(prevState => {
let formData = prevState.formData
formData[key] = value
return {
formData
}
})
}
// 上传
handleUpload (res) {
if (res.file.response && res.file.response.code === 0) {
this.setFormData('thumb', res.file.response.data)
} else if (res.file.response && res.file.response.msg) {
message.error(res.file.response.msg)
}
}
render () {
const { getFieldDecorator } = this.props.form
const options = {
html: {
mode: 'xml',
htmlMode: true,
theme: 'material',
lineNumbers: true,
tabSize: 2,
autofocus: true
},
css: {
mode: 'css',
theme: 'material',
lineNumbers: true,
tabSize: 2
},
js: {
mode: 'javascript',
theme: 'material',
lineNumbers: true,
tabSize: 2
},
config: {
mode: 'javascript',
theme: 'material',
lineNumbers: true,
tabSize: 2
}
}
const formData = this.state.formData
const cateList = this.state.cateList
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 }
}
return (
<div>
<div className='jimu-tools'>
<div className={styles.bars}>
<Button type='primary' onClick={this.handleSubmit.bind(this)}>保存</Button>
</div>
</div>
<div className='jimu-container'>
<div>
<Form onSubmit={this.handleSubmit}>
<FormItem label='所属类别' {...formItemLayout}>
{getFieldDecorator('cateId', {
rules: [{ required: true, message: '请选择插件类别' }]
})(
<Select
placeholder='所属类别'
>
{
cateList.map(item => {
return (
<Option key={item.id} value={item.id}>{item.title}</Option>
)
})
}
</Select>
)}
</FormItem>
<FormItem label='插件名称' {...formItemLayout}>
{getFieldDecorator('title', {
initialValue: formData.title,
rules: [{ required: true, message: '请输入插件名称' }]
})(
<Input placeholder='请输入插件名称' />
)}
</FormItem>
<FormItem label='插件描述' {...formItemLayout}>
{getFieldDecorator('summary', {
initialValue: formData.summary,
rules: [{ required: true, message: '请输入插件描述' }]
})(
<TextArea rows={4} placeholder='请输入插件描述' />
)}
</FormItem>
<FormItem label='封面图' {...formItemLayout}>
<Upload name='file'
beforeUpload={this.beforeUpload}
onChange={this.handleUpload.bind(this)}
action='/api/system/upload'
showUploadList={false}
listType='picture'>
<Button>
<Icon type='upload' /> 上传缩略图
</Button>
</Upload>
{formData.thumb ? <div style={{ width: '300px', marginTop: '20px' }}><img style={{ width: '100%' }} alt='thumb' src={formData.thumb} /></div> : ''}
</FormItem>
<FormItem label='相关代码' {...formItemLayout}>
<Tabs defaultActiveKey='0' tabBarStyle={{ height: '40px' }}>
<TabPane tab='html' key='1'>
<CodeMirror value={formData.html} onBeforeChange={(editor, data, value) => this.handCodeChange('html', value)} options={options.html} />
</TabPane>
<TabPane tab='css' key='2'>
<CodeMirror value={formData.css} onBeforeChange={(editor, data, value) => this.handCodeChange('css', value)} options={options.css} />
</TabPane>
<TabPane tab='js' key='3'>
<CodeMirror value={formData.js} onBeforeChange={(editor, data, value) => this.handCodeChange('js', value)} options={options.js} />
</TabPane>
<TabPane tab='config' key='4'>
<CodeMirror value={formData.config} onBeforeChange={(editor, data, value) => this.handCodeChange('config', value)} options={options.config} />
</TabPane>
</Tabs>
</FormItem>
</Form>
</div>
</div>
</div>
)
}
}
const WrappedApp = Form.create()(PluginEdit)
export default hot(module)(WrappedApp)
@import '~assets/styles/mixins.less';
.bars {
float: right;
button {
margin-left: 8px;
}
}
\ No newline at end of file
import React from 'react'
import { Link } from 'react-router'
import { Button, Select, Row, Modal, message } from 'antd'
import styles from './index.less'
import { hot } from 'react-hot-loader'
import PluginItem from 'basics/components/pluginItem/index'
import ajax from 'libs/ajax'
const Option = Select.Option
class PluginList extends React.Component {
constructor (props) {
super(props)
this.state = {
cateList: [],
componentList: []
}
}
// 初始化数据
componentWillMount () {
this.getCateList()
this.getComponentList()
}
// 获取分类
getCateList () {
ajax({
url: 'basics/cate',
params: {
pageSize: 100
}
}).then(res => {
this.setState({
cateList: res.lists
})
}).catch(err => err)
}
// 获取列表
getComponentList (opts = {}) {
let { cateId } = opts
ajax({
url: 'basics/component',
params: {
pageSize: 100,
cateId: cateId || ''
}
}).then(res => {
this.setState({
componentList: res.lists
})
}).catch(err => err)
}
// 筛选
handleCateChange (value) {
this.getComponentList({
cateId: value
})
}
// 删除一个组件
pluginRemove (id) {
Modal.confirm({
title: '确定删除该插件?',
confirmLoading: true,
okType: 'danger',
onOk: () => {
return ajax({
url: `/basics/component`,
params: {
id
},
method: 'delete'
}).then(data => {
message.success('删除成功')
this.getComponentList()
}).catch(err => err)
}
})
}
render () {
const { cateList } = this.state
return (
<div>
<div className='jimu-tools'>
<Select
style={{ width: 120 }}
placeholder='全部类别'
onChange={this.handleCateChange.bind(this)}
>
<Option value={0} key={0}>全部类别</Option>
{cateList.map(item => <Option value={item.id} key={item.id}>{item.title}</Option>)}
</Select>
<div className={styles.bars}>
<Button type='primary'><Link to='/plugin/edit/0'>新建</Link></Button>
</div>
</div>
<div style={{ padding: '10px 0' }}>
<Row gutter={16}>
{
this.state.componentList.map((item) => {
return (
<PluginItem item={item} remove={this.pluginRemove} key={item.id} />
)
})
}
</Row>
</div>
</div>
)
}
}
export default hot(module)(PluginList)
@import '~assets/styles/mixins.less';
.bars {
float: right;
button {
margin-left: 8px;
}
}
.gutter {
margin-bottom: 30px;
& > div {
position: relative;
left: 50%;
transform: translate(-50%);
}
}
\ No newline at end of file
<html>
<head>
<title>积木平台</title>
</head>
<body>
<div id="app">
</div>
</body>
</html>
\ No newline at end of file
import React from 'react'
import {
render
} from 'react-dom'
import {
Router,
hashHistory
} from 'react-router'
import 'assets/styles/admin.less'
import routes from './routes'
import { LocaleProvider } from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN'
render(<LocaleProvider locale={zhCN}><Router history={hashHistory} routes={routes} /></LocaleProvider>, document.getElementById('app'))
import app from './app'
import container from './container'
const routes = [
{
path: '/',
component: container,
getIndexRoute (partialNextState, callback) {
require.ensure([], function (require) {
callback(null, {
component: require('./containers/guide/index').default
})
})
},
childRoutes: [{
path: '/',
component: app,
childRoutes: [
{
path: 'activity',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/activity/list/index').default)
})
}
}, {
path: 'plugin',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/plugin/list/index').default)
})
}
}, {
path: 'plugin/edit/:id',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/plugin/edit/index').default)
})
}
}, {
path: 'plugin/cate',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/plugin/cate/index').default)
})
}
}, {
path: 'layout',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/layout/list/index').default)
})
}
}, {
path: 'layout/edit',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/layout/edit/index').default)
})
}
}
]
}, {
path: 'login',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/login/index').default)
})
}
}, {
path: 'activity/edit',
getComponents (nextState, callback) {
require.ensure([], function (require) {
callback(null, require('./containers/activity/edit/index').default)
})
}
}]
}
]
export default routes
import 'render/libs/animate'
import 'render/libs/loader'
import 'render/libs/checkwebp' // 判断是否支持webp
import './components/renderButtuon' // 按钮控件
import './components/renderImage' // 图片控件
import './components/renderTurnCircle' // 大转盘控件
import './components/renderPopup' // 弹层控件
import './components/renderWechat' // 微信控件
import './components/renderMobile' // 电话控件
import './components/renderCarousel' // 轮播控件
import './components/renderText' // 文字控件
import './components/renderAddress' // 地址控件
import './components/renderForm' // 表单控件
import './components/renderDownload' // 下载控件
import './components/renderCountdown' // 倒计时控件
import './components/renderCounter' // 计数器控件
import './components/renderQRCode'; // 二维码
\ No newline at end of file
import Util from 'render/libs/utils';
// import Loader from 'src/lib/loader';
(function($) {
class RenderAddress {
constructor(result, index, isProps) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.number = index
this.isProps = isProps
this.address = 'https://webapi.amap.com/maps?v=1.4.8&key=13b7051cc83cc78dcfa7bb094256139c'
this.style = ''
this.map = ''
this.init()
}
init() {
let addressElem = $(`<div class="address-wrap${this.number}"><div id="land-address${this.number}"></div><div class="address-title"></div></div>`)
$('.land_wrap').append(addressElem)
// this.renderStyle();
this.event()
}
renderStyle() {
let {
style
} = this.options;
let {
showType
} = this.options.address;
let styleCss = Object.assign({},
Util.transformCss(style, this.isProps), { 'position': 'absolute' })
$(`.address-wrap${this.number}`).css(styleCss)
$(`#land-address${this.number}`).css({
'position': 'absolute',
'top': 0,
'left': 0,
'width': Util.fitSize(style.width, this.isProps),
'height': Util.fitSize(style.height, this.isProps)
})
let styleAddress = Object.assign({},
Util.transformCss(this.options.address.style, this.isProps), { 'position': 'absolute' })
$(`.address-wrap${this.number} .address-title`).text(this.options.address.text)
$(`.address-wrap${this.number} .address-title`).css(styleAddress)
if (showType === 2) {
$(`.address-wrap${this.number} .address-title`).css('top', Util.fitSize('4px', this.isProps))
} else {
$(`.address-wrap${this.number} .address-title`).css('bottom', Util.fitSize('4px', this.isProps))
}
}
event() {
let self = this
let {
lnglat
} = this.options
window.Loader.async([self.address], function() {
self.map = new window.AMap.Map(`land-address${self.number}`, {
center: lnglat,
zoom: 11
})
self.marker = new window.AMap.Marker({
icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
position: lnglat
})
self.marker.setMap(self.map)
self.map.setZoomAndCenter(14, lnglat)
self.renderStyle()
})
}
}
window.TA.RenderAddress = RenderAddress
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils'
import { NETVeify, buryAOId } from 'render/libs/helper'
import { commonJumpLogic } from 'render/libs/common'
import pp from 'render/libs/popup'
;(function($) {
class RenderButton {
constructor(result, index, isProps, elementConfig, selector) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIphone = navigator.userAgent.indexOf('iPhone') !== -1
this.number = index
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
this.yidun = '//cstaticdun.126.net/load.min.js'
this.$mountNode = $(selector || '.land_wrap')
this.init()
}
init() {
let buttonElem = $(`<div class="land-button${this.number}"></div>`)
this.$mountNode.append(buttonElem)
this.renderStyle()
this.event()
// this.initPopup()
}
initPopup() {
let { type, popupId } = this.options.jump
if (type === 'popup') {
this.elementConfig &&
this.elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(
item,
index,
this.isProps,
this.elementConfig
).showPopup()
$('.land_wrap').css('height', $(window).height())
}
})
}
}
clickjump() {
let { name, picValid } = this.options
let extraParam = {}
picValid && (extraParam.sliderVerify = 1)
commonJumpLogic({
componentData: this.options,
jump: this.options.jump,
options: { location: name, ...extraParam },
popupCallback: () => {
this.initPopup()
}
})
}
renderStyle() {
let { height } = this.options.style
let { fixed, animation } = this.options
let duration = animation && animation.duration
let styleCss = Object.assign(
{},
Util.transformCss(this.options.style, this.isProps),
{
position: fixed === 0 ? 'absolute' : 'fixed',
'background-repeat': 'no-repeat',
'line-height': Util.fitSize(height, this.isProps)
},
{
animation: `scaleAnim ${duration}ms linear infinite alternate`
}
)
let selector = `.land-button${this.number}`
$(selector).css(styleCss)
$(selector).text(this.options.text)
}
event() {
let { picValid, styleMode, multiStyle } = this.options
let self = this
const selector = `.land_wrap .land-button${this.number}`
// 如果是跳转下载链接则埋唯一id
if (self.options.jump.type === 'link') {
buryAOId(selector)
}
$(selector).on('click', function() {
if (styleMode === 3) {
let ClickBackgroundImage = multiStyle.click.backgroundImage
if (ClickBackgroundImage) {
$(this).css({
backgroundImage: ClickBackgroundImage
})
}
}
if (picValid === 0) {
self.clickjump()
} else if (picValid === 1) {
NETVeify().then(self.clickjump.bind(self), () => {
pp.note('校验失败', {
mask: false,
closeTime: 2000
})
})
}
})
}
}
window.TA.RenderButton = RenderButton
})(Zepto)
import Swiper from 'swiper'
import '../../../../../node_modules/swiper/dist/css/swiper.min.css'
import Util from 'render/libs/utils';
(function($) {
class RenderCarousel {
constructor(result, index, isProps) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.number = index
this.isProps = isProps
this.style = ''
this.init()
}
init() {
let {
sliders
} = this.options
let carouselEle = `<div class="swiper-container${this.number}">
<div class="swiper-wrapper"></div>
</div>`
$('.land_wrap').append(carouselEle)
sliders && sliders.forEach((item, index) => {
if (typeof ''.ossimg === 'function' && item.src.indexOf('.gif') === -1) {
item.src = item.src.ossimg()
}
$(`.swiper-container${this.number} .swiper-wrapper`).append(`<div class="swiper-slide" src=${item.src} id=${item.id}></div>`)
})
this.renderStyle()
this.event()
}
renderStyle() {
let {
style,
fixed,
wrapStrategy
} = this.options
let styleCss = Object.assign({},
Util.transformCss(style, this.isProps), { 'position': fixed === 0 ? 'absolute' : 'fixed' }, { 'overflow': 'hidden' })
$(`.swiper-container${this.number}`).css(styleCss)
$(`.swiper-container${this.number} .swiper-slide`).each(function(index, ele) {
$(this).css({ 'background-image': 'url(' + $(this).attr('src') + ')', 'background-repeat': 'no-repeat', 'background-size': wrapStrategy })
})
}
event() {
let {
direction,
autoplay
} = this.options
new Swiper(`.swiper-container${this.number}`, {
direction,
autoplay: autoplay.enable === 0 ? false : autoplay,
loop: true
})
}
}
window.TA.RenderCarousel = RenderCarousel
})(Zepto)
import Util from 'render/libs/utils'
import { getDayStr, getTimeStr } from 'render/libs/helper'
let dayStr = getDayStr(new Date()) + ' '
let curryChange = (originalStr = '00:00:00', dstStr = '00:00:50') => {
let originDate = new Date(dayStr + originalStr)
let dstDate = new Date(dayStr + dstStr)
return step => {
return () => {
originDate = new Date(originDate.getTime() + 1000 * step)
if (step > 0) {
// 增加逻辑
return getTimeStr(originDate <= dstDate ? originDate : dstDate)
} else {
return getTimeStr(originDate >= dstDate ? originDate : dstDate)
}
}
}
}
(function($) {
class RenderCountdown {
constructor(result, index, isProps, elementConfig) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIphone = navigator.userAgent.indexOf('iPhone')
this.number = index
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
// curry方式定义plus和subtract操作
let { start, end } = this.options
this.add = curryChange(start, end)(1)
this.remove = curryChange(start, end)(-1)
this.init()
}
init() {
let countdownEle = $(`<div class="land-countdown${this.number}"><div class="land-countdown-wrap"></div></div>`)
$('.land_wrap').append(countdownEle)
this.renderStyle()
this.event()
}
renderStyle() {
let {
start,
style,
fixed
} = this.options
let {
verticalAlign
} = this.options.style
let styleCss = Object.assign({},
Util.transformCss(style, this.isProps), { 'position': !fixed ? 'absolute' : 'fixed' }, { 'display': 'table' })
$(`.land-countdown${this.number}`).css(styleCss)
$(`.land-countdown${this.number} .land-countdown-wrap`).text(start)
$(`.land-countdown${this.number} .land-countdown-wrap`).css({
'display': 'table-cell',
'vertical-align': verticalAlign
})
}
event() {
// 绑定事件
// 判断是增加还是减少
let {
start,
end
} = this.options
let value = null
let timer = setInterval(() => {
let next
// 这里巧借字符串逐位比对ASCII码的方式判断大小
if (start <= end) {
next = this.add()
} else {
next = this.remove()
}
if (value === next) {
clearInterval(timer)
} else {
value = next
$(`.land-countdown${this.number} .land-countdown-wrap`).text(next)
}
}, 999)
}
}
window.TA.RenderCountdown = RenderCountdown
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils'
(function($) {
class RenderCounter {
constructor(result, index, isProps, elementConfig) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIphone = navigator.userAgent.indexOf('iPhone')
this.number = index
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
let { start, end } = this.options
this.add = () => start + 1 <= end ? ++start : end
this.remove = () => start - 1 >= end ? --start : end
this.init()
}
init() {
let counterEle = $(`<div class="land-counter${this.number}"><div class="land-counter-wrap"></div></div>`)
$('.land_wrap').append(counterEle)
this.renderStyle()
this.event()
}
renderStyle() {
let {
start,
style,
fixed
} = this.options
let {
verticalAlign
} = this.options.style
let styleCss = Object.assign({},
Util.transformCss(style, this.isProps), { 'position': !fixed ? 'absolute' : 'fixed' }, { 'display': 'table' })
$(`.land-counter${this.number}`).css(styleCss)
$(`.land-counter${this.number} .land-counter-wrap`).text(start)
$(`.land-counter${this.number} .land-counter-wrap`).css({
'display': 'table-cell',
'vertical-align': verticalAlign
})
}
event() {
// 判断是增加还是减少
let {
start,
end
} = this.options
let value = null
let timer = setInterval(() => {
let next
// 这里巧借字符串逐位比对ASCII码的方式判断大小
if (start <= end) {
next = this.add()
} else {
next = this.remove()
}
if (value === next) {
clearInterval(timer)
} else {
value = next
$(`.land-counter${this.number} .land-counter-wrap`).text(next)
}
}, 999)
}
}
window.TA.RenderCounter = RenderCounter
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils';
import { NETVeify, buryAOId } from 'render/libs/helper'
import pp from 'render/libs/popup'
import { commonJumpLogic } from 'render/libs/common'
(function($) {
class RenderDownload {
constructor(result, index, isProps, elementConfig) {
let defaultValue = {
style: {}
}
this.style = '';
this.options = $.extend(true, defaultValue, result);
this.number = index;
this.isProps = isProps;
this.elementConfig = elementConfig;
this.init()
}
init() {
let downloadElem = $(`<div class="download${this.number}">
</div>`)
$('.land_wrap').append(downloadElem)
this.renderStyle()
this.event()
}
renderStyle() {
// let isFixed = this.options.fixed
let {
type
} = this.options.fixed
let styleCss = Object.assign({},
Util.transformCss(this.options.style, this.isProps), {
'position': 'fixed'
}
)
$(`.download${this.number}`).css(styleCss)
$('head').append('<style>' + this.style + '</style>')
}
initPopup() {
let {
type,
popupId
} = this.options.jump
if (type === 'popup') {
this.elementConfig && this.elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(item, index, this.isProps, this.elementConfig).showPopup();
$('.land_wrap').css('height', $(window).height());
}
})
}
}
clickjump() {
let { name } = this.options
commonJumpLogic({
componentData: this.options,
jump: this.options.jump,
options: { location: name },
popupCallback: () => { this.initPopup() }
})
}
event() {
let { type } = this.options.jump
let self = this
let { picValid } = this.options
const selector = `.land_wrap .download${this.number}`
// 如果是跳转下载链接则埋唯一id
if (type === 'link') {
buryAOId(selector)
}
$(selector).on('click', function() {
if (picValid) {
NETVeify().then(self.clickjump.bind(self), () => {
pp.note('校验失败', {
mask: false,
closeTime: 2000
})
})
} else {
self.clickjump()
}
})
}
}
window.TA.RenderDownload = RenderDownload
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils'
import Verify from '../verify'
import pp from 'render/libs/popup'
import area from 'render/libs/area'
import { commonJumpLogic } from 'render/libs/common'
import { NETVeify, buryAOId } from 'render/libs/helper'
// import '../rolldate.css';
// var rolldate = require('../rolldate.js');
const alertError = ({ msg = '校验失败' } = {}) => {
pp.note(msg, {
mask: false,
closeTime: 1000
})
}
const optionsGen=(opts)=>opts.reduce((acc,opt)=>acc+=`<option value="${opt}">${opt}</option>`,'')
;
(function($) {
class RenderForm {
constructor(result, index, isProps, elementConfig) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIpone = navigator.userAgent.indexOf('iPhone')
this.number = index
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
this.dataLength = 0
this.isClick = false
this.init()
}
init() {
this.renderDom()
this.renderStyle()
this.event()
// this.initPopup()
}
getSelect(type, item, contentType) {
switch (type) {
case 'sex':
return `<select id=${type} class="land-form-select sex" required=${item.required} >
<option value="男">男</option>
<option value="女">女</option>
</select>`
case 'address':
return contentType === 'justify' ? `<div class="land-form-select">
<select id="s_city" name="s_city" required=${item.required} >
</select>
<select id="s_province" name="s_province" required=${item.required} >
</select>
</div>` :
`<div class="land-form-select">
<select id="s_province" name="s_province" required=${item.required} >
</select>
<select id="s_city" name="s_city" required=${item.required} >
</select>
</div>`
case 'date':
return `<div class="land-form-select land-form-select-date">
<input type="text" readonly required=${item.required} id="land-date" placeholder=${item.placeholder} style="border: none">
</div>`
case 'time':
return `<div class="land-form-select land-form-select-time">
<input type="text" readonly id="land-time" required=${item.required} placeholder=${item.placeholder} style="border: none">
</div>`
case 'customize':
return `<select id=select-${type} data-title="${item.title}" class="land-form-select" required=${item.required} >
<option value="" disabled selected hidden>${item.placeholder}</option>
${optionsGen(item.options||[])}
</select>`
}
}
getradio(options, item2) {
let { arrangement } = item2;
let radions = options ? options.split('\n') : []
let readioDom = ''
let id = `radio-${this.number}`
if (arrangement === 'vertical') {
radions &&
radions.forEach((item, index) => {
readioDom += `<div class="radio" checked='0' required=${item2.required} title=${item2.title}><input id="${id}-${index}" name='radio' type="radio" value="${item}" /><label for="${id}-${index}">${item}</label></div>`
})
return readioDom
} else if (arrangement === 'horizontal') {
radions &&
radions.forEach((item, index) => {
readioDom += `<div class="radio horizontalRadio" checked='0' required=${item2.required} title=${item2.title}><input id="${id}-${index}" name='radio' type="radio" value="${item}" /><label for="${id}-${index}">${item}</label></div>`
})
return readioDom
}
}
getcheckbox(options, item2) {
let checkbox = options ? options.split('\n') : []
let checkboxDom = ''
let id = `checkbox-${this.number}`
checkbox &&
checkbox.forEach((item, index) => {
checkboxDom += `<div class="checkbox" checked='0' required=${item2.required} title=${item2.title}><input id="${id}-${index}" name='name${index}' type="checkbox" status='0' value=${item} /><label for="${id}-${index}">${item}</label></div>`
})
return checkboxDom
}
renderDom() {
let formSingEle = ''
let { controlSetting } = this.options
let { layout } = this.options.baseContent
this.dataLength = controlSetting && controlSetting.length
let formEle = `<div class="land-form${this.number}">
<div class="land-form-top"></div>
<div class="land-form-bottom"></div>
</div>`
controlSetting &&
controlSetting.forEach((item, index) => {
if (layout === 'left') {
if (item.type === 'input') {
formSingEle += `${
item.childType === 'mobile' && item.sendVerifyCode === 1
? `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>
<div class="land-form-item clearfix">
<div class="land-form-label">验证码</div>
<div class="land-form-input">
<input id="concode" class="land-code" placeholder="请输入验证码" />
<div class="code-btn" id="yzmbtn">获取验证码</div>
</div>
</div>`
: `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" maxlength=${item.childType === 'normal' ? 20 : null} placeholder=${item.placeholder} required=${item.required} />
</div>`
}`
} else if (item.type === 'select') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
${this.getSelect(item.childType, item)}
</div>`
} else if (item.type === 'radio') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-radio">
${this.getradio(item.options, item)}
</div>
</div>`
} else if (item.type === 'checkbox') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-checkbox">
${this.getcheckbox(item.options, item)}
</div>
</div>`
} else if (item.type === 'textarea') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-textarea">
<textarea required=${item.required} maxlength=${200} placeholder=${item.placeholder} rows="3" cols="20" title=${item.title}></textarea>
</div>
</div>`
}
} else if (layout === 'justify') {
if (item.type === 'input') {
formSingEle += `${item.childType === 'mobile' && item.sendVerifyCode === 1
? `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>
<div class="land-form-item clearfix">
<div class="land-form-label">验证码</div>
<div class="land-form-input">
<input id="concode" class="land-code" placeholder="请输入验证码" />
<div class="code-btn" id="yzmbtn">获取验证码</div>
</div>
</div>`
: `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>`
}`
} else if (item.type === 'select') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
${this.getSelect(item.childType, item, 'justify')}
</div>`
} else if (item.type === 'radio') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-radio">
${this.getradio(item.options, item)}
</div>
</div>`
} else if (item.type === 'checkbox') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-checkbox">
${this.getcheckbox(item.options, item)}
</div>
</div>`
} else if (item.type === 'textarea') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-textarea">
<textarea required=${item.required} placeholder=${item.placeholder} rows="3" cols="20" title=${item.title}></textarea>
</div>
</div>`
}
} else if (layout === 'vertical') {
if (item.type === 'input') {
formSingEle += `${
item.childType === 'mobile' && item.sendVerifyCode === 1
? `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>
<div class="land-form-item clearfix">
<div class="land-form-label">验证码</div>
<div class="land-form-input">
<input id="concode" class="land-code" placeholder="请输入验证码" />
<div class="code-btn" id="yzmbtn">获取验证码</div>
</div>
</div>`
: `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>`
}`
} else if (item.type === 'select') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
${this.getSelect(item.childType, item)}
</div>`
} else if (item.type === 'radio') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-radio">
${this.getradio(item.options, item)}
</div>
</div>`
} else if (item.type === 'checkbox') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-checkbox">
${this.getcheckbox(item.options, item)}
</div>
</div>`
} else if (item.type === 'textarea') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-textarea">
<textarea required=${item.required} placeholder=${item.placeholder} rows="3" cols="20" title=${item.title}></textarea>
</div>
</div>`
}
} else if (layout === 'no-title') {
if (item.type === 'input') {
formSingEle += `${
item.childType === 'mobile' && item.sendVerifyCode === 1
? `<div class="land-form-item clearfix">
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>
<div class="land-form-item clearfix">
<div class="land-form-input">
<input id="concode" class="land-code" placeholder="请输入验证码" />
<div class="code-btn" id="yzmbtn">获取验证码</div>
</div>
</div>`
: `<div class="land-form-item">
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} />
</div>`
}`
} else if (item.type === 'select') {
formSingEle += `<div class="land-form-item clearfix">
${this.getSelect(item.childType, item)}
</div>`
} else if (item.type === 'radio') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-radio">
${this.getradio(item.options, item)}
</div>
</div>`
} else if (item.type === 'checkbox') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-checkbox">
${this.getcheckbox(item.options, item)}
</div>
</div>`
} else if (item.type === 'textarea') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-textarea">
<textarea required=${item.required} placeholder=${item.placeholder} rows="3" cols="20" title=${item.title}></textarea>
</div>
</div>`
}
} else if (layout === 'icon') {
if (item.type === 'input') {
formSingEle += `${
item.childType === 'mobile' && item.sendVerifyCode === 1
? `<div class="land-form-item clearfix">
<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone"></i></div>
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>
<div class="land-form-item clearfix">
<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_Verifi"></i></div>
<div class="land-form-input">
<input id="concode" class="land-code" placeholder="请输入验证码" />
<div class="code-btn" id="yzmbtn">获取验证码</div>
</div>
</div>`
: `<div class="land-form-item clearfix">
${
item.childType === 'name'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_user"></i></div>`
: item.childType === 'normal'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_input"></i></div>`
: item.childType === 'email'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_email"></i></div>`
: item.childType === 'idcard'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_id"></i></div>`
: item.childType === 'mobile'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone"></i></div>`
: ''
}
<input id=${item.childType} class="land-form-input" placeholder=${item.placeholder} required=${item.required} />
</div>`
}`
} else if (item.type === 'select') {
formSingEle += `<div class="land-form-item clearfix">
${
item.childType === 'sex'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_Sex"></i></div>`
: item.childType === 'address'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_addres"></i></div>`
: item.childType === 'date'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_day"></i></div>`
: item.childType === 'time'
? `<div class="land-form-label land-form-newLabel"><i class="iconfont icon-system_phone_time"></i></div>`
: null
}
${this.getSelect(item.childType, item)}
</div>`
} else if (item.type === 'radio') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-radio">
${this.getradio(item.options, item)}
</div>
</div>`
} else if (item.type === 'checkbox') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-checkbox">
${this.getcheckbox(item.options, item)}
</div>
</div>`
} else if (item.type === 'textarea') {
formSingEle += `<div class="land-form-item clearfix">
<div class="land-form-label">${item.title}</div>
<div class="land-form-textarea">
<textarea required=${item.required} placeholder=${
item.placeholder
} rows="3" cols="20" title=${item.title}></textarea>
</div>
</div>`
}
}
})
$('.land_wrap').append(formEle)
$(`.land_wrap .land-form${this.number} .land-form-top`).append(
formSingEle
)
let $province = $(`.land-form${this.number} #s_province`).length
if($province) {
area([`s_province`, `s_city`]);
}
// area();
}
renderStyle() {
let { style } = this.options
let { text, dis } = this.options.submitVerify
let { layout } = this.options.baseContent
let styleCss = Object.assign({}, Util.transformCss(style, this.isProps), {
position: 'absolute',
'font-size': `${Util.fitSize(14, this.isProps)}`
})
let buttonStyle = Object.assign(
{},
Util.transformCss(this.options.submitVerify.style, this.isProps)
)
let formStyle = Object.assign(
{},
Util.transformCss(this.options.baseContent.style, this.isProps)
)
$(`.land_wrap .land-form${this.number}`).css(styleCss)
$(`.land_wrap .land-form${this.number} .land-form-top`).css(formStyle)
$(`.land_wrap .land-form${this.number} .land-form-bottom`)
.css(buttonStyle)
.text(text)
if (layout === 'left') {
this.style += `.land-form${this.number} .land-form-top` +
`{
padding: ${Util.fitSize(8, this.isProps)};
padding-top: 0;
border-radius: ${Util.fitSize(8, this.isProps)};
margin-bottom: ${Util.fitSize(dis, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-label` +
`{
float: left;
padding-top: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-bottom: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-left: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 8 / 200}rem;
width: ${Util.fitSize('70px', this.isProps)};
margin-top: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input` +
`{
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code` +
`{
border: none;
width: calc(100% - ${Util.fitSize('80px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .code-btn` +
`{
display: inline-block;
width: ${Util.fitSize('80px', this.isProps)};
color: #2D9AFF;
float:right;
line-height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item` +
`{
border-bottom: ${Util.fitSize(1, this.isProps)} solid #EAEAEA;
padding: ${Util.fitSize(4, this.isProps)} 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item:last-child` +
`{
border-bottom: 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date` +
`{
position: relative;
left: ${Util.fitSize('-9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time` +
`{
position: relative;
left: ${Util.fitSize('-9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .horizontalRadio` +
`{
float: left;
padding-right: ${Util.fitSize('10px', this.isProps)};
width: 50%;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio label` +
`{
position: relative;
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
top: ${Util.fitSize('2px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox label` +
`{
position: relative;
top: ${Util.fitSize('2px', this.isProps)};
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${Util.fitSize('8px', this.isProps)};
margin-top: ${Util.fitSize('13px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea textarea` +
`{
height: ${Util.fitSize('80px', this.isProps)};
width: 100%;
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_province` +
`{
border:none;
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
font-size:${Util.fitSize('14px', this.isProps)};
line-height: ${Util.fitSize('44px', this.isProps)};
padding-right: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_city` +
`{
border:none;
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
font-size:${Util.fitSize('14px', this.isProps)};
line-height: ${Util.fitSize('44px', this.isProps)};
}`
} else if (layout === 'justify') {
this.style += `.land-form${this.number} .land-form-top` +
`{
padding: ${Util.fitSize(8, this.isProps)};
padding-top: 0;
border-radius: ${Util.fitSize(8, this.isProps)};
margin-bottom: ${Util.fitSize(dis, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-label` +
`{
float: left;
padding-top: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-bottom: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-left: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 8 / 200}rem;
width: ${Util.fitSize('70px', this.isProps)};
margin-top: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input` +
`{
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code` +
`{
border: none;
width: calc(100% - ${Util.fitSize('80px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
text-align:right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .code-btn` +
`{
display: inline-block;
width: ${Util.fitSize('80px', this.isProps)};
color: #2D9AFF;
float: right;
line-height:${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item` +
`{
border-bottom: ${Util.fitSize(1, this.isProps)} solid #EAEAEA;
padding: ${Util.fitSize(4, this.isProps)} 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item:last-child` +
`{
border-bottom: 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)}
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date` +
`{
position: relative;
left: ${Util.fitSize('9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time` +
`{
position: relative;
left: ${Util.fitSize('9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
font-size: ${Util.fitSize('14px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .horizontalRadio` +
`{
float: left;
padding-right: ${Util.fitSize('10px', this.isProps)};
width: 50%;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio label` +
`{
position: relative;
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
top: ${Util.fitSize('2px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox label` +
`{
position: relative;
top: ${Util.fitSize('2px', this.isProps)};
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${Util.fitSize('8px', this.isProps)};
margin-top: ${Util.fitSize('13px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea textarea` +
`{
height: ${Util.fitSize('80px', this.isProps)};
width: 100%;
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_province-${this.number}` +
`{
border:none;
direction: ltr;
float: right;
font-size: ${Util.fitSize('14px', this.isProps)};
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
padding-right: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_city-${this.number}` +
`{
border:none;
direction: ltr;
float: right;
font-size: ${Util.fitSize('14px', this.isProps)};
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select` +
`{
direction: rtl;
padding-right: ${Util.fitSize('10px', this.isProps)};
float: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input::-webkit-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input:-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input::-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input:-ms-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code::-webkit-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code:-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code::-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code:-ms-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input textarea::-webkit-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input textarea:-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input textarea::-moz-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input textarea:-ms-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top #land-date::-webkit-input-placeholder` +
`{
text-align: right;
}`
this.style += `.land-form${this.number} .land-form-top #land-date:-moz-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-date::-moz-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-date:-ms-input-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-date` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-time::-webkit-input-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-time:-moz-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-time::-moz-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-time:-ms-input-placeholder` +
`{
text-align: right;
}`
this.style +=
`.land-form${
this.number
} .land-form-top #land-time` +
`{
text-align: right;
}`
} else if (layout === 'vertical') {
this.style +=
`.land-form${this.number} .land-form-top` +
`{
padding: ${this.isProps === '375px' ? ((8 / 200) * 64) / 75 : 7 / 200}rem;
padding-top: 0;
border-radius: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 8 / 200}rem;
margin-bottom: ${this.isProps === '375px' ? ((dis / 200) * 64) / 75 : ((dis / 75) * 64) / 200}rem;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-label` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
padding-top: ${
this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200
}rem;
padding-bottom: ${
this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200
}rem;
padding-left: ${Util.fitSize('4px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-input` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
padding-left: ${Util.fitSize('4px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`;
this.style +=
`.land-form${this.number} .land-form-top .land-form-item` +
`{
border-bottom: ${Util.fitSize(1, this.isProps)} solid #EAEAEA;
padding-top: ${Util.fitSize(4, this.isProps)};
padding-bottom: ${Util.fitSize(4, this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top #land-date` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
padding-left: ${Util.fitSize('4px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top #land-time` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
padding-left: ${Util.fitSize('4px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-item:last-child` +
`{
border-bottom: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select` +
`{
font-size: ${Util.fitSize('14px', this.isProps)};
border:none;
float: right;
width: 100%;
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
padding-left: ${Util.fitSize('4px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select-date` +
`{
position: relative;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select-time` +
`{
position: relative;
}`
this.style += `.land-form${this.number} .land-form-top #s_province-${this.number}` +
`{
border:none;
direction: ltr;
float: left;
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
padding-right: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_city-${this.number}` +
`{
border:none;
direction: ltr;
float: left;
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
}`
this.style +=
`.land-form${
this.number
} .land-form-top .land-form-input .land-code` +
`{
width: calc(100% - ${Util.fitSize('100px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
border: none;
font-size: ${Util.fitSize('14px', this.isProps)};
padding-left: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-input .code-btn` +
`{
display: inline-block;
width: ${Util.fitSize('80px', this.isProps)};
color: #2D9AFF;
line-height: ${Util.fitSize('44px', this.isProps)};
float: right;
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio` +
`{
border:none;
float: left;
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio` +
`{
border:none;
height:${Util.fitSize('44px', this.isProps)};
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .horizontalRadio` +
`{
float: left;
padding-right: ${Util.fitSize('10px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio label` +
`{
position: relative;
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
top: ${Util.fitSize('2px', this.isProps)};
width: 15%;
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox` +
`{
border:none;
float: left;
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox` +
`{
border:none;
height: ${Util.fitSize('44px', this.isProps)};
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox label` +
`{
position: relative;
top: ${Util.fitSize('2px', this.isProps)};
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea` +
`{
border:none;
padding-left: ${Util.fitSize('4px', this.isProps)};
margin-top: ${Util.fitSize('12px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea textarea` +
`{
height: ${Util.fitSize('80px', this.isProps)};
width: 100%;
font-size: ${Util.fitSize(14, this.isProps)};
}`
} else if (layout === 'no-title') {
this.style += `.land-form${this.number} .land-form-top` +
`{
padding: ${Util.fitSize(8, this.isProps)};
padding-top: 0;
border-radius: ${Util.fitSize(8, this.isProps)};
margin-bottom: ${Util.fitSize(dis, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-label` +
`{
float: left;
padding-top: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-bottom: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-left: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 8 / 200}rem;
width: ${Util.fitSize('70px', this.isProps)};
margin-top: ${Util.fitSize('6px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-item` +
`{
border-bottom: ${Util.fitSize(1, this.isProps)} solid #EAEAEA;
padding: ${Util.fitSize(4, this.isProps)} 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-input` +
`{
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
padding: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-item:last-child` +
`{
border-bottom: 0;
}`
this.style +=
`.land-form${
this.number
} .land-form-top .land-form-input .land-code` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
width: calc(100% - ${Util.fitSize('100px', this.isProps)});
border: none;
padding: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select-date` +
`{
position: relative;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select-time` +
`{
position: relative;
}`
this.style +=
`.land-form${this.number} .land-form-top #land-date` +
`{
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
padding-left: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top #land-time` +
`{
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
padding-left: 0;
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-input .code-btn` +
`{
display: inline-block;
color: #2D9AFF;
width: ${Util.fitSize('100px', this.isProps)};
border: ${Util.fitSize(1, this.isProps)} solid #2d9aff;
border-radius: ${Util.fitSize(4, this.isProps)};
text-align: center;
line-height: ${Util.fitSize('30px', this.isProps)};
float: right;
margin-top: ${Util.fitSize('7px', this.isProps)};
}`
this.style +=
`.land-form${this.number} .land-form-top .land-form-select` +
`{
border:none;
float: right;
width: 100%;
height: ${Util.fitSize('44px', this.isProps)};
padding-left: 0
}`
this.style += `.land-form${this.number} .land-form-top #s_province-${this.number}` +
`{
border:none;
direction: ltr;
float: left;
font-size: ${Util.fitSize('14px', this.isProps)};
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
padding-right: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_city-${this.number}` +
`{
border:none;
direction: ltr;
float: left;
font-size: ${Util.fitSize('14px', this.isProps)};
width: ${Util.fitSize('80px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
font-size: ${Util.fitSize('14px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .horizontalRadio` +
`{
float: left;
padding-right: ${Util.fitSize('10px', this.isProps)};
width: 50%;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio label` +
`{
position: relative;
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
top: ${Util.fitSize('2px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox label` +
`{
position: relative;
top: ${Util.fitSize('2px', this.isProps)};
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea` +
`{
border:none;
float: right;
width: 100%;
padding-right: ${Util.fitSize('8px', this.isProps)};
margin-top: ${Util.fitSize('13px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea textarea` +
`{
height: ${Util.fitSize('80px', this.isProps)};
width: 100%;
font-size: ${Util.fitSize(14, this.isProps)};
}`
} else if (layout === 'icon') {
this.style += `.land-form${this.number} .land-form-top` +
`{
padding: ${Util.fitSize(8, this.isProps)};
padding-top: 0;
border-radius: ${Util.fitSize(8, this.isProps)};
margin-bottom: ${Util.fitSize(dis, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-label` +
`{
float: left;
padding-top: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-bottom: ${this.isProps === '375px' ? ((22 / 200) * 64) / 75 : 19 / 200}rem;
padding-left: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 8 / 200}rem;
width: ${Util.fitSize('70px', this.isProps)};
margin-top: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-newLabel` +
`{
width: ${Util.fitSize('30px', this.isProps)};
margin-top: ${Util.fitSize('4px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-newLabel i` +
`{
color: #c2c2c2;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input` +
`{
float: right;
width: calc(100% - ${Util.fitSize('30px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
line-height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .land-code` +
`{
border: none;
width: calc(100% - ${Util.fitSize('100px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-input .code-btn` +
`{
display: inline-block;
width: ${Util.fitSize('80px', this.isProps)};
color: #2D9AFF;
float: right;
line-height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item` +
`{
border-bottom: ${Util.fitSize(1, this.isProps)} solid #EAEAEA;
padding: ${Util.fitSize(4, this.isProps)} 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-item:last-child` +
`{
border-bottom: 0;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('30px', this.isProps)});
height: ${Util.fitSize('44px', this.isProps)};
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date` +
`{
position: relative;
left: ${Util.fitSize('-9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-date input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time` +
`{
position: relative;
left: ${Util.fitSize('-9px', this.isProps)};
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-select-time input` +
`{
font-size: ${Util.fitSize(14, this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .sex` +
`{
background: none;
font-size: ${Util.fitSize('14px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .horizontalRadio` +
`{
float: left;
padding-right: ${Util.fitSize('10px', this.isProps)};
width: 50%;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-radio .radio label` +
`{
position: relative;
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
top: ${Util.fitSize('2px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${this.isProps === '375px' ? ((20 / 200) * 64) / 75 : 18 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox` +
`{
border:none;
line-height: ${Util.fitSize('44px', this.isProps)};
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox input` +
`{
border:none;
position: relative;
top: ${this.isProps === '375px' ? ((10 / 200) * 64) / 75 : 9 / 200}rem;
width: ${Util.fitSize('16px', this.isProps)};
height: ${Util.fitSize('16px', this.isProps)};
background-color: #ff7746;
}`
this.style += `.land-form${this.number} .land-form-top .land-form-checkbox .checkbox label` +
`{
position: relative;
top: ${Util.fitSize('2px', this.isProps)};
border:none;
padding-left: ${Util.fitSize('8px', this.isProps)};
height: ${this.isProps === '375px' ? ((40 / 200) * 64) / 75 : 34 / 200}rem;
color:
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea` +
`{
border:none;
float: right;
width: calc(100% - ${Util.fitSize('70px', this.isProps)});
padding-left: ${Util.fitSize('8px', this.isProps)};
margin-top: ${Util.fitSize('13px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top .land-form-textarea textarea` +
`{
height: ${Util.fitSize('80px', this.isProps)};
width: 100%;
font-size: ${Util.fitSize(14, this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_province-${this.number}` +
`{
border:none;
width: ${Util.fitSize('80px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
padding-right: ${Util.fitSize('6px', this.isProps)};
}`
this.style += `.land-form${this.number} .land-form-top #s_city-${this.number}` +
`{
border:none;
width: ${Util.fitSize('80px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
height: ${Util.fitSize('44px', this.isProps)};
}`
}
this.style +=`select:required:invalid {
color: gray;
}
option[value=""][disabled] {
display: none;
}
option {
color: black;
}`
$('head').append('<style>' + this.style + '</style>')
}
initPopup() {
let { type, popupId } = this.options.submitVerify.jump
if (type === 'popup') {
this.elementConfig &&
this.elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(item, index, this.isProps, this.elementConfig).showPopup();
$('.land_wrap').css('height', $(window).height());
}
})
}
}
verify ({
$name,
$mobile,
$code,
$email,
$idcard,
$normal,
$sex,
$province,
$city,
$radio,
$checkbox,
$textarea,
$date,
$time,
$customize
}) {
let data = {}
let checkbox = ''
let self = this
// 验证名字
if ($name) {
if (
Verify.verifyName(
$(`.land-form${self.number} #name`),
$(`.land-form${self.number} #name`).attr('required')
)
) {
data['userName'] = $(`.land-form${self.number} #name`)
.val()
.trim()
} else {
return null
}
}
// 验证手机号
if ($mobile) {
if (
Verify.verifyTel(
$(`.land-form${self.number} #mobile`),
$(`.land-form${self.number} #mobile`).attr('required')
)
) {
data['userPhone'] = $(`.land-form${self.number} #mobile`)
.val()
.trim()
} else {
return null
}
}
// 验证验证码
if ($code) {
var codeStatus = Verify.regCode(
$(`.land-form${self.number} #concode`).val()
)
var codeErrText = ''
if (codeStatus === 0) {
data['smsCode'] = $(`.land-form${self.number} .land-code`)
.val()
.trim()
} else if (codeStatus === 1) {
codeErrText = '验证码不能为空'
pp.note(codeErrText, {
mask: false,
closeTime: 2000
})
return null
} else if (codeStatus === 2) {
codeErrText = '验证码格式不正确'
pp.note(codeErrText, {
mask: false,
closeTime: 2000
})
return null
}
}
// 验证邮箱
if ($email) {
if (
Verify.verifyEmail(
$(`.land-form${self.number} #email`),
$(`.land-form${self.number} #email`).attr('required')
)
) {
data['email'] = $(`.land-form${self.number} #email`)
.val()
.trim()
} else {
return null
}
}
// 验证身份证
if ($idcard) {
if (
Verify.verifyCard(
$(`.land-form${self.number} #idcard`),
$(`.land-form${self.number} #idcard`).attr('required')
)
) {
data['idcard'] = $(`.land-form${self.number} #idcard`)
.val()
.trim()
} else {
return null
}
}
// 验证普通输入框
if ($normal) {
if (
Verify.verifyNormal(
$(`.land-form${self.number} #normal`),
$(`.land-form${self.number} #normal`).attr('required')
)
) {
data['customText'] = $(`.land-form${self.number} #normal`)
.val()
.trim()
} else {
return null
}
}
// 性别必填
if ($sex) {
// if (Number($(`.land-form${self.number} #sex`).attr('required')) === 1) {
// if ($(`.land-form${self.number} #sex`).val() !== $(`.land-form${self.number} #sex`).attr('property')) {
// data['sex'] = $(`.land-form${self.number} #sex`).val()
// } else {
// pp.note('请选择性别', {
// mask: false,
// closeTime: 2000
// })
// return null
// }
// } else {
// data['sex'] = $(`.land-form${self.number} #sex`).val()
// }
data['sex'] = $(`.land-form${self.number} #sex`).val() === '男' ? 1 : 0
}
//自定义下拉框
if($customize){
let val=$(`.land-form${self.number} #select-customize`).val()
let title=$(`.land-form${self.number} #select-customize`).data('title')
if(val===''){
pp.note(`${title}必填`, {
mask: false,
closeTime: 2000
})
return null
}
data['selectCustomize'] = val
}
// 省市区必填校验
if ($province) {
if (
$(`.land-form${self.number} #s_province`).attr('required') === '1'
) {
if ($(`.land-form${self.number} #s_province`).val() !== '省') {
data['province'] = $(`.land-form${self.number} #s_province`).val()
} else {
pp.note('请输入省', {
mask: false,
closeTime: 2000
})
return null
}
} else {
data['province'] = $(`.land-form${self.number} #s_province`).val()
}
}
if ($city) {
if ($(`.land-form${self.number} #s_city`).attr('required') === '1') {
if ($(`.land-form${self.number} #s_city`).val() !== '市') {
data['city'] = $(`.land-form${self.number} #s_city`).val()
} else {
pp.note('请输入市', {
mask: false,
closeTime: 2000
})
return null
}
} else {
data['city'] = $(`.land-form${self.number} #s_city`).val()
}
}
// if ($county) {
// if ($(`.land-form${self.number} #s_county`).attr('required') === 1) {
// if ($(`.land-form${self.number} #s_county`).val() !== '区') {
// data['region'] = $(`.land-form${self.number} #s_county`).val()
// } else {
// pp.note('请输入区', {
// mask: false,
// closeTime: 2000
// })
// return null
// }
// } else {
// data['region'] = $(`.land-form${self.number} #s_county`).val()
// }
// }
if ($date) {
if (Number($(`.land-form${self.number} #land-date`).attr('required')) !== 0) {
if (!$(`.land-form${self.number} #land-date`).val()) {
pp.note('日期必填', {
mask: false,
closeTime: 2000
})
return null
} else {
data['date'] = $(`.land-form${self.number} #land-date`).val()
}
} else {
data['date'] = $(`.land-form${self.number} #land-date`).val()
}
}
if ($time) {
if (Number($(`.land-form${self.number} #land-time`).attr('required')) !== 0) {
if (!$(`.land-form${self.number} #land-time`).val()) {
pp.note('时间必填', {
mask: false,
closeTime: 2000
})
return null
} else {
data['time'] = $(`.land-form${self.number} #land-time`).val()
}
} else {
data['time'] = $(`.land-form${self.number} #land-time`).val()
}
}
if ($radio) {
// console.log('33333', $(`.land-form${this.number} .land-form-top .land-form-radio .radio`).attr('required'));
if (Number($(`.land-form${self.number} .land-form-top .land-form-radio .radio`).attr('required')) !== 0) {
if (Number($(`.land-form${self.number} .land-form-top .land-form-radio .radio`).attr('checked')) === 0) {
pp.note($(`.land-form${self.number} .land-form-top .land-form-radio .radio`).attr('title') + '必填', {
mask: false,
closeTime: 2000
})
return null
}
$(`.land-form${self.number} .land-form-top .land-form-radio .radio input`).each(function(index, element) {
if ($(element).attr('checked')) {
data['customRadio'] = $(element).val()
}
})
} else {
$(`.land-form${self.number} .land-form-top .land-form-radio .radio input`).each(function(index, element) {
if ($(element).attr('checked')) {
data['customRadio'] = $(element).val()
}
})
}
}
if ($checkbox) {
if (Number($(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox`).attr('required')) !== 0) {
if (Number($(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox`).attr('checked')) === 0) {
pp.note($(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox`).attr('title') + '必填', {
mask: false,
closeTime: 2000
})
return null
}
checkbox = ''
$(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox input`).each(function(index, element) {
if ($(element).attr('checked')) {
checkbox += $(element).val() + ','
}
})
data['customCheckBox'] = checkbox.slice(0, -1)
} else {
checkbox = ''
$(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox input`).each(function(index, element) {
if ($(element).attr('checked')) {
checkbox += $(element).val() + ','
}
})
data['customCheckBox'] = checkbox.slice(0, -1)
}
}
if ($textarea) {
if (Number($(`.land-form${self.number} .land-form-top .land-form-textarea textarea`).attr('required')) !== 0) {
if (!$(`.land-form${self.number} .land-form-top .land-form-textarea textarea`).val()) {
pp.note($(`.land-form${self.number} .land-form-top .land-form-textarea textarea`).attr('title') + '必填', {
mask: false,
closeTime: 2000
})
return null
} else {
data['customBigText'] = $(`.land-form${self.number} .land-form-top .land-form-textarea textarea`).val()
}
} else {
data['customBigText'] = $(`.land-form${self.number} .land-form-top .land-form-textarea textarea`).val()
}
}
var params = {
landId: parseInt(window.atob(Util.getUrlParameter('id'))),
channel: 'formTemplate'
}
let specialKeys = ['userName', 'userPhone', 'smsCode', 'sex', 'email', 'region', 'city', 'province', 'location', 'address', 'birthday', 'idcard']
let filterData = {}
specialKeys.forEach(key => data[key] !== undefined && data[key] !== null && (filterData[key] = data[key]))
let listUserInfoList = Object.keys(data).filter(key => {
return specialKeys.indexOf(key) === -1
}).map(key => {
return {
name: key,
value: data[key],
check: false
}
})
listUserInfoList.push({
name: 'formName',
value: self.options.name,
check: false
})
listUserInfoList.push({
name: 'formId',
value: self.options.id,
check: false
})
// 唯一值逻辑
let controlSetting = self.options.controlSetting
let hasUnique = false
let unique = {
landId: parseInt(window.atob(Util.getUrlParameter('id')))
}
controlSetting.forEach(item => {
if ('mobile' === item.childType && item.isUnique) {
unique['userPhone'] = data.userPhone
hasUnique = true
}
if ('idcard' === item.childType && item.isUnique) {
unique['identification'] = data.idcard
hasUnique = true
}
if ('email' === item.childType && item.isUnique) {
unique['email'] = data.email
hasUnique = true
}
})
params = Object.assign({}, params, filterData, { listUserInfo: JSON.stringify(listUserInfoList) })
let { name } = self.options
let doForType = function() {
setTimeout(function() {
pp.note('保存成功', {
mask: false,
closeTime: 2000
})
}, 0)
let { submitVerify, controlSetting } = self.options
let extraParam = {}
submitVerify.enable && (extraParam.sliderVerify = 1)
let mobileInputOption = controlSetting.find(item => item.type === 'input' && item.childType === 'mobile')
mobileInputOption && mobileInputOption.sendVerifyCode && (extraParam.mobileVerify = 1)
commonJumpLogic({
componentData: self.options,
jump: self.options.submitVerify.jump,
options: { location: name, ...extraParam },
popupCallback: () => { self.initPopup() }
})
}
const submit = function() {
console.log(params)
window.xhr = $.ajax({
url: '/activity/land/submitForm',
type: 'POST',
timeout: 6000,
dataType: 'json',
data: params,
success: function(res) {
if (res.success) {
setTimeout(function() {
pp.note('保存成功', {
mask: false,
closeTime: 2000
})
}, 0)
doForType()
} else {
setTimeout(function() {
pp.note(res.desc, {
mask: false,
closeTime: 2000
})
}, 0)
}
},
error: function(XHR, status) {
if (status === 'timeout') {
window.xhr && window.xhr.abort()
setTimeout(function() {
pp.note('请求超时', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note('网络错误', {
mask: false,
closeTime: 2000
})
}, 0)
}
pp.hideing()
},
complete: function(e) {
pp.hideing()
self.isClick = false
}
})
}
if (!self.isClick) {
self.isClick = true
if (hasUnique) {
$.ajax({
url: '/activity/land/checkUniqueness',
type: 'POST',
timeout: 6000,
dataType: 'json',
data: unique,
success: function(res) {
if (res.success) {
let error = ''
if (res.data.identification) {
error = '身份证号码重复'
} else if (res.data.email) {
error = '邮箱重复'
} else if (res.data.userPhone) {
error = '手机号重复'
}
if (error) {
self.isClick = false
setTimeout(function() {
pp.note(error, {
mask: false,
closeTime: 2000
})
}, 0)
} else {
submit()
}
} else {
self.isClick = false
setTimeout(function() {
pp.note(res.desc, {
mask: false,
closeTime: 2000
})
}, 0)
}
},
error: function(res) {
pp.hideing()
self.isClick = false
},
complete: function(res) {
pp.hideing()
}
})
} else {
submit()
}
}
}
event() {
let isSend = false
let self = this
// let isClick = false;
// 判断元素是否存在
let data = {}
let $name = $(`.land-form${self.number} #name`).length
let $mobile = $(`.land-form${self.number} #mobile`).length
let $code = $(`.land-form${self.number} #concode`).length
let $email = $(`.land-form${self.number} #email`).length
let $idcard = $(`.land-form${self.number} #idcard`).length
let $normal = $(`.land-form${self.number} #normal`).length
let $sex = $(`.land-form${self.number} #sex`).length
let $province = $(`.land-form${self.number} #s_province`).length
let $city = $(`.land-form${self.number} #s_city`).length
// let $county = $(`.land-form${self.number} #s_county`).length
let $radio = $(`.land-form${self.number} .radio`).length
let $checkbox = $(`.land-form${self.number} .checkbox`).length
let $textarea = $(`.land-form${self.number} textarea`).length
let $date = $(`.land-form${self.number} #land-date`).length
let $time = $(`.land-form${self.number} #land-time`).length
let checkbox = ''
let $customize=$(`.land-form${self.number} #select-customize`).length
// if ($province) {
// area()
// }
if ($date) {
window.Loader.async(['//yun.tuisnake.com/h5-mami/landpage/rolldate.css', '//yun.tuisnake.com/h5-mami/landpage/rolldate.js'], function() {
new window.rolldate.Date({
el: '#land-date',
format: 'YYYY-MM-DD',
beginYear: 1900,
endYear: 2100,
theme: '#57b3ff'
})
$(`.land-form${self.number} #land-date`).on('click', function() {
$('.rolldate-mask').css('z-index', 20000)
$('.rolldate-wrapper').css('z-index', 22000)
})
})
}
if ($time) {
window.Loader.async(['//yun.tuisnake.com/h5-mami/landpage/rolldate.css', '//yun.tuisnake.com/h5-mami/landpage/rolldate.js'], function() {
new window.rolldate.Date({
el: '#land-time',
format: 'hh:mm:ss',
theme: '#57b3ff'
})
$(`.land-form${self.number} #land-time`).on('click', function() {
$('.rolldate-mask').css('z-index', 20000)
$('.rolldate-wrapper').css('z-index', 22000)
$('.rolldate-wrapper header').text('选择时间');
})
})
}
if ($radio) {
$(`.land-form${self.number} .land-form-top .land-form-radio .radio > *`).on('click', function() {
$(`.land-form${self.number} .land-form-top .land-form-radio .radio`).attr('checked', 1)
$(`.land-form${self.number} .land-form-top .land-form-radio .radio`).removeAttr('checked')
$(`.land-form${self.number} .land-form-top .land-form-radio .radio > *`).removeAttr('checked')
$(this).attr('checked', true)
})
}
if ($checkbox) {
$(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox > *`).on('click', function() {
$(`.land-form${self.number} .land-form-top .land-form-checkbox .checkbox`).attr('checked', '1')
if ($(this).attr('status') === '0') {
$(this).attr('checked', true)
$(this).attr('status', '1')
} else {
$(this).removeAttr('checked')
$(this).attr('status', '0')
}
})
}
let params = {
$name,
$mobile,
$code,
$email,
$idcard,
$normal,
$sex,
$province,
$city,
$radio,
$checkbox,
$textarea,
$date,
$time,
$customize
}
const btnSelector = `.land-form${this.number} .land-form-bottom`
if (this.options.submitVerify.jump.type === 'link') {
buryAOId(btnSelector)
}
// 点击领取按钮
$(btnSelector).on('click', () => {
self.options.submitVerify.enable ? NETVeify().then(() => {
self.verify(params)
}, alertError) : self.verify(params)
})
// 点击获取验证码
$(`.land-form${this.number} .land-form-top .code-btn`).on(
'click',
function() {
if (
!isSend &&
Verify.verifyTel(
$(`.land-form${self.number} #mobile`),
$(`.land-form${self.number} #mobile`).attr('required')
)
) {
isSend = true
let time = 60
var data = {
phone: $(`.land-form${self.number} #mobile`)
.val()
.trim(),
landId: parseInt(window.atob(Util.getUrlParameter('id'))),
landSubId: window.atob(Util.getUrlParameter('id')) + '-1',
channel: 'formTemplate'
}
pp.loading()
window.xhr = $.ajax({
url: '/activity/land/sendCode',
type: 'GET',
timeout: 6000,
dataType: 'json',
data,
success: function(res) {
if (res.success) {
setTimeout(function() {
pp.note('验证码获取成功', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note(res.desc, {
mask: false,
closeTime: 2000
})
}, 0)
}
},
error: function(XHR, status) {
if (status === 'timeout') {
window.xhr && window.xhr.abort()
setTimeout(function() {
pp.note('请求超时', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note('网络错误', {
mask: false,
closeTime: 2000
})
}, 0)
}
pp.hideing()
},
complete: function(e) {
pp.hideing()
}
})
var int = setInterval(function() {
$(`.land-form${self.number} #yzmbtn`).text(time + 's')
time--
if (!time) {
clearInterval(int)
$(`.land-form${self.number} #yzmbtn`).text('发送验证码')
isSend = false
}
}, 1000)
}
}
)
}
}
window.TA.RenderForm = RenderForm
})(Zepto);
\ No newline at end of file
import Util from 'render/libs/utils';
import { buryAOId } from 'render/libs/helper'
import { commonJumpLogic } from 'render/libs/common'
(function($) {
class RenderImage {
constructor(result, index, isProps, elementConfig,selector) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
this.number = index
this.$mountNode = $(selector || '.land_wrap')
this.init()
}
init() {
let imageElem = $(`<div class="land-image${this.number}"></div>`)
this.$mountNode.append(imageElem)
this.event()
this.renderStyle()
//this.initPopup()
}
initPopup() {
let {
type,
popupId
} = this.options.jump
if (type === 'popup') {
this.elementConfig && this.elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(item, index, this.isProps, this.elementConfig).showPopup();
$('.land_wrap').css('height', $(window).height());
}
})
}
}
renderStyle() {
let {
fixed
} = this.options
let styleCss = Object.assign({},
Util.transformCss(this.options.style, this.isProps), { 'position': fixed === 0 ? 'absolute' : 'fixed' }, { 'background-repeat': 'no-repeat' })
$(`.land_wrap .land-image${this.number}`).css(styleCss)
}
event() {
let {
type
} = this.options.jump
let {
name
} = this.options
let self = this
const selector = `.land_wrap .land-image${this.number}`
// 如果是跳转下载链接则埋唯一id
if (type === 'link') {
buryAOId(selector)
}
if (type !== 'none') {
$(selector).on('click', function() {
commonJumpLogic({
componentData: self.options,
jump: self.options.jump,
options: { location: name },
popupCallback: () => { self.initPopup() }
})
})
}
}
}
window.TA.RenderImage = RenderImage
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils'
import { commonJumpLogic } from 'render/libs/common';
(function($) {
class RenderMobile {
constructor(result, index, isProps) {
let defaultValue = {
style: {}
}
this.style = ''
this.options = $.extend(true, defaultValue, result)
this.number = index
this.isProps = isProps
this.init()
}
init() {
console.log(this.options)
let {
mobile
} = this.options
let mobileElem = $(`<a class="mobile${this.number}" href="tel:${mobile}">
<div class="mobile-jump">
<i class="iconfont icon-control_phone"></i>
<span class="mobile-num"></span>
</div>
</a>`)
$('.land_wrap').append(mobileElem)
this.event()
this.renderStyle()
}
renderStyle() {
let {
text
} = this.options
let {
type
} = this.options.fixed
// let iconClass = this.options.icon.className || '';
let styleCss = Object.assign({},
Util.transformCss(this.options.style, this.isProps), {
'position': type === 'self' || type === 'bottom' ? 'fixed' : 'absolute'
}
)
$(`.mobile${this.number}`).css(styleCss)
$(`.mobile${this.number} .mobile-num`).text(text)
let iconCss = Util.transformCss(this.options.icon.style, this.isProps)
$(`.mobile${this.number} i`).css(iconCss)
$(`.mobile${this.number} .mobile-jump`).css({
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)'
})
$('head').append('<style>' + this.style + '</style>')
}
event() {
let {
name,
jump
} = this.options
$(document).on('click', `.mobile${this.number}`, function() {
commonJumpLogic({
componentData: self.options,
jump,
options: { location: name }
})
})
}
}
window.TA.RenderMobile = RenderMobile
})(Zepto)
import Util from 'render/libs/utils'
import pp from 'render/libs/popup'
import Verify from '../verify'
import { buryAOId } from 'render/libs/helper'
import { commonJumpLogic } from 'render/libs/common'
;(function($) {
class RenderPopup {
constructor(result, index, isProps, elementData) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIpone = navigator.userAgent.indexOf('iPhone')
this.number = index
this.elementData = elementData
this.isProps = isProps
this.style = ''
this.init()
}
init() {
this.renderDom()
this.event()
// 新生成的数据才有子元素
if (this.options.elements) {
this.renderChild()
}
// this.hidePopup()
}
hidePopup() {
$(`.popup${this.number}`).remove()
$('.land_wrap').css('height', '')
}
showPopup() {
$(`.popup${this.number}`).show(400)
this.initTop()
}
renderDom() {
let { enable } = this.options.closeIcon
let { verify } = this.options.form
let $popUp = `<div class="popup${this.number}">
<div class="popup-img">
${
this.options.form.enable === 1
? `<div class="form">
<div class="form-group-tel">
<i class="form-group-tel-icon iconfont icon-system_phone_phone"></i>
<input class="conTel1" type="text" class="form-control" placeholder="请输入手机号码" required=${1}>
</div>
${
verify === 1
? `<div class="form-group-code">
<i class="form-group-tel-icon iconfont icon-system_phone_Verifi"></i>
<input class="concode" type="text" class="form-control" placeholder="请输入验证码" required=${1}>
<div class="yzmbtn">获取验证码</div>
</div>`
: ''
}
</div>`
: ''
}
</div>
${
enable === 1
? `<i class="iconfont icon-system_error popup-close"></i>`
: ''
}
</div>`
$('.land_wrap').append($popUp)
this.renderStyle()
}
initTop() {
let viewHeight = $(window).height()
let popupHeight = document.querySelector(
`.popup${this.number} .popup-img`
).offsetHeight
$(`.popup${this.number} .popup-img`).css(
'bottom',
(viewHeight - popupHeight) / 2
)
}
renderStyle() {
let { width, height, url, isDefault } = this.options.image
let { top, right } = this.options.closeIcon
if (typeof ''.ossimg === 'function' && url.indexOf('.gif') === -1) {
url = url.ossimg()
}
$(`.popup${this.number}`).css('height', $(window).height())
this.style +=
`.popup${this.number}` +
`{
position: absolute;
width: 100%;
z-index: 2000;
top:0;
bottom:0;
background-color: rgba(0,0,0,.5);
}`
this.style +=
`.popup${this.number} .popup-img` +
`{
position: absolute;
width: ${Util.fitSize(width, this.isProps)};
height: ${Util.fitSize(height, this.isProps)};
left: 50%;
transform: translateX(-50%);
${
isDefault
? 'background:none;'
: 'background: url(' + url + ') no-repeat;'
}
background-size: 100%;
}`
this.style +=
`.popup${this.number} .popup-close` +
`{
position: absolute;
font-size: ${Util.fitSize('24px', this.isProps)};
top: ${Util.fitSize(top, this.isProps)};
right: ${Util.fitSize(right, this.isProps)};
color: rgba(255,255,255, .5);
}`
this.style +=
`.popup${this.number} .form` +
`{
position: absolute;
width: ${Util.fitSize('260px', this.isProps)};
left: 50%;
transform: translate(-50%);
border-radius: ${Util.fitSize('6px', this.isProps)};
top: ${Util.fitSize(
this.options.form.top,
this.isProps
)};
overflow: hidden;
background-color: #fff;
font-size: ${Util.fitSize('14px', this.isProps)};
}`
this.style +=
`.popup${this.number} .form-group-tel` +
`{
position: relative;
height: ${Util.fitSize('48px', this.isProps)};
background-color: #fff;
margin: 0 ${Util.fitSize('10px', this.isProps)};
}`
this.style +=
`.popup${this.number} .form-group-code` +
`{
position: relative;
height: ${Util.fitSize('48px', this.isProps)};
background-color: #fff;
border-top: ${
this.isProps === '375px'
? ((1 / 200) * 64) / 75
: 1 / 200
}rem solid #eaeaea;
margin: 0 ${Util.fitSize('10px', this.isProps)};
}`
this.style +=
`.popup${this.number} .form-group-tel .form-group-tel-icon` +
`{
float: left;
height: ${Util.fitSize('48px', this.isProps)};
line-height: ${Util.fitSize('48px', this.isProps)};
padding-left:${Util.fitSize('2px', this.isProps)};
color: #C2C2C2;
}`
this.style +=
`.popup${this.number} .form-group-tel .conTel1` +
`{
width: auto;
height: ${Util.fitSize('48px', this.isProps)};
line-height: ${Util.fitSize('48px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
border: none;
float: left;
padding-left:${Util.fitSize('10px', this.isProps)};
}`
this.style +=
`.popup${this.number} .form-group-code .form-group-tel-icon` +
`{
float: left;
height: ${Util.fitSize('48px', this.isProps)};
line-height: ${Util.fitSize('48px', this.isProps)};
padding-left:${Util.fitSize('2px', this.isProps)};
color: #C2C2C2;
}`
this.style +=
`.popup${this.number} .form-group-code .concode` +
`{
width: ${Util.fitSize('114px', this.isProps)};
height: ${Util.fitSize('46px', this.isProps)};
line-height: ${Util.fitSize('46px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
border: none;
float: left;
padding-left:${Util.fitSize('10px', this.isProps)};
margin-top: ${Util.fitSize('2px', this.isProps)};
}`
this.style +=
`.popup${this.number} .yzmbtn` +
`{
width: width: ${Util.fitSize('90px', this.isProps)};
height: ${Util.fitSize('36px', this.isProps)};
line-height: ${Util.fitSize('36px', this.isProps)};
text-align: center;
float: right;
padding: 0 ${Util.fitSize('6px', this.isProps)};
font-size: ${Util.fitSize('14px', this.isProps)};
border: ${((1 / 200) * 64) / 75}rem solid #eaeaea;
margin-top: ${Util.fitSize('6px', this.isProps)};
color: #a3a399;
}`
$('head').append('<style>' + this.style + '</style>')
}
getNextPopup() {
let { popupId } = this.options.jump
this.elementData &&
this.elementData.forEach((item, index) => {
if (item.id === popupId) {
this.hidePopup() // 隐藏上一个弹框
new window.TA.RenderPopup(
item,
index,
this.isProps,
this.elementData
).showPopup() // 展示下一个弹层
$('.land_wrap').css('height', $(window).height())
}
})
}
event() {
let { type, android, ios } = this.options.jump
let { enable } = this.options.form
let { name } = this.options
let self = this
let isSend = false
// 点击表单
$(`.popup${this.number} .form`).on('click', function(e) {
e.stopPropagation()
})
const btnSelector = `.popup${this.number} .popup-img`
buryAOId(btnSelector)
// 点击弹层按钮
$(btnSelector).on('click', function(e) {
// 只处理自己触发的事件
if (!$(e.target).hasClass('popup-img')) {
return
}
// 不存在表单且类型为关闭则关闭
if (type === 'close' && !enable) {
self.hidePopup()
}
// 如果存在表单
if (
(type === 'close' || type === 'popup' || type === 'link') &&
enable === 1
) {
var isClick = false
if (
!Verify.verifyTel(
$(`.popup${self.number} .conTel1`),
$(`.popup${self.number} .conTel1`).attr('required')
)
) {
return false
}
var data = {
landId: window.atob(Util.getUrlParameter('id')),
channel: 'formTemplate',
userPhone: $(`.popup${self.number} .conTel1`)
.val()
.trim(),
listUserInfo: JSON.stringify({
formId: self.options.id,
formName: self.options.name
})
}
if ($(`.popup${self.number} .concode`).length) {
var codeStatus = Verify.regCode(
$(`.popup${self.number} .concode`).val()
)
var codeFlag = true
var codeErrText = ''
if (codeStatus === 0) {
codeFlag = false
data['smsCode'] = $(`.popup${self.number} .concode`)
.val()
.trim()
} else if (codeStatus === 1) {
codeErrText = '验证码不能为空'
} else if (codeStatus === 2) {
codeErrText = '验证码格式不正确'
}
if (codeFlag) {
pp.note(codeErrText, {
mask: false,
closeTime: 2000
})
return false
}
}
if (!isClick) {
isClick = true
window.xhr = $.ajax({
url: '/activity/land/submitForm',
type: 'POST',
timeout: 6000,
dataType: 'json',
data,
success: function(res) {
if (res.success) {
setTimeout(function() {
pp.note('保存成功', {
mask: false,
closeTime: 2000
})
}, 0)
let extraParam = {}
let { verify } = self.options.form
verify && (extraParam.mobileVerify = 1)
if (type === 'close') {
self.hidePopup()
}
commonJumpLogic({
componentData: self.options,
jump: self.options.jump,
options: { location: name, ...extraParam },
popupCallback: () => {
self.getNextPopup()
}
})
} else {
setTimeout(function() {
pp.note('验证码错误', {
mask: false,
closeTime: 2000
})
}, 0)
}
isClick = false
},
error: function(XHR, status) {
if (status === 'timeout') {
window.xhr && window.xhr.abort()
setTimeout(function() {
pp.note('请求超时', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note('网络错误', {
mask: false,
closeTime: 2000
})
}, 0)
}
pp.hideing()
},
complete: function(e) {
pp.hideing()
}
})
// { btn: 'click' }
} else {
return false
}
} else {
// 如果不存在表单
commonJumpLogic({
componentData: self.options,
jump: self.options.jump,
options: { location: name },
popupCallback: () => {
self.getNextPopup()
}
})
}
})
// 点击关闭按钮
$(`.popup${this.number} .popup-close`).on('click', function(e) {
self.hidePopup()
e.stopPropagation()
})
// 点击验证码按钮
$(`.popup${this.number} .yzmbtn`).on('click', function(e) {
if (
!isSend &&
Verify.verifyTel(
$(`.popup${self.number} .conTel1`),
$(`.popup${self.number} .conTel1`).attr('required')
)
) {
isSend = true
let time = 60
var data = {
phone: $(`.popup${self.number} .conTel1`)
.val()
.trim(),
landId: window.atob(Util.getUrlParameter('id')),
landSubId: window.atob(Util.getUrlParameter('id')) + '-1',
channel: 'formTemplate'
}
pp.loading()
window.xhr = $.ajax({
url: '/activity/land/sendCode',
type: 'GET',
timeout: 6000,
dataType: 'json',
data: data,
success: function(res) {
if (res.success) {
setTimeout(function() {
pp.note('验证码获取成功', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note(res.desc, {
mask: false,
closeTime: 2000
})
}, 0)
}
},
error: function(XHR, status) {
if (status === 'timeout') {
window.xhr && window.xhr.abort()
setTimeout(function() {
pp.note('请求超时', {
mask: false,
closeTime: 2000
})
}, 0)
} else {
setTimeout(function() {
pp.note('网络错误', {
mask: false,
closeTime: 2000
})
}, 0)
}
pp.hideing()
},
complete: function(e) {
pp.hideing()
}
})
var int = setInterval(function() {
$(`.popup${self.number} .yzmbtn`).text(time + 's')
time--
if (!time) {
clearInterval(int)
$(`.popup${self.number} .yzmbtn`).text('发送验证码')
isSend = false
}
}, 1000)
}
e.stopPropagation()
})
}
renderChild() {
let { elements } = this.options
elements.forEach((item, index) => {
let idx = '-popup-' + index
let selector = `.popup${this.number} .popup-img`
switch (item.type) {
case 'button':
new window.TA.RenderButton(
item,
idx,
this.isProps,
elements,
selector
)
break
case 'image':
new window.TA.RenderImage(
item,
idx,
this.isProps,
elements,
selector
)
break
case 'text':
new window.TA.RenderText(
item,
idx,
this.isProps,
elements,
selector
)
break
case 'QRCode':
new window.TA.RenderQRCode(
item,
idx,
this.isProps,
elements,
selector
)
break
}
})
}
}
window.TA.RenderPopup = RenderPopup
})(Zepto)
import Util from 'render/libs/utils'
import { commonJumpLogic } from 'render/libs/common'
;(function($) {
class RenderQRCode {
constructor(result, index, isProps, elementConfig,selector) {
let defaultValue = {
style: {}
}
this.number = index
this.options = $.extend(true, defaultValue, result)
this.elementConfig = elementConfig
this.isProps = isProps
this.$mountNode = $(selector || '.land_wrap')
this.$el = ''
this.init()
}
init() {
this.$el = $(
`<div class="land-QRCode${this.number}"><div class="land-QRCode-wrap">
<img src="${this.options.src}" alt="">
</div></div>`
)
this.$mountNode.append(this.$el)
this.renderStyle()
this.event()
}
renderStyle() {
let { style, fixed } = this.options
let styleCss = Object.assign(
{},
Util.transformCss(style, this.isProps),
{ position: !fixed ? 'absolute' : 'fixed' },
{ display: 'table' }
)
$(`.land-QRCode${this.number}`).css(styleCss)
$(`.land-QRCode${this.number} .land-QRCode-wrap`).css({})
}
event() {
this.$el.longPress(() => {
commonJumpLogic({
componentData: this.options,
jump: this.options.jump,
options: { location: name }
})
})
}
}
window.TA.RenderQRCode = RenderQRCode
})(Zepto)
import Util from 'render/libs/utils';
import { buryAOId } from 'render/libs/helper'
import { commonJumpLogic } from 'render/libs/common'
(function($) {
class RenderText {
constructor(result, index, isProps, elementConfig,selector) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.isIpone = navigator.userAgent.indexOf('iPhone')
this.number = index
this.elementConfig = elementConfig
this.isProps = isProps
this.style = ''
this.$mountNode = $(selector || '.land_wrap')
this.init()
}
init() {
let textElem = $(`<div class="land-text${this.number}"><div class="land-text-wrap"></div></div>`)
this.$mountNode.append(textElem)
this.renderStyle()
this.event()
// this.initPopup()
}
initPopup() {
let {
type,
popupId
} = this.options.jump
if (type === 'popup') {
this.elementConfig && this.elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(item, index, this.isProps, this.elementConfig).showPopup();
$('.land_wrap').css('height', $(window).height());
}
})
}
}
renderStyle() {
let {
text,
style,
fixed
} = this.options
let {
verticalAlign
} = this.options.style
let styleCss = Object.assign({},
Util.transformCss(style, this.isProps), { 'position': fixed === 0 ? 'absolute' : 'fixed' }, { 'display': 'table' })
$(`.land-text${this.number}`).css(styleCss)
$(`.land-text${this.number} .land-text-wrap`).html(text)
$(`.land-text${this.number} .land-text-wrap`).css({
'display': 'table-cell',
'vertical-align': verticalAlign
})
}
event() {
let {
type
} = this.options.jump
let {
name
} = this.options
let self = this
const selector = `.land_wrap .land-text${this.number} .land-text-wrap`
if (type === 'link') {
buryAOId(selector)
}
if (type !== 'none') {
$(selector).on('click', function() {
commonJumpLogic({
componentData: self.options,
jump: self.options.jump,
options: { location: name },
popupCallback: () => { self.initPopup() }
})
})
}
}
}
window.TA.RenderText = RenderText
})(Zepto)
\ No newline at end of file
import Util from 'render/libs/utils'
import pp from 'render/libs/popup'
import '../rotate'
;(function($) {
class RenderTurnCircle {
constructor(result, index, isProps, elementData) {
let defaultValue = {
style: {}
}
this.options = $.extend(true, defaultValue, result)
this.elementData = elementData
this.isProps = isProps
// 根据设定概率扔入奖池(以数组下标为奖池索引)
this.pricePool = []
// 大于零的奖品逻辑
this.options.awardSetting.forEach((item, index) => {
let probability = Number(item.probability) || 0
if (probability) {
for (var i = 0; i < probability * 100; i++) {
this.pricePool.push(index)
}
}
})
// 等于零的奖品逻辑,平摊剩余的可能性
let zeroArr = []
this.options.awardSetting.forEach((item, idx) => {
if (Number(item.probability) === 0) zeroArr.push(idx)
})
let zeroArrIndex = 0
for (var i = this.pricePool.length; i < 100; i++) {
this.pricePool.push(zeroArr[zeroArrIndex])
if (zeroArrIndex >= zeroArr.length - 1) {
zeroArrIndex = 0
} else {
zeroArrIndex++
}
}
this.style = ''
this.number = index
this.onOff = true
this.poponff = true
this.init()
}
init() {
// this.initPopup()
this.renderDom()
this.renderStyle()
this.event()
}
// turntable只跳弹层
initPopup(priceIndex) {
// 兼容旧代码
// let popupId
// let jump = this.options.baseContent.jump
// if (jump) {
// popupId = jump.popupId
// } else {
// let price = this.options.awardSetting[priceIndex]
// popupId = price.popupId
// }
let price = this.options.awardSetting[priceIndex]
let popupId = price.popupId
this.elementData &&
this.elementData.forEach((item, index) => {
if (item.id === popupId) {
new window.TA.RenderPopup(
item,
index,
this.isProps,
this.elementData
).showPopup()
$('.land_wrap').css('height', $(window).height())
}
})
}
renderDom() {
let { awardSetting } = this.options
let $circle = $(`<div class='land-circle-wrap${this.number}'>
<div class='land-circle-wrap-container'></div>
<img src="//yun.tuisnake.com/h5/activity/turntable_circle/images/radius-2.png" />
<img src=${
this.options.visualElement.bgImg
} class="land-backgrounp" />
<div class="land-btn"></div>
<div class="land-circle"></div>
<div class="land-point"></div>
</div>
</div>`)
$('.land_wrap').append($circle)
awardSetting &&
awardSetting.forEach((item, index) => {
let _prize = `<div class="prize" index=${item.probability} key=${
item.key
} ${
item.img ? '' : 'style="display:none"'
}><div class="prize-dialog"><p style="word-break:break-all;">${
item.awardName
}</p><img class="prize-img" src=${item.img} /></div></div>`
$(`.land-circle-wrap${this.number} .land-circle`).append(_prize)
})
}
renderStyle() {
let {
width,
height,
zIndex,
top,
left,
opacity,
borderStyle,
borderWidth,
borderColor
} = this.options.style
let { btnImg, guideImg } = this.options.visualElement
const borderColorImg = this.options.visualElement.borderColor
const borderWidthImg = this.options.visualElement.borderWidth
this.style +=
`.land-circle-wrap${this.number}` +
`{
position: absolute;
transform: rotate3d(0, 0, 1, 0deg);
border-radius: 50%;
z-index: ${zIndex};
width: ${Util.fitSize(width, this.isProps)};
height: ${Util.fitSize(height, this.isProps)};
top: ${Util.fitSize(top, this.isProps)};
left: ${Util.fitSize(left, this.isProps)};
background: ${borderColorImg};
}`
this.style +=
`.land-circle-wrap${this.number} .land-backgrounp` +
`{
position: absolute;
padding: ${Util.fitSize(borderWidthImg, this.isProps)};
width: 100%;
height: 100%;
top: 0;
left: 0;
}`
this.style +=
`.land-circle-wrap${this.number} .land-circle` +
`{
position: absolute;
transform: rotate3d(0, 0, 1, 0deg);
width: ${Util.fitSize(width, this.isProps)};
height: ${Util.fitSize(height, this.isProps)};
border-radius: 50%;
z-index: ${zIndex};
top: 0;
left: 0;
opacity: ${opacity};
border: ${Util.fitSize(
borderWidth,
this.isProps
)} ${borderStyle} ${borderColor};
background-size: 100%;
}`
this.style +=
`.land-circle-wrap${this.number} .land-btn` +
`{
position: absolute;
z-index: ${zIndex + 1};
width: ${
this.isProps === '375px'
? ((220 / 200) * 64) / 75
: 188 / 200
}rem;
height: ${
this.isProps === '375px'
? ((220 / 200) * 64) / 75
: 188 / 200
}rem;
background: url("${btnImg}") no-repeat;
background-size: 100%;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}`
this.style +=
`.land-circle-wrap${this.number} .prize-dialog` +
`{
font-size: ${Util.fitSize(12, this.isProps)};
width: ${
this.isProps === '375px'
? ((150 / 200) * 64) / 75
: 128 / 200
}rem;
height: ${
this.isProps === '375px'
? ((150 / 200) * 64) / 75
: 128 / 200
}rem;
top: ${
this.isProps === '375px'
? ((90 / 200) * 64) / 75
: 76 / 200
}rem;
left: ${Util.fitSize(73, this.isProps)};
margin-top: ${Util.fitSize(24, this.isProps)};
}`
this.style +=
`.land-circle-wrap${this.number} .prize-img` +
`{
width: ${
this.isProps === '375px'
? ((110 / 200) * 64) / 75
: 94 / 200
}rem;
height: ${
this.isProps === '375px'
? ((110 / 200) * 64) / 75
: 94 / 200
}rem;
}`
this.style +=
`.land-circle-wrap${this.number} .land-point` +
`{
position: absolute;
width: ${
this.isProps === '375px'
? ((42 / 200) * 64) / 75
: 36 / 200
}rem;
height: ${
this.isProps === '375px'
? ((68 / 200) * 64) / 75
: 58 / 200
}rem;
z-index: ${zIndex + 20};
background: url("${guideImg}") no-repeat;
background-size: 100%;
left: 50%;
top: -10px;
transform: translate(-50%);
}`
$('head').append('<style>' + this.style + '</style>')
}
event() {
let self = this
let { name } = this.options
let { startTime, endTime } = this.options.baseContent
$(document).on(
'click',
`.land-circle-wrap${this.number} .land-btn`,
function() {
if (Date.now() <= startTime || Date.now() >= endTime) {
pp.note('活动不在参与时间范围内', {
mask: false,
closeTime: 2000
})
return
}
self.poponff = true
if (self.onOff) {
self.onOff = false
window.countLog.sendClickData(
function() {
let resultInfo = self.getAngleRotate()
$(
`.land-circle-wrap${
self.number
} .land-circle, .land-circle-wrap${
self.number
} .land-backgrounp`
).stopRotate()
$(
`.land-circle-wrap${
self.number
} .land-circle, .land-circle-wrap${
self.number
} .land-backgrounp`
).rotate({
angle: 0,
animateTo: resultInfo.animateToAngle,
duration: 3000,
easing: function(x, t, b, c, d) {
return -c * ((t = t / d - 1) * t * t * t - 1) + b
},
callback: function() {
if (self.poponff) {
self.poponff = false
self.onOff = true
self.initPopup(resultInfo.priceIndex)
}
}
})
},
{ location: name, compId: self.options.id }
)
}
}
)
}
getAngleRotate() {
const randomIndex = Math.floor(Math.random() * 100)
// 中奖奖品旋转角度
let rotateAngles = [1410, 1350, 1290, 1230, 1170, 1110].map(
item => item + 360
)
let priceIndex = this.pricePool[randomIndex]
return {
animateToAngle: rotateAngles[priceIndex],
priceIndex
}
}
getRotateAngle() {
return (
$(`.land-circle-wrap${this.number} .land-circle`).getRotateAngle() % 60
)
}
}
window.TA.RenderTurnCircle = RenderTurnCircle
})(Zepto)
import Util from 'render/libs/utils';
import pp from 'render/libs/popup';
import { commonJumpLogic } from 'render/libs/common';
(function($) {
class RenderWechat {
constructor(result, index, isProps) {
let defaultValue = {
style: {}
}
this.style = ''
this.options = $.extend(true, defaultValue, result)
this.number = index
this.isProps = isProps
this.init()
}
init() {
let {
username
} = this.options.wechat;
let wechatElem = $(`<div class="wechat${this.number}">
<div class="wechat-user">
<img class="wechat-user-img"/>
<span class="wechat-user-name"></span>
</div>
<div class="wechat-btn" data-clipboard-action="copy" propy="${username}"></div>
</div>`)
$('.land_wrap').append(wechatElem)
this.renderStyle()
this.event()
}
renderStyle() {
let {
type
} = this.options.fixed;
let {
height
} = this.options.style
let styleCss = Object.assign({},
Util.transformCss(this.options.style, this.isProps), {
'position': type === 'bottom' || type === 'top' ? 'fixed' : 'absolute',
'line-height': Util.fitSize(height, this.isProps)
}
)
$(`.wechat${this.number}`).css(styleCss)
let imgCss = Util.transformCss(this.options.wechat.avatar.style, this.isProps)
$(`.wechat${this.number} .wechat-user .wechat-user-img`).css(imgCss)
let nameCss = Object.assign({},
Util.transformCss(this.options.wechat.name.style, this.isProps), {
'margin-left': Util.fitSize('10px', this.isProps)
}
)
$(`.wechat${this.number} .wechat-user .wechat-user-name`).css(nameCss)
let btnCss = Object.assign({},
Util.transformCss(this.options.btn.style, this.isProps), {
'position': 'absolute',
'right': Util.fitSize('10px', this.isProps),
'top': Util.fitSize('14px', this.isProps)
}
)
$(`.wechat${this.number} .wechat-btn`).css(btnCss)
$(`.wechat${this.number} .wechat-user .wechat-user-img`).attr('src', this.options.wechat.avatar.src)
this.style += `.wechat${this.number} .wechat-user` + `{
display: inline-block;
margin-left: ${Util.fitSize('10px', this.isProps)};
}`
$(`.wechat${this.number} .wechat-user .wechat-user-name`).text(this.options.wechat.name.text)
$(`.wechat${this.number} .wechat-btn`).text(this.options.btn.text)
$('head').append('<style>' + this.style + '</style>')
}
event() {
let {
name
} = this.options;
let self = this;
window.Loader.async(["//yun.tuisnake.com/h5-mami/insurance/taobao/clipboard.min.js"], function() {
var clipboard = new Clipboard(`.land_wrap .wechat${self.number} .wechat-btn`, {
text: function(trigger) {
return $(`.land_wrap .wechat${self.number} .wechat-btn`).attr('propy')
}
});
clipboard.on("success", function(element) { //复制成功的回调
setTimeout(function() {
pp.note('复制成功', {
mask: false,
closeTime: 1000
})
}, 0)
});
clipboard.on('error', function(e) {
console.info("复制失败");
});
})
$(`.land_wrap .wechat${this.number} .wechat-btn`).on('click', function() {
commonJumpLogic({
componentData: self.options,
jump: self.options.jump,
options: { location: name }
})
})
}
}
window.TA.RenderWechat = RenderWechat
})(Zepto)
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,viewport-fit=cover" />
<link rel="dns-prefetch" href="//yun.tuia.cn" />
<link rel="dns-prefetch" href="//yun.tuisnake.com" />
<link rel="dns-prefetch" href="//yun.pansyta.com" />
<link rel="dns-prefetch" href="//yun.dahliata.com" />
<link rel="dns-prefetch" href="//yun.iristta.com" />
<link rel="dns-prefetch" href="//yun.freesiata.com" />
<link rel="dns-prefetch" href="//yun.shisrd.com" />
<link rel="dns-prefetch" href="//yun.heisldg.com" />
<script>
!(function (e, i) {
var t = e.documentElement,
n = navigator.userAgent.match(/iphone|ipod|ipad/gi),
a = n ? Math.min(i.devicePixelRatio, 3) : 1,
m = 'orientationchange' in window ? 'orientationchange' : 'resize'
t.dataset.dpr = a
for (
var d, l, c = !1, o = e.getElementsByTagName('meta'), r = 0; r < o.length; r++
)
(l = o[r]), 'viewport' == l.name && ((c = !0), (d = l))
if (c)
d.content =
'width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,viewport-fit=cover'
else {
var o = e.createElement('meta');
(o.name = 'viewport'),
(o.content =
'width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,viewport-fit=cover'
),
t.firstElementChild.appendChild(o)
}
var s = function () {
var e = t.clientWidth
e / a > 640 && (e = 640 * a),
(window.remScale = e / 640),
(t.style.fontSize = 200 * (e / 640) + 'px')
}
s(), e.addEventListener && i.addEventListener(m, s, !1)
})(document, window)
</script>
<% if (htmlWebpackPlugin.options.JIMU_ENV !== 'prod') { %>
<script type="text/javascript">
;
(function () {
if (!/eruda=true/.test(window.location.href)) return
var oHead = document.head
var oScript = document.createElement('script')
oScript.type = 'text/javascript'
oScript.src = '//yun.tuia.cn/h5-mami/optimize/eruda.min.js'
oHead.appendChild(oScript)
oScript.onload = function () {
eruda.init()
}
})()
</script>
<% } %> <% if (htmlWebpackPlugin.options.JIMU_ENV === 'prod') { %>
<script type="text/javascript">
!function () {
var host = "//activity.tuisnake.com/statistics/activityPagePerf";
var data = {
type: "landpage",
id: -1,
cid: -1,
oId: -1,
s: 1,
_t: +new Date()
};
function send() {
var m1 = /[\?&]id=([^#&]*)/.exec(location.href);
if (m1) {
data.id = m1[1];
}
var m2 = /[\?&]a_cid=([^#&]*)/.exec(location.href);
if (m2) {
data.cid = m2[1];
}
var m4 = /[\?&]a_oId=([^#&]*)/.exec(location.href);
if (m4) {
data.oId = m4[1];
}
new Image().src = "".concat(host, "?id=").concat(data.id, "&cid=").concat(data.cid, "&oid=").concat(data.oId, "&s=").concat(data.s, "&_t=").concat(data._t);
}
try {
send();
} catch (e) {
data.s = 0;
new Image().src = "".concat(host, "?id=").concat(data.id, "&cid=").concat(data.cid, "&oid=").concat(data.oId, "&s=").concat(data.s, "&_t=").concat(data._t);
}
}();
</script>
<script type="text/javascript" src="//yun.tuisnake.com/h5-mami/log.js?t=1547205079675" id="send_log"></script>
<% } else { %>
<script type="text/javascript" src="//yun.dui88.com/h5-mami/log-test/v1/log-test.js" id="send_log"></script>
<% } %>
<title></title>
<link href="//yun.dui88.com/jimu/swiper.min.css" rel="stylesheet" />
<script src="//yun.dui88.com/jimu/swiper.min.js"></script>
<style>
#__loading {
position: fixed;
z-index: 1000;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
}
#__loading img {
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
}
</style>
<style>
.reload_tips {
position: fixed;
z-index: 2000;
display: none;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
margin: auto;
background: rgba(40, 40, 40, 0.85);
min-width: 124px;
max-width: 80%;
background: rgba(40, 40, 40, 0.85);
text-align: center;
border-radius: 3px;
color: #fff;
font-size: 16px;
margin: 0;
word-break: break-all;
line-height: 1.5;
padding: 10px 5px;
}
.show_reload_tips {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
body {
transition: transform 0.5s;
min-height: 100vh;
}
</style>
<script>
//超时toast
;
(function () {
var tipsTimer = setTimeout(function () {
var el = document.querySelector('#reload-tips')
el.classList.add('show_reload_tips')
//下拉刷新
var start = 0
var end = 0
var offset = 0
window.addEventListener('touchstart', function (e) {
var scrollTop = document.body.scrollTop
if (scrollTop > 10) return
start = e.touches[0].screenY
})
window.addEventListener('touchmove', function (e) {
var scrollTop = document.body.scrollTop
if (scrollTop > 10) return
end = e.touches[0].screenY
offset = end - start
document.querySelector('body').style.transform =
'translate(0,' + (offset > 50 ? 50 : offset) + 'px)'
})
window.addEventListener('touchend', function (e) {
document.querySelector('body').style.transform = 'translate(0,0)'
if (offset > 50) {
window.location.reload()
}
})
setTimeout(function () {
el.classList.remove('show_reload_tips')
}, 3000)
}, 5000)
window.onload = function () {
clearTimeout(tipsTimer)
console.log('load')
}
})()
</script>
</head>
<body>
<div class="reload_tips" id="reload-tips">
当前页面加载慢<br />下拉可重新加载页面
</div>
<div id="__loading">
<img src="//yun.tuisnake.com/jimu/balls.svg" />
</div>
</body>
</html>
\ No newline at end of file
import 'render/libs/base'
import './entry.less'
import './actBase.js'
import Util from 'render/libs/utils'
import { commonJumpLogic } from './libs/common'
window.FastClick = require('render/libs/fastclick')
;(function() {
FastClick.attach(document.body)
var defaultConfig, defaultWrapConfig, StyleConfig
let Template = {
init() {
let _self = this
// 获取皮肤数据
_self.getSkinInfo(result => {
// 初始化dom结构
_self.initElement(result)
})
},
getSkinInfo(callBack) {
let params = {
id: Util.getUrlParameter('id')
}
// 判断是本地开发环境
$.ajax({
url: '/activity/land/landPageDetail',
data: params,
success: result => {
try {
// 兼容后端返回text/html的情况
if (typeof result !== 'object') {
result = JSON.parse(result)
}
if (result.success === true) {
callBack &&
callBack({
data: {
pageJson: result.data.html
}
})
} else {
throw new Error('请求数据失败')
}
} catch (e) {
console.error('解析响应数据失败')
}
}
})
},
initElement(result) {
let _self = this
try {
// fixme
const data = JSON.parse(result.data.pageJson)
// const data = result.data.pageJson
if (result) {
defaultConfig = data.elements
defaultWrapConfig = data.page
}
StyleConfig = $.extend(true, [], defaultConfig)
_self.createElement(defaultWrapConfig, StyleConfig)
// 执行自定义代码
const code = data.page.code
code && setTimeout(() => eval(code), 100)
} catch (e) {
console.log(e)
}
},
createElement(wrapElementConfig, elementConfig) {
let _self = this
let isProps = wrapElementConfig.width
if (wrapElementConfig) {
let wrap = $('<div class="land_wrap"></div>')
$('body').prepend(wrap)
_self.initPage(wrapElementConfig, isProps, elementConfig)
}
elementConfig &&
elementConfig.forEach((item, index) => {
switch (item.type) {
case 'button':
new window.TA.RenderButton(item, index, isProps, elementConfig)
break
case 'image':
new window.TA.RenderImage(item, index, isProps, elementConfig)
break
case 'turntable':
new window.TA.RenderTurnCircle(
item,
index,
isProps,
elementConfig
)
break
case 'wechat':
new window.TA.RenderWechat(item, index, isProps)
break
// case 'popup':
// new window.TA.RenderPopup(item, index, isProps);
// break;
case 'mobile':
new window.TA.RenderMobile(item, index, isProps)
break
case 'carousel':
new window.TA.RenderCarousel(item, index, isProps)
break
case 'text':
new window.TA.RenderText(item, index, isProps, elementConfig)
break
case 'address':
new window.TA.RenderAddress(item, index, isProps)
break
case 'download':
new window.TA.RenderDownload(item, index, isProps, elementConfig)
break
case 'form':
new window.TA.RenderForm(item, index, isProps, elementConfig)
break
case 'countdown':
new window.TA.RenderCountdown(item, index, isProps, elementConfig)
break
case 'counter':
new window.TA.RenderCounter(item, index, isProps, elementConfig)
break
case 'QRCode':
new window.TA.RenderQRCode(item, index, isProps, elementConfig)
}
})
},
initPopup(data, isProps, elementConfig) {
let { popupId } = data.autoJump
elementConfig &&
elementConfig.forEach((item, index) => {
if (item.id === popupId) {
this.popId = index
new window.TA.RenderPopup(
item,
index,
isProps,
elementConfig
).showPopup()
$('.land_wrap').css('height', $(window).height())
}
})
},
// 初始化整个背景页面
initPage(data, isProps, elementConfig) {
let self = this
this.style = ''
this.isIpone = navigator.userAgent.indexOf('iPhone')
if (data.title) {
document.title = data.title
}
let {
width,
height,
backgroundColor,
backgroundImage,
backgroundRepeat,
backgroundSize,
autoJump,
name
} = data
this.style += `.land_wrap {
width: ${Util.fitSize(width, isProps)};
height: ${Util.fitSize(height, isProps)};
overflow: hidden;
}
@keyframes scaleAnim {
from {
transform: scale(1);
-webkit-tranform: scale(1);
}
to {
transform: scale(0.9);
-webkit-transform: scale(0.9);
}
}`
$('head').append('<style>' + this.style + '</style>')
// 背景色和背景图铺满屏幕
$('html,body').css({
backgroundColor,
backgroundImage,
backgroundRepeat,
backgroundSize: '100% auto'
})
if (autoJump.enable === 1) {
setTimeout(function() {
commonJumpLogic({
jump: autoJump,
options: { location: '自动跳转', _id: 'page$1234567890' },
popupCallback: () => {
self.initPopup(data, isProps, elementConfig)
}
})
}, autoJump.delay * 1000)
}
// 首页loading逻辑
let imgUrl = backgroundImage.replace(
/url\("([\s\S]*)"\)/,
(_, matches) => matches
)
let removeLoading = () =>
document.getElementById('__loading') &&
document.getElementById('__loading').remove()
if (imgUrl) {
let img = document.createElement('img')
img.src = imgUrl
img.onload = removeLoading
img.onerror = removeLoading
if (img.complete) removeLoading()
} else {
removeLoading()
}
// 兜底删除loading
setTimeout(removeLoading, 2000)
}
}
Template.init()
})()
@import './styles/common.less';
@import '../styles/font.less';
.land_wrap {
position: relative;
.land-circle {
.prize {
position: absolute;
width: 50%;
height: 50%;
transform-origin: right bottom;
.prize-dialog {
position: absolute;
text-align: center;
transform: skewY(-30deg) rotate(-30deg);
}
}
.prize:nth-child(1){
transform:rotate(60deg) skewY(30deg)
}
.prize:nth-child(2){
transform:rotate(120deg) skewY(30deg)
}
.prize:nth-child(3){
transform:rotate(180deg) skewY(30deg)
}
.prize:nth-child(4){
transform:rotate(240deg) skewY(30deg)
}
.prize:nth-child(5){
transform:rotate(300deg) skewY(30deg)
}
.prize:nth-child(6){
transform:rotate(360deg) skewY(30deg)
}
}
.land-form-input {
border: none !important;
}
.land-form-select {
appearance:none;
-moz-appearance:none;
-webkit-appearance:none;
}
}
.clearfix {
zoom: 1;
}
.clearfix:after {
display: table;
clear: both;
content: '';
}
// .land-form-input::-webkit-input-placeholder { /* WebKit browsers */ text-align: right;}
// .land-form-input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ text-align: right;}
// .land-form-input::-moz-placeholder { /* Mozilla Firefox 19+ but I'm not sure about working */ text-align: right;}
// .land-form-input:-ms-input-placeholder { /* Internet Explorer 10+ */ text-align: right;}
/**
* 广告提供给第三方客户JS
* Created by Anthony li on 2017/3/13
* updated by ylx on 2018/10/31
* 提供复制功能
*/
let prefix =
process.env.NODE_ENV === 'prod'
? '//activity.yuyiya.com'
: '//activity.tuiatest.cn'
function getUrlParameter(name, path = window.location.href) {
const result =
decodeURIComponent(
(new RegExp('[?|&]' + name + '=([^&;]+?)(&|#|;|$)').exec(path) || [
undefined,
''
])[1].replace(/\+/g, '%20')
) || null
return result ? result.split('/')[0] : ''
}
;(function(window, document) {
var json = null
var count = 0,
count1 = 0,
count2 = 0,
timeCount = 0,
startTime = 0,
endTime = 0
var perSec
var sessionID =
parseInt(Math.random() * 9999) +
parseInt(new Date().getTime())
.toString()
.substr(5, 8) //取随机值作为sessionID
var adverter = {
init: function() {
this.setCookie()
// if (!!document.getElementById('send_log')) {
// adverter.countInit();
// this.visibilityListen();
// }
adverter.setCountLog()
},
setCountLog: function() {
document.addEventListener(
'touchstart',
function() {
startTime = new Date()
},
false
) //事件代理
document.addEventListener(
'touchend',
function(e) {
if (!e.path) {
e.path = [e.target, e.target.parentNode]
}
for (let i = e.path.length - 1; i >= 0; --i) {
if (!!e.path[i].dataset && e.path[i].dataset.settingClick) {
adverter.setClickEvent(e, e.path[i])
}
if (!!e.path[i].dataset && e.path[i].dataset.settingCopy) {
adverter.setCopyEvent(e, e.path[i])
}
if (!!e.path[i].dataset && e.path[i].dataset.settingPress) {
adverter.setPressEvent(e, e.path[i])
}
}
},
false
) //事件代理
},
setClickEvent: function(e, element) {
// console.log(e.type)
if (
element.tagName == 'A' &&
!!element.getAttribute('href') &&
element.getAttribute('href').indexOf('javascript:') == -1
) {
event.preventDefault()
countLog.init(
function() {
console.log('点击转化发送OK')
window.location.href = element.getAttribute('href')
},
{
location: element.getAttribute('data-setting-click')
}
)
} else {
countLog.init(
function() {
console.log('点击转化发送OK1')
},
{
location: element.getAttribute('data-setting-click')
}
)
}
return
},
setCopyEvent(e, element) {
var text = element.dataset.settingCopy
var rgxVar = text.match(/\$\{(.+?)\}/g)
if (rgxVar && rgxVar.length) {
for (let index = 0; index < rgxVar.length; index++) {
var name = rgxVar[index].replace('${', '')
name = name.replace('}', '')
text = text.replace(rgxVar[index], adverter.getparams(name))
}
}
adverter.copyBoard(text)
return
},
setPressEvent: function(e, element) {
endTime = new Date() - startTime
console.log(endTime)
if (endTime > 500) {
countLog.init(function() {}, {
location: element.getAttribute('data-setting-press')
})
console.log('触摸埋点发送OK')
}
},
copyBoard: function(text) {
var textArea = document.createElement('textarea')
textArea.style.position = 'fixed'
textArea.style.top = 0
textArea.style.left = 0
textArea.style.width = '2em'
textArea.style.height = '2em'
textArea.style.padding = 0
textArea.style.border = 'none'
textArea.style.outline = 'none'
textArea.style.boxShadow = 'none'
textArea.style.background = 'transparent'
textArea.value = text
document.body.appendChild(textArea)
var isReadOnly = textArea.hasAttribute('readonly')
if (!isReadOnly) {
textArea.setAttribute('readonly', '')
}
textArea.select()
textArea.setSelectionRange(0, textArea.value.length)
if (!isReadOnly) {
textArea.removeAttribute('readonly')
}
selectedText = textArea.value
try {
if (document.execCommand('copy')) {
console.log('复制成功')
} else {
console.log('您的浏览器不支持自动复制,请长按复制')
}
} catch (err) {
console.log('不能使用这种方法复制内容')
}
document.body.removeChild(textArea)
},
countInit: function() {
var startX = (startY = endX = endY = 0)
perSec = setInterval(adverter.countTime, 1000)
document.addEventListener('touchstart', function(event) {
count++
adverter.dataAnalysis('touch')
var touch = event.targetTouches[0]
startX = touch.pageX
startY = touch.pageY
var ev = ev || window.event
var target = ev.target || ev.srcElement
if (target.nodeName.toLowerCase() == 'input') {
adverter.dataAnalysis('input')
count2++
}
})
document.addEventListener(
'touchend',
function(event) {
endX = event.changedTouches[0].pageX
endY = event.changedTouches[0].pageY
var changeY = Math.abs(endY - startY)
var changeX = Math.abs(endX - startX)
if (endX !== 0 && endY !== 0) {
if (changeX > 5 || changeY > 5) {
adverter.dataAnalysis('move')
count1++
endX = 0
endY = 0
}
}
},
false
)
},
visibilityListen: function() {
var hidden, state, visibilityChange
if (typeof document.hidden !== 'undefined') {
hidden = 'hidden'
visibilityChange = 'visibilitychange'
state = 'visibilityState'
} else if (typeof document.mozHidden !== 'undefined') {
hidden = 'mozHidden'
visibilityChange = 'mozvisibilitychange'
state = 'mozVisibilityState'
} else if (typeof document.msHidden !== 'undefined') {
hidden = 'msHidden'
visibilityChange = 'msvisibilitychange'
state = 'msVisibilityState'
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden'
visibilityChange = 'webkitvisibilitychange'
state = 'webkitVisibilityState'
}
// document.addEventListener(visibilityChange, function () {
// if (document[state] !== "visible") {
// clearInterval(perSec)
// } else if (!!document.getElementById('send_log')) {
// sessionID = parseInt(Math.random() * 9999) + parseInt(new Date().getTime()).toString().substr(5, 8);
// count = 0;
// count1 = 0;
// count2 = 0;
// timeCount = 0;
// perSec = setInterval(adverter.countTime, 1000);
// }
// }, false);
},
countTime: function() {
adverter.dataAnalysis('perSec')
timeCount++
if (timeCount === 300) {
clearInterval(perSec)
}
},
getUrlParam: function() {
var param = []
var url =
location.search.replace(/^\?/, '') + location.hash.replace(/^\#/, '&')
if (url) {
url = url.split('&')
if (url.length > 0) {
for (var i = 0; i < url.length; i++) {
var obj = url[i].split('=')
if (obj[0].indexOf('a_') == 0) {
var key = obj[0].replace('a_', '')
var val = obj[1]
param.push({
key: key,
val: val
})
}
}
}
}
return param
},
cookie: function(a, b, c) {
if ('undefined' == typeof b) {
var d = null
if (document.cookie && '' != document.cookie)
for (var e = document.cookie.split(';'), f = 0; f < e.length; f++) {
var g = e[f].replace(/(^\s*)|(\s*$)/g, '')
if (g.substring(0, a.length + 1) == a + '=') {
d = decodeURIComponent(g.substring(a.length + 1))
break
}
}
return d
}
;(c = c || {}),
null === b && ((b = ''), (c = $.extend({}, c)), (c.expires = -1))
var h = ''
if (
c.expires &&
('number' == typeof c.expires || c.expires.toUTCString)
) {
var i
'number' == typeof c.expires
? ((i = new Date()),
i.setTime(i.getTime() + 24 * c.expires * 60 * 60 * 1e3))
: (i = c.expires),
(h = '; expires=' + i.toUTCString())
}
var j = c.path ? '; path=' + c.path : '',
k = c.domain ? '; domain=' + c.domain : '',
l = c.secure ? '; secure' : ''
document.cookie = [a, '=', encodeURIComponent(b), h, j, k, l].join('')
},
getoId: function() {
var flag = false
var search = location.search
if (search.indexOf('a_oId') !== -1 || this.cookie('_coll_oId')) {
flag = true
}
return flag
},
setCookie: function() {
var urlparam = this.getUrlParam()
var self = this
json = {
referrer: document.referrer,
url: location.href,
landId: getUrlParameter('id'),
origin: 1
}
if (urlparam.length > 0) {
for (var i = 0; i < urlparam.length; i++) {
json[urlparam[i].key] = urlparam[i].val
this.cookie('_coll_' + urlparam[i].key, urlparam[i].val, {
path: '/',
expires: 1
})
}
}
if (location.search.indexOf('a_oId') == -1) {
var cookieList = document.cookie.split(';')
for (var i = 0; i < cookieList.length; i++) {
if (cookieList[i].indexOf('_coll_') !== -1) {
var _key = cookieList[i].split('=')[0]
json[_key.substr(_key.indexOf('_coll_') + 6)] = cookieList[i].split(
'='
)[1]
}
}
}
if (json.oId && json.oId.indexOf('enc-') !== -1) {
this.sendEncLog({
type: 97,
json: JSON.stringify(json)
})
}
this.sendLog({
type: 7,
json: JSON.stringify(json)
})
this.sendLandLog({
type: 49,
json: JSON.stringify(json)
})
},
formatParams: function(data) {
//格式化参数
var arr = []
for (var name in data) {
arr.push(
encodeURIComponent(name) + '=' + encodeURIComponent(data[name])
)
}
return arr.join('&')
},
ajax: function(options) {
options = options || {}
if (!options.url || !options.callback) {
throw new Error('参数不合法')
}
//创建 script 标签并加入到页面中
var callbackName = ('jsonp_' + Math.random()).replace('.', '')
var oHead = document.getElementsByTagName('head')[0]
options.data[options.callback] = callbackName
var params = this.formatParams(options.data)
var oS = document.createElement('script')
oHead.appendChild(oS)
//创建jsonp回调函数
window[callbackName] = function(json) {
oHead.removeChild(oS)
clearTimeout(oS.timer)
window[callbackName] = null
options.success && options.success(json)
}
//发送请求
oS.src = options.url + '?' + params
//超时处理
if (options.time) {
oS.timer = setTimeout(function() {
window[callbackName] = null
oHead.removeChild(oS)
options.error &&
options.error({
message: '超时'
})
}, options.time)
}
},
sendDataLog: function(data) {
if (this.getoId()) {
this.ajax({
url: prefix + '/statistics/stopPageCount',
callback: 'callback',
data: data,
time: 3000,
success: function(result) {},
error: function(result) {}
})
}
},
// 发送普通落地页的接口
sendLog: function(data, callback) {
if (adverter.getparams('log') == 'test') {
data.type == 7 ? alert('type7 send!') : alert('type8 send!')
}
try {
if (this.getoId()) {
this.ajax({
url: prefix + '/log/inner',
callback: 'callback',
data: data,
time: 3000,
success: function(result) {
callback && callback(result)
},
error: function(result) {
callback && callback(result)
}
})
} else {
callback && callback()
}
} catch (e) {
callback && callback()
}
},
// 发送激励落地页的接口
sendEncLog: function(data, callback) {
try {
if (this.getoId()) {
this.ajax({
url: prefix + '/log/enc/inner',
callback: 'callback',
data: data,
time: 3000,
success: function(result) {
callback && callback(result)
},
error: function(result) {
callback && callback(result)
}
})
} else {
callback && callback()
}
} catch (e) {
callback && callback()
}
},
sendLandLog: function(data, callback) {
try {
if (this.getoId()) {
this.ajax({
url: prefix + '/log/landLog',
callback: 'callback',
data: data,
time: 3000,
success: function(result) {
callback && callback(result)
},
error: function(result) {
callback && callback(result)
}
})
} else {
callback && callback()
}
} catch (e) {
console.log(e)
callback && callback()
}
},
cloneObj: function(oldObj) {
var self = this
if (typeof oldObj != 'object') return oldObj
if (oldObj == null) return oldObj
var newObj = new Object()
for (var i in oldObj) {
newObj[i] = self.cloneObj(oldObj[i])
}
return newObj
},
extendObj: function() {
var args = arguments
if (args.length < 2) return
var temp = this.cloneObj(args[0])
for (var n = 1; n < args.length; n++) {
for (var i in args[n]) {
temp[i] = args[n][i]
}
}
return temp
},
dataAnalysis: function(action) {
var urlparam = this.getUrlParam()
var countData = {
sessionID: sessionID,
action: action,
touchNum: count,
inputNum: count2,
moveNum: count1
}
countData = Object.assign(countData, json)
adverter.sendDataLog(countData)
},
getparams: function(name) {
var regexS = '[\\?&]' + name + '=([^&#]*)'
var regex = new RegExp(regexS)
var results = regex.exec(location.href)
if (results === null) return ''
else return results[1]
}
}
adverter.init()
var countLog = {
init: function(callback, op, isActive) {
isActive = isActive || 'open'
var object = adverter.extendObj(json, op)
if (object.oId && object.oId.indexOf('enc-') !== -1) {
var encData = {
type: 98,
json: JSON.stringify(object)
}
adverter.sendEncLog(encData, callback)
}
var data = {
type: 8,
json: JSON.stringify(object)
}
if (isActive == 'open') {
adverter.sendLog(data, callback)
adverter.sendLandLog({
type: 50,
json: JSON.stringify(object)
})
} else if (isActive == 'close') {
adverter.sendLandLog(
{
type: 50,
json: JSON.stringify(object)
},
callback
)
} else {
adverter.sendLog(data, callback)
}
},
// 推啊建站点击数据埋点
sendClickData: function(callback, op) {
var object = adverter.extendObj(json, op)
var data = {
type: 110,
json: JSON.stringify(object)
}
adverter.sendLandLog(data, callback)
}
}
window.countLog = countLog
})(window, document)
/* eslint-disable */
// zepto.animate
(function($) {
var prefix = '',
eventPrefix,
vendors = {
Webkit: 'webkit',
Moz: '',
O: 'o'
},
testEl = document.createElement('div'),
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
transform,
transitionProperty,
transitionDuration,
transitionTiming,
transitionDelay,
animationName,
animationDuration,
animationTiming,
animationDelay,
cssReset = {};
function dasherize(str) {
return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase();
}
function normalizeEvent(name) {
return eventPrefix ? eventPrefix + name : name.toLowerCase();
}
$.each(vendors, function(vendor, event) {
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
prefix = '-' + vendor.toLowerCase() + '-';
eventPrefix = event;
return false;
}
});
transform = prefix + 'transform';
cssReset[(transitionProperty = prefix + 'transition-property')] = cssReset[
(transitionDuration = prefix + 'transition-duration')
] = cssReset[(transitionDelay = prefix + 'transition-delay')] = cssReset[
(transitionTiming = prefix + 'transition-timing-function')
] = cssReset[(animationName = prefix + 'animation-name')] = cssReset[
(animationDuration = prefix + 'animation-duration')
] = cssReset[(animationDelay = prefix + 'animation-delay')] = cssReset[
(animationTiming = prefix + 'animation-timing-function')
] =
'';
$.fx = {
off:
eventPrefix === undefined &&
testEl.style.transitionProperty === undefined,
speeds: {
_default: 400,
fast: 200,
slow: 600
},
cssPrefix: prefix,
transitionEnd: normalizeEvent('TransitionEnd'),
animationEnd: normalizeEvent('AnimationEnd')
};
$.fn.animate = function(properties, duration, ease, callback, delay) {
if ($.isFunction(duration))
(callback = duration), (ease = undefined), (duration = undefined);
if ($.isFunction(ease)) (callback = ease), (ease = undefined);
if ($.isPlainObject(duration))
(ease = duration.easing),
(callback = duration.complete),
(delay = duration.delay),
(duration = duration.duration);
if (duration)
duration =
(typeof duration == 'number'
? duration
: $.fx.speeds[duration] || $.fx.speeds._default) / 1000;
if (delay) delay = parseFloat(delay) / 1000;
return this.anim(properties, duration, ease, callback, delay);
};
$.fn.anim = function(properties, duration, ease, callback, delay) {
var key,
cssValues = {},
cssProperties,
transforms = '',
that = this,
wrappedCallback,
endEvent = $.fx.transitionEnd,
fired = false;
if (duration === undefined) duration = $.fx.speeds._default / 1000;
if (delay === undefined) delay = 0;
if ($.fx.off) duration = 0;
if (typeof properties == 'string') {
// keyframe animation
cssValues[animationName] = properties;
cssValues[animationDuration] = duration + 's';
cssValues[animationDelay] = delay + 's';
cssValues[animationTiming] = ease || 'linear';
endEvent = $.fx.animationEnd;
} else {
cssProperties = [];
// CSS transitions
for (key in properties)
if (supportedTransforms.test(key))
transforms += key + '(' + properties[key] + ') ';
else
(cssValues[key] = properties[key]),
cssProperties.push(dasherize(key));
if (transforms)
(cssValues[transform] = transforms), cssProperties.push(transform);
if (duration > 0 && typeof properties === 'object') {
cssValues[transitionProperty] = cssProperties.join(', ');
cssValues[transitionDuration] = duration + 's';
cssValues[transitionDelay] = delay + 's';
cssValues[transitionTiming] = ease || 'linear';
}
}
wrappedCallback = function(event) {
if (typeof event !== 'undefined') {
if (event.target !== event.currentTarget) return; // makes sure the event didn't bubble from "below"
$(event.target).unbind(endEvent, wrappedCallback);
} else $(this).unbind(endEvent, wrappedCallback); // triggered by setTimeout
fired = true;
!$(this).attr('stop') && $(this).css(cssReset);
callback && callback.call(this);
};
if (duration > 0) {
this.bind(endEvent, wrappedCallback);
// transitionEnd is not always firing on older Android phones
// so make sure it gets fired
setTimeout(function() {
if (fired) return;
wrappedCallback.call(that);
}, (duration + delay) * 1000 + 25);
}
// trigger page reflow so new elements can animate
this.size() && this.get(0).clientLeft;
this.css(cssValues);
if (duration <= 0)
setTimeout(function() {
that.each(function() {
wrappedCallback.call(this);
});
}, 0);
return this;
};
testEl = null;
})(Zepto);
/* eslint-disable */
/**
* @note 选择地址弹层
* @create 17/7/19
* @des 选择地址弹层
* 使用方法 _init_area()
*/
function Dsy() {
this.Items = {};
}
Dsy.prototype.add = function(id, iArray) {
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id) {
if (typeof(this.Items[id]) == "undefined") return false;
return true;
}
window.change = function(v) {
let i, ar
var str = "0";
for (i = 0; i < v; i++) {
str += ("_" + (document.getElementById(s[i]).selectedIndex - 1));
};
var ss = document.getElementById(s[v]);
ss.length = 0;
ss.options[0] = new Option(opt0[v], opt0[v]);
if (v && document.getElementById(s[v - 1]).selectedIndex > 0 || !v) {
if (dsy.Exists(str)) {
ar = dsy.Items[str];
for (i = 0; i < ar.length; i++) {
ss.options[ss.length] = new Option(ar[i], ar[i]);
} //end for
if (v) { ss.options[0].selected = true; }
}
} //end if v
if (++v < s.length) { change(v); }
}
var dsy = new Dsy();
dsy.add("0", ["北京市", "天津市", "上海市", "重庆市", "河北省", "山西省", "内蒙古", "辽宁省", "吉林省", "黑龙江省", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "广西", "海南省", "四川省", "贵州省", "云南省", "西藏", "陕西省", "甘肃省", "青海省", "宁夏", "新疆", "香港", "澳门", "台湾省"]);
dsy.add("0_0_0", ["东城区", "西城区", "崇文区", "宣武区", "朝阳区", "丰台区", "石景山区", "海淀区", "门头沟区", "房山区", "通州区", "顺义区", "昌平区", "大兴区", "怀柔区", "平谷区", "密云县", "延庆县", "延庆镇"]);
dsy.add("0_0", ["北京市"]);
dsy.add("0_1_0", ["和平区", "河东区", "河西区", "南开区", "河北区", "红桥区", "塘沽区", "汉沽区", "大港区", "东丽区", "西青区", "津南区", "北辰区", "武清区", "宝坻区", "蓟县", "宁河县", "芦台镇", "静海县", "静海镇"]);
dsy.add("0_1", ["天津市"]);
dsy.add("0_2_0", ["黄浦区", "卢湾区", "徐汇区", "长宁区", "静安区", "普陀区", "闸北区", "虹口区", "杨浦区", "闵行区", "宝山区", "嘉定区", "浦东新区", "金山区", "松江区", "青浦区", "南汇区", "奉贤区", "崇明县", "城桥镇"]);
dsy.add("0_2", ["上海市"]);
dsy.add("0_3_0", ["渝中区", "大渡口区", "江北区", "沙坪坝区", "九龙坡区", "南岸区", "北碚区", "万盛区", "双桥区", "渝北区", "巴南区", "万州区", "涪陵区", "黔江区", "长寿区", "合川市", "永川区市", "江津市", "南川市", "綦江县", "潼南县", "铜梁县", "大足县", "荣昌县", "璧山县", "垫江县", "武隆县", "丰都县", "城口县", "梁平县", "开县", "巫溪县", "巫山县", "奉节县", "云阳县", "忠县", "石柱土家族自治县", "彭水苗族土家族自治县", "酉阳土家族苗族自治县", "秀山土家族苗族自治县"]);
dsy.add("0_3", ["重庆市"]);
dsy.add("0_4_0", ["长安区", "桥东区", "桥西区", "新华区", "裕华区", "井陉矿区", "辛集市", "藁城市", "晋州市", "新乐市", "鹿泉市", "井陉县", "微水镇", "正定县", "正定镇", "栾城县", "栾城镇", "行唐县", "龙州镇", "灵寿县", "灵寿镇", "高邑县", "高邑镇", "深泽县", "深泽镇", "赞皇县", "赞皇镇", "无极县", "无极镇", "平山县", "平山镇", "元氏县", "槐阳镇", "赵县", "赵州镇"]);
dsy.add("0_4_1", ["桥西区", "桥东区", "宣化区", "下花园区", "宣化县", "张家口市宣化区", "张北县", "张北镇", "康保县", "康保镇", "沽源县", "平定堡镇", "尚义县", "南壕堑镇", "蔚县", "蔚州镇", "阳原县", "西城镇", "怀安县", "柴沟堡镇", "万全县", "孔家庄镇", "怀来县", "沙城镇", "涿鹿县", "涿鹿镇", "赤城县", "赤城镇", "崇礼县", "西湾子镇"]);
dsy.add("0_4_2", ["双桥区", "双滦区", "鹰手营子矿区", "承德县", "下板城镇", "兴隆县", "兴隆镇", "平泉县", "平泉镇", "滦平县", "滦平镇", "隆化县", "隆化镇", "丰宁满族自治县", "大阁镇", "宽城满族自治县", "宽城镇", "围场满族蒙古族自治县", "围场镇"]);
dsy.add("0_4_3", ["海港区", "山海关区", "北戴河区", "昌黎县", "昌黎镇", "抚宁县", "抚宁镇", "卢龙县", "卢龙镇", "青龙满族自治县", "青龙镇"]);
dsy.add("0_4_4", ["路北区", "路南区", "古冶区", "开平区", "丰润区", "丰南区", "遵化市", "迁安市", "滦县", "滦州镇", "滦南县", "倴城镇", "乐亭县", "乐亭镇", "迁西县", "兴城镇", "玉田县", "玉田镇", "唐海县", "唐海镇"]);
dsy.add("0_4_5", ["安次区", "广阳区", "霸州市", "三河市", "固安县", "固安镇", "永清县", "永清镇", "香河县", "淑阳镇", "大城县", "平舒镇", "文安县", "文安镇", "大厂回族自治县", "大厂镇"]);
dsy.add("0_4_6", ["新市区", "北市区", "南市区", "定州市", "涿州市", "安国市", "高碑店市", "满城县", "满城镇", "清苑县", "清苑镇", "易县", "易州镇", "徐水县", "安肃镇", "涞源县", "涞源镇", "定兴县", "定兴镇", "顺平县", "蒲阳镇", "唐县", "仁厚镇", "望都县", "望都镇", "涞水县", "涞水镇", "高阳县", "高阳镇", "安新县", "安新镇", "雄县", "雄州镇", "容城县", "容城镇", "曲阳县", "恒州镇", "阜平县", "阜平镇", "博野县", "博陵镇", "蠡县", "蠡吾镇"]);
dsy.add("0_4_7", ["桃城区", "冀州市", "深州市", "枣强县", "枣强镇", "武邑县", "武邑镇", "武强县", "武强镇", "饶阳县", "饶阳镇", "安平县", "安平镇", "故城县", "郑口镇", "景县", "景州镇", "阜城县", "阜城镇"]);
dsy.add("0_4_8", ["运河区", "新华区", "泊头市", "任丘市", "黄骅市", "河间市", "沧县", "沧州市新华区", "青县", "清州镇", "东光县", "东光镇", "海兴县", "苏基镇", "盐山县", "盐山镇", "肃宁县", "肃宁镇", "南皮县", "南皮镇", "吴桥县", "桑园镇", "献县", "乐寿镇", "孟村回族自治县", "孟村镇"]);
dsy.add("0_4_9", ["桥东区", "桥西区", "南宫市", "沙河市", "邢台县", "邢台市桥东区", "临城县", "临城镇", "内丘县", "内丘镇", "柏乡县", "柏乡镇", "隆尧县", "隆尧镇", "任县", "任城镇", "南和县", "和阳镇", "宁晋县", "凤凰镇", "巨鹿县", "巨鹿镇", "新河县", "新河镇", "广宗县", "广宗镇", "平乡县", "丰州镇", "威县", "洺州镇", "清河县", "葛仙庄镇", "临西县", "临西镇"]);
dsy.add("0_4_10", ["丛台区", "邯山区", "复兴区", "峰峰矿区", "武安市", "邯郸县", "南堡乡东小屯村", "临漳县", "临漳镇", "成安县", "成安镇", "大名县", "大名镇", "涉县", "涉城镇", "磁县", "磁州镇", "肥乡县", "肥乡镇", "永年县", "临洺关镇", "邱县", "新马头镇", "鸡泽县", "鸡泽镇", "广平县", "广平镇", "馆陶县", "馆陶镇", "魏县", "魏城镇", "曲周县", "曲周镇"]);
dsy.add("0_4", ["石家庄市", "张家口市", "承德市", "秦皇岛市", "唐山市", "廊坊市", "保定市", "衡水市", "沧州市", "邢台市", "邯郸市"]);
dsy.add("0_5_0", ["杏花岭区", "小店区", "迎泽区", "尖草坪区", "万柏林区", "晋源区", "古交市", "清徐县", "清源镇", "阳曲县", "黄寨镇", "娄烦县", "娄烦镇"]);
dsy.add("0_5_1", ["朔城区", "平鲁区", "山阴县", "岱岳乡", "应县", "金城镇", "右玉县", "新城镇", "怀仁县", "云中镇"]);
dsy.add("0_5_2", ["城区", "矿区", "南郊区", "新荣区", "阳高县", "龙泉镇", "天镇县", "玉泉镇", "广灵县", "壶泉镇", "灵丘县", "武灵镇", "浑源县", "永安镇", "左云县", "云兴镇", "大同县", "西坪镇"]);
dsy.add("0_5_3", ["城区", "矿区", "郊区", "平定县", "冠山镇", "盂县", "秀水镇"]);
dsy.add("0_5_4", ["城区", "郊区", "潞城市", "长治县", "韩店镇", "襄垣县", "古韩镇", "屯留县", "麟绛镇", "平顺县", "青羊镇", "黎城县", "黎侯镇", "壶关县", "龙泉镇", "长子县", "丹朱镇", "武乡县", "丰州镇", "沁县", "定昌镇", "沁源县", "沁河镇"]);
dsy.add("0_5_5", ["城区", "高平市", "泽州县", "南村镇", "沁水县", "龙港镇", "阳城县", "凤城镇", "陵川县", "崇文镇"]);
dsy.add("0_5_6", ["忻府区", "原平市", "定襄县", "晋昌镇", "五台县", "台城镇", "代县", "上馆镇", "繁峙县", "繁城镇", "宁武县", "凤凰镇", "静乐县", "鹅城镇", "神池县", "龙泉镇", "五寨县", "砚城镇", "岢岚县", "岚漪镇", "河曲县", "文笔镇", "保德县", "东关镇", "偏关县", "新关镇"]);
dsy.add("0_5_7", ["榆次区", "介休市", "榆社县", "箕城镇", "左权县", "辽阳镇", "和顺县", "义兴镇", "昔阳县", "乐平镇", "寿阳县", "朝阳镇", "太谷县", "明星镇", "祁县", "昭余镇", "平遥县", "古陶镇", "灵石县", "翠峰镇"]);
dsy.add("0_5_8", ["尧都区", "侯马市", "霍州市", "曲沃县", "乐昌镇", "翼城县", "唐兴镇", "襄汾县", "新城镇", "洪洞县", "大槐树镇", "古县", "岳阳镇", "安泽县", "府城镇", "浮山县", "天坛镇", "吉县", "吉昌镇", "乡宁县", "昌宁镇", "蒲县", "蒲城镇", "大宁县", "昕水镇", "永和县", "芝河镇", "隰县", "龙泉镇", "汾西县", "永安镇"]);
dsy.add("0_5_9", ["离石区", "孝义市", "汾阳市", "文水县", "凤城镇", "中阳县", "宁乡镇", "兴县", "蔚汾镇", "临县", "临泉镇", "方山县", "圪洞镇", "柳林县", "柳林镇", "岚县", "东村镇", "交口县", "水头镇", "交城县", "天宁镇", "石楼县", "灵泉镇"]);
dsy.add("0_5_10", ["盐湖区", "永济市", "河津市", "芮城县", "古魏镇", "临猗县", "猗氏镇", "万荣县", "解店镇", "新绛县", "龙兴镇", "稷山县", "稷峰镇", "闻喜县", "桐城镇", "夏县", "瑶峰镇", "绛县", "古绛镇", "平陆县", "圣人涧镇", "垣曲县", "新城镇"]);
dsy.add("0_5", ["太原市", "朔州市", "大同市", "阳泉市", "长治市", "晋城市", "忻州市", "晋中市", "临汾市", "吕梁市", "运城市"]);
dsy.add("0_6_0", ["回民区", "新城区", "玉泉区", "赛罕区", "托克托县", "双河镇", "武川县", "可可以力更镇", "和林格尔县", "城关镇", "清水河县", "城关镇", "土默特左旗", "察素齐镇"]);
dsy.add("0_6_1", ["昆都仑区", "东河区", "青山区", "石拐区", "白云矿区", "九原区", "固阳县", "金山镇", "土默特右旗", "萨拉齐镇", "达尔罕茂明安联合旗", "百灵庙镇"]);
dsy.add("0_6_2", ["海勃湾区", "海南区", "乌达区"]);
dsy.add("0_6_3", ["红山区", "元宝山区", "松山区", "宁城县", "天义镇", "林西县", "林西镇", "阿鲁科尔沁旗", "天山镇", "巴林左旗", "林东镇", "巴林右旗", "大板镇", "克什克腾旗", "经棚镇", "翁牛特旗", "乌丹镇", "喀喇沁旗", "锦山镇", "敖汉旗", "新惠镇"]);
dsy.add("0_6_4", ["科尔沁区", "霍林郭勒市", "开鲁县", "开鲁镇", "库伦旗", "库伦镇", "奈曼旗", "大沁他拉镇", "扎鲁特旗", "鲁北镇", "科尔沁左翼中旗", "保康镇", "科尔沁左翼后旗", "甘旗卡镇"]);
dsy.add("0_6_5", ["海拉尔区", "满洲里市", "扎兰屯市", "牙克石市", "根河市", "额尔古纳市", "阿荣旗", "那吉镇", "新巴尔虎右旗", "阿拉坦额莫勒镇", "新巴尔虎左旗", "阿穆古郎镇", "陈巴尔虎旗", "巴彦库仁镇", "鄂伦春自治旗", "阿里河镇", "鄂温克族自治旗", "巴彦托海镇", "莫力达瓦达斡尔族自治旗", "尼尔基镇"]);
dsy.add("0_6_6", ["东胜区", "达拉特旗", "树林召镇", "准格尔旗", "薛家湾镇", "鄂托克前旗", "敖勒召其镇", "鄂托克旗", "乌兰镇", "杭锦旗", "锡尼镇", "乌审旗", "嘎鲁图镇", "伊金霍洛旗", "阿勒腾席热镇"]);
dsy.add("0_6_7", ["集宁区", "丰镇市", "卓资县", "卓资山镇", "化德县", "长顺镇", "商都县", "商都镇", "兴和县", "城关镇", "凉城县", "岱海镇", "察哈尔右翼前旗", "土贵乌拉镇", "察哈尔右翼中旗", "科布尔镇", "察哈尔右翼后旗", "白音察干镇", "四子王旗", "乌兰花镇"]);
dsy.add("0_6_8", ["临河区", "五原县", "隆兴昌镇", "磴口县", "巴彦高勒镇", "乌拉特前旗", "乌拉山镇", "乌拉特中旗", "海流图镇", "乌拉特后旗", "巴音宝力格镇", "杭锦后旗", "陕坝镇"]);
dsy.add("0_6_9", ["乌兰浩特市", "阿尔山市", "突泉县", "突泉镇", "科尔沁右翼前旗", "大坝沟镇", "科尔沁右翼中旗", "巴彦呼硕镇", "扎赉特旗", "音德尔镇"]);
dsy.add("0_6_10", ["锡林浩特市", "二连浩特市", "多伦县", "多伦淖尔镇", "阿巴嘎旗", "别力古台镇", "苏尼特左旗", "满都拉图镇", "苏尼特右旗", "赛汉塔拉镇", "东乌珠穆沁旗", "乌里雅斯太镇", "西乌珠穆沁旗", "巴拉嘎尔郭勒镇", "太仆寺旗", "宝昌镇", "镶黄旗", "新宝拉格镇", "正镶白旗", "明安图镇", "正蓝旗", "上都镇"]);
dsy.add("0_6_11", ["巴彦浩特镇", "阿拉善右旗", "额肯呼都格镇", "额济纳旗", "达来呼布镇"]);
dsy.add("0_6", ["呼和浩特市", "包头市", "乌海市", "赤峰市", "通辽市", "呼伦贝尔市", "鄂尔多斯市", "乌兰察布市", "巴彦淖尔市", "兴安盟", "锡林郭勒盟", "阿拉善盟"]);
dsy.add("0_7_0", ["沈河区", "和平区", "大东区", "皇姑区", "铁西区", "苏家屯区", "东陵区", "新城子区", "于洪区", "新民市", "辽中县", "辽中镇", "康平县", "康平镇", "法库县", "法库镇"]);
dsy.add("0_7_1", ["双塔区", "龙城区", "北票市", "凌源市", "朝阳县", "朝阳市双塔区", "建平县", "喀喇沁左翼蒙古族自治县", "大城子镇"]);
dsy.add("0_7_2", ["海州区", "新邱区", "太平区", "清河门区", "细河区", "彰武县", "彰武镇", "阜新蒙古族自治县", "阜新镇"]);
dsy.add("0_7_3", ["银州区", "清河区", "调兵山市", "开原市", "铁岭县", "铁岭市银州区", "西丰县", "西丰镇", "昌图县", "昌图镇"]);
dsy.add("0_7_4", ["顺城区", "新抚区", "东洲区", "望花区", "抚顺县", "抚顺市顺城区", "新宾满族自治县", "新宾镇", "清原满族自治县", "清原镇"]);
dsy.add("0_7_5", ["平山区", "溪湖区", "明山区", "南芬区", "本溪满族自治县", "小市镇", "桓仁满族自治县", "桓仁镇"]);
dsy.add("0_7_6", ["白塔区", "文圣区", "宏伟区", "弓长岭区", "太子河区", "灯塔市", "辽阳县", "首山镇"]);
dsy.add("0_7_7", ["铁东区", "铁西区", "立山区", "千山区", "海城市", "台安县", "台安镇", "岫岩满族自治县", "岫岩镇"]);
dsy.add("0_7_8", ["振兴区", "元宝区", "振安区", "凤城市", "东港市", "宽甸满族自治县", "宽甸镇"]);
dsy.add("0_7_9", ["西岗区", "中山区", "沙河口区", "甘井子区", "旅顺口区", "金州区", "瓦房店市", "普兰店市", "庄河市", "长海县", "大长山岛镇"]);
dsy.add("0_7_10", ["站前区", "西市区", "鲅鱼圈区", "老边区", "大石桥市", "盖州市"]);
dsy.add("0_7_11", ["兴隆台区", "双台子区", "大洼县", "大洼镇", "盘山县", "盘锦市双台子区"]);
dsy.add("0_7_12", ["太和区", "古塔区", "凌河区", "凌海市", "北宁市", "黑山县", "黑山镇", "义县", "义州镇"]);
dsy.add("0_7_13", ["龙港区", "连山区", "南票区", "兴城市", "绥中县", "绥中镇", "建昌县", "建昌镇"]);
dsy.add("0_7", ["沈阳市", "朝阳市", "阜新市", "铁岭市", "抚顺市", "本溪市", "辽阳市", "鞍山市", "丹东市", "大连市", "营口市", "盘锦市", "锦州市", "葫芦岛市"]);
dsy.add("0_8_0", ["朝阳区", "南关区", "宽城区", "二道区", "绿园区", "双阳区", "德惠市", "九台市", "榆树市", "农安县", "农安镇"]);
dsy.add("0_8_1", ["洮北区", "大安市", "洮南市", "镇赉县", "镇赉镇", "通榆县", "开通镇"]);
dsy.add("0_8_2", ["宁江区", "扶余县", "三岔河镇", "长岭县", "长岭镇", "乾安县", "乾安镇", "前郭尔罗斯蒙古族自治县", "前郭镇"]);
dsy.add("0_8_3", ["船营区", "龙潭区", "昌邑区", "丰满区", "磐石市", "蛟河市", "桦甸市", "舒兰市", "永吉县", "口前镇"]);
dsy.add("0_8_4", ["铁西区", "铁东区", "双辽市", "公主岭市", "梨树县", "梨树镇", "伊通满族自治县", "伊通镇"]);
dsy.add("0_8_5", ["龙山区", "西安区", "东丰县", "东丰镇", "东辽县", "白泉镇"]);
dsy.add("0_8_6", ["东昌区", "二道江区", "梅河口市", "集安市", "通化县", "快大茂镇", "辉南县", "朝阳镇", "柳河县", "柳河镇"]);
dsy.add("0_8_7", ["八道江区", "临江市", "江源县", "孙家堡子镇", "抚松县", "抚松镇", "靖宇县", "靖宇镇", "长白朝鲜族自治县", "长白镇"]);
dsy.add("0_8_8", ["延吉市", "图们市", "敦化市", "珲春市", "龙井市", "和龙市", "汪清县", "汪清镇", "安图县", "明月镇"]);
dsy.add("0_8", ["长春市", "白城市", "松原市", "吉林市", "四平市", "辽源市", "通化市", "白山市", "延边州"]);
dsy.add("0_9_0", ["松北区", "道里区", "南岗区", "道外区", "香坊区", "动力区", "平房区", "呼兰区", "双城市", "尚志市", "五常市", "阿城市", "依兰县", "依兰镇", "方正县", "方正镇", "宾县", "宾州镇", "巴彦县", "巴彦镇", "木兰县", "木兰镇", "通河县", "通河镇", "延寿县", "延寿镇"]);
dsy.add("0_9_1", ["建华区", "龙沙区", "铁锋区", "昂昂溪区", "富拉尔基区", "碾子山区", "梅里斯达斡尔族区", "讷河市", "龙江县", "龙江镇", "依安县", "依安镇", "泰来县", "泰来镇", "甘南县", "甘南镇", "富裕县", "富裕镇", "克山县", "克山镇", "克东县", "克东镇", "拜泉县", "拜泉镇"]);
dsy.add("0_9_2", ["桃山区", "新兴区", "茄子河区", "勃利县", "勃利镇"]);
dsy.add("0_9_3", ["爱辉区", "北安市", "五大连池市", "嫩江县", "嫩江镇", "逊克县", "边疆镇", "孙吴县", "孙吴镇"]);
dsy.add("0_9_4", ["萨尔图区", "龙凤区", "让胡路区", "大同区", "红岗区", "肇州县", "肇州镇", "肇源县", "肇源镇", "林甸县", "林甸镇", "杜尔伯特蒙古族自治县", "泰康镇"]);
dsy.add("0_9_5", ["兴山区", "向阳区", "工农区", "南山区", "兴安区", "东山区", "萝北县", "凤翔镇", "绥滨县", "绥滨镇"]);
dsy.add("0_9_6", ["伊春区", "南岔区", "友好区", "西林区", "翠峦区", "新青区", "美溪区", "金山屯区", "五营区", "乌马河区", "汤旺河区", "带岭区", "乌伊岭区", "红星区", "上甘岭区", "铁力市", "嘉荫县", "朝阳镇"]);
dsy.add("0_9_7", ["前进区", "永红区", "向阳区", "东风区", "郊区", "同江市", "富锦市", "桦南县", "桦南镇", "桦川县", "悦来镇", "汤原县", "汤原镇", "抚远县", "抚远镇"]);
dsy.add("0_9_8", ["尖山区", "岭东区", "四方台区", "宝山区", "集贤县", "福利镇", "友谊县", "友谊镇", "宝清县", "宝清镇", "饶河县", "饶河镇"]);
dsy.add("0_9_9", ["鸡冠区", "恒山区", "滴道区", "梨树区", "城子河区", "麻山区", "虎林市", "密山市", "鸡东县", "鸡东镇"]);
dsy.add("0_9_10", ["爱民区", "东安区", "阳明区", "西安区", "穆棱市", "绥芬河市", "海林市", "宁安市", "东宁县", "东宁镇", "林口县", "林口镇"]);
dsy.add("0_9_11", ["北林区", "安达市", "肇东市", "海伦市", "望奎县", "望奎镇", "兰西县", "兰西镇", "青冈县", "青冈镇", "庆安县", "庆安镇", "明水县", "明水镇", "绥棱县", "绥棱镇"]);
dsy.add("0_9_12", ["呼玛县", "呼玛镇", "塔河县", "塔河镇", "漠河县", "西林吉镇"]);
dsy.add("0_9", ["哈尔滨市", "齐齐哈尔市", "七台河市", "黑河市", "大庆市", "鹤岗市", "伊春市", "佳木斯市", "双鸭山市", "鸡西市", "牡丹江市", "绥化市", "大兴安岭地区"]);
dsy.add("0_10_0", ["玄武区", "白下区", "秦淮区", "建邺区", "鼓楼区", "下关区", "浦口区", "六合区", "栖霞区", "雨花台区", "江宁区", "溧水县", "永阳镇", "高淳县", "淳溪镇"]);
dsy.add("0_10_1", ["云龙区", "鼓楼区", "九里区", "贾汪区", "泉山区", "邳州市", "新沂市", "铜山县", "铜山镇", "睢宁县", "睢城镇", "沛县", "沛城镇", "丰县", "凤城镇"]);
dsy.add("0_10_2", ["新浦区", "连云区", "海州区", "赣榆县", "青口镇", "灌云县", "伊山镇", "东海县", "牛山镇", "灌南县", "新安镇"]);
dsy.add("0_10_3", ["宿城区", "宿豫区", "沭阳县", "沭城镇", "泗阳县", "众兴镇", "泗洪县", "青阳镇"]);
dsy.add("0_10_4", ["清河区", "清浦区", "楚州区", "淮阴区", "金湖县", "黎城镇", "盱眙县", "盱城镇", "洪泽县", "高良涧镇", "涟水县", "涟城镇"]);
dsy.add("0_10_5", ["亭湖区", "盐都区", "东台市", "大丰市", "射阳县", "合德镇", "阜宁县", "阜城镇", "滨海县", "东坎镇", "响水县", "响水镇", "建湖县", "近湖镇"]);
dsy.add("0_10_6", ["维扬区", "广陵区", "邗江区", "仪征市", "江都市", "高邮市", "宝应县", "安宜镇"]);
dsy.add("0_10_7", ["海陵区", "高港区", "靖江市", "泰兴市", "姜堰市", "兴化市"]);
dsy.add("0_10_8", ["崇川区", "港闸区", "海门市", "启东市", "通州市", "如皋市", "如东县", "掘港镇", "海安县", "海安镇"]);
dsy.add("0_10_9", ["京口区", "润州区", "丹徒区", "扬中市", "丹阳市", "句容市"]);
dsy.add("0_10_10", ["钟楼区", "天宁区", "戚墅堰区", "新北区", "武进区", "金坛市", "溧阳市"]);
dsy.add("0_10_11", ["崇安区", "南长区", "北塘区", "滨湖区", "惠山区", "锡山区", "江阴市", "宜兴市"]);
dsy.add("0_10_12", ["金阊区", "沧浪区", "平江区", "虎丘区", "吴中区", "相城区", "吴江市", "昆山市", "太仓市", "常熟市", "张家港市"]);
dsy.add("0_10", ["南京市", "徐州市", "连云港市", "宿迁市", "淮安市", "盐城市", "扬州市", "泰州市", "南通市", "镇江市", "常州市", "无锡市", "苏州市"]);
dsy.add("0_11_0", ["拱墅区", "上城区", "下城区", "江干区", "西湖区", "滨江区", "余杭区", "萧山区", "临安市", "富阳市", "建德市", "桐庐县", "淳安县", "千岛湖镇"]);
dsy.add("0_11_1", ["吴兴区", "南浔区", "长兴县", "雉城镇", "德清县", "武康镇", "安吉县", "递铺镇"]);
dsy.add("0_11_2", ["南湖区", "秀洲区", "平湖市", "海宁市", "桐乡市", "嘉善县", "魏塘镇", "海盐县", "武原镇"]);
dsy.add("0_11_3", ["定海区", "普陀区", "岱山县", "高亭镇", "嵊泗县", "菜园镇"]);
dsy.add("0_11_4", ["海曙区", "江东区", "江北区", "北仑区", "镇海区", "鄞州区", "慈溪市", "余姚市", "奉化市", "宁海县", "象山县"]);
dsy.add("0_11_5", ["越城区", "诸暨市", "上虞市", "嵊州市", "绍兴县", "新昌县", "城关镇"]);
dsy.add("0_11_6", ["柯城区", "衢江区", "江山市", "常山县", "天马镇", "开化县", "城关镇", "龙游县"]);
dsy.add("0_11_7", ["婺城区", "金东区", "兰溪市", "永康市", "义乌市", "东阳市", "武义县", "浦江县", "磐安县", "安文镇"]);
dsy.add("0_11_8", ["椒江区", "黄岩区", "路桥区", "临海市", "温岭市", "三门县", "海游镇", "天台县", "仙居县", "玉环县", "珠港镇"]);
dsy.add("0_11_9", ["鹿城区", "龙湾区", "瓯海区", "瑞安市", "乐清市", "永嘉县", "上塘镇", "文成县", "大峃镇", "平阳县", "昆阳镇", "泰顺县", "罗阳镇", "洞头县", "北岙镇", "苍南县", "灵溪镇"]);
dsy.add("0_11_10", ["莲都区", "龙泉市", "缙云县", "五云镇", "青田县", "鹤城镇", "云和县", "云和镇", "遂昌县", "妙高镇", "松阳县", "西屏镇", "庆元县", "松源镇", "景宁畲族自治县", "鹤溪镇"]);
dsy.add("0_11", ["杭州市", "湖州市", "嘉兴市", "舟山市", "宁波市", "绍兴市", "衢州市", "金华市", "台州市", "温州市", "丽水市"]);
dsy.add("0_12_0", ["庐阳区", "瑶海区", "蜀山区", "包河区", "长丰县", "水湖镇", "肥东县", "店埠镇", "肥西县", "上派镇"]);
dsy.add("0_12_1", ["埇桥区", "砀山县", "砀城镇", "萧县", "龙城镇", "灵璧县", "灵城镇", "泗县", "泗城镇"]);
dsy.add("0_12_2", ["相山区", "杜集区", "烈山区", "濉溪县", "濉溪镇"]);
dsy.add("0_12_3", ["谯城区", "涡阳县", "城关镇", "蒙城县", "城关镇", "利辛县", "城关镇"]);
dsy.add("0_12_4", ["颍州区", "颍东区", "颍泉区", "界首市", "临泉县", "城关镇", "太和县", "城关镇", "阜南县", "城关镇", "颍上县", "慎城镇"]);
dsy.add("0_12_5", ["蚌山区", "龙子湖区", "禹会区", "淮上区", "怀远县", "城关镇", "五河县", "城关镇", "固镇县", "城关镇"]);
dsy.add("0_12_6", ["田家庵区", "大通区", "谢家集区", "八公山区", "潘集区", "凤台县", "城关镇"]);
dsy.add("0_12_7", ["琅区", "南谯区", "明光市", "天长市", "来安县", "新安镇", "全椒县", "襄河镇", "定远县", "定城镇", "凤阳县", "府城镇"]);
dsy.add("0_12_8", ["雨山区", "花山区", "金家庄区", "当涂县", "姑孰镇"]);
dsy.add("0_12_9", ["镜湖区", "弋江区", "三山区", "鸠江区", "芜湖县", "湾镇", "繁昌县", "繁阳镇", "南陵县", "籍山镇"]);
dsy.add("0_12_10", ["铜官山区", "狮子山区", "郊区", "铜陵县", "五松镇"]);
dsy.add("0_12_11", ["迎江区", "大观区", "宜秀区", "桐城市", "怀宁县", "高河镇", "枞阳县", "枞阳镇", "潜山县", "梅城镇", "太湖县", "晋熙镇", "宿松县", "孚玉镇", "望江县", "雷阳镇", "岳西县", "天堂镇"]);
dsy.add("0_12_12", ["屯溪区", "黄山区", "徽州区", "歙县", "徽城镇", "休宁县", "海阳镇", "黟县", "碧阳镇", "祁门县", "祁山镇"]);
dsy.add("0_12_13", ["金安区", "裕安区", "寿县", "寿春镇", "霍邱县", "城关镇", "舒城县", "城关镇", "金寨县", "梅山镇", "霍山县", "衡山镇"]);
dsy.add("0_12_14", ["居巢区", "庐江县", "庐城镇", "无为县", "无城镇", "含山县", "环峰镇", "和县", "历阳镇"]);
dsy.add("0_12_15", ["贵池区", "东至县", "尧渡镇", "石台县", "七里镇", "青阳县", "蓉城镇"]);
dsy.add("0_12_16", ["宣州区", "宁国市", "郎溪县", "建平镇", "广德县", "桃州镇", "泾县", "泾川镇", "旌德县", "旌阳镇", "绩溪县", "华阳镇"]);
dsy.add("0_12", ["合肥市", "宿州市", "淮北市", "亳州市", "阜阳市", "蚌埠市", "淮南市", "滁州市", "马鞍山市", "芜湖市", "铜陵市", "安庆市", "黄山市", "六安市", "巢湖市", "池州市", "宣城市"]);
dsy.add("0_13_0", ["鼓楼区", "台江区", "仓山区", "马尾区", "晋安区", "福清市", "长乐市", "闽侯县", "连江县", "凤城镇", "罗源县", "凤山镇", "闽清县", "梅城镇", "永泰县", "樟城镇", "平潭县", "潭城镇"]);
dsy.add("0_13_1", ["延平区", "邵武市", "武夷山市", "建瓯市", "建阳市", "顺昌县", "浦城县", "光泽县", "杭川镇", "松溪县", "松源镇", "政和县", "熊山镇"]);
dsy.add("0_13_2", ["城厢区", "涵江区", "荔城区", "秀屿区", "仙游县"]);
dsy.add("0_13_3", ["梅列区", "三元区", "永安市", "明溪县", "雪峰镇", "清流县", "龙津镇", "宁化县", "翠江镇", "大田县", "均溪镇", "尤溪县", "城关镇", "沙县", "将乐县", "古镛镇", "泰宁县", "杉城镇", "建宁县", "濉城镇"]);
dsy.add("0_13_4", ["鲤城区", "丰泽区", "洛江区", "泉港区", "石狮市", "晋江市", "南安市", "惠安县", "螺城镇", "安溪县", "凤城镇", "永春县", "桃城镇", "德化县", "浔中镇", "金门县", "☆"]);
dsy.add("0_13_5", ["思明区", "海沧区", "湖里区", "集美区", "同安区", "翔安区"]);
dsy.add("0_13_6", ["芗城区", "龙文区", "龙海市", "云霄县", "云陵镇", "漳浦县", "绥安镇", "诏安县", "南诏镇", "长泰县", "武安镇", "东山县", "西埔镇", "南靖县", "山城镇", "平和县", "小溪镇", "华安县", "华丰镇"]);
dsy.add("0_13_7", ["新罗区", "漳平市", "长汀县", "汀州镇", "永定县", "凤城镇", "上杭县", "临江镇", "武平县", "平川镇", "连城县", "莲峰镇"]);
dsy.add("0_13_8", ["蕉城区", "福安市", "福鼎市", "寿宁县", "鳌阳镇", "霞浦县", "柘荣县", "双城镇", "屏南县", "古峰镇", "古田县", "周宁县", "狮城镇"]);
dsy.add("0_13", ["福州市", "南平市", "莆田市", "三明市", "泉州市", "厦门市", "漳州市", "龙岩市", "宁德市"]);
dsy.add("0_14_0", ["东湖区", "西湖区", "青云谱区", "湾里区", "青山湖区", "南昌县", "莲塘镇", "新建县", "长堎镇", "安义县", "龙津镇", "进贤县", "民和镇"]);
dsy.add("0_14_1", ["浔阳区", "庐山区", "瑞昌市", "九江县", "沙河街镇", "武宁县", "新宁镇", "修水县", "义宁镇", "永修县", "涂埠镇", "德安县", "蒲亭镇", "星子县", "南康镇", "都昌县", "都昌镇", "湖口县", "双钟镇", "彭泽县", "龙城镇"]);
dsy.add("0_14_2", ["珠山区", "昌江区", "乐平市", "浮梁县", "浮梁镇"]);
dsy.add("0_14_3", ["月湖区", "贵溪市", "余江县", "邓埠镇"]);
dsy.add("0_14_4", ["渝水区", "分宜县", "分宜镇"]);
dsy.add("0_14_5", ["安源区", "湘东区", "莲花县", "琴亭镇", "上栗县", "上栗镇", "芦溪县", "芦溪镇"]);
dsy.add("0_14_6", ["章贡区", "瑞金市", "南康市", "赣县", "梅林镇", "信丰县", "嘉定镇", "大余县", "南安镇", "上犹县", "东山镇", "崇义县", "横水镇", "安远县", "欣山镇", "龙南县", "龙南镇", "定南县", "历市镇", "全南县", "城厢镇", "宁都县", "梅江镇", "于都县", "贡江镇", "兴国县", "潋江镇", "会昌县", "文武坝镇", "寻乌县", "长宁镇", "石城县", "琴江镇"]);
dsy.add("0_14_7", ["信州区", "德兴市", "上饶县", "旭日镇", "广丰县", "永丰镇", "玉山县", "冰溪镇", "铅山县", "河口镇", "横峰县", "岑阳镇", "弋阳县", "弋江镇", "余干县", "玉亭镇", "鄱阳县", "鄱阳镇", "万年县", "陈营镇", "婺源县", "紫阳镇"]);
dsy.add("0_14_8", ["临川区", "南城县", "建昌镇", "黎川县", "日峰镇", "南丰县", "琴城镇", "崇仁县", "巴山镇", "乐安县", "鳌溪镇", "宜黄县", "凤冈镇", "金溪县", "秀谷镇", "资溪县", "鹤城镇", "东乡县", "孝岗镇", "广昌县", "旴江镇"]);
dsy.add("0_14_9", ["袁州区", "丰城市", "樟树市", "高安市", "奉新县", "冯川镇", "万载县", "上高县", "宜丰县", "新昌镇", "靖安县", "双溪镇", "铜鼓县", "永宁镇"]);
dsy.add("0_14_10", ["吉州区", "青原区", "井冈山市", "厦坪镇", "吉安县", "敦厚镇", "吉水县", "文峰镇", "峡江县", "水边镇", "新干县", "金川镇", "永丰县", "恩江镇", "泰和县", "澄江镇", "遂川县", "泉江镇", "万安县", "芙蓉镇", "安福县", "平都镇", "永新县", "禾川镇"]);
dsy.add("0_14", ["南昌市", "九江市", "景德镇市", "鹰潭市", "新余市", "萍乡市", "赣州市", "上饶市", "抚州市", "宜春市", "吉安市"]);
dsy.add("0_15_0", ["市中区", "历下区", "槐荫区", "天桥区", "历城区", "长清区", "章丘市", "平阴县", "平阴镇", "济阳县", "济阳镇", "商河县"]);
dsy.add("0_15_1", ["市南区", "市北区", "四方区", "黄岛区", "崂山区", "城阳区", "李沧区", "胶州市", "即墨市", "平度市", "胶南市", "莱西市"]);
dsy.add("0_15_2", ["东昌府区", "临清市", "阳谷县", "莘县", "茌平县", "东阿县", "冠县", "冠城镇", "高唐县"]);
dsy.add("0_15_3", ["德城区", "乐陵市", "禹城市", "陵县", "陵城镇", "平原县", "夏津县", "夏津镇", "武城县", "武城镇", "齐河县", "晏城镇", "临邑县", "宁津县", "宁津镇", "庆云县", "庆云镇"]);
dsy.add("0_15_4", ["东营区", "河口区", "垦利县", "垦利镇", "利津县", "利津镇", "广饶县", "广饶镇"]);
dsy.add("0_15_5", ["张店区", "淄川区", "博山区", "临淄区", "周村区", "桓台县", "索镇", "高青县", "田镇", "沂源县", "南麻镇"]);
dsy.add("0_15_6", ["潍城区", "寒亭区", "坊子区", "奎文区", "安丘市", "昌邑市", "高密市", "青州市", "诸城市", "寿光市", "临朐县", "昌乐县"]);
dsy.add("0_15_7", ["莱山区", "芝罘区", "福山区", "牟平区", "栖霞市", "海阳市", "龙口市", "莱阳市", "莱州市", "蓬莱市", "招远市", "长岛县", "南长山镇"]);
dsy.add("0_15_8", ["环翠区", "荣成市", "乳山市", "文登市"]);
dsy.add("0_15_9", ["东港区", "岚山区", "五莲县", "洪凝镇", "莒县", "城阳镇"]);
dsy.add("0_15_10", ["兰山区", "罗庄区", "河东区", "郯城县", "郯城镇", "苍山县", "卞庄镇", "莒南县", "十字路镇", "沂水县", "沂水镇", "蒙阴县", "蒙阴镇", "平邑县", "平邑镇", "费县", "费城镇", "沂南县", "界湖镇", "临沭县", "临沭镇"]);
dsy.add("0_15_11", ["薛城区", "市中区", "峄城区", "台儿庄区", "山亭区", "滕州市"]);
dsy.add("0_15_12", ["市中区", "任城区", "曲阜市", "兖州市", "邹城市", "微山县", "鱼台县", "谷亭镇", "金乡县", "金乡镇", "嘉祥县", "嘉祥镇", "汶上县", "汶上镇", "泗水县", "梁山县", "梁山镇"]);
dsy.add("0_15_13", ["泰山区", "岱岳区", "新泰市", "肥城市", "宁阳县", "宁阳镇", "东平县", "东平镇"]);
dsy.add("0_15_14", ["莱城区", "钢城区"]);
dsy.add("0_15_15", ["滨城区", "惠民县", "惠民镇", "阳信县", "阳信镇", "无棣县", "无棣镇", "沾化县", "富国镇", "博兴县", "博兴镇", "邹平县"]);
dsy.add("0_15_16", ["牡丹区", "曹县", "曹城镇", "定陶县", "定陶镇", "成武县", "成武镇", "单县", "单城镇", "巨野县", "巨野镇", "郓城县", "郓城镇", "鄄城县", "鄄城镇", "东明县", "城关镇"]);
dsy.add("0_15", ["济南市", "青岛市", "聊城市", "德州市", "东营市", "淄博市", "潍坊市", "烟台市", "威海市", "日照市", "临沂市", "枣庄市", "济宁市", "泰安市", "莱芜市", "滨州市", "菏泽市"]);
dsy.add("0_16_0", ["中原区", "二七区", "管城回族区", "金水区", "上街区", "惠济区", "新郑市", "登封市", "新密市", "巩义市", "荥阳市", "中牟县", "城关镇"]);
dsy.add("0_16_1", ["鼓楼区", "龙亭区", "顺河回族区", "禹王台区", "金明区", "杞县", "城关镇", "通许县", "城关镇", "尉氏县", "城关镇", "开封县", "城关镇", "兰考县", "城关镇"]);
dsy.add("0_16_2", ["湖滨区", "义马市", "灵宝市", "渑池县", "城关镇", "陕县", "大营镇", "卢氏县", "城关镇"]);
dsy.add("0_16_3", ["西工区", "老城区", "瀍河回族区", "涧西区", "吉利区", "洛龙区", "偃师市", "孟津县", "城关镇", "新安县", "城关镇", "栾川县", "城关镇", "嵩县", "城关镇", "汝阳县", "城关镇", "宜阳县", "城关镇", "洛宁县", "城关镇", "伊川县", "城关镇"]);
dsy.add("0_16_4", ["解放区", "山阳区", "中站区", "马村区", "孟州市", "沁阳市", "修武县", "城关镇", "博爱县", "清化镇", "武陟县", "木城镇", "温县", "温泉镇"]);
dsy.add("0_16_5", ["卫滨区", "红旗区", "凤泉区", "牧野区", "卫辉市", "辉县市", "新乡县", "新乡市红旗区", "获嘉县", "城关镇", "原阳县", "城关镇", "延津县", "城关镇", "封丘县", "城关镇", "长垣县", "城关镇"]);
dsy.add("0_16_6", ["淇滨区", "山城区", "鹤山区", "浚县", "城关镇", "淇县", "朝歌镇"]);
dsy.add("0_16_7", ["北关区", "文峰区", "殷都区", "龙安区", "林州市", "安阳县", "安阳市北关区", "汤阴县", "城关镇", "滑县", "道口镇", "内黄县", "城关镇"]);
dsy.add("0_16_8", ["华龙区", "清丰县", "城关镇", "南乐县", "城关镇", "范县", "城关镇", "台前县", "城关镇", "濮阳县", "城关镇"]);
dsy.add("0_16_9", ["梁园区", "睢阳区", "永城市", "虞城县", "城关镇", "民权县", "城关镇", "宁陵县", "城关镇", "睢县", "城关镇", "夏邑县", "城关镇", "柘城县", "城关镇"]);
dsy.add("0_16_10", ["魏都区", "禹州市", "长葛市", "许昌县", "许昌市魏都区", "鄢陵县", "安陵镇", "襄城县", "城关镇"]);
dsy.add("0_16_11", ["源汇区", "郾城区", "召陵区", "舞阳县", "舞泉镇", "临颍县", "城关镇"]);
dsy.add("0_16_12", ["新华区", "卫东区", "湛河区", "石龙区", "舞钢市", "汝州市", "宝丰县", "城关镇", "叶县", "昆阳镇", "鲁山县", "鲁阳镇", "郏县", "城关镇"]);
dsy.add("0_16_13", ["卧龙区", "宛城区", "邓州市", "南召县", "城关镇", "方城县", "城关镇", "西峡县", "镇平县", "城关镇", "内乡县", "城关镇", "淅川县", "社旗县", "赊店镇", "唐河县", "新野县", "城关镇", "桐柏县", "城关镇"]);
dsy.add("0_16_14", ["河区", "平桥区", "息县", "城关镇", "淮滨县", "城关镇", "潢川县", "光山县", "固始县", "城关镇", "商城县", "城关镇", "罗山县", "城关镇", "新县", "新集镇"]);
dsy.add("0_16_15", ["川汇区", "项城市", "扶沟县", "城关镇", "西华县", "城关镇", "商水县", "城关镇", "太康县", "城关镇", "鹿邑县", "城关镇", "郸城县", "城关镇", "淮阳县", "城关镇", "沈丘县", "槐店镇"]);
dsy.add("0_16_16", ["驿城区", "确山县", "盘龙镇", "泌阳县", "泌水镇", "遂平县", "灈阳镇", "西平县", "上蔡县", "蔡都镇", "汝南县", "汝宁镇", "平舆县", "古槐镇", "新蔡县", "古吕镇", "正阳县", "真阳镇"]);
dsy.add("0_16", ["郑州市", "开封市", "三门峡市", "洛阳市", "焦作市", "新乡市", "鹤壁市", "安阳市", "濮阳市", "商丘市", "许昌市", "漯河市", "平顶山市", "南阳市", "信阳市", "周口市", "驻马店市", "济源市"]);
dsy.add("0_17_0", ["江岸区", "江汉区", "硚口区", "汉阳区", "武昌区", "青山区", "洪山区", "东西湖区", "汉南区", "蔡甸区", "江夏区", "黄陂区", "新洲区"]);
dsy.add("0_17_1", ["张湾区", "茅箭区", "丹江口市", "郧县", "城关镇", "竹山县", "城关镇", "房县", "城关镇", "郧西县", "城关镇", "竹溪县", "城关镇"]);
dsy.add("0_17_2", ["襄城区", "樊城区", "襄阳区", "老河口市", "枣阳市", "宜城市", "南漳县", "城关镇", "谷城县", "城关镇", "保康县", "城关镇"]);
dsy.add("0_17_3", ["东宝区", "掇刀区", "钟祥市", "沙洋县", "沙洋镇", "京山县", "新市镇"]);
dsy.add("0_17_4", ["孝南区", "应城市", "安陆市", "汉川市", "孝昌县", "花园镇", "大悟县", "城关镇", "云梦县", "城关镇"]);
dsy.add("0_17_5", ["黄州区", "麻城市", "武穴市", "红安县", "城关镇", "罗田县", "凤山镇", "英山县", "温泉镇", "浠水县", "清泉镇", "蕲春县", "漕河镇", "黄梅县", "黄梅镇", "团风县", "团风镇"]);
dsy.add("0_17_6", ["鄂城区", "梁子湖区", "华容区"]);
dsy.add("0_17_7", ["黄石港区", "西塞山区", "下陆区", "铁山区", "大冶市", "阳新县", "兴国镇"]);
dsy.add("0_17_8", ["咸安区", "赤壁市", "嘉鱼县", "鱼岳镇", "通城县", "隽水镇", "崇阳县", "天城镇", "通山县", "通羊镇"]);
dsy.add("0_17_9", ["沙市区", "荆州区", "石首市", "洪湖市", "松滋市", "江陵县", "郝穴镇", "公安县", "斗湖堤镇", "监利县", "容城镇"]);
dsy.add("0_17_10", ["西陵区", "伍家岗区", "点军区", "猇亭区", "夷陵区", "枝江市", "宜都市", "当阳市", "远安县", "鸣凤镇", "兴山县", "古夫镇", "秭归县", "茅坪镇", "长阳土家族自治县", "龙舟坪镇", "五峰土家族自治县", "五峰镇"]);
dsy.add("0_17_11", ["曾都区", "广水市"]);
dsy.add("0_17_12", ["仙桃市", "天门市", "潜江市", "神农架林区", "松柏镇"]);
dsy.add("0_17_13", ["恩施市", "利川市", "建始县", "业州镇", "巴东县", "信陵镇", "宣恩县", "珠山镇", "咸丰县", "高乐山镇", "来凤县", "翔凤镇", "鹤峰县", "容美镇"]);
dsy.add("0_17", ["武汉市", "十堰市", "襄樊市", "荆门市", "孝感市", "黄冈市", "鄂州市", "黄石市", "咸宁市", "荆州市", "宜昌市", "随州市", "省直辖县级行政单位", "恩施州"]);
dsy.add("0_18_0", ["长沙市", "岳麓区", "芙蓉区", "天心区", "开福区", "雨花区", "浏阳市", "长沙县", "星沙镇", "望城县", "高塘岭镇", "宁乡县", "玉潭镇"]);
dsy.add("0_18_1", ["永定区", "武陵源区", "慈利县", "零阳镇", "桑植县", "澧源镇"]);
dsy.add("0_18_2", ["武陵区", "鼎城区", "津市市", "安乡县", "城关镇", "汉寿县", "龙阳镇", "澧县", "澧阳镇", "临澧县", "安福镇", "桃源县", "漳江镇", "石门县", "楚江镇"]);
dsy.add("0_18_3", ["赫山区", "资阳区", "沅江市", "南县", "南洲镇", "桃江县", "桃花江镇", "安化县", "东坪镇"]);
dsy.add("0_18_4", ["岳阳楼区", "君山区", "云溪区", "汨罗市", "临湘市", "岳阳县", "荣家湾镇", "华容县", "城关镇", "湘阴县", "文星镇", "平江县", "汉昌镇"]);
dsy.add("0_18_5", ["天元区", "荷塘区", "芦淞区", "石峰区", "醴陵市", "株洲县", "渌口镇", "攸县", "城关镇", "茶陵县", "城关镇", "炎陵县", "霞阳镇"]);
dsy.add("0_18_6", ["岳塘区", "雨湖区", "湘乡市", "韶山市", "湘潭县", "易俗河镇"]);
dsy.add("0_18_7", ["雁峰区", "珠晖区", "石鼓区", "蒸湘区", "南岳区", "常宁市", "耒阳市", "衡阳县", "西渡镇", "衡南县", "云集镇", "衡山县", "开云镇", "衡东县", "城关镇", "祁东县", "洪桥镇"]);
dsy.add("0_18_8", ["北湖区", "苏仙区", "资兴市", "桂阳县", "城关镇", "永兴县", "城关镇", "宜章县", "城关镇", "嘉禾县", "城关镇", "临武县", "城关镇", "汝城县", "城关镇", "桂东县", "城关镇", "安仁县", "城关镇"]);
dsy.add("0_18_9", ["冷水滩区", "零陵区", "东安县", "白牙市镇", "道县", "道江镇", "宁远县", "舜陵镇", "江永县", "潇浦镇", "蓝山县", "塔峰镇", "新田县", "龙泉镇", "双牌县", "泷泊镇", "祁阳县", "浯溪镇", "江华瑶族自治县", "沱江镇"]);
dsy.add("0_18_10", ["双清区", "大祥区", "北塔区", "武冈市", "邵东县", "两市镇", "邵阳县", "塘渡口镇", "新邵县", "酿溪镇", "隆回县", "桃洪镇", "洞口县", "洞口镇", "绥宁县", "长铺镇", "新宁县", "金石镇", "城步苗族自治县", "儒林镇"]);
dsy.add("0_18_11", ["鹤城区", "洪江市", "沅陵县", "沅陵镇", "辰溪县", "辰阳镇", "溆浦县", "卢峰镇", "中方县", "中方镇", "会同县", "林城镇", "麻阳苗族自治县", "高村镇", "新晃侗族自治县", "新晃镇", "芷江侗族自治县", "芷江镇", "靖州苗族侗族自治县", "渠阳镇", "通道侗族自治县", "双江镇"]);
dsy.add("0_18_12", ["娄星区", "冷水江市", "涟源市", "双峰县", "永丰镇", "新化县", "上梅镇"]);
dsy.add("0_18_13", ["吉首市", "泸溪县", "白沙镇", "凤凰县", "沱江镇", "花垣县", "花垣镇", "保靖县", "迁陵镇", "古丈县", "古阳镇", "永顺县", "灵溪镇", "龙山县"]);
dsy.add("0_18", ["长沙市", "张家界市", "常德市", "益阳市", "岳阳市", "株洲市", "湘潭市", "衡阳市", "郴州市", "永州市", "邵阳市", "怀化市", "娄底市", "湘西州"]);
dsy.add("0_19_0", ["越秀区", "荔湾区", "海珠区", "天河区", "白云区", "黄埔区", "番禺区", "花都区", "南沙区", "萝岗区", "增城市", "从化市"]);
dsy.add("0_19_1", ["福田区", "罗湖区", "南山区", "宝安区", "龙岗区", "盐田区"]);
dsy.add("0_19_2", ["清城区", "英德市", "连州市", "佛冈县", "石角镇", "阳山县", "阳城镇", "清新县", "太和镇", "连山壮族瑶族自治县", "吉田镇", "连南瑶族自治县", "三江镇"]);
dsy.add("0_19_3", ["浈江区", "武江区", "曲江区", "乐昌市", "南雄市", "始兴县", "太平镇", "仁化县", "仁化镇", "翁源县", "龙仙镇", "新丰县", "乳源瑶族自治县", "乳城镇"]);
dsy.add("0_19_4", ["源城区", "紫金县", "紫城镇", "龙川县", "老隆镇", "连平县", "元善镇", "和平县", "阳明镇", "东源县", "仙塘镇"]);
dsy.add("0_19_5", ["梅江区", "兴宁市", "梅县", "程江镇", "大埔县", "湖寮镇", "丰顺县", "汤坑镇", "五华县", "水寨镇", "平远县", "大柘镇", "蕉岭县", "蕉城镇"]);
dsy.add("0_19_6", ["湘桥区", "潮安县", "庵埠镇", "饶平县", "黄冈镇"]);
dsy.add("0_19_7", ["金平区", "濠江区", "龙湖区", "潮阳区", "潮南区", "澄海区", "南澳县", "后宅镇"]);
dsy.add("0_19_8", ["榕城区", "普宁市", "揭东县", "曲溪镇", "揭西县", "河婆镇", "惠来县", "惠城镇"]);
dsy.add("0_19_9", ["城区", "陆丰市", "海丰县", "海城镇", "陆河县", "河田镇"]);
dsy.add("0_19_10", ["惠城区", "惠阳区", "博罗县", "罗阳镇", "惠东县", "龙门县"]);
dsy.add("0_19_12", ["香洲区", "斗门区", "金湾区"]);
dsy.add("0_19_14", ["江海区", "蓬江区", "新会区", "恩平市", "台山市", "开平市", "鹤山市"]);
dsy.add("0_19_15", ["禅城区", "南海区", "顺德区", "三水区", "高明区"]);
dsy.add("0_19_16", ["端州区", "鼎湖区", "高要市", "四会市", "广宁县", "南街镇", "怀集县", "怀城镇", "封开县", "江口镇", "德庆县"]);
dsy.add("0_19_17", ["云城区", "罗定市", "云安县", "六都镇", "新兴县", "新城镇", "郁南县", "都城镇"]);
dsy.add("0_19_18", ["江城区", "阳春市", "阳西县", "织镇", "阳东县", "东城镇"]);
dsy.add("0_19_19", ["茂南区", "茂港区", "化州市", "信宜市", "高州市", "电白县", "水东镇"]);
dsy.add("0_19_20", ["赤坎区", "霞山区", "坡头区", "麻章区", "吴川市", "廉江市", "雷州市", "遂溪县", "遂城镇", "徐闻县", "撤销广州市东山区", "芳村区", "设立广州市南沙区", "萝岗区"]);
dsy.add("0_19", ["广州市", "深圳市", "清远市", "韶关市", "河源市", "梅州市", "潮州市", "汕头市", "揭阳市", "汕尾市", "惠州市", "东莞市", "珠海市", "中山市", "江门市", "佛山市", "肇庆市", "云浮市", "阳江市", "茂名市", "湛江市"]);
dsy.add("0_20_0", ["青秀区", "兴宁区", "江南区", "西乡塘区", "良庆区", "邕宁区", "武鸣县", "横县", "宾阳县", "上林县", "隆安县", "马山县"]);
dsy.add("0_20_1", ["象山区", "叠彩区", "秀峰区", "七星区", "雁山区", "阳朔县", "阳朔镇", "临桂县", "临桂镇", "灵川县", "灵川镇", "全州县", "全州镇", "兴安县", "兴安镇", "永福县", "永福镇", "灌阳县", "灌阳镇", "资源县", "资源镇", "平乐县", "平乐镇", "荔浦县", "荔城镇", "龙胜各族自治县", "龙胜镇", "恭城瑶族自治县", "恭城镇"]);
dsy.add("0_20_2", ["城中区", "鱼峰区", "柳南区", "柳北区", "柳江县", "拉堡镇", "柳城县", "大埔镇", "鹿寨县", "鹿寨镇", "融安县", "长安镇", "三江侗族自治县", "古宜镇", "融水苗族自治县", "融水镇"]);
dsy.add("0_20_3", ["万秀区", "蝶山区", "长洲区", "岑溪市", "苍梧县", "龙圩镇", "藤县", "藤州镇", "蒙山县", "蒙山镇"]);
dsy.add("0_20_4", ["港北区", "港南区", "覃塘区", "桂平市", "平南县", "平南镇"]);
dsy.add("0_20_5", ["玉州区", "北流市", "兴业县", "石南镇", "容县", "容州镇", "陆川县", "陆城镇", "博白县", "博白镇"]);
dsy.add("0_20_6", ["钦南区", "钦北区", "灵山县", "灵城镇", "浦北县", "小江镇"]);
dsy.add("0_20_7", ["海城区", "银海区", "铁山港区", "合浦县", "廉州镇"]);
dsy.add("0_20_8", ["港口区", "防城区", "东兴市", "上思县", "思阳镇"]);
dsy.add("0_20_9", ["江州区", "凭祥市", "扶绥县", "新宁镇", "大新县", "桃城镇", "天等县", "天等镇", "宁明县", "城中镇", "龙州县", "龙州镇"]);
dsy.add("0_20_10", ["右江区", "田阳县", "田州镇", "田东县", "平马镇", "平果县", "马头镇", "德保县", "城关镇", "靖西县", "新靖镇", "那坡县", "城厢镇", "凌云县", "泗城镇", "乐业县", "同乐镇", "西林县", "八达镇", "田林县", "乐里镇", "隆林各族自治县", "新州镇"]);
dsy.add("0_20_11", ["金城江区", "宜州市", "南丹县", "城关镇", "天峨县", "六排镇", "凤山县", "凤城镇", "东兰县", "东兰镇", "巴马瑶族自治县", "巴马镇", "都安瑶族自治县", "安阳镇", "大化瑶族自治县", "大化镇", "罗城仫佬族自治县", "东门镇", "环江毛南族自治县", "思恩镇"]);
dsy.add("0_20_12", ["兴宾区", "合山市", "象州县", "象州镇", "武宣县", "武宣镇", "忻城县", "城关镇", "金秀瑶族自治县", "金秀镇"]);
dsy.add("0_20_13", ["八步区", "昭平县", "昭平镇", "钟山县", "钟山镇", "富川瑶族自治县", "富阳镇"]);
dsy.add("0_20", ["南宁市", "桂林市", "柳州市", "梧州市", "贵港市", "玉林市", "钦州市", "北海市", "防城港市", "崇左市", "百色市", "河池市", "来宾市", "贺州市"]);
dsy.add("0_21_0", ["龙华区", "秀英区", "琼山区", "美兰区"]);
dsy.add("0_21_2", ["文昌市", "琼海市", "万宁市", "五指山市", "东方市", "儋州市", "临高县", "临城镇", "澄迈县", "金江镇", "定安县", "定城镇", "屯昌县", "屯城镇", "昌江黎族自治县", "石碌镇", "白沙黎族自治县", "牙叉镇", "琼中黎族苗族自治县", "营根镇", "陵水黎族自治县", "椰林镇", "保亭黎族苗族自治县", "保城镇", "乐东黎族自治县", "抱由镇"]);
dsy.add("0_21", ["海口市", "三亚市", "省直辖行政单位"]);
dsy.add("0_22_0", ["青羊区", "锦江区", "金牛区", "武侯区", "成华区", "龙泉驿区", "青白江区", "新都区", "温江区", "都江堰市", "彭州市", "邛崃市", "崇州市", "金堂县", "赵镇", "双流县", "郫县", "郫筒镇", "大邑县", "晋原镇", "蒲江县", "鹤山镇", "新津县", "五津镇"]);
dsy.add("0_22_1", ["市中区", "元坝区", "朝天区", "旺苍县", "东河镇", "青川县", "乔庄镇", "剑阁县", "下寺镇", "苍溪县", "陵江镇"]);
dsy.add("0_22_2", ["涪城区", "游仙区", "江油市", "三台县", "潼川镇", "盐亭县", "云溪镇", "安县", "花荄镇", "梓潼县", "文昌镇", "北川羌族自治县", "曲山镇", "平武县", "龙安镇"]);
dsy.add("0_22_3", ["旌阳区", "什邡市", "广汉市", "绵竹市", "罗江县", "罗江镇", "中江县", "凯江镇"]);
dsy.add("0_22_4", ["顺庆区", "高坪区", "嘉陵区", "阆中市", "南部县", "南隆镇", "营山县", "朗池镇", "蓬安县", "周口镇", "仪陇县", "新政镇", "西充县", "晋城镇"]);
dsy.add("0_22_5", ["广安区", "华蓥市", "岳池县", "九龙镇", "武胜县", "沿口镇", "邻水县", "鼎屏镇"]);
dsy.add("0_22_6", ["船山区", "安居区", "蓬溪县", "赤城镇", "射洪县", "太和镇", "大英县", "蓬莱镇"]);
dsy.add("0_22_7", ["市中区", "东兴区", "威远县", "严陵镇", "资中县", "重龙镇", "隆昌县", "金鹅镇"]);
dsy.add("0_22_8", ["市中区", "沙湾区", "五通桥区", "金口河区", "峨眉山市", "犍为县", "玉津镇", "井研县", "研城镇", "夹江县", "漹城镇", "沐川县", "沐溪镇", "峨边彝族自治县", "沙坪镇", "马边彝族自治县", "民建镇"]);
dsy.add("0_22_9", ["自流井区", "大安区", "贡井区", "沿滩区", "荣县", "旭阳镇", "富顺县", "富世镇"]);
dsy.add("0_22_10", ["江阳区", "纳溪区", "龙马潭区", "泸县", "福集镇", "合江县", "合江镇", "叙永县", "叙永镇", "古蔺县", "古蔺镇"]);
dsy.add("0_22_11", ["翠屏区", "宜宾县", "柏溪镇", "南溪县", "南溪镇", "江安县", "江安镇", "长宁县", "长宁镇", "高县", "庆符镇", "筠连县", "筠连镇", "珙县", "巡场镇", "兴文县", "中城镇", "屏山县", "屏山镇"]);
dsy.add("0_22_12", ["东区", "西区", "仁和区", "米易县", "攀莲镇", "盐边县", "桐子林镇"]);
dsy.add("0_22_13", ["巴州区", "通江县", "诺江镇", "南江县", "南江镇", "平昌县", "江口镇"]);
dsy.add("0_22_14", ["通川区", "万源市", "达县", "南外镇", "宣汉县", "东乡镇", "开江县", "新宁镇", "大竹县", "竹阳镇", "渠县", "渠江镇"]);
dsy.add("0_22_15", ["雁江区", "简阳市", "乐至县", "天池镇", "安岳县", "岳阳镇"]);
dsy.add("0_22_16", ["东坡区", "仁寿县", "文林镇", "彭山县", "凤鸣镇", "洪雅县", "洪川镇", "丹棱县", "丹棱镇", "青神县", "城厢镇"]);
dsy.add("0_22_17", ["雨城区", "名山县", "蒙阳镇", "荥经县", "严道镇", "汉源县", "富林镇", "石棉县", "新棉镇", "天全县", "城厢镇", "芦山县", "芦阳镇", "宝兴县", "穆坪镇"]);
dsy.add("0_22_18", ["马尔康县", "马尔康镇", "汶川县", "威州镇", "理县", "杂谷脑镇", "茂县", "凤仪镇", "松潘县", "进安镇", "九寨沟县", "永乐镇", "金川县", "金川镇", "小金县", "美兴镇", "黑水县", "芦花镇", "壤塘县", "壤柯镇", "阿坝县", "阿坝镇", "若尔盖县", "达扎寺镇", "红原县", "邛溪镇"]);
dsy.add("0_22_19", ["康定县", "炉城镇", "泸定县", "泸桥镇", "丹巴县", "章谷镇", "九龙县", "呷尔镇", "雅江县", "河口镇", "道孚县", "鲜水镇", "炉霍县", "新都镇", "甘孜县", "甘孜镇", "新龙县", "茹龙镇", "德格县", "更庆镇", "白玉县", "建设镇", "石渠县", "尼呷镇", "色达县", "色柯镇", "理塘县", "高城镇", "巴塘县", "夏邛镇", "乡城县", "桑披镇", "稻城县", "金珠镇", "得荣县", "松麦镇"]);
dsy.add("0_22_20", ["西昌市", "盐源县", "盐井镇", "德昌县", "德州镇", "会理县", "城关镇", "会东县", "会东镇", "宁南县", "披砂镇", "普格县", "普基镇", "布拖县", "特木里镇", "金阳县", "天地坝镇", "昭觉县", "新城镇", "喜德县", "光明镇", "冕宁县", "城厢镇", "越西县", "越城镇", "甘洛县", "新市坝镇", "美姑县", "巴普镇", "雷波县", "锦城镇", "木里藏族自治县", "乔瓦镇"]);
dsy.add("0_22", ["成都市", "广元市", "绵阳市", "德阳市", "南充市", "广安市", "遂宁市", "内江市", "乐山市", "自贡市", "泸州市", "宜宾市", "攀枝花市", "巴中市", "达州市", "资阳市", "眉山市", "雅安市", "阿坝州", "甘孜州", "凉山州"]);
dsy.add("0_23_0", ["乌当区", "南明区", "云岩区", "花溪区", "白云区", "小河区", "清镇市", "开阳县", "城关镇", "修文县", "龙场镇", "息烽县", "永靖镇"]);
dsy.add("0_23_1", ["钟山区", "盘县", "红果镇", "六枝特区", "平寨镇", "水城县"]);
dsy.add("0_23_2", ["红花岗区", "汇川区", "赤水市", "仁怀市", "遵义县", "南白镇", "桐梓县", "娄山关镇", "绥阳县", "洋川镇", "正安县", "凤仪镇", "凤冈县", "龙泉镇", "湄潭县", "湄江镇", "余庆县", "白泥镇", "习水县", "东皇镇", "道真仡佬族苗族自治县", "玉溪镇", "务川仡佬族苗族自治县", "都濡镇"]);
dsy.add("0_23_3", ["西秀区", "平坝县", "城关镇", "普定县", "城关镇", "关岭布依族苗族自治县", "关索镇", "镇宁布依族苗族自治县", "城关镇", "紫云苗族布依族自治县", "松山镇"]);
dsy.add("0_23_4", ["毕节市", "大方县", "大方镇", "黔西县", "城关镇", "金沙县", "城关镇", "织金县", "城关镇", "纳雍县", "雍熙镇", "赫章县", "城关镇", "威宁彝族回族苗族自治县", "草海镇"]);
dsy.add("0_23_5", ["铜仁市", "江口县", "双江镇", "石阡县", "汤山镇", "思南县", "思唐镇", "德江县", "青龙镇", "玉屏侗族自治县", "平溪镇", "印江土家族苗族自治县", "峨岭镇", "沿河土家族自治县", "和平镇", "松桃苗族自治县", "蓼皋镇", "万山特区", "万山镇"]);
dsy.add("0_23_6", ["凯里市", "黄平县", "新州镇", "施秉县", "城关镇", "三穗县", "八弓镇", "镇远县", "阳镇", "岑巩县", "思旸镇", "天柱县", "凤城镇", "锦屏县", "三江镇", "剑河县", "革东镇", "台江县", "台拱镇", "黎平县", "德凤镇", "榕江县", "古州镇", "从江县", "丙妹镇", "雷山县", "丹江镇", "麻江县", "杏山镇", "丹寨县", "龙泉镇"]);
dsy.add("0_23_7", ["都匀市", "福泉市", "荔波县", "玉屏镇", "贵定县", "城关镇", "瓮安县", "雍阳镇", "独山县", "城关镇", "平塘县", "平湖镇", "罗甸县", "龙坪镇", "长顺县", "长寨镇", "龙里县", "龙山镇", "惠水县", "和平镇", "三都水族自治县", "三合镇"]);
dsy.add("0_23_8", ["兴义市", "兴仁县", "城关镇", "普安县", "盘水镇", "晴隆县", "莲城镇", "贞丰县", "珉谷镇", "望谟县", "复兴镇", "册亨县", "者楼镇", "安龙县", "新安镇", "剑河县人民政府驻地由柳川镇迁至革东镇"]);
dsy.add("0_23", ["贵阳市", "六盘水市", "遵义市", "安顺市", "毕节地区", "铜仁地区", "黔东南州", "黔南州", "黔西南州"]);
dsy.add("0_24_0", ["盘龙区", "五华区", "官渡区", "西山区", "东川区", "安宁市", "呈贡县", "龙城镇", "晋宁县", "昆阳镇", "富民县", "永定镇", "宜良县", "匡远镇", "嵩明县", "嵩阳镇", "石林彝族自治县", "鹿阜镇", "禄劝彝族苗族自治县", "屏山镇", "寻甸回族彝族自治县", "仁德镇"]);
dsy.add("0_24_1", ["麒麟区", "宣威市", "马龙县", "通泉镇", "沾益县", "西平镇", "富源县", "中安镇", "罗平县", "罗雄镇", "师宗县", "丹凤镇", "陆良县", "中枢镇", "会泽县", "金钟镇"]);
dsy.add("0_24_2", ["红塔区", "江川县", "大街镇", "澄江县", "凤麓镇", "通海县", "秀山镇", "华宁县", "宁州镇", "易门县", "龙泉镇", "峨山彝族自治县", "双江镇", "新平彝族傣族自治县", "桂山镇", "元江哈尼族彝族傣族自治县", "澧江镇"]);
dsy.add("0_24_3", ["隆阳区", "施甸县", "甸阳镇", "腾冲县", "腾越镇", "龙陵县", "龙山镇", "昌宁县", "田园镇"]);
dsy.add("0_24_4", ["昭阳区", "鲁甸县", "文屏镇", "巧家县", "新华镇", "盐津县", "盐井镇", "大关县", "翠华镇", "永善县", "溪落渡镇", "绥江县", "中城镇", "镇雄县", "乌峰镇", "彝良县", "角奎镇", "威信县", "扎西镇", "水富县", "向家坝镇"]);
dsy.add("0_24_5", ["古城区", "永胜县", "永北镇", "华坪县", "中心镇", "玉龙纳西族自治县", "黄山镇", "宁蒗彝族自治县", "大兴镇"]);
dsy.add("0_24_6", ["翠云区", "普洱哈尼族彝族自治县", "宁洱镇", "墨江哈尼族自治县", "联珠镇", "景东彝族自治县", "锦屏镇", "景谷傣族彝族自治县", "威远镇", "镇沅彝族哈尼族拉祜族自治县", "恩乐镇", "江城哈尼族彝族自治县", "勐烈镇", "孟连傣族拉祜族佤族自治县", "娜允镇", "澜沧拉祜族自治县", "勐朗镇", "西盟佤族自治县", "勐梭镇"]);
dsy.add("0_24_7", ["临翔区", "凤庆县", "凤山镇", "云县", "爱华镇", "永德县", "德党镇", "镇康县", "南伞镇", "双江拉祜族佤族布朗族傣族自治县", "勐勐镇", "耿马傣族佤族自治县", "耿马镇", "沧源佤族自治县", "勐董镇"]);
dsy.add("0_24_8", ["潞西市", "瑞丽市", "梁河县", "遮岛镇", "盈江县", "平原镇", "陇川县", "章凤镇"]);
dsy.add("0_24_9", ["泸水县六库镇", "泸水县", "六库镇", "福贡县", "上帕镇", "贡山独龙族怒族自治县", "茨开镇", "兰坪白族普米族自治县", "金顶镇"]);
dsy.add("0_24_10", ["香格里拉县", "建塘镇", "德钦县", "升平镇", "维西傈僳族自治县", "保和镇"]);
dsy.add("0_24_11", ["大理市", "祥云县", "祥城镇", "宾川县", "金牛镇", "弥渡县", "弥城镇", "永平县", "博南镇", "云龙县", "诺邓镇", "洱源县", "茈碧湖镇", "剑川县", "金华镇", "鹤庆县", "云鹤镇", "漾濞彝族自治县", "苍山西镇", "南涧彝族自治县", "南涧镇", "巍山彝族回族自治县", "南诏镇"]);
dsy.add("0_24_12", ["楚雄市", "双柏县", "妥甸镇", "牟定县", "共和镇", "南华县", "龙川镇", "姚安县", "栋川镇", "大姚县", "金碧镇", "永仁县", "永定镇", "元谋县", "元马镇", "武定县", "狮山镇", "禄丰县", "金山镇"]);
dsy.add("0_24_13", ["蒙自县", "文澜镇", "个旧市", "开远市", "绿春县", "大兴镇", "建水县", "临安镇", "石屏县", "异龙镇", "弥勒县", "弥阳镇", "泸西县", "中枢镇", "元阳县", "南沙镇", "红河县", "迤萨镇", "金平苗族瑶族傣族自治县", "金河镇", "河口瑶族自治县", "河口镇", "屏边苗族自治县", "玉屏镇"]);
dsy.add("0_24_14", ["文山县", "开化镇", "砚山县", "江那镇", "西畴县", "西洒镇", "麻栗坡县", "麻栗镇", "马关县", "马白镇", "丘北县", "锦屏镇", "广南县", "莲城镇", "富宁县", "新华镇"]);
dsy.add("0_24_15", ["景洪市", "勐海县", "勐海镇", "勐腊县", "勐腊镇"]);
dsy.add("0_24", ["昆明市", "曲靖市", "玉溪市", "保山市", "昭通市", "丽江市", "思茅市", "临沧市", "德宏州", "怒江州", "迪庆州", "大理州", "楚雄州", "红河州", "文山州", "西双版纳州"]);
dsy.add("0_25_0", ["城关区", "林周县", "甘丹曲果镇", "当雄县", "当曲卡镇", "尼木县", "塔荣镇", "曲水县", "曲水镇", "堆龙德庆县", "东嘎镇", "达孜县", "德庆镇", "墨竹工卡县", "工卡镇"]);
dsy.add("0_25_1", ["那曲县", "那曲镇", "嘉黎县", "阿扎镇", "比如县", "比如镇", "聂荣县", "聂荣镇", "安多县", "帕那镇", "申扎县", "申扎镇", "索县", "亚拉镇", "班戈县", "普保镇", "巴青县", "拉西镇", "尼玛县", "尼玛镇"]);
dsy.add("0_25_2", ["昌都县", "城关镇", "江达县", "江达镇", "贡觉县", "莫洛镇", "类乌齐县", "桑多镇", "丁青县", "丁青镇", "察雅县", "烟多镇", "八宿县", "白玛镇", "左贡县", "旺达镇", "芒康县", "嘎托镇", "洛隆县", "孜托镇", "边坝县", "草卡镇"]);
dsy.add("0_25_3", ["林芝县", "八一镇", "工布江达县", "工布江达镇", "米林县", "米林镇", "墨脱县", "墨脱镇", "波密县", "扎木镇", "察隅县", "竹瓦根镇", "朗县", "朗镇"]);
dsy.add("0_25_4", ["乃东县", "泽当镇", "扎囊县", "扎塘镇", "贡嘎县", "吉雄镇", "桑日县", "桑日镇", "琼结县", "琼结镇", "曲松县", "曲松镇", "措美县", "措美镇", "洛扎县", "洛扎镇", "加查县", "安绕镇", "隆子县", "隆子镇", "错那县", "错那镇", "浪卡子县", "浪卡子镇"]);
dsy.add("0_25_5", ["日喀则市", "南木林县", "南木林镇", "江孜县", "江孜镇", "定日县", "协格尔镇", "萨迦县", "萨迦镇", "拉孜县", "曲下镇", "昂仁县", "卡嘎镇", "谢通门县", "卡嘎镇", "白朗县", "洛江镇", "仁布县", "德吉林镇", "康马县", "康马镇", "定结县", "江嘎镇", "仲巴县", "拉让乡", "亚东县", "下司马镇", "吉隆县", "宗嘎镇", "聂拉木县", "聂拉木镇", "萨嘎县", "加加镇", "岗巴县", "岗巴镇"]);
dsy.add("0_25_6", ["噶尔县", "狮泉河镇", "普兰县", "普兰镇", "札达县", "托林镇", "日土县", "日土镇", "革吉县", "革吉镇", "改则县", "改则镇", "措勤县", "措勤镇", "林芝县人民政府驻地由林芝镇迁至八一镇"]);
dsy.add("0_25", ["拉萨市", "那曲地区", "昌都地区", "林芝地区", "山南地区", "日喀则地区", "阿里地区"]);
dsy.add("0_26_0", ["莲湖区", "新城区", "碑林区", "灞桥区", "未央区", "雁塔区", "阎良区", "临潼区", "长安区", "蓝田县", "蓝关镇", "周至县", "二曲镇", "户县", "甘亭镇", "高陵县", "鹿苑镇"]);
dsy.add("0_26_1", ["宝塔区", "延长县", "七里村镇", "延川县", "延川镇", "子长县", "瓦窑堡镇", "安塞县", "真武洞镇", "志丹县", "保安镇", "吴起县", "吴旗镇", "甘泉县", "城关镇", "富县", "富城镇", "洛川县", "凤栖镇", "宜川县", "丹州镇", "黄龙县", "石堡镇", "黄陵县", "桥山镇"]);
dsy.add("0_26_2", ["耀州区", "王益区", "印台区", "宜君县", "城关镇"]);
dsy.add("0_26_3", ["临渭区", "华阴市", "韩城市", "华县", "华州镇", "潼关县", "城关镇", "大荔县", "城关镇", "蒲城县", "城关镇", "澄城县", "城关镇", "白水县", "城关镇", "合阳县", "城关镇", "富平县", "窦村镇"]);
dsy.add("0_26_4", ["秦都区", "杨陵区", "渭城区", "兴平市", "三原县", "城关镇", "泾阳县", "泾干镇", "乾县", "城关镇", "礼泉县", "城关镇", "永寿县", "监军镇", "彬县", "城关镇", "长武县", "昭仁镇", "旬邑县", "城关镇", "淳化县", "城关镇", "武功县", "普集镇"]);
dsy.add("0_26_5", ["渭滨区", "金台区", "陈仓区", "凤翔县", "城关镇", "岐山县", "凤鸣镇", "扶风县", "城关镇", "眉县", "首善镇", "陇县", "城关镇", "千阳县", "城关镇", "麟游县", "九成宫镇", "凤县", "双石铺镇", "太白县", "嘴头镇"]);
dsy.add("0_26_6", ["汉台区", "南郑县", "城关镇", "城固县", "博望镇", "洋县", "洋州镇", "西乡县", "城关镇", "勉县", "勉阳镇", "宁强县", "汉源镇", "略阳县", "城关镇", "镇巴县", "泾洋镇", "留坝县", "城关镇", "佛坪县", "袁家庄镇"]);
dsy.add("0_26_7", ["榆阳区", "神木县", "神木镇", "府谷县", "府谷镇", "横山县", "横山镇", "靖边县", "张家畔镇", "定边县", "定边镇", "绥德县", "名州镇", "米脂县", "银州镇", "佳县", "佳芦镇", "吴堡县", "宋家川镇", "清涧县", "宽洲镇", "子洲县", "双湖峪镇"]);
dsy.add("0_26_8", ["汉滨区", "汉阴县", "城关镇", "石泉县", "城关镇", "宁陕县", "城关镇", "紫阳县", "城关镇", "岚皋县", "城关镇", "平利县", "城关镇", "镇坪县", "城关镇", "旬阳县", "城关镇", "白河县", "城关镇"]);
dsy.add("0_26_9", ["商州区", "洛南县", "城关镇", "丹凤县", "龙驹寨镇", "商南县", "城关镇", "山阳县", "城关镇", "镇安县", "永乐镇", "柞水县", "乾佑镇"]);
dsy.add("0_26", ["西安市", "延安市", "铜川市", "渭南市", "咸阳市", "宝鸡市", "汉中市", "榆林市", "安康市", "商洛市"]);
dsy.add("0_27_0", ["城关区", "七里河区", "西固区", "安宁区", "红古区", "永登县", "城关镇", "皋兰县", "石洞镇", "榆中县", "城关镇"]);
dsy.add("0_27_1", ["金昌市", "金川区", "永昌县", "城关镇"]);
dsy.add("0_27_2", ["白银区", "平川区", "靖远县", "乌兰镇", "会宁县", "会师镇", "景泰县", "一条山镇"]);
dsy.add("0_27_3", ["秦州区", "麦积区", "清水县", "永清镇", "秦安县", "兴国镇", "甘谷县", "大像山镇", "武山县", "城关镇", "张家川回族自治县", "张家川镇"]);
dsy.add("0_27_4", ["凉州区", "民勤县", "城关镇", "古浪县", "古浪镇", "天祝藏族自治县", "华藏寺镇"]);
dsy.add("0_27_5", ["肃州区", "玉门市", "敦煌市", "金塔县", "金塔镇", "安西县", "渊泉镇", "肃北蒙古族自治县", "党城湾镇", "阿克塞哈萨克族自治县", "红柳湾镇"]);
dsy.add("0_27_6", ["甘州区", "民乐县", "洪水镇", "临泽县", "沙河镇", "高台县", "城关镇", "山丹县", "清泉镇", "肃南裕固族自治县", "红湾寺镇"]);
dsy.add("0_27_7", ["西峰区", "庆城县", "庆城镇", "环县", "环城镇", "华池县", "柔远镇", "合水县", "西华池镇", "正宁县", "山河镇", "宁县", "新宁镇", "镇原县", "城关镇"]);
dsy.add("0_27_8", ["崆峒区", "泾川县", "城关镇", "灵台县", "中台镇", "崇信县", "锦屏镇", "华亭县", "东华镇", "庄浪县", "水洛镇", "静宁县", "城关镇"]);
dsy.add("0_27_9", ["安定区", "通渭县", "平襄镇", "临洮县", "洮阳镇", "漳县", "武阳镇", "岷县", "岷阳镇", "渭源县", "清源镇", "陇西县", "巩昌镇"]);
dsy.add("0_27_10", ["武都区", "成县", "城关镇", "宕昌县", "城关镇", "康县", "文县", "城关镇", "西和县", "汉源镇", "礼县", "城关镇", "两当县", "城关镇", "徽县", "城关镇"]);
dsy.add("0_27_11", ["临夏市", "临夏县", "韩集镇", "康乐县", "附城镇", "永靖县", "刘家峡镇", "广河县", "城关镇", "和政县", "城关镇", "东乡族自治县", "锁南坝镇", "积石山保安族东乡族撒拉族自治县", "吹麻滩镇"]);
dsy.add("0_27_12", ["合作市", "临潭县", "城关镇", "卓尼县", "柳林镇", "舟曲县", "城关镇", "迭部县", "电尕镇", "玛曲县", "尼玛镇", "碌曲县", "玛艾镇", "夏河县", "拉卜楞镇"]);
dsy.add("0_27", ["兰州市", "嘉峪关市", "白银市", "天水市", "武威市", "酒泉市", "张掖市", "庆阳市", "平凉市", "定西市", "陇南市", "临夏州", "甘南州"]);
dsy.add("0_28_0", ["城中区", "城东区", "城西区", "城北区", "大通回族土族自治县", "桥头镇", "湟源县", "城关镇", "湟中县", "鲁沙尔镇"]);
dsy.add("0_28_1", ["平安县", "平安镇", "乐都县", "碾伯镇", "民和回族土族自治县", "川口镇", "互助土族自治县", "威远镇", "化隆回族自治县", "巴燕镇", "循化撒拉族自治县", "积石镇"]);
dsy.add("0_28_2", ["海晏县", "三角城镇", "祁连县", "八宝镇", "刚察县", "沙柳河镇", "门源回族自治县", "浩门镇"]);
dsy.add("0_28_3", ["共和县", "恰卜恰镇", "同德县", "尕巴松多镇", "贵德县", "河阴镇", "兴海县", "子科滩镇", "贵南县", "茫曲镇"]);
dsy.add("0_28_4", ["同仁县", "隆务镇", "尖扎县", "马克唐镇", "泽库县", "泽曲镇", "河南蒙古族自治县", "优干宁镇"]);
dsy.add("0_28_5", ["玛沁县", "大武镇", "班玛县", "赛来塘镇", "甘德县", "柯曲镇", "达日县", "吉迈镇", "久治县", "智青松多镇", "玛多县", "黄河乡"]);
dsy.add("0_28_6", ["玉树县", "结古镇", "杂多县", "萨呼腾镇", "称多县", "称文镇", "治多县", "加吉博洛镇", "囊谦县", "香达镇", "曲麻莱县", "约改镇"]);
dsy.add("0_28_7", ["德令哈市", "格尔木市", "乌兰县", "希里沟镇", "都兰县", "察汗乌苏镇", "天峻县", "新源镇"]);
dsy.add("0_28", ["西宁市", "海东地区", "海北州", "海南州", "黄南州", "果洛州", "玉树州", "海西州"]);
dsy.add("0_29_0", ["兴庆区", "金凤区", "西夏区", "灵武市", "永宁县", "杨和镇", "贺兰县", "习岗镇"]);
dsy.add("0_29_1", ["大武口区", "惠农区", "平罗县", "城关镇"]);
dsy.add("0_29_2", ["利通区", "青铜峡市", "盐池县", "花马池镇", "同心县", "豫海镇"]);
dsy.add("0_29_3", ["原州区", "西吉县", "吉强镇", "隆德县", "城关镇", "泾源县", "香水镇", "彭阳县", "白阳镇"]);
dsy.add("0_29_4", ["沙坡头区", "中宁县", "海原县"]);
dsy.add("0_29", ["银川市", "石嘴山市", "吴忠市", "固原市", "中卫市"]);
dsy.add("0_30_0", ["天山区", "沙依巴克区", "新市区", "水磨沟区", "头屯河区", "达坂城区", "东山区", "乌鲁木齐县", "乌鲁木齐市水磨沟区"]);
dsy.add("0_30_1", ["克拉玛依区", "独山子区", "白碱滩区", "乌尔禾区"]);
dsy.add("0_30_2", ["石河子市", "阿拉尔市", "图木舒克市", "五家渠市"]);
dsy.add("0_30_3", ["喀什市", "疏附县", "托克扎克镇", "疏勒县", "疏勒镇", "英吉沙县", "英吉沙镇", "泽普县", "泽普镇", "莎车县", "莎车镇", "叶城县", "喀格勒克镇", "麦盖提县", "麦盖提镇", "岳普湖县", "岳普湖镇", "伽师县", "巴仁镇", "巴楚县", "巴楚镇", "塔什库尔干塔吉克自治县", "塔什库尔干镇"]);
dsy.add("0_30_4", ["阿克苏市", "温宿县", "温宿镇", "库车县", "库车镇", "沙雅县", "沙雅镇", "新和县", "新和镇", "拜城县", "拜城镇", "乌什县", "乌什镇", "阿瓦提县", "阿瓦提镇", "柯坪县", "柯坪镇"]);
dsy.add("0_30_5", ["和田市", "和田县", "墨玉县", "喀拉喀什镇", "皮山县", "固玛镇", "洛浦县", "洛浦镇", "策勒县", "策勒镇", "于田县", "木尕拉镇", "民丰县", "尼雅镇"]);
dsy.add("0_30_6", ["吐鲁番市", "鄯善县", "鄯善镇", "托克逊县", "托克逊镇"]);
dsy.add("0_30_7", ["哈密市", "伊吾县", "伊吾镇", "巴里坤哈萨克自治县", "巴里坤镇"]);
dsy.add("0_30_8", ["阿图什市", "阿克陶县", "阿克陶镇", "阿合奇县", "阿合奇镇", "乌恰县", "乌恰镇"]);
dsy.add("0_30_9", ["博乐市", "精河县", "精河镇", "温泉县", "博格达尔镇"]);
dsy.add("0_30_10", ["昌吉市", "阜康市", "米泉市", "呼图壁县", "呼图壁镇", "玛纳斯县", "玛纳斯镇", "奇台县", "奇台镇", "吉木萨尔县", "吉木萨尔镇", "木垒哈萨克自治县", "木垒镇"]);
dsy.add("0_30_11", ["库尔勒市", "轮台县", "轮台镇", "尉犁县", "尉犁镇", "若羌县", "若羌镇", "且末县", "且末镇", "和静县", "和静镇", "和硕县", "特吾里克镇", "博湖县", "博湖镇", "焉耆回族自治县", "焉耆镇"]);
dsy.add("0_30_12", ["伊宁市", "奎屯市", "伊宁县", "吉里于孜镇", "霍城县", "水定镇", "巩留县", "巩留镇", "新源县", "新源镇", "昭苏县", "昭苏镇", "特克斯县", "特克斯镇", "尼勒克县", "尼勒克镇", "察布查尔锡伯自治县", "察布查尔镇"]);
dsy.add("0_30_13", ["塔城市", "乌苏市", "额敏县", "额敏镇", "沙湾县", "三道河子镇", "托里县", "托里镇", "裕民县", "哈拉布拉镇", "和布克赛尔蒙古自治县", "和布克赛尔镇"]);
dsy.add("0_30_14", ["阿勒泰市", "布尔津县", "布尔津镇", "富蕴县", "库额尔齐斯镇", "福海县", "哈巴河县", "青河县", "吉木乃县"]);
dsy.add("0_30", ["乌鲁木齐市", "克拉玛依市", "自治区直辖县级行政单位", "喀什地区", "阿克苏地区", "和田地区", "吐鲁番地区", "哈密地区", "克孜勒苏柯州", "博尔塔拉州", "昌吉州", "巴音郭楞州", "伊犁州", "塔城地区", "阿勒泰地区"]);
dsy.add("0_31_0", ["中西区", "东区", "九龙城区", "观塘区", "南区", "深水埗区", "湾仔区", "黄大仙区", "油尖旺区", "离岛区", "葵青区", "北区", "西贡区", "沙田区", "屯门区", "大埔区", "荃湾区", "元朗区"]);
dsy.add("0_31", ["香港特别行政区"]);
dsy.add("0_32_0", ["澳门特别行政区"]);
dsy.add("0_32", ["澳门特别行政区"]);
dsy.add("0_33_0", [" "]);
dsy.add("0_33", ["台北", "高雄", "台中", "花莲", "基隆", "嘉义", "金门", "连江", "苗栗", "南投", "澎湖", "屏东", "台东", "台南", "桃园", "新竹", "宜兰", "云林", "彰化"]);
dsy.add("0", ["北京市", "天津市", "上海市", "重庆市", "河北省", "山西省", "内蒙古", "辽宁省", "吉林省", "黑龙江省", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "广西", "海南省", "四川省", "贵州省", "云南省", "西藏", "陕西省", "甘肃省", "青海省", "宁夏", "新疆", "香港", "澳门", "台湾省"]);
var s = ["s_province", "s_city"]; //三个select的name
var opt0 = ["省", "市"]; //初始值
function _init_area(arr) { //初始化函数
s = arr
for (let i = 0; i < s.length - 1; i++) {
document.getElementById(s[i]).onchange = new Function("window.change(" + (i + 1) + ")");
}
window.change(0);
}
module.exports = _init_area;
\ No newline at end of file
/* eslint-disable */
/*
* @Author: 周成
* @Date: 2018-03-22 20:11:20
* @Last Modified by: Dec-F (fanxuehui@duiba.com.cn)
* @Last Modified time: 2019-09-02 18:39:24
*/
require('./polyfill');
/**
* Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API.
* If you use jQuery, you already know how to use Zepto.
* https://www.npmjs.com/package/zepto
*/
require('./zepto');
/**
* Polyfill to remove click delays on browsers with touch UIs.
* https://www.npmjs.com/package/fastclick
*/
if ('addEventListener' in document) {
document.addEventListener(
'DOMContentLoaded',
function() {
require.ensure([], () => {
const FastClick = require('./fastclick');
FastClick.attach(document.body);
}, 'fastclick');
},
false
);
}
require('render/libs/statistics');
$.fn.longPress = function(fn) {
var timeout = undefined
var $this = this
for (var i = 0; i < $this.length; i++) {
$this[i].addEventListener(
'touchstart',
function(event) {
timeout = setTimeout(fn, 800) // 长按时间超过800ms,则执行传入的方法
},
false
)
$this[i].addEventListener(
'touchend',
function(event) {
clearTimeout(timeout) // 长按时间少于800ms,不会执行传入的方法
},
false
)
}
}
/**
* 推啊所有的window变量都挂载在window.TA下面
*/
window.TA = window.TA || {};
\ No newline at end of file
/* eslint-disable */
/**
* 检查是否支持.webp 格式图片
*
* 支持 webp CDN ?x-oss-process=image/format,webp
* 不支持 CDN ?x-oss-process=image/quality,Q_80
*/
;
(function() {
var urlarr = [];
// localStorage存在且之前没设置过iswebp
if (localStorage && !localStorage.iswebp) {
var cs = document.createElement('canvas');
// 如果不支持canvas则退出
if (cs.getContext && cs.getContext('2d')) {
try {
localStorage.iswebp = (0 === cs.toDataURL('image/webp').indexOf('data:image/webp'));
} catch (e) {
// safari 浏览器无恒模式在低于11版本会有bug
// https://stackoverflow.com/questions/21159301/quotaexceedederror-dom-exception-22-an-attempt-was-made-to-add-something-to-st
console.error(e);
}
}
}
function getOssImg(url) {
if (!url) {
return url;
}
// 不支持localStorage或者没有设置过iswebp或者isweb是false
if (!localStorage || !localStorage.iswebp || localStorage.iswebp === 'false') {
url = url + '?x-oss-process=image/quality,Q_80';
return url;
} else {
// gif 的图片不做处理
urlarr = url.split('.');
if (urlarr.length > 0 && urlarr[urlarr.length - 1] === 'gif') {
return url;
}
url = url + '?x-oss-process=image/format,webp';
return url;
}
}
String.prototype.ossimg = function() {
return getOssImg(this);
};
})();
import { isIphone } from './helper'
import utils from './utils'
export const commonJumpLogic = function commonJumpLogic({
componentData = {},
jump,
options,
popupCallback,
closeCallback
} = {}) {
const { android, ios, type, isCoversion } = jump
// 埋点id
const { id } = componentData
id && (options.compId = id)
// 点击埋点
window.countLog.sendClickData(() => {
const cb = () => {
if (type === 'link') {
if (!isIphone) {
if (android) {
if (jump.is206Jump && navigator.userAgent.match(/micromessenger|alipay/ig)) {
jump206(android)
} else {
jumpTo(android)
}
}
} else {
if (ios) {
jumpTo(ios)
}
}
} else if (type === 'popup') {
popupCallback && popupCallback()
} else if (type === 'close') {
closeCallback && closeCallback()
}
}
if (isCoversion || isCoversion === undefined) {
// 转化埋点
window.countLog.init(cb, options)
} else {
cb()
}
}, options)
}
export const jump206 = function jump206(downloadUrl) {
$.ajax({
url: 'https://wxd.tuitortoise.com/api/record',
method: 'GET',
data: {
apiKey: 'ce2eab4d27db0b517526',
downloadUrl
},
success(data) {
if (data.code === 0) {
data.data && data.data.jumpUrl ? jumpTo(data.data.jumpUrl) : jumpTo(downloadUrl)
} else {
jumpTo(downloadUrl)
}
},
fail() {
jumpTo(downloadUrl)
}
})
}
function jumpTo(url) {
// 需要一同提交给广告主的当前url上的参数数组
const postBackStr = ['device']
let urlWithPostBackStr = url
// 如果跳转链接为apk 则直接跳转
if (urlWithPostBackStr.indexOf('.apk') !== -1) {
return window.location.href = urlWithPostBackStr
}
postBackStr.map(str => {
if (utils.getUrlParameter(str) !== '' && utils.getUrlParameter(str, urlWithPostBackStr) === '') {
urlWithPostBackStr = urlWithPostBackStr.indexOf('?') !== -1
? `${urlWithPostBackStr}&${str}=${utils.getUrlParameter(str)}`
: `${urlWithPostBackStr}?${str}=${utils.getUrlParameter(str)}`
}
})
window.location.href = urlWithPostBackStr
}
/* eslint-disable */
;(function () {
'use strict'
/**
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
*
* @codingstandard ftlabs-jsv2
* @copyright The Financial Times Limited [All Rights Reserved]
* @license MIT License (see LICENSE.txt)
*/
/* jslint browser:true, node:true */
/* global define, Event, Node */
/**
* Instantiate fast-clicking listeners on the specified layer.
*
* @constructor
* @param {Element} layer The layer to listen on
* @param {Object} [options={}] The options to override the defaults
*/
function FastClick(layer, options) {
var oldOnClick
options = options || {}
/**
* Whether a click is currently being tracked.
*
* @type boolean
*/
this.trackingClick = false
/**
* Timestamp for when click tracking started.
*
* @type number
*/
this.trackingClickStart = 0
/**
* The element being tracked for a click.
*
* @type EventTarget
*/
this.targetElement = null
/**
* X-coordinate of touch start event.
*
* @type number
*/
this.touchStartX = 0
/**
* Y-coordinate of touch start event.
*
* @type number
*/
this.touchStartY = 0
/**
* ID of the last touch, retrieved from Touch.identifier.
*
* @type number
*/
this.lastTouchIdentifier = 0
/**
* Touchmove boundary, beyond which a click will be cancelled.
*
* @type number
*/
this.touchBoundary = options.touchBoundary || 10
/**
* The FastClick layer.
*
* @type Element
*/
this.layer = layer
/**
* The minimum time between tap(touchstart and touchend) events
*
* @type number
*/
this.tapDelay = options.tapDelay || 200
/**
* The maximum time for a tap
*
* @type number
*/
this.tapTimeout = options.tapTimeout || 700
if (FastClick.notNeeded(layer)) {
return
}
// Some old versions of Android don't have Function.prototype.bind
function bind(method, context) {
return function() { return method.apply(context, arguments) }
}
var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel']
var context = this
for (var i = 0, l = methods.length; i < l; i++) {
context[methods[i]] = bind(context[methods[i]], context)
}
// Set up event handlers as required
if (deviceIsAndroid) {
layer.addEventListener('mouseover', this.onMouse, true)
layer.addEventListener('mousedown', this.onMouse, true)
layer.addEventListener('mouseup', this.onMouse, true)
}
layer.addEventListener('click', this.onClick, true)
layer.addEventListener('touchstart', this.onTouchStart, false)
layer.addEventListener('touchmove', this.onTouchMove, false)
layer.addEventListener('touchend', this.onTouchEnd, false)
layer.addEventListener('touchcancel', this.onTouchCancel, false)
// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
// layer when they are cancelled.
if (!Event.prototype.stopImmediatePropagation) {
layer.removeEventListener = function(type, callback, capture) {
var rmv = Node.prototype.removeEventListener
if (type === 'click') {
rmv.call(layer, type, callback.hijacked || callback, capture)
} else {
rmv.call(layer, type, callback, capture)
}
}
layer.addEventListener = function(type, callback, capture) {
var adv = Node.prototype.addEventListener
if (type === 'click') {
adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
if (!event.propagationStopped) {
callback(event)
}
}), capture)
} else {
adv.call(layer, type, callback, capture)
}
}
}
// If a handler is already declared in the element's onclick attribute, it will be fired before
// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
// adding it as listener.
if (typeof layer.onclick === 'function') {
// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
// - the old one won't work if passed to addEventListener directly.
oldOnClick = layer.onclick
layer.addEventListener('click', function(event) {
oldOnClick(event)
}, false)
layer.onclick = null
}
}
/**
* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
*
* @type boolean
*/
var deviceIsWindowsPhone = navigator.userAgent.indexOf('Windows Phone') >= 0
/**
* Android requires exceptions.
*
* @type boolean
*/
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone
/**
* iOS requires exceptions.
*
* @type boolean
*/
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone
/**
* iOS 4 requires an exception for select elements.
*
* @type boolean
*/
var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent)
/**
* iOS 6.0-7.* requires the target element to be manually derived
*
* @type boolean
*/
var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent)
/**
* BlackBerry requires exceptions.
*
* @type boolean
*/
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0
/**
* Determine whether a given element requires a native click.
*
* @param {EventTarget|Element} target Target DOM element
* @returns {boolean} Returns true if the element needs a native click
*/
FastClick.prototype.needsClick = function(target) {
switch (target.nodeName.toLowerCase()) {
// Don't send a synthetic click to disabled inputs (issue #62)
case 'button':
case 'select':
case 'textarea':
if (target.disabled) {
return true
}
break
case 'input':
// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
if ((deviceIsIOS && target.type === 'file') || target.disabled) {
return true
}
break
case 'label':
case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
case 'video':
return true
}
return (/\bneedsclick\b/).test(target.className)
}
/**
* Determine whether a given element requires a call to focus to simulate click into element.
*
* @param {EventTarget|Element} target Target DOM element
* @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
*/
FastClick.prototype.needsFocus = function(target) {
switch (target.nodeName.toLowerCase()) {
case 'textarea':
return true
case 'select':
return !deviceIsAndroid
case 'input':
switch (target.type) {
case 'button':
case 'checkbox':
case 'file':
case 'image':
case 'radio':
case 'submit':
return false
}
// No point in attempting to focus disabled inputs
return !target.disabled && !target.readOnly
default:
return (/\bneedsfocus\b/).test(target.className)
}
}
/**
* Send a click event to the specified element.
*
* @param {EventTarget|Element} targetElement
* @param {Event} event
*/
FastClick.prototype.sendClick = function(targetElement, event) {
var clickEvent, touch
// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
if (document.activeElement && document.activeElement !== targetElement) {
document.activeElement.blur()
}
touch = event.changedTouches[0]
// Synthesise a click event, with an extra attribute so it can be tracked
clickEvent = document.createEvent('MouseEvents')
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null)
clickEvent.forwardedTouchEvent = true
targetElement.dispatchEvent(clickEvent)
}
FastClick.prototype.determineEventType = function(targetElement) {
// Issue #159: Android Chrome Select Box does not open with a synthetic click event
if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
return 'mousedown'
}
return 'click'
}
/**
* @param {EventTarget|Element} targetElement
*/
FastClick.prototype.focus = function(targetElement) {
var length
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
length = targetElement.value.length
targetElement.setSelectionRange(length, length)
} else {
targetElement.focus()
}
}
/**
* Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
*
* @param {EventTarget|Element} targetElement
*/
FastClick.prototype.updateScrollParent = function(targetElement) {
var scrollParent, parentElement
scrollParent = targetElement.fastClickScrollParent
// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
// target element was moved to another parent.
if (!scrollParent || !scrollParent.contains(targetElement)) {
parentElement = targetElement
do {
if (parentElement.scrollHeight > parentElement.offsetHeight) {
scrollParent = parentElement
targetElement.fastClickScrollParent = parentElement
break
}
parentElement = parentElement.parentElement
} while (parentElement)
}
// Always update the scroll top tracker if possible.
if (scrollParent) {
scrollParent.fastClickLastScrollTop = scrollParent.scrollTop
}
}
/**
* @param {EventTarget} targetElement
* @returns {Element|EventTarget}
*/
FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
if (eventTarget.nodeType === Node.TEXT_NODE) {
return eventTarget.parentNode
}
return eventTarget
}
/**
* On touch start, record the position and scroll offset.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.onTouchStart = function(event) {
var targetElement, touch, selection
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
if (event.targetTouches.length > 1) {
return true
}
targetElement = this.getTargetElementFromEventTarget(event.target)
touch = event.targetTouches[0]
if (deviceIsIOS) {
// Fastclick导致IOS下多个 select ,点击某一个,焦点不停变换的bug - by zsl
var nodeName = targetElement.nodeName.toLowerCase()
var typeAttribute = targetElement.getAttribute('type')
if (nodeName === 'select') {
return false
}
// Only trusted events will deselect text on iOS (issue #49)
selection = window.getSelection()
if (selection.rangeCount && !selection.isCollapsed) {
return true
}
if (!deviceIsIOS4) {
// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
// with the same identifier as the touch event that previously triggered the click that triggered the alert.
// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
// random integers, it's safe to to continue if the identifier is 0 here.
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
event.preventDefault()
return false
}
this.lastTouchIdentifier = touch.identifier
// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
// 1) the user does a fling scroll on the scrollable layer
// 2) the user stops the fling scroll with another tap
// then the event.target of the last 'touchend' event will be the element that was under the user's finger
// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
this.updateScrollParent(targetElement)
}
}
this.trackingClick = true
this.trackingClickStart = event.timeStamp
this.targetElement = targetElement
this.touchStartX = touch.pageX
this.touchStartY = touch.pageY
// Prevent phantom clicks on fast double-tap (issue #36)
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
event.preventDefault()
}
return true
}
/**
* Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.touchHasMoved = function(event) {
var touch = event.changedTouches[0]; var boundary = this.touchBoundary
if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
return true
}
return false
}
/**
* Update the last position.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.onTouchMove = function(event) {
if (!this.trackingClick) {
return true
}
// If the touch has moved, cancel the click tracking
if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
this.trackingClick = false
this.targetElement = null
}
return true
}
/**
* Attempt to find the labelled control for the given label element.
*
* @param {EventTarget|HTMLLabelElement} labelElement
* @returns {Element|null}
*/
FastClick.prototype.findControl = function(labelElement) {
// Fast path for newer browsers supporting the HTML5 control attribute
if (labelElement.control !== undefined) {
return labelElement.control
}
// All browsers under test that support touch events also support the HTML5 htmlFor attribute
if (labelElement.htmlFor) {
return document.getElementById(labelElement.htmlFor)
}
// If no for attribute exists, attempt to retrieve the first labellable descendant element
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')
}
/**
* On touch end, determine whether to send a click event at once.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.onTouchEnd = function(event) {
var forElement; var trackingClickStart; var targetTagName; var scrollParent; var touch; var targetElement = this.targetElement
if (!this.trackingClick) {
return true
}
// Prevent phantom clicks on fast double-tap (issue #36)
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
this.cancelNextClick = true
return true
}
if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
return true
}
// Reset to prevent wrong click cancel on input (issue #156).
this.cancelNextClick = false
this.lastClickTime = event.timeStamp
trackingClickStart = this.trackingClickStart
this.trackingClick = false
this.trackingClickStart = 0
// On some iOS devices, the targetElement supplied with the event is invalid if the layer
// is performing a transition or scroll, and has to be re-detected manually. Note that
// for this to function correctly, it must be called *after* the event target is checked!
// See issue #57; also filed as rdar://13048589 .
if (deviceIsIOSWithBadTarget) {
touch = event.changedTouches[0]
// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent
}
targetTagName = targetElement.tagName.toLowerCase()
if (targetTagName === 'label') {
forElement = this.findControl(targetElement)
if (forElement) {
this.focus(targetElement)
if (deviceIsAndroid) {
return false
}
targetElement = forElement
}
} else if (this.needsFocus(targetElement)) {
// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
this.targetElement = null
return false
}
this.focus(targetElement)
this.sendClick(targetElement, event)
// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
if (!deviceIsIOS || targetTagName !== 'select') {
this.targetElement = null
event.preventDefault()
}
return false
}
if (deviceIsIOS && !deviceIsIOS4) {
// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
scrollParent = targetElement.fastClickScrollParent
if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
return true
}
}
// Prevent the actual click from going though - unless the target node is marked as requiring
// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
if (!this.needsClick(targetElement)) {
event.preventDefault()
this.sendClick(targetElement, event)
}
return false
}
/**
* On touch cancel, stop tracking the click.
*
* @returns {void}
*/
FastClick.prototype.onTouchCancel = function() {
this.trackingClick = false
this.targetElement = null
}
/**
* Determine mouse events which should be permitted.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.onMouse = function(event) {
// If a target element was never set (because a touch event was never fired) allow the event
if (!this.targetElement) {
return true
}
if (event.forwardedTouchEvent) {
return true
}
// Programmatically generated events targeting a specific element should be permitted
if (!event.cancelable) {
return true
}
// Derive and check the target element to see whether the mouse event needs to be permitted;
// unless explicitly enabled, prevent non-touch click events from triggering actions,
// to prevent ghost/doubleclicks.
if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
// Prevent any user-added listeners declared on FastClick element from being fired.
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation()
} else {
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
event.propagationStopped = true
}
// Cancel the event
event.stopPropagation()
event.preventDefault()
return false
}
// If the mouse event is permitted, return true for the action to go through.
return true
}
/**
* On actual clicks, determine whether this is a touch-generated click, a click action occurring
* naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
* an actual click which should be permitted.
*
* @param {Event} event
* @returns {boolean}
*/
FastClick.prototype.onClick = function(event) {
var permitted
// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
if (this.trackingClick) {
this.targetElement = null
this.trackingClick = false
return true
}
// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
if (event.target.type === 'submit' && event.detail === 0) {
return true
}
permitted = this.onMouse(event)
// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
if (!permitted) {
this.targetElement = null
}
// If clicks are permitted, return true for the action to go through.
return permitted
}
/**
* Remove all FastClick's event listeners.
*
* @returns {void}
*/
FastClick.prototype.destroy = function() {
var layer = this.layer
if (deviceIsAndroid) {
layer.removeEventListener('mouseover', this.onMouse, true)
layer.removeEventListener('mousedown', this.onMouse, true)
layer.removeEventListener('mouseup', this.onMouse, true)
}
layer.removeEventListener('click', this.onClick, true)
layer.removeEventListener('touchstart', this.onTouchStart, false)
layer.removeEventListener('touchmove', this.onTouchMove, false)
layer.removeEventListener('touchend', this.onTouchEnd, false)
layer.removeEventListener('touchcancel', this.onTouchCancel, false)
}
/**
* Check whether FastClick is needed.
*
* @param {Element} layer The layer to listen on
*/
FastClick.notNeeded = function(layer) {
var metaViewport
var chromeVersion
var blackberryVersion
var firefoxVersion
// Devices that don't support touch don't need FastClick
if (typeof window.ontouchstart === 'undefined') {
return true
}
// Chrome version - zero for other browsers
chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]
if (chromeVersion) {
if (deviceIsAndroid) {
metaViewport = document.querySelector('meta[name=viewport]')
if (metaViewport) {
// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
return true
}
// Chrome 32 and above with width=device-width or less don't need FastClick
if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
return true
}
}
// Chrome desktop doesn't need FastClick (issue #15)
} else {
return true
}
}
if (deviceIsBlackBerry10) {
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/)
// BlackBerry 10.3+ does not require Fastclick library.
// https://github.com/ftlabs/fastclick/issues/251
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
metaViewport = document.querySelector('meta[name=viewport]')
if (metaViewport) {
// user-scalable=no eliminates click delay.
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
return true
}
// width=device-width (or less than device-width) eliminates click delay.
if (document.documentElement.scrollWidth <= window.outerWidth) {
return true
}
}
}
}
// IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
return true
}
// Firefox version - zero for other browsers
firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]
if (firefoxVersion >= 27) {
// Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
metaViewport = document.querySelector('meta[name=viewport]')
if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
return true
}
}
// IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
// http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
return true
}
return false
}
/**
* Factory method for creating a FastClick object
*
* @param {Element} layer The layer to listen on
* @param {Object} [options={}] The options to override the defaults
*/
FastClick.attach = function(layer, options) {
return new FastClick(layer, options)
}
if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// AMD. Register as an anonymous module.
define(function() {
return FastClick
})
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = FastClick.attach
module.exports.FastClick = FastClick
} else {
window.FastClick = FastClick
}
}())
import Util from './utils'
import '../polyfills/string-padStart'
// 未完成
export const NETVeify = ({ triggerDom } = {}) => {
return new Promise((resolve, reject) => {
let yidunWrapper = $(`<div id="captcha"></div>`)
$('.land_wrap').append(yidunWrapper)
let ins = null
window.Loader.async(['//cstaticdun.126.net/load.min.js'], function() {
window.initNECaptcha({
captchaId: '4fd034beb0f0429f856ccc1b0cd71004',
element: `#captcha`,
mode: 'popup',
width: $(window).width() - 50,
onVerify: function(err, data) {
if (err) {
ins.destroy()
$(`#captcha`).remove()
reject(err)
return
}
ins.destroy()
resolve(data)
}
},
function onload(instance) {
ins = instance
// 初始化成功后,用户输入对应用户名和密码,以及完成验证后,直接点击登录按钮即可
instance.refresh()
instance.popUp()
},
function onerror(err) {
ins.destroy()
$(`#captcha`).remove()
reject(err)
// 验证码初始化失败处理逻辑,例如:提示用户点击按钮重新初始化
}
)
})
})
}
export const buryAOId = (selector) => {
window.Loader.async(["//yun.tuisnake.com/h5-mami/insurance/taobao/clipboard.min.js"], function() {
var clipboard = new Clipboard(selector, {
text: function(trigger) {
return `tuia=${Util.getUrlParameter('a_oId')}`
}
});
clipboard.on("success", function(element) { //复制成功的回调
});
clipboard.on('error', function(e) {
});
})
}
export const padStr = any => ''.padStart.call(any, 2, '0')
export const getDayStr = date => `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
export const getTimeStr = date => `${padStr(date.getHours())}:${padStr(date.getMinutes())}:${padStr(date.getSeconds())}`
export const isIphone = navigator.userAgent.indexOf('iPhone') !== -1
/**
* @preserve Tiny-Loader: A small loader that load CSS/JS in best way for page performanceIs.
*
* @version 1.0.1
* @copyright The Youzan Limited [All Rights Reserved]
* @license MIT License (see LICENSE.txt)
*/
(function(window, document) {
'use strict'
// cssExpr 用于判断资源是否是css
var cssExpr = new RegExp('\\.css|.less')
var nHead = document.head || document.getElementsByTagName('head')[0]
// `onload` 在WebKit < 535.23, Firefox < 9.0 不被支持
var isOldWebKit = +navigator.userAgent
.replace(/.*(?:AppleWebKit|AndroidWebKit)\/?(\d+).*/i, '$1') < 536
// 判断对应的node节点是否已经载入完成
function isReady(node) {
return node.readyState === 'complete' || node.readyState === 'loaded'
}
// loadCss 用于载入css资源
function loadCss(url, setting, callback) {
var node = document.createElement('link')
node.rel = 'stylesheet'
addOnload(node, callback, 'css')
node.async = true
node.href = url
nHead.appendChild(node)
}
// loadJs 用于载入js资源
function loadJs(url, setting, callback) {
var node = document.createElement('script')
node.charset = 'utf-8'
addOnload(node, callback, 'js')
node.async = !setting.sync
node.src = url
nHead.appendChild(node)
}
// 在老的webkit中,因不支持load事件,这里用轮询sheet来保证
function pollCss(node, callback) {
var isLoaded
if (node.sheet) {
isLoaded = true
}
setTimeout(function() {
if (isLoaded) {
// 在这里callback 是为了让样式有足够的时间渲染
callback()
} else {
pollCss(node, callback)
}
}, 20)
}
// 用于给指定的节点绑定onload回调
// 监听元素载入完成事件
function addOnload(node, callback, type) {
var supportOnload = 'onload' in node
var isCSS = type === 'css'
// 对老的webkit和老的firefox的兼容
if (isCSS && (isOldWebKit || !supportOnload)) {
setTimeout(function() {
pollCss(node, callback)
}, 1)
return
}
if (supportOnload) {
node.onload = onload
node.onerror = function() {
node.onerror = null
// window._cdnFallback(node);
}
} else {
node.onreadystatechange = function() {
if (isReady(node)) {
onload()
}
}
}
function onload() {
// 执行一次后清除,防止重复执行
node.onload = node.onreadystatechange = null
node = null
callback()
}
}
// 资源下载入口,根绝文件类型的不同,调用loadCss或者loadJs
function loadItem(url, list, setting, callback) {
if (cssExpr.test(url)) {
loadCss(url, setting, onFinishLoading)
} else {
loadJs(url, setting, onFinishLoading)
}
// 每次资源下载完成后,检验是否结束整个list下载过程
// 若已经完成所有下载,执行回调函数
function onFinishLoading() {
var urlIndex = list.indexOf(url)
if (urlIndex > -1) {
list.splice(urlIndex, 1)
}
if (list.length === 0) {
callback()
}
}
}
function doInit(list, setting, callback) {
var cb = function() {
callback && callback()
}
list = Array.prototype.slice.call(list || [])
if (list.length === 0) {
cb()
return
}
for (var i = 0, len = list.length; i < len; i++) {
loadItem(list[i], list, setting, cb)
}
}
// 判断当前页面是否加载完
// 加载完,立刻执行下载
// 未加载完,等待页面load事件以后再进行下载
function ready(node, callback) {
if (isReady(node)) {
callback()
} else {
window.addEventListener('load', callback)
}
}
// 暴露出去的Loader
// 提供async, sync两个函数
// async 用作异步下载执行用,不阻塞页面渲染
// sync 用作异步下载,顺序执行,保证下载的js按照数组顺序执行
var Loader = {
async: function(list, callback) {
ready(document, function() {
doInit(list, {}, callback)
})
},
sync: function(list, callback) {
ready(document, function() {
doInit(list, {
sync: true
}, callback)
})
}
}
window.Loader = Loader
return Loader
})(window, document)
/* eslint-disable */
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.io/#x15.4.4.18
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(' this is null or not defined');
}
// 1. Let O be the result of calling toObject() passing the
// |this| value as the argument.
var O = Object(this);
// 2. Let lenValue be the result of calling the Get() internal
// method of O with the argument "length".
// 3. Let len be toUint32(lenValue).
var len = O.length >>> 0;
// 4. If isCallable(callback) is false, throw a TypeError exception.
// See: http://es5.github.com/#x9.11
if (typeof callback !== "function") {
throw new TypeError(callback + ' is not a function');
}
// 5. If thisArg was supplied, let T be thisArg; else let
// T be undefined.
if (arguments.length > 1) {
T = thisArg;
}
// 6. Let k be 0
k = 0;
// 7. Repeat, while k < len
while (k < len) {
var kValue;
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty
// internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if (k in O) {
// i. Let kValue be the result of calling the Get internal
// method of O with argument Pk.
kValue = O[k];
// ii. Call the Call internal method of callback with T as
// the this value and argument list containing kValue, k, and O.
callback.call(T, kValue, k, O);
}
// d. Increase k by 1.
k++;
}
// 8. return undefined
};
}
\ No newline at end of file
var defaultConfig = {
content: '',
size: 'auto',
mask: true,
position: 'center',
radius: 8,
closeTime: 0,
actionConfig: [],
mainStyle: {
display: 'inline-block',
'max-width': '65%',
'border-radius': '0.1rem',
background: '#fff'
}
}
function popup(content, config) {
var cf = $.extend(true, {}, defaultConfig, config)
cf.content = content || cf.content
// 初始化html
var $mask = $('<div></div>').addClass('popup-mask')
var $main = $('<div></div>').addClass('popup-main')
var $content = $('<div></div>').addClass('popup-content')
// 构建初步的样式
$mask.css({
position: 'fixed',
left: 0,
top: 0,
width: '100%',
height: '100%',
background: 'rgba( 0, 0, 0,.6)',
'z-index': 2000
})
$main.css(cf.mainStyle)
$mask.append($main)
$main.append($content)
// config.mask
if (cf.mask === false) {
$mask.css({
background: 'rgba(0,0,0,0)'
})
}
// config.content
$content.html(cf.content)
// config.size
if (typeof cf.size === 'object') {
$main.css({
width: cf.size.width,
height: cf.size.height
})
}
// config.action
var acflength = cf.actionConfig.length
if (acflength > 0) {
var $action = $('<div></div>').addClass('popup-action')
var $actionBtn = $('<a></a>').addClass('popup-action-btn')
var defaultAction = {
text: '',
callback: function() {}
}
$action.css({
padding: '.2rem 0',
'text-align': 'center'
})
$main.append($action)
if (acflength >= 3) {
$actionBtn.css({
width: 100 / cf.actionConfig.length + '%',
'text-align': 'center',
'font-size': '0.25rem',
color: '#0d81ff',
display: 'inline-block',
'text-decoration': 'none',
'border-top': '1px #eee solid',
padding: '0.18rem 0'
})
}
cf.actionConfig.reverse()
for (var k = acflength; k--;) {
var $t = $actionBtn.clone()
var acf = $.extend({}, defaultAction, cf.actionConfig[k])
$t.css({
display: 'inline-block',
height: '.4rem',
'text-align': 'center',
'font-size': '0.2rem',
'line-height': '.4rem',
'text-decoration': 'none',
'border-radius': '.04rem',
'box-sizing': 'border-box'
})
if (acflength === 1) {
$t.css({
width: '78%',
color: '#fff',
'background-color': 'rgba(112, 112, 112, 0.68)'
})
} else if (acflength === 2) {
if (k === 1) {
$t.css({
width: '3.25rem',
color: '#ff4965',
border: '1px #ff4965 solid',
'margin-right': '0.6rem'
})
} else {
$t.css({
width: '3.25rem',
color: '#fff',
'background-color': '#ff4965'
})
}
}
$t.html(acf.text).on(
'click', {
acf: acf
},
function(ev) {
ev.data.acf.callback()
}
)
if (k < cf.actionConfig.length - 1 && cf.actionConfig.length >= 3) {
$t.css({
'box-sizing': 'border-box',
'border-right': '1px #eee solid'
})
}
$action.append($t)
}
}
// 插入popbox
$('body').append($mask)
// 定位
if (cf.position === 'center') {
$main.css({
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translateX(-50%)',
'margin-top': -$main.height() / 2
})
} else if (cf.position === 'top') {
$main.css({
position: 'absolute',
top: '5%',
left: '50%',
'margin-left': -$main.width() / 2
})
} else if (cf.position === 'bottom') {
$main.css({
position: 'absolute',
top: '95%',
left: '50%',
'margin-left': -$main.width() / 2,
'margin-top': -$main.height()
})
}
// config.closeTime
if (cf.closeTime !== 0) {
setTimeout(function() {
method.fadeOut(function() {
method.remove()
})
}, cf.closeTime)
}
var method = {
$mask: $mask,
$main: $main,
$contnet: $content,
show: function() {
this.$mask.show()
return this
},
hide: function() {
this.$mask.hide()
return this
},
fadeOut: function(callback) {
var self = this
var fadeOut = function(a, b) {
a -= b
self.$mask.css('opacity', a / 200)
setTimeout(function() {
fadeOut(a, b)
}, b)
if (a === 0) {
callback()
}
}
fadeOut(200, 20)
},
remove: function() {
this.$mask.remove()
return this
}
}
return method
}
popup.loading = function(config) {
config = $.extend(
true, {}, {
mainStyle: {
background: 'rgba(0,0,0,.5)',
padding: '.1rem .15rem'
}
},
config
)
return popup(
'<style>.sk-fading-circle{width:0.3rem;height:0.3rem;position:relative}.sk-fading-circle .sk-circle{width:100%;height:100%;position:absolute;left:0;top:0}.sk-fading-circle .sk-circle:before{content:"";display:block;margin:0 auto;width:15%;height:15%;background-color:#fff;border-radius:100%;-webkit-animation:sk-circleFadeDelay 1.2s infinite ease-in-out both;animation:sk-circleFadeDelay 1.2s infinite ease-in-out both}.sk-fading-circle .sk-circle2{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}.sk-fading-circle .sk-circle3{-webkit-transform:rotate(60deg);-ms-transform:rotate(60deg);transform:rotate(60deg)}.sk-fading-circle .sk-circle4{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.sk-fading-circle .sk-circle5{-webkit-transform:rotate(120deg);-ms-transform:rotate(120deg);transform:rotate(120deg)}.sk-fading-circle .sk-circle6{-webkit-transform:rotate(150deg);-ms-transform:rotate(150deg);transform:rotate(150deg)}.sk-fading-circle .sk-circle7{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.sk-fading-circle .sk-circle8{-webkit-transform:rotate(210deg);-ms-transform:rotate(210deg);transform:rotate(210deg)}.sk-fading-circle .sk-circle9{-webkit-transform:rotate(240deg);-ms-transform:rotate(240deg);transform:rotate(240deg)}.sk-fading-circle .sk-circle10{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.sk-fading-circle .sk-circle11{-webkit-transform:rotate(300deg);-ms-transform:rotate(300deg);transform:rotate(300deg)}.sk-fading-circle .sk-circle12{-webkit-transform:rotate(330deg);-ms-transform:rotate(330deg);transform:rotate(330deg)}.sk-fading-circle .sk-circle2:before{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}.sk-fading-circle .sk-circle3:before{-webkit-animation-delay:-1s;animation-delay:-1s}.sk-fading-circle .sk-circle4:before{-webkit-animation-delay:-.9s;animation-delay:-.9s}.sk-fading-circle .sk-circle5:before{-webkit-animation-delay:-.8s;animation-delay:-.8s}.sk-fading-circle .sk-circle6:before{-webkit-animation-delay:-.7s;animation-delay:-.7s}.sk-fading-circle .sk-circle7:before{-webkit-animation-delay:-.6s;animation-delay:-.6s}.sk-fading-circle .sk-circle8:before{-webkit-animation-delay:-.5s;animation-delay:-.5s}.sk-fading-circle .sk-circle9:before{-webkit-animation-delay:-.4s;animation-delay:-.4s}.sk-fading-circle .sk-circle10:before{-webkit-animation-delay:-.3s;animation-delay:-.3s}.sk-fading-circle .sk-circle11:before{-webkit-animation-delay:-.2s;animation-delay:-.2s}.sk-fading-circle .sk-circle12:before{-webkit-animation-delay:-.1s;animation-delay:-.1s}@-webkit-keyframes sk-circleFadeDelay{0%,39%,100%{opacity:0}40%{opacity:1}}@keyframes sk-circleFadeDelay{0%,39%,100%{opacity:0}40%{opacity:1}}</style><div class="sk-fading-circle"><div class="sk-circle1 sk-circle"></div><div class="sk-circle2 sk-circle"></div><div class="sk-circle3 sk-circle"></div><div class="sk-circle4 sk-circle"></div><div class="sk-circle5 sk-circle"></div><div class="sk-circle6 sk-circle"></div><div class="sk-circle7 sk-circle"></div><div class="sk-circle8 sk-circle"></div><div class="sk-circle9 sk-circle"></div><div class="sk-circle10 sk-circle"></div><div class="sk-circle11 sk-circle"></div><div class="sk-circle12 sk-circle"></div></div>',
config
)
}
popup.hideing = function() {
$('.popup-mask').remove()
}
popup.note = function(text, config) {
var defaultCfg = {
mainStyle: {
background: 'rgba(0,0,0,.7)',
padding: '.1rem .15rem'
},
closeTime: 1000
}
if (typeof config === 'number') {
config = $.extend(true, {}, defaultCfg, {
closeTime: config
})
} else {
config = $.extend(true, {}, defaultCfg, config)
}
return popup(
'<div style="color:#fff;font-size:0.12rem;margin:0">' + text + '</div>',
config
)
}
popup.confirm = function(text, confirmCallback, cancelCallback, config) {
config = $.extend(
true, {}, {
mainStyle: {
width: '65%'
},
mask: true,
actionConfig: [{
text: '取消',
callback: function() {
re.remove()
cancelCallback && cancelCallback.apply(re)
}
},
{
text: '确认',
callback: function() {
re.remove()
confirmCallback && confirmCallback.apply(re)
}
}
]
},
config
)
var re = popup(
'<div style="padding:.3rem;text-align:center;font-size:0.2rem;">' +
text +
'</div>',
config
)
return re
}
popup.alert = function(text, config, callback) {
config = $.extend(
true, {}, {
mainStyle: {
width: '65%'
},
mask: true,
actionConfig: [{
text: '好的',
callback: function() {
re.remove()
callback && callback()
}
}]
},
config
)
var re = popup(
'<div style="padding:.25rem;text-align:center;font-size: 0.16rem;">' +
text +
'</div>',
config
)
return re
}
module.exports = popup
/* eslint-disable */
/**
* @note 推啊 - 统计代码
* @date 2017-10-11
* @des
* 1. DOM中写db-exposure属性,属性中传入后端给的数据,通常为 ${lottery}
* 2. 埋点初始化,调用 window.DB.exposure.initLog()
* 3. 埋点批量曝光,调用 window.DB.exposure.showLog()
* 4. 埋点点击埋点, 调用 window.DB.exposure.clickLog()
* 5. 埋点单张曝光, 调用 window.DB.exposure.singleExp(data)
* 6. 埋点单次点击, 调用 window.DB.exposure.singleClk({data:data, callback:callback})
* @update: 2017-05-18 20:13:46
* 增加点击需求
* 默认<a db-exposure=""></a> 曝光
* <a db-click=""></a> 点击
* <a db-exposure="" db-click=""></a> 曝光+点击
*
* 增加singleExp、singleClk
*
*/
(function (window, $, DB) {
$.cookie = function (a, b, c) { if ("undefined" == typeof b) { var d = null; if (document.cookie && "" != document.cookie) for (var e = document.cookie.split(";"), f = 0; f < e.length; f++) { var g = $.trim(e[f]); if (g.substring(0, a.length + 1) == a + "=") { d = decodeURIComponent(g.substring(a.length + 1)); break } } return d } c = c || {}, null === b && (b = "", c = $.extend({}, c), c.expires = -1); var h = ""; if (c.expires && ("number" == typeof c.expires || c.expires.toUTCString)) { var i; "number" == typeof c.expires ? (i = new Date, i.setTime(i.getTime() + 24 * c.expires * 60 * 60 * 1e3)) : i = c.expires, h = "; expires=" + i.toUTCString() } var j = c.path ? "; path=" + c.path : "", k = c.domain ? "; domain=" + c.domain : "", l = c.secure ? "; secure" : ""; document.cookie = [a, "=", encodeURIComponent(b), h, j, k, l].join("") };
var Ret = $.cookie('Ret');
var exposure = {
logTimeout: null,
$win: $(window),
initLog: function () {
var self = this;
self.showLog();
self.clickLog();
self.srollLog();
},
singleExp: function (data) {
var domainUrl, webUrl;
if (data === undefined || data === 'undefined' || $.trim(data) === '' || data === 'null') {
return;
}
if (data && typeof data === 'string') {
data = JSON.parse(data);
} else {
return;
}
// 埋点服务器曝光
if (data.domain) {
var arr = [];
for (var name in data) {
arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name]));
}
domainUrl = data.domain + '/exposure/standard?' + arr.join('&') + '&_t=' + (new Date().getTime()) + '&Ret=' + Ret;
var $img = $('<img style="display:none;" src="' + domainUrl + '">'); // img src方式曝光
}
// web服务器曝光
if (data.domain4Web) {
var arr = [];
for (var name in data) {
arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name]));
}
webUrl = data.domain4Web + data.url + '?' + arr.join('&') + '&_t=' + (new Date().getTime());
var $img = $('<img style="display:none;" src="' + webUrl + '">'); // img src方式曝光
}
},
// 曝光
showLog: function (callback) {
var self = this, Wheight = self.$win.height(), Wwidth = self.$win.width();
// 遍历DOM
$('body').find('[db-exposure]').not('[db-exposure-get]').each(function () {
var me = $(this), data = me.attr('db-exposure');
// 规避 隐藏 (visiblity除外)
if (me.offset() && me.offset().width === 0) {
return;
}
if (data === undefined || data === 'undefined' || $.trim(data) === '' || data === 'null') {
return;
}
//判断是否在屏幕范围内,在则继续,不在则返回
if ($(window).scrollTop() + Wheight >= me.offset().top && $(window).scrollLeft() + Wwidth >= me.offset().left) {
me.attr('db-exposure-get', true);
} else {
return;
}
if (data === undefined || data === 'undefined' || $.trim(data) === '') {
return;
}
try {
data = JSON.parse(data);
} catch (e) {
console.log('数据曝光失败:' + (e || ''));
}
if (data.domain) {
// 发送埋点到埋点服务器
data.Ret = Ret;
self.sendApi({
domain: data.domain,
url: '/exposure/standard',
data: data
}, function () {
callback && callback();
});
}
if (data.domain4Web) {
// 发送埋点到内部日志
self.sendApi({
domain: data.domain4Web,
url: data.url,
data: data
}, function () {
callback && callback();
});
}
});
},
singleClk: function (options) {
var self = this;
var _defaults = {
data: null,
callback: function () { }
}
options = $.extend(true, _defaults, options);
var data = options.data, callback = options.callback;
if (data === undefined || data === 'undefined' || $.trim(data) === '') {
callback && callback();
return;
}
try {
data = JSON.parse(data);
} catch (e) {
console.log('数据曝光失败:' + (e || ''));
}
if (data.domain4Web) {
// 发送点击埋点到内部日志
self.sendApi({
domain: data.domain4Web,
url: data.url,
data: data
}, function () {
callback && callback();
});
}
},
clickLog: function (callback) {
var self = this;
$('body').find('[db-click]').unbind('click.statistics').bind('click.statistics', function () {
var me = $(this), data = me.attr('db-click');
// 规避 隐藏 && disabled
if (me.css('display') === 'none' || me.attr('disabled') === 'disabled' || me.prop('disabled')) {
return;
}
if (data === undefined || data === 'undefined' || $.trim(data) === '') {
return;
}
try {
data = JSON.parse(data);
} catch (e) {
console.log('数据曝光失败:' + (e || ''));
}
if (data.domain4Web) {
// 发送点击埋点到内部日志
self.sendApi({
domain: data.domain4Web,
url: data.url,
data: data
}, function () {
callback && callback();
});
}
});
},
//屏幕滚动
srollLog: function (callback) {
var self = this;
clearTimeout(self.logTimeout);
self.logTimeout = setTimeout(function () {
self.$win.scroll(function () {
self.showLog();
});
}, 200);
},
sendApi: function (data, complete, success, error) {
// 数据过滤,防刷
try {
var Protection = JSON.stringify(data);
if (Protection.indexOf('iframe') !== -1) {
return;
}
} catch (e) {
console.log('数据异常:' + (e || ''));
}
var domain = data.domain || '',
url = data.url;
// domain不存在,返回
if (!domain) return;
// domain、 url不需要传,过滤不需要的数据
delete data.domain;
delete data.url;
if (data.data && data.data.domain) {
delete data.data.domain
}
$.ajax({
url: domain + url,
data: data.data,
dataType: 'jsonp',
type: 'get',
timeout: 400,
jsonpCallback: 'tracks',
complete: function () {
complete && complete();
},
success: function (datas) {
success && success(datas);
},
error: function (datas) {
error && error(datas);
}
});
}
};
var format = function (data) {
if (data) {
var _data = JSON.parse(data);
} else {
return;
}
var arr = [];
for (var name in _data) {
arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(_data[name]));
}
return _data.domainWeb + _data.url + '?' + arr.join('&');
}
// 调用 window.DB.exposure
DB.exposure = exposure;
DB.format = format;
})(window, $, window.DB || (window.DB = {}));
\ No newline at end of file
/*
* @Author: Zhang Min
* @Date: 2018-05-08 19:18:24
* @Last Modified by: Zhang Min
* @Last Modified time: 2018-07-31 16:06:33
*/
const utils = {
ajax(options) {
const self = this
const _defaults = {
data: {
timestamp: new Date().getTime()
},
dataType: 'json',
success: function() {},
error: function(XHR, status) {
if (status === 'timeout') {
XHR && XHR.abort()
console.error('请求超时')
} else {
console.error('网络错误')
}
}
}
options = $.extend(true, _defaults, options)
// 是否需要检查token
if (window.CFG && window.CFG.isGlobalToken && window.CFG.globalToken) {
var globalToken = window.CFG.globalToken
var callback = options.success
var getToken = function() {
self.getActivityIframeToken(function() {
globalToken = window.CFG.globalToken
options.data.globalToken = globalToken
$.ajax(options)
})
}
options.success = function(data) {
if (data && data.code === '9999998') {
getToken()
return false
}
callback(data)
}
options.data.globalToken = globalToken
$.ajax(options)
return false
}
$.ajax(options)
},
// 获取token
getActivityIframeToken(callback) {
// 防重复请求
if (window.CFG && window.CFG.isRequestToken) {
// 因为存在多个ajax并行,所以须等待拿到token再回调
var timer = setInterval(function() {
if (!window.CFG.isRequestToken) {
clearInterval(timer)
callback()
}
})
return false
}
window.CFG.isRequestToken = true
$.ajax({
url: '/token/getGlobalToken',
type: 'get',
dataType: 'json',
data: {
appId: window.CFG && window.CFG.appId,
deviceId: this.getUrlParameter('deviceId'),
slotId: window.CFG && window.CFG.slotId
},
success: function(resp) {
if (window.CFG) {
window.CFG.globalToken = resp.data || ''
}
},
complete: function() {
callback()
window.CFG.isRequestToken = false
}
})
},
/**
* 获取url中特定字符串的值
* @param {*} name 字符串key
* @param {*} path 默认为页面链接地址,也可自己传某段string
*/
getUrlParameter(name, path = window.location.href) {
const result =
decodeURIComponent(
(new RegExp('[?|&]' + name + '=([^&;]+?)(&|#|;|$)').exec(path) || [
undefined,
''
])[1].replace(/\+/g, '%20')
) || null
return result ? result.split('/')[0] : ''
},
/**
* 获取UA环境类型
*/
getBroEnv() {
const ua = navigator.userAgent.toLocaleLowerCase()
const envArr = [{
rgx: /qq/g,
val: 2
},
{
rgx: /micromessenger/g,
val: 1
},
{
rgx: /alipay/g,
val: 3
}
]
let result = 4
for (var i = 0; i < envArr.length; i++) {
if (ua.match(envArr[i].rgx)) {
result = envArr[i].val
}
}
return result
},
/**
* 获取当前页面的页面类型
*/
getMainPageType() {
const {
pathname
} = window.location
let mainPageType = -1
switch (pathname) {
// 0.预览页面 1.主会场 2.活动中心 3.直投页 4.活动工具 5.活动工具奖品页
case '/mainMeet/index':
mainPageType = 1
break
case '/actCenter/index':
mainPageType = 2
break
case '/direct/index':
mainPageType = 3
break
case '/activity/index':
mainPageType = 4
break
case '/activity/indexRecord':
mainPageType = 5
break
case '/pluginTools/preview':
case '/plugin/entry.html':
mainPageType = 0
break
default:
mainPageType = -1
}
return mainPageType
},
/**
* 获取当前页面存储key值前缀
*/
getPageKey(name = '') {
const mainPageType = this.getMainPageType()
const id = this.getUrlParameter('id') || 0
const prefix = 'T'
let pageKey = 'preview'
switch (mainPageType) {
// 0.预览页面 1.主会场 2.活动中心 3.直投页 4.活动工具 5.活动工具奖品页
case 1:
pageKey = 'maninmeet'
break
case 2:
pageKey = 'actCenter'
break
case 3:
pageKey = 'direct'
break
case 4:
pageKey = 'activity'
break
case 6:
pageKey = 'record'
break
default:
break
}
pageKey = prefix + '-' + pageKey + '-' + id
if (name) {
pageKey = pageKey + '-' + name
}
return pageKey
},
// ifame访问的情况下,获取deviceId
getDeviceId() {
let deviceId = ''
try {
const cacheData = JSON.parse(window.localStorage.getItem('T-activity-Middle-deviceId'))
if (cacheData) {
deviceId = cacheData.data
}
} catch (error) {
console.log(error)
}
return deviceId
},
transformCss(data, isProps) {
let newStyle = {}
const reMultiStyles = [
'fontSize',
'width',
'height',
'top',
'left',
'borderBottomLeftRadius',
'borderBottomRightRadius',
'borderTopLeftRadius',
'borderTopRightRadius',
'borderWidth',
'borderRadius',
'lineHeight',
'minHeight',
'maxHeight',
'minWidth',
'maxWidth',
'bottom',
'right',
'backgroundSize'
]
for (var attr in data) {
if (reMultiStyles.indexOf(attr) !== -1 && !/%/g.test(data[attr])) {
newStyle[this.getKebabCase(attr)] = this.fitSize(data[attr], isProps) || data[attr]
} else {
newStyle[this.getKebabCase(attr)] = data[attr]
}
}
return newStyle
},
fitSize(size, isProps) {
if (size === 0) {
return size
}
if (isProps === '375px') {
return parseInt(size) ? (parseInt(size) * 2 / 200 * 64 / 75 + 'rem') : size
} else if (isProps === '320px') {
return parseInt(size) ? (parseInt(size) * 2 / 200 + 'rem') : size
}
},
// deletePx(data) {
// let number;
// if (typeof data === 'string') {
// number = parseInt(data);
// }
// return number;
// },
getKebabCase(str) {
if (!/[A-Z]/g.test(str)) {
return str
}
return str.replace(/[A-Z]/g, function(i) {
return '-' + i.toLowerCase()
})
}
}
export default utils
\ No newline at end of file
/* eslint-disable */
// 扩展zepto,让zepto和jquery一样能够再fn上挂载插件
Zepto.extend = Zepto.fn.extend = function() {
var options,
name,
src,
copy,
copyIsArray,
clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target;
// Skip the boolean and the target
target = arguments[i] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== 'object' && !Zepto.isFunction(target)) {
target = {};
}
// Extend Zepto itself if only one argument is passed
if (i === length) {
target = this;
i--;
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (
deep &&
copy &&
(Zepto.isPlainObject(copy) || (copyIsArray = Zepto.isArray(copy)))
) {
if (copyIsArray) {
copyIsArray = false;
clone = src && Zepto.isArray(src) ? src : [];
} else {
clone = src && Zepto.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = Zepto.extend(deep, clone, copy);
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
};
/* eslint-disable */
/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */
(function(global, factory) {
if (typeof define === 'function' && define.amd)
define(function() { return factory(global) })
else
factory(global)
}(window, function(window) {
var Zepto = (function() {
var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice,
document = window.document,
elementDisplay = {}, classCache = {},
cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 },
fragmentRE = /^\s*<(\w+|!)[^>]*>/,
singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rootNodeRE = /^(?:body|html)$/i,
capitalRE = /([A-Z])/g,
// special attributes that should be get/set via method calls
methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],
adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],
table = document.createElement('table'),
tableRow = document.createElement('tr'),
containers = {
'tr': document.createElement('tbody'),
'tbody': table, 'thead': table, 'tfoot': table,
'td': tableRow, 'th': tableRow,
'*': document.createElement('div')
},
readyRE = /complete|loaded|interactive/,
simpleSelectorRE = /^[\w-]*$/,
class2type = {},
toString = class2type.toString,
zepto = {},
camelize, uniq,
tempParent = document.createElement('div'),
propMap = {
'tabindex': 'tabIndex',
'readonly': 'readOnly',
'for': 'htmlFor',
'class': 'className',
'maxlength': 'maxLength',
'cellspacing': 'cellSpacing',
'cellpadding': 'cellPadding',
'rowspan': 'rowSpan',
'colspan': 'colSpan',
'usemap': 'useMap',
'frameborder': 'frameBorder',
'contenteditable': 'contentEditable'
},
isArray = Array.isArray ||
function(object){ return object instanceof Array }
zepto.matches = function(element, selector) {
if (!selector || !element || element.nodeType !== 1) return false
var matchesSelector = element.matches || element.webkitMatchesSelector ||
element.mozMatchesSelector || element.oMatchesSelector ||
element.matchesSelector
if (matchesSelector) return matchesSelector.call(element, selector)
// fall back to performing a selector:
var match, parent = element.parentNode, temp = !parent
if (temp) (parent = tempParent).appendChild(element)
match = ~zepto.qsa(parent, selector).indexOf(element)
temp && tempParent.removeChild(element)
return match
}
function type(obj) {
return obj == null ? String(obj) :
class2type[toString.call(obj)] || "object"
}
function isFunction(value) { return type(value) == "function" }
function isWindow(obj) { return obj != null && obj == obj.window }
function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }
function isObject(obj) { return type(obj) == "object" }
function isPlainObject(obj) {
return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype
}
function likeArray(obj) {
var length = !!obj && 'length' in obj && obj.length,
type = $.type(obj)
return 'function' != type && !isWindow(obj) && (
'array' == type || length === 0 ||
(typeof length == 'number' && length > 0 && (length - 1) in obj)
)
}
function compact(array) { return filter.call(array, function(item){ return item != null }) }
function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }
camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }
function dasherize(str) {
return str.replace(/::/g, '/')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/_/g, '-')
.toLowerCase()
}
uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) }
function classRE(name) {
return name in classCache ?
classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)'))
}
function maybeAddPx(name, value) {
return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value
}
function defaultDisplay(nodeName) {
var element, display
if (!elementDisplay[nodeName]) {
element = document.createElement(nodeName)
document.body.appendChild(element)
display = getComputedStyle(element, '').getPropertyValue("display")
element.parentNode.removeChild(element)
display == "none" && (display = "block")
elementDisplay[nodeName] = display
}
return elementDisplay[nodeName]
}
function children(element) {
return 'children' in element ?
slice.call(element.children) :
$.map(element.childNodes, function(node){ if (node.nodeType == 1) return node })
}
function Z(dom, selector) {
var i, len = dom ? dom.length : 0
for (i = 0; i < len; i++) this[i] = dom[i]
this.length = len
this.selector = selector || ''
}
// `$.zepto.fragment` takes a html string and an optional tag name
// to generate DOM nodes from the given html string.
// The generated DOM nodes are returned as an array.
// This function can be overridden in plugins for example to make
// it compatible with browsers that don't support the DOM fully.
zepto.fragment = function(html, name, properties) {
var dom, nodes, container
// A special case optimization for a single tag
if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1))
if (!dom) {
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>")
if (name === undefined) name = fragmentRE.test(html) && RegExp.$1
if (!(name in containers)) name = '*'
container = containers[name]
container.innerHTML = '' + html
dom = $.each(slice.call(container.childNodes), function(){
container.removeChild(this)
})
}
if (isPlainObject(properties)) {
nodes = $(dom)
$.each(properties, function(key, value) {
if (methodAttributes.indexOf(key) > -1) nodes[key](value)
else nodes.attr(key, value)
})
}
return dom
}
// `$.zepto.Z` swaps out the prototype of the given `dom` array
// of nodes with `$.fn` and thus supplying all the Zepto functions
// to the array. This method can be overridden in plugins.
zepto.Z = function(dom, selector) {
return new Z(dom, selector)
}
// `$.zepto.isZ` should return `true` if the given object is a Zepto
// collection. This method can be overridden in plugins.
zepto.isZ = function(object) {
return object instanceof zepto.Z
}
// `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
// takes a CSS selector and an optional context (and handles various
// special cases).
// This method can be overridden in plugins.
zepto.init = function(selector, context) {
var dom
// If nothing given, return an empty Zepto collection
if (!selector) return zepto.Z()
// Optimize for string selectors
else if (typeof selector == 'string') {
selector = selector.trim()
// If it's a html fragment, create nodes from it
// Note: In both Chrome 21 and Firefox 15, DOM error 12
// is thrown if the fragment doesn't begin with <
if (selector[0] == '<' && fragmentRE.test(selector))
dom = zepto.fragment(selector, RegExp.$1, context), selector = null
// If there's a context, create a collection on that context first, and select
// nodes from there
else if (context !== undefined) return $(context).find(selector)
// If it's a CSS selector, use it to select nodes.
else dom = zepto.qsa(document, selector)
}
// If a function is given, call it when the DOM is ready
else if (isFunction(selector)) return $(document).ready(selector)
// If a Zepto collection is given, just return it
else if (zepto.isZ(selector)) return selector
else {
// normalize array if an array of nodes is given
if (isArray(selector)) dom = compact(selector)
// Wrap DOM nodes.
else if (isObject(selector))
dom = [selector], selector = null
// If it's a html fragment, create nodes from it
else if (fragmentRE.test(selector))
dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null
// If there's a context, create a collection on that context first, and select
// nodes from there
else if (context !== undefined) return $(context).find(selector)
// And last but no least, if it's a CSS selector, use it to select nodes.
else dom = zepto.qsa(document, selector)
}
// create a new Zepto collection from the nodes found
return zepto.Z(dom, selector)
}
// `$` will be the base `Zepto` object. When calling this
// function just call `$.zepto.init, which makes the implementation
// details of selecting nodes and creating Zepto collections
// patchable in plugins.
$ = function(selector, context){
return zepto.init(selector, context)
}
function extend(target, source, deep) {
for (key in source)
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
if (isPlainObject(source[key]) && !isPlainObject(target[key]))
target[key] = {}
if (isArray(source[key]) && !isArray(target[key]))
target[key] = []
extend(target[key], source[key], deep)
}
else if (source[key] !== undefined) target[key] = source[key]
}
// Copy all but undefined properties from one or more
// objects to the `target` object.
$.extend = function(target){
var deep, args = slice.call(arguments, 1)
if (typeof target == 'boolean') {
deep = target
target = args.shift()
}
args.forEach(function(arg){ extend(target, arg, deep) })
return target
}
// `$.zepto.qsa` is Zepto's CSS selector implementation which
// uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
// This method can be overridden in plugins.
zepto.qsa = function(element, selector){
var found,
maybeID = selector[0] == '#',
maybeClass = !maybeID && selector[0] == '.',
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked
isSimple = simpleSelectorRE.test(nameOnly)
return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById
( (found = element.getElementById(nameOnly)) ? [found] : [] ) :
(element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] :
slice.call(
isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName
maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class
element.getElementsByTagName(selector) : // Or a tag
element.querySelectorAll(selector) // Or it's not simple, and we need to query all
)
}
function filtered(nodes, selector) {
return selector == null ? $(nodes) : $(nodes).filter(selector)
}
$.contains = document.documentElement.contains ?
function(parent, node) {
return parent !== node && parent.contains(node)
} :
function(parent, node) {
while (node && (node = node.parentNode))
if (node === parent) return true
return false
}
function funcArg(context, arg, idx, payload) {
return isFunction(arg) ? arg.call(context, idx, payload) : arg
}
function setAttribute(node, name, value) {
value == null ? node.removeAttribute(name) : node.setAttribute(name, value)
}
// access className property while respecting SVGAnimatedString
function className(node, value){
var klass = node.className || '',
svg = klass && klass.baseVal !== undefined
if (value === undefined) return svg ? klass.baseVal : klass
svg ? (klass.baseVal = value) : (node.className = value)
}
// "true" => true
// "false" => false
// "null" => null
// "42" => 42
// "42.5" => 42.5
// "08" => "08"
// JSON => parse if valid
// String => self
function deserializeValue(value) {
try {
return value ?
value == "true" ||
( value == "false" ? false :
value == "null" ? null :
+value + "" == value ? +value :
/^[\[\{]/.test(value) ? $.parseJSON(value) :
value )
: value
} catch(e) {
return value
}
}
$.type = type
$.isFunction = isFunction
$.isWindow = isWindow
$.isArray = isArray
$.isPlainObject = isPlainObject
$.isEmptyObject = function(obj) {
var name
for (name in obj) return false
return true
}
$.isNumeric = function(val) {
var num = Number(val), type = typeof val
return val != null && type != 'boolean' &&
(type != 'string' || val.length) &&
!isNaN(num) && isFinite(num) || false
}
$.inArray = function(elem, array, i){
return emptyArray.indexOf.call(array, elem, i)
}
$.camelCase = camelize
$.trim = function(str) {
return str == null ? "" : String.prototype.trim.call(str)
}
// plugin compatibility
$.uuid = 0
$.support = { }
$.expr = { }
$.noop = function() {}
$.map = function(elements, callback){
var value, values = [], i, key
if (likeArray(elements))
for (i = 0; i < elements.length; i++) {
value = callback(elements[i], i)
if (value != null) values.push(value)
}
else
for (key in elements) {
value = callback(elements[key], key)
if (value != null) values.push(value)
}
return flatten(values)
}
$.each = function(elements, callback){
var i, key
if (likeArray(elements)) {
for (i = 0; i < elements.length; i++)
if (callback.call(elements[i], i, elements[i]) === false) return elements
} else {
for (key in elements)
if (callback.call(elements[key], key, elements[key]) === false) return elements
}
return elements
}
$.grep = function(elements, callback){
return filter.call(elements, callback)
}
if (window.JSON) $.parseJSON = JSON.parse
// Populate the class2type map
$.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase()
})
// Define methods that will be available on all
// Zepto collections
$.fn = {
constructor: zepto.Z,
length: 0,
// Because a collection acts like an array
// copy over these useful array functions.
forEach: emptyArray.forEach,
reduce: emptyArray.reduce,
push: emptyArray.push,
sort: emptyArray.sort,
splice: emptyArray.splice,
indexOf: emptyArray.indexOf,
concat: function(){
var i, value, args = []
for (i = 0; i < arguments.length; i++) {
value = arguments[i]
args[i] = zepto.isZ(value) ? value.toArray() : value
}
return concat.apply(zepto.isZ(this) ? this.toArray() : this, args)
},
// `map` and `slice` in the jQuery API work differently
// from their array counterparts
map: function(fn){
return $($.map(this, function(el, i){ return fn.call(el, i, el) }))
},
slice: function(){
return $(slice.apply(this, arguments))
},
ready: function(callback){
// need to check if document.body exists for IE as that browser reports
// document ready when it hasn't yet created the body element
if (readyRE.test(document.readyState) && document.body) callback($)
else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false)
return this
},
get: function(idx){
return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]
},
toArray: function(){ return this.get() },
size: function(){
return this.length
},
remove: function(){
return this.each(function(){
if (this.parentNode != null)
this.parentNode.removeChild(this)
})
},
each: function(callback){
emptyArray.every.call(this, function(el, idx){
return callback.call(el, idx, el) !== false
})
return this
},
filter: function(selector){
if (isFunction(selector)) return this.not(this.not(selector))
return $(filter.call(this, function(element){
return zepto.matches(element, selector)
}))
},
add: function(selector,context){
return $(uniq(this.concat($(selector,context))))
},
is: function(selector){
return this.length > 0 && zepto.matches(this[0], selector)
},
not: function(selector){
var nodes=[]
if (isFunction(selector) && selector.call !== undefined)
this.each(function(idx){
if (!selector.call(this,idx)) nodes.push(this)
})
else {
var excludes = typeof selector == 'string' ? this.filter(selector) :
(likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)
this.forEach(function(el){
if (excludes.indexOf(el) < 0) nodes.push(el)
})
}
return $(nodes)
},
has: function(selector){
return this.filter(function(){
return isObject(selector) ?
$.contains(this, selector) :
$(this).find(selector).size()
})
},
eq: function(idx){
return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1)
},
first: function(){
var el = this[0]
return el && !isObject(el) ? el : $(el)
},
last: function(){
var el = this[this.length - 1]
return el && !isObject(el) ? el : $(el)
},
find: function(selector){
var result, $this = this
if (!selector) result = $()
else if (typeof selector == 'object')
result = $(selector).filter(function(){
var node = this
return emptyArray.some.call($this, function(parent){
return $.contains(parent, node)
})
})
else if (this.length == 1) result = $(zepto.qsa(this[0], selector))
else result = this.map(function(){ return zepto.qsa(this, selector) })
return result
},
closest: function(selector, context){
var nodes = [], collection = typeof selector == 'object' && $(selector)
this.each(function(_, node){
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
node = node !== context && !isDocument(node) && node.parentNode
if (node && nodes.indexOf(node) < 0) nodes.push(node)
})
return $(nodes)
},
parents: function(selector){
var ancestors = [], nodes = this
while (nodes.length > 0)
nodes = $.map(nodes, function(node){
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
ancestors.push(node)
return node
}
})
return filtered(ancestors, selector)
},
parent: function(selector){
return filtered(uniq(this.pluck('parentNode')), selector)
},
children: function(selector){
return filtered(this.map(function(){ return children(this) }), selector)
},
contents: function() {
return this.map(function() { return this.contentDocument || slice.call(this.childNodes) })
},
siblings: function(selector){
return filtered(this.map(function(i, el){
return filter.call(children(el.parentNode), function(child){ return child!==el })
}), selector)
},
empty: function(){
return this.each(function(){ this.innerHTML = '' })
},
// `pluck` is borrowed from Prototype.js
pluck: function(property){
return $.map(this, function(el){ return el[property] })
},
show: function(){
return this.each(function(){
this.style.display == "none" && (this.style.display = '')
if (getComputedStyle(this, '').getPropertyValue("display") == "none")
this.style.display = defaultDisplay(this.nodeName)
})
},
replaceWith: function(newContent){
return this.before(newContent).remove()
},
wrap: function(structure){
var func = isFunction(structure)
if (this[0] && !func)
var dom = $(structure).get(0),
clone = dom.parentNode || this.length > 1
return this.each(function(index){
$(this).wrapAll(
func ? structure.call(this, index) :
clone ? dom.cloneNode(true) : dom
)
})
},
wrapAll: function(structure){
if (this[0]) {
$(this[0]).before(structure = $(structure))
var children
// drill down to the inmost element
while ((children = structure.children()).length) structure = children.first()
$(structure).append(this)
}
return this
},
wrapInner: function(structure){
var func = isFunction(structure)
return this.each(function(index){
var self = $(this), contents = self.contents(),
dom = func ? structure.call(this, index) : structure
contents.length ? contents.wrapAll(dom) : self.append(dom)
})
},
unwrap: function(){
this.parent().each(function(){
$(this).replaceWith($(this).children())
})
return this
},
clone: function(){
return this.map(function(){ return this.cloneNode(true) })
},
hide: function(){
return this.css("display", "none")
},
toggle: function(setting){
return this.each(function(){
var el = $(this)
;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide()
})
},
prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') },
next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') },
html: function(html){
return 0 in arguments ?
this.each(function(idx){
var originHtml = this.innerHTML
$(this).empty().append( funcArg(this, html, idx, originHtml) )
}) :
(0 in this ? this[0].innerHTML : null)
},
text: function(text){
return 0 in arguments ?
this.each(function(idx){
var newText = funcArg(this, text, idx, this.textContent)
this.textContent = newText == null ? '' : ''+newText
}) :
(0 in this ? this.pluck('textContent').join("") : null)
},
attr: function(name, value){
var result
return (typeof name == 'string' && !(1 in arguments)) ?
(0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined) :
this.each(function(idx){
if (this.nodeType !== 1) return
if (isObject(name)) for (key in name) setAttribute(this, key, name[key])
else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))
})
},
removeAttr: function(name){
return this.each(function(){ this.nodeType === 1 && name.split(' ').forEach(function(attribute){
setAttribute(this, attribute)
}, this)})
},
prop: function(name, value){
name = propMap[name] || name
return (1 in arguments) ?
this.each(function(idx){
this[name] = funcArg(this, value, idx, this[name])
}) :
(this[0] && this[0][name])
},
removeProp: function(name){
name = propMap[name] || name
return this.each(function(){ delete this[name] })
},
data: function(name, value){
var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()
var data = (1 in arguments) ?
this.attr(attrName, value) :
this.attr(attrName)
return data !== null ? deserializeValue(data) : undefined
},
val: function(value){
if (0 in arguments) {
if (value == null) value = ""
return this.each(function(idx){
this.value = funcArg(this, value, idx, this.value)
})
} else {
return this[0] && (this[0].multiple ?
$(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') :
this[0].value)
}
},
offset: function(coordinates){
if (coordinates) return this.each(function(index){
var $this = $(this),
coords = funcArg(this, coordinates, index, $this.offset()),
parentOffset = $this.offsetParent().offset(),
props = {
top: coords.top - parentOffset.top,
left: coords.left - parentOffset.left
}
if ($this.css('position') == 'static') props['position'] = 'relative'
$this.css(props)
})
if (!this.length) return null
if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0]))
return {top: 0, left: 0}
var obj = this[0].getBoundingClientRect()
return {
left: obj.left + window.pageXOffset,
top: obj.top + window.pageYOffset,
width: Math.round(obj.width),
height: Math.round(obj.height)
}
},
css: function(property, value){
if (arguments.length < 2) {
var element = this[0]
if (typeof property == 'string') {
if (!element) return
return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property)
} else if (isArray(property)) {
if (!element) return
var props = {}
var computedStyle = getComputedStyle(element, '')
$.each(property, function(_, prop){
props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))
})
return props
}
}
var css = ''
if (type(property) == 'string') {
if (!value && value !== 0)
this.each(function(){ this.style.removeProperty(dasherize(property)) })
else
css = dasherize(property) + ":" + maybeAddPx(property, value)
} else {
for (key in property)
if (!property[key] && property[key] !== 0)
this.each(function(){ this.style.removeProperty(dasherize(key)) })
else
css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
}
return this.each(function(){ this.style.cssText += ';' + css })
},
index: function(element){
return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])
},
hasClass: function(name){
if (!name) return false
return emptyArray.some.call(this, function(el){
return this.test(className(el))
}, classRE(name))
},
addClass: function(name){
if (!name) return this
return this.each(function(idx){
if (!('className' in this)) return
classList = []
var cls = className(this), newName = funcArg(this, name, idx, cls)
newName.split(/\s+/g).forEach(function(klass){
if (!$(this).hasClass(klass)) classList.push(klass)
}, this)
classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "))
})
},
removeClass: function(name){
return this.each(function(idx){
if (!('className' in this)) return
if (name === undefined) return className(this, '')
classList = className(this)
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){
classList = classList.replace(classRE(klass), " ")
})
className(this, classList.trim())
})
},
toggleClass: function(name, when){
if (!name) return this
return this.each(function(idx){
var $this = $(this), names = funcArg(this, name, idx, className(this))
names.split(/\s+/g).forEach(function(klass){
(when === undefined ? !$this.hasClass(klass) : when) ?
$this.addClass(klass) : $this.removeClass(klass)
})
})
},
scrollTop: function(value){
if (!this.length) return
var hasScrollTop = 'scrollTop' in this[0]
if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset
return this.each(hasScrollTop ?
function(){ this.scrollTop = value } :
function(){ this.scrollTo(this.scrollX, value) })
},
scrollLeft: function(value){
if (!this.length) return
var hasScrollLeft = 'scrollLeft' in this[0]
if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset
return this.each(hasScrollLeft ?
function(){ this.scrollLeft = value } :
function(){ this.scrollTo(value, this.scrollY) })
},
position: function() {
if (!this.length) return
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset()
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( $(elem).css('margin-top') ) || 0
offset.left -= parseFloat( $(elem).css('margin-left') ) || 0
// Add offsetParent borders
parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0
parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
}
},
offsetParent: function() {
return this.map(function(){
var parent = this.offsetParent || document.body
while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static")
parent = parent.offsetParent
return parent
})
}
}
// for now
$.fn.detach = $.fn.remove
// Generate the `width` and `height` functions
;['width', 'height'].forEach(function(dimension){
var dimensionProperty =
dimension.replace(/./, function(m){ return m[0].toUpperCase() })
$.fn[dimension] = function(value){
var offset, el = this[0]
if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :
isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :
(offset = this.offset()) && offset[dimension]
else return this.each(function(idx){
el = $(this)
el.css(dimension, funcArg(this, value, idx, el[dimension]()))
})
}
})
function traverseNode(node, fun) {
fun(node)
for (var i = 0, len = node.childNodes.length; i < len; i++)
traverseNode(node.childNodes[i], fun)
}
// Generate the `after`, `prepend`, `before`, `append`,
// `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
adjacencyOperators.forEach(function(operator, operatorIndex) {
var inside = operatorIndex % 2 //=> prepend, append
$.fn[operator] = function(){
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
var argType, nodes = $.map(arguments, function(arg) {
var arr = []
argType = type(arg)
if (argType == "array") {
arg.forEach(function(el) {
if (el.nodeType !== undefined) return arr.push(el)
else if ($.zepto.isZ(el)) return arr = arr.concat(el.get())
arr = arr.concat(zepto.fragment(el))
})
return arr
}
return argType == "object" || arg == null ?
arg : zepto.fragment(arg)
}),
parent, copyByClone = this.length > 1
if (nodes.length < 1) return this
return this.each(function(_, target){
parent = inside ? target : target.parentNode
// convert all methods to a "before" operation
target = operatorIndex == 0 ? target.nextSibling :
operatorIndex == 1 ? target.firstChild :
operatorIndex == 2 ? target :
null
var parentInDocument = $.contains(document.documentElement, parent)
nodes.forEach(function(node){
if (copyByClone) node = node.cloneNode(true)
else if (!parent) return $(node).remove()
parent.insertBefore(node, target)
if (parentInDocument) traverseNode(node, function(el){
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&
(!el.type || el.type === 'text/javascript') && !el.src){
var target = el.ownerDocument ? el.ownerDocument.defaultView : window
target['eval'].call(target, el.innerHTML)
}
})
})
})
}
// after => insertAfter
// prepend => prependTo
// before => insertBefore
// append => appendTo
$.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){
$(html)[operator](this)
return this
}
})
zepto.Z.prototype = Z.prototype = $.fn
// Export internal API functions in the `$.zepto` namespace
zepto.uniq = uniq
zepto.deserializeValue = deserializeValue
$.zepto = zepto
return $
})()
window.Zepto = Zepto
window.$ === undefined && (window.$ = Zepto)
;(function($){
var _zid = 1, undefined,
slice = Array.prototype.slice,
isFunction = $.isFunction,
isString = function(obj){ return typeof obj == 'string' },
handlers = {},
specialEvents={},
focusinSupported = 'onfocusin' in window,
focus = { focus: 'focusin', blur: 'focusout' },
hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }
specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'
function zid(element) {
return element._zid || (element._zid = _zid++)
}
function findHandlers(element, event, fn, selector) {
event = parse(event)
if (event.ns) var matcher = matcherFor(event.ns)
return (handlers[zid(element)] || []).filter(function(handler) {
return handler
&& (!event.e || handler.e == event.e)
&& (!event.ns || matcher.test(handler.ns))
&& (!fn || zid(handler.fn) === zid(fn))
&& (!selector || handler.sel == selector)
})
}
function parse(event) {
var parts = ('' + event).split('.')
return {e: parts[0], ns: parts.slice(1).sort().join(' ')}
}
function matcherFor(ns) {
return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')
}
function eventCapture(handler, captureSetting) {
return handler.del &&
(!focusinSupported && (handler.e in focus)) ||
!!captureSetting
}
function realEvent(type) {
return hover[type] || (focusinSupported && focus[type]) || type
}
function add(element, events, fn, data, selector, delegator, capture){
var id = zid(element), set = (handlers[id] || (handlers[id] = []))
events.split(/\s/).forEach(function(event){
if (event == 'ready') return $(document).ready(fn)
var handler = parse(event)
handler.fn = fn
handler.sel = selector
// emulate mouseenter, mouseleave
if (handler.e in hover) fn = function(e){
var related = e.relatedTarget
if (!related || (related !== this && !$.contains(this, related)))
return handler.fn.apply(this, arguments)
}
handler.del = delegator
var callback = delegator || fn
handler.proxy = function(e){
e = compatible(e)
if (e.isImmediatePropagationStopped()) return
e.data = data
var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
if (result === false) e.preventDefault(), e.stopPropagation()
return result
}
handler.i = set.length
set.push(handler)
if ('addEventListener' in element)
element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
})
}
function remove(element, events, fn, selector, capture){
var id = zid(element)
;(events || '').split(/\s/).forEach(function(event){
findHandlers(element, event, fn, selector).forEach(function(handler){
delete handlers[id][handler.i]
if ('removeEventListener' in element)
element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
})
})
}
$.event = { add: add, remove: remove }
$.proxy = function(fn, context) {
var args = (2 in arguments) && slice.call(arguments, 2)
if (isFunction(fn)) {
var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) }
proxyFn._zid = zid(fn)
return proxyFn
} else if (isString(context)) {
if (args) {
args.unshift(fn[context], fn)
return $.proxy.apply(null, args)
} else {
return $.proxy(fn[context], fn)
}
} else {
throw new TypeError("expected function")
}
}
$.fn.bind = function(event, data, callback){
return this.on(event, data, callback)
}
$.fn.unbind = function(event, callback){
return this.off(event, callback)
}
$.fn.one = function(event, selector, data, callback){
return this.on(event, selector, data, callback, 1)
}
var returnTrue = function(){return true},
returnFalse = function(){return false},
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,
eventMethods = {
preventDefault: 'isDefaultPrevented',
stopImmediatePropagation: 'isImmediatePropagationStopped',
stopPropagation: 'isPropagationStopped'
}
function compatible(event, source) {
if (source || !event.isDefaultPrevented) {
source || (source = event)
$.each(eventMethods, function(name, predicate) {
var sourceMethod = source[name]
event[name] = function(){
this[predicate] = returnTrue
return sourceMethod && sourceMethod.apply(source, arguments)
}
event[predicate] = returnFalse
})
event.timeStamp || (event.timeStamp = Date.now())
if (source.defaultPrevented !== undefined ? source.defaultPrevented :
'returnValue' in source ? source.returnValue === false :
source.getPreventDefault && source.getPreventDefault())
event.isDefaultPrevented = returnTrue
}
return event
}
function createProxy(event) {
var key, proxy = { originalEvent: event }
for (key in event)
if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]
return compatible(proxy, event)
}
$.fn.delegate = function(selector, event, callback){
return this.on(event, selector, callback)
}
$.fn.undelegate = function(selector, event, callback){
return this.off(event, selector, callback)
}
$.fn.live = function(event, callback){
$(document.body).delegate(this.selector, event, callback)
return this
}
$.fn.die = function(event, callback){
$(document.body).undelegate(this.selector, event, callback)
return this
}
$.fn.on = function(event, selector, data, callback, one){
var autoRemove, delegator, $this = this
if (event && !isString(event)) {
$.each(event, function(type, fn){
$this.on(type, selector, data, fn, one)
})
return $this
}
if (!isString(selector) && !isFunction(callback) && callback !== false)
callback = data, data = selector, selector = undefined
if (callback === undefined || data === false)
callback = data, data = undefined
if (callback === false) callback = returnFalse
return $this.each(function(_, element){
if (one) autoRemove = function(e){
remove(element, e.type, callback)
return callback.apply(this, arguments)
}
if (selector) delegator = function(e){
var evt, match = $(e.target).closest(selector, element).get(0)
if (match && match !== element) {
evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))
}
}
add(element, event, callback, data, selector, delegator || autoRemove)
})
}
$.fn.off = function(event, selector, callback){
var $this = this
if (event && !isString(event)) {
$.each(event, function(type, fn){
$this.off(type, selector, fn)
})
return $this
}
if (!isString(selector) && !isFunction(callback) && callback !== false)
callback = selector, selector = undefined
if (callback === false) callback = returnFalse
return $this.each(function(){
remove(this, event, callback, selector)
})
}
$.fn.trigger = function(event, args){
event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)
event._args = args
return this.each(function(){
// handle focus(), blur() by calling them directly
if (event.type in focus && typeof this[event.type] == "function") this[event.type]()
// items in the collection might not be DOM elements
else if ('dispatchEvent' in this) this.dispatchEvent(event)
else $(this).triggerHandler(event, args)
})
}
// triggers event handlers on current element just as if an event occurred,
// doesn't trigger an actual event, doesn't bubble
$.fn.triggerHandler = function(event, args){
var e, result
this.each(function(i, element){
e = createProxy(isString(event) ? $.Event(event) : event)
e._args = args
e.target = element
$.each(findHandlers(element, event.type || event), function(i, handler){
result = handler.proxy(e)
if (e.isImmediatePropagationStopped()) return false
})
})
return result
}
// shortcut methods for `.bind(event, fn)` for each event type
;('focusin focusout focus blur load resize scroll unload click dblclick '+
'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
'change select keydown keypress keyup error').split(' ').forEach(function(event) {
$.fn[event] = function(callback) {
return (0 in arguments) ?
this.bind(event, callback) :
this.trigger(event)
}
})
$.Event = function(type, props) {
if (!isString(type)) props = type, type = props.type
var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])
event.initEvent(type, bubbles, true)
return compatible(event)
}
})(Zepto)
;(function($){
var jsonpID = +new Date(),
document = window.document,
key,
name,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
scriptTypeRE = /^(?:text|application)\/javascript/i,
xmlTypeRE = /^(?:text|application)\/xml/i,
jsonType = 'application/json',
htmlType = 'text/html',
blankRE = /^\s*$/,
originAnchor = document.createElement('a')
originAnchor.href = window.location.href
// trigger a custom event and return false if it was cancelled
function triggerAndReturn(context, eventName, data) {
var event = $.Event(eventName)
$(context).trigger(event, data)
return !event.isDefaultPrevented()
}
// trigger an Ajax "global" event
function triggerGlobal(settings, context, eventName, data) {
if (settings.global) return triggerAndReturn(context || document, eventName, data)
}
// Number of active Ajax requests
$.active = 0
function ajaxStart(settings) {
if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
}
function ajaxStop(settings) {
if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
}
// triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
function ajaxBeforeSend(xhr, settings) {
var context = settings.context
if (settings.beforeSend.call(context, xhr, settings) === false ||
triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
return false
triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
}
function ajaxSuccess(data, xhr, settings, deferred) {
var context = settings.context, status = 'success'
settings.success.call(context, data, status, xhr)
if (deferred) deferred.resolveWith(context, [data, status, xhr])
triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
ajaxComplete(status, xhr, settings)
}
// type: "timeout", "error", "abort", "parsererror"
function ajaxError(error, type, xhr, settings, deferred) {
var context = settings.context
settings.error.call(context, xhr, type, error)
if (deferred) deferred.rejectWith(context, [xhr, type, error])
triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])
ajaxComplete(type, xhr, settings)
}
// status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
function ajaxComplete(status, xhr, settings) {
var context = settings.context
settings.complete.call(context, xhr, status)
triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
ajaxStop(settings)
}
function ajaxDataFilter(data, type, settings) {
if (settings.dataFilter == empty) return data
var context = settings.context
return settings.dataFilter.call(context, data, type)
}
// Empty function, used as default callback
function empty() {}
$.ajaxJSONP = function(options, deferred){
if (!('type' in options)) return $.ajax(options)
var _callbackName = options.jsonpCallback,
callbackName = ($.isFunction(_callbackName) ?
_callbackName() : _callbackName) || ('Zepto' + (jsonpID++)),
script = document.createElement('script'),
originalCallback = window[callbackName],
responseData,
abort = function(errorType) {
$(script).triggerHandler('error', errorType || 'abort')
},
xhr = { abort: abort }, abortTimeout
if (deferred) deferred.promise(xhr)
$(script).on('load error', function(e, errorType){
clearTimeout(abortTimeout)
$(script).off().remove()
if (e.type == 'error' || !responseData) {
ajaxError(null, errorType || 'error', xhr, options, deferred)
} else {
ajaxSuccess(responseData[0], xhr, options, deferred)
}
window[callbackName] = originalCallback
if (responseData && $.isFunction(originalCallback))
originalCallback(responseData[0])
originalCallback = responseData = undefined
})
if (ajaxBeforeSend(xhr, options) === false) {
abort('abort')
return xhr
}
window[callbackName] = function(){
responseData = arguments
}
script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName)
document.head.appendChild(script)
if (options.timeout > 0) abortTimeout = setTimeout(function(){
abort('timeout')
}, options.timeout)
return xhr
}
$.ajaxSettings = {
// Default type of request
type: 'GET',
// Callback that is executed before request
beforeSend: empty,
// Callback that is executed if the request succeeds
success: empty,
// Callback that is executed the the server drops error
error: empty,
// Callback that is executed on request complete (both: error and success)
complete: empty,
// The context for the callbacks
context: null,
// Whether to trigger "global" Ajax events
global: true,
// Transport
xhr: function () {
return new window.XMLHttpRequest()
},
// MIME types mapping
// IIS returns Javascript as "application/x-javascript"
accepts: {
script: 'text/javascript, application/javascript, application/x-javascript',
json: jsonType,
xml: 'application/xml, text/xml',
html: htmlType,
text: 'text/plain'
},
// Whether the request is to another domain
crossDomain: false,
// Default timeout
timeout: 0,
// Whether data should be serialized to string
processData: true,
// Whether the browser should be allowed to cache GET responses
cache: true,
//Used to handle the raw response data of XMLHttpRequest.
//This is a pre-filtering function to sanitize the response.
//The sanitized response should be returned
dataFilter: empty
}
function mimeToDataType(mime) {
if (mime) mime = mime.split(';', 2)[0]
return mime && ( mime == htmlType ? 'html' :
mime == jsonType ? 'json' :
scriptTypeRE.test(mime) ? 'script' :
xmlTypeRE.test(mime) && 'xml' ) || 'text'
}
function appendQuery(url, query) {
if (query == '') return url
return (url + '&' + query).replace(/[&?]{1,2}/, '?')
}
// serialize payload and append it to the URL for GET requests
function serializeData(options) {
if (options.processData && options.data && $.type(options.data) != "string")
options.data = $.param(options.data, options.traditional)
if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType))
options.url = appendQuery(options.url, options.data), options.data = undefined
}
$.ajax = function(options){
var settings = $.extend({}, options || {}),
deferred = $.Deferred && $.Deferred(),
urlAnchor, hashIndex
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
ajaxStart(settings)
if (!settings.crossDomain) {
urlAnchor = document.createElement('a')
urlAnchor.href = settings.url
// cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
urlAnchor.href = urlAnchor.href
settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)
}
if (!settings.url) settings.url = window.location.toString()
if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex)
serializeData(settings)
var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url)
if (hasPlaceholder) dataType = 'jsonp'
if (settings.cache === false || (
(!options || options.cache !== true) &&
('script' == dataType || 'jsonp' == dataType)
))
settings.url = appendQuery(settings.url, '_=' + Date.now())
if ('jsonp' == dataType) {
if (!hasPlaceholder)
settings.url = appendQuery(settings.url,
settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?')
return $.ajaxJSONP(settings, deferred)
}
var mime = settings.accepts[dataType],
headers = { },
setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] },
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
xhr = settings.xhr(),
nativeSetHeader = xhr.setRequestHeader,
abortTimeout
if (deferred) deferred.promise(xhr)
if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')
setHeader('Accept', mime || '*/*')
if (mime = settings.mimeType || mime) {
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
xhr.overrideMimeType && xhr.overrideMimeType(mime)
}
if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')
if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])
xhr.setRequestHeader = setHeader
xhr.onreadystatechange = function(){
if (xhr.readyState == 4) {
xhr.onreadystatechange = empty
clearTimeout(abortTimeout)
var result, error = false
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))
if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob')
result = xhr.response
else {
result = xhr.responseText
try {
// http://perfectionkills.com/global-eval-what-are-the-options/
// sanitize response accordingly if data filter callback provided
result = ajaxDataFilter(result, dataType, settings)
if (dataType == 'script') (1,eval)(result)
else if (dataType == 'xml') result = xhr.responseXML
else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
} catch (e) { error = e }
if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred)
}
ajaxSuccess(result, xhr, settings, deferred)
} else {
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)
}
}
}
if (ajaxBeforeSend(xhr, settings) === false) {
xhr.abort()
ajaxError(null, 'abort', xhr, settings, deferred)
return xhr
}
var async = 'async' in settings ? settings.async : true
xhr.open(settings.type, settings.url, async, settings.username, settings.password)
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]
for (name in headers) nativeSetHeader.apply(xhr, headers[name])
if (settings.timeout > 0) abortTimeout = setTimeout(function(){
xhr.onreadystatechange = empty
xhr.abort()
ajaxError(null, 'timeout', xhr, settings, deferred)
}, settings.timeout)
// avoid sending empty string (#319)
xhr.send(settings.data ? settings.data : null)
return xhr
}
// handle optional data/success arguments
function parseArguments(url, data, success, dataType) {
if ($.isFunction(data)) dataType = success, success = data, data = undefined
if (!$.isFunction(success)) dataType = success, success = undefined
return {
url: url
, data: data
, success: success
, dataType: dataType
}
}
$.get = function(/* url, data, success, dataType */){
return $.ajax(parseArguments.apply(null, arguments))
}
$.post = function(/* url, data, success, dataType */){
var options = parseArguments.apply(null, arguments)
options.type = 'POST'
return $.ajax(options)
}
$.getJSON = function(/* url, data, success */){
var options = parseArguments.apply(null, arguments)
options.dataType = 'json'
return $.ajax(options)
}
$.fn.load = function(url, data, success){
if (!this.length) return this
var self = this, parts = url.split(/\s/), selector,
options = parseArguments(url, data, success),
callback = options.success
if (parts.length > 1) options.url = parts[0], selector = parts[1]
options.success = function(response){
self.html(selector ?
$('<div>').html(response.replace(rscript, "")).find(selector)
: response)
callback && callback.apply(self, arguments)
}
$.ajax(options)
return this
}
var escape = encodeURIComponent
function serialize(params, obj, traditional, scope){
var type, array = $.isArray(obj), hash = $.isPlainObject(obj)
$.each(obj, function(key, value) {
type = $.type(value)
if (scope) key = traditional ? scope :
scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'
// handle data in serializeArray() format
if (!scope && array) params.add(value.name, value.value)
// recurse into nested objects
else if (type == "array" || (!traditional && type == "object"))
serialize(params, value, traditional, key)
else params.add(key, value)
})
}
$.param = function(obj, traditional){
var params = []
params.add = function(key, value) {
if ($.isFunction(value)) value = value()
if (value == null) value = ""
this.push(escape(key) + '=' + escape(value))
}
serialize(params, obj, traditional)
return params.join('&').replace(/%20/g, '+')
}
})(Zepto)
;(function($){
$.fn.serializeArray = function() {
var name, type, result = [],
add = function(value) {
if (value.forEach) return value.forEach(add)
result.push({ name: name, value: value })
}
if (this[0]) $.each(this[0].elements, function(_, field){
type = field.type, name = field.name
if (name && field.nodeName.toLowerCase() != 'fieldset' &&
!field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' &&
((type != 'radio' && type != 'checkbox') || field.checked))
add($(field).val())
})
return result
}
$.fn.serialize = function(){
var result = []
this.serializeArray().forEach(function(elm){
result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value))
})
return result.join('&')
}
$.fn.submit = function(callback) {
if (0 in arguments) this.bind('submit', callback)
else if (this.length) {
var event = $.Event('submit')
this.eq(0).trigger(event)
if (!event.isDefaultPrevented()) this.get(0).submit()
}
return this
}
})(Zepto)
;(function(){
// getComputedStyle shouldn't freak out when called
// without a valid element as argument
try {
getComputedStyle(undefined)
} catch(e) {
var nativeGetComputedStyle = getComputedStyle
window.getComputedStyle = function(element, pseudoElement){
try {
return nativeGetComputedStyle(element, pseudoElement)
} catch(e) {
return null
}
}
}
})()
return Zepto
}))
if (!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength,padString) {
targetLength = targetLength>>0; //floor if number or convert non-number to 0;
padString = String((typeof padString !== 'undefined' ? padString : ' '));
if (this.length > targetLength) {
return String(this);
}
else {
targetLength = targetLength-this.length;
if (targetLength > padString.length) {
padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed
}
return padString.slice(0,targetLength) + String(this);
}
};
}
\ No newline at end of file
/* eslint-disable */
/**
* @note 转动
* @author
* @date 2016-09-20
* @des
*/
import 'render/libs/zepto.fn.extend';
(function($) {
var jQuery = Zepto;
var supportedCSS,
styles = document.getElementsByTagName('head')[0].style,
toCheck = 'transformProperty WebkitTransform OTransform msTransform MozTransform'.split(
' '
);
for (var a = 0; a < toCheck.length; a++)
if (styles[toCheck[a]] !== undefined) supportedCSS = toCheck[a];
// Bad eval to preven google closure to remove it from code o_O
// After compresion replace it back to var IE = 'v' == '\v'
var IE = eval('"v"=="\v"');
jQuery.fn.extend({
rotate: function(parameters) {
console.log('yyyyyyy');
if (this.length === 0 || typeof parameters == 'undefined') return;
if (typeof parameters == 'number')
parameters = {
angle: parameters
};
var returned = [];
for (var i = 0, i0 = this.length; i < i0; i++) {
var element = this.get(i);
if (!element.Wilq32 || !element.Wilq32.PhotoEffect) {
var paramClone = $.extend(true, {}, parameters);
var newRotObject = new Wilq32.PhotoEffect(element, paramClone)
._rootObj;
returned.push($(newRotObject));
} else {
element.Wilq32.PhotoEffect._handleRotation(parameters);
}
}
return returned;
},
getRotateAngle: function() {
var ret = [];
for (var i = 0, i0 = this.length; i < i0; i++) {
var element = this.get(i);
if (element.Wilq32 && element.Wilq32.PhotoEffect) {
ret[i] = element.Wilq32.PhotoEffect._angle;
}
}
return ret;
},
stopRotate: function() {
for (var i = 0, i0 = this.length; i < i0; i++) {
var element = this.get(i);
if (element.Wilq32 && element.Wilq32.PhotoEffect) {
clearTimeout(element.Wilq32.PhotoEffect._timer);
}
}
}
});
// Library agnostic interface
var Wilq32
Wilq32 = window.Wilq32 || {};
Wilq32.PhotoEffect = (function() {
if (supportedCSS) {
return function(img, parameters) {
img.Wilq32 = {
PhotoEffect: this
};
this._img = this._rootObj = this._eventObj = img;
this._handleRotation(parameters);
};
} else {
return function(img, parameters) {
// Make sure that class and id are also copied - just in case you would like to refeer to an newly created object
this._img = img;
this._rootObj = document.createElement('span');
this._rootObj.style.display = 'inline-block';
this._rootObj.Wilq32 = {
PhotoEffect: this
};
img.parentNode.insertBefore(this._rootObj, img);
if (img.complete) {
this._Loader(parameters);
} else {
var self = this;
// TODO: Remove jQuery dependency
jQuery(this._img).bind('load', function() {
self._Loader(parameters);
});
}
};
}
})();
Wilq32.PhotoEffect.prototype = {
_setupParameters: function(parameters) {
this._parameters = this._parameters || {};
if (typeof this._angle !== 'number') this._angle = 0;
if (typeof parameters.angle === 'number') this._angle = parameters.angle;
this._parameters.animateTo =
typeof parameters.animateTo === 'number' ?
parameters.animateTo :
this._angle;
this._parameters.step = parameters.step || this._parameters.step || null;
this._parameters.easing =
parameters.easing ||
this._parameters.easing ||
function(x, t, b, c, d) {
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
};
this._parameters.duration =
parameters.duration || this._parameters.duration || 1000;
this._parameters.callback =
parameters.callback || this._parameters.callback || function() {};
if (parameters.bind && parameters.bind != this._parameters.bind)
this._BindEvents(parameters.bind);
},
_handleRotation: function(parameters) {
this._setupParameters(parameters);
if (this._angle == this._parameters.animateTo) {
this._rotate(this._angle);
} else {
this._animateStart();
}
},
_BindEvents: function(events) {
if (events && this._eventObj) {
// Unbinding previous Events
if (this._parameters.bind) {
var oldEvents = this._parameters.bind;
for (var a in oldEvents)
if (oldEvents.hasOwnProperty(a))
// TODO: Remove jQuery dependency
jQuery(this._eventObj).unbind(a, oldEvents[a]);
}
this._parameters.bind = events;
for (var a in events)
if (events.hasOwnProperty(a))
// TODO: Remove jQuery dependency
jQuery(this._eventObj).bind(a, events[a]);
}
},
_Loader: (function() {
if (IE)
return function(parameters) {
var width = this._img.width;
var height = this._img.height;
this._img.parentNode.removeChild(this._img);
this._vimage = this.createVMLNode('image');
this._vimage.src = this._img.src;
this._vimage.style.height = height + 'px';
this._vimage.style.width = width + 'px';
this._vimage.style.position = 'absolute'; // FIXES IE PROBLEM - its only rendered if its on absolute position!
this._vimage.style.top = '0px';
this._vimage.style.left = '0px';
/* Group minifying a small 1px precision problem when rotating object */
this._container = this.createVMLNode('group');
this._container.style.width = width;
this._container.style.height = height;
this._container.style.position = 'absolute';
this._container.setAttribute(
'coordsize',
width - 1 + ',' + (height - 1)
); // This -1, -1 trying to fix ugly problem with small displacement on IE
this._container.appendChild(this._vimage);
this._rootObj.appendChild(this._container);
this._rootObj.style.position = 'relative'; // FIXES IE PROBLEM
this._rootObj.style.width = width + 'px';
this._rootObj.style.height = height + 'px';
this._rootObj.setAttribute('id', this._img.getAttribute('id'));
this._rootObj.className = this._img.className;
this._eventObj = this._rootObj;
this._handleRotation(parameters);
};
else
return function(parameters) {
this._rootObj.setAttribute('id', this._img.getAttribute('id'));
this._rootObj.className = this._img.className;
this._width = this._img.width;
this._height = this._img.height;
this._widthHalf = this._width / 2; // used for optimisation
this._heightHalf = this._height / 2; // used for optimisation
var _widthMax = Math.sqrt(
this._height * this._height + this._width * this._width
);
this._widthAdd = _widthMax - this._width;
this._heightAdd = _widthMax - this._height; // widthMax because maxWidth=maxHeight
this._widthAddHalf = this._widthAdd / 2; // used for optimisation
this._heightAddHalf = this._heightAdd / 2; // used for optimisation
this._img.parentNode.removeChild(this._img);
this._aspectW =
(parseInt(this._img.style.width, 10) || this._width) /
this._img.width;
this._aspectH =
(parseInt(this._img.style.height, 10) || this._height) /
this._img.height;
this._canvas = document.createElement('canvas');
this._canvas.setAttribute('width', this._width);
this._canvas.style.position = 'relative';
this._canvas.style.left = -this._widthAddHalf + 'px';
this._canvas.style.top = -this._heightAddHalf + 'px';
this._canvas.Wilq32 = this._rootObj.Wilq32;
this._rootObj.appendChild(this._canvas);
this._rootObj.style.width = this._width + 'px';
this._rootObj.style.height = this._height + 'px';
this._eventObj = this._canvas;
this._cnv = this._canvas.getContext('2d');
this._handleRotation(parameters);
};
})(),
_animateStart: function() {
if (this._timer) {
clearTimeout(this._timer);
}
this._animateStartTime = +new Date();
this._animateStartAngle = this._angle;
this._animate();
},
_animate: function() {
var actualTime = +new Date();
var checkEnd =
actualTime - this._animateStartTime > this._parameters.duration;
// TODO: Bug for animatedGif for static rotation ? (to test)
if (checkEnd && !this._parameters.animatedGif) {
clearTimeout(this._timer);
} else {
if (this._canvas || this._vimage || this._img) {
var angle = this._parameters.easing(
0,
actualTime - this._animateStartTime,
this._animateStartAngle,
this._parameters.animateTo - this._animateStartAngle,
this._parameters.duration
);
this._rotate(~~(angle * 10) / 10);
}
if (this._parameters.step) {
this._parameters.step(this._angle);
}
var self = this;
this._timer = setTimeout(function() {
self._animate.call(self);
}, 10);
}
// To fix Bug that prevents using recursive function in callback I moved this function to back
if (this._parameters.callback && checkEnd) {
this._angle = this._parameters.animateTo;
this._rotate(this._angle);
this._parameters.callback.call(this._rootObj);
}
},
_rotate: (function() {
var rad = Math.PI / 180;
if (IE)
return function(angle) {
this._angle = angle;
this._container.style.rotation = (angle % 360) + 'deg';
};
else if (supportedCSS)
return function(angle) {
this._angle = angle;
this._img.style[supportedCSS] =
'rotate3d(0,0,1,' + (angle % 360) + 'deg)';
};
else
return function(angle) {
this._angle = angle;
angle = (angle % 360) * rad;
// clear canvas
this._canvas.width = this._width + this._widthAdd;
this._canvas.height = this._height + this._heightAdd;
// REMEMBER: all drawings are read from backwards.. so first function is translate, then rotate, then translate, translate..
this._cnv.translate(this._widthAddHalf, this._heightAddHalf); // at least center image on screen
this._cnv.translate(this._widthHalf, this._heightHalf); // we move image back to its orginal
this._cnv.rotate(angle); // rotate image
this._cnv.translate(-this._widthHalf, -this._heightHalf); // move image to its center, so we can rotate around its center
this._cnv.scale(this._aspectW, this._aspectH); // SCALE - if needed ;)
this._cnv.drawImage(this._img, 0, 0); // First - we draw image
};
})()
};
if (IE) {
Wilq32.PhotoEffect.prototype.createVMLNode = (function() {
document
.createStyleSheet()
.addRule('.rvml', 'behavior:url(#default#VML)');
try {
!document.namespaces.rvml &&
document.namespaces.add('rvml', 'urn:schemas-microsoft-com:vml');
return function(tagName) {
return document.createElement('<rvml:' + tagName + ' class="rvml">');
};
} catch (e) {
return function(tagName) {
return document.createElement(
'<' +
tagName +
' xmlns="urn:schemas-microsoft.com:vml" class="rvml">'
);
};
}
})();
}
})(Zepto);
\ No newline at end of file
/*
* @Author: 周成
* @Date: 2018-03-22 19:54:44
* @Last Modified by: 周成
* @Last Modified time: 2018-04-27 12:14:06
*/
@import "./global.less";
@import "./reset.rem640.less";
@import "./util.less";
@import "./mixin.less";
/*
* @Author: 周成
* @Date: 2018-03-22 19:59:22
* @Last Modified by: 周成
* @Last Modified time: 2018-04-27 10:32:07
*/
/*
* 全局变量
*/
\ No newline at end of file
.clearfix() {
*zoom: 1;
&:before,
&:after {
display: table;
content: '';
}
&:after {
clear: both;
}
}
.hidden() {
display: none !important;
visibility: hidden;
}
.line0() {
overflow: hidden;
white-space: nowrap;
}
.line1() {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.line2() {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.line3() {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.linex(@num) {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: @num;
}
.border-radius(@radius: 5px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
.background-size(@size: 100% auto) {
-webkit-background-size: @size;
background-size: @size;
}
.box-sizing(@type: border-box) {
-webkit-box-sizing: @type;
-moz-box-sizing: @type;
-ms-box-sizing: @type;
box-sizing: @type;
}
.text-shadow(@shadow: 0 1px 3px rgba(0, 0, 0, 0.25)) {
text-shadow: @shadow;
}
.box-shadow(@shadow: 1px 1px 2px rgba(0, 0, 0, 0.25)) {
-webkit-box-shadow: @shadow;
-moz-box-shadow: @shadow;
box-shadow: @shadow;
}
.filter(@filter: grayscale(100%)) {
-webkit-filter: @filter;
-moz-filter: @filter;
-ms-filter: @filter;
-o-filter: @filter;
filter: @filter;
}
.transition(@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
transition: @transition;
}
.rotate(@rotation) {
-webkit-transform: rotate(@rotation);
-moz-transform: rotate(@rotation);
-o-transform: rotate(@rotation);
transform: rotate(@rotation);
}
.scale(@factor) {
-webkit-transform: scale(@factor);
-moz-transform: scale(@factor);
-ms-transform: scale(@factor);
-o-transform: scale(@factor);
transform: scale(@factor);
}
.skew(@deg, @deg2) {
-webkit-transform: skew(@deg, @deg2);
-moz-transform: skew(@deg, @deg2);
-ms-transform: skew(@deg, @deg2);
-o-transform: skew(@deg, @deg2);
transform: skew(@deg, @deg2);
}
.transition(@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
transition: @transition;
}
.translate(@x, @y: 0) {
-webkit-transform: translate(@x, @y);
-moz-transform: translate(@x, @y);
-ms-transform: translate(@x, @y);
-o-transform: translate(@x, @y);
transform: translate(@x, @y);
}
.translate3d(@x, @y: 0, @z: 0) {
-webkit-transform: translate3d(@x, @y, @z);
-moz-transform: translate3d(@x, @y, @z);
-ms-transform: translate3d(@x, @y, @z);
-o-transform: translate3d(@x, @y, @z);
transform: translate3d(@x, @y, @z);
}
.perspective(@value: 1000) {
-webkit-perspective: @value;
-moz-perspective: @value;
-ms-perspective: @value;
perspective: @value;
}
.placeholder(@color: #ddd) {
:-moz-placeholder {
color: @color;
}
::-webkit-input-placeholder {
color: @color;
}
}
.flexbox() {
/* flex container */
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex(@values: 0 1 auto) {
/* flex item */
/* flex属性是flex-grow, flex-shrink 和 flex-basis的简写,默认值为0 1 auto */
-webkit-box-flex: @values;
-moz-box-flex: @values;
-webkit-flex: @values;
-ms-flex: @values;
flex: @values;
}
// user select 不允许用户选中页面中文字
.user-select-none() {
-webkit-user-select: none;
/* Chrome all / Safari all */
-ms-user-select: none;
/* IE 10+ */
user-select: none;
}
.rem(@name,@font-size) {
@{name}: @font-size / 46.875 * 1rem;
}
.px(@name,@font-size) {
@{name}: (@font-size / 2) * 1px;
[data-dpr='2'] & {
@{name}: @font-size*1px;
}
[data-dpr='3'] & {
@{name}: (@font-size / 2 * 3) * 1px;
}
}
.font-size(@font-size) {
.px(font-size,@font-size);
}
.border-width(@font-size) {
border-width: (@font-size) * 1px;
[data-dpr='2'] & {
border-width: @font-size / 46.875 * 1rem;
}
[data-dpr='3'] & {
border-width: @font-size / 46.875 * 1rem;
}
}
//数字 字体加粗 用Helvetica Neue字体
.font-weight() {
font-family: 'Helvetica Neue', HeitiJ-Light, Helvetica, STHeiTi, sans-serif;
-webkit-font-smoothing: antialiased;
font-weight: bold;
}
.sticky() {
position: fixed !important; //兼容旧版本
position: -webkit-sticky !important;
position: -moz-sticky !important;
position: -ms-sticky !important;
position: sticky !important;
}
.bg(@img) {
background-image: url('@{img}');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.ps(@top,@left) {
position: absolute;
top: @top;
left: @left;
}
.pl(@top,@left) {
position: absolute;
top: @top;
left: @left;
}
.pr(@top,@right) {
position: absolute;
top: @top;
right: @right;
}
.wd(@w,@h) {
width: @w;
height: @h;
}
/*
* @Author: 周成
* @Date: 2018-03-22 19:57:53
* @Last Modified by: Zhang Min
* @Last Modified time: 2018-05-14 19:34:03
*/
/*
* 重置默认样式
*/
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
outline: none;
}
html {
font-family: Helvetica, 'Helvetica Neue', 'Roboto', 'Heiti SC', 'Noto', 'Hiragino Sans GB', 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent; /* For some Androids */
-webkit-font-smoothing: antialiased;
}
body {
font-size: 0.0512rem;
line-height: 1;
overflow-x: hidden;
width: 100%;
max-width: 3.2rem;
margin: 0 auto;
color: #333;
background-color: #f0f0f0;
-webkit-overflow-scrolling: touch;
-webkit-touch-callout: none;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
a {
text-decoration: none;
color: inherit;
}
a:active {
outline: 0;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: normal;
}
img {
max-width: 100%;
vertical-align: middle;
border: 0;
}
input,
textarea,
button {
font-family: Helvetica, 'Helvetica Neue', 'Roboto', 'Heiti SC', 'Noto', 'Hiragino Sans GB', 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
font-size: 0.1024rem;
margin: 0;
padding: 0;
border: 0;
}
textarea {
resize: none;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
td,
th {
padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
form,
blockquote {
margin: 0;
}
ul,
ol,
li,
dl,
dd {
margin: 0;
padding: 0;
}
ul,
ol,
li {
list-style: none;
}
input {
width: 100%;
height: 0.290133rem;
padding: 0 0.085333rem;
text-align: left;
border: 0.004267rem solid #ddd;
-webkit-border-radius: 0.034133rem;
border-radius: 0.034133rem;
// -webkit-appearance: none;
}
.placeholder {
font-family: Helvetica, 'Helvetica Neue', 'Roboto', 'Heiti SC', 'Noto', 'Hiragino Sans GB', 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
text-align: left;
color: #999;
}
input:-moz-placeholder,
textarea:-moz-placeholder {
.placeholder();
}
input::-moz-placeholder,
textarea::-moz-placeholder {
opacity: 1;
.placeholder();
}
input:-ms-input-placeholder,
textarea::-ms-input-placeholder {
.placeholder();
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
.placeholder();
}
\ No newline at end of file
/*
* @Author: 周成
* @Date: 2018-03-22 19:57:16
* @Last Modified by: 周成
* @Last Modified time: 2018-03-22 19:57:41
*/
/*
* 工具类class
*/
.hidden {
display: none !important;
visibility: hidden !important;
}
.fl {
float: left;
}
.fr {
float: right;
}
\ No newline at end of file
import pp from 'render/libs/popup'
const Verify = {
verifyName($ele, isRequired) {
let name = $ele.val()
if (!name && Number(isRequired) === 1) {
pp.note('姓名不能为空', {
mask: false,
closeTime: 2000
})
return false
}
var nameReg = /^([\u4E00-\uFA29]){2,6}$/
if (!nameReg.test(name) && Number(isRequired) === 1) {
pp.note('姓名应为2-6位中文!', {
mask: false,
closeTime: 2000
})
return false
}
return true
},
verifyTel($ele, isRequired) {
let tel = $ele.val()
console.log('telephone', tel);
// 表单输入校验
if (!tel && Number(isRequired) === 1) {
pp.note('手机号不能为空', {
mask: false,
closeTime: 2000
})
return false
}
var myreg2 = /^1[3|4|5|7|8][0-9]\d{8}$/
if (!myreg2.test(tel) && Number(isRequired) === 1) {
pp.note('请输入有效的手机号码', {
mask: false,
closeTime: 2000
})
return false
}
return true
},
regCode(code) {
if (!code) {
return 1
}
var reg = /^\d{6}$/
if (reg.test(code)) {
return 0
}
return 2
},
verifyEmail($ele, isRequired) {
let email = $ele.val()
// 表单输入校验
if (!email && Number(isRequired) === 1) {
pp.note('邮箱不能为空', {
mask: false,
closeTime: 2000
})
return false
}
var emailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
if (!emailReg.test(email) && Number(isRequired) === 1) {
pp.note('请输入有效的邮箱', {
mask: false,
closeTime: 2000
})
return false
}
return true
},
verifyCard($ele, isRequired) {
let card = $ele.val()
// 表单输入校验
if (!card && Number(isRequired) === 1) {
pp.note('身份证不能为空', {
mask: false,
closeTime: 2000
})
return false
}
var cardReg = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$/
if (!cardReg.test(card) && Number(isRequired) === 1) {
pp.note('请输入有效的身份证号', {
mask: false,
closeTime: 2000
})
return false
}
return true
},
verifyNormal($ele, isRequired) {
let normal = $ele.val()
// 表单输入校验
if (!normal && Number(isRequired) === 1) {
pp.note('不能为空', {
mask: false,
closeTime: 2000
})
return false
}
return true
}
}
export default Verify
\ 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 to comment