wzh 2 سال پیش
والد
کامیت
c6b1d148ae

+ 14 - 0
api/device/device.js

@@ -68,3 +68,17 @@ export function cancelPlan(planId){
         method: 'post',
     })
 }
+//绑定设备
+export function bindDevice(qrcode){
+    return request({
+        url: '/device/bindDevice?qrcode='+qrcode,
+        method: 'post',
+    })
+}
+
+export function deviceList(){
+    return request({
+        url: '/device/deviceList',
+        method: 'post',
+    })
+}

+ 2 - 2
config.js

@@ -1,8 +1,8 @@
 // 应用全局配置
 module.exports = {
   //baseUrl: 'https://vue.ruoyi.vip/prod-api',
-  baseUrl: 'http://127.0.0.1:8090',
-  socketUrl: 'ws://127.0.0.1:8090/websocket',
+  baseUrl: 'http://192.168.1.102:8090',
+  socketUrl: 'ws://192.168.1.102:8090/websocket',
   imgUrl:'https://saomawzz.oss-cn-hangzhou.aliyuncs.com/chargerforeign',
   // 应用信息
   appInfo: {

+ 12 - 6
locale/en.json

@@ -37,7 +37,7 @@
     "立即充电": "Start charging",
     "获取状态": "Get status",
     "设备控制": "Device control",
-    "返回": "Return",
+    "返回上级": "Return back",
     "原密码": "Original password",
     "6位数字新密码": "6-digit new password",
     "端口一": "Port one",
@@ -108,9 +108,13 @@
     "创建时间": "Creation time",
     "重复时间": "Recurring time",
     "重复日期": "Recurring date",
-    "执行时间": "Execution time"
-
-
+    "执行时间": "Execution time",
+    "在线中": "Online",
+    "已离线": "Offline",
+    "连接自动充电": "Automatically charges when connected",
+    "开启": "Turn On",
+    "关闭": "Turn off",
+    "设置成功":"Successfully set"
   },
   "locale.auto": "System",
   "locale.en": "English",
@@ -121,7 +125,7 @@
   "mine": "Mine",
   "login": {
     "language": "Language",
-    "title": "GOOD Charger Platform",
+    "title": "WEGOOD Charger Platform",
     "mailInput": "Please enter your email",
     "pwdInput": "Please enter your password",
     "noAccount": "No account",
@@ -184,6 +188,8 @@
     "mine": "mine",
     "chargerecord": "Charging record",
     "planrecord": "Reservation record",
-    "scan": "Scan"
+    "scan": "Scan",
+    "deviceList": "My Device",
+    "modifypwd":"Change Password"
   }
 }

+ 6 - 4
locale/zh-Hans.json

@@ -48,7 +48,7 @@
 		"current": "设备电流",
 		"chargetime": "已冲时间",
 		"power": "充电功率",
-
+		"nocharge": "空闲中",
 
 		"startcharge": "开始充电",
 		"getinfo": "获取状态",
@@ -59,10 +59,10 @@
 	"page": {
 		"login": "登录",
 		"bluetooth": "蓝牙控制",
-		"charepage": "充电页面",
+		"charepage": "详情",
 		"blueconnect": "蓝牙连接",
 		"setting": "设置",
-		"control": "发送指令",
+		"control": "充电",
 		"plan": "预约",
 		"detail": "设备详情",
 		"controltai": "控制台",
@@ -70,6 +70,8 @@
 		"mine": "我的",
 		"chargerecord": "充电记录",
 		"planrecord": "预约记录",
-		"scan": "扫码"
+		"scan": "扫码",
+		"deviceList": "设备列表",
+		"modifypwd":"修改密码"
 	}
 }

+ 2 - 1
manifest.json

@@ -17,7 +17,8 @@
         "modules" : {
             "Bluetooth" : {},
             "Barcode" : {},
-            "Geolocation" : {}
+            "Geolocation" : {},
+            "Camera" : {}
         },
         "distribute" : {
             "android" : {

+ 31 - 13
pages.json

@@ -4,13 +4,12 @@
     {
       "path": "pages/login",
       "style": {
-        "navigationBarTitleText": "%page.login%"
       }
     },
     {
       "path": "pages/weitiandi/bluetooth/index",
       "style": {
-        "navigationBarTitleText": "%page.bluetooth%",
+        "navigationBarTitleText": "蓝牙控制",
         "navigationStyle": "default"
       }
     },
@@ -24,7 +23,7 @@
     {
       "path": "pages/bluetooth/index/index",
       "style": {
-        "navigationBarTitleText": "%page.blueconnect%",
+        "navigationBarTitleText": "连接蓝牙",
         "navigationStyle": "default"
       }
     },
@@ -45,44 +44,50 @@
      {
   "path": "pages/weitiandi/device/plan",
   "style": {
-    "navigationBarTitleText": "%page.plan%"
+    "navigationBarTitleText": "%page.plan%",
+    "navigationStyle": "default"
   }
   },
     {
       "path" : "pages/weitiandi/device/index",
       "style" : {
         "navigationBarTitleText": "%page.detail%",
-        "enablePullDownRefresh": false
+        "enablePullDownRefresh": false,
+        "navigationStyle": "default"
       }
     },
     {
       "path" : "pages/weitiandi/device/status",
       "style" : {
         "navigationBarTitleText": "%page.detail%",
-        "enablePullDownRefresh": false
+        "enablePullDownRefresh": false,
+        "navigationStyle": "default"
       }
     },
 	{
     "path": "pages/weitiandi/device/setting",
     "style": {
-      "navigationBarTitleText": "%page.setting%"
+      "navigationBarTitleText": "%page.setting%",
+      "navigationStyle": "default"
     }
   },
  {
     "path": "pages/index",
     "style": {
-      "navigationBarTitleText": "%page.controltai%"
+      "navigationBarTitleText": "%page.controltai%",
+      "navigationStyle": "default"
     }
   }, {
     "path": "pages/work/index",
     "style": {
-      "navigationBarTitleText": "%page.worktai%"
+      "navigationBarTitleText": "%page.worktai%",
+      "navigationStyle": "default"
     }
   }, {
     "path": "pages/mine/index",
     "style": {
       "navigationBarTitleText": "%page.mine%",
-      "navigationStyle": "custom"
+      "navigationStyle": "default"
     }
   }, {
     "path": "pages/mine/avatar/index",
@@ -102,7 +107,8 @@
   }, {
     "path": "pages/mine/pwd/index",
     "style": {
-      "navigationBarTitleText": "修改密码"
+      "navigationBarTitleText": "%page.modifypwd%",
+      "navigationStyle": "default"
     }
   }, {
     "path": "pages/mine/setting/index",
@@ -134,7 +140,8 @@
       "style" :
       {
         "navigationBarTitleText": "%page.chargerecord%",
-        "enablePullDownRefresh": false
+        "enablePullDownRefresh": false,
+        "navigationStyle": "default"
       }
 
     },
@@ -143,7 +150,8 @@
       "style" :
       {
         "navigationBarTitleText": "%page.planrecord%",
-        "enablePullDownRefresh": false
+        "enablePullDownRefresh": false,
+        "navigationStyle": "default"
       }
 
     }
@@ -156,6 +164,16 @@
       }
 
     }
+        ,{
+            "path" : "pages/weitiandi/deviceList",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "设备列表",
+                "enablePullDownRefresh": false,
+              "navigationStyle": "default"
+            }
+            
+        }
     ],
   "tabBar": {
     "color": "#000000",

+ 9 - 2
pages/bluetooth/index/index.vue

@@ -14,7 +14,7 @@
 			<text class="list-item-rssi">{{item.rssi}}</text>
 			<view class="list-item-line"></view>
 		</view>
-    <u-modal :show="showPwd" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  :title="$t('buletooth.pwdinput')" >
+    <u-modal :show="showPwd" :confirmText="i18('确认')" :cancelText="i18('取消')" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  :title="$t('buletooth.pwdinput')" >
       <view class="slot-content">
         <u--input
             type="number"
@@ -41,6 +41,7 @@ import ecBLE from '@/utils/ecBLE/ecBLE.js'
 const ecUI = require('@/utils/ecUI.js')
 const ecBLE = require('@/utils/ecBLE/ecBLE.js')
 // #endif
+import i18 from '@/utils/i18.js'
 	let ctx
 	let deviceListData = []
 	export default {
@@ -56,6 +57,9 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
 			}
 		},
 		onLoad() {
+      uni.setNavigationBarTitle({
+        title: this.$t('page.bluetooth')
+      })
       ecUI.showLoading(this.$t('buletooth.init'))
 			ctx = this
       clearInterval(this.timer);
@@ -76,6 +80,9 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
 			}, 100)
 		},
 		methods: {
+      i18(text){
+        return i18(text)
+      },
       cancel(){
         this.showPwd = false;
         uni.navigateBack({
@@ -117,7 +124,7 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
               ecUI.hideLoading()
               getPwd();
               self.buleid = id;
-            },3000)
+            },5000)
             // uni.setStorageSync('blueid', id);
 						// ecBLE.stopBluetoothDevicesDiscovery();
             //

+ 60 - 29
pages/index.vue

@@ -31,7 +31,7 @@
 </template>
 
 <script>
-import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
+import { getDeviceInfoFromQrcode,bindDevice } from '@/api/device/device.js'
 import i18 from '@/utils/i18.js'
   export default {
     data:function(){
@@ -52,11 +52,14 @@ import i18 from '@/utils/i18.js'
     onLoad: function() {
     },
     onShow(){
+      uni.setNavigationBarTitle({
+        title: this.$t('page.worktai')
+      })
     },
     methods:{
       devicelist(){
         uni.navigateTo({
-          url: '/pages/bluetooth/index/index'
+          url: '/pages/weitiandi/deviceList'
         });
       },
       i18(text){
@@ -67,41 +70,69 @@ import i18 from '@/utils/i18.js'
           url: '/pages/bluetooth/index/index'
         });
       },
+      toBind(qrcode){
+        bindDevice(qrcode).then(res=>{
+          let data = res.data;
+          if(data != null){
+            let imei = res.data.imei;
+            let ccid = res.data.ccid;
+            let qrcode = res.data.qrcode;
+            let uuid = res.data.uuid;
+            this.$modal.showToast("绑定成功");
+          }else{
+            this.$modal.showToast("绑定失败");
+          }
+        })
+      },
       scan(){
-        if(window.location.href.indexOf("localhost") != -1){
-          this.scan2();
-        }else{
-          uni.navigateTo({
-            url: '/pages/weitiandi/device/scan'
-          });
-        }
-
-
-        // uni.scanCode({
-        //   success: function (res) {
-        //     console.log('条码类型:' + res.scanType);
-        //     console.log('条码内容:' + res.result);
-        //     getDeviceInfoFromQrcode(res.result).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
-        //         });
-        //       }
-        //     });
-        //   }
-        // });
+        let self = this;
+        uni.scanCode({
+          success: function (res) {
+            console.log('条码类型:' + res.scanType);
+            console.log('条码内容:' + res.result);
+            getDeviceInfoFromQrcode(res.result).then(res=>{
+              if(res.data != null){
+                let imei = res.data.imei;
+                let ccid = res.data.ccid;
+                let qrcode = res.data.qrcode;
+                let uuid = res.data.userId;
+                if(uuid){
+                  self.$modal.showToast("该设备已被绑定");
+                }else{
+                  self.$modal.confirm("确认绑定该设备?").then(res=>{
+                    self.toBind(qrcode)
+                  })
+                }
+                // uni.navigateTo({
+                //   url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+                // });
+              }else{
+                self.$modal.showToast("找不到设备,请联系管理员");
+              }
+            });
+          }
+        });
       },
       scan2(){
+        let self = this;
         getDeviceInfoFromQrcode("http://wetiandi.com/app/index.php?i=1&j=1&c=entry&m=wdl_shopping&do=wepay&sn=GD1B342399").then(res=>{
             if(res.data != null){
                   let imei = res.data.imei;
                   let ccid = res.data.ccid;
                   let qrcode = res.data.qrcode;
-                  uni.navigateTo({
-                    url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
-                  });
+                  let uuid = res.data.userId;
+                  if(uuid){
+                    self.$modal.showToast("该设备已被绑定");
+                  }else{
+                    self.$modal.confirm("确认绑定该设备?").then(res=>{
+                      self.toBind(qrcode)
+                    })
+                  }
+                  // uni.navigateTo({
+                  //   url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+                  // });
+            }else{
+              self.$modal.showToast("找不到设备,请联系管理员");
             }
         });
       }

+ 5 - 2
pages/login.vue

@@ -97,7 +97,7 @@
 	    <text @click="buleTeeth">{{ $t('login.buletooth') }}</text>
 	</view>
 	</view>
-    <u-picker :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
+    <u-picker @cancel="cancelLocale" :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
   </view>
 </template>
 
@@ -150,6 +150,9 @@
       this.checkLogin();
     },
     methods: {
+      cancelLocale(){
+        this.showLocale = false;
+      },
       setLocale(){
         this.locale = uni.getLocale()
         if(this.locale == "en"){
@@ -169,7 +172,7 @@
           this.showLocale = true;
       },
       buleTeeth(){
-        this.$tab.reLaunch('/pages/bluetooth/index/index')
+        this.$tab.navigateTo('/pages/bluetooth/index/index')
       },
       checkLogin(){
         let token = getToken()

+ 10 - 2
pages/mine/index.vue

@@ -1,6 +1,6 @@
 <template>
     <view class="mine-container" :style="'background: url('+this.imgUrl+'/index/mingbg.png) no-repeat 100% 100%;height:'+windowHeight+'px;background-position: 0 0;background-size: 100% 100%;'">
-      <view style="position: fixed;right: 10px;z-index: 999999;top:10px" @click="changeLocale">
+      <view style="position: fixed;right: 10px;z-index: 999999;top:30px" @click="changeLocale">
         {{ $t('login.language') }}:{{localeConfig[locale]}}<uni-icons type="gear" size="15"></uni-icons>
       </view>
     <!--顶部个人信息栏-->
@@ -48,7 +48,7 @@
           </view>
         </view>
       </view>
-      <u-picker :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
+      <u-picker @cancel="cancelLocale" :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
 
     </view>
 
@@ -80,7 +80,15 @@
     onLoad(){
       this.setLocale();
     },
+    onShow(){
+      uni.setNavigationBarTitle({
+        title: this.$t('page.mine')
+      })
+    },
     methods: {
+      cancelLocale(){
+        this.showLocale = false;
+      },
       changeLanguage(e){
         this.showLocale  =false;
         console.log(e.value[0].id)

+ 5 - 0
pages/mine/pwd/index.vue

@@ -65,6 +65,11 @@
     onReady() {
       this.$refs.form.setRules(this.rules)
     },
+    onShow(){
+      uni.setNavigationBarTitle({
+        title: this.$t('page.modifypwd')
+      })
+    },
     methods: {
       i18(text){
         return i18(text)

+ 10 - 13
pages/weitiandi/bluetooth/index.vue

@@ -9,7 +9,7 @@
 
       <view class="dportitems">
         <view class="dportitem " v-for="item in curPort" @click="selectPort(item.id);">
-          <p class="dpropitem-title "> {{ item.text }}</p>
+          <p class="dpropitem-title "> {{ i18(item.text )}}</p>
           <view style="position: absolute;right: 0px;z-index: 9999" v-if="item.id == choosePort">
             <image class="dportitem-img" style="width: 15px;height: 15px" src="/static/images/new/start/choose.png"/>
           </view>
@@ -106,7 +106,7 @@
       <view class="control-btn" @click="goBack">
         <image class="btn-image" src="/static/images/new/start/back.png" >
         </image>
-        <view>{{ i18('返回') }}</view>
+        <view>{{ i18('返回上级') }}</view>
       </view>
 <!--      <view class="control-btn">-->
 <!--        <image class="btn-image" :src="imgUrl+'/control/record.png'" >-->
@@ -197,6 +197,9 @@ export default {
    this.checkPassword();
  },
   onShow(){
+    uni.setNavigationBarTitle({
+      title: this.$t('page.control')
+    })
     this.buletooth();
 
   },
@@ -243,9 +246,9 @@ export default {
       let date = new Date();
       let nowDay = date.getDate();
       let hour = value[1]+"";
-      hour = parseInt(hour.substr(0,hour.length-1),10);
+      hour = parseInt(hour,10);
       let min = value[2]+"";
-      min = parseInt(min.substr(0,min.length-1),10);
+      min = parseInt(min,10);
       let todayTotalMin = 0;
       let planDate = {min:min,hour:hour};
       let nowHour = date.getHours();
@@ -408,12 +411,6 @@ export default {
       }
       self.$forceUpdate();
       console.log('收到服务器内容:' + JSON.stringify(data));
-      if(!this.firstInit){
-        this.firstInit = true;
-        if(self.portDetail.portStatus == 5){
-          self.startCharge();
-        }
-      }
     },
     planCharge(){
       if(this.portDetail.portStatus == 6){
@@ -488,15 +485,15 @@ export default {
       let arr3 = [];
       let arr4 = [];
       for (let i = 0; i < hour; i++) {
-        arr2.push(i+"时")
+        arr2.push(i)
       }
       this.columnData[0] = arr2;
       for (let i = hour+1; i < 24; i++) {
-        arr3.push(i+"时")
+        arr3.push(i)
       }
       this.columnData[1] = arr3;
       for (let i = 0; i <= 59; i++) {
-        arr4.push(i+"分")
+        arr4.push(i)
       }
       this.planCols = [arr1, arr3, arr4]
       this.showPlan = true;

+ 64 - 11
pages/weitiandi/bluetooth/setting.vue

@@ -9,9 +9,20 @@
             {{ item.text }}
           </view>
         </view>
-        <view class="prop-input" v-if="current.custom">
-          <input v-model="current.customValue" class="input" :placeholder="i18('请输入电流')"/>
-          <view style="color: #0E9F9B">A</view>
+        <view class="prop-input" style="width: 100%" v-if="current.custom">
+          <view style="width: 80%">
+            <u-slider min="8" max="32" step="2" v-model="current.customValue"></u-slider>
+          </view>
+          <view style="color: #1A87FF">{{current.customValue}}A</view>
+        </view>
+      </view>
+
+      <view class="prop-item">
+        <view class="prop-title">{{i18('连接自动充电')}}</view>
+        <view class="prop-value">
+          <view :style="item.style" class="value-tag" @click=" setAutoCharge(item.value)" v-for="item in autoCharge">
+            {{ i18(item.title) }}
+          </view>
         </view>
       </view>
 
@@ -82,6 +93,17 @@ export default {
       ccid:"",
       visitTime: "",
       mainBoardInfo:{},
+      autoCharge:[
+        {
+          title:"开启",
+          value:1,
+          style: ""
+        },
+        {
+          title:"关闭",
+          value:2,
+          style: ""
+        }],
       current: {
         items: [
           {text: "8A", style: "", value: 8},
@@ -108,13 +130,44 @@ export default {
   onLoad(opt) {
     this.deviceId = opt.id;
     this.ccid = opt.ccid;
+    this.checkAutoCharge();
     this.buletooth();
 
   },
+  onShow(){
+    uni.setNavigationBarTitle({
+      title: this.$t('page.setting')
+    })
+  },
   methods: {
     i18(text){
       return i18(text)
     },
+    checkAutoCharge(){
+       let autoCharge = this.getAutoChargeValue();
+       this.setAutoCharge(autoCharge,true);
+    },
+    getAutoChargeValue(){
+      let autoCharge = uni.getStorageSync("autoCharge");
+      if(!autoCharge ){
+        autoCharge = 1;
+      }
+      return autoCharge;
+    },
+    setAutoCharge(value,tip){
+      for (let i = 0; i < this.autoCharge.length; i++) {
+        let obj = this.autoCharge[i];
+        if(obj.value == value){
+          obj.style = ";  background: #1A87FF;color:white";
+        }else{
+          obj.style = ";  background: rgb(227, 242, 245);color: #1A87FF;"
+        }
+      }
+      uni.setStorageSync("autoCharge",value);
+      if(!tip){
+        this.$modal.showToast("设置成功")
+      }
+    },
     closeSocket(){
       ecBLE.onBLEConnectionStateChange(() => {})
       ecBLE.onBLECharacteristicValueChange(() => {})
@@ -209,14 +262,14 @@ export default {
         let dian = items[i];
         if(dian.value == max_current){
           hasValue = true;
-          dian.style = ";  background: #0E9F9B;color:white"
+          dian.style = ";  background: #1A87FF;color:white"
         }else{
-          dian.style = ";  background: rgb(227, 242, 245);color: #0E9F9B;"
+          dian.style = ";  background: rgb(227, 242, 245);color: #1A87FF;"
         }
       }
       if(!hasValue){
         this.current.custom = true;
-        items[len-1].style = ";  background: #0E9F9B;color:white"
+        items[len-1].style = ";  background: #1A87FF;color:white"
       }
       this.current.customValue = max_current;
     },
@@ -225,12 +278,12 @@ export default {
       let len = items.length;
       for (let i = 0; i < len; i++) {
         let dian = items[i];
-        dian.style = ";  background: rgb(227, 242, 245);color: #0E9F9B;"
+        dian.style = ";  background: rgb(227, 242, 245);color: #1A87FF;"
       }
-      item.style = ";  background: #0E9F9B;color:white"
+      item.style = ";  background: #1A87FF;color:white"
       if (item.value == -1) {
         obj.custom = true;
-        obj.customValue = 0;
+        obj.customValue = 8;
       } else {
         obj.custom = false;
         obj.customValue = item.value;
@@ -327,7 +380,7 @@ export default {
 
 .value-tag {
   background: rgb(227, 242, 245);
-  color: #0E9F9B;
+  color: #1A87FF;
   width: 14vw;
   height: 4vh;
   line-height: 4vh;
@@ -364,7 +417,7 @@ export default {
 }
 
 .btn {
-  background: #0E9F9B;
+  background: #1A87FF;
   text-align: center;
   color: white;
   height: 6vh;

+ 22 - 6
pages/weitiandi/bluetooth/status.vue

@@ -1,10 +1,13 @@
 <template>
   <view class="container">
-    <view style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:30px;z-index: 9999;background: rgb(243,157,116);color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="goBack">
+    <view  style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:30px;z-index: 9999;background: rgb(243,157,116);color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="goBack">
       {{$t('charge.break')}}
     </view>
 
-    <view style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:120px;z-index: 9999;background: #1A87FF;color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="modifyPwd">
+    <view v-if="locale == 'en'" style="height: 40px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:120px;z-index: 9999;background: #1A87FF;color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="modifyPwd">
+      {{$t('charge.modifypwd')}}
+    </view>
+    <view v-else style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:120px;z-index: 9999;background: #1A87FF;color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="modifyPwd">
       {{$t('charge.modifypwd')}}
     </view>
     <view style=";position: relative;height: 250px;margin-top:2vh;">
@@ -36,11 +39,11 @@
                 {{$t('charge.charging')}}
               </view>
 
-              <view v-if="portDetail.portStatus == 6">
+              <view v-else-if="portDetail.portStatus == 6">
                 {{$t('charge.planed')}}
               </view>
 
-              <view v-if="portDetail.portStatus == 2">
+              <view v-else-if="portDetail.portStatus == 5">
                 {{$t('charge.connected')}}
               </view>
 
@@ -161,6 +164,7 @@ let sendData = ''
 export default {
  data() {
    return {
+     locale:"",
      oldPwd:"",
      pwd:"",
      showPwd:false,
@@ -192,10 +196,14 @@ export default {
    }
  },
  onLoad() {
+   this.locale = uni.getLocale();
    console.log("status comeing")
    this.checkPassword();
  },
   onShow(){
+    uni.setNavigationBarTitle({
+      title: this.$t('page.detail')
+    })
     this.buletooth();
 
   },
@@ -399,11 +407,19 @@ export default {
       console.log('收到服务器内容:' + JSON.stringify(data));
       if(!this.firstInit){
         this.firstInit = true;
-        if(self.portDetail.portStatus == 5){
+        let autoCharge = self.getAutoChargeValue()
+        if(self.portDetail.portStatus == 5 && autoCharge == 1){
           self.startCharge();
         }
       }
     },
+    getAutoChargeValue(){
+      let autoCharge = uni.getStorageSync("autoCharge");
+      if(!autoCharge ){
+        autoCharge = 1;
+      }
+      return autoCharge;
+    },
     planCharge(){
       if(this.portDetail.portStatus == 6){
         this.$modal.confirm("确认取消预约?").then(res=>{
@@ -1028,7 +1044,7 @@ padding:0 22px;
   display: flex;
   justify-content: center;
   align-items: center;
-  left: 25%;
+  left: 15%;
   position: relative;
 }
 .dstatus{

+ 5 - 0
pages/weitiandi/device/chargerecord.vue

@@ -45,6 +45,11 @@
         chargeList: [],
       }
     },
+    onShow(){
+      uni.setNavigationBarTitle({
+        title: this.$t('page.chargerecord')
+      })
+    },
     methods: {
       i18(text){
         return i18(text)

+ 1 - 1
pages/weitiandi/device/index.vue

@@ -100,7 +100,7 @@
       <view class="control-btn" @click="goBack">
         <image class="btn-image" src="/static/images/new/start/back.png" >
         </image>
-        <view>{{ i18('返回') }}</view>
+        <view>{{ i18('返回上级') }}</view>
       </view>
       <!--      <view class="control-btn">-->
       <!--        <image class="btn-image" :src="imgUrl+'/control/record.png'" >-->

+ 5 - 0
pages/weitiandi/device/planrecord.vue

@@ -55,6 +55,11 @@ export default {
       chargeList: [],
     };
   },
+  onShow(){
+    uni.setNavigationBarTitle({
+      title: this.$t('page.planrecord')
+    })
+  },
   methods: {
     i18(text){
       return i18(text)

+ 34 - 4
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";
+import {getDeviceInfoFromQrcode,bindDevice} from "@/api/device/device";
 	export default {
     components: {
       mumuGetQrcode
@@ -17,14 +17,44 @@ import {getDeviceInfoFromQrcode} from "@/api/device/device";
 			}
 		},
 		methods: {
+      toBind(qrcode){
+        bindDevice(qrcode).then(res=>{
+          let data = res.data;
+          if(data != null){
+            let imei = res.data.imei;
+            let ccid = res.data.ccid;
+            let qrcode = res.data.qrcode;
+            this.$modal.showToast("绑定成功");
+            setTimeout(function (){
+              uni.navigateTo({
+                url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+              });
+            },2000)
+          }else{
+            this.$modal.showToast("绑定失败");
+          }
+        })
+      },
       qrcodeSucess(data) {
+        let self = this;
         getDeviceInfoFromQrcode(data).then(res=>{
           if(res.data != null){
             let imei = res.data.imei;
             let ccid = res.data.ccid;
-            uni.redirectTo({
-              url: '/pages/weitiandi/device/status?id='+imei+'&ccid='+ccid
-            });
+            let qrcode = res.data.qrcode;
+            let uuid = res.data.userId;
+            if(uuid){
+              this.$modal.showToast("该设备已被绑定");
+            }else{
+              this.$modal.confirm("确认绑定该设备?").then(res=>{
+                self.toBind(qrcode)
+              })
+            }
+            // uni.navigateTo({
+            //   url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+            // });
+          }else{
+            this.$modal.showToast("找不到设备,请联系管理员");
           }
         });
       },

+ 14 - 12
pages/weitiandi/device/setting.vue

@@ -9,9 +9,11 @@
             {{ item.text }}
           </view>
         </view>
-        <view class="prop-input" v-if="current.custom">
-          <input v-model="current.customValue" class="input" :placeholder="i18('请输入电流')"/>
-          <view style="color: #0E9F9B">A</view>
+        <view class="prop-input" style="width: 100%" v-if="current.custom">
+         <view style="width: 80%">
+           <u-slider min="8" max="32" step="2" v-model="current.customValue"></u-slider>
+         </view>
+          <view style="color: #1A87FF">{{current.customValue}}A</view>
         </view>
       </view>
 
@@ -79,7 +81,7 @@ export default {
           {text: i18("自定义"), style: "", value: -1}
         ],
         custom: false,
-        customValue: ''
+        customValue: 8
       }
 
     }
@@ -159,14 +161,14 @@ export default {
         let dian = items[i];
         if(dian.value == max_current){
           hasValue = true;
-          dian.style = ";  background: #0E9F9B;color:white"
+          dian.style = ";  background: #1A87FF;color:white"
         }else{
-          dian.style = ";  background: rgb(227, 242, 245);color: #0E9F9B;"
+          dian.style = ";  background: rgb(227, 242, 245);color: #1A87FF;"
         }
       }
       if(!hasValue){
         this.current.custom = true;
-        items[len-1].style = ";  background: #0E9F9B;color:white"
+        items[len-1].style = ";  background: #1A87FF;color:white"
       }
       this.current.customValue = max_current;
     },
@@ -175,12 +177,12 @@ export default {
       let len = items.length;
       for (let i = 0; i < len; i++) {
         let dian = items[i];
-        dian.style = ";  background: rgb(227, 242, 245);color: #0E9F9B;"
+        dian.style = ";  background: rgb(227, 242, 245);color: #1A87FF;"
       }
-      item.style = ";  background: #0E9F9B;color:white"
+      item.style = ";  background: #1A87FF;color:white"
       if (item.value == -1) {
         obj.custom = true;
-        obj.customValue = 0;
+        obj.customValue = 8;
       } else {
         obj.custom = false;
         obj.customValue = item.value;
@@ -284,7 +286,7 @@ export default {
 
 .value-tag {
   background: rgb(227, 242, 245);
-  color: #0E9F9B;
+  color: #1A87FF;
   width: 14vw;
   height: 4vh;
   line-height: 4vh;
@@ -321,7 +323,7 @@ export default {
 }
 
 .btn {
-  background: #0E9F9B;
+  background: #1A87FF;
   text-align: center;
   color: white;
   height: 6vh;

+ 5 - 5
pages/weitiandi/device/status.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <view style=";position: relative;height: 250px;margin-top:2vh;">
       <view class="dtop">
-        <view class="can">
+        <view class="can" style="background-image: url(/static/images/new/quan.png);">
 
           <view class="box">
             <!--view class="top_ball one"></view-->
@@ -30,11 +30,11 @@
               <view v-if="portDetail.portStatus == 2">
                 {{$t('charge.charging')}}
               </view>
-              <view v-if="portDetail.portStatus == 6">
+              <view v-else-if="portDetail.portStatus == 6">
                 {{$t('charge.planed')}}
               </view>
 
-              <view v-if="portDetail.portStatus == 2">
+              <view v-else-if="portDetail.portStatus == 5">
                 {{$t('charge.connected')}}
               </view>
 
@@ -813,7 +813,7 @@ export default {
   z-index: 0;
   width: 211px;
   height: 211px;
-  background-image: url(/static/images/new/quan.png);
+
   background-size: cover;
   display: flex;
   justify-content: center;
@@ -827,7 +827,7 @@ export default {
   display: flex;
   justify-content: center;
   align-items: center;
-  left: 25%;
+  left: 15%;
   position: relative;
 }
 .dstatus{

+ 134 - 0
pages/weitiandi/deviceList.vue

@@ -0,0 +1,134 @@
+<template>
+  <view class="container">
+    <view class="list-item">
+      <view class="item" v-for="item in chargeList" :key="item.id">
+        <view class="item-header">
+          <view class="item-title">
+            {{i18('设备编号')}}:{{ item.imei }}
+          </view>
+          <view class="item-status">
+            <uni-tag type="success" :text="i18('在线中')" v-if="item.status === 1"></uni-tag>
+            <uni-tag type="default" :text="i18('已离线')" v-if="item.status === 2"></uni-tag>
+          </view>
+        </view>
+        <view class="item-body">
+          <view style="font-size: 12px; margin: 5px 0;position: relative">
+            {{i18('创建时间')}}:{{ item.createTime }}
+            <view class="item-detail-btn" @click="detail(item)">
+              {{i18('设备控制')}}
+            </view>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { deviceList } from '@/api/device/device.js';
+import i18 from '@/utils/i18.js'
+export default {
+  data() {
+    return {
+      startText:"more",
+      search:{
+        pageNum:1,
+        pageSize:6,
+        reasonable:true,
+      },
+      contentText: {
+        contentdown: i18('点击查看更多'),
+        contentrefresh: i18('加载中'),
+        contentnomore: i18('没有更多'),
+      },
+      chargeList: [],
+    };
+  },
+  onShow(){
+    uni.setNavigationBarTitle({
+      title: this.$t('page.deviceList')
+    })
+  },
+  methods: {
+    i18(text){
+      return i18(text)
+    },
+    getMore(){
+      this.search.pageNum++;
+      this.deviceList();
+    },
+    async deviceList() {
+      deviceList().then(res=>{
+          this.startText = "more"
+          this.chargeList =  res.data;
+          if(this.chargeList.length == 1){
+            this.detail(this.chargeList[0])
+          }
+      })
+    },
+    detail(item){
+      let qrcode = item.qrcode;
+      let imei = item.imei;
+      let ccid = item.ccid;
+      uni.navigateTo({
+        url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+      });
+    },
+  },
+  created() {
+    this.deviceList();
+  },
+};
+</script>
+<style>
+.container {
+  background: rgb(249, 252, 255);
+  inset: 0;
+  position: absolute;
+}
+
+.list-item {
+  margin: 0vw;
+}
+
+.item {
+  box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
+  border-radius: 4px;
+  background: #FFFFFF;
+  margin: 4vw;
+  padding: 4vw;
+}
+
+.item-title {
+  display: inline-block;
+  float: left;
+}
+
+.item-status {
+  display: inline-block;
+  float: right;
+}
+
+.item-header {
+  border-bottom: 1px solid lightgray;
+  height: 4vh;
+  font-size: 12px;
+}
+
+.item-body {
+  padding-top: 4vw;
+  line-height: 3vh;
+}
+
+.item-time {
+  color: #545454;
+  font-size: 12px;
+  margin-bottom: 4px
+}
+.item-detail-btn{
+  position: absolute;
+  right: 0px;
+  top:0px;
+  text-decoration: underline;
+}
+</style>

+ 5 - 1
permission.js

@@ -7,7 +7,7 @@ const loginPage = "/pages/login"
 const whiteList = [
   '/pages/login', '/pages/common/webview/index','/pages/bluetooth/index/index','/pages/weitiandi/bluetooth/index',
 
-  '/pages/weitiandi/bluetooth/setting'
+  '/pages/weitiandi/bluetooth/setting','/pages/weitiandi/bluetooth/status'
 ]
 
 // 检查地址白名单
@@ -30,6 +30,10 @@ list.forEach(item => {
         if (checkWhite(to.url)) {
           return true
         }
+        uni.showToast({
+          icon:"error",
+          title:"需要登录"
+        })
         uni.reLaunch({ url: loginPage })
         return false
       }