ソースを参照

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc_app into V0.0.2

coys 2 年 前
コミット
9772bb93b4

+ 6 - 2
src/components/selectCell/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="date-cell">
-    <van-cell v-if="disabled" :required="required" :title="title" :label="label"/>
-    <van-cell v-else  :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
+    <van-cell v-if="disabled"  :required="required" :title="title" :label="label"/>
+    <van-cell v-else :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
     <van-popup v-model="showPicker" round lazy-render position="bottom" :close-on-popstate="true" get-container="#app">
       <van-picker
         v-bind="$attrs"
@@ -35,6 +35,10 @@ export default {
       type: [Boolean,String],
       default: false,
     },
+    border:{
+      type: [Boolean,String],
+      default: true,
+    },
     //标题
     title:{
       type: String,

+ 4 - 2
src/utils/globalMixins.js

@@ -15,7 +15,7 @@ export default {
       this.setDicts()
     }
   },
- 
+
   methods: {
     ...mapActions(['setDict']),
     setDicts() {
@@ -121,9 +121,10 @@ export default {
         }
       }
     },
-    
+
     isAndroidOrIos() {
       const urls = navigator.userAgent
+      console.log(urls,'urls')
       let isAndroid = urls.indexOf('Android') > -1 || urls.indexOf('Linux') > -1
       let isIos = !!urls.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
       if (isAndroid) {
@@ -132,6 +133,7 @@ export default {
       if (isIos) {
         return 2
       }
+      return 3
     }
   }
 }

+ 68 - 18
src/views/menu/NFCmanage/index.vue

@@ -4,16 +4,16 @@
     <div class="nfc-container">
       <div class="nfc-box">
         <div class="nfc-btn" @touchend="getNfc">
-          <span>点击扫描</span>
+          <span>{{nfcMsg}}</span>
         </div>
       </div>
       <Card>
-        <p class="card-title blue">标签信息</p>
+        <p class="card-title blue">{{disable?'标签信息':'新增标签'}}</p>
         <van-cell-group v-if="!disable" :border="false">
           <van-cell title="NFC编码" :value="formData.code" />
 <!--          <van-cell title="所属机构" value="内容" is-link/>-->
           <van-cell required title="选择所属机构" :label="formData.orgName" is-link  @click="clickItem"/>
-          <select-cell required :disabled="areaList.length == 0" v-model="formData.areaId" title="选择区域" :prop="props" :dataList="areaList"></select-cell>
+          <select-cell required :disabled="areaList.length == 0" v-model="formData.areaId" title="选择区域" :border="true" :prop="props" :dataList="areaList"></select-cell>
           <select-cell required :disabled="pointList.length == 0" v-model="formData.checkId" title="选择采集点" :prop="checkProps" :dataList="pointList"></select-cell>
         </van-cell-group>
         <van-cell-group v-else :border="false">
@@ -28,6 +28,7 @@
         <van-button v-if="disable && nfcInfo.code" type="danger" size="large" @click="unBindNfc">解绑</van-button>
       </div>
     </div>
+<!--    <van-popup v-model="showPopup" :close-on-click-overlay="false"></van-popup>-->
     <org-picker
       :show="showPicker"
       @cancel="cancelPicker"
@@ -54,6 +55,8 @@ export default {
     return{
       disable:true,
       showPicker:false,
+      showPopup:false,
+      nfcMsg:'点击扫描',
       props:{
         label:'name',
         value:'id',
@@ -77,16 +80,41 @@ export default {
         areaId:null,
         checkId:null,
       },
+      flag:false,
     }
   },
   mounted() {
-
+    window.openNFCScanCallBack = this.openNFCScanCallBack;
   },
   computed:{
     ...mapGetters(['orgId']),
   },
   methods:{
-
+    //自定义nfc回调
+    openNFCScanCallBack(data){
+      //alert(data)
+      this.nfcMsg = '读取中...';
+      if(!data) {
+        this.nfcMsg = '点击扫描';
+        this.$toast('扫描失败');
+        //this.showPopup = false;
+        return
+      }
+      let code = JSON.parse(data).content;
+      this.$toast('扫描成功');
+      nfcDetails(code).then(res=>{
+        console.log(res,'res')
+        //this.showPopup = false;
+        setTimeout(()=>{this.nfcMsg = '点击扫描';},500);
+        if(res.data){
+          this.nfcInfo = res.data;
+        }else {
+          this.$toast('未查询到NFC相关信息');
+          this.formData.code = code;
+          this.disable = false;
+        }
+      })
+    },
     bindNfc(){
       let flag = this.checkData();
       if(!flag) return
@@ -106,7 +134,6 @@ export default {
         this.disable = false;
         let {code,orgId,orgName,areaId,checkId} = JSON.parse(JSON.stringify(this.nfcInfo));
         this.formData = {code,orgId,orgName};
-        console.log('orgid改变')
         this.getAreaList();
         this.getCheckList();
         this.$nextTick(()=>{
@@ -131,18 +158,8 @@ export default {
       })
     },
     getNfc(){
-     alert('模拟扫描');
-     let code = '234242342' //'3333333333'
-     nfcDetails(code).then(res=>{
-       console.log(res,'res')
-       if(res.data){
-         this.nfcInfo = res.data;
-       }else {
-         this.$toast('未查询到相关信息');
-         this.formData.code = code;
-         this.disable = false;
-       }
-     })
+     if(this.nfcMsg === '扫描中...') return;
+     this.useNFC();
     },
     changeOrg(selected){
       this.showPicker = false;
@@ -178,6 +195,39 @@ export default {
       console.log(111)
       this.showPicker = true;
     },
+    useNFC(){
+      let system = this.isAndroidOrIos();
+      console.log(system,'system')
+      if(system === 3) return this.$toast('当前环境不支持');
+      const parms = {
+        "iOS_SessionType":"0"
+      };
+      if(system === 1){
+        //android
+        // 判断当前环境是是否存在 js桥 'sap'
+        const hasSap = window.hasOwnProperty('sap');
+        console.log(hasSap,'hasSap')
+        if (hasSap) {
+          // 判断是否存在方法 ?preview
+          const fun = sap.hasOwnProperty('openNFCScan');
+          if (fun) {
+            sap.openNFCScan(JSON.stringify(parms));
+          }
+        }else {
+          this.$toast('当前环境不支持');
+        }
+      }
+
+      if(system === 2){
+        //ios
+        // 判断 ios是否存在方法 preview
+        if(!window.webkit) return this.$toast('当前环境不支持');
+        const fun = window.webkit.messageHandlers.hasOwnProperty('openNFCScan')
+        if (fun) {
+          window.webkit.messageHandlers.openNFCScan.postMessage(JSON.stringify(parms))
+        }
+      }
+    },
   }
 }
 </script>

+ 35 - 19
src/views/menu/message/index.vue

@@ -37,26 +37,24 @@
       left-arrow
       @click-left="onClickLeft"
     />
-    <van-panel v-if="selected" :title="selected.title" :desc="selected.orgName">
+    <div class="detail-box" v-if="selected">
+      <div class="msg-title">
+        <p>{{selected.title}}</p>
+        <p class="cell-time">{{selected.publishTime}}</p>
+      </div>
       <div class="message-content">
         <div class="text-content">
           <p>{{selected.content}}</p>
-        </div>
-        <div v-if="selected.fileList" class="file-box" >
-          附件:
-          <div v-for="(v,i) in selected.fileList">
-            <span style="color: #1989fa;" @click="preview(v)"  :key="v.name">{{v.name}}</span>
+          <div v-if="selected.fileList" class="file-box" >
+            附件:
+            <div v-for="(v,i) in selected.fileList">
+              <span style="color: #1989fa;" @click="preview(v)"  :key="v.name">{{v.name}}</span>
+            </div>
           </div>
-<!--          <div>-->
-<!--            <div v-if="imageList" class="nfc-img" v-for="(v,i) in imageList" :key="v.img" @click="preViewNFC(i)">-->
-<!--              <img :src="imgUrl(v.img)" alt="" >-->
-<!--              <span>{{v.checkName}}</span>-->
-<!--            </div>-->
-<!--          </div>-->
         </div>
-        <p class="cell-time">{{selected.publishTime}}</p>
+
       </div>
-    </van-panel>
+    </div>
   </div>
 
 </div>
@@ -100,7 +98,7 @@ export default {
       this.show = false;
     },
     clickItem(v){
-      if(v.fileList.length > 0){
+      if(v.fileList && v.fileList.length > 0){
         v.fileList.forEach(v=>{
           //p:获取url中的后缀名
           let p = v.url.split('.');
@@ -231,8 +229,9 @@ export default {
 }
 .cell-time{
   text-align: right;
-  height: 60px;
-  padding-top: 20px;
+  height: 30px;
+  font-size: 24px;
+  color:#aaa;
 }
 .point-icon{
   width: 20px;
@@ -248,17 +247,34 @@ export default {
 }
 .message-detail{
   height: calc(100vh - 102px);
+
+}
+.detail-box{
+  height: calc(100% - 90px);
+  overflow: auto;
   background-color: #fff;
 }
+.msg-title{
+  display: flex;
+  flex-direction: column;
+  box-sizing: border-box;
+  width: 100%;
+  padding: 2.666667vw 4.266667vw;
+  overflow: hidden;
+  color: #323233;
+  font-size: 3.733333vw;
+  line-height: 6.4vw;
+  border-bottom: 1px solid #f5f5f5;
+}
 .message-content{
   width: 100%;
+  padding:20px 30px 20px 30px;
   height: 100%;
-  padding:20px 30px 120px 30px;
   overflow: auto;
   .text-content{
     width: 100%;
     min-height: 40px;
-    padding: 20px 0;
+    overflow: auto;
     >p{
       word-break: break-word;
       width: 100%;

+ 3 - 2
vue.config.js

@@ -3,12 +3,13 @@ const defaultSettings = require('./src/config/index.js')
 const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
 
 const resolve = dir => path.join(__dirname, dir)
-// page title
+// page titley
 const name = defaultSettings.title;
 // 生产环境,测试和正式
 const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
 
 const { defineConfig } = require('@vue/cli-service')
+require('events').EventEmitter.defaultMaxListeners = 0;
 // externals
 // const externals = {
 //   vue: 'Vue',
@@ -119,7 +120,7 @@ module.exports = defineConfig({
         }
       },
       '/test': {
-        target: "http://47.92.229.224:8080",
+        target: "http://10.87.10.91:8080",
         // ws:true,
         changOrigin:true,
         pathRewrite:{