130 129
      loadMonthTable: false,
131
130
      // 公司、部门、员工、列表
131
      companyTypesList: [],
132
      departmentTypesList: [],
133
      getStaffTypesList: [],
132 134
      monthlyTotal: 0,
133 135
      dailyTotal: 0,
134 136
      monthlyForm: {
@ -150,6 +152,24 @@ export default {
150 152
    }
151 153
  },
152 154
  methods: {
155
    getDailyOrgId(id) {
156
      this.dailyForm.orgId = id
157
    },
158
    getDailyDepId(id) {
159
      this.dailyForm.depId = id
160
    },
161
    getDailyStaffId(id) {
162
      this.dailyForm.userid = id
163
    },
164
    getMonthOrgId(id) {
165
      this.monthlyForm.orgId = id
166
    },
167
    getMonthDepId(id) {
168
      this.monthlyForm.depId = id
169
    },
170
    getMonthStaffId(id) {
171
      this.monthlyForm.userid = id
172
    },
153 173
    handleDailyInited () {
154 174
      // this.getDailyTable()
155 175
    },
@ -178,6 +198,68 @@ export default {
178 198
      this.monthlyForm.current = val
179 199
      this.getMonthTable()
180 200
    },
201
    // // 向服务器发送请求获取公司类型列表数据
202
    // async getCompanyTypesList () {
203
    //   const res = await commonApi.getCompanyTypesList()
204
    //   if (res.status === 200) {
205
    //     this.companyTypesList = res.data.data
206
    //   } else {
207
    //     this.$Message.danger('公司类型列表数据获取失败!')
208
    //   }
209
    // },
210
    // // 获取部门列表
211
    // async queryCycleChildOrg (id) {
212
    //   const res = await commonApi.queryCycleChildOrg(id)
213
    //   if (res.status === 200) {
214
    //     const data = []
215
    //     // 递归 实现tree组件所需部门数据结构
216
    //     this.nextDepartment(res.data, data)
217
    //     // 深拷贝data
218
    //     const data1 = JSON.parse(JSON.stringify(data))
219
    //     // 用部门id映射关系代替code与parentCode父子映射关系
220
    //     data.forEach(item => {
221
    //       // 删除pid为"-1"的的pid属性,否则tree渲染的时候没有根节点渲染不出来
222
    //       if (item.pid === '-1') {
223
    //         delete item.pid
224
    //       }
225
    //       item.id = item.orgId
226
    //       data1.some((item1) => {
227
    //         if (item.pid === item1.id) {
228
    //           item.pid = item1.orgId
229
    //         } else {
230
    //           return false
231
    //         }
232
    //       })
233
    //     })
234
    //     // eslint-disable-next-line no-return-assign
235
    //     this.departmentTypesList = data.filter(item => item.data = item.id)
236
    //   } else {
237
    //     this.$Message.danger('部门类型列表数据获取失败!')
238
    //   }
239
    // },
240
    // // 向服务器发送请求获取用户类型列表数据
241
    // async getStaffTypesList (id) {
242
    //   const res = await commonApi.getStaffTypesList(id)
243
    //   if (res.status === 200) {
244
    //     this.staffTypesList = res.data.data
245
    //   } else {
246
    //     this.$Message.danger('用户类型列表数据获取失败!')
247
    //   }
248
    // },
249
    // // 如果部门还有下级 递归
250
    // nextDepartment (data, arr) {
251
    //   if (data.length > 0) {
252
    //     data.forEach(item => {
253
    //       arr.push({
254
    //         orgId: item.id + '',
255
    //         id: item.code,
256
    //         label: item.name,
257
    //         pid: item.parentCode
258
    //       })
259
    //       this.nextDepartment(item.departments, arr)
260
    //     })
261
    //   }
262
    // },
181 263
    // 重置日报数据
182 264
    resetDailyData() {
183 265
      this.$nextTick(() => {

+ 11 - 5
security-protection-platform/src/modules/system/devicemana/components/modal/addDeviceModal.vue

@ -1,6 +1,6 @@
1 1
<template>
2 2
  <!-- 请假对话框 -->
3
  <t-modal :visibled.sync="visibled" :mask-closable="false" width="600px" height="500px">
3
  <t-modal :visibled.sync="visibled" :mask-closable="false" width="600px" height="560px">
4 4
    <template slot="header">
5 5
      <div class="device-modal-title">{{ isEdit?'设备编辑':'设备新增' }}</div>
6 6
    </template>
@ -21,9 +21,12 @@
21 21
          <t-option v-for="item in types" :value="item.id" :key="item.id">{{ item.name }}</t-option>
22 22
        </t-select>
23 23
      </t-form-item>
24
      <t-form-item label="视频地址:" prop="videoUrl">
25
        <t-input v-model="addDeviceModalForm.videoUrl" placeholder="请输入视频地址"></t-input>
26
      </t-form-item>
24 27
      <t-form-item label="图片上传:">
25 28
        <div style="display:flex;flex-direction:row">
26
          <t-upload ref="uploader" :format="['jpg','jpeg','png']" :show-uploaded="false" :before-upload="$_onUploadBeforeUpload" :action="action" :data="{pictureUrl:addDeviceModalForm.pictureUrl}" name="picture" multiple type="drag" style="width:180px;height:180px" @success="$_onUploadSuccess" @remove-file="$_onUploadRemoveFile" @error="$_onUploadError" @file-ext-error="$_onUploadFormatError" @file-exceeded-size="$_onUploadExceededSize">
29
          <t-upload ref="uploader" :format="['jpg','jpeg','png']" :show-uploaded="false" :before-upload="$_onUploadBeforeUpload" :action="action" :data="{pictureUrl:addDeviceModalForm.pictureUrl}" multiple type="drag" style="width:180px;height:180px" @success="$_onUploadSuccess" @remove-file="$_onUploadRemoveFile" @error="$_onUploadError" @file-ext-error="$_onUploadFormatError" @file-exceeded-size="$_onUploadExceededSize">
27 30
            <div style="width: 180px;height:180px;line-height: 180px">
28 31
              <t-icon icon="plus-outline" size="40"></t-icon>
29 32
            </div>
@ -46,6 +49,7 @@ const defaultAddDeviceModalForm = {
46 49
  deviceId: '', // 设备id
47 50
  deviceName: '', // 设备名称
48 51
  deviceTypeId: '', // 设备类型id
52
  videoUrl: '', // 视频地址
49 53
  pictureUrl: '' // 图片标识
50 54
}
51 55
export default {
@ -79,6 +83,9 @@ export default {
79 83
        deviceName: [
80 84
          { required: true, message: '设备名称不能为空', trigger: 'blur' }
81 85
        ],
86
        videoUrl: [
87
          { required: true, message: '视频地址不能为空', trigger: 'blur' }
88
        ],
82 89
        deviceTypeId: [
83 90
          { required: true, message: '设备类型不能为空' }
84 91
        ]
@ -187,10 +194,9 @@ export default {
187 194
      console.log(file)
188 195
    },
189 196
    $_onUploadSuccess (res, file) {
190
      this.imgUrl = res.data.data.toolPictureUrl
191
      this.addDeviceModalForm.pictureUrl = res.data.data.pictureUrl
197
      this.imgUrl = res.data.toolPictureUrl
198
      this.addDeviceModalForm.pictureUrl = res.data.pictureUrl
192 199
      // 因为演示用的上传服务器返回数据格式的原因,这里模拟添加 url
193
      console.log(file)
194 200
      this.uploadList.push(file)
195 201
    },
196 202
    $_onUploadRemoveFile () { },

+ 12 - 2
security-protection-platform/src/modules/system/monitor/HomePageSettings/ShiftCameraDialog.vue

@ -30,7 +30,7 @@
30 30
          <div>
31 31
            <img
32 32
              :class="item.resourceToolId == form.resourceToolId ? 'hover' : ''"
33
              :src="item.pictureUrl"
33
              :src="item.imageUrl"
34 34
              style="height: 120px; width: 158px"
35 35
              alt=""
36 36
            />
@ -129,10 +129,20 @@ export default {
129 129
        nameAsLike: this.searchValue // 设备名称(模糊匹配)
130 130
      }
131 131
      sysapi.getResourceTool(params).then((resp) => {
132
        this.cameraList = resp.data.data.data || []
132
        const res = resp.data.data.data || []
133
        let data = []
134
        res.forEach(item => data.push(item.pictureUrl))
135
        this.getListFileUrl(res, data)
133 136
        this.total = resp.data.data.total
134 137
      })
135 138
    },
139
    async getListFileUrl(res, data) {
140
      const resp = await sysapi.getListFileUrl(data)
141
      res.filter((item, index) => {
142
        item.imageUrl = resp.data.data[index]
143
      })
144
      this.cameraList = res
145
    },
136 146
    groupClick(item) {
137 147
      // 选中更换摄像头
138 148
      this.form.resourceToolName = item.resourceToolName

+ 157 - 51
security-protection-platform/src/modules/usermana/components/modal/addUser.vue

@ -1,59 +1,80 @@
1 1
<template>
2
  <t-modal :visibled.sync="isVisibled" :mask-closable="false">
2
  <t-modal :visibled.sync="isVisibled" :mask-closable="false" width="600px">
3 3
    <template slot="header">
4 4
      <div class="device-modal-title">{{ isEdit?'用户编辑':'新增用户' }}</div>
5 5
    </template>
6 6
    <t-form ref="addUserModal" :model="addUserModal" :rules="addUserModalRules" label-position="right">
7 7
      <t-form-item label="姓名:" prop="name">
8
        <t-input v-model="addUserModal.name" placeholder="请输入姓名"></t-input>
8
        <t-input v-model="addUserModal.name" style="width:300px" placeholder="请输入姓名"></t-input>
9 9
      </t-form-item>
10 10
      <t-form-item label="员工编号:" prop="code">
11
        <t-input v-model="addUserModal.code" placeholder="请输入员工编号"></t-input>
11
        <t-input v-model="addUserModal.code" placeholder="请输入员工编号" style="width:300px"></t-input>
12 12
      </t-form-item>
13 13
      <t-form-item label="公司:" prop="apartments">
14
        <t-select v-model="addUserModal.apartments" placeholder="请选择公司" clearable>
14
        <t-select v-model="addUserModal.apartments" width="300px" placeholder="请选择公司" clearable>
15 15
          <t-option v-for="(item,index) in companyList" :value="item.id" :key="index">{{ item.name }}</t-option>
16 16
        </t-select>
17 17
      </t-form-item>
18 18
      <t-form-item v-if="addUserModal.apartments!==''" label="部门:" prop="organizeCode">
19
        <t-select-tree v-model="addUserModal.organizeCode" :node-data="departmentTypesList" node-key="id"></t-select-tree>
19
        <t-select-tree v-model="addUserModal.organizeCode" :node-data="departmentTypesList" width="300px" node-value="data" node-key="data"></t-select-tree>
20 20
      </t-form-item>
21 21
      <t-form-item label="职务:" prop="mainJobPosition">
22
        <t-select v-model="addUserModal.mainJobPosition" placeholder="请选择职务" clearable>
22
        <t-select v-model="addUserModal.mainJobPosition" width="300px" placeholder="请选择职务" clearable>
23 23
          <t-option v-for="(item,index) in jobPoisitonList" :value="item.code" :key="index">{{ item.value }}</t-option>
24 24
        </t-select>
25 25
      </t-form-item>
26 26
      <t-form-item label="年龄:" prop="birthday">
27
        <t-date-picker v-model="addUserModal.birthday" placeholder="请输入年龄" @date-change="startPickerDateChange"></t-date-picker>
27
        <t-date-picker v-model="addUserModal.birthday" style="width:300px" placeholder="请输入年龄" @date-change="startPickerDateChange"></t-date-picker>
28 28
      </t-form-item>
29 29
      <t-form-item label="手机:" prop="mainWirelessCall">
30
        <t-input v-model="addUserModal.mainWirelessCall" placeholder="请输入11位手机号"></t-input>
30
        <t-input v-model="addUserModal.mainWirelessCall" style="width:300px" placeholder="请输入11位手机号"></t-input>
31 31
      </t-form-item>
32
      <t-form-item label="人脸图片:" prop="facePicture">
33
        <t-upload
34
          ref="uploader"
35
          :show-uploaded="true"
36
          :allowed-ext="['jpg','jpeg','png']"
37
          :max-size="2048"
38
          :before-upload="$_onUploadBeforeUpload"
39
          :data="{picture:'11d'}"
40
          multiple
41
          style="width:120px;height:160px;background-color:#FFFFFF;"
42
          type="drag"
43
          action="http://10.19.90.34:8018/sp/employeeManagement/uploadEmployeePicture"
44
          class="demo-upload-list"
45
        >
46
          <div class="picture-upload">
47
            <t-icon class="upload-icon" icon="plus-outline"></t-icon>
48
            <span style="color:rgba(0, 0, 0, 0.45)">上传照片</span>
49
          </div>
50
        </t-upload>
32
      <t-form-item label="人脸图片:" style="display:flex" prop="facePicture">
33
        <div style="display:flex">
34
          <t-upload
35
            ref="uploader"
36
            :show-uploaded="false"
37
            :allowed-ext="['jpg','jpeg','png']"
38
            :max-size="2048"
39
            :before-upload="$_onUploadBeforeUpload"
40
            multiple
41
            style="width:120px;height:160px;background-color:#FFFFFF;"
42
            type="drag"
43
            action="http://10.19.90.34:8018/sp/employeeManagement/uploadEmployeePicture"
44
            class="demo-upload-list"
45
            @success = "$_onUploadSuccess"
46
          >
47
            <div class="picture-upload">
48
              <t-icon class="upload-icon" icon="plus-outline"></t-icon>
49
              <span style="color:rgba(0, 0, 0, 0.45)">上传照片</span>
50
            </div>
51
          </t-upload>
52
          <img v-show="showPicture" :src="showPicture" class="upload-img"/>
53
          <!-- <div v-show="showPicture" class="upload-edit">
54
            修改 </div> -->
55
          <t-upload
56
            v-show="showPicture"
57
            ref="uploader"
58
            :show-uploaded="false"
59
            :allowed-ext="['jpg','jpeg','png']"
60
            :max-size="2048"
61
            :before-upload="$_onUploadBeforeUpload"
62
            multiple
63
            type="drag"
64
            action="http://10.19.90.34:8018/sp/employeeManagement/uploadEmployeePicture"
65
            class="upload-edit"
66
            @success = "$_onUploadSuccess"
67
          >
68
            <div>上传</div>
69
          </t-upload>
70
          <img v-show="showPicture" :src="showPicture" class="upload-edit-img"/>
71
        </div>
51 72
        <span style="color:rgba(0, 0, 0, 0.45);font-size:12px">照片格式:jpg、png或bmp文件,且不超过2M</span>
52 73
      </t-form-item>
53 74
    </t-form>
54 75
    <template slot="footer">
55 76
      <t-button @click="resetModalData">取消</t-button>
56
      <t-button v-if="isEdit" :loading="loadingSubmit" color="primary" @click="submitModalData">修改</t-button>
77
      <t-button v-if="isEdit" :loading="loadingSubmit" color="primary" @click="editModalData">修改</t-button>
57 78
      <t-button v-else color="primary" @click="submitModalData">提交</t-button>
58 79
    </template>
59 80
  </t-modal>
@ -61,6 +82,7 @@
61 82
62 83
<script>
63 84
import sysapi from '@/api/usermana'
85
import formatDateTime from '@/utils/formatDateTime.js'
64 86
export default {
65 87
  props: {
66 88
    visible: {
@ -71,20 +93,27 @@ export default {
71 93
    companyList: {
72 94
      type: Array,
73 95
      default: () => []
96
    },
97
    // 回显数据列表
98
    editUserModal: {
99
      type: Object,
100
      default: () => []
74 101
    }
75 102
  },
76 103
  data() {
77 104
    // 手机号验证
78
    // const VALIDATEPASSCHECK = (rule, value, callback) => {
79
    //   if (value === '') {
80
    //     callback(new Error('请输入11位手机号'))
81
    //   } else if (value.length > 0 & value.length !== 11) {
82
    //     callback(new Error('手机号格式不正确'))
83
    //   } else {
84
    //     callback()
85
    //   }
86
    // }
105
    const VALIDATEPASSCHECK = (rule, value, callback) => {
106
      if (value === '') {
107
        callback(new Error('请输入11位手机号'))
108
      } else if (value.length > 0 & value.length !== 11) {
109
        callback(new Error('手机号需为11位'))
110
      } else {
111
        callback()
112
      }
113
    }
87 114
    return {
115
      // 按钮是否加载中
116
      loadingSubmit: false,
88 117
      // 是否为编辑状态
89 118
      isEdit: false,
90 119
      // 部门列表
@ -92,6 +121,8 @@ export default {
92 121
      // 职务列表
93 122
      uploadList: [],
94 123
      jobPoisitonList: [],
124
      // 回显图片
125
      showPicture: '',
95 126
      // 新增用户表单
96 127
      addUserModal: {
97 128
        name: '',
@ -121,10 +152,10 @@ export default {
121 152
          { required: true, message: '职务不能为空', trigger: 'change' }
122 153
        ],
123 154
        birthday: [
124
          { required: true, message: '年龄不能为空', trigger: 'blur' }
155
          { required: true, message: '年龄不能为空' }
125 156
        ],
126 157
        mainWirelessCall: [
127
          { required: true, message: '请输入11位手机号', trigger: 'blur' }
158
          { validator: VALIDATEPASSCHECK, required: true, trigger: 'blur' }
128 159
        ],
129 160
        facePicture: [
130 161
          { required: true, message: '图片不能为空', trigger: 'blur' }
@ -149,6 +180,9 @@ export default {
149 180
      this.addUserModal.organizeCode = ''
150 181
      // 查询部门列表
151 182
      this.queryCycleChildOrg(val)
183
    },
184
    editUserModal () {
185
      this.getCompanyList()
152 186
    }
153 187
  },
154 188
  mounted() {
@ -166,14 +200,14 @@ export default {
166 200
            organizeCode: this.addUserModal.organizeCode, // 部门CODE
167 201
            mainWirelessCall: this.addUserModal.mainWirelessCall, // 手机号码
168 202
            mainJobPosition: this.addUserModal.mainJobPosition, // 职务
169
            field1: this.addUserModal.facePicture, // 照片标识
203
            field1: this.addUserModal.field1, // 照片标识
170 204
            field4: this.addUserModal.apartments, // 公司ID
171
            birthday: Math.round(new Date() / 1000) // 生日(时间戳)
205
            birthday: this.addUserModal.birthday // 生日(时间戳)
172 206
          }
173
          sysapi.creteEmployee({params: obj}).then(res => {
174
            console.log(res)
207
          sysapi.creteEmployee(obj).then(res => {
175 208
            if (res.data.success === true) {
176
              this.$Message.success('新增成功')
209
              this.$Message.success('提交成功')
210
              this.$refs['addUserModal'].resetFields()
177 211
            } else {
178 212
              console.log(res.data.fail.message)
179 213
              this.$Message.success(res.data.fail.message)
@ -182,11 +216,56 @@ export default {
182 216
        }
183 217
      })
184 218
    },
219
    // 修改用户个人信息
220
    editModalData() {
221
      this.loadingSubmit = true
222
      let obj = {
223
        id: this.editUserModal.employeeId, // 主键ID
224
        name: this.addUserModal.name, // 员工姓名
225
        code: this.addUserModal.code, // 员工编号
226
        organizeCode: this.addUserModal.organizeCode, // 部门CODE
227
        mainWirelessCall: this.addUserModal.mainWirelessCall, // 手机号码
228
        mainJobPosition: this.addUserModal.mainJobPosition, // 职务
229
        field1: this.addUserModal.field1, // 照片标识
230
        field4: this.addUserModal.apartments, // 公司ID
231
        birthday: +new Date(this.addUserModal.birthday) // 生日(时间戳)
232
      }
233
      sysapi.editUserDetail(obj).then(res => {
234
        if (res.status === 200) {
235
          this.$Message.success('修改成功!')
236
          this.isVisibled = false
237
          this.resetModalData()
238
          this.$emit('getUserList')
239
        } else {
240
          this.$Message.danger('修改失败!')
241
        }
242
        this.loadingSubmit = false
243
      })
244
    },
185 245
    // 重置表单数据
186 246
    resetModalData () {
187 247
      this.$refs['addUserModal'].resetFields()
188 248
      this.imgUrl = ''
249
      this.isEdit = false
189 250
      this.isVisibled = false
251
      this.showPicture = ''
252
    },
253
    // 获得编辑回显数据
254
    getCompanyList() {
255
      this.$nextTick(() => {
256
        this.addUserModal = {
257
          'name': this.editUserModal.employeeName, // 员工姓名
258
          'code': this.editUserModal.employeeCode, // 员工编号
259
          'organizeCode': this.editUserModal.organizationCode, // 部门CODE
260
          'mainWirelessCall': this.editUserModal.mainWirelessCall, // 手机号码
261
          'mainJobPosition': this.editUserModal.employeePosition, // 职务
262
          'apartments': '', // 公司ID
263
          'birthday': formatDateTime(new Date(this.editUserModal.birthday - 0)) // 生日(时间戳)
264
        }
265
        this.addUserModal.apartments = parseInt(this.editUserModal.field4)
266
        this.showPicture = this.editUserModal.pictureUrl// 照片标识
267
        this.isEdit = true
268
      })
190 269
    },
191 270
    // 查询职务列表
192 271
    async getJobPositionList() {
@ -212,7 +291,7 @@ export default {
212 291
          if (item.pid === '-1') {
213 292
            delete item.pid
214 293
          }
215
          item.id = item.orgId
294
          // item.id = item.orgId
216 295
          data1.some((item1) => {
217 296
            if (item.pid === item1.id) {
218 297
              item.pid = item1.orgId
@ -223,6 +302,9 @@ export default {
223 302
        })
224 303
        // eslint-disable-next-line no-return-assign
225 304
        this.departmentTypesList = data.filter(item => item.data = item.id)
305
        this.$nextTick(() => {
306
          this.addUserModal.organizeCode = this.editUserModal.organizationCode
307
        })
226 308
      } else {
227 309
        this.$Message.danger('部门类型列表数据获取失败!')
228 310
      }
@ -237,7 +319,8 @@ export default {
237 319
            orgId: item.id + '',
238 320
            id: item.code,
239 321
            label: item.name,
240
            pid: item.parentCode
322
            pid: item.parentCode,
323
            data: item.code
241 324
          })
242 325
          this.nextDepartment(item.departments, arr)
243 326
        })
@ -257,11 +340,9 @@ export default {
257 340
      console.log(file)
258 341
    },
259 342
    $_onUploadSuccess (res, file) {
260
      this.imgUrl = res.data.data.toolPictureUrl
261
      this.addDeviceModalForm.pictureUrl = res.data.data.pictureUrl
262 343
      // 因为演示用的上传服务器返回数据格式的原因,这里模拟添加 url
263
      console.log(file)
264
      this.uploadList.push(file)
344
      this.showPicture = res.data.headerPictureUrl
345
      this.addUserModal.field1 = res.data.pictureUrl
265 346
    },
266 347
    $_onUploadRemoveFile () { },
267 348
    $_onUploadExceededSize () { },
@ -305,8 +386,33 @@ export default {
305 386
<style lang="scss" scoped>
306 387
.demo-upload-list{
307 388
  .upload--drag{
308
  background-color:#FFFFFF
389
  background-color:#FFFFFF;
390
  align-items: center;
391
  justify-content: center;
392
  display: flex
393
}
394
}
395
.upload-img{
396
  width:120px;
397
  height:160px;
398
  margin-left:12px
399
}
400
.upload-edit{
401
  width:120px;
402
  height:160px;
403
  margin-left:12px;
404
  background-color:rgba(0, 0, 0, 0.5);
405
  justify-content: center;
406
  align-items: center;
407
  color: white;
408
  display: flex;
409
  cursor: pointer;
410
  z-index: 2;
309 411
}
412
.upload-edit-img{
413
  margin-left:-120px;
414
  width:120px;
415
  height:160px;
310 416
}
311 417
.picture-upload{
312 418
  display:flex;

+ 19 - 5
security-protection-platform/src/modules/usermana/index.vue

@ -52,7 +52,7 @@
52 52
          </t-table-column>
53 53
          <t-table-column label="操作">
54 54
            <template v-slot="{row}">
55
              <a href="javascript:;" style="color:#0089D4;" @click="editDeviceData(row.resourceToolId)">编辑</a>
55
              <a href="javascript:;" style="color:#0089D4;" @click="editDeviceData(row.id)">编辑</a>
56 56
              <a href="javascript:;" style="color:#0089D4;" @click="deleteUserData(row)">删除</a>
57 57
              <a v-if="row.field2!='5'" href="javascript:;" style="color:#0089D4;" @click="auditdata(row.id,row.companyName)">人脸审核</a>
58 58
            </template>
@ -64,7 +64,7 @@
64 64
        </t-pager>
65 65
      </div>
66 66
    </t-card>
67
    <add-user-modal :company-list="companyTypesList" :visible.sync="addDeviceModal"></add-user-modal>
67
    <add-user-modal :edit-user-modal="currentEditDevice" :company-list="companyTypesList" :visible.sync="addDeviceModal" @getUserList="getUserList"></add-user-modal>
68 68
    <auditModal :auditshow.sync="auditshow" :auditid="auditid" :company-name="companyName" @refeshUserList="getUserList"></auditModal>
69 69
  </div>
70 70
</template>
@ -112,7 +112,9 @@ export default {
112 112
      // 人脸审核选择id
113 113
      auditid: 0,
114 114
      // 人脸审核的公司名称
115
      companyName: ''
115
      companyName: '',
116
      // 判断页面是否是第一次渲染
117
      firstCreated: true
116 118
117 119
    }
118 120
  },
@ -137,6 +139,8 @@ export default {
137 139
  created () {
138 140
    // this.getDeviceData()
139 141
    this.getCompanyTypesList()
142
    // 默认选中能源部
143
    this.companyTypeId = 10086
140 144
  },
141 145
  methods: {
142 146
    // 获取用户列表数据
@ -211,6 +215,13 @@ export default {
211 215
        })
212 216
        // eslint-disable-next-line no-return-assign
213 217
        this.departmentTypesList = data.filter(item => item.data = item.id)
218
        // 进入页面默认选中ebc
219
        if (this.departmentTypeId === '' && this.firstCreated) {
220
          this.$nextTick(() => {
221
            this.departmentTypeId = '10087'
222
            this.firstCreated = false
223
          })
224
        }
214 225
      } else {
215 226
        this.$Message.danger('部门类型列表数据获取失败!')
216 227
      }
@ -249,6 +260,7 @@ export default {
249 260
    },
250 261
    // 删除数据
251 262
    deleteUserData (row) {
263
      console.log(row)
252 264
      this.$Confirm.confirm({
253 265
        title: '正在准备删除...',
254 266
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
@ -307,10 +319,12 @@ export default {
307 319
    showAddDeviceModal () {
308 320
      this.addDeviceModal = true
309 321
    },
322
    // 编辑新增用户信息
310 323
    async editDeviceData (id) {
311
      const res = await sysapi.getDeviceInfo(id)
324
      const res = await sysapi.getOneEmployee({ params: { employeeId: id } })
312 325
      if (res.status === 200) {
313
        this.currentEditDevice = res.data
326
        this.currentEditDevice = res.data.data
327
        console.log(this.currentEditDevice)
314 328
      } else {
315 329
        this.$Message.danger('设备数据获取失败!')
316 330
      }

+ 4 - 4
security-protection-platform/src/modules/videoSurveillance/components/ReplayDialog/index.vue

@ -70,10 +70,10 @@ export default {
70 70
      videoList: [],
71 71
      // 视频播放器对象
72 72
      $player: null,
73
      // 开始时间
74
      beginDay: '2020-12-19 20:14:00',
75
      // 结束时间
76
      endDay: '2020-12-19 20:14:59',
73
      //   开始时间
74
      beginDay: formatDateTime(new Date(+new Date() - 10 * 60 * 1000), 'yyyy-MM-dd hh:mm:ss'),
75
      //   结束时间
76
      endDay: formatDateTime(new Date(), 'yyyy-MM-dd hh:mm:ss'),
77 77
      isShow: true,
78 78
      playerOptions: {
79 79
        playbackRates: [0.7, 1.0, 1.5, 2.0], // 播放速度

+ 27 - 7
security-protection-platform/src/modules/videoSurveillance/distinguishRecord/index.vue

@ -44,10 +44,14 @@
44 44
        </div>
45 45
      </div>
46 46
      <div class="img-viewer">
47
        <div v-for="(item,index) in dataImg" :key="index" :src="item.idenPictureUrl" class="image-carousel">
48
          <img :src="'http://10.19.90.34:19000/ai-image/'+item.idenPictureUrl" class="img-viewer-size" @click="getParticularsData(item.aiIdenLogId,index)">
49
          <span :class="{'fileName' : index === fileNameIndex}" style="width: 132px;margin-right: 14px;text-align:center">{{ item.fileName }}</span>
50
        </div>
47
        <t-carousel dots="none" arrow="always" style="width: 100%">
48
          <t-carousel-item v-for="(item1,index1) in dataImgList" :key="index1" style="width: 100%;padding-left: 10%">
49
            <div v-for="(item, index) in item1" :key="index" :src="item.idenPictureUrl" class="image-carousel">
50
              <img :src="'http://10.19.90.34:19000/ai-image/'+item.idenPictureUrl" class="img-viewer-size" @click="getParticularsData(item.aiIdenLogId,index)">
51
              <span :class="{'fileName' : index === fileNameIndex}" style="width: 132px;margin-right: 14px;text-align:center">{{ item.fileName }}</span>
52
            </div>
53
          </t-carousel-item>
54
        </t-carousel>
51 55
      </div>
52 56
    </div>
53 57
  </div>
@ -65,6 +69,7 @@ export default {
65 69
      devicePosition: '',
66 70
      distinguishUrl: '',
67 71
      dataImg: [],
72
      dataImgList: [],
68 73
      fileNameIndex: 0,
69 74
      playerOptions: {
70 75
        playbackRates: [0.7, 1.0, 1.5, 2.0], // 播放速度
@ -116,12 +121,13 @@ export default {
116 121
      }
117 122
      var flag = this.startreend(this.startDate, this.endDate)
118 123
      if (flag) {
119
        var data = { params: { beginDay: this.startDate, endDay: this.endDate, id: this.videoId }}
124
        var data = { params: { beginDay: this.startDate, endDay: this.endDate, id: this.videoId, pageNumber: 1, pageSize: 10000 }}
120 125
        sysapi.getDistinguishData(data).then(res => {
121 126
          console.log(res.data)
122 127
          this.dataImg = res.data.data
123 128
          if (res.data.data.length > 0) {
124 129
            this.getParticularsData(res.data.data[0].aiIdenLogId, 0)
130
            this.dataImgList = this.arrayGroup(res.data.data, 10)
125 131
          } else {
126 132
            this.devicePosition = ''
127 133
            this.defineResult = ''
@ -135,6 +141,14 @@ export default {
135 141
        this.$Message.danger('开始时间不能在结束时间的后面')
136 142
      }
137 143
    },
144
    arrayGroup(array, subGroupLength) {
145
      let index = 0
146
      let newArray = []
147
      while(index < array.length) {
148
        newArray.push(array.slice(index, index += subGroupLength))
149
      }
150
      return newArray
151
    },
138 152
    // 字符串更改为时间类型
139 153
    stringtodate (date) {
140 154
      date = date.substring(0, 19)
@ -240,16 +254,22 @@ export default {
240 254
            display: flex;
241 255
            .image-carousel{
242 256
              display: flex;
257
              width: 9%;
258
              height: 80%;
243 259
              flex-direction: column;
244 260
              .img-viewer-size{
245 261
                cursor:pointer;
246
                width: 132px;
247
                height: 88px;
262
                width: 100%;
263
                height: 100%;
248 264
                margin-right: 14px;
265
                padding-left: 2%;
249 266
              }
250 267
            }
251 268
        }
252 269
    }
270
    .carousel-control-prev-icon{
271
      color: #009bf3;
272
    }
253 273
}
254 274
.fileName{
255 275
  color: #009bf3;

+ 37 - 22
security-protection-platform/src/modules/videoSurveillance/index.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <div class="page-main">
3 3
    <t-button-group class="top-btn">
4
      <t-button v-for="(item,index) in sceneList" :key="index" :value="item.monitorSceneId" :color="item.monitorSceneId === selectedMonitorScene ? 'primary' : 'secondary'" @click="tabClick(item.monitorSceneId)">
4
      <t-button v-for="(item,index) in sceneList" :key="index" :value="item.monitorSceneId" :color="item.monitorSceneId === selectedMonitorScene ? 'primary' : 'secondary'" @click="tabClick(item.monitorSceneId, item.monitorViewLayout)">
5 5
        {{ item.monitorSceneName }}
6 6
      </t-button>
7 7
    </t-button-group>
@ -125,7 +125,7 @@ export default {
125 125
          btn1.className = 'aidicon aidicon-piechart-outline'
126 126
          btn1.setAttribute('title', '视频回放')
127 127
          btn1.addEventListener('click', () => {
128
            this.handleReview(this.videoList[index].id)
128
            this.handleReview(this.videoList[index].resourceToolId)
129 129
          })
130 130
          item.appendChild(txt)
131 131
          item.appendChild(btn)
@ -141,20 +141,20 @@ export default {
141 141
        if (element.id === this.gateFieldData) {
142 142
          sysapi.getMonitorScene(this.organizationList[index].id).then((resp) => {
143 143
            this.sceneList = resp.data.data || []
144
            if (resp.data.data[0].monitorViewLayout === '1X1') {
145
              this.viewLayoutSpan = 10
146
              this.videoPageSize = 1
147
            } else if (resp.data.data[0].monitorViewLayout === '2X2') {
148
              this.viewLayoutSpan = 6
149
              this.videoPageSize = 4
150
            } else if (resp.data.data[0].monitorViewLayout === '3X3') {
151
              this.viewLayoutSpan = 4
152
              this.videoPageSize = 9
153
            } else if (resp.data.data[0].monitorViewLayout === '4X4') {
154
              this.viewLayoutSpan = 3
155
              this.videoPageSize = 16
156
            }
157
            this.tabClick(this.sceneList[0].monitorSceneId)
144
            // if (resp.data.data[0].monitorViewLayout === '1X1') {
145
            //   this.viewLayoutSpan = 10
146
            //   this.videoPageSize = 1
147
            // } else if (resp.data.data[0].monitorViewLayout === '2X2') {
148
            //   this.viewLayoutSpan = 6
149
            //   this.videoPageSize = 4
150
            // } else if (resp.data.data[0].monitorViewLayout === '3X3') {
151
            //   this.viewLayoutSpan = 4
152
            //   this.videoPageSize = 9
153
            // } else if (resp.data.data[0].monitorViewLayout === '4X4') {
154
            //   this.viewLayoutSpan = 3
155
            //   this.videoPageSize = 16
156
            // }
157
            this.tabClick(this.sceneList[0].monitorSceneId, resp.data.data[0].monitorViewLayout)
158 158
          })
159 159
        }
160 160
      })
@ -169,7 +169,6 @@ export default {
169 169
      }
170 170
      if (res.status === 200) {
171 171
        this.replayList = res.data.data
172
        console.log(this.replayList)
173 172
      } else {
174 173
        this.$Message.danger('视频列表数据获取失败!')
175 174
      }
@ -181,7 +180,20 @@ export default {
181 180
      this.showReplayDialog = true
182 181
    },
183 182
    // 切换场景
184
    async tabClick (id) {
183
    async tabClick (id, monitorViewLayout) {
184
      if (monitorViewLayout === '1X1') {
185
        this.viewLayoutSpan = 10
186
        this.videoPageSize = 1
187
      } else if (monitorViewLayout === '2X2') {
188
        this.viewLayoutSpan = 6
189
        this.videoPageSize = 4
190
      } else if (monitorViewLayout === '3X3') {
191
        this.viewLayoutSpan = 4
192
        this.videoPageSize = 9
193
      } else if (monitorViewLayout === '4X4') {
194
        this.viewLayoutSpan = 3
195
        this.videoPageSize = 16
196
      }
185 197
      this.selectedMonitorScene = id
186 198
      this.paramsObj.page = 0
187 199
      this.videoList = []
@ -207,11 +219,14 @@ export default {
207 219
    },
208 220
    // 获得风场大门数据
209 221
    getVideoSurveillanceData () {
222
      this.videoList = []
223
      this.videoOptions = []
210 224
      var id = this.tabId
211 225
      this.paramsObj.page = this.videoCurrent
212
      sysapi.getVideoSurveillanceData({ params: { monitorSceneId: id } }).then(res => {
213
        this.videoList = res.data.data
214
        for (let i in res.data.data) {
226
      sysapi.getVideoSurveillanceDataForPage({ params: { monitorSceneId: id, pageNumber: this.videoCurrent, pageSize: this.videoPageSize } }).then(res => {
227
        this.videoList = res.data.data.data
228
        this.videoTotal = res.data.data.total
229
        for (let i in res.data.data.data) {
215 230
          let obj = {
216 231
            autoplay: true, // 如果true,浏览器准备好时开始回放。
217 232
            muted: true, // 默认情况下将会消除任何音频。
@ -229,7 +244,7 @@ export default {
229 244
            sources: [{
230 245
              withCredentials: false,
231 246
              type: 'application/x-mpegURL', // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
232
              src: res.data.data[i].videoUrl // url地址
247
              src: res.data.data.data[i].videoUrl // url地址
233 248
            }],
234 249
            flash: { hls: { withCredentials: false } },
235 250
            html5: { hls: { withCredentials: false } },

+ 2 - 1
security-protection-platform/src/routes.js

@ -14,12 +14,13 @@ export const constantRoutes = [
14 14
  {
15 15
    path: '/',
16 16
    component: Layout,
17
    redirect: '/attendance/report',
17
    redirect: '/dashboard',
18 18
    hidden: true
19 19
  },
20 20
  {
21 21
    name: 'dashboard',
22 22
    path: '/dashboard',
23
    redirect: '/',
23 24
    component: () => import(/* webpackChunkName: "dashboard" */ './modules/dashboard'),
24 25
    meta: { title: '首页', icon: 'home' },
25 26
    children: [

+ 2 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/AiIdenLogManageController.java

@ -46,6 +46,7 @@ public class AiIdenLogManageController {
46 46
		params.put("endTime", attendanceReport.getEndDay());
47 47
		params.put("relateEmployeeNameAsLike", attendanceReport.getNameAsLike());
48 48
		params.put("aiIdenModel", EbcConstant.AI_MODEL_FACE);
49
		params.put("idenResultType", EbcConstant.AI_IDENTIFY_RESULT_ATTENDANCE);
49 50
50 51
		return aiIdenLogManageService.queryPageAiIdenLog(params, pageNumber, pageSize);
51 52
	}
@ -73,7 +74,7 @@ public class AiIdenLogManageController {
73 74
		params.put("beginTime", attendanceReport.getBeginDay());
74 75
		params.put("endTime", attendanceReport.getEndDay());
75 76
		params.put("resourceToolId", attendanceReport.getId());
76
		params.put("aiIdenModel", EbcConstant.AI_MODEL_CLOTHING_CODE);
77
		params.put("idenResultType", EbcConstant.AI_IDENTIFY_RESULT_ALARM);
77 78
78 79
		return aiIdenLogManageService.queryAllAiIdenLogPicture(params, pageNumber, pageSize);
79 80
	}

+ 1 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/InAndOutRecordController.java

@ -75,7 +75,7 @@ public class InAndOutRecordController {
75 75
	}
76 76
	
77 77
	/**
78
	 * 首页查询进出记录
78
	 * 查询首页进出记录
79 79
	 * @return
80 80
	 * @throws Exception
81 81
	 */

+ 2 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/MonitorVideoLogManageController.java

@ -49,7 +49,6 @@ public class MonitorVideoLogManageController {
49 49
		return monitorVideoLogManageService.queryMonitorVideoLogByTime(monitorVideoLogCondition);
50 50
	}
51 51
52
53 52
	/**
54 53
	 * 查询监控视频日志(按时间段)
55 54
	 * @param attendanceReport
@ -76,7 +75,7 @@ public class MonitorVideoLogManageController {
76 75
	 */
77 76
	@ResponseBody
78 77
	@RequestMapping("/queryOneMonitorVideoLog")
79
	public CommonResponse<EbcMonitorVideoLog> queryOneMonitorVideoLog(@RequestParam String monitorVideoLogId)
78
	public CommonResponse<String> queryOneMonitorVideoLog(@RequestParam String monitorVideoLogId)
80 79
			throws Exception {
81 80
		if (StringUtils.isEmpty(monitorVideoLogId)) {
82 81
			return CommonResponse.fail("500", "操作失败");
@ -94,7 +93,7 @@ public class MonitorVideoLogManageController {
94 93
	 */
95 94
	@ResponseBody
96 95
	@RequestMapping("/getMonitorVideoLogByPictureTime")
97
	public CommonResponse<List<EbcMonitorVideoLog>> getMonitorVideoLogByPictureTime(@RequestParam String imageTime,@RequestParam String resourceToolId)
96
	public CommonResponse<String> getMonitorVideoLogByPictureTime(@RequestParam String imageTime,@RequestParam String resourceToolId)
98 97
			throws Exception {
99 98
		if (StringUtils.isEmpty(imageTime)||StringUtils.isEmpty(resourceToolId)) {
100 99
			return CommonResponse.fail("500", "获取视频失败");

+ 5 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AiAlarmManageServiceImpl.java

@ -164,17 +164,19 @@ public class AiAlarmManageServiceImpl implements AiAlarmManageService {
164 164
		Map<String, String> pictureMap= uploadFileService.getFileUrlToMap(workTaskSafetyAlarmMap.get("idenPictureUrl"));
165 165
		
166 166
		//视频信息
167
		List<EbcMonitorVideoLog> logsList=monitorVideoLogManageService.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), workTaskSafetyAlarmMap.get("resourceToolId")).getData();
167
		/*List<EbcMonitorVideoLog> logsList=monitorVideoLogManageService.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), workTaskSafetyAlarmMap.get("resourceToolId")).getData();
168 168
		EbcMonitorVideoLog ebcMonitorVideoLog=null;
169 169
		if (!CollectionUtils.isEmpty(logsList)) {
170 170
			ebcMonitorVideoLog=logsList.get(0);
171 171
			ebcMonitorVideoLog.setVideoFileUrl(uploadFileService.getFileUrl(ebcMonitorVideoLog.getVideoUrl()));
172
		}
172
		}*/
173
		String videoFileUrl =monitorVideoLogManageService.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), workTaskSafetyAlarmMap.get("resourceToolId")).getData();
173 174
		
174 175
		Map<String,Object> resultMap= new HashMap<String, Object>();
175 176
		resultMap.put("alarmInfo", workTaskSafetyAlarmMap);
176 177
		resultMap.put("pictureInfo", pictureMap);
177
		resultMap.put("videoInfo", ebcMonitorVideoLog);
178
		//resultMap.put("videoInfo", ebcMonitorVideoLog);
179
		resultMap.put("videoInfo", videoFileUrl);
178 180
		return CommonResponse.ok(resultMap);
179 181
	}
180 182

+ 7 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AiIdenLogManageServiceImpl.java

@ -252,19 +252,23 @@ public class AiIdenLogManageServiceImpl implements AiIdenLogManageService {
252 252
		Map<String, String> pictureMap = uploadFileService.getFileUrlToMap(aiIdenLog.getIdenPictureUrl());
253 253
254 254
		// 视频信息
255
		List<EbcMonitorVideoLog> logsList = monitorVideoLogManageService
255
		/*List<EbcMonitorVideoLog> logsList = monitorVideoLogManageService
256 256
				.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), aiIdenLog.getResourceToolId())
257 257
				.getData();
258 258
		EbcMonitorVideoLog ebcMonitorVideoLog = null;
259 259
		if (!CollectionUtils.isEmpty(logsList)) {
260 260
			ebcMonitorVideoLog = logsList.get(0);
261 261
			ebcMonitorVideoLog.setVideoFileUrl(uploadFileService.getFileUrl(ebcMonitorVideoLog.getVideoUrl()));
262
		}
262
		}*/
263
		String videoFileUrl =monitorVideoLogManageService
264
				.getMonitorVideoLogByPictureTime(pictureMap.get("fileDateTimeStr"), aiIdenLog.getResourceToolId())
265
				.getData();
263 266
264 267
		Map<String, Object> resultMap = new HashMap<String, Object>();
265 268
		resultMap.put("alarmInfo", aiIdenLogInfoMap);
266 269
		resultMap.put("pictureInfo", pictureMap);
267
		resultMap.put("videoInfo", ebcMonitorVideoLog);
270
		//resultMap.put("videoInfo", ebcMonitorVideoLog);
271
		resultMap.put("videoInfo", videoFileUrl);
268 272
		return CommonResponse.ok(resultMap);
269 273
	}
270 274

+ 5 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/EmployeeManagementServiceImpl.java

@ -106,12 +106,17 @@ public class EmployeeManagementServiceImpl implements EmployeeManagementService
106 106
		resultMap.put("organizationCode", response.getData().getOrganizeCode());
107 107
		resultMap.put("organizationName", response.getData().getOrgName());
108 108
		resultMap.put("age", response.getData().getAge());
109
		
109 110
		resultMap.put("mainWirelessCall", response.getData().getMainWirelessCall());
110 111
		resultMap.put("field1", response.getData().getField1()); // 头像标识
111 112
		resultMap.put("field2", response.getData().getField2()); // 审核结果
112 113
		resultMap.put("field3", response.getData().getField3()); // 审核意见
113 114
		resultMap.put("field4", response.getData().getField4()); // 公司
114 115
116
		if (response.getData().getBirthday()!=null) {
117
			resultMap.put("birthday", String.valueOf(response.getData().getBirthday().getTime()));
118
		}
119
		
115 120
		resultMap.put("pictureUrl",
116 121
				uploadFileService.getFileUrl(response.getData().getField1(), minioConfig.getBucketHeaderImage()));
117 122

+ 21 - 12
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/MonitorVideoLogManageServiceImpl.java

@ -46,6 +46,7 @@ public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageSe
46 46
	private SecurityProtectionMinioConfig minioConfig;
47 47
48 48
	@Override
49
	@Deprecated
49 50
	public CommonResponse<List<EbcMonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
50 51
			throws Exception {
51 52
		CommonRequest<MonitorVideoLog> request = new CommonRequest<MonitorVideoLog>(monitorVideoLogCondition);
@ -103,38 +104,46 @@ public class MonitorVideoLogManageServiceImpl implements MonitorVideoLogManageSe
103 104
	}
104 105
105 106
	@Override
106
	public CommonResponse<EbcMonitorVideoLog> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception {
107
	public CommonResponse<String> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception {
107 108
		CommonRequest<Long> request = new CommonRequest<Long>(monitorVideoLogId);
108 109
		CommonResponse<MonitorVideoLog> response = monitorSceneQuery.loadMonitorVideoLog(request);
109 110
110 111
		if (response == null || response.getData() == null) {
111 112
			return CommonResponse.fail("504", "监控视频不存在");
112 113
		}
113
114
		EbcMonitorVideoLog ebcMonitorVideoLog = getEbcMonitorVideoLog(response.getData());
115
		return CommonResponse.ok(ebcMonitorVideoLog);
114
		
115
		//EbcMonitorVideoLog ebcMonitorVideoLog = getEbcMonitorVideoLog(response.getData());
116
		//return CommonResponse.ok(ebcMonitorVideoLog);
117
		return queryMonitorVideoLogByTimeForM3u8(response.getData());
116 118
	}
117 119
118 120
	@Override
119
	public CommonResponse<List<EbcMonitorVideoLog>> getMonitorVideoLogByPictureTime(String imageTime,
121
	public CommonResponse<String> getMonitorVideoLogByPictureTime(String imageTime,
120 122
			String resourceToolId) throws Exception {
121
		Map<String, Object> conditionMap = new HashMap<String, Object>();
123
		MonitorVideoLog monitorVideoLogCondition = new MonitorVideoLog();
124
		monitorVideoLogCondition.setResourceToolId(resourceToolId);
125
		monitorVideoLogCondition.setBeginTime(DateUtil.convertDate(imageTime));
126
		monitorVideoLogCondition.setEndTime(DateUtil.convertDate(imageTime));
127
		
128
		return queryMonitorVideoLogByTimeForM3u8(monitorVideoLogCondition);
129
		
130
		
131
		/*Map<String, Object> conditionMap = new HashMap<String, Object>();
122 132
		conditionMap.put("resourceToolId", resourceToolId);
123 133
		conditionMap.put("imageTime", imageTime);
124 134
		CommonRequest<Map<String, Object>> conditionMapRequest = new CommonRequest<Map<String, Object>>(conditionMap);
125 135
		CommonResponse<List<MonitorVideoLog>> response = monitorSceneQuery.selectMonitorVideoLog(conditionMapRequest);
126
127
		List<EbcMonitorVideoLog> list = new ArrayList<EbcMonitorVideoLog>();
136
		
128 137
		if (response == null || CollectionUtils.isEmpty(response.getData())) {
129
			return CommonResponse.ok(list);
138
			return CommonResponse.ok("");
130 139
		}
131
140
		
132 141
		for (MonitorVideoLog monitorVideoLog : response.getData()) {
133 142
			EbcMonitorVideoLog ebcMonitorVideoLog = getEbcMonitorVideoLog(monitorVideoLog);
134 143
			list.add(ebcMonitorVideoLog);
135 144
		}
136
137
		return CommonResponse.ok(list);
145
		
146
		return CommonResponse.ok(list);*/
138 147
	}
139 148
140 149
	/**

+ 1 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AiIdenLogManageService.java

@ -45,7 +45,7 @@ public interface AiIdenLogManageService {
45 45
	CommonResponse<Map<String, Object>> queryOneAiIdenLog(Long aiIdenLogId) throws Exception;
46 46
47 47
	/**
48
	 * 查询所有设备最后一个识别记录
48
	 * 根据场景ID查询最后一条进出记录
49 49
	 * @param params
50 50
	 * @return
51 51
	 * @throws Exception

+ 9 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/MonitorVideoLogManageService.java

@ -19,10 +19,16 @@ public interface MonitorVideoLogManageService {
19 19
	 * @return
20 20
	 * @throws Exception
21 21
	 */
22
	@Deprecated
22 23
	CommonResponse<List<EbcMonitorVideoLog>> queryMonitorVideoLogByTime(MonitorVideoLog monitorVideoLogCondition)
23 24
			throws Exception;
24 25
25
26
	/**
27
	 * 按时间段查询监控视频日志
28
	 * @param monitorVideoLogCondition
29
	 * @return
30
	 * @throws Exception
31
	 */
26 32
	CommonResponse<String> queryMonitorVideoLogByTimeForM3u8(MonitorVideoLog monitorVideoLogCondition) throws Exception;
27 33
28 34
	/**
@ -31,7 +37,7 @@ public interface MonitorVideoLogManageService {
31 37
	 * @return
32 38
	 * @throws Exception
33 39
	 */
34
	CommonResponse<EbcMonitorVideoLog> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception;
40
	CommonResponse<String> queryMonitorVideoLogById(Long monitorVideoLogId) throws Exception;
35 41
36 42
	/**
37 43
	 * 根据设备图片时间查询视频日志
@ -40,7 +46,7 @@ public interface MonitorVideoLogManageService {
40 46
	 * @return
41 47
	 * @throws Exception
42 48
	 */
43
	CommonResponse<List<EbcMonitorVideoLog>> getMonitorVideoLogByPictureTime(String imageTime,String resourceToolId) throws Exception;
49
	CommonResponse<String> getMonitorVideoLogByPictureTime(String imageTime,String resourceToolId) throws Exception;
44 50
	
45 51
	/**
46 52
	 * 创建监控视频日志

+ 3 - 9
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/EbcConstant.java

@ -75,6 +75,9 @@ public class EbcConstant {
75 75
	//AI识别结果:考勤
76 76
	public static final String AI_IDENTIFY_RESULT_ATTENDANCE= "ATT";
77 77
	
78
	//AI匹配模型:人脸识别
79
	public static final String AI_MODEL_FACE="FACE";
80
	
78 81
	//场景关联设备的作用类别:进门识别
79 82
	public static final String TERMINAL_EFFECT_TYPE_IN="IN";
80 83
	
@ -93,15 +96,6 @@ public class EbcConstant {
93 96
	//审核状态:未生效(未审核通过)
94 97
	public static final String AUDIT_STATUS_DIS="3";
95 98
	
96
	//AI匹配模型:着装违规识别
97
	public static final String AI_MODEL_CLOTHING_CODE="CLOTHING_CODE";
98
	
99
	//AI匹配模型:人脸识别
100
	public static final String AI_MODEL_FACE="FACE";
101
	
102
	//AI匹配模型:陌生人识别
103
	public static final String AI_MODEL_STRANGER="STRANGER";
104
	
105 99
	
106 100
	// 当前登录者的STAFF_ID
107 101
	public static String USPA_USER_STAFF_ID = "201613310867";

android-share - Nuosi Git Service

ipu的trunk版的android工程和服务端工程。

zepto.js 55KB

    /* Zepto v1.1.6 - zepto event ajax form ie - zeptojs.com/license */ var Zepto = (function() { var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter, // NOSONAR 注释,可以忽略sonar扫描 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.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) { return typeof obj.length == 'number' } 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 }) } // `$.zepto.fragment` takes a html string and an optional tag name // to generate DOM nodes nodes from the given html string. // The generated DOM nodes are returned as an array. // This function can be overriden 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. Note that `__proto__` is not supported on Internet // Explorer. This method can be overriden in plugins. zepto.Z = function(dom, selector) { dom = dom || [] dom.__proto__ = $.fn dom.selector = selector || '' return dom } // `$.zepto.isZ` should return `true` if the given object is a Zepto // collection. This method can be overriden 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 overriden 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 overriden 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 (isDocument(element) && isSimple && maybeID) ? ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : (element.nodeType !== 1 && element.nodeType !== 9) ? [] : slice.call( isSimple && !maybeID ? 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 } $.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 = { } $.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 = { // 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, indexOf: emptyArray.indexOf, concat: emptyArray.concat, // `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 node = this[0], collection = false if (typeof selector == 'object') collection = $(selector) while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) node = node !== context && !isDocument(node) && node.parentNode return $(node) }, 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 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[0].textContent : null) }, attr: function(name, value){ var result return (typeof name == 'string' && !(1 in arguments)) ? (!this.length || this[0].nodeType !== 1 ? undefined : (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result ) : 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]) }, 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){ return 0 in arguments ? this.each(function(idx){ this.value = funcArg(this, value, idx, this.value) }) : (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 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 computedStyle, element = this[0] if(!element) return computedStyle = getComputedStyle(element, '') if (typeof property == 'string') return element.style[camelize(property)] || computedStyle.getPropertyValue(property) else if (isArray(property)) { var props = {} $.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) { argType = type(arg) return argType == "object" || argType == "array" || 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) window['eval'].call(window, 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 = $.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, // NOSONAR 注释,可以忽略sonar扫描 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]$)/, 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 }) 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 (isFunction(data) || 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 = 0, 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) } // 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) || ('jsonp' + (++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 } 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')) options.url = appendQuery(options.url, options.data), options.data = undefined } $.ajax = function(options){ var settings = $.extend({}, options || {}), deferred = $.Deferred && $.Deferred(), urlAnchor 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 urlAnchor.href = urlAnchor.href settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host) } if (!settings.url) settings.url = window.location.toString() 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')) result = xhr.responseText try { // http://perfectionkills.com/global-eval-what-are-the-options/ 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) ajaxError(error, 'parsererror', xhr, settings, deferred) else 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 } if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name] var async = 'async' in settings ? settings.async : true xhr.open(settings.type, settings.url, async, settings.username, settings.password) 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($){ // __proto__ doesn't exist on IE<11, so redefine // the Z function to use object extension instead if (!('__proto__' in {})) { $.extend($.zepto, { Z: function(dom, selector){ dom = dom || [] $.extend(dom, $.fn) dom.selector = selector || '' dom.__Z = true return dom }, // this is a kludge but works isZ: function(object){ return $.type(object) === 'array' && '__Z' in object } }) } // 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){ try { return nativeGetComputedStyle(element) } catch(e) { return null } } } })(Zepto)