Pārlūkot izejas kodu

添加国际化

wzh 2 gadi atpakaļ
vecāks
revīzija
85dd1a5f95

+ 182 - 1
locale/en.json

@@ -1,8 +1,189 @@
 {
+  "common":{
+    "正在加载":"Loading",
+    "确认": "Confirm",
+    "取消": "Cancel",
+    "度": "kWh",
+    "分钟": "Min",
+    "温馨提示": "Warm reminder",
+    "桩控制最大输出电流,当功率没有达到请检查车的状态或者车的设置":"The charging station controls the maximum output current. If the power is not reached, please check the status or settings of the vehicle",
+    "启动充电->设备管理->可设置设备最大输出电流":"Start charging -> Device management -> You can set the maximum output current of the device",
+    "为保障您远程启动正常充电,请确保枪头完全连接充电口,同时确认您的爱车处于立即充电状态下": "To ensure that remote charging starts normally, please make sure that the charging gun is fully connected to the charging port and confirm that your vehicle is in immediate charging mode",
+    "注意规范安全充电,停好车,锁好车。": "Please follow the safety charging procedures, park your vehicle properly, and lock your vehicle.",
+    "原密码不能为空":"The original password cannot be empty",
+    "原密码不对":"The original password is incorrect",
+    "密码不能为空":"The password cannot be empty",
+    "密码修改成功":"Password changed successfully",
+    "最大预约时间为24小时": "The maximum reservation time is 24 hours",
+    "正在获取状态,请稍等...": "Getting status, please wait...",
+    "停止成功": "Stopped successfully",
+    "启动成功": "Started successfully",
+    "需要停止充电么?": "Do you need to stop charging?",
+    "请先将充电枪插入后再点击充电": "Please insert the charging gun first and then click \"Start Charging\".",
+    "确认开始充电么?": "Are you sure you want to start charging?",
+    "端口无法开始充电": "The port cannot start charging.",
+    "设备端口": "Device port",
+    "空闲中": "Idle",
+    "充电中": "Charging",
+    "禁用中": "Disabled",
+    "故障中": "Fault",
+    "已连接": "Connected",
+    "已预约": "Booked",
+    "预约充电": "Book charging",
+    "点击预约充电": "Click to book charging",
+    "可点击取消预约": "Can click to cancel the booking",
+    "设备操作": "Device operation",
+    "停止充电": "Stop charging",
+    "立即充电": "Start charging",
+    "获取状态": "Get status",
+    "设备控制": "Device control",
+    "返回": "Return",
+    "原密码": "Original password",
+    "6位数字新密码": "6-digit new password",
+    "端口一": "Port one",
+    "端口二":"Port two",
+    "确认取消预约?": "Confirm cancel booking?",
+    "取消成功": "Cancellation successful",
+    "今日": "Today",
+    "明日": "Tomorrow",
+    "保存中。。": "Saving...\n\n",
+    "保存成功": "Saved successfully",
+    "正在获取配置信息": "Getting configuration information...",
+    "正在重置,请稍等...": "Resetting, please wait...",
+    "正在重启中,请稍等...": "Restarting, please wait...",
+    "自定义": "Customized",
+    "充电电流": "Charging current",
+    "请输入电流": "Please enter the current",
+    "获取主板配置": "MainBoard configuration",
+    "恢复默认配置": "Restore default settings",
+    "重启充电桩": "Restart charging station",
+    "蓝牙连接": "Bluetooth connection",
+    "扫码绑定": "Scan to bind",
+    "设备列表": "Device list",
+    "点击登录": "Click to log in",
+    "你好": "Welcome",
+    "账户设置": "Account settings",
+    "充电记录": "Charging record",
+    "预约记录": "Reservation record",
+    "确定注销并退出系统吗?": "Are you sure you want to log out and exit the system?",
+    "请输入旧密码": "Enter the old password",
+    "请输入新密码": "Please enter the new password",
+    "旧密码": "Old password",
+    "新密码": "New Password",
+    "确认密码": "Confirm Password",
+    "请确认新密码": "Please confirm the new password",
+    "提交": "Submit",
+    "退出登录": "Log out",
+    "旧密码不能为空": "Old password cannot be empty",
+    "新密码不能为空": "New password cannot be empty",
+    "长度在 6 到 20 个字符": "Length should be between 6 and 20 characters",
+    "确认密码不能为空": "Confirmed password cannot be empty",
+    "两次输入的密码不一致": "The two passwords entered do not match",
+    "修改成功": "Modification succeeded",
+    "单次": "Single",
+    "选择时间": "Select time",
+    "选择重复日期": "Select recurring date",
+    "请设置时间":"Please set the time",
+    "请设置重复时间":"Please set the recurring time",
+    "预约成功":"Reservation succeeded",
+    "提示": "Prompt",
+    "确定": "Confirm",
+    "周一": "Monday",
+    "周二": "Tuesday",
+    "周三": "Wednesday",
+    "周四": "Thursday",
+    "周五": "Friday",
+    "周六": "Saturday",
+    "周日": "Sunday",
+    "点击查看更多": "Click to view more",
+    "加载中": "Loading",
+    "没有更多": "No more",
+    "没有更多数据了": "No more data",
+    "设备编号": "Device ID",
+    "已停用": "Disabled",
+    "激活中": "Activating",
+    "已执行": "Executed",
+    "预约类型": "Reservation type",
+    "重复": "Recurring",
+    "创建时间": "Creation time",
+    "重复时间": "Recurring time",
+    "重复日期": "Recurring date",
+    "执行时间": "Execution time"
+
+
+  },
   "locale.auto": "System",
   "locale.en": "English",
   "locale.zh-hans": "简体中文",
+  "locale.zh-hant": "繁体中文",
+  "locale.ja": "日语",
+  "index": "Index",
+  "mine": "Mine",
   "login": {
-    "input": ""
+    "language": "Language",
+    "title": "GOOD Charger Platform",
+    "mailInput": "Please enter your email",
+    "pwdInput": "Please enter your password",
+    "noAccount": "No account",
+    "resiger":"Register",
+    "tologin": "Login",
+    "buletooth":"Bluetooth",
+    "logintip": "Please enter your email",
+    "pwdtip": "Please enter your password",
+    "logining": "Logining,please waitting"
+  },
+  "register": {
+    "logintip": "Please enter your email",
+    "pwdtip": "Please enter your password",
+    "logining": "Registering,please waitting",
+    "hasAccount": "Have an account?",
+    "backLogin": "To Login",
+    "register": "Register"
+  },
+  "buletooth": {
+    "nodevice": "No device found. Please confirm that Bluetooth is turned on.",
+    "init": "Bluetooth initializing.",
+    "nopwd": "Password cannot be empty.",
+    "pwdtip": "6-digit numeric password.",
+    "pwdinput": "Please enter the operation password.",
+    "errpwd": "Password cannot be empty.",
+    "connecting": "Device connecting.",
+    "tip": "Prompt"
+  },
+  "charge": {
+    "break": "Disconnect",
+    "modifypwd": "Change password",
+    "charging": "Charging",
+    "planed": " Reserved",
+    "connected": "Connected",
+    "nocharge": "Idle",
+    "devtemper": "Device temperature",
+    "voltage": "Device voltage",
+    "current": "Device current",
+    "chargetime": "Charging time",
+    "power": "Charging power",
+
+
+    "startcharge": "Start charging",
+    "getinfo": "Get status",
+    "oldpwd": "Original password",
+    "newpwd": "6-digit new password",
+    "elec": "Charging capacity"
+  },
+  "page": {
+    "login": "Login",
+    "bluetooth": "Bluetooth control",
+    "charepage": "Charging page",
+    "blueconnect": "Bluetooth connection",
+    "setting": "Setting",
+    "control": "Send command",
+    "plan": "Reservation",
+    "detail": "Device details",
+    "controltai": "Console",
+    "worktai": "Workbench",
+    "mine": "mine",
+    "chargerecord": "Charging record",
+    "planrecord": "Reservation record",
+    "scan": "Scan"
   }
 }

+ 24 - 1
locale/zh-Hans.json

@@ -4,7 +4,11 @@
 	"locale.zh-hans": "简体中文",
 	"locale.zh-hant": "繁体中文",
 	"locale.ja": "日语",
+	"index": "首页",
+	"mine": "我的",
 	"login": {
+		"language": "当前语言",
+		"title": "谷微云充电平台",
 		"mailInput": "请输入邮箱",
 		"pwdInput": "请输入密码",
 		"noAccount": "暂无账号",
@@ -18,7 +22,10 @@
 	"register": {
 		"logintip": "请输入账号",
 		"pwdtip": "请输入密码",
-		"logining": "注册中,请等待"
+		"logining": "注册中,请等待",
+		"hasAccount": "已有账号?",
+		"backLogin": "返回登录",
+		"register": "注册"
 	},
 	"buletooth": {
 		"nodevice": "未发现设备,请确认蓝牙已经打开",
@@ -48,5 +55,21 @@
 		"oldpwd": "原密码",
 		"newpwd": "6位数字新密码",
 		"elec": "已冲电量"
+	},
+	"page": {
+		"login": "登录",
+		"bluetooth": "蓝牙控制",
+		"charepage": "充电页面",
+		"blueconnect": "蓝牙连接",
+		"setting": "设置",
+		"control": "发送指令",
+		"plan": "预约",
+		"detail": "设备详情",
+		"controltai": "控制台",
+		"worktai": "工作台",
+		"mine": "我的",
+		"chargerecord": "充电记录",
+		"planrecord": "预约记录",
+		"scan": "扫码"
 	}
 }

+ 1 - 1
main.js

@@ -2,7 +2,7 @@ import Vue from 'vue'
 import App from './App'
 import store from './store' // store
 import plugins from './plugins' // plugins
-import messages from './locale/index'
+import messages from '@/locale/index'
 import './permission' // permission
 // import axios from "axios";
 import uView from '@/uni_modules/uview-ui'

+ 31 - 24
pages.json

@@ -4,77 +4,84 @@
     {
       "path": "pages/login",
       "style": {
-        "navigationBarTitleText": "登录"
+        "navigationBarTitleText": "%page.login%"
       }
     },
     {
       "path": "pages/weitiandi/bluetooth/index",
       "style": {
-        "navigationBarTitleText": "蓝牙控制",
+        "navigationBarTitleText": "%page.bluetooth%",
         "navigationStyle": "default"
       }
     },
     {
       "path": "pages/weitiandi/bluetooth/status",
       "style": {
-        "navigationBarTitleText": "充电页面",
+        "navigationBarTitleText": "%page.charepage%",
         "navigationStyle": "default"
       }
     },
     {
       "path": "pages/bluetooth/index/index",
       "style": {
-        "navigationBarTitleText": "蓝牙连接",
+        "navigationBarTitleText": "%page.blueconnect%",
         "navigationStyle": "default"
       }
     },
     {
       "path": "pages/weitiandi/bluetooth/setting",
       "style": {
-        "navigationBarTitleText": "设置",
+        "navigationBarTitleText": "%page.setting%",
         "navigationStyle": "default"
       }
     },
 	{
 	  "path": "pages/bluetooth/device/device",
 	  "style": {
-	    "navigationBarTitleText": "发送指令",
+	    "navigationBarTitleText": "%page.control%",
 		"navigationStyle": "default"
 	  }
 	},
      {
   "path": "pages/weitiandi/device/plan",
   "style": {
-    "navigationBarTitleText": "预约"
-    }
-  },
-	{
-	"path" : "pages/weitiandi/device/index",
-	"style" : {
-	  "navigationBarTitleText": "设备详情",
-	  "enablePullDownRefresh": false
-    }
+    "navigationBarTitleText": "%page.plan%"
+  }
   },
+    {
+      "path" : "pages/weitiandi/device/index",
+      "style" : {
+        "navigationBarTitleText": "%page.detail%",
+        "enablePullDownRefresh": false
+      }
+    },
+    {
+      "path" : "pages/weitiandi/device/status",
+      "style" : {
+        "navigationBarTitleText": "%page.detail%",
+        "enablePullDownRefresh": false
+      }
+    },
 	{
     "path": "pages/weitiandi/device/setting",
     "style": {
-      "navigationBarTitleText": ""
+      "navigationBarTitleText": "%page.setting%"
     }
   },
  {
     "path": "pages/index",
     "style": {
-      "navigationBarTitleText": "控制台"
+      "navigationBarTitleText": "%page.controltai%"
     }
   }, {
     "path": "pages/work/index",
     "style": {
-      "navigationBarTitleText": "工作台"
+      "navigationBarTitleText": "%page.worktai%"
     }
   }, {
     "path": "pages/mine/index",
     "style": {
-      "navigationBarTitleText": "我的",
+      "navigationBarTitleText": "%page.mine%",
       "navigationStyle": "custom"
     }
   }, {
@@ -126,7 +133,7 @@
       "path" : "pages/weitiandi/device/chargerecord",
       "style" :
       {
-        "navigationBarTitleText": "充电记录",
+        "navigationBarTitleText": "%page.chargerecord%",
         "enablePullDownRefresh": false
       }
 
@@ -135,7 +142,7 @@
       "path" : "pages/weitiandi/device/planrecord",
       "style" :
       {
-        "navigationBarTitleText": "预约记录",
+        "navigationBarTitleText": "%page.planrecord%",
         "enablePullDownRefresh": false
       }
 
@@ -144,7 +151,7 @@
       "path" : "pages/weitiandi/device/scan",
       "style" :
       {
-        "navigationBarTitleText": "扫码",
+        "navigationBarTitleText": "%page.scan%",
         "enablePullDownRefresh": false
       }
 
@@ -159,12 +166,12 @@
         "pagePath": "pages/index",
         "iconPath": "static/images/icons/menu-off.png",
         "selectedIconPath": "static/images/icons/menu-on.png",
-        "text": "首页"
+        "text": "%index%"
       }, {
         "pagePath": "pages/mine/index",
         "iconPath": "static/images/icons/mine-off.png",
         "selectedIconPath": "static/images/icons/mine-on.png",
-        "text": "我的"
+        "text": "%mine%"
       }
     ]
   },

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

@@ -100,7 +100,7 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
         this.pwd = "";
         ecBLE.stopBluetoothDevicesDiscovery();
         uni.navigateTo({
-          url: '/pages/weitiandi/bluetooth/index'
+          url: '/pages/weitiandi/bluetooth/status'
         });
       },
       getLocalPwd(){
@@ -117,7 +117,7 @@ const ecBLE = require('@/utils/ecBLE/ecBLE.js')
               ecUI.hideLoading()
               getPwd();
               self.buleid = id;
-            },2500)
+            },3000)
             // uni.setStorageSync('blueid', id);
 						// ecBLE.stopBluetoothDevicesDiscovery();
             //

+ 26 - 2
pages/index.vue

@@ -15,10 +15,16 @@
     <view class="container">
       <view class="item" @click="buleTeeth">
         <image :src = "imgUrl+'/index/bluetooth.png'"/>
+        <view class="item-text">{{i18('蓝牙连接')}}</view>
       </view>
 
       <view class="item" @click="scan">
         <image :src = "imgUrl+'/index/scan.png'"/>
+        <view class="item-text">{{i18('扫码绑定')}}</view>
+      </view>
+      <view class="item" @click="devicelist">
+        <image :src = "imgUrl+'/index/device-2.png'"/>
+        <view class="item-text">{{i18('设备列表')}}</view>
       </view>
     </view>
   </view>
@@ -26,6 +32,7 @@
 
 <script>
 import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
+import i18 from '@/utils/i18.js'
   export default {
     data:function(){
       return {
@@ -47,8 +54,18 @@ import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
     onShow(){
     },
     methods:{
+      devicelist(){
+        uni.navigateTo({
+          url: '/pages/bluetooth/index/index'
+        });
+      },
+      i18(text){
+        return i18(text)
+      },
       buleTeeth(){
-        this.$modal.showToast('功能开发中~')
+        uni.navigateTo({
+          url: '/pages/bluetooth/index/index'
+        });
       },
       scan(){
         if(window.location.href.indexOf("localhost") != -1){
@@ -83,7 +100,7 @@ import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
                   let ccid = res.data.ccid;
                   let qrcode = res.data.qrcode;
                   uni.navigateTo({
-                    url: '/pages/weitiandi/device/index?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
+                    url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
                   });
             }
         });
@@ -140,8 +157,15 @@ import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
   .item{
     display: inline-block;
     width: 50%;
+    position: relative;
   }
   .item image{
     height: 12vh;
   }
+  .item-text{
+    position: absolute;
+    top:30px;
+    left: 50%;
+  }
+
 </style>

+ 39 - 13
pages/login.vue

@@ -1,16 +1,19 @@
 <template>
   <view class="normal-login-container">
 
+   <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>
 	<view>
-		<image style="width: 750px;height: 807px;" :src="imgUrl+'/login/backImg2.png'" mode="widthFix">
+		<image style="width: 750px;height: 807px;" :src="imgUrl+'/login/backImg2.png'" mode="widthFix"/>
 		<view class="logo-content align-center justify-center flex">
-		  <text class="title" style="">微天地充电平台</text>
+		  <text class="title" style="font-size: 25px;margin-left:-71px">{{$t('login.title') }}</text>
 		</view>
 		<view class="logo-content justify-center flex">
-		  <text class="welcome" style="">欢迎登录</text>
+		  <text class="welcome" style="">Welcome</text>
 		</view>
 		<view class="logo-content justify-center flex">
-		  <text class="welcome1" style="">Welcome</text>
+		  <text class="welcome1" style=""></text>
 		</view>
 	</view>
 	<!-- 登录表单 -->
@@ -62,7 +65,7 @@
 		  		<uni-icons class="icon" type="email" size="20" color="#0E9F9B"></uni-icons>
 		   </uni-col>
 		   <uni-col :span="22">
-		    <input v-model="register.username" class="input" type="text" placeholder="请输入新账号" maxlength="30" />
+		    <input v-model="register.username" class="input" type="text" :placeholder="$t('login.mailInput')" maxlength="30" />
 		   </uni-col>
 		   </uni-row>
 		  </view>
@@ -73,16 +76,16 @@
 		  		<uni-icons class="icon" type="locked" size="20" color="#0E9F9B"></uni-icons>
 		   </uni-col>
 		   <uni-col :span="22">
-		    <input v-model="register.password" class="input" type="text" placeholder="请输入新密码" maxlength="30" />
+		    <input v-model="register.password" class="input" type="text" :placeholder="$t('login.pwdInput')" maxlength="30" />
 		   </uni-col>
 		   </uni-row>
 		  </view>
 		  </view>
 		  <view class="xieyi text-center" style="margin-top: -10px;">
-		  <p class="text-grey">已有账号?<a href="#" @click="toggleLoginMode" class="text-green">返回登录</a></p>
+		  <p class="text-grey">{{ $t('register.hasAccount') }}<a href="#" @click="toggleLoginMode" class="text-green">{{ $t('register.backLogin') }}</a></p>
 		  </view>
 		  <view class="action-btn" style="z-index: 9999;position: relative;">
-          <button @click="handleRegister" type="submit" class="login-btn cu-btn block bg-blue lg round">注册</button>
+          <button @click="handleRegister" type="submit" class="login-btn cu-btn block bg-blue lg round">{{ $t('register.register') }}</button>
 		  </view>
      </view>
   </view>
@@ -94,6 +97,7 @@
 	    <text @click="buleTeeth">{{ $t('login.buletooth') }}</text>
 	</view>
 	</view>
+    <u-picker :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
   </view>
 </template>
 
@@ -103,6 +107,9 @@
   export default {
     data() {
       return {
+        showLocale:false,
+        localeList:[[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]],
+        localeConfig:{"zh-Hans":"简体中文","en":"英文"},
 		// currentImg: "",
         codeUrl: "",
         captchaEnabled: true,
@@ -116,6 +123,8 @@
 		register:{
 		username: "",
 		password: "",
+    locale:"",
+
 		},
 		isLogin: true, // 是否为登录模式
        }
@@ -129,8 +138,7 @@
 	  }
 	},
     created() {
-      console.log(uni.getLocale())
-      console.log(this.$t('locale.auto'))
+     this.setLocale()
 		uni.getLocation({
 			type: 'wgs84',
 			success: function (res) {
@@ -142,6 +150,24 @@
       this.checkLogin();
     },
     methods: {
+      setLocale(){
+        this.locale = uni.getLocale()
+        if(this.locale == "en"){
+          this.localeList = [[{"label":"Chinese","id":"zh-Hans"},{"label":"English","id":"en"}]];
+          this.localeConfig={"zh-Hans":"Chinese","en":"English"};
+        }else if(this.locale == "zh-Hans"){
+          this.localeList = [[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]];
+          this.localeConfig={"zh-Hans":"简体中文","en":"英文"};
+        }
+      },
+      changeLanguage(e){
+        this.showLocale  =false;
+        console.log(e.value[0].id)
+        uni.setLocale(e.value[0].id);
+      },
+      changeLocale(){
+          this.showLocale = true;
+      },
       buleTeeth(){
         this.$tab.reLaunch('/pages/bluetooth/index/index')
       },
@@ -194,9 +220,9 @@
           this.$modal.closeLoading()
           this.loginSuccess()
         }).catch(() => {
-          if (this.captchaEnabled) {
-            this.getCode()
-          }
+          // if (this.captchaEnabled) {
+          //   this.getCode()
+          // }
         })
       },
       // 登录成功后,处理函数

+ 38 - 6
pages/mine/index.vue

@@ -1,5 +1,8 @@
 <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">
+        {{ $t('login.language') }}:{{localeConfig[locale]}}<uni-icons type="gear" size="15"></uni-icons>
+      </view>
     <!--顶部个人信息栏-->
     <view class="header-section">
       <view class="flex padding justify-between">
@@ -10,11 +13,11 @@
           <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
           </image>
           <view v-if="!name" @click="handleToLogin" class="login-tip">
-            点击登录
+          {{  i18('点击登录')}}
           </view>
           <view v-if="name" @click="handleToInfo" class="user-info">
             <view class="u_title" style="color: #8E8E8E">
-              你好!
+               {{  i18('你好')}}
             </view>
             <view class="u_title">
               {{ name }}
@@ -29,22 +32,23 @@
         <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
           <view class="menu-item-box">
             <image :src="this.imgUrl+'/index/settingicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
-            <view class="menu-text">账户设置</view>
+            <view class="menu-text"> {{  i18('账户设置')}}</view>
           </view>
         </view>
         <view class="list-cell list-cell-arrow" @click="handleAbout">
           <view class="menu-item-box">
             <image :src="this.imgUrl+'/index/chargeicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
-            <view class="menu-text">充电记录</view>
+            <view class="menu-text">{{  i18('充电记录')}}</view>
           </view>
         </view>
         <view class="list-cell list-cell-arrow" @click="handleToSetting">
           <view class="menu-item-box">
             <image :src="this.imgUrl+'/index/planicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
-            <view class="menu-text">预约记录</view>
+            <view class="menu-text">{{  i18('预约记录')}}</view>
           </view>
         </view>
       </view>
+      <u-picker :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
 
     </view>
 
@@ -52,10 +56,14 @@
 
 <script>
   import storage from '@/utils/storage'
-
+  import i18 from '@/utils/i18.js'
   export default {
     data() {
       return {
+        showLocale:false,
+        locale:"",
+        localeList:[[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]],
+        localeConfig:{"zh-Hans":"简体中文","en":"英文"},
         name: this.$store.state.user.name,
         version: getApp().globalData.config.appInfo.version,
         imgUrl:getApp().globalData.config.imgUrl
@@ -69,7 +77,31 @@
         return uni.getSystemInfoSync().windowHeight - 50
       }
     },
+    onLoad(){
+      this.setLocale();
+    },
     methods: {
+      changeLanguage(e){
+        this.showLocale  =false;
+        console.log(e.value[0].id)
+        uni.setLocale(e.value[0].id);
+      },
+      changeLocale(){
+        this.showLocale = true;
+      },
+      setLocale(){
+        this.locale = uni.getLocale()
+        if(this.locale == "en"){
+          this.localeList = [[{"label":"Chinese","id":"zh-Hans"},{"label":"English","id":"en"}]];
+          this.localeConfig={"zh-Hans":"Chinese","en":"English"};
+        }else if(this.locale == "zh-Hans"){
+          this.localeList = [[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]];
+          this.localeConfig={"zh-Hans":"简体中文","en":"英文"};
+        }
+      },
+      i18(text){
+        return i18(text)
+      },
       handleToEditInfo() {
         this.$tab.navigateTo('/pages/mine/pwd/index')
       },

+ 17 - 14
pages/mine/pwd/index.vue

@@ -1,19 +1,19 @@
 <template>
   <view class="pwd-retrieve-container">
     <uni-forms ref="form" :value="user" labelWidth="80px">
-      <uni-forms-item name="oldPassword" label="旧密码">
-        <uni-easyinput type="password" v-model="user.oldPassword" placeholder="请输入旧密码" />
+      <uni-forms-item name="oldPassword" :label="i18('旧密码')">
+        <uni-easyinput type="password" v-model="user.oldPassword" :placeholder="i18('请输入旧密码')" />
       </uni-forms-item>
-      <uni-forms-item name="newPassword" label="新密码">
-        <uni-easyinput type="password" v-model="user.newPassword" placeholder="请输入新密码" />
+      <uni-forms-item name="newPassword" :label="i18('新密码')">
+        <uni-easyinput type="password" v-model="user.newPassword" :placeholder="i18('请输入新密码')" />
       </uni-forms-item>
-      <uni-forms-item name="confirmPassword" label="确认密码">
-        <uni-easyinput type="password" v-model="user.confirmPassword" placeholder="请确认新密码" />
+      <uni-forms-item name="confirmPassword" :label="i18('确认密码')">
+        <uni-easyinput type="password" v-model="user.confirmPassword" :placeholder="i18('请确认新密码')" />
       </uni-forms-item>
-      <button type="primary" style="background: #0E9F9B;color: white" @click="submit">提交</button>
+      <button type="primary" style="background: #0E9F9B;color: white" @click="submit">{{i18('提交')}}</button>
 
       <view style="bottom: 10px;position: absolute;left: 10px;right:10px">
-        <button type="warn"  @click="" style="background: #0E9F9B;color: white" @click="handleLogout">退出登录</button>
+        <button type="warn"  @click="" style="background: #0E9F9B;color: white" @click="handleLogout">{{i18('退出登录')}}</button>
       </view>
     </uni-forms>
   </view>
@@ -21,7 +21,7 @@
 
 <script>
   import { updateUserPwd } from "@/api/system/user"
-
+  import i18 from '@/utils/i18.js'
   export default {
     data() {
       return {
@@ -34,28 +34,28 @@
           oldPassword: {
             rules: [{
               required: true,
-              errorMessage: '旧密码不能为空'
+              errorMessage: i18('旧密码不能为空')
             }]
           },
           newPassword: {
             rules: [{
                 required: true,
-                errorMessage: '新密码不能为空',
+                errorMessage: i18('新密码不能为空'),
               },
               {
                 minLength: 6,
                 maxLength: 20,
-                errorMessage: '长度在 6 到 20 个字符'
+                errorMessage: i18('长度在 6 到 20 个字符')
               }
             ]
           },
           confirmPassword: {
             rules: [{
                 required: true,
-                errorMessage: '确认密码不能为空'
+                errorMessage: i18('确认密码不能为空')
               }, {
                 validateFunction: (rule, value, data) => data.newPassword === value,
-                errorMessage: '两次输入的密码不一致'
+                errorMessage: i18('两次输入的密码不一致')
               }
             ]
           }
@@ -66,6 +66,9 @@
       this.$refs.form.setRules(this.rules)
     },
     methods: {
+      i18(text){
+        return i18(text)
+      },
       submit() {
         this.$refs.form.validate().then(res => {
           updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {

+ 31 - 25
pages/weitiandi/bluetooth/index.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <view class="dboxs dport">
       <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/port.png"/>
-        <view class="dboxtitle-text"> 设备端口</view>
+        <view class="dboxtitle-text"> {{ i18('设备端口') }}</view>
 
         </view>
 
@@ -15,33 +15,33 @@
           </view>
           <view class="dpropitem-block dportitem-block-2" v-if="item.status == 2">
             <image class="dportitem-img" src="/static/images/new/start/using.png"/>
-            <view class="dpropitem-status">充电中</view>
+            <view class="dpropitem-status">{{ i18('充电中') }}</view>
           </view>
 
           <view class="dpropitem-block dportitem-block-1" v-if="item.status == 1">
             <image class="dportitem-img" src="/static/images/new/start/free.png"/>
-            <view class="dpropitem-status">空闲中</view>
+            <view class="dpropitem-status">{{ i18('空闲中') }}</view>
           </view>
 
           <view class="dpropitem-block dportitem-block-3" style="background: rgb(247,238,240);color:#FF6868" v-if="item.status == 3">
             <image class="dportitem-img" src="/static/images/new/start/ban.png"/>
-            <view class="dpropitem-status">禁用中</view>
+            <view class="dpropitem-status">{{ i18('禁用中') }}</view>
           </view>
 
           <view class="dpropitem-block dportitem-block-3" style="background: rgb(248,244,230);color:#FFAA00" v-if="item.status == 4">
             <image class="dportitem-img" src="/static/images/new/start/bad.png"/>
-            <view class="dpropitem-status">故障中</view>
+            <view class="dpropitem-status">{{ i18('故障中') }}</view>
           </view>
 
 
           <view class="dpropitem-block dportitem-block-3" style=";" v-if="item.status == 5">
             <image class="dportitem-img" src="/static/images/new/start/lianjie.png"/>
-            <view class="dpropitem-status">已连接</view>
+            <view class="dpropitem-status">{{ i18('已连接') }}</view>
           </view>
 
           <view class="dpropitem-block dportitem-block-3" style="background: rgb(239,235,254);color:#A552FF" v-if="item.status == 6">
             <image class="dportitem-img" src="/static/images/new/start/yuyue.png"/>
-            <view class="dpropitem-status">已预约</view>
+            <view class="dpropitem-status">{{ i18('已预约') }}</view>
           </view>
         </view>
 
@@ -51,17 +51,19 @@
 
     <view class="dboxs dport" style="height: 100px" @click="planCharge">
       <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/clock.png"/>
-      <view class="dboxtitle-text">预约充电</view>
+      <view class="dboxtitle-text">{{ i18('预约充电') }}</view>
       </view>
 
-      <view class="port-text" v-if="portDetail.portStatus == 6"  style="left:40px;top:48px;font-size: 14px">
-        已预约
+      <view class="port-text" v-if="planInfo != null"  style="left:40px;top:48px;font-size: 14px">
+       {{ i18('已预约') }}    <view  class="port-text" style="top:30px;">
+        <text style="font-size: 10px">{{ planInfo.runTime }}</text>
+      </view>
       </view>
       <view class="port-text" style="left:40px;top:55px;font-size: 14px" v-else>
-        点击预约充电
+          {{ i18('点击预约充电') }}
       </view>
       <view class="port-num" style="left:40px;top:70px;font-size: 12px" v-if="portDetail.portStatus == 6">
-        可点击取消预约
+         {{ i18('可点击取消预约') }}
       </view>
       <view class="port-icon"  v-if="portDetail.portStatus !=6" style="width: 50px;height: 50px;right:10px;top:28%">
         <image class="btn-image" src="/static/images/new/start/clock.png" >
@@ -77,34 +79,34 @@
 
     <view class="dboxs dport" style="height: 200px">
       <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/oper.png"/>
-        <view class="dboxtitle-text">设备操作</view>
+        <view class="dboxtitle-text"> {{ i18('设备操作') }}</view>
       </view>
       <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus == 2">
         <image class="btn-image" src="/static/images/new/start/stop.png" >
         </image>
-        <view>停止充电</view>
+        <view>{{ i18('停止充电') }}</view>
       </view>
 
       <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus != 2">
         <image class="btn-image"  src="/static/images/new/start/using.png" >
         </image>
-        <view>立即充电</view>
+        <view>{{ i18('立即充电') }}</view>
       </view>
       <view class="control-btn" @click="getInfo">
         <image class="btn-image"  src="/static/images/new/start/get.png" >
         </image>
-        <view>获取状态</view>
+        <view>{{ i18('获取状态') }}</view>
       </view>
       <view class="control-btn" @click="toSet">
         <image class="btn-image" src="/static/images/new/start/oper.png" >
         </image>
-        <view>设备控制</view>
+        <view>{{ i18('设备控制') }}</view>
       </view>
 
       <view class="control-btn" @click="goBack">
         <image class="btn-image" src="/static/images/new/start/back.png" >
         </image>
-        <view>返回</view>
+        <view>{{ i18('返回') }}</view>
       </view>
 <!--      <view class="control-btn">-->
 <!--        <image class="btn-image" :src="imgUrl+'/control/record.png'" >-->
@@ -113,12 +115,12 @@
 <!--      </view>-->
     </view>
     <u-picker @cancel="cancelPicker" @confirm="confirm" :show="showPlan" :columns="planCols" @change="changeHandler"></u-picker>
-    <u-modal :show="showPwd" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  title="修改密码" >
+    <u-modal :show="showPwd" :confirmText="i18('确认')" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  title="修改密码" >
       <view class="slot-content">
         <view>
           <u--input
               type="number"
-              placeholder="原密码"
+              :placeholder="i18('原密码')"
               border="surround"
               v-model="oldPwd"
           ></u--input>
@@ -127,7 +129,7 @@
         <view style="margin-top:5px">
           <u--input
               type="number"
-              placeholder="6位数字新密码"
+              :placeholder="i18('6位数字新密码')"
               border="surround"
               v-model="pwd"
           ></u--input>
@@ -148,6 +150,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 isCheckScroll = true
 let isCheckRevHex = false
@@ -201,6 +204,9 @@ export default {
    this.closeSocket();
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
    selectPort(id){
      this.choosePort = id;
      console.log(this.choosePort)
@@ -218,7 +224,7 @@ export default {
         return;
       }
       if(rightPwd != this.oldPwd){
-        this.$modal.showToast("原密码不对");
+        this.$modal.showToast("原密码不对");
         return;
       }
         if(!this.pwd){
@@ -245,7 +251,7 @@ export default {
       let nowHour = date.getHours();
       let nowMin = date.getMinutes();
       let nowDate ={min:nowMin,hour:nowHour};
-      if("今日" == day){
+      if(i18("今日") == day){
         todayTotalMin = this.getGapMin(planDate,nowDate)
       }else {
         let nowHour = date.getHours();
@@ -291,7 +297,7 @@ export default {
       this.picker = picker;
       if (columnIndex === 0) {
         // picker为选择器this实例,变化第二列对应的选项
-        if(day == "今日"){
+        if(day == i18("今日")){
           picker.setColumnValues(1, this.columnData[1])
         }else{
           picker.setColumnValues(1, this.columnData[0])
@@ -477,7 +483,7 @@ export default {
       let date = new Date();
       let min = date.getMinutes();
       let hour = date.getHours();
-      let arr1 = ["今日", "明日"];
+      let arr1 = [i18("今日"), i18("明日")];
       let arr2 = []
       let arr3 = [];
       let arr4 = [];

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

@@ -3,14 +3,14 @@
     <view class="setting">
 
       <view class="prop-item">
-        <view class="prop-title">充电电流</view>
+        <view class="prop-title">{{i18('充电电流')}}</view>
         <view class="prop-value">
           <view :style="item.style" class="value-tag" @click="checkItem(current,item)" v-for="item in current.items">
             {{ item.text }}
           </view>
         </view>
         <view class="prop-input" v-if="current.custom">
-          <input v-model="current.customValue" class="input" placeholder="请输入电流"/>
+          <input v-model="current.customValue" class="input" :placeholder="i18('请输入电流')"/>
           <view style="color: #0E9F9B">A</view>
         </view>
       </view>
@@ -20,7 +20,7 @@
 
     <view class="bottom-area">
 
-      <view class="btn" @click="confirm">确认</view>
+      <view class="btn" @click="confirm">{{i18('确认')}}</view>
 
 
       <view class="areas">
@@ -30,7 +30,7 @@
 
           </view>
           <view>
-            <view>获取主板配置</view>
+            <view>{{i18('获取主板配置')}}</view>
           </view>
         </view>
 
@@ -39,7 +39,7 @@
             <image style="width: 50px;height: 50px" :src="imgUrl+'/seting/reset.png'"></image>
           </view>
           <view>
-            <view >恢复默认配置</view>
+            <view >{{i18('恢复默认配置')}}</view>
           </view>
         </view>
 
@@ -48,7 +48,7 @@
             <image style="width: 50px;height: 50px" :src="imgUrl+'/seting/restart.png'"></image>
           </view>
           <view>
-            <view>重启充电桩</view>
+            <view>{{i18('重启充电桩')}}</view>
           </view>
         </view>
 
@@ -67,6 +67,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 isCheckScroll = true
 let isCheckRevHex = false
@@ -87,7 +88,7 @@ export default {
           {text: "10A", style: "", value: 10},
           {text: "16A", style: "", value: 16},
           {text: "32A", style: "", value: 32},
-          {text: "自定义", style: "", value: -1}
+          {text: i18("自定义"), style: "", value: -1}
         ],
         custom: false,
         customValue: ''
@@ -111,6 +112,9 @@ export default {
 
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
     closeSocket(){
       ecBLE.onBLEConnectionStateChange(() => {})
       ecBLE.onBLECharacteristicValueChange(() => {})

+ 26 - 40
pages/weitiandi/bluetooth/status.vue

@@ -12,8 +12,6 @@
         <view class="can">
 
           <view class="box">
-            <!--view class="top_ball one"></view-->
-            <!--view class="top_ball two"></view-->
             <view class="three">
               <view class="four"></view>
               <view class="five"></view>
@@ -32,7 +30,7 @@
           <!--            </canvas>-->
           <view class="stip">
 
-            <view class="p0" st="">{$device['sn']}</view>
+            <view class="p0" st=""></view>
             <view class="p1">
               <view v-if="portDetail.portStatus == 2">
                 {{$t('charge.charging')}}
@@ -77,7 +75,7 @@
 
       <view class="ditem">
         <image class="itemimg" src="/static/images/new/shjian.png"/>
-        <view class="item-value">{{ portDetail.time }}分钟</view>
+        <view class="item-value">{{ portDetail.time }}{{ i18('分钟') }}</view>
         <span class="item-text">{{$t('charge.chargetime')}}</span>
       </view>
 
@@ -89,7 +87,7 @@
 
       <view class="ditem">
         <image class="itemimg" src="/static/images/new/dianliang.png"/>
-        <view class="item-value">{{ portDetail.elec }} 度</view>
+        <view class="item-value">{{ portDetail.elec }} {{ i18('') }}</view>
         <span class="item-text">{{$t('charge.elec')}}</span>
       </view>
 
@@ -110,16 +108,16 @@
     </view>
 
     <view class="dtip">
-      <view style="margin:10px 0px;color: #1A87FF;"><img style="width: 13px;height: 13px" src="/static/images/new/tip.png">温馨提示</view>
-      <view>1,桩控制最大输出电流,当功率没有达到请检查车的状态或者车的设置;</view>
-      <view>2,启动充电-&gt;设备管理- 可设置设备最大输出电流</view>
-      <view>3,为保障您远程启动正常充电,请确保枪头完全连接充电口,同时确认您的爱车处于立即充电状态下;</view>
-      <view>4,注意规范安全充电,停好车,锁好车。</view>
+      <view style="margin:10px 0px;color: #1A87FF;"><img style="width: 13px;height: 13px" src="/static/images/new/tip.png">{{i18('温馨提示')}}</view>
+      <view>1,{{i18('桩控制最大输出电流,当功率没有达到请检查车的状态或者车的设置')}};</view>
+      <view>2,{{i18('启动充电-&gt;设备管理->可设置设备最大输出电流')}}</view>
+      <view>3,{{i18('为保障您远程启动正常充电,请确保枪头完全连接充电口,同时确认您的爱车处于立即充电状态下')}};</view>
+      <view>4,{{i18('注意规范安全充电,停好车,锁好车。')}}</view>
     </view>
     <u-picker @cancel="showPort=false" @confirm="confirmPort" :show="showPort" :columns="portList" keyName="text"></u-picker>
 
     <u-picker @cancel="cancelPicker" @confirm="confirm" :show="showPlan" :columns="planCols" @change="changeHandler"></u-picker>
-    <u-modal :show="showPwd" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  :title="$t('charge.modifypwd')" >
+    <u-modal :show="showPwd" :confirmText="i18('确认')" :cancelText="i18('取消')" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true"  :title="$t('charge.modifypwd')" >
       <view class="slot-content">
         <view>
           <u--input
@@ -154,6 +152,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 isCheckScroll = true
 let isCheckRevHex = false
@@ -192,10 +191,8 @@ export default {
      return getApp().globalData.config.imgUrl;
    }
  },
- onLoad(opt) {
-   this.deviceInfo.deviceId = opt.id;
-   this.deviceInfo.ccid = opt.ccid;
-   this.deviceInfo.qrcode = opt.qrcode;
+ onLoad() {
+   console.log("status comeing")
    this.checkPassword();
  },
   onShow(){
@@ -206,6 +203,9 @@ export default {
    this.closeSocket();
   },
   methods: {
+   i18(text){
+     return i18(text)
+   },
     toPage(){
       uni.navigateTo({
         url: '/pages/weitiandi/bluetooth/index'
@@ -224,7 +224,7 @@ export default {
         return;
       }
       if(rightPwd != this.oldPwd){
-        this.$modal.showToast("原密码不对");
+        this.$modal.showToast("原密码不对");
         return;
       }
         if(!this.pwd){
@@ -853,30 +853,6 @@ padding:0 22px;
   font-size: 15px;
 }
 
-/* 顶部的两个旋转小球 */
-.top_ball {
-  width: 200px;
-  height: 200px;
-  border-radius: 35%;
-  opacity: 0.5;
-  position: absolute;
-  top: 20px;
-  z-index: 10;
-  /* 从中心向外剪切圆,相当于掏空 */
-  -webkit-mask: radial-gradient(transparent 95px, white 0px);
-}
-
-/* 顶部的两个旋转小球 */
-.top_ball.one {
-  background: var(--c);
-  animation: ballZhuan 5s linear infinite;
-}
-
-/* 顶部的两个旋转小球 */
-.top_ball.two {
-  background: var(--c);
-  animation: ballZhuan 8s linear infinite;
-}
 
 .three {
   width: 170px;
@@ -1130,4 +1106,14 @@ padding:0 22px;
   color: #B8B9BA;
   margin-bottom: 10px;
 }
+.p1{
+  font-size: 20px;
+  color: white;
+  font-weight: bold;
+  margin-top:10px;
+}
+.stip{
+  text-align: center;
+  z-index: 9999;
+}
 </style>

+ 7 - 4
pages/weitiandi/device/chargerecord.vue

@@ -27,7 +27,7 @@
 
 <script>
   import { listCharge } from '@/api/device/chargerecord.js'
-
+  import i18 from '@/utils/i18.js'
   export default {
     data() {
       return {
@@ -38,14 +38,17 @@
           reasonable:true,
         },
         contentText: {
-          contentdown: '点击查看更多',
-          contentrefresh: '加载中',
-          contentnomore: '没有更多'
+          contentdown: i18('点击查看更多'),
+          contentrefresh: i18('加载中'),
+          contentnomore: i18('没有更多'),
         },
         chargeList: [],
       }
     },
     methods: {
+      i18(text){
+        return i18(text)
+      },
       getMore(){
         this.search.pageNum++;
         this.chargeRecord();

+ 168 - 145
pages/weitiandi/device/index.vue

@@ -1,187 +1,123 @@
 <template>
   <view class="container">
-    <view class="header">
-      <view class="header-status chong-active" v-if="portDetail.portStatus == 1">
-        充电枪未连接
-      </view>
+    <view class="dboxs dport">
+      <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/port.png"/>
+        <view class="dboxtitle-text"> {{ i18('设备端口') }}</view>
 
-      <view class="header-status chong-active" v-if="portDetail.portStatus == 0">
-        正在读取状态
       </view>
 
-      <view class="header-status chong-active" v-if="portDetail.portStatus == 5">
-        充电枪已连接
-      </view>
 
-      <view class="header-status chong-active" v-if="portDetail.portStatus == 2">
-        充电枪已连接
-      </view>
-      <view class="header-img" v-if="portDetail.portStatus == 2">
-        <image :src="imgUrl+'/chargedetail/chonging.png'">
+      <view class="dportitems">
+        <view class="dportitem " v-for="item in curPort" @click="selectPort(item.id);">
+          <p class="dpropitem-title "> {{ 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>
+          <view class="dpropitem-block dportitem-block-2" v-if="item.status == 2">
+            <image class="dportitem-img" src="/static/images/new/start/using.png"/>
+            <view class="dpropitem-status">{{ i18('充电中') }}</view>
+          </view>
 
-        </image>
-      </view>
+          <view class="dpropitem-block dportitem-block-1" v-if="item.status == 1">
+            <image class="dportitem-img" src="/static/images/new/start/free.png"/>
+            <view class="dpropitem-status">{{ i18('空闲中') }}</view>
+          </view>
 
-      <view class="header-img" v-if="portDetail.portStatus != 2">
-        <image :src="imgUrl+'/chargedetail/chongoff.png'">
+          <view class="dpropitem-block dportitem-block-3" style="background: rgb(247,238,240);color:#FF6868" v-if="item.status == 3">
+            <image class="dportitem-img" src="/static/images/new/start/ban.png"/>
+            <view class="dpropitem-status">{{ i18('禁用中') }}</view>
+          </view>
 
-        </image>
-      </view>
-      <view class="header-status-desc" v-if="portDetail.portStatus == 2">
-        充电中
-      </view>
+          <view class="dpropitem-block dportitem-block-3" style="background: rgb(248,244,230);color:#FFAA00" v-if="item.status == 4">
+            <image class="dportitem-img" src="/static/images/new/start/bad.png"/>
+            <view class="dpropitem-status">{{ i18('故障中') }}</view>
+          </view>
 
-      <view class="header-status-desc" style="color: #B2B2B2" v-if="portDetail.portStatus != 2">
-        未充电
-      </view>
-    </view>
-    <view class="port"  @click="showPort = true">
-      <view class="port-image">
-        <image class="btn-image" :src="imgUrl+'/index/device.png'" >
-        </image>
-      </view>
-      <view class="port-text">
-        设备编号:{{ deviceInfo.qrcode }}
-      </view>
 
-      <view class="port-num">
-        <view>
-          {{portList[0][choosePort-1]["text"]}}
+          <view class="dpropitem-block dportitem-block-3" style=";" v-if="item.status == 5">
+            <image class="dportitem-img" src="/static/images/new/start/lianjie.png"/>
+            <view class="dpropitem-status">{{ i18('已连接') }}</view>
+          </view>
+
+          <view class="dpropitem-block dportitem-block-3" style="background: rgb(239,235,254);color:#A552FF" v-if="item.status == 6">
+            <image class="dportitem-img" src="/static/images/new/start/yuyue.png"/>
+            <view class="dpropitem-status">{{ i18('已预约') }}</view>
+          </view>
         </view>
 
-      </view>
-      <view class="port-icon">
-        <image class="btn-image" :src="imgUrl+'/index/right.png'" >
-        </image>
+
       </view>
     </view>
-    <view class="plan" @click="planCharge">
-      <view class="port-image">
-        <image class="btn-image" :src="imgUrl+'/index/clock.png'" >
-        </image>
-      </view>
-      <view class="port-text" v-if="planInfo != null"  style="top:8px">
-        预约充电时间:
+    <view class="dboxs dport" style="height: 100px" @click="planCharge">
+      <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/clock.png"/>
+        <view class="dboxtitle-text">{{ i18('预约充电') }}</view>
       </view>
-      <view v-if="planInfo != null" class="port-text" style="top:30px;">
-        <text style="font-size: 10px">{{ planInfo.runTime }}</text>
+
+      <view class="port-text" v-if="planInfo != null"  style="left:40px;top:48px;font-size: 14px">
+        {{ i18('已预约') }}  {{planInfo.runTime}}
       </view>
-      <view class="port-text" style="top:24px" v-else>
-        点击预约充电
+      <view class="port-text" style="left:40px;top:55px;font-size: 14px" v-else>
+        {{ i18('点击预约充电') }}
       </view>
-      <view class="port-num" style="top:48px;font-size: 12px" v-if="planInfo != null">
-        点击取消预约
+      <view class="port-num" style="left:40px;top:70px;font-size: 12px" v-if="planInfo != null">
+        {{ i18('可点击取消预约') }}
       </view>
-      <view class="port-icon"  v-if="planInfo==null">
-        <image class="btn-image" :src="imgUrl+'/index/right.png'" >
+      <view class="port-icon"  v-if="planInfo == null" style="width: 50px;height: 50px;right:10px;top:28%">
+        <image class="btn-image" src="/static/images/new/start/clock.png" >
         </image>
       </view>
-      <view class="port-icon" v-if="planInfo !=null" style="width: 18px;height: 18px;right:1px;">
-        <image class="btn-image"  :src="imgUrl+'/index/del.png'" >
+      <view class="port-icon" v-if="planInfo != null" style="width: 50px;height: 50px;right:10px;top:28%">
+        <image class="btn-image"  src="/static/images/new/start/del.png" >
         </image>
       </view>
-
     </view>
-    <view class="info-body">
-     <view>
-       <view class="info-content">
-
-         <view class="info-content-value">{{ portDetail.voltage }}V</view>
-         <view class="info-content-text">
-           充电电压
-         </view>
-       </view>
-
-       <view class="info-content">
-
-         <view class="info-content-value" v-if="portDetail.voltage == 0">0A</view>
-         <view class="info-content-value" v-else>{{portDetail.POWER/portDetail.voltage}}A</view>
-
-         <view class="info-content-text">
-           充电电流
-         </view>
-       </view>
-
-       <view class="info-content">
-
-         <view class="info-content-value">{{portDetail.dev_temper}}℃</view>
-         <view class="info-content-text">
-           设备温度
-         </view>
-       </view>
-
-
-       <view class="info-content">
-
-         <view class="info-content-value">{{portDetail.wire_temper}}℃</view>
-         <view class="info-content-text">
-           线路温度
-         </view>
-       </view>
-     </view>
-
-      <view class="body-bottom">
-        <view class="info-content">
-
-          <view class="info-content-value">{{ portDetail.time }}分钟</view>
-          <view class="info-content-text">
-            已冲时间
-          </view>
-        </view>
-        <view class="info-content">
-
-          <view class="info-content-value">{{ portDetail.power }}W</view>
-          <view class="info-content-text">
-            充电功率
-          </view>
-        </view>
-        <view class="info-content">
-
-          <view class="info-content-value">{{ portDetail.elec }} 度</view>
-          <view class="info-content-text">
-            已冲电量
-          </view>
-        </view>
+    <view class="dboxs dport" style="height: 200px">
+      <view class="dboxtitle"><image class="portimg" src="/static/images/new/start/oper.png"/>
+        <view class="dboxtitle-text"> {{ i18('设备操作') }}</view>
       </view>
-
-    </view>
-    <u-picker @cancel="showPort=false" @confirm="confirmPort" :show="showPort" :columns="portList" keyName="text"></u-picker>
-
-
-    <view class="bottom-control">
       <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus == 2">
-        <image class="btn-image" :src="imgUrl+'/control/stop.png'" >
+        <image class="btn-image" src="/static/images/new/start/stop.png" >
         </image>
-        <view>停止充电</view>
+        <view>{{ i18('停止充电') }}</view>
       </view>
 
       <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus != 2">
-        <image class="btn-image" :src="imgUrl+'/control/charge.png'" >
+        <image class="btn-image"  src="/static/images/new/start/using.png" >
         </image>
-        <view>立即充电</view>
+        <view>{{ i18('立即充电') }}</view>
       </view>
       <view class="control-btn" @click="getInfo">
-        <image class="btn-image" :src="imgUrl+'/control/getstatus.png'" >
+        <image class="btn-image"  src="/static/images/new/start/get.png" >
         </image>
-        <view>获取状态</view>
+        <view>{{ i18('获取状态') }}</view>
       </view>
       <view class="control-btn" @click="toSet">
-        <image class="btn-image" :src="imgUrl+'/control/control.png'" >
+        <image class="btn-image" src="/static/images/new/start/oper.png" >
         </image>
-        <view>设备控制</view>
+        <view>{{ i18('设备控制') }}</view>
       </view>
-      <view class="control-btn">
-        <image class="btn-image" :src="imgUrl+'/control/record.png'" >
+
+      <view class="control-btn" @click="goBack">
+        <image class="btn-image" src="/static/images/new/start/back.png" >
         </image>
-        <view>使用记录</view>
+        <view>{{ i18('返回') }}</view>
       </view>
+      <!--      <view class="control-btn">-->
+      <!--        <image class="btn-image" :src="imgUrl+'/control/record.png'" >-->
+      <!--        </image>-->
+      <!--        <view>使用记录</view>-->
+      <!--      </view>-->
     </view>
+    <u-picker @cancel="showPort=false" @confirm="confirmPort" :show="showPort" :columns="portList" keyName="text"></u-picker>
+
+
   </view>
 </template>
 
 <script>
 import {getDeviceInfo,getPortDetail,startCharge,stopCharge,sendPortDetailCmd,checkStatusChange,getPlanInfo,cancelPlan} from "@/api/device/device";
 import websocket from '@/utils/websocket'
+import i18 from '@/utils/i18.js'
 export default {
  data() {
    return {
@@ -196,7 +132,8 @@ export default {
      choosePort:1,
      portList:[[{port:1,text:"端口一"}]],
      planInfo:null,
-     days:["","周一","周二","周三","周四","周五","周六","周日"]
+     days:["","周一","周二","周三","周四","周五","周六","周日"],
+     curPort:[]
    }
  },
  computed: {
@@ -217,6 +154,13 @@ export default {
    this.closeSocket();
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
+    goBack(){
+      uni.navigateBack({
+      });
+    },
     planCharge(){
       if(this.planInfo != null){
         this.$modal.confirm("确认取消预约?").then(res=>{
@@ -253,7 +197,7 @@ export default {
                 if(strs.length>0){
                   strs+=",";
                 }
-                strs +=this.days[days[i]];
+                strs +=i18(this.days[days[i]]);
             }
             this.planInfo = planInfo;
             this.planInfo.runTime = strs+" "+data.repeatTime;
@@ -289,14 +233,24 @@ export default {
         let real_data = data.real_data;
         if(type == 103){
           self.portDetail = real_data
-          self.portList = [[]];
+          self.curPort = [];
           let port_first_status = self.portDetail["port_first_status"];
           let port_second_status = self.portDetail["port_second_status"]
           if(port_first_status){
-            self.portList[0].push({port:1,text:"端口一"});
+            self.portList[0].push({port:1,text:i18("端口一")});
+            self.curPort.push({
+              text:i18("端口一"),
+              status:port_first_status,
+              id:1,
+            })
           }
           if(port_second_status){
-            self.portList[0].push({port:2,text:"端口二"});
+            self.portList[0].push({port:2,text:i18("端口二")});
+            self.curPort.push({
+              text:i18("端口二"),
+              status:port_second_status,
+              id:2
+            })
           }
           let choosePort = self.choosePort
           if(choosePort == 1){
@@ -464,11 +418,12 @@ export default {
   font-size: 5vw;
   font-weight: bold;
   color: #0E9F9B;
+  margin-bottom: 5vw;
 }
 
 .header-status {
   font-weight: bold;
-  padding-left: 5vw;
+  text-align: center;
 }
 
 .chong-active {
@@ -621,13 +576,13 @@ export default {
   width: 90%;
 }
 .body-bottom{
-padding:0 22px;
+  padding:0 22px;
 }
 .body-bottom .info-content{
   width: 30%;
 }
 .bottom-control{
-  height: 20vh;
+  height: 22vh;
   margin: 0 2%;
   margin-top:2vh;
   line-height: 3vh;
@@ -648,4 +603,72 @@ padding:0 22px;
 }
 .control-btn .btn-image{
 }
+.dportitem{
+  color: #60af7b
+}
+.dboxs{
+  background: #F8FCFF;
+  border: 0px solid #F8FCFF;
+  box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
+  border-radius: 4px;
+  padding: 20px;
+  font-size: 0.24rem;
+  color: #1A87FF;
+  margin:20px;
+  position: relative;
+}
+.portimg{
+  width: 20px;
+  height: 20px;
+}
+.dportitem-img{
+  width: 30px;
+  height: 30px;
+}
+.dpropitem-block{
+  padding: 0.12rem 0.37rem;
+  background: #e6f6f1;
+  display: flex;
+  width: 70px;
+  height: 70px;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  position: relative;
+}
+.dportitem{
+  margin:10px;
+  width: 70px;
+  position: relative;
+  display: inline-block;
+}
+.dportitem-block-2{
+  background: #f9f4e5;
+  color: #FFAA00;
+}
+.dpropitem-title{
+  text-align: center;
+  margin-bottom: 5px;
+  font-size: 16px;
+}
+.dpropitem-status{
+  font-size: 14px;
+}
+.dboxtitle{
+  font-size: 18px;
+  position: relative;
+}
+.dboxtitle-text{
+  display: inline-block;
+  position: absolute;
+  top: -2px;
+  left: 25px;
+}
+.btn-image{
+  width: 30px;
+  height: 30px;
+}
+.control-btn{
+  font-size: 14px;
+}
 </style>

+ 18 - 14
pages/weitiandi/device/plan.vue

@@ -9,8 +9,8 @@
       <view class="charge-type">
 
        <view class="charge-type-container">
-         <view @click="changeType(0)" class="type-left" :class="chargeType == 0?'type-choose':''">单次</view>
-         <view @click="changeType(1)" class="type-right" :class="chargeType == 1?'type-choose':''">自定义</view>
+         <view @click="changeType(0)" class="type-left" :class="chargeType == 0?'type-choose':''">{{i18('单次')}}</view>
+         <view @click="changeType(1)" class="type-right" :class="chargeType == 1?'type-choose':''">{{i18('自定义')}}</view>
        </view>
       </view>
 
@@ -19,7 +19,7 @@
 
       <view class="one-time">{{ oneTime.time }}</view>
 
-      <view class="one-setting"><uni-datetime-picker @change="changeDate" v-model="oneTime.time" :hide-second	="true">选择时间</uni-datetime-picker></view>
+      <view class="one-setting"><uni-datetime-picker @change="changeDate" v-model="oneTime.time" :hide-second	="true">{{i18('选择时间')}}</uni-datetime-picker></view>
     </view>
 
 
@@ -27,16 +27,16 @@
            <view style=";text-align: center;">
              <view class="one-date" style="display:inline-block;font-size: 12px;padding:0 2px" v-for="item in array">{{ item.name }}</view>
            </view>
-      <view class="one-setting" @click="showChoose">选择重复日期</view>
+      <view class="one-setting" @click="showChoose">{{i18('选择重复日期')}}</view>
       <view class="one-time">{{time}}</view>
 
       <picker mode="time" start="00:00" end="23:59" @change="bindTimeChange">
-        <view class="one-setting">选择时间</view>
+        <view class="one-setting">{{i18('选择时间')}}</view>
       </picker>
     </view>
 
     <view style="margin:5vh 7vw;">
-      <button @click="saveConfig"  style="background: #0E9F9B;color: white;" type="default" >确认</button>
+      <button @click="saveConfig"  style="background: #0E9F9B;color: white;" type="default" >{{i18('确认')}}</button>
     </view>
 
     <uni-popup ref="popup" type="bottom">
@@ -51,7 +51,7 @@
           </label>
         </checkbox-group>
         <view style="text-align: center">
-          <button size="mini" @click="chooseDay" style="background: #1cbbb4;color: white;" type="default" >确认</button>
+          <button size="mini" @click="chooseDay" style="background: #1cbbb4;color: white;" type="default" >{{i18('确认')}}</button>
         </view>
       </view>
 
@@ -62,6 +62,7 @@
 
 <script>
 	import {save} from '@/api/device/plan.js'
+  import i18 from '@/utils/i18.js'
 export default {
 
   data() {
@@ -80,31 +81,31 @@ export default {
       array: [],
       items: [{
         value: '7',
-        name: '周日'
+        name: i18('周日')
       },
         {
           value: '1',
-          name: '周一',
+          name: i18('周一'),
         },
         {
           value: '2',
-          name: '周二'
+          name: i18('周二'),
         },
         {
           value: '3',
-          name: '周三'
+          name: i18('周三'),
         },
         {
           value: '4',
-          name: '周四'
+          name: i18('周四'),
         },
         {
           value: '5',
-          name: '周五'
+          name: i18('周五'),
         },
         {
           value: '6',
-          name: '周六'
+          name: i18('周六'),
         }
       ]
     }
@@ -120,6 +121,9 @@ export default {
     this.port = opt.port;
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
     chooseDay(){
       this.array = [];
       let items = this.items;

+ 19 - 15
pages/weitiandi/device/planrecord.vue

@@ -4,28 +4,29 @@
       <view class="item" v-for="item in chargeList" :key="item.id">
         <view class="item-header">
           <view class="item-title">
-            设备编号:{{ item.deviceId }}
+            {{i18('设备编号')}}:{{ item.deviceId }}
           </view>
           <view class="item-status">
-            <uni-tag type="success" text="激活中" v-if="item.status === 1"></uni-tag>
-            <uni-tag type="error" text="已停用" v-if="item.status === 2"></uni-tag>
+            <uni-tag type="success" :text="i18('激活中')" v-if="item.status === 1"></uni-tag>
+            <uni-tag type="error" :text="i18('已停用')" v-if="item.status === 2"></uni-tag>
+            <uni-tag type="success" :text="i18('已执行')"  v-if="item.status === 3"></uni-tag>
           </view>
         </view>
         <view class="item-body">
           <view style="font-size: 12px">
-            预约类型:
-            <uni-tag type="primary" text="单次" v-if="item.planType === 1"></uni-tag>
-            <uni-tag type="warning" text="重复" v-if="item.planType === 2"></uni-tag>
+            {{i18('预约类型')}}:
+            <uni-tag type="primary" :text="i18('单次')" v-if="item.planType === 1"></uni-tag>
+            <uni-tag type="warning" :text="i18('重复')" v-if="item.planType === 2"></uni-tag>
           </view>
           <view style="font-size: 12px; margin: 5px 0">
-            创建时间:{{ item.createTime }}
+            {{i18('创建时间')}}:{{ item.createTime }}
           </view>
           <view v-if="item.planType === 2">
-            <view class="item-time">重复日期:{{ formatRepeatDays(item.repeatDays) }}</view>
-            <view class="item-time">重复时间:{{ item.repeatTime }}</view>
+            <view class="item-time">{{i18('重复日期')}}:{{ formatRepeatDays(item.repeatDays) }}</view>
+            <view class="item-time">{{i18('重复时间')}}:{{ item.repeatTime }}</view>
           </view>
           <view v-if="item.planType === 1">
-            <view class="item-time">执行时间:{{ item.runTime }}</view>
+            <view class="item-time">{{i18('执行时间')}}:{{ item.runTime }}</view>
           </view>
         </view>
       </view>
@@ -36,7 +37,7 @@
 
 <script>
 import { plan } from '@/api/device/plan.js';
-
+import i18 from '@/utils/i18.js'
 export default {
   data() {
     return {
@@ -47,14 +48,17 @@ export default {
         reasonable:true,
       },
       contentText: {
-        contentdown: '点击查看更多',
-        contentrefresh: '加载中',
-        contentnomore: '没有更多'
+        contentdown: i18('点击查看更多'),
+        contentrefresh: i18('加载中'),
+        contentnomore: i18('没有更多'),
       },
       chargeList: [],
     };
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
     getMore(){
       this.search.pageNum++;
       this.planRecord();
@@ -76,7 +80,7 @@ export default {
       const result = [];
       for (const day of days) {
         const weekday = weekdays[parseInt(day) - 1];
-        result.push(weekday);
+        result.push(i18(weekday));
       }
       return result.join(' ');
     },

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

@@ -23,7 +23,7 @@ import {getDeviceInfoFromQrcode} from "@/api/device/device";
             let imei = res.data.imei;
             let ccid = res.data.ccid;
             uni.redirectTo({
-              url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
+              url: '/pages/weitiandi/device/status?id='+imei+'&ccid='+ccid
             });
           }
         });

+ 10 - 6
pages/weitiandi/device/setting.vue

@@ -10,7 +10,7 @@
           </view>
         </view>
         <view class="prop-input" v-if="current.custom">
-          <input v-model="current.customValue" class="input" placeholder="请输入电流"/>
+          <input v-model="current.customValue" class="input" :placeholder="i18('请输入电流')"/>
           <view style="color: #0E9F9B">A</view>
         </view>
       </view>
@@ -20,7 +20,7 @@
 
     <view class="bottom-area">
 
-      <view class="btn" @click="confirm">确认</view>
+      <view class="btn" @click="confirm">{{i18('确认')}}</view>
 
 
       <view class="areas">
@@ -30,7 +30,7 @@
 
           </view>
           <view>
-            <view>获取主板配置</view>
+            <view>{{i18('获取主板配置')}}</view>
           </view>
         </view>
 
@@ -39,7 +39,7 @@
             <image style="width: 50px;height: 50px" :src="imgUrl+'/seting/reset.png'"></image>
           </view>
           <view>
-            <view >恢复默认配置</view>
+            <view >{{i18('恢复默认配置')}}</view>
           </view>
         </view>
 
@@ -48,7 +48,7 @@
             <image style="width: 50px;height: 50px" :src="imgUrl+'/seting/restart.png'"></image>
           </view>
           <view>
-            <view>重启充电桩</view>
+            <view>{{i18('重启充电桩')}}</view>
           </view>
         </view>
 
@@ -60,6 +60,7 @@
 <script>
 import {setCurrent, getMainbordConfig,sendMainboardCmd, getDeviceInfo, reset, restart} from '@/api/device/current.js'
 import websocket from '@/utils/websocket'
+import i18 from '@/utils/i18.js'
 export default {
   data() {
     return {
@@ -75,7 +76,7 @@ export default {
           {text: "10A", style: "", value: 10},
           {text: "16A", style: "", value: 16},
           {text: "32A", style: "", value: 32},
-          {text: "自定义", style: "", value: -1}
+          {text: i18("自定义"), style: "", value: -1}
         ],
         custom: false,
         customValue: ''
@@ -98,6 +99,9 @@ export default {
     this.sendMainboardCmd();
   },
   methods: {
+    i18(text){
+      return i18(text)
+    },
     closeSocket(){
       this.scriptTask.close();
     },

+ 918 - 0
pages/weitiandi/device/status.vue

@@ -0,0 +1,918 @@
+<template>
+  <view class="container">
+    <view style=";position: relative;height: 250px;margin-top:2vh;">
+      <view class="dtop">
+        <view class="can">
+
+          <view class="box">
+            <!--view class="top_ball one"></view-->
+            <!--view class="top_ball two"></view-->
+            <view class="three">
+              <view class="four"></view>
+              <view class="five"></view>
+              <view class="six"></view>
+
+            </view>
+
+            <view class="dot"></view>
+            <view class="dot"></view>
+            <view class="dot"></view>
+            <view class="dot"></view>
+            <view class="dot"></view>
+          </view>
+
+          <!--            <canvas id="c">-->
+          <!--            </canvas>-->
+          <view class="stip">
+
+            <view class="p0" st="">{{ deviceInfo.qrcode}}</view>
+            <view class="p1">
+              <view v-if="portDetail.portStatus == 2">
+                {{$t('charge.charging')}}
+              </view>
+              <view v-if="portDetail.portStatus == 6">
+                {{$t('charge.planed')}}
+              </view>
+
+              <view v-if="portDetail.portStatus == 2">
+                {{$t('charge.connected')}}
+              </view>
+
+              <view v-else>
+                {{$t('charge.nocharge')}}
+              </view>
+
+            </view>
+
+          </view>
+        </view>
+
+      </view>
+    </view>
+    <view class="dstatus">
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/tmp.png"/>
+        <view class="item-value">{{portDetail.dev_temper}}℃</view>
+        <span class="item-text">{{$t('charge.devtemper')}}</span>
+      </view>
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/dianya.png"/>
+        <view class="item-value">{{ portDetail.voltage }}V</view>
+        <span class="item-text">{{$t('charge.voltage')}}</span>
+      </view>
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/dianliu.png"/>
+        <view class="item-value" v-if="portDetail.voltage == 0">0A</view>
+        <view class="item-value" v-else>{{portDetail.POWER/portDetail.voltage}}A</view>
+        <span class="item-text">{{$t('charge.current')}}</span>
+      </view>
+
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/shjian.png"/>
+        <view class="item-value">{{ portDetail.time }}{{ i18('分钟') }}</view>
+        <span class="item-text">{{$t('charge.chargetime')}}</span>
+      </view>
+
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/gonglv.png"/>
+        <view class="item-value">{{ portDetail.power }}W</view>
+        <span class="item-text">{{$t('charge.power')}}</span>
+      </view>
+
+      <view class="ditem">
+        <image class="itemimg" src="/static/images/new/dianliang.png"/>
+        <view class="item-value">{{ portDetail.elec }} {{ i18('度') }}</view>
+        <span class="item-text">{{$t('charge.elec')}}</span>
+      </view>
+
+    </view>
+    <view class="dbtns">
+      <view class="start" @click="toPage">
+        <image style="width:25px;height: 25px;margin-right: 5px;" src="/static/images/new/start.png"/>
+        <span>{{$t('charge.startcharge')}}</span>
+      </view>
+
+
+      <view class="get" @click="getInfo">
+        <image style="width:25px;height: 25px;margin-right: 5px;" src="/static/images/new/get.png"/>
+        <span>{{$t('charge.getinfo')}}</span>
+      </view>
+
+    </view>
+    <view class="dtip">
+      <view style="margin:10px 0px;color: #1A87FF;"><img style="width: 13px;height: 13px" src="/static/images/new/tip.png">{{i18('温馨提示')}}</view>
+      <view>1,{{i18('桩控制最大输出电流,当功率没有达到请检查车的状态或者车的设置')}};</view>
+      <view>2,{{i18('启动充电-&gt;设备管理->可设置设备最大输出电流')}}</view>
+      <view>3,{{i18('为保障您远程启动正常充电,请确保枪头完全连接充电口,同时确认您的爱车处于立即充电状态下')}};</view>
+      <view>4,{{i18('注意规范安全充电,停好车,锁好车。')}}</view>
+    </view>
+  </view>
+</template>
+
+<script>
+import {getDeviceInfo,getPortDetail,startCharge,stopCharge,sendPortDetailCmd,checkStatusChange,getPlanInfo,cancelPlan} from "@/api/device/device";
+import websocket from '@/utils/websocket'
+import i18 from '@/utils/i18.js'
+export default {
+ data() {
+   return {
+     deviceInfo:{},
+     visitTime:"",
+     timer:null,
+     showPort:false,
+     portDetail:{portStatus:0,POWER:0,voltage:0},
+     statusTimer:"",
+     connected:false,
+     scriptTask:null,
+     choosePort:1,
+     portList:[[{port:1,text:"端口一"}]],
+     planInfo:null,
+     days:["","周一","周二","周三","周四","周五","周六","周日"]
+   }
+ },
+ computed: {
+   imgUrl() {
+     return getApp().globalData.config.imgUrl;
+   }
+ },
+ onLoad(opt) {
+   this.deviceInfo.deviceId = opt.id;
+   this.deviceInfo.ccid = opt.ccid;
+   this.deviceInfo.qrcode = opt.qrcode;
+ },
+  onShow(){
+    this.getInfo();
+    this.getPlanInfo();
+  },
+  onUnload (){
+   this.closeSocket();
+  },
+  methods: {
+    toPage(){
+      let imei =  this.deviceInfo.deviceId;
+      let ccid =  this.deviceInfo.ccid;
+      this.closeSocket();
+      uni.navigateTo({
+        url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
+      });
+    },
+    i18(text){
+      return i18(text)
+    },
+    planCharge(){
+      if(this.planInfo != null){
+        this.$modal.confirm("确认取消预约?").then(res=>{
+          this.cancelPlan();
+        })
+      }else{
+        this.toPlan()
+      }
+    },
+    cancelPlan(){
+      cancelPlan(this.planInfo.id).then(res=>{
+        this.$modal.msg("取消成功");
+        this.planInfo = null;
+        this.getPlanInfo();
+      })
+    },
+    getPlanInfo(){
+      getPlanInfo(this.deviceInfo.deviceId,this.choosePort).then(res=>{
+        let data = res.data;
+        if(data != null){
+          let planType = data.planType;
+          if(planType == 1){//单次预约
+              let planInfo = {};
+              planInfo.runTime = data.runTime;
+              this.planInfo = planInfo;
+              this.planInfo.id = data.id;
+          }else{
+            let planInfo = {};
+            planInfo.runTime = data.runTime;
+            let repeatDays = data.repeatDays;
+            let days = repeatDays.split(",")
+            let strs = "";
+            for (let i = 0; i < days.length; i++) {
+                if(strs.length>0){
+                  strs+=",";
+                }
+                strs +=this.days[days[i]];
+            }
+            this.planInfo = planInfo;
+            this.planInfo.runTime = strs+" "+data.repeatTime;
+            this.planInfo.id = data.id;
+          }
+        }
+      })
+    },
+    confirmPort(e){
+      let value = e.value[0]
+      this.choosePort = value.port;
+      this.showPort = false;
+      this.getInfo()
+    },
+    initSocket(key){
+      let self = this;
+      let socketUrl =  getApp().globalData.config.socketUrl
+      this.scriptTask = websocket({
+        url:"/"+key+"/",
+      });
+      let scriptTask = this.scriptTask;
+      scriptTask.onOpen(function (res) {
+        console.log('WebSocket连接已打开!');
+        self.connected = true;
+      });
+      scriptTask.onError(function (res) {
+        self.connected = false;
+        console.log(res);
+      });
+      scriptTask.onMessage(function (res) {
+        let data = JSON.parse(res.data);
+        let type = data.type;
+        let real_data = data.real_data;
+        if(type == 103){
+          self.portDetail = real_data
+          self.portList = [[]];
+          let port_first_status = self.portDetail["port_first_status"];
+          let port_second_status = self.portDetail["port_second_status"]
+          if(port_first_status){
+            self.portList[0].push({port:1,text:"端口一"});
+          }
+          if(port_second_status){
+            self.portList[0].push({port:2,text:"端口二"});
+          }
+          let choosePort = self.choosePort
+          if(choosePort == 1){
+            self.portDetail.portStatus = port_first_status;
+          }else if(choosePort == 2){
+            self.portDetail.portStatus = port_second_status;
+          }
+
+          self.$modal.closeLoading();
+        }
+        if(type == 116){
+          self.$modal.closeLoading();
+          self.getInfo();
+        }
+        if(type == 113){
+          self.$modal.closeLoading();
+          self.getInfo();
+        }
+        if(type == 96){
+          self.mainBoardInfo = real_data;
+          self.formatMainboardData();
+          self.$modal.closeLoading();
+        }
+        self.$forceUpdate();
+        console.log('收到服务器内容:' + JSON.stringify(data));
+      });
+      scriptTask.onClose(function (res) {
+        console.log('WebSocket 已关闭!');
+      });
+    },
+    toSet(){
+      this.closeSocket();
+      uni.navigateTo({
+        url: '/pages/weitiandi/device/setting?id='+this.deviceInfo.deviceId+"&ccid="+this.deviceInfo.ccid
+      });
+    },
+    toPlan(){
+      uni.navigateTo({
+        url: '/pages/weitiandi/device/plan?port='+this.choosePort+'&id='+this.deviceInfo.deviceId+"&ccid="+this.deviceInfo.ccid
+      });
+    },
+    trigger(){
+      let portStatus = this.portDetail.portStatus;
+      if(portStatus == 2){//需要停止充电
+        this.$modal.confirm("需要停止充电么?").then(res=>{
+              this.stopCharge();
+        })
+      }else{
+        if(portStatus == 1){
+          this.$modal.msg("请先将充电枪插入后再点击充电");
+        }
+        if(portStatus == 5){
+          this.$modal.confirm("确认开始充电么?").then(res=>{
+            this.startCharge();
+          })
+        }
+
+      }
+    },
+   getInfo() {
+    this.$modal.loading("正在获取状态,请稍等...");
+     sendPortDetailCmd(this.deviceInfo).then(res => {
+       this.$modal.loading("正在获取状态,请稍等...");
+        this.visitTime = res.msg;
+        if(!this.visitTime){
+          this.$modal.msg("请重新进入页面");
+          return;
+        }
+        if(!this.scriptTask){
+          this.initSocket(this.deviceInfo.deviceId);
+        }
+       // this.getPortInfo()
+    })
+  },
+    stopCharge(){
+      let self = this;
+      this.deviceInfo.port = this.choosePort;
+      stopCharge(this.deviceInfo).then(()=>{
+        self.$modal.loading("停止成功");
+        setTimeout((()=>{
+          self.getInfo();
+        }),1000);
+      })
+    },
+    startCharge(){
+      let self = this;
+      this.deviceInfo.port = this.choosePort;
+      startCharge(this.deviceInfo).then(res=>{
+        self.$modal.loading("启动成功");
+        setTimeout((()=>{
+          self.getInfo();
+        }),1000);
+      })
+    },
+    getPortInfo(){
+      this.startPortDetailTimer();
+    },
+    startPortDetailTimer(){
+     let self = this;
+      this.timer = setTimeout(function (){
+        getPortDetail(self.deviceInfo,self.visitTime).then(res=>{
+         let data = res.data;
+         if(data != null){
+           self.portDetail = data;
+           self.checkStatusCheck();
+           self.$modal.closeLoading();
+         }else{
+           self.startPortDetailTimer();
+         }
+        });
+      },1000);
+    },
+    checkStatusCheck(){
+      this.statusChangeTimer();
+    },
+    checkOnPage(){
+      var pages = getCurrentPages() // 获取栈实例
+      let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
+      if("pages/weitiandi/device/index" != currentRoute){
+        return false;
+      }
+      return  true;
+    },
+    closeSocket(){
+      this.scriptTask.close();
+      this.scriptTask = null;
+    },
+    statusChangeTimer(){
+      let self = this;
+      this.statusTimer = setTimeout(function(){
+       if(!this.checkOnPage()){
+         return;
+       }
+        checkStatusChange(self.deviceInfo,self.visitTime).then(res=>{
+          let data = res.data;
+          if(data != null){
+            self.getInfo();
+          }else{
+            self.statusChangeTimer();
+          }
+        });
+      },3000);
+    }
+  }
+}
+</script>
+
+<style>
+.container {
+  background: rgb(249, 252, 255);
+  inset: 0;
+  position: absolute;
+}
+
+.header {
+  position: relative;
+  margin-top:4vw;
+}
+
+.header-status-desc {
+  position: absolute;
+  text-align: center;
+  width: 100%;
+  bottom:1vh;
+  font-size: 5vw;
+  font-weight: bold;
+  color: #0E9F9B;
+  margin-bottom: 5vw;
+}
+
+.header-status {
+  font-weight: bold;
+  text-align: center;
+}
+
+.chong-active {
+  color: #0E9F9B
+}
+
+.header-img {
+  width: 100%;
+  padding: 5% 10%;
+  text-align: center;
+
+}
+
+.header-img image {
+  width: 100%;
+  height: 23vh;
+}
+.info-body{
+  background: #0E9F9B;
+  height: 20vh;
+  margin: 0 2%;
+  border-radius: 1vw;
+  margin-top:2vh;
+  color: #F8FCFF;
+  line-height: 3vh;
+}
+.info-content{
+  display: inline-block;
+  width: 23%;
+  text-align: center;
+  margin: 1%;
+  margin-top:2.5vh;
+}
+.info-content-value{
+  font-weight: bold;
+}
+.info-content-text{
+
+}
+.info-summary{
+  display: flex;
+  flex-direction: row;
+  text-align: center;
+  margin:3vh 0;
+}
+.summary{
+  width: 33%;
+  line-height: 2.5vh;
+}
+.charge-num{
+  color: #0E9F9B;
+  font-weight: bold;
+  font-size: 4.5vw;
+}
+.charge-title{
+  color: #B2B2B2;
+  font-weight: 400;
+}
+.btn-image{
+  width: 90%;
+  height: 100%;
+}
+.info-bottom-btn{
+  display: flex;
+  flex-direction: row;
+  text-align: center;
+  position: relative;
+  margin-top: 10vh
+;
+}
+.btn-area{
+  width: 50%;
+  height: 50px;
+}
+.left{
+  position: relative;
+  left: 10px;
+  text-align: right;
+}
+.right{
+  text-align: left;
+  position: relative;
+  right: 10px;
+}
+.info-plan{
+  text-align: center;
+  color: #0E9F9B;
+  margin-top:1vh;
+  font-weight: 400;
+}
+.setting{
+  position: fixed;
+  right: -1px;
+  top: 10vh;
+  z-index: 999;
+  background: rgb(227,243,245);
+  color: #0E9F9B;
+  font-size: 10px;
+  border-radius: 5px;
+  padding: 3px;
+}
+.port{
+  height: 70px;
+  background: #F8FCFF;
+  border: 0px solid #F8FCFF;
+  box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
+  border-radius: 4px;
+  margin:0 10px;
+  position: relative;
+  margin-top:10px;
+}
+
+.plan{
+  height: 70px;
+  background: #F8FCFF;
+  border: 0px solid #F8FCFF;
+  box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
+  border-radius: 4px;
+  margin:0 10px;
+  position: relative;
+  margin-top:15px;
+}
+.port-image{
+  height: 40px;
+  width: 40px;
+  position: absolute;
+  top:15px;
+  left:20px;
+}
+.port-text{
+  position: absolute;
+  top:13px;
+  left:75px;
+  font-weight: bold;
+}
+.port-num{
+  position: absolute;
+  top:38px;
+  left:75px;
+  color: #B2B2B2;
+}
+.port-icon{
+  position: absolute;
+  top:30px;
+  right:5px;
+  width: 10px;
+  height: 16px;
+}
+.port-icon image{
+  width: 90%;
+}
+.body-bottom{
+  padding:0 22px;
+}
+.body-bottom .info-content{
+  width: 30%;
+}
+.bottom-control{
+  height: 22vh;
+  margin: 0 2%;
+  margin-top:2vh;
+  line-height: 3vh;
+  background: #F8FCFF;
+  border: 0px solid #F8FCFF;
+  box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
+  border-radius: 4px;
+  padding:3%;
+}
+.control-btn{
+  display: inline-block;;
+  height: 60px;
+  width: 25%;
+  padding:10px 20px;
+  text-align: center;
+  font-size: 12px;
+  color: black;
+}
+.control-btn .btn-image{
+}
+
+#box {
+  /* width: 300px; */
+  height: 280px;
+  position: relative;
+  /* 背景色 */
+  /* background: #f7f6f6; */
+  overflow: hidden;
+  /* padding: 50px 0; */
+  box-sizing: border-box;
+;
+}
+
+.box {
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  display: flex;
+  justify-content: center;
+  /* 此处尽量不要设置背景色,可以选择在父标签上设置背景色,否则没有黏黏的效果 */
+  filter: url("#goo");
+}
+
+/* 电量文字 */
+.text {
+  font-weight: 200;
+  font-size: 20px;
+  margin-top: 5px;
+  text-align: center;
+  color: #ff6600;
+}
+
+/* 电量文字 */
+.text span {
+  font-size: 15px;
+}
+
+/* 顶部的两个旋转小球 */
+.top_ball {
+  width: 200px;
+  height: 200px;
+  border-radius: 35%;
+  opacity: 0.5;
+  position: absolute;
+  top: 20px;
+  z-index: 10;
+  /* 从中心向外剪切圆,相当于掏空 */
+  -webkit-mask: radial-gradient(transparent 95px, white 0px);
+}
+
+/* 顶部的两个旋转小球 */
+.top_ball.one {
+  background: var(--c);
+  animation: ballZhuan 5s linear infinite;
+}
+
+/* 顶部的两个旋转小球 */
+.top_ball.two {
+  background: var(--c);
+  animation: ballZhuan 8s linear infinite;
+}
+
+.three {
+  width: 170px;
+  height: 170px;
+  border-radius: 300px;
+  opacity: 1;
+  position: absolute;
+  top: 20px;
+  z-index: 10;
+  /* 从中心向外剪切圆,相当于掏空 */
+  /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
+  background: #ffffff;
+  /* animation: ballZhuan 9s linear infinite; */
+  overflow: hidden;
+  box-shadow: 0px 0px 19px 1px #2196f3;
+}
+.four {
+  width: 200px;
+  height: 200px;
+  border-radius: 80px;
+  opacity: 0.3;
+  position: absolute;
+  top: 10px;
+  z-index: 10;
+  /* 从中心向外剪切圆,相当于掏空 */
+  /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
+  background: #2196f3;
+  animation: ballZhuan1 linear infinite;
+  animation-duration: 11s;
+}
+.five {
+  width: 270px;
+  height: 270px;
+  border-radius: 99px;
+  opacity: 0.6;
+  position: absolute;
+  top: 30px;
+  z-index: 10;
+  /* 从中心向外剪切圆,相当于掏空 */
+  /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
+  background: #2196f3;
+  animation: ballZhuan1 linear infinite;
+  /* transform: rotate(120deg); */
+  animation-duration: 9s;
+  left: -67px;
+}
+.six {
+  width: 270px;
+  height: 270px;
+  border-radius: 99px;
+  opacity: 0.6;
+  position: absolute;
+  top:30px;
+  z-index: 10;
+  /* 从中心向外剪切圆,相当于掏空 */
+  /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
+  background: #2196f3;
+  animation: ballZhuan1 7s linear infinite;
+  /* transform: rotate(120deg); */
+  right: -67px;
+}
+
+@keyframes ballZhuan {
+  100% {
+    transform: rotate(360deg);
+  }
+}
+
+@keyframes ballZhuan1 {
+  100% {
+    transform: rotate(360deg);
+  }
+}
+
+/* 底部的小球 */
+.dot {
+  display: block;
+  width: 20px;
+  height: 20px;
+  border-radius: 50%;
+  background: rgba(101,192,255,0.28);
+  position: absolute;
+  z-index: 1000;
+  bottom: -50px;
+}
+
+.dot:nth-of-type(1) {
+  width: 40px;
+  height: 40px;
+  right: 116px;
+  animation: dotMove 5s linear infinite;
+}
+
+.dot:nth-of-type(2) {
+  width: 50px;
+  height: 50px;
+  left: 120px;
+  animation: dotMove 4s linear infinite;
+}
+
+.dot:nth-of-type(3) {
+  animation: dotMove 2s linear infinite;
+}
+
+.dot:nth-of-type(4) {
+  width: 15px;
+  height: 15px;
+  left: 130px;
+  animation: dotMove 2s linear infinite;
+}
+
+.dot:nth-of-type(5) {
+  width: 30px;
+  height: 30px;
+  animation: dotMove 3s linear infinite;
+}
+
+@keyframes dotMove {
+  0% {
+    transform: translateY(0px);
+    opacity: 1;
+  }
+
+  98% {
+    opacity: 1;
+  }
+
+  100% {
+    transform: translateY(-260px);
+    opacity: 0;
+  }
+}
+
+.w-flex {
+  display: -webkit-box;
+  display: -webkit-flex;
+  display: flex;
+  padding: 0px 25px;
+}
+.w-flex__item {
+  -webkit-box-flex: 1;
+  -webkit-flex: 1;
+  flex: 1;
+}
+.w-item{
+  text-align: center;
+  padding: 5px;
+}
+.w-item-tit{
+  font-size: 14px;
+  color: #888;
+}
+.w-item-num{
+  font-size: 18px;
+  color: #111;
+}
+.can{
+  position: relative;
+  z-index: 0;
+  width: 211px;
+  height: 211px;
+  background-image: url(/static/images/new/quan.png);
+  background-size: cover;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.dtop{
+  background: url(/static/images/new/box1.png);
+  background-size: cover;
+  width: 260px;
+  height: 236px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  left: 25%;
+  position: relative;
+}
+.dstatus{
+  margin-top: 0.1rem;
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: space-evenly;
+  align-content: center;
+}
+.ditem{
+  width: 30%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-bottom: 0.3rem;
+  margin-top: 10px;
+}
+.itemimg{
+  width: 50px;
+  height: 50px;
+}
+
+.item-value{
+  font-weight: bold;
+  font-size: 19px;
+  margin:4px 0;
+}
+.item-text{
+  font-size: 13px;
+  margin:1px 0;
+  color: #999999;
+}
+.start{
+  background: #1A87FF;
+  color: #fff;
+  width: 45%;
+  height: 50px;
+  min-height: 40px;
+  border-radius: 50px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 20px;
+  font-weight: bold;
+}
+.dbtns{
+  display: flex;
+  margin-top:10px;
+  justify-content: space-between;
+  padding: 0 30px;
+}
+.get{
+  background: #fff;
+  border: 1px solid #1A87FF;
+  color: #1A87FF;
+  width: 45%;
+  height: 50px;
+  min-height: 40px;
+  border-radius: 50px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 20px;
+  font-weight: bold;
+}
+.dtip{
+  margin: 20px 20px;
+  padding: 10px;
+  background: rgba(127,200,251,0.1);
+  border: 1px solid #7FC8FB;
+  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.19);
+  border-radius: 5px;
+  font-size: 17px;
+  font-weight: 400;
+  color: #B8B9BA;
+  margin-bottom: 10px;
+}
+.p1{
+  font-size: 20px;
+  color: white;
+  font-weight: bold;
+  margin-top:10px;
+}
+.stip{
+  text-align: center;
+  z-index: 9999;
+}
+</style>

+ 12 - 4
plugins/modal.js

@@ -1,6 +1,8 @@
+import i18 from '@/utils/i18.js'
 export default {
   // 消息提示
   msg(content) {
+    content = i18(content);
     uni.showToast({
       title: content,
       icon: 'none'
@@ -8,6 +10,7 @@ export default {
   },
   // 错误消息
   msgError(content) {
+    content = i18(content);
     uni.showToast({
       title: content,
       icon: 'error'
@@ -15,6 +18,7 @@ export default {
   },
   // 成功消息
   msgSuccess(content) {
+    content = i18(content);
     uni.showToast({
       title: content,
       icon: 'success'
@@ -26,20 +30,22 @@ export default {
   },
   // 弹出提示
   alert(content) {
+    content = i18(content);
     uni.showModal({
-      title: '提示',
+      title: i18('提示'),
       content: content,
       showCancel: false
     })
   },
   // 确认窗体
   confirm(content) {
+    content = i18(content);
     return new Promise((resolve, reject) => {
       uni.showModal({
-        title: '系统提示',
+        title: i18('提示'),
         content: content,
-        cancelText: '取消',
-        confirmText: '确定',
+        cancelText: i18('取消'),
+        confirmText: i18('确认'),
         success: function(res) {
           if (res.confirm) {
             resolve(res.confirm)
@@ -50,6 +56,7 @@ export default {
   },
   // 提示信息
   showToast(option) {
+    option = i18(option);
     if (typeof option === "object") {
       uni.showToast(option)
     } else {
@@ -62,6 +69,7 @@ export default {
   },
   // 打开遮罩层
   loading(content) {
+    content = i18(content);
     uni.showLoading({
       title: content,
       icon: 'none',

+ 4 - 0
utils/ecUI.js

@@ -1,4 +1,7 @@
+import i18 from '@/utils/i18.js'
 const showModal = (title, content, cb) => {
+	title = i18(title);
+	content = i18(content);
 	uni.showModal({
 		title,
 		content,
@@ -9,6 +12,7 @@ const showModal = (title, content, cb) => {
 	});
 };
 const showLoading = (title) => {
+	title = i18(title);
 	uni.showLoading({
         title,
         mask:true,

+ 17 - 0
utils/i18.js

@@ -0,0 +1,17 @@
+import messages from '@/locale/index'
+
+function $t(title){
+    let locale = uni.getLocale()
+    let mes = messages[locale];
+    let common = mes.common;
+    if(!common){
+        return title;
+    }
+    if(common[title]){
+        return common[title]
+    }else{
+        return title;
+    }
+}
+
+export  default  $t;

+ 8 - 6
utils/request.js

@@ -4,6 +4,8 @@ import { getToken } from '@/utils/auth'
 import errorCode from '@/utils/errorCode'
 import { toast, showConfirm, tansParams } from '@/utils/common'
 
+import i18 from '@/utils/i18.js'
+
 let timeout = 10000
 const baseUrl = config.baseUrl
 
@@ -21,7 +23,7 @@ const request = config => {
     config.url = url
   }
   return new Promise((resolve, reject) => {
-    uni.showLoading({title:"正在加载"});
+    uni.showLoading({title:i18("正在加载")});
     uni.request({
         method: config.method || 'get',
         timeout: config.timeout ||  timeout,
@@ -30,24 +32,24 @@ const request = config => {
         header: config.header,
         dataType: 'json'
       }).then(response => {
-      uni.hideLoading();
+        uni.hideLoading();
         let [error, res] = response
         if (error) {
-          toast('后端接口连接异常')
-          reject('后端接口连接异常')
+          toast(i18('后端接口连接异常'))
+          reject(i18('后端接口连接异常'))
           return
         }
         const code = res.data.code || 200
         const msg = errorCode[code] || res.data.msg || errorCode['default']
         if (code === 401) {
-          showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+          showConfirm(i18('登录状态已过期,您可以继续留在该页面,或者重新登录?')).then(res => {
             if (res.confirm) {
               store.dispatch('LogOut').then(res => {
                 uni.reLaunch({ url: '/pages/login' })
               })
             }
           })
-          reject('无效的会话,或者会话已过期,请重新登录。')
+          reject(i18('无效的会话,或者会话已过期,请重新登录。'))
         } else if (code === 500) {
           toast(msg)
           reject('500')