init
This commit is contained in:
parent
63e9a62ecd
commit
26e0a007dc
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
unpackage/
|
||||||
16
.hbuilderx/launch.json
Normal file
16
.hbuilderx/launch.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||||
|
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||||
|
"version": "0.0",
|
||||||
|
"configurations": [{
|
||||||
|
"app-plus" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"default" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"type" : "uniCloud"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
225
components/custom/query-selector.vue
Normal file
225
components/custom/query-selector.vue
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<view class="auto-complete">
|
||||||
|
<u-popup
|
||||||
|
:show="show"
|
||||||
|
:round="10"
|
||||||
|
mode="bottom"
|
||||||
|
:closeable="true"
|
||||||
|
:closeIconPos="multiple ? 'top-left' : 'top-right'"
|
||||||
|
@open="onOpen"
|
||||||
|
@close="handleClosePopup">
|
||||||
|
<u--text
|
||||||
|
v-if="multiple"
|
||||||
|
text="确定"
|
||||||
|
type="primary"
|
||||||
|
bold
|
||||||
|
class="ok-button"
|
||||||
|
size="16"
|
||||||
|
@click="handleOk"
|
||||||
|
></u--text>
|
||||||
|
<u-list
|
||||||
|
@scrolltolower="scrolltolower"
|
||||||
|
:pagingEnabled="true"
|
||||||
|
>
|
||||||
|
<view class="head">
|
||||||
|
<view class="title">{{title}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="search" style="padding-top: 6px">
|
||||||
|
<u-search
|
||||||
|
v-model="searchValue"
|
||||||
|
@search="handleSearch"
|
||||||
|
@custom="handleSearch"
|
||||||
|
:clearabled="true">
|
||||||
|
</u-search>
|
||||||
|
</view>
|
||||||
|
<view v-if="multiple" class="multi-checkbox" @click.stop="">
|
||||||
|
<u-checkbox-group
|
||||||
|
placement="column"
|
||||||
|
@onchange="onCheckboxChange"
|
||||||
|
>
|
||||||
|
<u-checkbox
|
||||||
|
:customStyle="checkboxStyle"
|
||||||
|
v-for="(item, index) in indexList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.NAME"
|
||||||
|
:name="item.ID"
|
||||||
|
:checked="multipleSelect.map(i => i.ID).includes(item.ID)"
|
||||||
|
>
|
||||||
|
</u-checkbox>
|
||||||
|
</u-checkbox-group>
|
||||||
|
</view>
|
||||||
|
<u-list-item
|
||||||
|
v-else
|
||||||
|
v-for="(item, index) in indexList"
|
||||||
|
:key="index"
|
||||||
|
class="single-select"
|
||||||
|
>
|
||||||
|
<view @click="handleSelected(item)">
|
||||||
|
<u-cell
|
||||||
|
:title="`${item.name}`"
|
||||||
|
>
|
||||||
|
<text v-if="item.code" slot="right-icon">{{item.code}}</text>
|
||||||
|
</u-cell>
|
||||||
|
</view>
|
||||||
|
</u-list-item>
|
||||||
|
</u-list>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import UText from '../../uni_modules/uview-ui/components/u-text/u-text.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { UText },
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
lists: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaultValue: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
defaultChecked: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title:{
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
total:{
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchValue: '',
|
||||||
|
indexList: [],
|
||||||
|
pageIndex: 1,
|
||||||
|
multipleSelect: [],
|
||||||
|
checkboxStyle: {
|
||||||
|
marginBottom: '8px',
|
||||||
|
padding: '10px 0',
|
||||||
|
borderBottom: '1px solid #e5e5e5'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onCheckboxChange(e) {
|
||||||
|
if (e.checked) {
|
||||||
|
const obj = this.indexList.filter(i => i.ID === e.id)[0]
|
||||||
|
this.multipleSelect.push(obj)
|
||||||
|
} else {
|
||||||
|
this.multipleSelect.forEach(item => {
|
||||||
|
if (e.id === item.ID) {
|
||||||
|
this.multipleSelect = this.multipleSelect.filter(i => i.ID !== e.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onOpen() {
|
||||||
|
this.pageIndex = 1
|
||||||
|
if (this.defaultValue) {
|
||||||
|
this.searchValue = this.defaultValue
|
||||||
|
this.handleSearch(this.defaultValue)
|
||||||
|
} else {
|
||||||
|
this.searchValue = ''
|
||||||
|
// this.indexList = this.lists
|
||||||
|
}
|
||||||
|
this.multipleSelect = this.defaultChecked
|
||||||
|
},
|
||||||
|
handleClosePopup() {
|
||||||
|
this.searchValue = ''
|
||||||
|
this.indexList = []
|
||||||
|
this.multipleSelect = []
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
|
handleSearch(val) {
|
||||||
|
this.searchValue = val
|
||||||
|
this.indexList = []
|
||||||
|
this.$emit('search', val, 1)
|
||||||
|
},
|
||||||
|
handleSelected(val) {
|
||||||
|
this.searchValue = ''
|
||||||
|
this.indexList = []
|
||||||
|
this.multipleSelect = []
|
||||||
|
this.$emit('select', val)
|
||||||
|
},
|
||||||
|
handleOk() {
|
||||||
|
this.searchValue = ''
|
||||||
|
this.indexList = []
|
||||||
|
this.$emit('select', this.multipleSelect)
|
||||||
|
},
|
||||||
|
scrolltolower() {
|
||||||
|
if (this.total > this.pageIndex * 20) {
|
||||||
|
this.pageIndex++
|
||||||
|
this.$emit('search', this.searchValue, this.pageIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
lists(newLists) {
|
||||||
|
this.indexList = this.indexList.concat(newLists)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.head {
|
||||||
|
height: 46px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.head .cancel,
|
||||||
|
.head .ok {
|
||||||
|
font-size: 15px;
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
.head .cancel {
|
||||||
|
color: rgb(144, 145, 147);
|
||||||
|
}
|
||||||
|
.head .ok {
|
||||||
|
color: rgb(60, 156, 255)
|
||||||
|
}
|
||||||
|
.head .title {
|
||||||
|
color: #303133;
|
||||||
|
padding: 0 22px;
|
||||||
|
font-size: 16px;
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.search {
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
.multi-checkbox {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
.single-select {
|
||||||
|
margin-right: 16px;
|
||||||
|
margin-left: 16px
|
||||||
|
}
|
||||||
|
.ok-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
right: 15px;
|
||||||
|
width: max-content;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
3
main.js
3
main.js
@ -4,6 +4,9 @@ import uView from '@/uni_modules/uview-ui'
|
|||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
|
import QuerySelector from 'components/custom/query-selector.vue'
|
||||||
|
|
||||||
|
Vue.component('query-selector', QuerySelector)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
|
|||||||
@ -17,7 +17,10 @@
|
|||||||
"delay" : 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules" : {
|
||||||
|
"Barcode" : {},
|
||||||
|
"Camera" : {}
|
||||||
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
@ -38,7 +41,8 @@
|
|||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
],
|
||||||
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios" : {},
|
||||||
|
|||||||
28
pages.json
28
pages.json
@ -3,7 +3,25 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "首页"
|
"navigationBarTitleText": "首页",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"buttons": [{
|
||||||
|
"text": "进入",
|
||||||
|
"type": "none",
|
||||||
|
"color": "#304ffe",
|
||||||
|
"background": "#000000",
|
||||||
|
"fontSize": "14px"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/camera/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "随手拍",
|
||||||
|
"onReachBottomDistance": 100
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -25,7 +43,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/webview/webview",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
<view class="content-icon">
|
<view class="content-icon">
|
||||||
<u-icon name="checkmark-circle" size="108" color="#5ac725" v-if="type == 'success'"></u-icon>
|
<u-icon name="checkmark-circle" size="108" color="#5ac725" v-if="type == 'success'"></u-icon>
|
||||||
<view class="text" v-if="type == 'success'">提交成功</view>
|
<view class="text" v-if="type == 'success'">提交成功</view>
|
||||||
<u-icon name="checkmark-circle" size="108" color="#f56c6c" v-if="type == 'failed'"></u-icon>
|
<u-icon name="close-circle" size="108" color="#f56c6c" v-if="type == 'failed'"></u-icon>
|
||||||
<view class="text" v-if="type == 'failed'">提交失败,请稍后重新提交</view>
|
<view class="text" v-if="type == 'failed'">{{titleFailes}}</view>
|
||||||
<view style="display: flex;flex-direction: row;" class="bottom-button">
|
<view style="display: flex;flex-direction: row;" class="bottom-button">
|
||||||
<!-- <u-button type="primary" @click="reset" color="#3d4b70" :plain="true" style="margin-right: 5px;">重置</u-button> -->
|
<!-- <u-button type="primary" @click="reset" color="#3d4b70" :plain="true" style="margin-right: 5px;">重置</u-button> -->
|
||||||
<u-button type="success" @click="submit" v-if="type == 'success'">完成</u-button>
|
<u-button type="success" @click="submit" v-if="type == 'success'">完成</u-button>
|
||||||
@ -27,7 +27,8 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showSex: false,
|
showSex: false,
|
||||||
type:'success'
|
type: 'success',
|
||||||
|
titleFailes: '提交失败,请稍后重新提交',
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -36,14 +37,17 @@
|
|||||||
a.style.display = 'none';
|
a.style.display = 'none';
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log(options.type, 'op')
|
|
||||||
this.type = options.type
|
this.type = options.type
|
||||||
|
if (options.title&&options.title!=='') {
|
||||||
|
this.titleFailes = options.title
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
// uni.navigateBack()
|
// uni.navigateBack()
|
||||||
uni.navigateTo({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -56,7 +60,12 @@
|
|||||||
.content {
|
.content {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
/* #ifndef APP-PLUS */
|
||||||
|
height: calc(100vh - 44px - 50px); // 非APP平台下生效
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP-PLUS */
|
||||||
|
height: calc(100vh); // APP平台下生效
|
||||||
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
@ -56,6 +56,10 @@
|
|||||||
import {
|
import {
|
||||||
RegisterUser
|
RegisterUser
|
||||||
} from '../../services/apply.js'
|
} from '../../services/apply.js'
|
||||||
|
import {
|
||||||
|
isChinaMobilePhone,
|
||||||
|
easyCheckID,
|
||||||
|
} from '../../utils/common.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -73,6 +77,16 @@
|
|||||||
WORKINGYEAR: '',
|
WORKINGYEAR: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
model2: {
|
||||||
|
userInfo: {
|
||||||
|
Name: '',
|
||||||
|
Sex: '',
|
||||||
|
Phone: '',
|
||||||
|
ID_CARD: '',
|
||||||
|
InTime: '',
|
||||||
|
WORKINGYEAR: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
dateTimePickerInfo: {
|
dateTimePickerInfo: {
|
||||||
showCheckDate: false,
|
showCheckDate: false,
|
||||||
defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
||||||
@ -99,27 +113,36 @@
|
|||||||
message: '请选择男或女',
|
message: '请选择男或女',
|
||||||
trigger: ['blur', 'change']
|
trigger: ['blur', 'change']
|
||||||
},
|
},
|
||||||
|
'userInfo.Phone': {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
message: '请填写手机号',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
'userInfo.ID_CARD': {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
message: '请填写身份证号',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
'userInfo.InTime': {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
message: '请选择入职时间',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
'userInfo.WORKINGYEAR': {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
message: '请选择工龄',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
},
|
},
|
||||||
radio: '',
|
radio: '',
|
||||||
switchVal: false
|
switchVal: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {},
|
||||||
// console.log(this.pickerColumns, 'pickerColumns')
|
|
||||||
// let pages = getCurrentPages()
|
|
||||||
// let currentPage = pages[pages.length - 1]
|
|
||||||
// const currentUrl = `/${currentPage.route}`
|
|
||||||
// console.log(currentUrl,'currentUrl')
|
|
||||||
// let routes = currentPage.route
|
|
||||||
// let options = currentPage.options
|
|
||||||
// let opurl = routes + '?'
|
|
||||||
// console.log(options,'options')
|
|
||||||
// for(let key in options) {
|
|
||||||
// opurl +=key +'='+options[key]+'&'
|
|
||||||
// }
|
|
||||||
// opurl = opurl.substr(0,opurl.length - 1)
|
|
||||||
// console.log(opurl,'1231312321')
|
|
||||||
},
|
|
||||||
onReady() {
|
onReady() {
|
||||||
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
||||||
this.$refs.uForm.setRules(this.rules)
|
this.$refs.uForm.setRules(this.rules)
|
||||||
@ -138,8 +161,6 @@
|
|||||||
showCheckDate: true,
|
showCheckDate: true,
|
||||||
defaultDateTime: this.model1.userInfo.InTime,
|
defaultDateTime: this.model1.userInfo.InTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleCheckDate(e) {
|
handleCheckDate(e) {
|
||||||
// let v = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
|
// let v = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
|
||||||
@ -165,39 +186,56 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
// if (this.model1.userInfo.Name == '' ||
|
if (this.model1.userInfo.Name == '' ||
|
||||||
// this.model1.userInfo.Sex == '' ||
|
this.model1.userInfo.Sex == '' ||
|
||||||
// this.model1.userInfo.Phone == '' ||
|
this.model1.userInfo.Phone == '' ||
|
||||||
// this.model1.userInfo.ID_CARD == '' ||
|
this.model1.userInfo.ID_CARD == '' ||
|
||||||
// this.model1.userInfo.InTime == '' ||
|
this.model1.userInfo.InTime == '' ||
|
||||||
// this.model1.userInfo.WORKINGYEAR == '') {
|
this.model1.userInfo.WORKINGYEAR == '') {
|
||||||
// uni.showToast({
|
uni.showToast({
|
||||||
// icon: 'error',
|
icon: 'error',
|
||||||
// title: '信息不能为空'
|
title: '信息不能为空'
|
||||||
// })
|
})
|
||||||
// return
|
return
|
||||||
// }
|
|
||||||
console.log(this.model1.userInfo,'this.model1.userInfo')
|
|
||||||
const json = {
|
|
||||||
Name: '云',
|
|
||||||
Sex: '0',
|
|
||||||
Phone:'19846123760',
|
|
||||||
ID_CARD: '230182200000000000',
|
|
||||||
InTime: '2024-01-01 09:00:00',
|
|
||||||
WORKINGYEAR: '1',
|
|
||||||
}
|
}
|
||||||
|
if (isChinaMobilePhone(this.model1.userInfo.Phone) == false) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: '手机号码格式不正确'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (easyCheckID(this.model1.userInfo.ID_CARD) == false) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: '身份证号码格式不正确'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.model2.userInfo = this.model1.userInfo
|
||||||
|
if (this.model1.userInfo.Sex == '男') {
|
||||||
|
this.model2.userInfo.Sex = '1'
|
||||||
|
} else {
|
||||||
|
this.model2.userInfo.Sex = '0'
|
||||||
|
}
|
||||||
|
const json = this.model2.userInfo
|
||||||
RegisterUser(json).then((res) => {
|
RegisterUser(json).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
console.log('成功', res);
|
console.log('成功', res);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/apply/complete?type=success'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/apply/complete?type=failed&title=${res.msg}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('失败', err);
|
uni.navigateTo({
|
||||||
|
url: `/pages/apply/complete?type=failed&title=${err.msg}`
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// console.log(this.model1, '12312')
|
|
||||||
// // uni.navigateBack()
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/apply/complete?type=success'
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -208,7 +246,12 @@
|
|||||||
.content {
|
.content {
|
||||||
background-color: #f4f7ff;
|
background-color: #f4f7ff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
/* #ifndef APP-PLUS */
|
||||||
|
height: calc(100vh - 44px - 50px); // 非APP平台下生效
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP-PLUS */
|
||||||
|
height: calc(100vh); // APP平台下生效
|
||||||
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
266
pages/camera/index.vue
Normal file
266
pages/camera/index.vue
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
<template>
|
||||||
|
<view class="camera-page">
|
||||||
|
<uni-card class="card-style" margin="0" :is-shadow="true">
|
||||||
|
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="dataModel" :rules="rules"
|
||||||
|
ref="wForm" errorType="border-bottom">
|
||||||
|
<u-form-item label="接收人" prop="recipient.name" borderBottom
|
||||||
|
@click="handleShowPersonQuery">
|
||||||
|
<u--input :value="dataModel.recipient.name" readonly disabledColor="#fff" placeholder="请选择接收人"
|
||||||
|
border="none" inputAlign="right"></u--input>
|
||||||
|
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
|
||||||
|
</u-form-item>
|
||||||
|
<!-- <u-form-item label="检查层级" prop="checkLevel" borderBottom-->
|
||||||
|
<!-- @click="handleShowSheet({title: '检查层级', name: 'checkLevel'})">-->
|
||||||
|
<!-- <u--input :value="dataModel.checkLevel.name" placeholder="请选择检查层级" disabled disabledColor="#fff"-->
|
||||||
|
<!-- border="none" inputAlign="right"></u--input>-->
|
||||||
|
<!-- <u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>-->
|
||||||
|
<!-- </u-form-item>-->
|
||||||
|
<!-- <u-form-item label="检查时间" prop="checkDate" borderBottom @click="showCheckDate = true;">-->
|
||||||
|
<!-- <u--input disabled disabledColor="#fff" :value="dataModel.checkDate.value" border="none"-->
|
||||||
|
<!-- inputAlign="right"></u--input>-->
|
||||||
|
<!-- </u-form-item>-->
|
||||||
|
<view class="label-title">照片</view>
|
||||||
|
<u-form-item borderBottom prop="pictureLists">
|
||||||
|
<u-upload :fileList="dataModel.pictureLists" @afterRead="afterRead" @delete="deletePic" multiple :maxCount="3"
|
||||||
|
style="margin-bottom: 0;" :previewFullImage="true" uploadIcon="plus"></u-upload>
|
||||||
|
</u-form-item>
|
||||||
|
<view>
|
||||||
|
<view class="label-title">检查内容</view>
|
||||||
|
<u-form-item borderBottom>
|
||||||
|
<u--textarea :value="dataModel.checkContent.value" @input="onInput" placeholder="请输入检查内容"
|
||||||
|
border="surround"></u--textarea>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u--form>
|
||||||
|
<!-- <people-selector :show="showSelectorPerson" @select="handleSelectorPeople"-->
|
||||||
|
<!-- @close="showSelectorPerson = false">-->
|
||||||
|
<!-- </people-selector>-->
|
||||||
|
<query-selector :show="showQueryPerson" :lists="userLists" :total="curTotal"
|
||||||
|
@close="handleClosePopup" @search="handleSearchUser" @select="handleSelectedUser" />
|
||||||
|
<!-- <u-datetime-picker :show="showCheckDate" mode="datetime" :value="dataModel.checkDate.value"-->
|
||||||
|
<!-- @confirm="handleCheckDate" @close="showCheckDate = false;"-->
|
||||||
|
<!-- @cancel="showCheckDate = false;"></u-datetime-picker>-->
|
||||||
|
<!-- <u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"-->
|
||||||
|
<!-- @close="closePicker" @cancel="closePicker" keyName="name"></u-picker>-->
|
||||||
|
</uni-card>
|
||||||
|
<button type="primary" @click="handleSubmit">提交</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
extendFilterGroup,
|
||||||
|
extendGroupRule,
|
||||||
|
extendInclude,
|
||||||
|
extendOrder,
|
||||||
|
extendRule,
|
||||||
|
guid,
|
||||||
|
initFilter, initFilterGroup
|
||||||
|
} from '../../utils/common'
|
||||||
|
// import {
|
||||||
|
// getUserLists
|
||||||
|
// } from '../../services/safe'
|
||||||
|
// import {
|
||||||
|
// saveSnapShot
|
||||||
|
// } from '../../services/app'
|
||||||
|
import config from '../../config/common'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sourceUrl: config.uni_app_web_source_url,
|
||||||
|
userLists: [],
|
||||||
|
curTotal: 0,
|
||||||
|
showSelectorPerson: false,
|
||||||
|
showQueryPerson: false,
|
||||||
|
dataModel: {
|
||||||
|
recipient: {
|
||||||
|
name: '',
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
checkContent: {
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
pictureLists: [],
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'recipient.name': {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
message: '请选择接收人',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},
|
||||||
|
'pictureLists': {
|
||||||
|
type: 'array',
|
||||||
|
required: true,
|
||||||
|
message: '请上传照片',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// this.dataModel.pictureLists = this.$store.state.imageLists.map(i => {
|
||||||
|
// return {
|
||||||
|
// url: this.sourceUrl + i.IMG_FILE_PATH,
|
||||||
|
// id: i.IMG_FILE_ID,
|
||||||
|
// IMG_FILE_PATH: this.sourceUrl + i.IMG_FILE_PATH,
|
||||||
|
// IMG_FILE_ID: i.IMG_FILE_ID,
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleShowPersonQuery() {
|
||||||
|
this.showQueryPerson = true
|
||||||
|
this.handleSearchUser('init')
|
||||||
|
},
|
||||||
|
handleClosePopup() {
|
||||||
|
this.showQueryPerson = false
|
||||||
|
},
|
||||||
|
// handleSelectorPeople(e) {
|
||||||
|
// console.log(e)
|
||||||
|
// },
|
||||||
|
handleSearchUser(val, pageIndex) {
|
||||||
|
const orgId = uni.getStorageSync('orgId')
|
||||||
|
const json = initFilter(orgId, "", "NAME", '', pageIndex)
|
||||||
|
extendInclude(json, "Nav_Person.Nav_Post")
|
||||||
|
extendRule(json, 'ENABLE_STATUS', 1, '0')
|
||||||
|
if (val !== 'init') {
|
||||||
|
const tempGroup = initFilterGroup(false);
|
||||||
|
extendGroupRule(tempGroup, 'NAME', 9, val)
|
||||||
|
extendFilterGroup(json, tempGroup);
|
||||||
|
}
|
||||||
|
json.Limit = 20
|
||||||
|
if (pageIndex) {
|
||||||
|
json.Start = (pageIndex - 1) * 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
// getUserLists(json).then(res => {
|
||||||
|
// if (res.IsSuccessful) {
|
||||||
|
// this.userLists = res.Data.map(i => {
|
||||||
|
// return {
|
||||||
|
// ...i,
|
||||||
|
// name: i.NAME,
|
||||||
|
// code: i.CODE
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// this.curTotal = res.TotalCount
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
handleSelectedUser(val) {
|
||||||
|
this.showQueryPerson = false
|
||||||
|
this.lists = []
|
||||||
|
this.dataModel.recipient = val
|
||||||
|
},
|
||||||
|
onInput(e) {
|
||||||
|
this.dataModel.checkContent.value = e
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
const ele = this.$refs
|
||||||
|
ele['wForm'].validate().then(res => {
|
||||||
|
const orgId = uni.getStorageSync('orgId')
|
||||||
|
const appInfoData = uni.getStorageSync('appInfo')
|
||||||
|
const {
|
||||||
|
recipient,
|
||||||
|
checkContent,
|
||||||
|
pictureLists
|
||||||
|
} = this.dataModel
|
||||||
|
// const submitId = guid()
|
||||||
|
const params = {
|
||||||
|
ACCEPT_ID: recipient.ID,
|
||||||
|
DESCRIPTION: checkContent.value,
|
||||||
|
Nav_Files: pictureLists.map(i => {
|
||||||
|
return {
|
||||||
|
ID: guid(),
|
||||||
|
IMG_FILE_ID: i.IMG_FILE_ID,
|
||||||
|
ORG_ID: orgId,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
// saveSnapShot(params).then(res => {
|
||||||
|
// if (res) {
|
||||||
|
// uni.$showMsgFunc('提交成功', () => {
|
||||||
|
// uni.switchTab({
|
||||||
|
// url: '/pages/index/index2'
|
||||||
|
// })
|
||||||
|
// }, '', 1000)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('校验失败', err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deletePic(event) {
|
||||||
|
this.dataModel.pictureLists.splice(event.index, 1)
|
||||||
|
},
|
||||||
|
async afterRead(event) {
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
let lists = [].concat(event.file)
|
||||||
|
let fileListLen = this.dataModel.pictureLists.length
|
||||||
|
lists.map((item) => {
|
||||||
|
this.dataModel.pictureLists.push({
|
||||||
|
...item,
|
||||||
|
status: 'uploading',
|
||||||
|
message: '上传中'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let i = 0; i < lists.length; i++) {
|
||||||
|
const result = await this.uploadFilePromise(lists[i].url)
|
||||||
|
let item = this.dataModel.pictureLists[fileListLen]
|
||||||
|
this.dataModel.pictureLists.splice(fileListLen, 1, Object.assign(item, {
|
||||||
|
status: 'success',
|
||||||
|
message: '',
|
||||||
|
IMG_FILE_ID: result.imgFileID
|
||||||
|
// url: result
|
||||||
|
}))
|
||||||
|
fileListLen++
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uploadFilePromise(url) {
|
||||||
|
const appInfoData = uni.getStorageSync('appInfo')
|
||||||
|
const userId = appInfoData?.User?.ID || ''
|
||||||
|
const orgId = uni.getStorageSync('orgId')
|
||||||
|
const tenant = uni.getStorageSync('Tenant') || ''
|
||||||
|
const remoteUrl = config.serviceHost('/PF/File/UploadFile')
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.uploadFile({
|
||||||
|
url: remoteUrl,
|
||||||
|
filePath: url,
|
||||||
|
fileList: url,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
OrgId: orgId
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
Tenant: tenant,
|
||||||
|
userid: userId
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
const uploadResult = JSON.parse(res.data)
|
||||||
|
if (uploadResult.IsSuccessful) {
|
||||||
|
resolve(uploadResult.Data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* @import url("@/style/css/editTemplate.css"); */
|
||||||
|
.camera-page {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-title {
|
||||||
|
color: #303133;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 22px;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -2,35 +2,47 @@
|
|||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<u-grid :border="false" @click="click" :col="2">
|
<u-grid :border="false" @click="click" :col="2">
|
||||||
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff" @click="clicktwo">
|
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff">
|
||||||
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.name" :size="42" color="#304ffe"></u-icon>
|
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42" color="#304ffe"></u-icon>
|
||||||
<text class="grid-text">{{baseListItem.title}}</text>
|
<text class="grid-text">{{baseListItem.name}}</text>
|
||||||
</u-grid-item>
|
</u-grid-item>
|
||||||
</u-grid>
|
</u-grid>
|
||||||
|
<view style="display: flex;flex-direction: row;" class="home-button">
|
||||||
|
<!-- <u-button type="primary" @click="reset" color="#3d4b70" :plain="true" style="margin-right: 5px;">重置</u-button> -->
|
||||||
|
<u-button type="primary" @click="goCamera" color="#3d4b70">隐患随手拍</u-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getMenu} from '../../services/apply'
|
import {
|
||||||
|
getMenu
|
||||||
|
} from '../../services/apply'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseList: [{
|
baseList: [
|
||||||
name: 'man-add',
|
|
||||||
title: '新员工信息录入'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'warning',
|
name: "新增用户",
|
||||||
title: '风险区域明细'
|
iconName: "man-add"
|
||||||
}, {
|
|
||||||
name: 'pushpin',
|
|
||||||
title: '区域风险四色图'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'grid',
|
|
||||||
title: '区域隐患数量'
|
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// name: "风险区域明细",
|
||||||
|
// iconName: "man-add"
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: "区域风险四色图",
|
||||||
|
// iconName: "man-add"
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: "区域隐患数量",
|
||||||
|
// iconName: "man-add"
|
||||||
|
// },
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -41,17 +53,28 @@
|
|||||||
this.getCaidan()
|
this.getCaidan()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
onNavigationBarButtonTap(e) {
|
||||||
|
let url = 'http://47.122.43.22:9100/'
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/webview/webview?url=' + url
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click(name) {
|
click(name) {
|
||||||
console.log(name)
|
this.baseList.map((item, index) => {
|
||||||
if (name == 0) {
|
if (index == name) {
|
||||||
|
if (item.name == '新增用户') {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/apply/index?company=XLK&post=1'
|
url: '/pages/apply/index?Company=GXBB&post=1'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
clicktwo(name) {
|
goCamera() {
|
||||||
console.log(name, '2')
|
uni.navigateTo({
|
||||||
|
url: '/pages/camera/index'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getCaidan() {
|
getCaidan() {
|
||||||
const json = {
|
const json = {
|
||||||
@ -61,35 +84,12 @@
|
|||||||
}
|
}
|
||||||
getMenu(json).then((res) => {
|
getMenu(json).then((res) => {
|
||||||
console.log('成功', res);
|
console.log('成功', res);
|
||||||
|
this.baseList = res.data
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('失败', err);
|
console.error('失败', err);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// getMenu() {
|
|
||||||
// uni.request({
|
|
||||||
// url: 'http://47.122.43.22:3179/api/BI/H5Controller/GetMenu', //仅为示例,并非真实接口地址。
|
|
||||||
// data: {
|
|
||||||
// Company: 'XLK',
|
|
||||||
// Post:'搬运工',
|
|
||||||
// Type:1
|
|
||||||
// },
|
|
||||||
// header: {
|
|
||||||
// 'Content-Type': 'application/json;charset=UTF-8' //自定义请求头信息
|
|
||||||
// },
|
|
||||||
// success: res => {
|
|
||||||
// console.log(res)
|
|
||||||
// if (res.data.status !== 0) {
|
|
||||||
// return uni.showToast({
|
|
||||||
// title: "数据获取失败"
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// this.data = res.data.messege
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,7 +99,12 @@
|
|||||||
.content {
|
.content {
|
||||||
background-color: #f4f7ff;
|
background-color: #f4f7ff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
/* #ifndef APP-PLUS */
|
||||||
|
height: calc(100vh - 44px - 50px); // 非APP平台下生效
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP-PLUS */
|
||||||
|
height: calc(100vh); // APP平台下生效
|
||||||
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
@ -118,6 +123,21 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.home-button {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 36px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #f4f7ff;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-button .u-button {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.grid-text {
|
.grid-text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
|||||||
18
pages/webview/webview.vue
Normal file
18
pages/webview/webview.vue
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<web-view :src="url"></web-view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
url: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(item) {
|
||||||
|
// 传入需要跳转的链接 使用web-view标签进行跳转
|
||||||
|
this.url = decodeURIComponent(item.url)
|
||||||
|
// console.log(this.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
BIN
static/camera2.png
Normal file
BIN
static/camera2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@ -2,6 +2,7 @@
|
|||||||
// import moment from 'moment';
|
// import moment from 'moment';
|
||||||
// import { color } from 'html2canvas/dist/types/css/types/color'; //wyw 这个会影响
|
// import { color } from 'html2canvas/dist/types/css/types/color'; //wyw 这个会影响
|
||||||
|
|
||||||
|
|
||||||
export function timeFix() {
|
export function timeFix() {
|
||||||
const time = new Date()
|
const time = new Date()
|
||||||
const hour = time.getHours()
|
const hour = time.getHours()
|
||||||
@ -1294,3 +1295,77 @@ export function duplicated(array) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
export function isChinaMobilePhone(phone) {
|
||||||
|
// 2024
|
||||||
|
var reg = new RegExp(/^(13[0-9]|14[05679]|15[012356789]|16[2567]|17[01235678]|18[0-9]|19[012356789])[0-9]{8}$/)
|
||||||
|
return reg.test(phone)
|
||||||
|
}
|
||||||
|
export function easyCheckID(code) {
|
||||||
|
return /^([0-9a-zA-Z]{15}|[0-9a-zA-Z]{18})$/.test(code)
|
||||||
|
}
|
||||||
|
export function IsChinese(str) {
|
||||||
|
// var reg = /^[\u0391-\uFFE5]+$/;
|
||||||
|
var reg =/[^\u4e00-\u9fa5]/
|
||||||
|
if (reg.test(str)) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
export function checkIDCard(code) {
|
||||||
|
// 校验非空
|
||||||
|
if (!code) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 校验长度
|
||||||
|
if (code.length != 15 && code.length != 18) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
|
||||||
|
//假设18位身份证号码:41000119910101123X 410001 19910101 123X
|
||||||
|
//^开头
|
||||||
|
//[1-9] 第一位1-9中的一个 4
|
||||||
|
//\\d{5} 五位数字 10001(前六位省市县地区)
|
||||||
|
//(18|19|20) 19(现阶段可能取值范围18xx-20xx年)
|
||||||
|
//\\d{2} 91(年份)
|
||||||
|
//((0[1-9])|(10|11|12)) 01(月份)
|
||||||
|
//(([0-2][1-9])|10|20|30|31)01(日期)
|
||||||
|
//\\d{3} 三位数字 123(第十七位奇数代表男,偶数代表女)
|
||||||
|
//[0-9Xx] 0123456789Xx其中的一个 X(第十八位为校验值)
|
||||||
|
//$结尾
|
||||||
|
|
||||||
|
//假设15位身份证号码:410001910101123 410001 910101 123
|
||||||
|
//^开头
|
||||||
|
//[1-9] 第一位1-9中的一个 4
|
||||||
|
//\\d{5} 五位数字 10001(前六位省市县地区)
|
||||||
|
//\\d{2} 91(年份)
|
||||||
|
//((0[1-9])|(10|11|12)) 01(月份)
|
||||||
|
//(([0-2][1-9])|10|20|30|31)01(日期)
|
||||||
|
//\\d{3} 三位数字 123(第十五位奇数代表男,偶数代表女),15位身份证不含X
|
||||||
|
//$结尾
|
||||||
|
|
||||||
|
var reg = new RegExp(/(^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/)
|
||||||
|
var matches = reg.test(code)
|
||||||
|
if (matches) {
|
||||||
|
// 15位的身份证,直接返回合法
|
||||||
|
if (code.length == 15) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 18位的进一步校验
|
||||||
|
try {
|
||||||
|
// TODO:
|
||||||
|
if (/^([0-9a-zA-Z]{18})$/.test(code)) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return matches
|
||||||
|
}
|
||||||
@ -6,17 +6,21 @@ import handle401 from './handle401'
|
|||||||
export default (params) => {
|
export default (params) => {
|
||||||
let pages = getCurrentPages()
|
let pages = getCurrentPages()
|
||||||
let currentPage = pages[pages.length - 1]
|
let currentPage = pages[pages.length - 1]
|
||||||
const currentUrl = `/${currentPage.route}`
|
|
||||||
console.log(currentUrl, 'currentUrl')
|
|
||||||
let routes = currentPage.route
|
|
||||||
let options = currentPage.options
|
let options = currentPage.options
|
||||||
let opurl = routes + '?'
|
let tenantId = ''
|
||||||
for (let key in options) {
|
console.log(options, 'options')
|
||||||
opurl += key + '=' + options[key] + '&'
|
if (options.Company == 'DCJD') {
|
||||||
|
tenantId = 'A0000025'
|
||||||
|
} else if (options.Company == 'GXBB') {
|
||||||
|
tenantId = 'A0000028'
|
||||||
|
} else if (options.Company == 'LYYL') {
|
||||||
|
tenantId = 'A0000024'
|
||||||
|
} else if (options.Company == 'LYXT') {
|
||||||
|
tenantId = '0002'
|
||||||
|
} else {
|
||||||
|
tenantId = '0001'
|
||||||
}
|
}
|
||||||
opurl = opurl.substr(0, opurl.length - 1)
|
console.log(tenantId,'tenantId')
|
||||||
console.log(opurl, '1231312321')
|
|
||||||
|
|
||||||
let url = params.url;
|
let url = params.url;
|
||||||
let method = params.method || "get";
|
let method = params.method || "get";
|
||||||
let data = params.data || {};
|
let data = params.data || {};
|
||||||
@ -24,13 +28,13 @@ export default (params) => {
|
|||||||
// 'Blade-Auth': uni.getStorageSync('token') || '',
|
// 'Blade-Auth': uni.getStorageSync('token') || '',
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
// 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
|
// 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
|
||||||
'Tenant': uni.getStorageSync('tenantId') || '0001', // avue配置相关
|
'Tenant': tenantId, // avue配置相关
|
||||||
...params.header
|
...params.header
|
||||||
}
|
}
|
||||||
if (method == "post") {
|
if (method == "post") {
|
||||||
header = {
|
header = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Tenant': uni.getStorageSync('tenantId') || '0001',
|
'Tenant': tenantId,
|
||||||
...params.header
|
...params.header
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user