diff --git a/.gitignore b/.gitignore
index 8f5fd87..4ab3641 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.history
+unpackage/dist
diff --git a/App.vue b/App.vue
index f21e65c..f0a45a4 100644
--- a/App.vue
+++ b/App.vue
@@ -1,63 +1,95 @@
diff --git a/manifest.json b/manifest.json
index 1a6a7b1..e7501bb 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "巡检保洁",
- "appid" : "",
+ "appid" : "__UNI__659FDE6",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@@ -87,6 +87,6 @@
"uniStatistics" : {
"enable" : false
},
- "sassImplementationName": "node-sass",
+ "sassImplementationName" : "node-sass",
"vueVersion" : "2"
}
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
new file mode 100644
index 0000000..42e3dac
--- /dev/null
+++ b/node_modules/.package-lock.json
@@ -0,0 +1,7 @@
+{
+ "name": "巡检保洁",
+ "version": "1.0.6",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {}
+}
diff --git a/pages.json b/pages.json
index f5462e8..4ea6938 100644
--- a/pages.json
+++ b/pages.json
@@ -4,6 +4,12 @@
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
},
"pages": [
+ {
+ "path": "pages/home/index",
+ "style": {
+ "navigationBarTitleText": ""
+ }
+ },
{
"path": "pages/index/index",
"style": {
diff --git a/pages/home/index.vue b/pages/home/index.vue
new file mode 100644
index 0000000..9835f75
--- /dev/null
+++ b/pages/home/index.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
diff --git a/pages/index/cleanPlan.vue b/pages/index/cleanPlan.vue
index b0b52d5..016a3c2 100644
--- a/pages/index/cleanPlan.vue
+++ b/pages/index/cleanPlan.vue
@@ -53,6 +53,35 @@
+
+
+
+
+
+
+ 刷卡成功
+
+ 暂不
+ 上传图片
+
+
+
+
+
+
+
+
+
+ 刷卡失败
+
+ 暂不
+ 异常上报
+
+
+
+
@@ -95,18 +124,46 @@ export default {
],
paramsId: "",
+ // 刷卡成功弹窗
+ successShow:false,
+ // 刷卡失败弹窗
+ errorShow:false,
};
},
onLoad(options) {
this.paramsId = options.id;
+ window.nfcFn = this.nfcResFn;
+ // this.nfcResFn();
},
created() {
- this.getPlanInfoAreaList();
+ // this.getPlanInfoAreaList();
},
methods: {
+ nfcResFn(data){
+ if(false){
+ console.log('%c%s', 'color:red', 'nfc刷卡成功');
+ this.successShow = true;
+ }else{
+ console.log('%c%s', 'color:red', '刷卡失败');
+ this.errorShow = true;
+ }
+ },
+ // 上传图片
+ uploadFn(){
+ console.log('%c%s', 'color:red', '上传图片');
+ uni.navigateTo({
+ url: "/pages/index/uploadPhoto",
+ });
+ },
+ // 异常上报
+ exceptionReportFn(){
+ console.log('%c%s', 'color:red', '异常上报');
+ },
+ openFn(){},
+ closeFn(){},
changeTab(i) {
console.log(i);
this.selectIdx = i;
@@ -244,4 +301,128 @@ export default {
}
}
}
+.success-box{
+ // overflow:hidden;
+ width:650rpx;
+ padding-top:50rpx;
+ background-color:transparent;
+ .box-content{
+ height:450rpx;
+ background-color: #ffffff;
+ background: linear-gradient(to bottom, #A7DAFC, white 60%, white);
+ border-radius:30rpx;
+ // border:1px solid red;
+ position:relative;
+ .logo{
+ position:absolute;
+ top:-50rpx;
+ left:50%;
+ transform:translateX(-50%);
+ width:200rpx;
+ height:200rpx;
+ background-color:red;
+ }
+ .content-title{
+ position:absolute;
+ top:40%;
+ width:100%;
+ color:black;
+ font-size:40rpx;
+ text-align:center;
+ }
+ .btn-box{
+ position:absolute;
+ bottom:10%;
+ width:100%;
+ display:flex;
+ justify-content:space-evenly;
+ .btn-cancel{
+ width:200rpx;
+ height:70rpx;
+ background-color:#F3F6F7;
+ border-radius:50rpx;
+ display:flex;
+ align-items:center;
+ justify-content:center;
+ font-size:30rpx;
+ color:#32353B;
+ }
+ .btn-success{
+ width:200rpx;
+ height:70rpx;
+ background-color:#4278F4;
+ border-radius:50rpx;
+ display:flex;
+ align-items:center;
+ justify-content:center;
+ font-size:30rpx;
+ color:white;
+ }
+ }
+ }
+}
+.error-box{
+ // overflow:hidden;
+ width:650rpx;
+ padding-top:50rpx;
+ background-color:transparent;
+ .box-content{
+ height:450rpx;
+ background-color: #ffffff;
+ background: linear-gradient(to bottom, #A7DAFC, white 60%, white);
+ border-radius:30rpx;
+ // border:1px solid red;
+ position:relative;
+ .logo{
+ position:absolute;
+ top:-50rpx;
+ left:50%;
+ transform:translateX(-50%);
+ width:200rpx;
+ height:200rpx;
+ background-color:red;
+ }
+ .content-title{
+ position:absolute;
+ top:40%;
+ width:100%;
+ color:black;
+ font-size:40rpx;
+ text-align:center;
+ }
+ .btn-box{
+ position:absolute;
+ bottom:10%;
+ width:100%;
+ display:flex;
+ justify-content:space-evenly;
+ .btn-cancel{
+ width:200rpx;
+ height:70rpx;
+ background-color:#F3F6F7;
+ border-radius:50rpx;
+ display:flex;
+ align-items:center;
+ justify-content:center;
+ font-size:30rpx;
+ color:#32353B;
+ }
+ .btn-success{
+ width:200rpx;
+ height:70rpx;
+ background-color:#4278F4;
+ border-radius:50rpx;
+ display:flex;
+ align-items:center;
+ justify-content:center;
+ font-size:30rpx;
+ color:white;
+ }
+ }
+ }
+}
+::v-deep .u-mode-center-box{
+ margin-top:-500rpx !important;
+ background-color:transparent !important;
+}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index e1f5232..83a5309 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -128,11 +128,14 @@ export default {
},
mounted() {
+ console.log('%c%s', 'color:red', 'mounted--')
this.getPlanByDate();
},
methods: {
onDateChange({ date, isToday }) {
+ // 对接完登陆后解开
+ // return
this.isToday = isToday;
this.currentDate = date;
this.getPlanByDate();
diff --git a/pages/index/nfc.js b/pages/index/nfc.js
new file mode 100644
index 0000000..dbc290e
--- /dev/null
+++ b/pages/index/nfc.js
@@ -0,0 +1,133 @@
+// if ('nfc' in navigator) {
+// console.log('设备支持NFC');
+// uni.showToast({ title: '支持NFC', icon: "none" });
+// } else {
+// uni.showToast({ title: '设备不支持NFC', icon: "none" });
+// console.log('设备不支持NFC');
+// }
+// try {
+// await navigator.permissions.query({ name: 'nfc' });
+// this.nfcMsg = 'NFC权限已授予'
+// console.log('NFC权限已授予');
+// } catch (error) {
+// this.nfcMsg = '获取NFC权限失败'
+// console.error('获取NFC权限失败', error);
+// }
+
+document.addEventListener("plusready", function () {
+ // NFC监听
+ monitorNFC()
+})
+
+function monitorNFC(t) {
+ this.nfcMsg = '111'
+ let NfcAdapter;
+ let NdefRecord;
+ let NdefMessage;
+ function listenNFCStatus() {
+ try {
+ let main = plus.android.runtimeMainActivity();
+ let Intent = plus.android.importClass('android.content.Intent');
+ let Activity = plus.android.importClass('android.app.Activity');
+ let PendingIntent = plus.android.importClass('android.app.PendingIntent');
+ let IntentFilter = plus.android.importClass('android.content.IntentFilter');
+ NfcAdapter = plus.android.importClass('android.nfc.NfcAdapter');
+ let nfcAdapter = NfcAdapter.getDefaultAdapter(main);
+ let intent = new Intent(main, main.getClass());
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ let pendingIntent = PendingIntent.getActivity(main, 0, intent, 0);
+ let ndef = new IntentFilter("android.nfc.action.TECH_DISCOVERED");
+ ndef.addDataType("*/*");
+ let intentFiltersArray = [ndef];
+ let techListsArray = [
+ ["android.nfc.tech.IsoDep"],
+ ["android.nfc.tech.NfcA"],
+ ["android.nfc.tech.NfcB"],
+ ["android.nfc.tech.NfcF"],
+ ["android.nfc.tech.Nfcf"],
+ ["android.nfc.tech.NfcV"],
+ ["android.nfc.tech.NdefFormatable"],
+ ["android.nfc.tech.MifareClassic"],
+ ["android.nfc.tech.MifareUltralight"]
+ ];
+ document.addEventListener("newintent",
+ function () {
+ console.error('newintent');
+ setTimeout(handle_nfc_data1, 1000);
+ }, false);
+ document.addEventListener("pause", function (e) {
+ if (nfcAdapter) {
+ nfcAdapter.disableForegroundDispatch(main);
+ console.log('pause');
+ }
+ }, false);
+ document.addEventListener("resume", function (e) {
+ if (nfcAdapter) {
+ console.log('resume');
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
+ }
+ }, false);
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
+ } catch (e) {
+ console.error(e);
+ }
+ }
+
+ function handle_nfc_data1() {
+ NdefRecord = plus.android.importClass("android.nfc.NdefRecord");
+ NdefMessage = plus.android.importClass("android.nfc.NdefMessage");
+ let main = plus.android.runtimeMainActivity();
+ let intent = main.getIntent();
+ if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) {
+ // if (readyWriteData) {
+ // __write(intent);
+ // readyWriteData = false;
+ // } else if (readyRead) {
+ console.log("进行读取NFC")
+ __read(intent);
+ readyRead = false;
+ // }
+ }
+ }
+
+ function __read(intent) {
+ try {
+ let content = "";
+ waiting = plus.nativeUI.showWaiting("请勿移开标签\n正在读取数据...");
+ let tag = plus.android.importClass("android.nfc.Tag");
+ tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
+ let bytesId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
+ let rawmsgs = intent.getParcelableArrayExtra("android.nfc.extra.NDEF_MESSAGES");
+ let records = rawmsgs[0].getRecords();
+ let result = records[0].getPayload();
+ let s = plus.android.newObject("java.lang.String", result);
+ console.log(s)
+ if (s) {
+ s = s.slice(s.indexOf('en') + 2)
+ }
+ console.log('查询解过:' + s)
+ // console.log("bytesId:" + (bytesId));
+ // console.log("十六进制ID:" + (bytesToHexString(tag.getId())));
+ } catch (e) {
+ alert(e);
+ }
+ readyRead = false
+ waiting.close();
+ }
+
+ function bytesToHexString(inarray) {
+ let i, j, x;
+ let hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
+ "B", "C", "D", "E", "F"
+ ];
+ let out = "";
+ for (j = 0; j < inarray.length; ++j) {
+ x = parseInt(inarray[j]) & 0xff;
+ i = (x >> 4) & 0x0f;
+ out += hex[i];
+ i = x & 0x0f;
+ out += hex[i];
+ }
+ return out;
+ }
+}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 6af3de5..2504969 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -8,7 +8,7 @@ const manager = new RequestManager()
// 先写死调接口
-uni.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwOGRkNzFiZC01N2MxLTQ1YmMtODBiYS0xMjkzYjU4MTViMmEiLCJ1bmlxdWVfbmFtZSI6IuS_nea0gSIsInJvbGUiOiJVc2VyIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIxODE3NDAxMDU2MiIsImdyb3Vwc2lkIjoiNGIyZDk2NjItYTc2OC0wOGYyLWEwYzgtNzYyYjhjNzZkYTJhIiwibmJmIjoxNzQ0MTc1MjA2LCJleHAiOjE3NDQxNzg4MDYsImlhdCI6MTc0NDE3NTIwNn0.1qDnEAJH-bJlEr1wbwjTfqLY9xAyJKzf6bmLP6svUNo')
+// uni.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiI1YmJiYTBhMi04YmJmLTcxMmUtMjMxMy1kYTc0N2E1MGUxYzEiLCJ1bmlxdWVfbmFtZSI6Iua1i-ivlSIsInJvbGUiOiJBZG1pbiIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL21vYmlsZXBob25lIjoiMTgxNzQwMTA1NjEiLCJncm91cHNpZCI6IjRiMmQ5NjYyLWE3NjgtMDhmMi1hMGM4LTc2MmI4Yzc2ZGEyYSIsIm5iZiI6MTc0NDE3OTY2NiwiZXhwIjoxNzQ0MTgzMjY2LCJpYXQiOjE3NDQxNzk2NjZ9.TTLt3vwefdrd8rx3zNN4rr0OI4yp14m781N3PC3lIHw')
const baseRequest = async (url, method, data = {}, loading = true) =>{