Explorar el Código

初始化版本1.0

wzh hace 2 años
padre
commit
00fc7bdb59
Se han modificado 5 ficheros con 19 adiciones y 28 borrados
  1. 3 3
      config.js
  2. 2 2
      manifest.json
  3. 0 17
      pages/index.vue
  4. 4 3
      pages/weitiandi/device/index.vue
  5. 10 3
      pages/weitiandi/device/scan.vue

+ 3 - 3
config.js

@@ -1,13 +1,13 @@
 // 应用全局配置
 module.exports = {
   //baseUrl: 'https://vue.ruoyi.vip/prod-api',
-  baseUrl: 'http://localhost:8090',
-  socketUrl: 'ws://localhost:8090/websocket',
+  baseUrl: 'http://120.55.183.139:8090',
+  socketUrl: 'ws://120.55.183.139:8090/websocket',
   imgUrl:'https://saomawzz.oss-cn-hangzhou.aliyuncs.com/chargerforeign',
   // 应用信息
   appInfo: {
     // 应用名称
-    name: "ruoyi-app",
+    name: "充电助理",
     // 应用版本
     version: "1.1.0",
     // 应用logo

+ 2 - 2
manifest.json

@@ -57,8 +57,8 @@
     "h5" : {
         "template" : "static/index.html",
         "devServer" : {
-            "port" : 9090,
-            "https" : false
+            "port" : 443,
+            "https" : true
         },
         "title" : "充电助理",
         "router" : {

+ 0 - 17
pages/index.vue

@@ -25,7 +25,6 @@
 </template>
 
 <script>
-  import {getDeviceInfoFromQrcode} from "@/api/device/device";
 
   export default {
     data:function(){
@@ -46,24 +45,8 @@
     onLoad: function() {
     },
     onShow(){
-      this.readScanResult();
     },
     methods:{
-      readScanResult(){
-        let self = this;
-        uni.$on("scanResult", data => {
-          getDeviceInfoFromQrcode(data).then(res=>{
-            if(res.data != null){
-              let imei = res.data.imei;
-              let ccid = res.data.ccid;
-              uni.navigateTo({
-                url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
-              });
-            }
-          });
-          uni.$off('scanResult');
-        })
-      },
       scan(){
         if(window.location.href.indexOf("localhost") != -1){
           this.scan2();

+ 4 - 3
pages/weitiandi/device/index.vue

@@ -150,7 +150,6 @@ export default {
  onLoad(opt) {
    this.deviceInfo.deviceId = opt.id;
    this.deviceInfo.ccid = opt.ccid;
-
  },
   onShow(){
     this.getInfo();
@@ -179,8 +178,8 @@ export default {
         let type = data.type;
         let real_data = data.real_data;
         if(type == 103){
-            self.portDetail = real_data;
-            self.$modal.closeLoading();
+          self.portDetail = real_data
+          self.$modal.closeLoading();
         }
         if(type == 116){
           self.$modal.closeLoading();
@@ -195,6 +194,7 @@ export default {
           self.formatMainboardData();
           self.$modal.closeLoading();
         }
+        self.$forceUpdate();
         console.log('收到服务器内容:' + JSON.stringify(data));
       });
       scriptTask.onClose(function (res) {
@@ -233,6 +233,7 @@ export default {
    getInfo() {
     this.$modal.loading("正在获取状态,请稍等...");
      sendPortDetailCmd(this.deviceInfo).then(res => {
+       this.$modal.loading("正在获取状态,请稍等...");
         this.visitTime = res.msg;
         if(!this.visitTime){
           this.$modal.msg("请重新进入页面");

+ 10 - 3
pages/weitiandi/device/scan.vue

@@ -6,7 +6,7 @@
 
 <script>
 import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'
-
+import {getDeviceInfoFromQrcode} from "@/api/device/device";
 	export default {
     components: {
       mumuGetQrcode
@@ -18,8 +18,15 @@ import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcod
 		},
 		methods: {
       qrcodeSucess(data) {
-        uni.$emit("scanResult",data);
-        uni.navigateBack({})
+        getDeviceInfoFromQrcode(data).then(res=>{
+          if(res.data != null){
+            let imei = res.data.imei;
+            let ccid = res.data.ccid;
+            uni.redirectTo({
+              url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
+            });
+          }
+        });
       },
       qrcodeError(err) {
         console.log(err)