From 6bba61bde32fffeb2a73033b7703dd050519efef Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 27 十一月 2024 10:15:06 +0800
Subject: [PATCH] ll
---
h5/main.js | 36
h5/index.html | 20
h5/.gitignore | 29
h5/utils/qrcode.js | 1201 ++++++++++++++++++++++++
h5/store/index.js | 105 ++
h5/pages/index/index.vue | 52 +
admin/src/api/business/ywAccount.js | 64 +
admin/src/views/finance/account.vue | 58
h5/api/staff.js | 232 ++++
h5/manifest.json | 152 +++
h5/static/logo.png | 0
h5/uni.scss | 76 +
admin/src/views/finance/components/accountEdit.vue | 65
h5/pages.json | 21
h5/api/index.js | 29
h5/utils/config.js | 22
h5/utils/http.api.js | 36
h5/uni.promisify.adaptor.js | 10
h5/utils/service.js | 65 +
h5/utils/http.interceptor.js | 40
h5/utils/meetingHttp.js | 69 +
admin/src/views/finance/company.vue | 28
h5/utils/utils.js | 163 +++
admin/src/api/business/company.js | 3
admin/src/views/finance/components/companyEdit.vue | 6
h5/App.vue | 250 +++++
h5/utils/login.js | 60 +
27 files changed, 2,841 insertions(+), 51 deletions(-)
diff --git a/admin/src/api/business/company.js b/admin/src/api/business/company.js
index 0e179b0..28b67ec 100644
--- a/admin/src/api/business/company.js
+++ b/admin/src/api/business/company.js
@@ -57,6 +57,9 @@
export function deleteById (id) {
return request.get(`/visitsAdmin/cloudService/business/company/delete/${id}`)
}
+export function updateStatusById (data) {
+ return request.post('/visitsAdmin/cloudService/business/company/updateStatusById', data)
+}
// 鏍规嵁绫诲瀷鏌ヨ缁勭粐淇℃伅
export function findCompanyTreePage (type) {
diff --git a/admin/src/api/business/ywAccount.js b/admin/src/api/business/ywAccount.js
new file mode 100644
index 0000000..904ec72
--- /dev/null
+++ b/admin/src/api/business/ywAccount.js
@@ -0,0 +1,64 @@
+import request from '../../utils/request'
+
+// 鏌ヨ
+export function fetchList (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/page', data)
+}
+
+// 鍒涘缓
+export function create (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/create', data)
+}
+// 鍒涘缓璐㈠姟鍏徃
+export function createFinanceywAccount (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/createFinanceywAccount', data)
+}
+export function updateFinanceywAccount (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/updateFinanceywAccount', data)
+}
+
+// 淇敼
+export function updateById (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/updateById', data)
+}
+export function sort (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/updateSort', data)
+}
+
+// 閮ㄩ棬淇℃伅鍚屾
+export function ywAccountSync (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/syncAll', data)
+}
+// 鍒嗛〉鏌ヨ
+export function ywAccountGetList (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/page', data)
+}
+// 鏌ヨ鎵�鏈夐儴闂�
+export function ywAccountGetListPost (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/list', data)
+}
+
+// 鍒犻櫎
+export function deleteById (id) {
+ return request.get(`/visitsAdmin/cloudService/business/ywAccount/delete/${id}`)
+}
+export function detailById (id) {
+ return request.get(`/visitsAdmin/cloudService/business/ywAccount/${id}`)
+}
+export function updateStatusById (data) {
+ return request.post('/visitsAdmin/cloudService/business/ywAccount/updateStatusById', data)
+}
+
+// 鏍规嵁绫诲瀷鏌ヨ缁勭粐淇℃伅
+export function findywAccountTreePage (type) {
+ return request.get(`/visitsAdmin/cloudService/business/ywAccount/findywAccountTreePage?type=${type}`)
+}
+
+// 鎵归噺鍒犻櫎
+export function deleteByIdInBatch (ids) {
+ return request.get('/visitsAdmin/cloudService/business/ywAccount/delete/batch', {
+ params: {
+ ids
+ }
+ })
+}
diff --git a/admin/src/views/finance/account.vue b/admin/src/views/finance/account.vue
index 3cb9a42..1d60573 100644
--- a/admin/src/views/finance/account.vue
+++ b/admin/src/views/finance/account.vue
@@ -6,15 +6,20 @@
v-permissions="['business:ywpatrolline:create']">鏂板缓</el-button>
</div>
<el-table v-loading="loading" :data="list" stripe>
- <el-table-column prop="code" label="鏀舵敮鏉$洰" min-width="100" show-overflow-tooltip />
- <el-table-column prop="name" label="鏀舵鍏徃" min-width="100" show-overflow-tooltip />
- <el-table-column prop="" label="璐︽埛绫诲瀷" min-width="100" show-overflow-tooltip />
- <el-table-column prop="modelNo" label="璐︽埛鍚嶇О" min-width="100" show-overflow-tooltip />
- <el-table-column prop="realName" label="寮�鎴烽摱琛�" min-width="100" show-overflow-tooltip />
- <el-table-column prop="realName" label="閾惰璐﹀彿" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="title" label="鏀舵敮鏉$洰" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="companyName" label="鏀舵鍏徃" min-width="100" show-overflow-tooltip />
+ <el-table-column label="璐︽埛绫诲瀷" min-width="100" show-overflow-tooltip>
+ <template v-slot="{row}">
+ <span v-if="row.type == 0">瀵瑰叕</span>
+ <span v-if="row.type == 1">涓汉</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="name" label="璐︽埛鍚嶇О" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="bankName" label="寮�鎴烽摱琛�" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="bankNo" label="閾惰璐﹀彿" min-width="100" show-overflow-tooltip />
<el-table-column prop="status" label="鐘舵��" min-width="100" show-overflow-tooltip>
<template v-slot="scope">
- <el-switch v-model="scope.row.status" active-value="0" inactive-value="1">
+ <el-switch v-model="scope.row.status" @change="e =>changeStatus(scope.row)" :active-value="0" :inactive-value="1">
</el-switch>
</template>
</el-table-column>
@@ -22,7 +27,7 @@
<template slot-scope="{row}">
<el-button type="text" @click="handleEdit(row)" icon="el-icon-edit"
v-permissions="['business:category:update']">缂栬緫</el-button>
- <el-button type="text" @click="deleteById(row)" icon="el-icon-delete"
+ <el-button type="text" @click="handleDel(row)" icon="el-icon-delete"
v-permissions="['business:category:delete']">鍒犻櫎</el-button>
</template>
</el-table-column>
@@ -38,7 +43,9 @@
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/accountEdit.vue'
-import { companyGetList, deleteById } from '@/api/business/company'
+import { fetchList, updateById, deleteById } from '@/api/business/ywAccount'
+import { companyGetList } from '@/api/business/company'
+import { Message } from 'element-ui'
export default {
components: {
Pagination,
@@ -60,14 +67,17 @@
queryFormConfig: {
formItems: [
{
- filed: 'name',
+ filed: 'title',
type: 'input',
label: '鏀舵敮鏉$洰'
},
{
- filed: 'name',
+ filed: 'companyId',
type: 'select',
- label: '鏀舵鍏徃'
+ label: '鏀舵鍏徃',
+ labelCode: 'name',
+ valueCode: 'id',
+ options: []
},
],
online: true
@@ -76,15 +86,15 @@
},
created() {
this.getList()
+ this.getCompany()
},
methods: {
getList(page) {
const { pagination, filters } = this
this.loading = true
- companyGetList({
+ fetchList({
model: {
...filters,
- type: 2
},
capacity: pagination.pageSize,
page: page || pagination.page,
@@ -99,6 +109,23 @@
this.loading = false
})
},
+ changeStatus(row) {
+ updateById(row).then(res => {
+ this.getList()
+ Message.success('鏇存柊鐘舵�佹垚鍔�')
+ }, () => {
+ this.getList()
+ })
+ },
+ getCompany(){
+ companyGetList({
+ model: {type: 2},
+ capacity: 9999,
+ page: 1
+ }).then(res => {
+ this.queryFormConfig.formItems[1].options = res.records || []
+ })
+ },
handleEdit(row) {
this.showEdit = true
this.$nextTick(() => {
@@ -110,10 +137,9 @@
},
handleDel(row) {
- let message = `纭鍒犻櫎璇ヨ褰曞悧?`
+ let message = `纭鍒犻櫎璇ヨ处鎴峰悧?`
this.$dialog.deleteConfirm(message)
.then(() => {
- this.isWorking.delete = true
deleteById(row.id)
.then(() => {
this.$tip.apiSuccess('鍒犻櫎鎴愬姛')
diff --git a/admin/src/views/finance/company.vue b/admin/src/views/finance/company.vue
index 6397411..36e48b1 100644
--- a/admin/src/views/finance/company.vue
+++ b/admin/src/views/finance/company.vue
@@ -6,14 +6,14 @@
v-permissions="['business:ywpatrolline:create']">鏂板缓</el-button>
</div>
<el-table v-loading="loading" :data="list" stripe>
- <el-table-column prop="code" label="鍏徃鍚嶇О" min-width="100" show-overflow-tooltip />
- <el-table-column prop="name" label="鍏徃绠�浠�" min-width="100" show-overflow-tooltip />
- <el-table-column prop="" label="绾崇◣璇嗗埆鍙�" min-width="100" show-overflow-tooltip />
- <el-table-column prop="modelNo" label="鍏徃鍦板潃" min-width="100" show-overflow-tooltip />
- <el-table-column prop="realName" label="鏀舵敮璐︽埛鏁伴噺" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="name" label="鍏徃鍚嶇О" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="shortName" label="鍏徃绠�浠�" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="code" label="绾崇◣璇嗗埆鍙�" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="address" label="鍏徃鍦板潃" min-width="100" show-overflow-tooltip />
+ <el-table-column prop="accountNum" label="鏀舵敮璐︽埛鏁伴噺" min-width="100" show-overflow-tooltip />
<el-table-column prop="status" label="鐘舵��" min-width="100" show-overflow-tooltip>
<template v-slot="scope">
- <el-switch v-model="scope.row.status" active-value="0" inactive-value="1">
+ <el-switch v-model="scope.row.status" @change="e => changeStatus(scope.row)" :active-value="0" :inactive-value="1">
</el-switch>
</template>
</el-table-column>
@@ -21,7 +21,7 @@
<template slot-scope="{row}">
<el-button type="text" @click="handleEdit(row)" icon="el-icon-edit"
v-permissions="['business:category:update']">缂栬緫</el-button>
- <el-button type="text" @click="deleteById(row)" icon="el-icon-delete"
+ <el-button type="text" @click="handleDel(row)" icon="el-icon-delete"
v-permissions="['business:category:delete']">鍒犻櫎</el-button>
</template>
</el-table-column>
@@ -37,7 +37,8 @@
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/companyEdit.vue'
-import { companyGetList, deleteById } from '@/api/business/company'
+import { companyGetList, deleteById, updateStatusById } from '@/api/business/company'
+import { Message } from 'element-ui'
export default {
components: {
Pagination,
@@ -72,6 +73,14 @@
this.getList()
},
methods: {
+ changeStatus(row) {
+ updateStatusById(row).then(res => {
+ this.getList()
+ Message.success('鏇存柊鐘舵�佹垚鍔�')
+ }, () => {
+ this.getList()
+ })
+ },
getList(page) {
const { pagination, filters } = this
this.loading = true
@@ -104,10 +113,9 @@
},
handleDel(row) {
- let message = `纭鍒犻櫎璇ヨ褰曞悧?`
+ let message = `纭鍒犻櫎璇ュ叕鍙稿悧?`
this.$dialog.deleteConfirm(message)
.then(() => {
- this.isWorking.delete = true
deleteById(row.id)
.then(() => {
this.$tip.apiSuccess('鍒犻櫎鎴愬姛')
diff --git a/admin/src/views/finance/components/accountEdit.vue b/admin/src/views/finance/components/accountEdit.vue
index 7a7fae4..1fdf30d 100644
--- a/admin/src/views/finance/components/accountEdit.vue
+++ b/admin/src/views/finance/components/accountEdit.vue
@@ -1,32 +1,32 @@
<template>
- <GlobalWindow :title="param.id ? '缂栬緫鍏徃' : '鏂板缓鍏徃'" :confirmWorking="subLoading" :visible.sync="isShowModal"
+ <GlobalWindow :title="param.id ? '缂栬緫璐︽埛' : '鏂板缓璐︽埛'" :confirmWorking="subLoading" :visible.sync="isShowModal"
width="600px" @close="close" @confirm="handleSub">
<el-form :model="param" ref="paramRef" :rules="rules">
- <el-form-item label="鏀舵敮鏉$洰" prop="name">
- <el-input v-model="param.name" placeholder="璇疯緭鍏�" v-trim />
+ <el-form-item label="鏀舵敮鏉$洰" prop="title">
+ <el-input v-model="param.title" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
- <el-form-item label="鏀舵鍏徃" prop="name">
- <el-select v-model="param.realName" filterable clearable>
- <el-option value="0" label="xxx"></el-option>
+ <el-form-item label="鏀舵鍏徃" prop="companyId">
+ <el-select v-model="param.companyId" filterable clearable>
+ <el-option v-for="item in comList" :value="item.id" :label="item.name"></el-option>
</el-select>
</el-form-item>
- <el-form-item label="鏀舵绫诲瀷" prop="name">
- <el-radio-group v-model="param.radio">
+ <el-form-item label="鏀舵绫诲瀷" prop="type">
+ <el-radio-group v-model="param.type">
<el-radio :label="0">瀵瑰叕</el-radio>
<el-radio :label="1">涓汉</el-radio>
</el-radio-group>
</el-form-item>
- <el-form-item label="璐︽埛鍚嶇О" prop="desc">
- <el-input v-model="param.desc" placeholder="璇疯緭鍏�" v-trim />
+ <el-form-item label="璐︽埛鍚嶇О" prop="name">
+ <el-input v-model="param.name" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
- <el-form-item label="寮�鎴峰悕绉�">
- <el-input v-model="param.code" placeholder="璇疯緭鍏�" v-trim />
+ <el-form-item label="寮�鎴烽摱琛�" prop="bankName">
+ <el-input v-model="param.bankName" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
- <el-form-item label="閾惰璐﹀彿">
- <el-input v-model="param.addr" placeholder="璇疯緭鍏�" v-trim />
+ <el-form-item label="閾惰璐﹀彿" prop="bankNo">
+ <el-input v-model="param.bankNo" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
- <el-form-item label="鐘舵��" prop="code">
- <el-switch v-model="param.status" active-value="0" inactive-value="1">
+ <el-form-item label="鐘舵��" prop="status">
+ <el-switch v-model="param.status" :active-value="0" :inactive-value="1">
</el-switch>
</el-form-item>
</el-form>
@@ -36,7 +36,8 @@
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import UploadAvatarImage from '@/components/common/UploadAvatarImage'
-import { create, updateById } from '@/api/business/company'
+import { create, updateById, detailById } from '@/api/business/ywAccount'
+import { companyGetList } from '@/api/business/company'
import { Message } from 'element-ui'
export default {
components: { GlobalWindow, UploadAvatarImage },
@@ -45,18 +46,23 @@
isShowModal: false,
subLoading: false,
param: {
- type: 2,
- status: '0'
+ type: 0,
+ status: 0
},
- cateList: [],
+ comList: [],
rules: {
name: [{ required: true, message: '璇疯緭鍏�' }],
- desc: [{ required: true, message: '璇疯緭鍏�' }]
+ title: [{ required: true, message: '璇疯緭鍏�' }],
+ bankName: [{ required: true, message: '璇疯緭鍏�' }],
+ bankNo: [{ required: true, message: '璇疯緭鍏�' }],
+ status: [{ required: true, message: '璇烽�夋嫨' }],
+ type: [{ required: true, message: '璇烽�夋嫨' }],
+ companyId: [{ required: true, message: '璇烽�夋嫨' }],
},
-
}
},
created() {
+ this.getCompany()
},
methods: {
handleSub() {
@@ -76,6 +82,21 @@
}
})
},
+ getDetail(id) {
+ detailById(id).then(res => {
+ this.param = res
+ })
+ },
+ getCompany(){
+ companyGetList({
+ model: {type: 2},
+ capacity: 9999,
+ page: 1
+ }).then(res => {
+ this.comList = res.records || []
+
+ })
+ },
changeSel(e) {
if (e && e.length == 1) {
this.$set(this.param, 'catePId', e[0])
diff --git a/admin/src/views/finance/components/companyEdit.vue b/admin/src/views/finance/components/companyEdit.vue
index 22c1e7f..0ab2eeb 100644
--- a/admin/src/views/finance/components/companyEdit.vue
+++ b/admin/src/views/finance/components/companyEdit.vue
@@ -5,14 +5,14 @@
<el-form-item label="鍏徃鍚嶇О" prop="name">
<el-input v-model="param.name" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
- <el-form-item label="鍏徃绠�浠�" prop="desc">
- <el-input v-model="param.desc" placeholder="璇疯緭鍏�" v-trim />
+ <el-form-item label="鍏徃绠�浠�" prop="shortName">
+ <el-input v-model="param.shortName" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
<el-form-item label="绾崇◣璇嗗埆鍙�">
<el-input v-model="param.code" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
<el-form-item label="鑱旂郴鍦板潃">
- <el-input v-model="param.addr" placeholder="璇疯緭鍏�" v-trim />
+ <el-input v-model="param.address" placeholder="璇疯緭鍏�" v-trim />
</el-form-item>
<el-form-item label="鐘舵��" prop="code">
<el-switch v-model="param.status" active-value="0" inactive-value="1">
diff --git a/h5/.gitignore b/h5/.gitignore
new file mode 100644
index 0000000..ee6dfa3
--- /dev/null
+++ b/h5/.gitignore
@@ -0,0 +1,29 @@
+.DS_Store
+coderd.json
+node_modules
+uni_modules
+.env.development
+uview-ui
+
+/dist
+/unpackage
+
+
+# local env files
+.env.local
+.env.*.local
+unpackage
+admin
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/h5/App.vue b/h5/App.vue
new file mode 100644
index 0000000..8f99e4c
--- /dev/null
+++ b/h5/App.vue
@@ -0,0 +1,250 @@
+<script>
+export default {
+ onLaunch: function () {
+
+ },
+ onShow: function () {
+ console.log('App Show')
+ },
+ onHide: function () {
+ console.log('App Hide')
+ }
+}
+</script>
+
+<style lang="scss">
+/*姣忎釜椤甸潰鍏叡css */
+@import "uview-ui/index.scss";
+
+.flex-cb {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.container {
+ height: 100%;
+ width: 100%;
+ max-width: 800rpx;
+ overflow-y: auto;
+}
+.empty_wrap{
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ color: #666666;
+ min-height: 600rpx;
+ image{
+ width: 300rpx;
+ height: 300rpx;
+ }
+}
+.doumee-container .ivu-tabs-nav {
+ width: 100%;
+}
+
+.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
+ width: calc(100% / 3);
+}
+
+.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
+ margin-right: 0;
+ text-align: center;
+}
+
+.cell {
+ background-color: #fff;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ min-height: 100rpx;
+ padding: 24rpx 30rpx;
+ box-sizing: border-box;
+ border-bottom: 1rpx solid #eee;
+ font-size: 15rpx;
+ position: relative;
+}
+
+.cell .title {
+ flex-shrink: 0;
+ color: #222;
+ line-height: 20rpx;
+ height: 20rpx;
+ width: 28%;
+ margin-right: 5%;
+}
+
+.cell .content {
+ flex: 1;
+ font-size: 28rpx;
+ font-weight: 400;
+ color: #999999;
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+}
+
+.cell .content .input {
+ width: 100%;
+ height: 100%;
+ font-size: 28rpx;
+ font-weight: 400;
+ color: #333333;
+ text-align: right;
+}
+
+.cell.is-link::after {
+ content: "";
+ display: block;
+ width: 8rpx;
+ height: 8rpx;
+ transform: rotate(-45deg);
+ border-right: 1rpx solid #999999;
+ border-bottom: 1rpx solid #999999;
+ margin-left: 5rpx;
+}
+
+.card {
+ background-color: #fff;
+ padding: 16rpx;
+ position: relative;
+}
+
+.card::after {
+ content: "";
+ display: block;
+ position: absolute;
+ width: calc(100% - 32rpx);
+ height: 0;
+ bottom: 0;
+ left: 16rpx;
+ border-bottom: 1rpx solid #f7f7f7;
+}
+
+.card .title {
+ color: #777777;
+ margin-bottom: 12rpx;
+}
+
+.card .content {
+ color: #222;
+}
+
+.placeholder9 {
+ color: #999999 !important;
+ font-size: 28rpx;
+}
+.red{
+ color: red !important;
+}
+
+//璁剧疆鍦嗚
+checkbox .uni-checkbox-input {
+ border-radius: 50%;
+}
+
+checkbox .uni-checkbox-input.uni-checkbox-input-checked {
+ color: #fff !important;
+ border: 1px solid #4d99a8 !important;
+ background-color: #4d99a8 !important;
+}
+
+checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
+ /* color: #4d99a8 !important; */
+ /* border: 1px solid #4d99a8 !important; */
+ /* font-size: 58rpx; */
+ /* border-radius: 50%; */
+}
+
+//
+
+view {
+ box-sizing: border-box;
+}
+
+image {
+ box-sizing: border-box;
+ margin: 0;
+ display: flex;
+}
+input {
+ font-size: 30rpx;
+}
+textarea {
+ box-sizing: border-box;
+ // background-color: #f7f7f7;
+ font-size: 30rpx !important;
+ padding: 0;
+ border-radius: 8rpx;
+ color: #333333 !important;
+}
+.u-textarea {
+ padding: 0 !important;
+ color: #333333 !important;
+}
+
+.df_ac {
+ display: flex;
+ align-items: center;
+}
+
+.main_app {
+ padding: 0 30rpx 30rpx;
+ font-size: 28rpx;
+ color: #333333;
+}
+.popupShow {
+ overflow: hidden;
+ position: fixed;
+ width: 100%;
+}
+.placeholder6 {
+ color: #666666;
+ font-size: 28rpx;
+}
+.primaryColor {
+ color: $uni-color-primary;
+}
+.avatar {
+ width: 64rpx;
+ height: 64rpx;
+ border-radius: 50%;
+ margin-right: 20rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background-color: $uni-color-primary;
+ color: #fff;
+ font-size: 30rpx;
+}
+.placeholder9 {
+ color: #999999;
+ font-size: 28rpx;
+}
+.fs24 {
+ font-size: 24rpx;
+}
+.mr24 {
+ margin-right: 24rpx;
+}
+.mt24 {
+ margin-top: 24rpx;
+}
+
+.mr12 {
+ margin-right: 12rpx;
+}
+.ml12 {
+ margin-left: 12rpx;
+}
+.ml6 {
+ margin-left: 6rpx;
+}
+.mt6 {
+ margin-top: 6rpx;
+}
+.mr6 {
+ margin-right: 6rpx;
+}
+</style>
diff --git a/h5/api/index.js b/h5/api/index.js
new file mode 100644
index 0000000..9a7edfe
--- /dev/null
+++ b/h5/api/index.js
@@ -0,0 +1,29 @@
+import { http } from '@/utils/service.js'
+export * from '@/utils/config.js'
+export * from './staff'
+
+
+
+// 鏌ヨ瀛楀吀鍊兼暟鎹�
+export const getSystemDictData = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/web/other/getSystemDictData',
+ data
+ })
+}
+// 鎺堟潈
+export const wxAuthorize = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/web/visitor/wxAuthorize',
+ method: 'get',
+ data
+ })
+}
+// 鍙戦�佺煭淇¢獙璇佺爜
+export const sendSms = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/smsEmail/sendSms',
+ method: 'post',
+ data
+ })
+}
\ No newline at end of file
diff --git a/h5/api/staff.js b/h5/api/staff.js
new file mode 100644
index 0000000..ea64d24
--- /dev/null
+++ b/h5/api/staff.js
@@ -0,0 +1,232 @@
+import { http } from '@/utils/service.js'
+
+// login
+export const loginPost = (data) => {
+ return http({
+ url: 'loginH5',
+ method: 'post',
+ data
+ })
+}
+export const loginCaptcha = () => {
+ return http({
+ url: 'captcha',
+ method: 'get'
+ })
+}
+// 鍒锋柊token
+export const refreshToken = () => {
+ return http({
+ url: 'refreshtoken',
+ method: 'post'
+ })
+}
+export const getUserInfo = () => {
+ return http({
+ url: 'getUserInfo',
+ method: 'get'
+ })
+}
+// 鏌ヨ浜哄憳鐩稿叧淇℃伅0鍔冲姟璁垮 1鏅�氳瀹� 2鍐呴儴浜哄憳,绀轰緥鍊�(1)
+export const findTypeMemberInfo = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/member/findTypeMemberInfo',
+ // url: 'visitsAdmin/cloudService/business/member/page',
+ method: 'post',
+ data
+ })
+}
+// 閲嶇疆瀵嗙爜
+export const resetPassword = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/visits/resetPassword',
+ method: 'post',
+ data
+ })
+}
+// 淇敼瀵嗙爜
+export const uploadPassword = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/member/updatePwd',
+ method: 'post',
+ data
+ })
+}
+// loginout
+export const logoutPost = (data) => {
+ return http({
+ url: '/logout',
+ method: 'post',
+ data
+ })
+}
+
+// 闅愭偅闅忔墜鎷� 鍒涘缓
+export const DangerCreate = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDanger/create',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅鍖哄煙
+export const DangerArea = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDanger/create',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 璇︽儏
+export const hiddenDangerDetail = (id) => {
+ return http({
+ url: `visitsAdmin/cloudService/business/hiddenDanger/${id}`,
+ method: 'get'
+ })
+}
+// 閮ㄩ棬鍒楄〃
+export const deptListPost = (data) => {
+ return http({
+ url: '/visitsAdmin/cloudService/business/company/list',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 绫诲瀷
+export const DangerConfigType = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDangerParam/list',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 鏌ヨ鍖哄煙鍐呭畨鍏ㄥ憳
+export const findHiddenAreaMemberList = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDangerParam/findHiddenAreaMemberList',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 澶勭悊
+export const dealHiddenDanger = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDanger/dealHiddenDanger',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 杞氦
+export const transferHiddenDanger = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDanger/transferHiddenDanger',
+ method: 'post',
+ data
+ })
+}
+// 闅愭偅 娴佺▼鍒楄〃
+export const findListFlowDanger = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/hiddenDangerLog/findList',
+ method: 'post',
+ data
+ })
+}
+// 杞﹁締 鍒楄〃
+export const getCarsList = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/cars/list',
+ method: 'post',
+ data
+ })
+}
+// 鏌ヨ杞﹁締鍙绾︽椂娈�
+export const carCanReservationDate = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/carCanReservationDate',
+ method: 'get',
+ data
+ })
+}
+// 鏌ヨ杞﹁締 棰勭害璁板綍
+export const carUseBookList = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/carUseBookList',
+ method: 'post',
+ data
+ })
+}
+
+// 鐢ㄨ溅鐢宠鎻愪氦
+export const carUseBookCraete = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/create',
+ method: 'post',
+ data
+ })
+}
+
+// 鏌ヨ杞﹁締 娲捐溅璁板綍
+export const carUseBookPaiche = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/page',
+ method: 'post',
+ data
+ })
+}
+// 鏌ヨ杞﹁締 娲捐溅璁板綍 璇︽儏
+export const carUseBookDetail = (id) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/'+id,
+ method: 'get'
+ })
+}
+// 瀹℃壒
+export const carUseBookAppr = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/approve/approved',
+ method: 'post',
+ data
+ })
+}
+// 鏌ヨ杞﹁締 娲捐溅璁板綍 鎾ら攢鐢宠
+export const carUseBookBack = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/carUseBook/revoke',
+ method: 'get',
+ data
+ })
+}
+// 鏌ヨ杞﹁締 鍙告満鍒楄〃
+export const driveListPost = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/member/driveList',
+ method: 'post',
+ data
+ })
+}
+
+// 浠诲姟涓績 澶撮儴鏁版嵁
+export const stagingHead = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/staging/taskCenterHead',
+ method: 'get',
+ data
+ })
+}
+// 浠诲姟涓績 鍒嗛〉鏁版嵁
+export const stagingTaskPage = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/staging/taskPage',
+ method: 'post',
+ data
+ })
+}
+// 浠诲姟涓績 鏍囪宸茶
+export const signReadTask = (data) => {
+ return http({
+ url: 'visitsAdmin/cloudService/business/staging/signRead',
+ method: 'get',
+ data
+ })
+}
diff --git a/h5/index.html b/h5/index.html
new file mode 100644
index 0000000..c3ff205
--- /dev/null
+++ b/h5/index.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <script>
+ var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
+ CSS.supports('top: constant(a)'))
+ document.write(
+ '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
+ (coverSupport ? ', viewport-fit=cover' : '') + '" />')
+ </script>
+ <title></title>
+ <!--preload-links-->
+ <!--app-context-->
+ </head>
+ <body>
+ <div id="app"><!--app-html--></div>
+ <script type="module" src="/main.js"></script>
+ </body>
+</html>
diff --git a/h5/main.js b/h5/main.js
new file mode 100644
index 0000000..3250c70
--- /dev/null
+++ b/h5/main.js
@@ -0,0 +1,36 @@
+import App from './App'
+import store from './store/index.js'
+import uView from "uview-ui"
+// #ifndef VUE3
+import Vue from 'vue'
+import './uni.promisify.adaptor'
+
+Vue.config.productionTip = false
+Vue.use(uView)
+Vue.prototype.$store = store
+Vue.prototype.showToast = (str) => {
+ setTimeout(() => {
+ uni.showToast({
+ title: str,
+ icon: 'none',
+ duration: 2000
+ })
+ })
+}
+Vue.prototype.$eventBus = new Vue()
+App.mpType = 'app'
+const app = new Vue({
+ ...App
+})
+app.$mount()
+// #endif
+
+// #ifdef VUE3
+import { createSSRApp } from 'vue'
+export function createApp() {
+ const app = createSSRApp(App)
+ return {
+ app
+ }
+}
+// #endif
\ No newline at end of file
diff --git a/h5/manifest.json b/h5/manifest.json
new file mode 100644
index 0000000..cd8f8b1
--- /dev/null
+++ b/h5/manifest.json
@@ -0,0 +1,152 @@
+{
+ "name" : "laborVisitors",
+ "appid" : "__UNI__BCCF400",
+ "description" : "",
+ "versionName" : "1.0.0",
+ "versionCode" : "100",
+ "transformPx" : false,
+ /* 5+App鐗规湁鐩稿叧 */
+ "app-plus" : {
+ "usingComponents" : true,
+ "nvueStyleCompiler" : "uni-app",
+ "compilerVersion" : 3,
+ "splashscreen" : {
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
+ "autoclose" : true,
+ "delay" : 0
+ },
+ /* 妯″潡閰嶇疆 */
+ "modules" : {},
+ /* 搴旂敤鍙戝竷淇℃伅 */
+ "distribute" : {
+ /* android鎵撳寘閰嶇疆 */
+ "android" : {
+ "permissions" : [
+ "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+ "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+ "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+ "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+ "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+ "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+ "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+ "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+ "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+ "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+ "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+ "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+ "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+ "<uses-feature android:name=\"android.hardware.camera\"/>",
+ "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+ ]
+ },
+ /* ios鎵撳寘閰嶇疆 */
+ "ios" : {
+ "dSYMs" : false
+ },
+ /* SDK閰嶇疆 */
+ "sdkConfigs" : {
+ "ad" : {}
+ },
+ "icons" : {
+ "android" : {
+ "hdpi" : "",
+ "xhdpi" : "",
+ "xxhdpi" : "",
+ "xxxhdpi" : ""
+ },
+ "ios" : {
+ "appstore" : "",
+ "ipad" : {
+ "app" : "",
+ "app@2x" : "",
+ "notification" : "",
+ "notification@2x" : "",
+ "proapp@2x" : "",
+ "settings" : "",
+ "settings@2x" : "",
+ "spotlight" : "",
+ "spotlight@2x" : ""
+ },
+ "iphone" : {
+ "app@2x" : "",
+ "app@3x" : "",
+ "notification@2x" : "",
+ "notification@3x" : "",
+ "settings@2x" : "",
+ "settings@3x" : "",
+ "spotlight@2x" : "",
+ "spotlight@3x" : ""
+ }
+ }
+ }
+ }
+ },
+ /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */
+ "quickapp" : {},
+ /* 灏忕▼搴忕壒鏈夌浉鍏� */
+ "mp-weixin" : {
+ "appid" : "wxcd2b89fd2ff065f8",
+ "setting" : {
+ "urlCheck" : false,
+ "es6" : true,
+ "postcss" : true,
+ "minified" : true
+ },
+ "usingComponents" : true,
+ "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ],
+ "permission" : {
+ "scope.userLocation" : {
+ "desc" : "鐢ㄤ簬鑾峰彇鍛ㄨ竟鎴挎簮浣嶇疆"
+ }
+ }
+ },
+ "mp-alipay" : {
+ "usingComponents" : true
+ },
+ "mp-baidu" : {
+ "usingComponents" : true
+ },
+ "mp-toutiao" : {
+ "usingComponents" : true
+ },
+ "uniStatistics" : {
+ "enable" : false
+ },
+ "vueVersion" : "2",
+ "h5" : {
+ "router" : {
+ "mode" : "hash",
+ "base" : "./"
+ },
+ // "base" : "/h5/"
+ "devServer" : {
+ "port" : 8090,
+ "historyApiFallback" : true,
+ "disableHostCheck" : true,
+ "proxy" : {
+ "/gateway_interface" : {
+ // 杩欎釜瀛楁鍚嶉渶涓庝綘閰嶇疆鐨刡asePrefixUrl涓�鑷达紝绯荤粺璇嗗埆鍒板甫鏈�/dev-api璇锋眰鐨勫湴鍧�鏃讹紝浼氬湪鍓嶉潰鎷兼帴涓婁唬鐞嗘湇鍔″櫒鍦板潃
+ // "target" : "http://172.20.10.7:10010", // 浠g悊鏈嶅姟鍣ㄥ煙鍚嶆垨IP鍦板潃
+ // "target" : "http://192.168.0.100:10010", // 浠g悊鏈嶅姟鍣ㄥ煙鍚嶆垨IP鍦板潃
+ // "target" : "http://10.50.250.253:8088/gateway_interface", // 浠g悊鏈嶅姟鍣ㄥ煙鍚嶆垨IP鍦板潃
+ "target" : "http://192.168.0.173/gateway_interface", // 浠g悊鏈嶅姟鍣ㄥ煙鍚嶆垨IP鍦板潃
+ "changeOrigin" : true, // 鍏佽璺ㄥ煙
+ "pathRewrite" : {
+ "^/gateway_interface" : ""
+ }
+ }
+ },
+ "https" : false
+ },
+ "sdkConfigs" : {
+ "maps" : {
+ "amap" : {
+ "key" : "d9a554b1808ce10a12a932ed9b0db1d0",
+ "securityJsCode" : "",
+ "serviceHost" : ""
+ }
+ }
+ }
+ }
+}
diff --git a/h5/pages.json b/h5/pages.json
new file mode 100644
index 0000000..dcfd2f8
--- /dev/null
+++ b/h5/pages.json
@@ -0,0 +1,21 @@
+{
+ "easycom": {
+ "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
+ },
+ "pages": [
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationBarTitleText": "璁垮涓績",
+ "enablePullDownRefresh": false
+ }
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "",
+ "navigationBarBackgroundColor": "#ffffff",
+ "backgroundColor": "#ffffff"
+ },
+ "uniIdRouter": {}
+}
\ No newline at end of file
diff --git a/h5/pages/index/index.vue b/h5/pages/index/index.vue
new file mode 100644
index 0000000..4ca2b92
--- /dev/null
+++ b/h5/pages/index/index.vue
@@ -0,0 +1,52 @@
+<template>
+ <view class="content">
+ <image class="logo" src="/static/logo.png"></image>
+ <view class="text-area">
+ <text class="title">{{title}}</text>
+ </view>
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ title: 'Hello'
+ }
+ },
+ onLoad() {
+
+ },
+ methods: {
+
+ }
+ }
+</script>
+
+<style>
+ .content {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .logo {
+ height: 200rpx;
+ width: 200rpx;
+ margin-top: 200rpx;
+ margin-left: auto;
+ margin-right: auto;
+ margin-bottom: 50rpx;
+ }
+
+ .text-area {
+ display: flex;
+ justify-content: center;
+ }
+
+ .title {
+ font-size: 36rpx;
+ color: #8f8f94;
+ }
+</style>
diff --git a/h5/static/logo.png b/h5/static/logo.png
new file mode 100644
index 0000000..b5771e2
--- /dev/null
+++ b/h5/static/logo.png
Binary files differ
diff --git a/h5/store/index.js b/h5/store/index.js
new file mode 100644
index 0000000..a0a9693
--- /dev/null
+++ b/h5/store/index.js
@@ -0,0 +1,105 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+Vue.use(Vuex)
+
+const openId = uni.getStorageSync('openId')
+const member = uni.getStorageSync('member')
+
+// meeting
+const navHeight = uni.getStorageSync('navHeight')
+const statusbarHeight = uni.getStorageSync('statusbarHeight')
+const height = uni.getStorageSync('height')
+const token = uni.getStorageSync('token')
+const time = uni.getStorageSync('time')
+const userInfo = uni.getStorageSync('userInfo')
+const driverInfo = uni.getStorageSync('driverInfo')
+const sessionKey = uni.getStorageSync('sessionKey')
+
+const store = new Vuex.Store({
+
+ state: {
+ // openId: openId || '061kuG0006hxcS13TT200w9VIp4kuG09',
+ openId: openId || '123123',
+ member: member || null,
+ statusbarHeight: statusbarHeight || '0',
+ navHeight: navHeight || '0',
+ token: token || null,
+ time: time || null,
+ userInfo: userInfo || {},
+ driverInfo: driverInfo || {},
+ height: height || '0',
+ sessionKey: sessionKey || '',
+ primaryColor: '#279baa'
+ },
+
+ mutations: {
+ // 璁剧疆openId
+ setOpenId(state, val) {
+ state.openId = val
+ uni.setStorageSync('openId', val)
+ },
+ // 璁剧疆鐢ㄦ埛淇℃伅
+ setMember(state, val) {
+ state.member = val
+ uni.setStorageSync('member', val)
+ },
+ // 璁剧疆瀵艰埅鏍忛珮搴�
+ setHeight(state, val) {
+ state.navHeight = val.navHeight
+ state.statusbarHeight = val.statusbarHeight
+ state.height = val.height
+ uni.setStorageSync('navHeight', val.navHeight)
+ uni.setStorageSync('statusbarHeight', val.statusbarHeight)
+ uni.setStorageSync('height', val.height)
+ },
+ // 璁剧疆缂撳瓨token
+ setToken(state, token) {
+ state.token = token
+ uni.setStorageSync('token', token)
+ },
+ // 璁剧疆杩囨湡鏃堕棿鎴�
+ setTimeStamp(state, time) {
+ state.time = time
+ uni.setStorageSync('time', time)
+ },
+ // 璁剧疆鐢ㄦ埛淇℃伅
+ setUserInfo(state, obj) {
+ state.userInfo = obj
+ uni.setStorageSync('userInfo', obj)
+ },
+ // 璁剧疆鍙告満淇℃伅
+ setDriverInfo(state, obj) {
+ state.driverInfo = obj
+ uni.setStorageSync('driverInfo', obj)
+ },
+ // 璁剧疆SessionKey
+ setSessionKey(state, val) {
+ state.sessionKey = val
+ uni.setStorageSync('sessionKey', val)
+ },
+ // 娓呯┖鐧诲綍缂撳瓨
+ empty(state) {
+ state.token = ''
+ state.userInfo = {}
+ state.driverInfo = {}
+ uni.removeStorageSync('userInfo')
+ uni.removeStorageSync('driverInfo')
+ uni.removeStorageSync('token')
+ }
+ },
+ actions: {
+ // 鑾峰彇鐘舵�侀珮搴�
+ getHeight(context) {
+ let res = uni.getMenuButtonBoundingClientRect()
+ let status = uni.getSystemInfoSync()
+ var height = res.height
+ let statusbarHeight = status.statusBarHeight
+ let navHeight = res.height + (res.top - statusbarHeight) * 2
+ context.commit('setHeight', { statusbarHeight, navHeight, height })
+ }
+ }
+
+})
+
+export default store
\ No newline at end of file
diff --git a/h5/uni.promisify.adaptor.js b/h5/uni.promisify.adaptor.js
new file mode 100644
index 0000000..47fbce1
--- /dev/null
+++ b/h5/uni.promisify.adaptor.js
@@ -0,0 +1,10 @@
+uni.addInterceptor({
+ returnValue (res) {
+ if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
+ return res;
+ }
+ return new Promise((resolve, reject) => {
+ res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
+ });
+ },
+});
\ No newline at end of file
diff --git a/h5/uni.scss b/h5/uni.scss
new file mode 100644
index 0000000..24dfcb8
--- /dev/null
+++ b/h5/uni.scss
@@ -0,0 +1,76 @@
+/**
+ * 杩欓噷鏄痷ni-app鍐呯疆鐨勫父鐢ㄦ牱寮忓彉閲�
+ *
+ * uni-app 瀹樻柟鎵╁睍鎻掍欢鍙婃彃浠跺競鍦猴紙https://ext.dcloud.net.cn锛変笂寰堝涓夋柟鎻掍欢鍧囦娇鐢ㄤ簡杩欎簺鏍峰紡鍙橀噺
+ * 濡傛灉浣犳槸鎻掍欢寮�鍙戣�咃紝寤鸿浣犱娇鐢╯css棰勫鐞嗭紝骞跺湪鎻掍欢浠g爜涓洿鎺ヤ娇鐢ㄨ繖浜涘彉閲忥紙鏃犻渶 import 杩欎釜鏂囦欢锛夛紝鏂逛究鐢ㄦ埛閫氳繃鎼Н鏈ㄧ殑鏂瑰紡寮�鍙戞暣浣撻鏍间竴鑷寸殑App
+ *
+ */
+
+/**
+ * 濡傛灉浣犳槸App寮�鍙戣�咃紙鎻掍欢浣跨敤鑰咃級锛屼綘鍙互閫氳繃淇敼杩欎簺鍙橀噺鏉ュ畾鍒惰嚜宸辩殑鎻掍欢涓婚锛屽疄鐜拌嚜瀹氫箟涓婚鍔熻兘
+ *
+ * 濡傛灉浣犵殑椤圭洰鍚屾牱浣跨敤浜唖css棰勫鐞嗭紝浣犱篃鍙互鐩存帴鍦ㄤ綘鐨� scss 浠g爜涓娇鐢ㄥ涓嬪彉閲忥紝鍚屾椂鏃犻渶 import 杩欎釜鏂囦欢
+ */
+@import 'uview-ui/theme.scss';
+/* 棰滆壊鍙橀噺 */
+
+/* 琛屼负鐩稿叧棰滆壊 */
+$uni-color-primary: #279baa;
+$uni-color-success: #4cd964;
+$uni-color-warning: #f0ad4e;
+$uni-color-error: #dd524d;
+
+/* 鏂囧瓧鍩烘湰棰滆壊 */
+$uni-text-color:#333;//鍩烘湰鑹�
+$uni-text-color-inverse:#fff;//鍙嶈壊
+$uni-text-color-grey:#999;//杈呭姪鐏拌壊锛屽鍔犺浇鏇村鐨勬彁绀轰俊鎭�
+$uni-text-color-placeholder: #808080;
+$uni-text-color-disable:#c0c0c0;
+
+/* 鑳屾櫙棰滆壊 */
+$uni-bg-color:#ffffff;
+$uni-bg-color-grey:#f8f8f8;
+$uni-bg-color-hover:#f1f1f1;//鐐瑰嚮鐘舵�侀鑹�
+$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//閬僵棰滆壊
+
+/* 杈规棰滆壊 */
+$uni-border-color:#c8c7cc;
+
+/* 灏哄鍙橀噺 */
+
+/* 鏂囧瓧灏哄 */
+$uni-font-size-sm:12px;
+$uni-font-size-base:14px;
+$uni-font-size-lg:16;
+
+/* 鍥剧墖灏哄 */
+$uni-img-size-sm:20px;
+$uni-img-size-base:26px;
+$uni-img-size-lg:40px;
+
+/* Border Radius */
+$uni-border-radius-sm: 2px;
+$uni-border-radius-base: 3px;
+$uni-border-radius-lg: 6px;
+$uni-border-radius-circle: 50%;
+
+/* 姘村钩闂磋窛 */
+$uni-spacing-row-sm: 5px;
+$uni-spacing-row-base: 10px;
+$uni-spacing-row-lg: 15px;
+
+/* 鍨傜洿闂磋窛 */
+$uni-spacing-col-sm: 4px;
+$uni-spacing-col-base: 8px;
+$uni-spacing-col-lg: 12px;
+
+/* 閫忔槑搴� */
+$uni-opacity-disabled: 0.3; // 缁勪欢绂佺敤鎬佺殑閫忔槑搴�
+
+/* 鏂囩珷鍦烘櫙鐩稿叧 */
+$uni-color-title: #2C405A; // 鏂囩珷鏍囬棰滆壊
+$uni-font-size-title:20px;
+$uni-color-subtitle: #555555; // 浜岀骇鏍囬棰滆壊
+$uni-font-size-subtitle:26px;
+$uni-color-paragraph: #3F536E; // 鏂囩珷娈佃惤棰滆壊
+$uni-font-size-paragraph:15px;
diff --git a/h5/utils/config.js b/h5/utils/config.js
new file mode 100644
index 0000000..d6d6ee5
--- /dev/null
+++ b/h5/utils/config.js
@@ -0,0 +1,22 @@
+
+export const baseUrl = 'gateway_interface/'
+// export const baseUrl = 'http://192.168.0.173/gateway_interface/'
+// export const baseUrl = 'http://10.50.250.253:8088/gateway_interface/'
+
+export const uploadAvatar = `${baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`
+export const uploadUrl = `${baseUrl}visitsAdmin/cloudService/public/uploadBatch`
+
+export const statusMap = {
+ 0: '寰呯‘璁�',
+ 1: '绛夊緟绛惧埌',
+ 2: '绛夊緟鍙彿', // 绛夊緟鍙彿
+ 3: '鍏ュ洯绛夊緟',
+ 4: '鏈堝彴绛夊緟', //宸插彨鍙�
+ 5: '浣滀笟涓�',
+ 6: '浣滀笟瀹屾垚',
+ 7: '杞Щ涓�',
+ 8: '寮傚父鎸傝捣',
+ 9: '宸叉巿鏉冪鍥�',
+ 10: '宸茬鍥�',
+ 11: '宸茶繃鍙�',
+}
\ No newline at end of file
diff --git a/h5/utils/http.api.js b/h5/utils/http.api.js
new file mode 100644
index 0000000..471728b
--- /dev/null
+++ b/h5/utils/http.api.js
@@ -0,0 +1,36 @@
+import { baseUrl, uploadUrl } from './config'
+
+const install = (Vue, vm) => {
+
+ uni.$u.http.setConfig((config) => {
+ config.baseURL = baseUrl
+ config.timeout = 60000
+ return config
+ })
+ Vue.prototype.$baseUrl = baseUrl
+ Vue.prototype.$uploadUrl = uploadUrl
+
+ let wxAuthorize = (params = {}) => vm.$u.http.get('visitsAdmin/cloudService/web/visitor/wxAuthorize', { params }) // 璁垮寰俊鎺堟潈
+ let getSystemDictData = (params = {}) => vm.$u.http.get('visitsAdmin/cloudService/web/other/getSystemDictData', { params }) // 鏌ヨ瀛楀吀鍊兼暟鎹�
+ let getProblemsVO = (params = {}) => vm.$u.http.get('visitsAdmin/cloudService/web/problem/getProblemsVO', { params }) // 鑾峰彇棰樼洰鏁版嵁
+ let finishAnswer = (data = {}) => vm.$u.http.post('visitsAdmin/cloudService/web/problem/finishAnswer', data) // 淇敼褰撳墠鐧诲綍鐨勭敤鎴蜂俊鎭�
+ let deviceRoleList = (params = {}) => vm.$u.http.get('visitsAdmin/cloudService/web/other/deviceRoleList', { params }) // 璁惧缁勫垪琛�
+ let getVisitedMember = (data = {}) => vm.$u.http.post('visitsAdmin/cloudService/web/visitor/getVisitedMember', data) // 鏌ヨ琚闂汉淇℃伅
+ let createFk = (data = {}) => vm.$u.http.post('visitsAdmin/cloudService/web/visitor/createFk', data) // 璁垮璁板綍鎻愪氦
+ let detail = (params = {}) => vm.$u.http.get('visitsAdmin/cloudService/web/visitor/detail', { params }) // 璁垮璁板綍璇︽儏
+
+
+
+ vm.$u.api = {
+ wxAuthorize,
+ getSystemDictData,
+ getProblemsVO,
+ finishAnswer,
+ deviceRoleList,
+ getVisitedMember,
+ createFk,
+ detail
+ }
+}
+
+export default { install }
\ No newline at end of file
diff --git a/h5/utils/http.interceptor.js b/h5/utils/http.interceptor.js
new file mode 100644
index 0000000..6d17428
--- /dev/null
+++ b/h5/utils/http.interceptor.js
@@ -0,0 +1,40 @@
+const install = (Vue, vm) => {
+ // 璇锋眰鎷︽埅鍣�
+ uni.$u.http.interceptors.request.use((config) => {
+ uni.showLoading({
+ title: '鍔犺浇涓�',
+ mask: true
+ });
+ // const Headtoken = vm.$store.state.token || ''
+ // if (Headtoken) {
+ // config.header['eva-auth-token'] = Headtoken;
+ // }
+ return config
+ }, config => {
+ return Promise.reject(config)
+ })
+
+ // 鍝嶅簲鎷︽埅鍣�
+ uni.$u.http.interceptors.response.use((response) => {
+ uni.hideLoading();
+ // 鐧诲綍杩囨湡
+ if (response.data.code === 401) {
+ uni.navigateTo({
+ url: '/packageA/loginAgain/loginAgain'
+ });
+ }
+ if (response.data.code !== 200) {
+ uni.showToast({
+ title: response.data.message,
+ icon: "none",
+ duration: 2000
+ });
+ }
+ return response.data;
+ }, (response) => {
+ uni.hideLoading();
+ return Promise.reject(response)
+ })
+}
+
+export default { install }
\ No newline at end of file
diff --git a/h5/utils/login.js b/h5/utils/login.js
new file mode 100644
index 0000000..a9c95b5
--- /dev/null
+++ b/h5/utils/login.js
@@ -0,0 +1,60 @@
+import Vue from 'vue'
+
+// 鍒ゆ柇鏄惁鐧诲綍
+export function isLogin(type) {
+ // console.log('鍒ゆ柇鏄惁鐧诲綍');
+ if (type === 'empty') {
+ loginAction()
+ return
+ }
+ if (!uni.getStorageSync('token')) {
+ console.log('鏈櫥褰�');
+ loginAction()
+ } else {
+ console.log('宸茬櫥褰�');
+ let oldTime = Number(uni.getStorageSync('time'))
+ let s = (new Date().valueOf() - oldTime) / 1000
+ let h = s / 60 / 60
+ console.log(h)
+ if (h >= 120) {
+ console.log('杩囨湡');
+ loginAction()
+ } else {
+ console.log('鏈繃鏈�');
+ Vue.prototype.$reslove()
+ }
+ }
+}
+
+function loginAction() {
+ // console.log('getProvider 鍓�');
+ uni.getProvider({
+ service: 'oauth',
+
+ success: function(res) {
+ // console.log('鑾峰彇鎺堟潈鎴愬姛');
+ uni.login({
+ provider: res.provider,
+ scopes: 'auth_user',
+ success: function(loginRes) {
+
+ // #ifdef MP-WEIXIN
+ // wxLogin({ code: loginRes.code })
+ // .then(resData => {
+ // uni.setStorageSync('token', resData.data.token);
+ // uni.setStorageSync('avatarUrl', resData.data.member.avatarUrl);
+ // uni.setStorageSync('nickName', resData.data.member.nickName);
+ // uni.setStorageSync('realName', resData.data.member.realName);
+ // uni.setStorageSync('gender', resData.data.member.gender);
+ // uni.setStorageSync('mobile', resData.data.member.mobile);
+ // uni.setStorageSync('sessionKey', resData.data.sessionKey);
+ // uni.setStorageSync('time', new Date().valueOf());
+ // Vue.prototype.$reslove()
+ // })
+ // #endif
+ }
+ })
+ }
+ })
+}
+
diff --git a/h5/utils/meetingHttp.js b/h5/utils/meetingHttp.js
new file mode 100644
index 0000000..aacb730
--- /dev/null
+++ b/h5/utils/meetingHttp.js
@@ -0,0 +1,69 @@
+import { baseUrl } from './http.api'
+
+const install = (Vue, vm) => {
+
+ uni.$u.http.setConfig((config) => {
+ config.baseURL = baseUrl
+ config.timeout = 60000
+ return config
+ })
+
+
+ let ordinaryLogin = (params = {}) => uni.$u.http.get('web/account/ordinaryLogin', { params })
+ let wxEmpower = (params = {}) => uni.$u.http.get('web/account/wxEmpower', { params })
+ let editUserInfo = (data = {}) => vm.$u.http.post('web/account/editUserInfo', data)
+ let getUserInfo = (params = {}) => vm.$u.http.get('web/account/getUserInfo', { params })
+ let roomsList = (params = {}) => vm.$u.http.get('web/rooms/roomsList', { params })
+ let getRoomUseTime = (data = {}) => vm.$u.http.post('web/rooms/getRoomUseTime', data)
+ let userPage = (data = {}) => vm.$u.http.post('web/meeting/userPage', data)
+ let getRoomDetail = (params = {}) => vm.$u.http.get('web/rooms/getRoomDetail', { params })
+ let reservationMeeting = (data = {}) => vm.$u.http.post('web/meeting/reservationMeeting', data)
+ let meetingDetail = (params = {}) => vm.$u.http.get('web/meeting/meetingDetail', { params })
+ let getQrCode = (params = {}) => vm.$u.http.get('web/meeting/getQrCode', { params })
+ let reservationCancel = (params = {}) => vm.$u.http.get('web/meeting/reservationCancel', { params })
+ let resetPwd = (data = {}) => vm.$u.http.post('web/account/resetPwd', data)
+ let myMeetingPage = (data = {}) => vm.$u.http.post('web/meeting/myMeetingPage', data)
+ let myRoomsPage = (data = {}) => vm.$u.http.post('web/rooms/myRoomsPage', data)
+ let findNoticePage = (data = {}) => vm.$u.http.post('web/notice/findNoticePage', data)
+ let getMemberDTO = (params = {}) => vm.$u.http.get('web/notice/getMemberDTO', { params })
+ let findNewNotice = (params = {}) => vm.$u.http.get('web/notice/findNewNotice', { params })
+ let monthMeeting = (params = {}) => vm.$u.http.get('web/meeting/monthMeeting', { params })
+ let roomsGetQrCode = (params = {}) => vm.$u.http.get('web/rooms/getQrCode', { params })
+ let getSystemDictData = (params = {}) => vm.$u.http.get('web/util/getSystemDictData', { params })
+ let getQrCodeImg = (params = {}) => vm.$u.http.get('web/meeting/getQrCodeImg', { params })
+ let visitorLogin = (params = {}) => vm.$u.http.get('web/account/visitorLogin', { params })
+ let visitorWxPhone = (data = {}) => vm.$u.http.post('web/account/visitorWxPhone', data)
+ let getNoticeDetail = (params = {}) => vm.$u.http.get('web/notice/getNoticeDetail', { params })
+
+
+
+ vm.$u.api = {
+ ordinaryLogin,
+ wxEmpower,
+ editUserInfo,
+ getUserInfo,
+ roomsList,
+ getRoomUseTime,
+ userPage,
+ getRoomDetail,
+ reservationMeeting,
+ meetingDetail,
+ getQrCode,
+ reservationCancel,
+ resetPwd,
+ myMeetingPage,
+ myRoomsPage,
+ findNoticePage,
+ getMemberDTO,
+ findNewNotice,
+ monthMeeting,
+ roomsGetQrCode,
+ getSystemDictData,
+ getQrCodeImg,
+ visitorLogin,
+ visitorWxPhone,
+ getNoticeDetail
+ }
+}
+
+export default { install }
\ No newline at end of file
diff --git a/h5/utils/qrcode.js b/h5/utils/qrcode.js
new file mode 100644
index 0000000..d1a71f1
--- /dev/null
+++ b/h5/utils/qrcode.js
@@ -0,0 +1,1201 @@
+let QRCode = {};
+(function () {
+ /**
+ * 鑾峰彇鍗曚釜瀛楃鐨剈tf8缂栫爜
+ * unicode BMP骞抽潰绾�65535涓瓧绗�
+ * @param {num} code
+ * return {array}
+ */
+ function unicodeFormat8(code) {
+ // 1 byte
+ var c0, c1, c2;
+ if (code < 128) {
+ return [code];
+ // 2 bytes
+ } else if (code < 2048) {
+ c0 = 192 + (code >> 6);
+ c1 = 128 + (code & 63);
+ return [c0, c1];
+ // 3 bytes
+ } else {
+ c0 = 224 + (code >> 12);
+ c1 = 128 + (code >> 6 & 63);
+ c2 = 128 + (code & 63);
+ return [c0, c1, c2];
+ }
+ }
+ /**
+ * 鑾峰彇瀛楃涓茬殑utf8缂栫爜瀛楄妭涓�
+ * @param {string} string
+ * @return {array}
+ */
+ function getUTF8Bytes(string) {
+ var utf8codes = [];
+ for (var i = 0; i < string.length; i++) {
+ var code = string.charCodeAt(i);
+ var utf8 = unicodeFormat8(code);
+ for (var j = 0; j < utf8.length; j++) {
+ utf8codes.push(utf8[j]);
+ }
+ }
+ return utf8codes;
+ }
+ /**
+ * 浜岀淮鐮佺畻娉曞疄鐜�
+ * @param {string} data 瑕佺紪鐮佺殑淇℃伅瀛楃涓�
+ * @param {num} errorCorrectLevel 绾犻敊绛夌骇
+ */
+ function QRCodeAlg(data, errorCorrectLevel) {
+ this.typeNumber = -1; //鐗堟湰
+ this.errorCorrectLevel = errorCorrectLevel;
+ this.modules = null; //浜岀淮鐭╅樀锛屽瓨鏀炬渶缁堢粨鏋�
+ this.moduleCount = 0; //鐭╅樀澶у皬
+ this.dataCache = null; //鏁版嵁缂撳瓨
+ this.rsBlocks = null; //鐗堟湰鏁版嵁淇℃伅
+ this.totalDataCount = -1; //鍙娇鐢ㄧ殑鏁版嵁閲�
+ this.data = data;
+ this.utf8bytes = getUTF8Bytes(data);
+ this.make();
+ }
+ QRCodeAlg.prototype = {
+ constructor: QRCodeAlg,
+ /**
+ * 鑾峰彇浜岀淮鐮佺煩闃靛ぇ灏�
+ * @return {num} 鐭╅樀澶у皬
+ */
+ getModuleCount: function () {
+ return this.moduleCount;
+ },
+ /**
+ * 缂栫爜
+ */
+ make: function () {
+ this.getRightType();
+ this.dataCache = this.createData();
+ this.createQrcode();
+ },
+ /**
+ * 璁剧疆浜屼綅鐭╅樀鍔熻兘鍥惧舰
+ * @param {bool} test 琛ㄧず鏄惁鍦ㄥ鎵炬渶濂芥帺鑶滈樁娈�
+ * @param {num} maskPattern 鎺╄啘鐨勭増鏈�
+ */
+ makeImpl: function (maskPattern) {
+ this.moduleCount = this.typeNumber * 4 + 17;
+ this.modules = new Array(this.moduleCount);
+ for (var row = 0; row < this.moduleCount; row++) {
+ this.modules[row] = new Array(this.moduleCount);
+ }
+ this.setupPositionProbePattern(0, 0);
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
+ this.setupPositionAdjustPattern();
+ this.setupTimingPattern();
+ this.setupTypeInfo(true, maskPattern);
+ if (this.typeNumber >= 7) {
+ this.setupTypeNumber(true);
+ }
+ this.mapData(this.dataCache, maskPattern);
+ },
+ /**
+ * 璁剧疆浜岀淮鐮佺殑浣嶇疆鎺㈡祴鍥惧舰
+ * @param {num} row 鎺㈡祴鍥惧舰鐨勪腑蹇冩í鍧愭爣
+ * @param {num} col 鎺㈡祴鍥惧舰鐨勪腑蹇冪旱鍧愭爣
+ */
+ setupPositionProbePattern: function (row, col) {
+ for (var r = -1; r <= 7; r++) {
+ if (row + r <= -1 || this.moduleCount <= row + r) continue;
+ for (var c = -1; c <= 7; c++) {
+ if (col + c <= -1 || this.moduleCount <= col + c) continue;
+ if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) {
+ this.modules[row + r][col + c] = true;
+ } else {
+ this.modules[row + r][col + c] = false;
+ }
+ }
+ }
+ },
+ /**
+ * 鍒涘缓浜岀淮鐮�
+ * @return {[type]} [description]
+ */
+ createQrcode: function () {
+ var minLostPoint = 0;
+ var pattern = 0;
+ var bestModules = null;
+ for (var i = 0; i < 8; i++) {
+ this.makeImpl(i);
+ var lostPoint = QRUtil.getLostPoint(this);
+ if (i == 0 || minLostPoint > lostPoint) {
+ minLostPoint = lostPoint;
+ pattern = i;
+ bestModules = this.modules;
+ }
+ }
+ this.modules = bestModules;
+ this.setupTypeInfo(false, pattern);
+ if (this.typeNumber >= 7) {
+ this.setupTypeNumber(false);
+ }
+ },
+ /**
+ * 璁剧疆瀹氫綅鍥惧舰
+ * @return {[type]} [description]
+ */
+ setupTimingPattern: function () {
+ for (var r = 8; r < this.moduleCount - 8; r++) {
+ if (this.modules[r][6] != null) {
+ continue;
+ }
+ this.modules[r][6] = (r % 2 == 0);
+ if (this.modules[6][r] != null) {
+ continue;
+ }
+ this.modules[6][r] = (r % 2 == 0);
+ }
+ },
+ /**
+ * 璁剧疆鐭鍥惧舰
+ * @return {[type]} [description]
+ */
+ setupPositionAdjustPattern: function () {
+ var pos = QRUtil.getPatternPosition(this.typeNumber);
+ for (var i = 0; i < pos.length; i++) {
+ for (var j = 0; j < pos.length; j++) {
+ var row = pos[i];
+ var col = pos[j];
+ if (this.modules[row][col] != null) {
+ continue;
+ }
+ for (var r = -2; r <= 2; r++) {
+ for (var c = -2; c <= 2; c++) {
+ if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) {
+ this.modules[row + r][col + c] = true;
+ } else {
+ this.modules[row + r][col + c] = false;
+ }
+ }
+ }
+ }
+ }
+ },
+ /**
+ * 璁剧疆鐗堟湰淇℃伅锛�7浠ヤ笂鐗堟湰鎵嶆湁锛�
+ * @param {bool} test 鏄惁澶勪簬鍒ゆ柇鏈�浣虫帺鑶滈樁娈�
+ * @return {[type]} [description]
+ */
+ setupTypeNumber: function (test) {
+ var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
+ for (var i = 0; i < 18; i++) {
+ var mod = (!test && ((bits >> i) & 1) == 1);
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+ this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+ }
+ },
+ /**
+ * 璁剧疆鏍煎紡淇℃伅锛堢籂閿欑瓑绾у拰鎺╄啘鐗堟湰锛�
+ * @param {bool} test
+ * @param {num} maskPattern 鎺╄啘鐗堟湰
+ * @return {}
+ */
+ setupTypeInfo: function (test, maskPattern) {
+ var data = (QRErrorCorrectLevel[this.errorCorrectLevel] << 3) | maskPattern;
+ var bits = QRUtil.getBCHTypeInfo(data);
+ // vertical
+ for (var i = 0; i < 15; i++) {
+ var mod = (!test && ((bits >> i) & 1) == 1);
+ if (i < 6) {
+ this.modules[i][8] = mod;
+ } else if (i < 8) {
+ this.modules[i + 1][8] = mod;
+ } else {
+ this.modules[this.moduleCount - 15 + i][8] = mod;
+ }
+ // horizontal
+ var mod = (!test && ((bits >> i) & 1) == 1);
+ if (i < 8) {
+ this.modules[8][this.moduleCount - i - 1] = mod;
+ } else if (i < 9) {
+ this.modules[8][15 - i - 1 + 1] = mod;
+ } else {
+ this.modules[8][15 - i - 1] = mod;
+ }
+ }
+ // fixed module
+ this.modules[this.moduleCount - 8][8] = (!test);
+ },
+ /**
+ * 鏁版嵁缂栫爜
+ * @return {[type]} [description]
+ */
+ createData: function () {
+ var buffer = new QRBitBuffer();
+ var lengthBits = this.typeNumber > 9 ? 16 : 8;
+ buffer.put(4, 4); //娣诲姞妯″紡
+ buffer.put(this.utf8bytes.length, lengthBits);
+ for (var i = 0, l = this.utf8bytes.length; i < l; i++) {
+ buffer.put(this.utf8bytes[i], 8);
+ }
+ if (buffer.length + 4 <= this.totalDataCount * 8) {
+ buffer.put(0, 4);
+ }
+ // padding
+ while (buffer.length % 8 != 0) {
+ buffer.putBit(false);
+ }
+ // padding
+ while (true) {
+ if (buffer.length >= this.totalDataCount * 8) {
+ break;
+ }
+ buffer.put(QRCodeAlg.PAD0, 8);
+ if (buffer.length >= this.totalDataCount * 8) {
+ break;
+ }
+ buffer.put(QRCodeAlg.PAD1, 8);
+ }
+ return this.createBytes(buffer);
+ },
+ /**
+ * 绾犻敊鐮佺紪鐮�
+ * @param {buffer} buffer 鏁版嵁缂栫爜
+ * @return {[type]}
+ */
+ createBytes: function (buffer) {
+ var offset = 0;
+ var maxDcCount = 0;
+ var maxEcCount = 0;
+ var length = this.rsBlock.length / 3;
+ var rsBlocks = new Array();
+ for (var i = 0; i < length; i++) {
+ var count = this.rsBlock[i * 3 + 0];
+ var totalCount = this.rsBlock[i * 3 + 1];
+ var dataCount = this.rsBlock[i * 3 + 2];
+ for (var j = 0; j < count; j++) {
+ rsBlocks.push([dataCount, totalCount]);
+ }
+ }
+ var dcdata = new Array(rsBlocks.length);
+ var ecdata = new Array(rsBlocks.length);
+ for (var r = 0; r < rsBlocks.length; r++) {
+ var dcCount = rsBlocks[r][0];
+ var ecCount = rsBlocks[r][1] - dcCount;
+ maxDcCount = Math.max(maxDcCount, dcCount);
+ maxEcCount = Math.max(maxEcCount, ecCount);
+ dcdata[r] = new Array(dcCount);
+ for (var i = 0; i < dcdata[r].length; i++) {
+ dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+ }
+ offset += dcCount;
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
+ var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
+ var modPoly = rawPoly.mod(rsPoly);
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
+ for (var i = 0; i < ecdata[r].length; i++) {
+ var modIndex = i + modPoly.getLength() - ecdata[r].length;
+ ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
+ }
+ }
+ var data = new Array(this.totalDataCount);
+ var index = 0;
+ for (var i = 0; i < maxDcCount; i++) {
+ for (var r = 0; r < rsBlocks.length; r++) {
+ if (i < dcdata[r].length) {
+ data[index++] = dcdata[r][i];
+ }
+ }
+ }
+ for (var i = 0; i < maxEcCount; i++) {
+ for (var r = 0; r < rsBlocks.length; r++) {
+ if (i < ecdata[r].length) {
+ data[index++] = ecdata[r][i];
+ }
+ }
+ }
+ return data;
+
+ },
+ /**
+ * 甯冪疆妯″潡锛屾瀯寤烘渶缁堜俊鎭�
+ * @param {} data
+ * @param {} maskPattern
+ * @return {}
+ */
+ mapData: function (data, maskPattern) {
+ var inc = -1;
+ var row = this.moduleCount - 1;
+ var bitIndex = 7;
+ var byteIndex = 0;
+ for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+ if (col == 6) col--;
+ while (true) {
+ for (var c = 0; c < 2; c++) {
+ if (this.modules[row][col - c] == null) {
+ var dark = false;
+ if (byteIndex < data.length) {
+ dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
+ }
+ var mask = QRUtil.getMask(maskPattern, row, col - c);
+ if (mask) {
+ dark = !dark;
+ }
+ this.modules[row][col - c] = dark;
+ bitIndex--;
+ if (bitIndex == -1) {
+ byteIndex++;
+ bitIndex = 7;
+ }
+ }
+ }
+ row += inc;
+ if (row < 0 || this.moduleCount <= row) {
+ row -= inc;
+ inc = -inc;
+ break;
+ }
+ }
+ }
+ }
+ };
+ /**
+ * 濉厖瀛楁
+ */
+ QRCodeAlg.PAD0 = 0xEC;
+ QRCodeAlg.PAD1 = 0x11;
+ //---------------------------------------------------------------------
+ // 绾犻敊绛夌骇瀵瑰簲鐨勭紪鐮�
+ //---------------------------------------------------------------------
+ var QRErrorCorrectLevel = [1, 0, 3, 2];
+ //---------------------------------------------------------------------
+ // 鎺╄啘鐗堟湰
+ //---------------------------------------------------------------------
+ var QRMaskPattern = {
+ PATTERN000: 0,
+ PATTERN001: 1,
+ PATTERN010: 2,
+ PATTERN011: 3,
+ PATTERN100: 4,
+ PATTERN101: 5,
+ PATTERN110: 6,
+ PATTERN111: 7
+ };
+ //---------------------------------------------------------------------
+ // 宸ュ叿绫�
+ //---------------------------------------------------------------------
+ var QRUtil = {
+ /*
+ 姣忎釜鐗堟湰鐭鍥惧舰鐨勪綅缃�
+ */
+ PATTERN_POSITION_TABLE: [
+ [],
+ [6, 18],
+ [6, 22],
+ [6, 26],
+ [6, 30],
+ [6, 34],
+ [6, 22, 38],
+ [6, 24, 42],
+ [6, 26, 46],
+ [6, 28, 50],
+ [6, 30, 54],
+ [6, 32, 58],
+ [6, 34, 62],
+ [6, 26, 46, 66],
+ [6, 26, 48, 70],
+ [6, 26, 50, 74],
+ [6, 30, 54, 78],
+ [6, 30, 56, 82],
+ [6, 30, 58, 86],
+ [6, 34, 62, 90],
+ [6, 28, 50, 72, 94],
+ [6, 26, 50, 74, 98],
+ [6, 30, 54, 78, 102],
+ [6, 28, 54, 80, 106],
+ [6, 32, 58, 84, 110],
+ [6, 30, 58, 86, 114],
+ [6, 34, 62, 90, 118],
+ [6, 26, 50, 74, 98, 122],
+ [6, 30, 54, 78, 102, 126],
+ [6, 26, 52, 78, 104, 130],
+ [6, 30, 56, 82, 108, 134],
+ [6, 34, 60, 86, 112, 138],
+ [6, 30, 58, 86, 114, 142],
+ [6, 34, 62, 90, 118, 146],
+ [6, 30, 54, 78, 102, 126, 150],
+ [6, 24, 50, 76, 102, 128, 154],
+ [6, 28, 54, 80, 106, 132, 158],
+ [6, 32, 58, 84, 110, 136, 162],
+ [6, 26, 54, 82, 110, 138, 166],
+ [6, 30, 58, 86, 114, 142, 170]
+ ],
+ G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+ G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+ G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+ /*
+ BCH缂栫爜鏍煎紡淇℃伅
+ */
+ getBCHTypeInfo: function (data) {
+ var d = data << 10;
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+ d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)));
+ }
+ return ((data << 10) | d) ^ QRUtil.G15_MASK;
+ },
+ /*
+ BCH缂栫爜鐗堟湰淇℃伅
+ */
+ getBCHTypeNumber: function (data) {
+ var d = data << 12;
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+ d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)));
+ }
+ return (data << 12) | d;
+ },
+ /*
+ 鑾峰彇BCH浣嶄俊鎭�
+ */
+ getBCHDigit: function (data) {
+ var digit = 0;
+ while (data != 0) {
+ digit++;
+ data >>>= 1;
+ }
+ return digit;
+ },
+ /*
+ 鑾峰彇鐗堟湰瀵瑰簲鐨勭煫姝e浘褰綅缃�
+ */
+ getPatternPosition: function (typeNumber) {
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+ },
+ /*
+ 鎺╄啘绠楁硶
+ */
+ getMask: function (maskPattern, i, j) {
+ switch (maskPattern) {
+ case QRMaskPattern.PATTERN000:
+ return (i + j) % 2 == 0;
+ case QRMaskPattern.PATTERN001:
+ return i % 2 == 0;
+ case QRMaskPattern.PATTERN010:
+ return j % 3 == 0;
+ case QRMaskPattern.PATTERN011:
+ return (i + j) % 3 == 0;
+ case QRMaskPattern.PATTERN100:
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
+ case QRMaskPattern.PATTERN101:
+ return (i * j) % 2 + (i * j) % 3 == 0;
+ case QRMaskPattern.PATTERN110:
+ return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
+ case QRMaskPattern.PATTERN111:
+ return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
+ default:
+ throw new Error("bad maskPattern:" + maskPattern);
+ }
+ },
+ /*
+ 鑾峰彇RS鐨勭籂閿欏椤瑰紡
+ */
+ getErrorCorrectPolynomial: function (errorCorrectLength) {
+ var a = new QRPolynomial([1], 0);
+ for (var i = 0; i < errorCorrectLength; i++) {
+ a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
+ }
+ return a;
+ },
+ /*
+ 鑾峰彇璇勪环
+ */
+ getLostPoint: function (qrCode) {
+ var moduleCount = qrCode.getModuleCount(),
+ lostPoint = 0,
+ darkCount = 0;
+ for (var row = 0; row < moduleCount; row++) {
+ var sameCount = 0;
+ var head = qrCode.modules[row][0];
+ for (var col = 0; col < moduleCount; col++) {
+ var current = qrCode.modules[row][col];
+ //level 3 璇勪环
+ if (col < moduleCount - 6) {
+ if (current && !qrCode.modules[row][col + 1] && qrCode.modules[row][col + 2] && qrCode.modules[row][col + 3] && qrCode.modules[row][col + 4] && !qrCode.modules[row][col + 5] && qrCode.modules[row][col + 6]) {
+ if (col < moduleCount - 10) {
+ if (qrCode.modules[row][col + 7] && qrCode.modules[row][col + 8] && qrCode.modules[row][col + 9] && qrCode.modules[row][col + 10]) {
+ lostPoint += 40;
+ }
+ } else if (col > 3) {
+ if (qrCode.modules[row][col - 1] && qrCode.modules[row][col - 2] && qrCode.modules[row][col - 3] && qrCode.modules[row][col - 4]) {
+ lostPoint += 40;
+ }
+ }
+ }
+ }
+ //level 2 璇勪环
+ if ((row < moduleCount - 1) && (col < moduleCount - 1)) {
+ var count = 0;
+ if (current) count++;
+ if (qrCode.modules[row + 1][col]) count++;
+ if (qrCode.modules[row][col + 1]) count++;
+ if (qrCode.modules[row + 1][col + 1]) count++;
+ if (count == 0 || count == 4) {
+ lostPoint += 3;
+ }
+ }
+ //level 1 璇勪环
+ if (head ^ current) {
+ sameCount++;
+ } else {
+ head = current;
+ if (sameCount >= 5) {
+ lostPoint += (3 + sameCount - 5);
+ }
+ sameCount = 1;
+ }
+ //level 4 璇勪环
+ if (current) {
+ darkCount++;
+ }
+ }
+ }
+ for (var col = 0; col < moduleCount; col++) {
+ var sameCount = 0;
+ var head = qrCode.modules[0][col];
+ for (var row = 0; row < moduleCount; row++) {
+ var current = qrCode.modules[row][col];
+ //level 3 璇勪环
+ if (row < moduleCount - 6) {
+ if (current && !qrCode.modules[row + 1][col] && qrCode.modules[row + 2][col] && qrCode.modules[row + 3][col] && qrCode.modules[row + 4][col] && !qrCode.modules[row + 5][col] && qrCode.modules[row + 6][col]) {
+ if (row < moduleCount - 10) {
+ if (qrCode.modules[row + 7][col] && qrCode.modules[row + 8][col] && qrCode.modules[row + 9][col] && qrCode.modules[row + 10][col]) {
+ lostPoint += 40;
+ }
+ } else if (row > 3) {
+ if (qrCode.modules[row - 1][col] && qrCode.modules[row - 2][col] && qrCode.modules[row - 3][col] && qrCode.modules[row - 4][col]) {
+ lostPoint += 40;
+ }
+ }
+ }
+ }
+ //level 1 璇勪环
+ if (head ^ current) {
+ sameCount++;
+ } else {
+ head = current;
+ if (sameCount >= 5) {
+ lostPoint += (3 + sameCount - 5);
+ }
+ sameCount = 1;
+ }
+ }
+ }
+ // LEVEL4
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+ lostPoint += ratio * 10;
+ return lostPoint;
+ }
+
+ };
+ //---------------------------------------------------------------------
+ // QRMath浣跨敤鐨勬暟瀛﹀伐鍏�
+ //---------------------------------------------------------------------
+ var QRMath = {
+ /*
+ 灏唍杞寲涓篴^m
+ */
+ glog: function (n) {
+ if (n < 1) {
+ throw new Error("glog(" + n + ")");
+ }
+ return QRMath.LOG_TABLE[n];
+ },
+ /*
+ 灏哸^m杞寲涓簄
+ */
+ gexp: function (n) {
+ while (n < 0) {
+ n += 255;
+ }
+ while (n >= 256) {
+ n -= 255;
+ }
+ return QRMath.EXP_TABLE[n];
+ },
+ EXP_TABLE: new Array(256),
+ LOG_TABLE: new Array(256)
+
+ };
+ for (var i = 0; i < 8; i++) {
+ QRMath.EXP_TABLE[i] = 1 << i;
+ }
+ for (var i = 8; i < 256; i++) {
+ QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
+ }
+ for (var i = 0; i < 255; i++) {
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+ }
+ //---------------------------------------------------------------------
+ // QRPolynomial 澶氶」寮�
+ //---------------------------------------------------------------------
+ /**
+ * 澶氶」寮忕被
+ * @param {Array} num 绯绘暟
+ * @param {num} shift a^shift
+ */
+ function QRPolynomial(num, shift) {
+ if (num.length == undefined) {
+ throw new Error(num.length + "/" + shift);
+ }
+ var offset = 0;
+ while (offset < num.length && num[offset] == 0) {
+ offset++;
+ }
+ this.num = new Array(num.length - offset + shift);
+ for (var i = 0; i < num.length - offset; i++) {
+ this.num[i] = num[i + offset];
+ }
+ }
+ QRPolynomial.prototype = {
+ get: function (index) {
+ return this.num[index];
+ },
+ getLength: function () {
+ return this.num.length;
+ },
+ /**
+ * 澶氶」寮忎箻娉�
+ * @param {QRPolynomial} e 琚箻澶氶」寮�
+ * @return {[type]} [description]
+ */
+ multiply: function (e) {
+ var num = new Array(this.getLength() + e.getLength() - 1);
+ for (var i = 0; i < this.getLength(); i++) {
+ for (var j = 0; j < e.getLength(); j++) {
+ num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
+ }
+ }
+ return new QRPolynomial(num, 0);
+ },
+ /**
+ * 澶氶」寮忔ā杩愮畻
+ * @param {QRPolynomial} e 妯″椤瑰紡
+ * @return {}
+ */
+ mod: function (e) {
+ var tl = this.getLength(),
+ el = e.getLength();
+ if (tl - el < 0) {
+ return this;
+ }
+ var num = new Array(tl);
+ for (var i = 0; i < tl; i++) {
+ num[i] = this.get(i);
+ }
+ while (num.length >= el) {
+ var ratio = QRMath.glog(num[0]) - QRMath.glog(e.get(0));
+
+ for (var i = 0; i < e.getLength(); i++) {
+ num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio);
+ }
+ while (num[0] == 0) {
+ num.shift();
+ }
+ }
+ return new QRPolynomial(num, 0);
+ }
+ };
+
+ //---------------------------------------------------------------------
+ // RS_BLOCK_TABLE
+ //---------------------------------------------------------------------
+ /*
+ 浜岀淮鐮佸悇涓増鏈俊鎭痆鍧楁暟, 姣忓潡涓殑鏁版嵁鍧楁暟, 姣忓潡涓殑淇℃伅鍧楁暟]
+ */
+ var RS_BLOCK_TABLE = [
+ // L
+ // M
+ // Q
+ // H
+ // 1
+ [1, 26, 19],
+ [1, 26, 16],
+ [1, 26, 13],
+ [1, 26, 9],
+
+ // 2
+ [1, 44, 34],
+ [1, 44, 28],
+ [1, 44, 22],
+ [1, 44, 16],
+
+ // 3
+ [1, 70, 55],
+ [1, 70, 44],
+ [2, 35, 17],
+ [2, 35, 13],
+
+ // 4
+ [1, 100, 80],
+ [2, 50, 32],
+ [2, 50, 24],
+ [4, 25, 9],
+
+ // 5
+ [1, 134, 108],
+ [2, 67, 43],
+ [2, 33, 15, 2, 34, 16],
+ [2, 33, 11, 2, 34, 12],
+
+ // 6
+ [2, 86, 68],
+ [4, 43, 27],
+ [4, 43, 19],
+ [4, 43, 15],
+
+ // 7
+ [2, 98, 78],
+ [4, 49, 31],
+ [2, 32, 14, 4, 33, 15],
+ [4, 39, 13, 1, 40, 14],
+
+ // 8
+ [2, 121, 97],
+ [2, 60, 38, 2, 61, 39],
+ [4, 40, 18, 2, 41, 19],
+ [4, 40, 14, 2, 41, 15],
+
+ // 9
+ [2, 146, 116],
+ [3, 58, 36, 2, 59, 37],
+ [4, 36, 16, 4, 37, 17],
+ [4, 36, 12, 4, 37, 13],
+
+ // 10
+ [2, 86, 68, 2, 87, 69],
+ [4, 69, 43, 1, 70, 44],
+ [6, 43, 19, 2, 44, 20],
+ [6, 43, 15, 2, 44, 16],
+
+ // 11
+ [4, 101, 81],
+ [1, 80, 50, 4, 81, 51],
+ [4, 50, 22, 4, 51, 23],
+ [3, 36, 12, 8, 37, 13],
+
+ // 12
+ [2, 116, 92, 2, 117, 93],
+ [6, 58, 36, 2, 59, 37],
+ [4, 46, 20, 6, 47, 21],
+ [7, 42, 14, 4, 43, 15],
+
+ // 13
+ [4, 133, 107],
+ [8, 59, 37, 1, 60, 38],
+ [8, 44, 20, 4, 45, 21],
+ [12, 33, 11, 4, 34, 12],
+
+ // 14
+ [3, 145, 115, 1, 146, 116],
+ [4, 64, 40, 5, 65, 41],
+ [11, 36, 16, 5, 37, 17],
+ [11, 36, 12, 5, 37, 13],
+
+ // 15
+ [5, 109, 87, 1, 110, 88],
+ [5, 65, 41, 5, 66, 42],
+ [5, 54, 24, 7, 55, 25],
+ [11, 36, 12],
+
+ // 16
+ [5, 122, 98, 1, 123, 99],
+ [7, 73, 45, 3, 74, 46],
+ [15, 43, 19, 2, 44, 20],
+ [3, 45, 15, 13, 46, 16],
+
+ // 17
+ [1, 135, 107, 5, 136, 108],
+ [10, 74, 46, 1, 75, 47],
+ [1, 50, 22, 15, 51, 23],
+ [2, 42, 14, 17, 43, 15],
+
+ // 18
+ [5, 150, 120, 1, 151, 121],
+ [9, 69, 43, 4, 70, 44],
+ [17, 50, 22, 1, 51, 23],
+ [2, 42, 14, 19, 43, 15],
+
+ // 19
+ [3, 141, 113, 4, 142, 114],
+ [3, 70, 44, 11, 71, 45],
+ [17, 47, 21, 4, 48, 22],
+ [9, 39, 13, 16, 40, 14],
+
+ // 20
+ [3, 135, 107, 5, 136, 108],
+ [3, 67, 41, 13, 68, 42],
+ [15, 54, 24, 5, 55, 25],
+ [15, 43, 15, 10, 44, 16],
+
+ // 21
+ [4, 144, 116, 4, 145, 117],
+ [17, 68, 42],
+ [17, 50, 22, 6, 51, 23],
+ [19, 46, 16, 6, 47, 17],
+
+ // 22
+ [2, 139, 111, 7, 140, 112],
+ [17, 74, 46],
+ [7, 54, 24, 16, 55, 25],
+ [34, 37, 13],
+
+ // 23
+ [4, 151, 121, 5, 152, 122],
+ [4, 75, 47, 14, 76, 48],
+ [11, 54, 24, 14, 55, 25],
+ [16, 45, 15, 14, 46, 16],
+
+ // 24
+ [6, 147, 117, 4, 148, 118],
+ [6, 73, 45, 14, 74, 46],
+ [11, 54, 24, 16, 55, 25],
+ [30, 46, 16, 2, 47, 17],
+
+ // 25
+ [8, 132, 106, 4, 133, 107],
+ [8, 75, 47, 13, 76, 48],
+ [7, 54, 24, 22, 55, 25],
+ [22, 45, 15, 13, 46, 16],
+
+ // 26
+ [10, 142, 114, 2, 143, 115],
+ [19, 74, 46, 4, 75, 47],
+ [28, 50, 22, 6, 51, 23],
+ [33, 46, 16, 4, 47, 17],
+
+ // 27
+ [8, 152, 122, 4, 153, 123],
+ [22, 73, 45, 3, 74, 46],
+ [8, 53, 23, 26, 54, 24],
+ [12, 45, 15, 28, 46, 16],
+
+ // 28
+ [3, 147, 117, 10, 148, 118],
+ [3, 73, 45, 23, 74, 46],
+ [4, 54, 24, 31, 55, 25],
+ [11, 45, 15, 31, 46, 16],
+
+ // 29
+ [7, 146, 116, 7, 147, 117],
+ [21, 73, 45, 7, 74, 46],
+ [1, 53, 23, 37, 54, 24],
+ [19, 45, 15, 26, 46, 16],
+
+ // 30
+ [5, 145, 115, 10, 146, 116],
+ [19, 75, 47, 10, 76, 48],
+ [15, 54, 24, 25, 55, 25],
+ [23, 45, 15, 25, 46, 16],
+
+ // 31
+ [13, 145, 115, 3, 146, 116],
+ [2, 74, 46, 29, 75, 47],
+ [42, 54, 24, 1, 55, 25],
+ [23, 45, 15, 28, 46, 16],
+
+ // 32
+ [17, 145, 115],
+ [10, 74, 46, 23, 75, 47],
+ [10, 54, 24, 35, 55, 25],
+ [19, 45, 15, 35, 46, 16],
+
+ // 33
+ [17, 145, 115, 1, 146, 116],
+ [14, 74, 46, 21, 75, 47],
+ [29, 54, 24, 19, 55, 25],
+ [11, 45, 15, 46, 46, 16],
+
+ // 34
+ [13, 145, 115, 6, 146, 116],
+ [14, 74, 46, 23, 75, 47],
+ [44, 54, 24, 7, 55, 25],
+ [59, 46, 16, 1, 47, 17],
+
+ // 35
+ [12, 151, 121, 7, 152, 122],
+ [12, 75, 47, 26, 76, 48],
+ [39, 54, 24, 14, 55, 25],
+ [22, 45, 15, 41, 46, 16],
+
+ // 36
+ [6, 151, 121, 14, 152, 122],
+ [6, 75, 47, 34, 76, 48],
+ [46, 54, 24, 10, 55, 25],
+ [2, 45, 15, 64, 46, 16],
+
+ // 37
+ [17, 152, 122, 4, 153, 123],
+ [29, 74, 46, 14, 75, 47],
+ [49, 54, 24, 10, 55, 25],
+ [24, 45, 15, 46, 46, 16],
+
+ // 38
+ [4, 152, 122, 18, 153, 123],
+ [13, 74, 46, 32, 75, 47],
+ [48, 54, 24, 14, 55, 25],
+ [42, 45, 15, 32, 46, 16],
+
+ // 39
+ [20, 147, 117, 4, 148, 118],
+ [40, 75, 47, 7, 76, 48],
+ [43, 54, 24, 22, 55, 25],
+ [10, 45, 15, 67, 46, 16],
+
+ // 40
+ [19, 148, 118, 6, 149, 119],
+ [18, 75, 47, 31, 76, 48],
+ [34, 54, 24, 34, 55, 25],
+ [20, 45, 15, 61, 46, 16]
+ ];
+
+ /**
+ * 鏍规嵁鏁版嵁鑾峰彇瀵瑰簲鐗堟湰
+ * @return {[type]} [description]
+ */
+ QRCodeAlg.prototype.getRightType = function () {
+ for (var typeNumber = 1; typeNumber < 41; typeNumber++) {
+ var rsBlock = RS_BLOCK_TABLE[(typeNumber - 1) * 4 + this.errorCorrectLevel];
+ if (rsBlock == undefined) {
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + this.errorCorrectLevel);
+ }
+ var length = rsBlock.length / 3;
+ var totalDataCount = 0;
+ for (var i = 0; i < length; i++) {
+ var count = rsBlock[i * 3 + 0];
+ var dataCount = rsBlock[i * 3 + 2];
+ totalDataCount += dataCount * count;
+ }
+ var lengthBytes = typeNumber > 9 ? 2 : 1;
+ if (this.utf8bytes.length + lengthBytes < totalDataCount || typeNumber == 40) {
+ this.typeNumber = typeNumber;
+ this.rsBlock = rsBlock;
+ this.totalDataCount = totalDataCount;
+ break;
+ }
+ }
+ };
+
+ //---------------------------------------------------------------------
+ // QRBitBuffer
+ //---------------------------------------------------------------------
+ function QRBitBuffer() {
+ this.buffer = new Array();
+ this.length = 0;
+ }
+ QRBitBuffer.prototype = {
+ get: function (index) {
+ var bufIndex = Math.floor(index / 8);
+ return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1);
+ },
+ put: function (num, length) {
+ for (var i = 0; i < length; i++) {
+ this.putBit(((num >>> (length - i - 1)) & 1));
+ }
+ },
+ putBit: function (bit) {
+ var bufIndex = Math.floor(this.length / 8);
+ if (this.buffer.length <= bufIndex) {
+ this.buffer.push(0);
+ }
+ if (bit) {
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
+ }
+ this.length++;
+ }
+ };
+
+
+
+ // xzedit
+ let qrcodeAlgObjCache = [];
+ /**
+ * 浜岀淮鐮佹瀯閫犲嚱鏁帮紝涓昏鐢ㄤ簬缁樺埗
+ * @param {鍙傛暟鍒楄〃} opt 浼犻�掑弬鏁�
+ * @return {}
+ */
+ QRCode = function (opt) {
+ //璁剧疆榛樿鍙傛暟
+ this.options = {
+ text: '',
+ size: 256,
+ correctLevel: 3,
+ background: '#ffffff',
+ foreground: '#000000',
+ pdground: '#000000',
+ image: '',
+ imageSize: 30,
+ canvasId: opt.canvasId,
+ context: opt.context,
+ usingComponents: opt.usingComponents,
+ showLoading: opt.showLoading,
+ loadingText: opt.loadingText,
+ };
+ if (typeof opt === 'string') { // 鍙紪鐮丄SCII瀛楃涓�
+ opt = {
+ text: opt
+ };
+ }
+ if (opt) {
+ for (var i in opt) {
+ this.options[i] = opt[i];
+ }
+ }
+ //浣跨敤QRCodeAlg鍒涘缓浜岀淮鐮佺粨鏋�
+ var qrCodeAlg = null;
+ for (var i = 0, l = qrcodeAlgObjCache.length; i < l; i++) {
+ if (qrcodeAlgObjCache[i].text == this.options.text && qrcodeAlgObjCache[i].text.correctLevel == this.options.correctLevel) {
+ qrCodeAlg = qrcodeAlgObjCache[i].obj;
+ break;
+ }
+ }
+ if (i == l) {
+ qrCodeAlg = new QRCodeAlg(this.options.text, this.options.correctLevel);
+ qrcodeAlgObjCache.push({
+ text: this.options.text,
+ correctLevel: this.options.correctLevel,
+ obj: qrCodeAlg
+ });
+ }
+ /**
+ * 璁$畻鐭╅樀鐐圭殑鍓嶆櫙鑹�
+ * @param {Obj} config
+ * @param {Number} config.row 鐐箈鍧愭爣
+ * @param {Number} config.col 鐐箉鍧愭爣
+ * @param {Number} config.count 鐭╅樀澶у皬
+ * @param {Number} config.options 缁勪欢鐨刼ptions
+ * @return {String}
+ */
+ let getForeGround = function (config) {
+ var options = config.options;
+ if (options.pdground && (
+ (config.row > 1 && config.row < 5 && config.col > 1 && config.col < 5) ||
+ (config.row > (config.count - 6) && config.row < (config.count - 2) && config.col > 1 && config.col < 5) ||
+ (config.row > 1 && config.row < 5 && config.col > (config.count - 6) && config.col < (config.count - 2))
+ )) {
+ return options.pdground;
+ }
+ return options.foreground;
+ }
+ // 鍒涘缓canvas
+ let createCanvas = function (options) {
+ if (options.showLoading) {
+ uni.showLoading({
+ title: options.loadingText,
+ mask: true
+ });
+ }
+ var ctx = uni.createCanvasContext(options.canvasId, options.context);
+ var count = qrCodeAlg.getModuleCount();
+ var ratioSize = options.size;
+ var ratioImgSize = options.imageSize;
+ //璁$畻姣忎釜鐐圭殑闀垮
+ var tileW = (ratioSize / count).toPrecision(4);
+ var tileH = (ratioSize / count).toPrecision(4);
+ //缁樺埗
+ for (var row = 0; row < count; row++) {
+ for (var col = 0; col < count; col++) {
+ var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW));
+ var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW));
+ var foreground = getForeGround({
+ row: row,
+ col: col,
+ count: count,
+ options: options
+ });
+ ctx.setFillStyle(qrCodeAlg.modules[row][col] ? foreground : options.background);
+ ctx.fillRect(Math.round(col * tileW), Math.round(row * tileH), w, h);
+ }
+ }
+ if (options.image) {
+ var x = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
+ var y = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
+ drawRoundedRect(ctx, x, y, ratioImgSize, ratioImgSize, 2, 6, true, true)
+ ctx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize);
+ // 鐢诲渾瑙掔煩褰�
+ function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
+ ctxi.setLineWidth(lineWidth);
+ ctxi.setFillStyle(options.background);
+ ctxi.setStrokeStyle(options.background);
+ ctxi.beginPath(); // draw top and top right corner
+ ctxi.moveTo(x + r, y);
+ ctxi.arcTo(x + width, y, x + width, y + r, r); // draw right side and bottom right corner
+ ctxi.arcTo(x + width, y + height, x + width - r, y + height, r); // draw bottom and bottom left corner
+ ctxi.arcTo(x, y + height, x, y + height - r, r); // draw left and top left corner
+ ctxi.arcTo(x, y, x + r, y, r);
+ ctxi.closePath();
+ if (fill) {
+ ctxi.fill();
+ }
+ if (stroke) {
+ ctxi.stroke();
+ }
+ }
+ }
+ setTimeout(() => {
+ ctx.draw(true, () => {
+ // 淇濆瓨鍒颁复鏃跺尯鍩�
+ setTimeout(() => {
+ uni.canvasToTempFilePath({
+ width: options.width,
+ height: options.height,
+ destWidth: options.width,
+ destHeight: options.height,
+ canvasId: options.canvasId,
+ quality: Number(1),
+ success: function (res) {
+ if (options.cbResult) {
+ options.cbResult(res.tempFilePath)
+ }
+ },
+ fail: function (res) {
+ if (options.cbResult) {
+ options.cbResult(res)
+ }
+ },
+ complete: function () {
+ if (options.showLoading){
+ uni.hideLoading();
+ }
+ },
+ }, options.context);
+ }, options.text.length + 100);
+ });
+ }, options.usingComponents ? 0 : 150);
+ }
+ createCanvas(this.options);
+ // 绌哄垽瀹�
+ let empty = function (v) {
+ let tp = typeof v,
+ rt = false;
+ if (tp == "number" && String(v) == "") {
+ rt = true
+ } else if (tp == "undefined") {
+ rt = true
+ } else if (tp == "object") {
+ if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
+ } else if (tp == "string") {
+ if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
+ } else if (tp == "function") {
+ rt = false
+ }
+ return rt
+ }
+ };
+ QRCode.prototype.clear = function (fn) {
+ var ctx = uni.createCanvasContext(this.options.canvasId, this.options.context)
+ ctx.clearRect(0, 0, this.options.size, this.options.size)
+ ctx.draw(false, () => {
+ if (fn) {
+ fn()
+ }
+ })
+ };
+})()
+
+export default QRCode
\ No newline at end of file
diff --git a/h5/utils/service.js b/h5/utils/service.js
new file mode 100644
index 0000000..70e1617
--- /dev/null
+++ b/h5/utils/service.js
@@ -0,0 +1,65 @@
+import { baseUrl } from "./config.js"
+export const http = function (options) {
+ {
+ return new Promise((resolve, reject) => {
+ let token = uni.getStorageSync('token') || ''
+ // 鍦ㄧ櫥褰曠殑鏃跺�欓渶瑕佸偍瀛� token uni.setStorageSync("authorization","杩欓噷鏄櫥褰曡幏鍙栫殑token鍊�")
+
+ // uni.showLoading({
+ // title:"鍔犺浇涓�..."
+ // })
+ uni.showLoading({
+ title: '鍔犺浇涓�',
+ mask: true
+ })
+ uni.request({
+ url: baseUrl + options.url,
+ data: options.data || {},
+ method: options.method || 'GET',
+ header: options.header || {
+ // 鏍规嵁瀹為檯鎺ュ彛璁捐 key 鍙� token 鎴栬�� authorization
+ dm_user_token: token,
+ "content-type": 'application/json'
+ },
+ success: (res) => {
+ let data = res.data
+ // 鎺у埗鍙版樉绀烘暟鎹俊鎭�
+ uni.hideLoading()
+ // 鐧诲綍杩囨湡
+ if (data.code !== 200) {
+ setTimeout(() => {
+ uni.showToast({
+ title: data.message,
+ icon: "none",
+ duration: 2000
+ })
+ })
+ if (data.code === 500 || data.code === 5112) {
+ uni.clearStorageSync()
+ return uni.navigateTo({
+ url: '/pages/login/login'
+ })
+ }
+ return
+ }
+ resolve(data)
+ // return response.data
+ },
+ fail: (err) => {
+ // 椤甸潰涓脊妗嗘樉绀哄け璐�
+ uni.showToast({
+ title: '璇锋眰鎺ュ彛澶辫触'
+ })
+
+ // 杩斿洖閿欒娑堟伅
+ reject(err)
+ uni.hideLoading()
+ return Promise.reject(err)
+ },
+ catch: (e) => {
+ console.log(e)
+ }
+ })
+ })
+ }
+}
\ No newline at end of file
diff --git a/h5/utils/utils.js b/h5/utils/utils.js
new file mode 100644
index 0000000..08378e8
--- /dev/null
+++ b/h5/utils/utils.js
@@ -0,0 +1,163 @@
+/**
+ * 鏃堕棿鍓嶅悗鍚戝墠鎺ㄧ畻鏃堕棿闆嗗悎
+ * @param {string:before|after} timebd锛氳幏鍙栨椂闂村線鍚庢帹锛岃繕鏄線鍓嶆帹锛�
+ * @param {boole} haveCurrentDay锛氬寘涓嶅寘鍚綋澶╂椂闂达紝
+ * @param {number} Days锛氳绠楀嚑澶╃殑鏃堕棿锛�
+ * @param {string:"2023-11-02"} timing锛氭寚瀹氫笉鎸囧畾褰撳ぉ鐨勬棩鏈�
+ * @returns {array}鏁版嵁闆嗗悎
+ */
+export const nextDay = (timebd, haveCurrentDay, Days, timing) => {
+
+ let today = new Date() //鑾峰彇浠婂ぉ鐨勬棩鏈�
+ if (timing) {
+ today = new Date(timing)
+ }
+ let date2 = new Date(today);
+ let dateArray = []
+ timebd=timebd ? timebd:"after"
+ haveCurrentDay=haveCurrentDay ? true:false
+ Days=Days ? Days:7
+ function TimestampToDate2(Timestamp) {
+ 銆�銆�let now = new Date(Timestamp),
+ 銆�銆�y = now.getFullYear(),
+ 銆�銆�m = now.getMonth() + 1,
+ 銆�銆�d = now.getDate();
+ 銆�銆�return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
+ }
+ let fori=haveCurrentDay ? 0:1;
+ let fortotal=haveCurrentDay ? Days:Days+1;
+ for(let i = fori; i < fortotal; i++){
+ let everyDay=""
+ if (timebd=="after") {//鏈潵
+ everyDay=date2.setDate(today.getDate() + i)
+ }else{//杩囧幓
+ everyDay=date2.setDate(today.getDate() - i)
+ }
+ dateArray.push(TimestampToDate2(everyDay)) //鑾峰彇鏈潵7澶╁唴鐨勬棩鏈�
+ }
+ if (timebd=="after") {//鏈潵
+ return dateArray
+ }else{//杩囧幓
+ return dateArray.reverse()
+ }
+ }
+
+/**
+ * 杩斿洖涓や釜鏃ユ湡涔嬪墠鐨勫ぉ鏁�
+ */
+export const getDateByDays = (startDate, endDdate) => {
+ let d1 = Date.parse(new Date(startDate));
+ let d2 = Date.parse(new Date(endDdate));
+ // 鏃堕棿鎴崇浉鍑� / 澶╂暟
+ let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24));
+ return day
+}
+
+// 鑾峰彇澶氬皯澶╁悗鐨勬棩鏈�
+export const getDaysAfterDate = (date, days) => {
+ if (days === 0) {
+ return '2099-01-01'
+ }
+ const now = new Date(date);
+ now.setDate(now.getDate() + days);
+ const year = now.getFullYear();
+ const month = now.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑
+ const day = now.getDate();
+ return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
+}
+
+
+// meeting
+/**
+ * 鑾峰彇褰撳ぉ鏃ユ湡
+ **/
+export const getDay = () => {
+ let date = new Date();
+ var year = date.getFullYear();
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+ month = (month > 9) ? month : ("0" + month);
+ day = (day < 10) ? ("0" + day) : day;
+ let week = '鏄熸湡' + '鏃ヤ竴浜屼笁鍥涗簲鍏�'.charAt(new Date().getDay())
+ var today = year + "骞�" + month + "鏈�" + day + "鏃�" + " " + week;
+
+ return {
+ today,
+ date: year + "-" + month + "-" + day,
+ day
+ };
+}
+
+/**
+ * 鑾峰彇涓婁竴澶╂棩鏈�
+ **/
+export const getPreviousDay = (number, val) => {
+ let num = (24*60*60*1000) * number;
+ let date = ''
+ if (val) {
+ date = new Date(new Date(val).getTime() - num);
+ } else {
+ date = new Date(new Date().getTime() - num);
+ }
+ var year = date.getFullYear();
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+ month = (month > 9) ? month : ("0" + month);
+ day = (day < 10) ? ("0" + day) : day;
+ let week = '鏄熸湡' + '鏃ヤ竴浜屼笁鍥涗簲鍏�'.charAt(date.getDay())
+ var today = year + "骞�" + month + "鏈�" + day + "鏃�" + " " + week;
+
+ return {
+ today,
+ date: year + "-" + month + "-" + day
+ };
+}
+
+// 鏍煎紡鍖栨棩瀵硅薄
+export const getNowDate = () => {
+ var date = new Date();
+ var sign2 = ":";
+ var year = date.getFullYear() // 骞�
+ var month = date.getMonth() + 1; // 鏈�
+ var day = date.getDate(); // 鏃�
+ var hour = date.getHours(); // 鏃�
+ var minutes = date.getMinutes(); // 鍒�
+ var seconds = date.getSeconds() //绉�
+ var weekArr = ['鏄熸湡涓�', '鏄熸湡浜�', '鏄熸湡涓�', '鏄熸湡鍥�', '鏄熸湡浜�', '鏄熸湡鍏�', '鏄熸湡澶�'];
+ var week = weekArr[date.getDay()];
+ // 缁欎竴浣嶆暟鐨勬暟鎹墠闈㈠姞 鈥�0鈥�
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (day >= 0 && day <= 9) {
+ day = "0" + day;
+ }
+ if (hour >= 0 && hour <= 9) {
+ hour = "0" + hour;
+ }
+ if (minutes >= 0 && minutes <= 9) {
+ minutes = "0" + minutes;
+ }
+ if (seconds >= 0 && seconds <= 9) {
+ seconds = "0" + seconds;
+ }
+ return year + "-" + month + "-" + day + " " + hour + sign2 + minutes + sign2 + seconds;
+}
+
+//蹇呴』涓哄瓧姣嶅姞鏁板瓧涓旈暱搴︿笉灏忎簬8浣�
+export const CheckPassWord = (password) => {
+ var str = password;
+ if (str == null || str.length <8) {
+ return false;
+ }
+ var reg1 = new RegExp(/^[0-9A-Za-z]+$/);
+ if (!reg1.test(str)) {
+ return false;
+ }
+ var reg = new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
+ if (reg.test(str)) {
+ return true;
+ } else {
+ return false;
+ }
+}
--
Gitblit v1.9.3