diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..be30a57
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+unpackage/
diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
new file mode 100644
index 0000000..582561b
--- /dev/null
+++ b/.hbuilderx/launch.json
@@ -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"
+ }
+ ]
+}
diff --git a/components/custom/query-selector.vue b/components/custom/query-selector.vue
new file mode 100644
index 0000000..8733fb8
--- /dev/null
+++ b/components/custom/query-selector.vue
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+ {{title}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.code}}
+
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
index e4fe57f..cbe03cc 100644
--- a/main.js
+++ b/main.js
@@ -4,6 +4,9 @@ import uView from '@/uni_modules/uview-ui'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
+import QuerySelector from 'components/custom/query-selector.vue'
+
+Vue.component('query-selector', QuerySelector)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
diff --git a/manifest.json b/manifest.json
index 439fbf5..f6cd14b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -17,7 +17,10 @@
"delay" : 0
},
/* 模块配置 */
- "modules" : {},
+ "modules" : {
+ "Barcode" : {},
+ "Camera" : {}
+ },
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
@@ -38,7 +41,8 @@
"",
"",
""
- ]
+ ],
+ "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
},
/* ios打包配置 */
"ios" : {},
diff --git a/pages.json b/pages.json
index 6e8bfeb..f910334 100644
--- a/pages.json
+++ b/pages.json
@@ -3,7 +3,25 @@
{
"path": "pages/index/index",
"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": {
"navigationBarTextStyle": "black",
diff --git a/pages/apply/complete.vue b/pages/apply/complete.vue
index 011b96c..b082e49 100644
--- a/pages/apply/complete.vue
+++ b/pages/apply/complete.vue
@@ -8,8 +8,8 @@
提交成功
-
- 提交失败,请稍后重新提交
+
+ {{titleFailes}}
完成
@@ -27,7 +27,8 @@
data() {
return {
showSex: false,
- type:'success'
+ type: 'success',
+ titleFailes: '提交失败,请稍后重新提交',
}
},
@@ -36,14 +37,17 @@
a.style.display = 'none';
},
onLoad(options) {
- console.log(options.type, 'op')
this.type = options.type
+ if (options.title&&options.title!=='') {
+ this.titleFailes = options.title
+ }
+
},
onReady() {},
methods: {
submit() {
// uni.navigateBack()
- uni.navigateTo({
+ uni.reLaunch({
url: '/pages/index/index'
})
},
@@ -56,7 +60,12 @@
.content {
background-color: #fff;
width: 100%;
- height: 100vh;
+ /* #ifndef APP-PLUS */
+ height: calc(100vh - 44px - 50px); // 非APP平台下生效
+ /* #endif */
+ /* #ifdef APP-PLUS */
+ height: calc(100vh); // APP平台下生效
+ /* #endif */
}
.container {
diff --git a/pages/apply/index.vue b/pages/apply/index.vue
index bd420c8..57e4bed 100644
--- a/pages/apply/index.vue
+++ b/pages/apply/index.vue
@@ -56,6 +56,10 @@
import {
RegisterUser
} from '../../services/apply.js'
+ import {
+ isChinaMobilePhone,
+ easyCheckID,
+ } from '../../utils/common.js'
export default {
data() {
return {
@@ -73,6 +77,16 @@
WORKINGYEAR: '',
},
},
+ model2: {
+ userInfo: {
+ Name: '',
+ Sex: '',
+ Phone: '',
+ ID_CARD: '',
+ InTime: '',
+ WORKINGYEAR: '',
+ },
+ },
dateTimePickerInfo: {
showCheckDate: false,
defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
@@ -99,27 +113,36 @@
message: '请选择男或女',
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: '',
switchVal: false
}
},
- 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')
- },
+ onLoad() {},
onReady() {
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
this.$refs.uForm.setRules(this.rules)
@@ -138,8 +161,6 @@
showCheckDate: true,
defaultDateTime: this.model1.userInfo.InTime,
}
-
-
},
handleCheckDate(e) {
// let v = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
@@ -165,39 +186,56 @@
}
},
submit() {
- // if (this.model1.userInfo.Name == '' ||
- // this.model1.userInfo.Sex == '' ||
- // this.model1.userInfo.Phone == '' ||
- // this.model1.userInfo.ID_CARD == '' ||
- // this.model1.userInfo.InTime == '' ||
- // this.model1.userInfo.WORKINGYEAR == '') {
- // uni.showToast({
- // icon: 'error',
- // title: '信息不能为空'
- // })
- // 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 (this.model1.userInfo.Name == '' ||
+ this.model1.userInfo.Sex == '' ||
+ this.model1.userInfo.Phone == '' ||
+ this.model1.userInfo.ID_CARD == '' ||
+ this.model1.userInfo.InTime == '' ||
+ this.model1.userInfo.WORKINGYEAR == '') {
+ uni.showToast({
+ icon: 'error',
+ title: '信息不能为空'
+ })
+ return
}
+ 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) => {
- console.log('成功', res);
+ if (res.code == 200) {
+ 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) => {
- 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 {
background-color: #f4f7ff;
width: 100%;
- height: 100vh;
+ /* #ifndef APP-PLUS */
+ height: calc(100vh - 44px - 50px); // 非APP平台下生效
+ /* #endif */
+ /* #ifdef APP-PLUS */
+ height: calc(100vh); // APP平台下生效
+ /* #endif */
}
.container {
diff --git a/pages/camera/index.vue b/pages/camera/index.vue
new file mode 100644
index 0000000..9a6f013
--- /dev/null
+++ b/pages/camera/index.vue
@@ -0,0 +1,266 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 照片
+
+
+
+
+ 检查内容
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index e55d3f4..4bb2e21 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -2,35 +2,47 @@
-
-
- {{baseListItem.title}}
+
+
+ {{baseListItem.name}}
+
+
+ 隐患随手拍
+
+
\ No newline at end of file
diff --git a/static/camera2.png b/static/camera2.png
new file mode 100644
index 0000000..4d1d288
Binary files /dev/null and b/static/camera2.png differ
diff --git a/utils/common.js b/utils/common.js
index d69605c..f5d1315 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -2,6 +2,7 @@
// import moment from 'moment';
// import { color } from 'html2canvas/dist/types/css/types/color'; //wyw 这个会影响
+
export function timeFix() {
const time = new Date()
const hour = time.getHours()
@@ -1293,4 +1294,78 @@ export function duplicated(array) {
}
}
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
}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index fea4bc2..6605d81 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -6,17 +6,21 @@ import handle401 from './handle401'
export default (params) => {
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 + '?'
- for (let key in options) {
- opurl += key + '=' + options[key] + '&'
+ let tenantId = ''
+ console.log(options, 'options')
+ 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(opurl, '1231312321')
-
+ console.log(tenantId,'tenantId')
let url = params.url;
let method = params.method || "get";
let data = params.data || {};
@@ -24,13 +28,13 @@ export default (params) => {
// 'Blade-Auth': uni.getStorageSync('token') || '',
'Content-Type': 'application/json;charset=UTF-8',
// 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
- 'Tenant': uni.getStorageSync('tenantId') || '0001', // avue配置相关
+ 'Tenant': tenantId, // avue配置相关
...params.header
}
if (method == "post") {
header = {
- 'Content-Type': 'application/json',
- 'Tenant': uni.getStorageSync('tenantId') || '0001',
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Tenant': tenantId,
...params.header
};
}