From 26e0a007dcae74f41e187aefa9955571c4c5bd8e Mon Sep 17 00:00:00 2001 From: yunkexin <760754045@qq.com> Date: Thu, 25 Jul 2024 11:35:20 +0800 Subject: [PATCH] init --- .gitignore | 1 + .hbuilderx/launch.json | 16 ++ components/custom/query-selector.vue | 225 ++++++++++++++++++++++ main.js | 3 + manifest.json | 8 +- pages.json | 28 ++- pages/apply/complete.vue | 21 ++- pages/apply/index.vue | 137 +++++++++----- pages/camera/index.vue | 266 +++++++++++++++++++++++++++ pages/index/index.vue | 122 +++++++----- pages/webview/webview.vue | 18 ++ static/camera2.png | Bin 0 -> 2636 bytes utils/common.js | 75 ++++++++ utils/request.js | 28 +-- 14 files changed, 829 insertions(+), 119 deletions(-) create mode 100644 .gitignore create mode 100644 .hbuilderx/launch.json create mode 100644 components/custom/query-selector.vue create mode 100644 pages/camera/index.vue create mode 100644 pages/webview/webview.vue create mode 100644 static/camera2.png 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 @@ + + + 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 0000000000000000000000000000000000000000..4d1d2889621bc523caaa07ef4390081f162edb7c GIT binary patch literal 2636 zcmV-S3bXZzP)yp32Zq_@2lfGtE~ld_JsMs|S_$xV`$qw@fi=J#X=_;U39u2Ub~zob>1s4B1ZajY1~#PJ zm^G{g{+JFTQX;_D?H>$00&E3tNmZEy@ddCPc+2H{>SF3fdsW#4j2FF?zT0ggOp##ph+wgd$JSziohX%zOBuC|P*ExWZ&?zcAWJn9f7s=8RGJBx5}-{l$BoMCPT6^Om%_Mg z*t7`7j4*pt`f%n7Ji7}{wZW!ED$~cAzT^^@)6rm5Xh?wO?E>6L%jYG?U2h4Nz9 z{8$3orxB}mLQMl~U8*v9lpzUwfh9)HlG#lA2nNQtc@>s#Q&>Fh#u*Rt?8Vby`8I_% zuc0aP5LMWXe>lAP-Q*NcHy-~Tw0sJ?pS;GPfx12V3t+6? z+QEpn#TdA^FYl89Z~eEEQ?@VAtIPUoyOGE(h)pqwAwYZkx~sYaZaZ%uv$1v#Rz0(R zK~@H=odY$EHV(KAN!Xy-76H8;Fk7#7R}XBiRe10&m^mQ@ZTko_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>39ahbjB&;G_-60PX``!XWv=0-Av5fJ1;co>P+y`h { 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 }; }