Browse Source

初始化项目

chenyi406 3 years ago
commit
5659bd74f6
78 changed files with 2237 additions and 0 deletions
  1. 32 0
      .gitignore
  2. 217 0
      app.js
  3. 44 0
      app.json
  4. 218 0
      app.wxss
  5. BIN
      imgs/My/arrows.png
  6. BIN
      imgs/My/banner.png
  7. BIN
      imgs/My/device.png
  8. BIN
      imgs/My/info.png
  9. BIN
      imgs/My/set.png
  10. BIN
      imgs/My/track.png
  11. BIN
      imgs/center.png
  12. BIN
      imgs/device/default.png
  13. BIN
      imgs/device/more.png
  14. BIN
      imgs/device/phone.png
  15. BIN
      imgs/device/scan.png
  16. BIN
      imgs/marker.png
  17. BIN
      imgs/navIcon/Index.png
  18. BIN
      imgs/navIcon/IndexS.png
  19. BIN
      imgs/navIcon/Location.png
  20. BIN
      imgs/navIcon/LocationS.png
  21. BIN
      imgs/navIcon/My.png
  22. BIN
      imgs/navIcon/MyS.png
  23. BIN
      imgs/refresh.png
  24. BIN
      imgs/route.png
  25. BIN
      imgs/set/arrows.png
  26. BIN
      imgs/set/auto_answer.png
  27. BIN
      imgs/set/broadcast.png
  28. BIN
      imgs/set/contacts.png
  29. BIN
      imgs/set/continue.png
  30. BIN
      imgs/set/idioms.png
  31. BIN
      imgs/set/upload.png
  32. BIN
      imgs/set/volume.png
  33. 55 0
      pages/device/addition/addition.js
  34. 3 0
      pages/device/addition/addition.json
  35. 13 0
      pages/device/addition/addition.wxml
  36. 46 0
      pages/device/addition/addition.wxss
  37. 123 0
      pages/device/manager/manager.js
  38. 3 0
      pages/device/manager/manager.json
  39. 37 0
      pages/device/manager/manager.wxml
  40. 83 0
      pages/device/manager/manager.wxss
  41. 194 0
      pages/index/index.js
  42. 3 0
      pages/index/index.json
  43. 28 0
      pages/index/index.wxml
  44. 112 0
      pages/index/index.wxss
  45. 30 0
      pages/my/my.js
  46. 2 0
      pages/my/my.json
  47. 33 0
      pages/my/my.wxml
  48. 103 0
      pages/my/my.wxss
  49. 94 0
      pages/set/broadcast/broadcast.js
  50. 3 0
      pages/set/broadcast/broadcast.json
  51. 34 0
      pages/set/broadcast/broadcast.wxml
  52. 53 0
      pages/set/broadcast/broadcast.wxss
  53. 54 0
      pages/set/contacts/contacts.js
  54. 3 0
      pages/set/contacts/contacts.json
  55. 44 0
      pages/set/contacts/contacts.wxml
  56. 3 0
      pages/set/contacts/contacts.wxss
  57. 77 0
      pages/set/set.js
  58. 3 0
      pages/set/set.json
  59. 44 0
      pages/set/set.wxml
  60. 48 0
      pages/set/set.wxss
  61. 40 0
      pages/set/uploadData/uploadData.js
  62. 3 0
      pages/set/uploadData/uploadData.json
  63. 10 0
      pages/set/uploadData/uploadData.wxml
  64. 3 0
      pages/set/uploadData/uploadData.wxss
  65. 51 0
      pages/set/volume/volume.js
  66. 3 0
      pages/set/volume/volume.json
  67. 26 0
      pages/set/volume/volume.wxml
  68. 36 0
      pages/set/volume/volume.wxss
  69. 92 0
      pages/track/track.js
  70. 3 0
      pages/track/track.json
  71. 2 0
      pages/track/track.wxml
  72. 11 0
      pages/track/track.wxss
  73. 43 0
      pages/welcome/welcome.js
  74. 2 0
      pages/welcome/welcome.json
  75. 2 0
      pages/welcome/welcome.wxml
  76. 3 0
      pages/welcome/welcome.wxss
  77. 61 0
      project.config.json
  78. 7 0
      sitemap.json

+ 32 - 0
.gitignore

@@ -0,0 +1,32 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/
+/node_modules

+ 217 - 0
app.js

@@ -0,0 +1,217 @@
+const appUrl = "https://www.mang406.top/omp/api/wx/";
+// const appUrl = "http://localhost:8081/omp/api/wx/";
+let lock = false;
+App({
+  onLaunch: function () { },
+
+  // 自定义页面跳转
+  Route: {
+    path: {
+      my: "/pages/my/my",
+      set: "/pages/set/set",
+      uploadData: "/pages/set/uploadData/uploadData",
+      contacts: "/pages/set/contacts/contacts",
+      volume: "/pages/set/volume/volume",
+      idioms: "/pages/set/idioms/idioms",
+      broadcast: "/pages/set/broadcast/broadcast",
+
+      manager: "/pages/device/manager/manager",
+      addition: "/pages/device/addition/addition",
+      index: "/pages/index/index",
+      location: "/pages/location/location",
+      track: "/pages/track/track",
+    },
+    //跳转页面
+    routeTo: function (path, params) {
+      let url = "";
+      if (params === undefined) url = path;
+      else {
+        const arr = Object.keys(params);
+        url += "?"
+        for (let i = 0; i < arr.length; i++) {
+          url = url + arr[i] + "=" + params[arr[i]] + "&";
+        }
+        url = url.substring(0, url.length - 1);
+      }
+      wx.navigateTo({
+        url: url,
+      })
+    }
+  },
+
+  Url: {
+    //登录
+    login: appUrl + "user/login.do",
+
+    // 获取设备位置信息
+    getLocation: appUrl + "location/getLocation.do",
+    // 获取设备位置信息-历史轨迹
+    getLocationHistory: appUrl + "location/getHistory.do",
+
+    //添加用户设备绑定关系
+    bind: appUrl + "device/bind.do",
+    //删除绑定关系
+    unbind: appUrl + "device/unbind.do",
+    // 修改设备名称
+    modifyDeviceName: appUrl + "device/updateName.do",
+    //获取设备集合
+    getListByUserId: appUrl + "device/getListByUserId.do",
+    //修改默认设备
+    changeDefaultDevice: appUrl + "device/changeDefault.do",
+
+
+    // 获取用户常用语
+    getUserIdioms: appUrl + "idioms/getList.do",
+    // 添加用户常用语
+    addUserIdioms: appUrl + "idioms/save.do",
+    // 删除用户常用语
+    deleteUserIdioms: appUrl + "idioms/delById.do",
+
+    //获取音量设置
+    getVolume: appUrl + "setInfo/volume.do",
+    //获取联系人设置
+    getSos: appUrl + "setInfo/sos.do",
+    //获取其他设置
+    getOther: appUrl + "setInfo/other.do",
+
+    //设置功能-音量
+    setVolume: appUrl + "set/volume.do",
+    //设置功能-自动接听
+    setAutoAnswer: appUrl + "set/autoAnswer.do",
+    //设置功能-持续定位
+    setContinue: appUrl + "set/continue.do",
+    //设置功能-联系人
+    setSos: appUrl + "set/sos.do",
+    //设置功能-定位频率
+    setGpsRate: appUrl + "set/gpsRate.do",
+    //设置功能-语音播报
+    setNews: appUrl + "set/news.do",
+  },
+
+  /**
+   * 发送Get请求
+   * showLoading 是否显示等待
+   */
+  Get: function (url, params, showLoading) {
+    const that = this;
+    if (showLoading) wx.showLoading();
+    return new Promise((resolve, reject) => {
+      wx.request({
+        url: url,
+        header: {
+          "user": that.globalData.openId
+        },
+        data: params,
+        success: function (res) {
+          console.log(url);
+          console.log(res.data);
+          console.log("-------------------------------------------------------")
+          if (showLoading) wx.hideLoading();
+          //请求成功回调函数
+          switch (res.data.status) {
+            case 200: //成功
+              resolve(res.data);
+              break;
+            case 300: //警告
+              that.Modal.tips(res.data.msg);
+              break;
+            case 500: //服务器异常
+              that.Modal.tips("服务器开小差了");
+              break;
+          }
+        },
+        fail: function () { //失败
+          console.log("网络异常:" + url);
+          that.Modal.tips("网络异常")
+        },
+      })
+    })
+  },
+
+  /**
+   *  发送Post请求
+   */
+  Post: function (url, params) {
+    const that = this;
+    if (lock) {
+      that.Modal.tips("您的请求太快了");
+      return;
+    } else {
+      lock = true; //加锁
+    }
+    wx.showLoading();
+    return new Promise((resolve, reject) => {
+      wx.request({
+        url: url,
+        method: 'POST',
+        header: {
+          "user": that.globalData.openId,
+          "Content-Type": "application/x-www-form-urlencoded",
+        },
+        data: params,
+        success: function (res) {
+          console.log(url);
+          console.log(res.data);
+          console.log("-------------------------------------------------------")
+          wx.hideLoading();
+          //请求成功回调函数
+          switch (res.data.status) {
+            case 200: //成功
+              resolve(res.data);
+              break;
+            case 300: //警告
+              that.Modal.tips(res.data.msg);
+              break;
+            case 500: //服务器异常
+              console.log(res)
+              that.Modal.tips("服务器开小差了");
+              break;
+          }
+        },
+        fail: function () { //失败
+          console.log("网络异常:" + url);
+          that.Modal.tips("网络异常")
+        },
+        complete: function () {
+          lock = false; //解锁
+        }
+      })
+    })
+  },
+
+  /**
+   * 弹出层
+   */
+  Modal: {
+    tips: function (content) {
+      wx.hideLoading();
+      wx.showToast({
+        icon: 'none',
+        title: content,
+        duration: 2500,
+      })
+    },
+  },
+
+  /**
+   * 静态数据
+   */
+  globalData: {
+    openId: null,
+    deviceList: null,
+  },
+
+  /**
+   * 获取设备集合
+   */
+  getDeviceList: function () {
+    return this.globalData.deviceList == null ? [] : this.globalData.deviceList;
+  },
+
+  /**
+   * 获取当前设备的信息
+   */
+  getCurrentDevice: function () {
+    return (this.globalData.deviceList == null || this.globalData.deviceList == []) ? null : this.globalData.deviceList[0];
+  },
+})

+ 44 - 0
app.json

@@ -0,0 +1,44 @@
+{
+  "pages": [
+    "pages/welcome/welcome",
+    "pages/device/manager/manager",
+    "pages/set/set",
+    "pages/set/broadcast/broadcast",
+    "pages/set/contacts/contacts",
+    "pages/set/volume/volume",
+    "pages/set/uploadData/uploadData",
+    "pages/index/index",
+    "pages/track/track",
+    "pages/my/my"
+  ],
+  "window": {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#5D88FF",
+    "navigationBarTitleText": "华航置云",
+    "navigationBarTextStyle": "white"
+  },
+
+  "tabBar": {
+    "selectedColor": "#5CA5F9",
+    "list": [{
+        "pagePath": "pages/index/index",
+        "text": "首页",
+        "iconPath": "imgs/navIcon/Index.png",
+        "selectedIconPath": "imgs/navIcon/IndexS.png"
+      },
+      {
+        "pagePath": "pages/my/my",
+        "text": "我的",
+        "iconPath": "imgs/navIcon/My.png",
+        "selectedIconPath": "imgs/navIcon/MyS.png"
+      }
+    ]
+  },
+  "style": "v2",
+  "sitemapLocation": "sitemap.json",
+  "permission": {
+    "scope.userLocation": {
+      "desc": "小程序将获取您的位置"
+    }
+  }
+}

+ 218 - 0
app.wxss

@@ -0,0 +1,218 @@
+page {
+  width: 100%;
+  height: 100%;
+  color: rgb(15, 15, 15);
+}
+
+.wx-switch-input {
+  transform: scale(.7);
+}
+
+slider {
+  transform: scale(.9);
+}
+
+
+/* 按钮样式 */
+button::after {
+  border: none !important;
+}
+
+.button-normal {
+  font-weight: normal;
+  padding: 0;
+  border-radius: 80rpx;
+  text-align: center;
+  margin: 60rpx auto 0;
+  width: 70%;
+  line-height: 80rpx;
+  height: 80rpx;
+  font-size: 34rpx;
+  color: white;
+  background: #5D88FF;
+}
+
+.button-small {
+  font-weight: normal;
+  padding: 0;
+  border-radius: 80rpx;
+  text-align: center;
+  margin: 50rpx auto 0;
+  width: 60%;
+  line-height: 60rpx;
+  height: 60rpx;
+  font-size: 30rpx;
+  color: white;
+  background: #5D88FF;
+}
+
+.button-text {
+  display: inline;
+  line-height: 40rpx;
+  font-weight: normal;
+  padding: 0 !important;
+  margin: 0 !important;
+  border-radius: 0;
+  font-size: 34rpx;
+  color: #5D88FF;
+  background: none;
+}
+
+/* 表单空白块 */
+.white-block {
+  position: relative;
+  background: white;
+  width: 100%;
+  box-sizing: border-box;
+  padding: 30rpx 30rpx 50rpx;
+  margin-top: 30rpx;
+}
+
+/* 表单行 */
+.form-item {
+  overflow: hidden;
+  margin-bottom: 20rpx;
+  position: relative;
+  padding-left: 180rpx;
+  width: 100%;
+  height: 70rpx;
+  line-height: 70rpx;
+  box-sizing: border-box;
+}
+
+.form-item .label {
+  position: absolute;
+  top: 0;
+  left: 0;
+  color: #333;
+  text-align: right;
+  width: 160rpx;
+  font-size: 30rpx;
+}
+
+.form-item .input-normal {
+  width: 100%;
+  height: 100%;
+  border-bottom: 2rpx dashed #eee;
+  box-sizing: border-box;
+  font-size: 28rpx;
+}
+
+.block-title {
+  width: 100%;
+  line-height: 40rpx;
+  font-size: 26rpx;
+  color: #333;
+}
+
+/*遮罩层*/
+.cy-mask {
+  top: 0;
+  left: 0;
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  z-index: 99;
+  background: rgb(0, 0, 0, .6);
+}
+
+/*选择器样式*/
+.cy-select {
+  z-index: 999;
+  color: #333;
+  width: 100%;
+  padding-top: 10rpx;
+  background: white;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  box-sizing: border-box;
+}
+
+.cy-select::before {
+  line-height: 100rpx;
+  content: "你可以进行以下操作";
+  font-size: 30rpx;
+  color: #666;
+  width: 100%;
+  display: block;
+  text-align: center;
+}
+
+.cy-select-cancel {
+  border-top: 20rpx solid #EEE !important;
+  text-align: center;
+  line-height: 100rpx;
+  display: block;
+  content: "取消";
+  width: 100%;
+  color: #666;
+}
+
+.cy-select view {
+  box-sizing: border-box;
+  border-top: 1rpx solid #F1F1F1;
+  width: 100%;
+  line-height: 100rpx;
+  text-align: center;
+}
+
+/*对话框*/
+.cy-dialog {
+  border-radius: 10rpx;
+  top: 30%;
+  left: 75rpx;
+  position: fixed;
+  width: 600rpx;
+  box-sizing: border-box;
+  padding: 10rpx 20rpx;
+  z-index: 9999;
+  background: white;
+}
+
+.cy-dialog-title {
+  text-align: center;
+  width: 100%;
+  height: 80rpx;
+  line-height: 80rpx;
+  color: #666;
+}
+
+.cy-dialog-btn-area {
+  width: 100%;
+  height: 80rpx;
+}
+
+.cy-dialog-btn-cancel {
+  margin-right: 30rpx !important;
+  font-weight: normal;
+  padding: 0;
+  float: right;
+  line-height: 64rpx;
+  background: white;
+  color: #666;
+  font-size: 30rpx !important;
+  width: 120rpx !important;
+  height: 64rpx !important;
+  box-sizing: border-box;
+  border: 2rpx solid #DDD;
+}
+
+.cy-dialog-btn-confirm {
+  color: white !important;
+  margin-right: 10rpx;
+  font-weight: normal;
+  padding: 0;
+  float: right;
+  line-height: 64rpx;
+  background: #5D88FF;
+  color: #666;
+  font-size: 30rpx !important;
+  width: 120rpx !important;
+  height: 64rpx !important;
+  box-sizing: border-box;
+}
+
+.red {
+  color: #e54d42;
+}

BIN
imgs/My/arrows.png


BIN
imgs/My/banner.png


BIN
imgs/My/device.png


BIN
imgs/My/info.png


BIN
imgs/My/set.png


BIN
imgs/My/track.png


BIN
imgs/center.png


BIN
imgs/device/default.png


BIN
imgs/device/more.png


BIN
imgs/device/phone.png


BIN
imgs/device/scan.png


BIN
imgs/marker.png


BIN
imgs/navIcon/Index.png


BIN
imgs/navIcon/IndexS.png


BIN
imgs/navIcon/Location.png


BIN
imgs/navIcon/LocationS.png


BIN
imgs/navIcon/My.png


BIN
imgs/navIcon/MyS.png


BIN
imgs/refresh.png


BIN
imgs/route.png


BIN
imgs/set/arrows.png


BIN
imgs/set/auto_answer.png


BIN
imgs/set/broadcast.png


BIN
imgs/set/contacts.png


BIN
imgs/set/continue.png


BIN
imgs/set/idioms.png


BIN
imgs/set/upload.png


BIN
imgs/set/volume.png


+ 55 - 0
pages/device/addition/addition.js

@@ -0,0 +1,55 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    deviceNum: "",
+  },
+  /**
+   * 扫码
+   */
+  scanCode: function () {
+    const that = this;
+    wx.scanCode({
+      success(res) {
+        that.setData({
+          deviceNum: res.result
+        })
+      },
+      fail: function () {
+        console.log("调用摄像头失败")
+      }
+    })
+  },
+  /**
+   * 提交表单
+   */
+  submit: function (form) {
+    const params = {
+      name: form.detail.value.deviceName,
+      deviceNum: form.detail.value.deviceNum,
+    }
+    if (params.deviceNum == null || params.deviceNum === "") {
+      APP.Modal.tips("请输入设备码!")
+      return;
+    }
+    if (params.name == null || params.name === "") {
+      APP.Modal.tips("请输入设备名称!")
+      return;
+    }
+    //禁用提交按钮
+    this.setData({
+      deviceNum: "",
+      deviceName: "",
+    })
+    APP.Post(APP.Url.bind, params).then(res => {
+      //更新设备集合
+      APP.Get(APP.Url.getListByUserId, params, false).then(res => {
+        APP.globalData.deviceList = res.data;
+        APP.Modal.tips("添加成功!");
+      })
+    })
+  },
+})

+ 3 - 0
pages/device/addition/addition.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "添加设备"
+}

+ 13 - 0
pages/device/addition/addition.wxml

@@ -0,0 +1,13 @@
+<image class="icon" src="/imgs/device/scan.png" bindtap="scanCode"></image>
+
+<form bindsubmit="submit">
+	<view class="item">
+		<image src="/imgs/device/phone.png"></image>
+		<input type="text" name="deviceNum" placeholder="点击上图扫描或输入设备码" value="{{deviceNum}}"></input>
+	</view>
+	<view class="item">
+		<image src="/imgs/device/phone.png"></image>
+		<input type="text" name="deviceName" value="{{deviceName}}" placeholder="请输入设备名称"></input>
+	</view>
+	<button class="button-normal" form-type="submit">添加设备</button>
+</form>

+ 46 - 0
pages/device/addition/addition.wxss

@@ -0,0 +1,46 @@
+page {
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+}
+
+.icon {
+  display: block;
+  margin: 150rpx auto 80rpx;
+  width: 420rpx;
+  height: 400rpx;
+}
+
+.item {
+  overflow: hidden;
+  box-sizing: border-box;
+  width: 600rpx;
+  height: 90rpx;
+  margin: 0 auto;
+}
+
+.item image {
+  margin-top: 10rpx;
+  float: left;
+  width: 70rpx;
+  height: 70rpx;
+}
+
+.item input {
+  box-sizing: border-box;
+  border-bottom: 2rpx solid #eee;
+  margin-left: 30rpx;
+  float: left;
+  width: 500rpx;
+  height: 90rpx;
+  line-height: 90rpx;
+  font-size: 36rpx;
+  color: #666;
+}
+
+.button-normal {
+  font-size: 38rpx;
+  width: 400rpx !important;
+  height: 90rpx;
+  line-height: 90rpx;
+}

+ 123 - 0
pages/device/manager/manager.js

@@ -0,0 +1,123 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    showMore: false,//显示更多
+    showModify: false, //显示修改框
+    deviceList: [],
+    currentDevice: null,//当前选中的设备
+  },
+
+  onShow: function () {
+    this.getDeviceList();
+  },
+
+  /**
+   * 请求设备集合
+   */
+  getDeviceList: function () {
+    APP.Get(APP.Url.getListByUserId, {}, false).then(res => {
+      this.setData({
+        deviceList: res.data,
+      })
+      APP.globalData.deviceList = res.data;
+    })
+  },
+  /**
+   * 切换当前设备
+   */
+  changeDefaultDevice: function (event) {
+    const params = {
+      deviceNum: event.currentTarget.dataset.num
+    }
+    APP.Post(APP.Url.changeDefaultDevice, params).then(res => {
+      APP.Modal.tips("设置成功");
+      this.getDeviceList();
+    })
+  },
+
+  /**
+   * 解除设备
+   */
+  unbind: function () {
+    const that = this;
+    const params = {
+      deviceNum: this.data.currentDevice.deviceNum,
+    }
+    wx.showModal({
+      title: '提示',
+      content: '确定解绑这台设备吗?',
+      success(res) {
+        if (res.confirm) {
+          APP.Post(APP.Url.unbind, params).then(res => {
+            that.hideAll();
+            APP.Modal.tips("解绑成功");
+            that.getDeviceList();
+          })
+        }
+      }
+    })
+  },
+  /**
+   * 显示重命名框
+   */
+  showModify: function () {
+    this.setData({
+      showMore: false,
+      showModify: true,
+    })
+  },
+
+  /**
+   * 修改设备名
+   */
+  modifyName: function (form) {
+    const that = this;
+    const params = {
+      num: this.data.currentDevice.deviceNum,
+      name: form.detail.value.deviceName
+    }
+    APP.Post(APP.Url.modifyDeviceName, params).then(res => {
+      APP.Modal.tips("修改成功");
+      that.hideAll();
+      that.getDeviceList();
+    })
+  },
+
+  /**
+   * 跳转至添加设备
+   */
+  toAddDevice: function () {
+    APP.Route.routeTo(APP.Route.path.addition);
+  },
+
+  /**
+   * 显示更多
+   */
+  showMore: function (event) {
+    let deviceNum = event.currentTarget.dataset.num;
+    for (let i = 0; i < this.data.deviceList.length; i++) {
+      if (this.data.deviceList[i].deviceNum == deviceNum) {
+        this.setData({
+          currentDevice: this.data.deviceList[i],
+          showMore: true,
+          showModify: false,
+        })
+        break;
+      }
+    }
+  },
+
+  /**
+   * 隐藏所有模态框
+   */
+  hideAll: function () {
+    this.setData({
+      showMore: false,
+      showModify: false,
+    })
+  },
+})

+ 3 - 0
pages/device/manager/manager.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "设备管理"
+}

+ 37 - 0
pages/device/manager/manager.wxml

@@ -0,0 +1,37 @@
+<view class="white-block">
+	<view class="button">
+		<view bindtap="toAddDevice">添加</view>
+	</view>
+
+	<view class="item-box" wx:for="{{deviceList}}" wx:key="deviceNum">
+		<image src="/imgs/device/default.png" class="default" wx:if="{{item.isDefault==1}}" />
+		<image src="/imgs/device/phone.png" class="phone" data-num="{{item.deviceNum}}" bindtap="changeDefaultDevice" />
+		<view class="title">
+			<text>{{item.name}}</text>
+			<text>{{item.deviceNum}}</text>
+		</view>
+		<image src="/imgs/device/more.png" class="more" data-num="{{item.deviceNum}}" bindtap="showMore" />
+	</view>
+	<view class="noData" wx:if="{{deviceList.length==0}}">暂无设备</view>
+</view>
+
+
+<view class="cy-mask" wx:if="{{showMore||showModify}}" bindtap="hideAll"></view>
+
+<!-- 选项框 -->
+<view class="cy-select" wx:if="{{showMore}}">
+	<view bindtap="showModify">重命名</view>
+	<view class='red' bindtap="unbind">删除</view>
+	<view class="cy-select-cancel" bindtap="hideAll">取消</view>
+</view>
+
+<view class="cy-dialog" wx:if="{{showModify}}">
+	<view class="cy-dialog-title">修改设备名</view>
+	<form bindsubmit="modifyName">
+		<input name="deviceName" placeholder="请输入设备名" value="{{currentDevice.name}}" maxlength="10" class="input"></input>
+		<view class="cy-dialog-btn-area">
+			<button class="cy-dialog-btn-confirm" form-type="submit">确定</button>
+			<button class="cy-dialog-btn-cancel">取消</button>
+		</view>
+	</form>
+</view>

+ 83 - 0
pages/device/manager/manager.wxss

@@ -0,0 +1,83 @@
+page {
+  background: #F3F5F9;
+}
+.button{
+  width: 100%;
+  height: 80rpx;
+}
+
+.button view {
+  box-shadow: 6rpx 6rpx 8rpx rgba(48, 156, 63, 0.2);
+  float: right;
+  border-radius: 10rpx;
+  color: white;
+  text-align: center;
+  line-height: 64rpx;
+  width: 120rpx;
+  height: 64rpx;
+  background: #39b54a;
+}
+
+.item-box {
+  margin-top: 10rpx;
+  position: relative;
+  overflow: hidden;
+  padding: 10rpx 0 10rpx 130rpx;
+  width: 100%;
+  height: 120rpx;
+  border-bottom: 2rpx solid #F5F5F5;
+  box-sizing: border-box;
+}
+
+.item-box .phone {
+  position: absolute;
+  top: 20rpx;
+  left: 30rpx;
+  width: 80rpx;
+  height: 80rpx;
+}
+
+.item-box .default {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 64rpx;
+  height: 64rpx;
+}
+
+.item-box .more {
+  position: absolute;
+  top: 38rpx;
+  right: 20rpx;
+  width: 45rpx;
+  height: 45rpx;
+}
+
+.item-box .title text {
+  line-height: 40rpx;
+  display: block;
+  font-size: 30rpx;
+}
+
+.item-box .title text:last-child {
+  color: #666;
+  margin-top: 10rpx;
+  font-size: 24rpx;
+}
+
+.noData {
+  width: 100%;
+  height: 120rpx;
+  text-align: center;
+  line-height: 120rpx;
+  color: #666;
+}
+
+.input {
+  width: 450rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx solid #F1F1F1;
+  height: 70rpx;
+  font-size: 32rpx;
+  margin: 40rpx auto 60rpx;
+}

+ 194 - 0
pages/index/index.js

@@ -0,0 +1,194 @@
+const APP = getApp();
+let mapContext; //地图对象
+let clockRefresh = null;
+let continueRefresh = null;
+Page({
+  data: {
+    device: null, //设备信息
+    location: null, //位置信息
+    mapCenter: { //地图聚焦中心 默认北京
+      latitude: 39.9,
+      longitude: 116.6,
+    },
+    markers: [], //地图标记 
+  },
+
+  // 监听页面加载
+  onLoad: function () {
+    // 获取地图对象
+    mapContext = wx.createMapContext('map');
+    this.setData({
+      device: APP.getCurrentDevice()
+    })
+  },
+
+  // 监听页面显示
+  onShow: function () {
+    const that = this;
+    if (APP.getDeviceList().length < 1) {
+      APP.Modal.tips("您还没有设备可以查看");
+      mapContext.moveToLocation({});
+      return;
+    }
+    //请求设备位置
+    this.getLocation(APP.getCurrentDevice().deviceId, false);
+    setTimeout(function () {
+      that.intervalRefresh(APP.getCurrentDevice().deviceId);
+    }, 5000)
+    that.intervalSetContinue(APP.getCurrentDevice().deviceId);
+  },
+
+  // 监听页面隐藏 
+  onHide: function () {
+    //清除定时
+    clearInterval(clockRefresh);
+    clearInterval(continueRefresh);
+    clockRefresh = null;
+    continueRefresh = null;
+  },
+
+  /**
+   * 定时刷新
+   */
+  intervalRefresh: function (deviceId) {
+    console.log("启动")
+    const that = this;
+    if (clockRefresh != null) return;
+    clockRefresh = setInterval(function () {
+      that.getLocationInterval(deviceId);
+    }, 15000)
+  },
+
+  /**
+   * 定时设置持续定位
+   */
+  intervalSetContinue: function (deviceId) {
+    console.log("启动持续定位")
+    const that = this;
+    if (continueRefresh != null) return;
+    that.setContinue(deviceId);
+    continueRefresh = setInterval(function () {
+      that.setContinue(deviceId);
+    }, 240000)
+  },
+
+  /**
+   * 设置持续定位
+   */
+  setContinue: function (deviceId) {
+    const params = {
+      deviceId: deviceId,
+      highFreq: 1
+    }
+    APP.Post(APP.Url.setContinue, params).then(res => {}).catch(res => {
+      console.log(res)
+    })
+  },
+
+  /**
+   * 聚焦中心
+   */
+  center: function () {
+    if (this.data.location == null) return;
+    this.moveTo(this.data.location.lonGcj, this.data.location.latGcj);
+  },
+
+  /**
+   * 获取设备位置
+   */
+  getLocation: function (deviceId) {
+    const that = this;
+    const params = {
+      deviceId: deviceId
+    }
+    APP.Get(APP.Url.getLocation, params, false).then(res => {
+      const location = res.data;
+      if (location == null) {
+        APP.Modal.tips("该设备还没有上传位置信息");
+        return;
+      }
+      //首次加载聚焦中心为当前位置
+      that.moveTo(location.lonGcj, location.latGcj);
+      that.setLocation(location);
+    })
+  },
+
+  /**
+   * 获取设备位置
+   * 定时器
+   */
+  getLocationInterval: function (deviceId) {
+    console.log("请求数据")
+    const params = {
+      deviceId: deviceId
+    }
+    APP.Get(APP.Url.getLocation, params, false).then(res => {
+      this.setLocation(res.data);
+    })
+  },
+
+  /**
+   * 设置位置信息
+   */
+  setLocation: function (location) {
+    if (location == null) return;
+    //信号强度
+    location.signal = this.formatSignal(location.signalnum);
+    //定位时间
+    location.latestTime = this.formatTime(location.uploadTime)
+    this.setData({
+      location: location
+    })
+    //添加地图标记
+    this.addMarker(location.lonGcj, location.latGcj)
+  },
+
+  /**
+   * 格式化时间显示
+   */
+  formatTime: function (date) {
+    const diff = (new Date().getTime() - new Date(date).getTime()) / 1000;
+    if (diff < 60) return "刚刚";
+    if (diff < 3600) return parseInt(diff / 60) + "分钟前";
+    if (diff < 86400) return parseInt(diff / 3600) + "小时前";
+    if (diff < 31104000) return parseInt(diff / 86400) + "天前";
+    return "1年前";
+  },
+
+  /**
+   * 格式化电池信号量
+   */
+  formatSignal: function (num) {
+    if (num > 90) return "信号良好";
+    if (num > 60) return "信号正常";
+    if (num > 30) return "信号较差";
+    if (num == 0) return "无信号";
+    return "信号差"
+  },
+
+  /**
+   * 添加标记
+   */
+  addMarker: function (lng, lat) {
+    this.setData({
+      markers: [{
+        id: 1,
+        iconPath: "/imgs/marker.png",
+        latitude: parseFloat(lat),
+        longitude: parseFloat(lng),
+        width: 35,
+        height: 35
+      }]
+    })
+  },
+
+  /**
+   * 移动地图焦点到某个点
+   */
+  moveTo: function (lng, lat) {
+    mapContext.moveToLocation({
+      latitude: parseFloat(lat), //纬度 
+      longitude: parseFloat(lng), //经度
+    })
+  }
+})

+ 3 - 0
pages/index/index.json

@@ -0,0 +1,3 @@
+{
+  "navigationStyle": "custom"
+}

+ 28 - 0
pages/index/index.wxml

@@ -0,0 +1,28 @@
+<map id="map" longitude="{{mapCenter.longitude}}" latitude="{{mapCenter.latitude}}" scale="17" markers="{{markers}}"
+	show-location polyline="{{polyline}}" class="map"></map>
+
+<view class="title-bar">
+	<view>{{device.name}}</view>
+	<view>电量: {{location.batteryNum}}% | 信号强度: {{location.signal}}</view>
+</view>
+
+<view class="siteInfo" wx:if="{{location!=null}}">
+	<view class="address">{{location.site}}</view>
+	<view class="indate">{{location.latestTime}}</view>
+</view>
+
+<view class="circle-nav center" bindtap="center">
+	<image src="/imgs/center.png" />
+</view>
+
+<view class="debug">
+	<view>信号: {{location.signalNum}}</view>
+	<view>定位模式: {{location.mode}}</view>
+	<view>经度: {{location.lon}}</view>
+	<view>纬度: {{location.lat}}</view>
+	<view>经度(Gcj): {{location.lonGcj}}</view>
+	<view>纬度(Gcj): {{location.latGcj}}</view>
+	<view>速度: {{location.speed}}</view>
+	<view>卫星颗数: {{location.num}}</view>
+	<view>{{location.uploadTime}}</view>
+</view>

+ 112 - 0
pages/index/index.wxss

@@ -0,0 +1,112 @@
+page {
+  overflow: hidden;
+  width: 100%;
+  height: 100%;
+}
+
+.map {
+  z-index: 1;
+  width: 100%;
+  height: 100%;
+}
+
+.title-bar {
+  width: 100%;
+  height: 150rpx;
+  box-sizing: border-box;
+  padding-top: 50rpx;
+  position: absolute;
+  top: 0;
+  z-index: 2;
+  background: #5D88FF;
+}
+
+.title-bar view {
+  color: white;
+  font-size: 26rpx;
+  width: 100%;
+  height: 45rpx;
+  line-height: 45rpx;
+  text-align: center;
+}
+
+.siteInfo {
+  width: 100%;
+  z-index: 2;
+  box-sizing: border-box;
+  padding: 20rpx;
+  position: fixed;
+  bottom: 0;
+  background: white;
+  box-shadow: 0 -1rpx 6rpx rgba(0, 0, 0, 0.12);
+}
+
+.siteInfo .address {
+  width: 550rpx;
+  font-size: 30rpx;
+  color: rgb(100, 100, 100);
+  line-height: 40rpx;
+}
+
+.siteInfo .indate {
+  background: rgba(89, 170, 255, 0.2);
+  text-align: center;
+  font-size: 22rpx;
+  color: #2d8cf0;
+  position: absolute;
+  top: 20rpx;
+  border-radius: 20rpx;
+  right: 30rpx;
+  width: 120rpx;
+  height: 40rpx;
+  line-height: 40rpx;
+}
+
+.circle-nav {
+  width: 70rpx;
+  height: 70rpx;
+  box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.2);
+  overflow: hidden;
+  position: fixed;
+  border-radius: 100rpx;
+  background: white;
+}
+
+.circle-nav image {
+  display: block;
+  margin: 14rpx;
+  width: 44rpx;
+  height: 44rpx;
+}
+
+.refresh {
+  z-index: 999;
+  left: 20rpx;
+  bottom: 150rpx;
+}
+
+.center {
+  z-index: 999;
+  right: 20rpx;
+  bottom: 150rpx;
+}
+
+.debug {
+  border-radius: 10rpx;
+  z-index: 99;
+  min-height: 270rpx;
+  box-sizing: border-box;
+  padding: 10rpx;
+  width: 280rpx;
+  position: absolute;
+  top: 160rpx;
+  right: 20rpx;
+  background: rgba(0, 0, 0, 0.5);
+}
+
+.debug view {
+  color: white;
+  width: 100%;
+  line-height: 36rpx;
+  font-size: 24rpx;
+}

+ 30 - 0
pages/my/my.js

@@ -0,0 +1,30 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {},
+
+  /**
+   * 跳转至子页面页面
+   */
+  routeTo: function (event) {
+    const path = event.currentTarget.dataset.path;
+    APP.Route.routeTo(APP.Route.path[path])
+  },
+
+  /**
+   * 跳转到设置页面
+   */
+  toSet: function () {
+    console.log(APP.getDeviceList());
+    if (APP.getDeviceList().length <= 0) {
+      APP.Modal.tips("你还没有设备,请先去设备管理添加一台设备");
+      return;
+    }
+    wx.navigateTo({
+      url: "/pages/set/set",
+    })
+  }
+})

+ 2 - 0
pages/my/my.json

@@ -0,0 +1,2 @@
+{
+}

+ 33 - 0
pages/my/my.wxml

@@ -0,0 +1,33 @@
+<view class="banner">
+	<image src="/imgs/My/banner.png" class="bg" />
+	<view class="avatar">
+		<open-data type="userAvatarUrl"></open-data>
+	</view>
+</view>
+<view class="nickName">
+	<open-data type="userNickName"></open-data>
+</view>
+
+<view class="nav device" bindtap="routeTo" data-path="manager">
+	<view class="icon">
+		<image src="/imgs/My/device.png" />
+	</view>
+	<view class="text">设备管理</view>
+	<image src="/imgs/My/arrows.png" class="arrows" />
+</view>
+
+<view class="nav set" bindtap="toSet">
+	<view class="icon">
+		<image src="/imgs/My/set.png" />
+	</view>
+	<view class="text">设置</view>
+	<image src="/imgs/My/arrows.png" class="arrows" />
+</view>
+
+<!-- <view class="nav personInfo" bindtap="routeTo" data-path="track">
+	<view class="icon">
+		<image src="/imgs/My/track.png" />
+	</view>
+	<view class="text">轨迹</view>
+	<image src="/imgs/My/arrows.png" class="arrows" />
+</view> -->

+ 103 - 0
pages/my/my.wxss

@@ -0,0 +1,103 @@
+.banner {
+  position: relative;
+  width: 750rpx;
+  height: 373rpx;
+}
+
+.banner .bg {
+  width: 100%;
+  height: 100%;
+}
+
+.banner .avatar {
+  border: 10rpx solid white;
+  bottom: -25rpx;
+  left: 50%;
+  margin-left: -100rpx;
+  position: absolute;
+  overflow: hidden;
+  width: 160rpx;
+  height: 160rpx;
+  background: white;
+  border-radius: 180rpx;
+}
+
+.nickName {
+  width: 100%;
+  font-size: 30rpx;
+  text-align: center;
+  margin-top: 30rpx;
+}
+
+/* 页面导航 */
+.nav {
+  overflow: hidden;
+  box-sizing: border-box;
+  padding: 15rpx;
+  margin: 20rpx auto;
+  width: 650rpx;
+  height: 90rpx;
+  border-bottom: 2rpx solid #eee;
+}
+
+.nav .icon {
+  float: left;
+  border-radius: 60rpx;
+  border-right: 50rpx;
+  width: 60rpx;
+  height: 60rpx;
+}
+
+.nav .icon image {
+  display: block;
+  margin: 12rpx 14rpx;
+  width: 30rpx;
+  height: 32rpx;
+}
+
+.nav .text {
+  float: left;
+  line-height: 60rpx;
+  font-size: 30rpx;
+  margin-left: 15rpx;
+}
+
+.nav .arrows {
+  margin-top: 16rpx;
+  width: 18rpx;
+  height: 30rpx;
+  float: right;
+}
+
+/* 设备管理 */
+.device .icon {
+  background: #75caff;
+}
+
+.device .icon image {
+  margin: 12rpx 14rpx;
+  width: 35rpx;
+  height: 35rpx;
+}
+
+/* 个人信息 */
+.personInfo .icon {
+  background: #c79bfa;
+}
+
+.personInfo .icon image {
+  margin: 12rpx 14rpx;
+  width: 30rpx;
+  height: 32rpx;
+}
+
+/* 设置 */
+.set .icon {
+  background: #ff8297;
+}
+
+.set .icon image {
+  margin: 8rpx;
+  width: 42rpx;
+  height: 42rpx;
+}

+ 94 - 0
pages/set/broadcast/broadcast.js

@@ -0,0 +1,94 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    time: "点击选择时间",
+    typeIdx: 0,
+    typeList: [{
+        id: 1,
+        name: "实时播报"
+      },
+      //  {
+      //   id: 0,
+      //   name: "固定播报"
+      // }
+    ],
+    weekList: [{
+      id: 7,
+      name: "日"
+    }, {
+      id: 1,
+      name: "一"
+    }, {
+      id: 2,
+      name: "二"
+    }, {
+      id: 3,
+      name: "三"
+    }, {
+      id: 4,
+      name: "四"
+    }, {
+      id: 5,
+      name: "五"
+    }, {
+      id: 6,
+      name: "六"
+    }]
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {},
+
+  /**
+   * 监听-时间选择切换
+   */
+  bindTimeChange: function (event) {
+    this.setData({
+      time: event.detail.value,
+    })
+  },
+
+  /**
+   * 监听-播报类型切换
+   */
+  bindTypeChange: function (event) {
+    this.setData({
+      typeIdx: event.detail.value,
+    })
+  },
+
+  /**
+   * 发送播报消息
+   */
+  setNews: function (form) {
+    const data = {
+      deviceId: APP.getCurrentDevice().deviceId,
+      newsType: this.data.typeList[this.data.typeIdx].id,
+      newTime: "",
+      news: form.detail.value.news
+    }
+    if (data.newsType == 0) {
+      if (this.data.time === "点击选择时间") {
+        APP.Modal.tips("时间不为空!")
+        return;
+      }
+      data.newsTime = this.data.time + ":00";
+    }
+    if (data.news == null || data.news == "") {
+      APP.Modal.tips("播报内容不为空!")
+      return;
+    }
+    APP.Post(APP.Url.setNews, data).then(res => {
+      APP.Modal.tips("设置成功!")
+    }).catch(res => {
+      console.log(res)
+      APP.Modal.tips("设置失败!")
+    })
+  },
+})

+ 3 - 0
pages/set/broadcast/broadcast.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 34 - 0
pages/set/broadcast/broadcast.wxml

@@ -0,0 +1,34 @@
+<form bindsubmit="setNews">
+  <view class='white-block'>
+    <view class="form-item">
+      <view class="label">播报类型:</view>
+      <picker bindchange="bindTypeChange" value="{{typeIdx}}" range="{{typeList}}" range-key="name">
+        <view class="picker">{{typeList[typeIdx].name}}</view>
+      </picker>
+    </view>
+
+    <view class="form-item" style="height:140rpx" wx:if="{{typeIdx==1}}">
+      <view class="label">播报周期:</view>
+      <checkbox-group bindchange="checkboxChange">
+        <label wx:for="{{weekList}}" class="checkBox">
+          <checkbox value="{{item.id}}" />
+          <text>{{item.name}}</text>
+        </label>
+      </checkbox-group>
+    </view>
+
+    <view class="form-item" wx:if="{{typeIdx==1}}">
+      <view class="label">时间:</view>
+      <picker mode="time" value="{{time}}" start="00:00" end="23:59" bindchange="bindTimeChange">
+        <view class="picker">{{time}}</view>
+      </picker>
+    </view>
+
+    <view class="form-item content">
+      <view class="label">播报内容:</view>
+      <textarea name="news" placeholder="100字以内" maxlength="100" class="input-normal "></textarea>
+    </view>
+
+    <button class="button-normal" form-type="submit">发送</button>
+  </view>
+</form>

+ 53 - 0
pages/set/broadcast/broadcast.wxss

@@ -0,0 +1,53 @@
+page {
+  background: #F3F5F9;
+}
+
+.form-item picker {
+  font-size: 28rpx;
+  color: #666;
+  width: 500rpx;
+  height: 70rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx dashed #eee;
+}
+
+picker view {
+  width: 500rpx;
+  height: 70rpx;
+}
+
+.content {
+  height: 200rpx;
+}
+
+.content textarea {
+  box-sizing: border-box;
+  padding-top: 20rpx;
+  line-height: 30rpx;
+}
+
+.checkBox {
+  margin-left: 20rpx;
+}
+
+
+.mask {
+  width: 100%;
+  height: 100%;
+  position: fixed;
+  top: 0;
+  left: 0;
+  background: rgba(0, 0, 0, .4);
+}
+
+.dialog {
+  box-sizing: border-box;
+  padding: 30rpx 20rpx 30rpx 0;
+  border-radius: 15rpx;
+  left: 50rpx;
+  top: 300rpx;
+  position: fixed;
+  width: 650rpx;
+  background: white;
+  z-index: 99;
+}

+ 54 - 0
pages/set/contacts/contacts.js

@@ -0,0 +1,54 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    setInfo: null,//设置信息
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function () {
+    this.getSetInfo(APP.getCurrentDevice().deviceId);
+  },
+
+  /**
+   * 设置按键
+   */
+  setSos: function (form) {
+    const that = this;
+    const params = {
+      deviceId: this.data.setInfo.deviceId,
+      key0Name: form.detail.value.key0Name,
+      key0Phone: form.detail.value.key0Phone,
+      key1Name: form.detail.value.key1Name,
+      key1Phone: form.detail.value.key1Phone,
+      key2Name: form.detail.value.key2Name,
+      key2Phone: form.detail.value.key2Phone,
+    }
+    APP.Post(APP.Url.setSos, params).then(res => {
+      that.getSetInfo(params.deviceId)
+      APP.Modal.tips("设置成功!")
+    }).catch(res => {
+      APP.Modal.tips("设置失败!")
+    })
+  },
+
+  /**
+   * 获取设备设置信息
+   */
+  getSetInfo: function (deviceId) {
+    const params = {
+      deviceId: deviceId,
+    }
+    APP.Get(APP.Url.getSos, params,false).then(res => {
+      this.setData({
+        setInfo: res.data
+      })
+    })
+  },
+
+})

+ 3 - 0
pages/set/contacts/contacts.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "联系人设置"
+}

+ 44 - 0
pages/set/contacts/contacts.wxml

@@ -0,0 +1,44 @@
+<form bindsubmit="setSos">
+	<view class='white-block'>
+		<view class="block-title">
+			<text>按键 SOS 设置</text>
+		</view>
+		<view class="form-item">
+			<view class="label">姓名:</view>
+			<input type="text" value="{{setInfo.key0Name}}" name="key0Name" placeholder="姓名" class="input-normal"></input>
+		</view>
+		<view class=" form-item">
+			<view class="label">电话号码:</view>
+			<input type="text" value="{{setInfo.key0Phone}}" name="key0Phone" placeholder="电话号码" class="input-normal"></input>
+		</view>
+	</view>
+
+	<view class='white-block'>
+		<view class="block-title">
+			<text>按键 1 设置</text>
+		</view>
+		<view class="form-item">
+			<view class="label">姓名:</view>
+			<input type="text" value="{{setInfo.key1Name}}" name="key1Name" placeholder="姓名" class="input-normal"></input>
+		</view>
+		<view class=" form-item">
+			<view class="label">电话号码:</view>
+			<input type="text" value="{{setInfo.key1Phone}}" name="key1Phone" placeholder="电话号码" class="input-normal"></input>
+		</view>
+	</view>
+
+	<view class='white-block'>
+		<view class="block-title">
+			<text>按键 2 设置</text>
+		</view>
+		<view class="form-item">
+			<view class="label">姓名:</view>
+			<input type="text" value="{{setInfo.key2Name}}" name="key2Name" placeholder="姓名" class="input-normal"></input>
+		</view>
+		<view class=" form-item">
+			<view class="label">电话号码:</view>
+			<input type="text" value="{{setInfo.key2Phone}}" name="key2Phone" placeholder="电话号码" class="input-normal"></input>
+		</view>
+	</view>
+	<button class="button-normal" form-type="submit">保存</button>
+</form>

+ 3 - 0
pages/set/contacts/contacts.wxss

@@ -0,0 +1,3 @@
+page {
+  background: #F3F5F9;
+}

+ 77 - 0
pages/set/set.js

@@ -0,0 +1,77 @@
+const APP = getApp()
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    setInfo: null,//设置信息
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function () {
+    this.getOther(APP.getCurrentDevice().deviceId);
+  },
+
+  /**
+   * 获取设备自动接听设置
+   */
+  getOther: function (deviceId) {
+    const that = this;
+    const params = {
+      deviceId: deviceId,
+    }
+    APP.Get(APP.Url.getOther, params).then(res => {
+      that.setData({
+        setInfo: res.data,
+      })
+    })
+  },
+
+  /**
+   * 监听自动接听开关
+   */
+  handleAutoAnswerChange: function (event) {
+    const that = this;
+    const params = {
+      deviceId: that.data.setInfo.deviceId,
+      autoAnswer: event.detail.value === true ? 1 : 0
+    }
+    APP.Post(APP.Url.setAutoAnswer, params).then(res => {
+      that.getOther(params.deviceId)
+      APP.Modal.tips("设置成功!")
+    }).catch(res => {
+      console.log(res)
+      APP.Modal.tips("设置失败!")
+    })
+  },
+
+  /**
+   * 监听持续定位
+   */
+  handleContinueChange: function (event) {
+    const that = this;
+    const params = {
+      deviceId: that.data.setInfo.deviceId,
+      // highFreq: event.detail.value === true ? 1 : 0,
+      highFreq: 1
+    }
+    APP.Post(APP.Url.setContinue, params).then(res => {
+      that.getOther(params.deviceId)
+      APP.Modal.tips("设置成功!")
+    }).catch(res => {
+      console.log(res)
+      APP.Modal.tips("设置失败!")
+    })
+  },
+
+  /**
+   * 跳转至子页面页面
+   */
+  routeTo: function (event) {
+    const path = event.currentTarget.dataset.path;
+    APP.Route.routeTo(APP.Route.path[path])
+  },
+})

+ 3 - 0
pages/set/set.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "设置"
+}

+ 44 - 0
pages/set/set.wxml

@@ -0,0 +1,44 @@
+<view class="white-black">
+	<view class="item-bar" bindtap="routeTo" data-path="uploadData">
+		<image src="/imgs/set/upload.png" class="icon" />
+		<text>数据上传设置</text>
+		<image src="/imgs/Set/arrows.png" class="arrows" />
+	</view>
+	<view class="item-bar" bindtap="routeTo" data-path="contacts">
+		<image src="/imgs/set/contacts.png" class="icon" />
+		<text>联系人设置</text>
+		<image src="/imgs/Set/arrows.png" class="arrows" />
+	</view>
+	<view class="item-bar" bindtap="routeTo" data-path="volume">
+		<image src="/imgs/set/volume.png" class="icon" />
+		<text>声音设置</text>
+		<image src="/imgs/Set/arrows.png" class="arrows" />
+	</view>
+</view>
+
+<view class="white-black">
+	<view class="item-bar" bindtap="routeTo" data-path="idioms">
+		<image src="/imgs/set/idioms.png" class="icon" />
+		<text>常用语设置</text>
+		<image src="/imgs/Set/arrows.png" class="arrows" />
+	</view>
+	<view class="item-bar" bindtap="routeTo" data-path="broadcast">
+		<image src="/imgs/set/broadcast.png" class="icon" />
+		<text>语音播报</text>
+		<image src="/imgs/set/arrows.png" class="arrows" />
+	</view>
+</view>
+
+<view class="white-black">
+	<view class="item-bar">
+		<image src="/imgs/set/auto_answer.png" class="icon" />
+		<text>自动接听</text>
+		<switch checked="{{setInfo.autoAnswer==1}}" bindchange="handleAutoAnswerChange" color="#477EEE" class="switch" />
+	</view>
+
+	<view class="item-bar">
+		<image src="/imgs/set/continue.png" class="icon" />
+		<text>持续定位</text>
+		<switch checked="{{setInfo.highFreq==1}}" bindchange="handleContinueChange" color="#477EEE" class="switch" />
+	</view>
+</view>

+ 48 - 0
pages/set/set.wxss

@@ -0,0 +1,48 @@
+page {
+  background: #F3F5F9;
+}
+
+.white-black {
+  background: white;
+  box-sizing: border-box;
+  padding: 0 30rpx;
+  width: 100%;
+  margin-top: 40rpx;
+}
+
+
+.item-bar {
+  overflow: hidden;
+  width: 100%;
+  height: 100rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx solid #F0F0F0;
+}
+
+.item-bar .icon {
+  float: left;
+  margin-top: 28rpx;
+  width: 48rpx;
+  height: 48rpx;
+}
+
+.item-bar text {
+  float: left;
+  margin-left: 20rpx;
+  color: #333;
+  line-height: 100rpx;
+  font-size: 30rpx;
+}
+
+.item-bar .arrows {
+  margin-right: 30rpx;
+  margin-top: 36rpx;
+  float: right;
+  width: 16rpx;
+  height: 30rpx;
+}
+
+.switch {
+  margin-top: 20rpx;
+  float: right;
+}

+ 40 - 0
pages/set/uploadData/uploadData.js

@@ -0,0 +1,40 @@
+const APP = getApp();
+Page({
+
+  data: {
+    setInfo: null //设置信息
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getSetInfo(APP.getCurrentDevice().deviceId);
+  },
+  /**
+   *  获取设备设置信息
+   */
+  getSetInfo: function (deviceId) {
+    const param = {
+      deviceId: deviceId
+    }
+    APP.Get(APP.Url.getOther, param, false).then(res => {
+      this.setData({
+        setInfo: res.data
+      })
+    })
+  },
+  /**
+   * 设置定位频率
+   */
+  setGpsRate: function (form) {
+    const param = {
+      deviceId: this.data.setInfo.deviceId,
+      gpsRate: form.detail.value.gpsRate
+    }
+    APP.Post(APP.Url.setGpsRate, param).then(res => {
+      APP.Modal.tips("设置成功");
+      this.getSetInfo(param.deviceId);
+    })
+  }
+})

+ 3 - 0
pages/set/uploadData/uploadData.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 10 - 0
pages/set/uploadData/uploadData.wxml

@@ -0,0 +1,10 @@
+<view class='white-block'>
+  <form bindsubmit="setGpsRate">
+		<view class="form-item">
+			<view class="label">定位频率:</view>
+			<input type="text" value="{{setInfo.gpsRate}}" name="gpsRate" placeholder="单位(小时)" class="input-normal"></input>
+		</view>
+
+		<button class="button-normal" form-type="submit">保存</button>
+	</form>
+</view>

+ 3 - 0
pages/set/uploadData/uploadData.wxss

@@ -0,0 +1,3 @@
+page {
+  background: #F3F5F9;
+}

+ 51 - 0
pages/set/volume/volume.js

@@ -0,0 +1,51 @@
+const APP = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    setInfo: null //设置信息
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function () {
+    this.getVolume(APP.getCurrentDevice().deviceId);
+  },
+
+  /**
+   * 提交表单
+   */
+  submit: function (form) {
+    const parmas = {
+      deviceId: this.data.setInfo.deviceId,
+      ringVol: form.detail.value.ringVol === "" ? 0 : form.detail.value.ringVol,
+      msgVol: form.detail.value.msgVol === "" ? 0 : form.detail.value.msgVol,
+      phoneVol: form.detail.value.phoneVol === "" ? 0 : form.detail.value.phoneVol,
+    }
+    APP.Post(APP.Url.setVolume, parmas).then(res => {
+      this.getVolume(parmas.deviceId);
+      APP.Modal.tips("设置成功!")
+    }).catch(res => {
+      console.log(res)
+      APP.Modal.tips("设置失败!")
+    })
+  },
+
+  /**
+   * 获取设备音量设置
+   */
+  getVolume: function (deviceId) {
+    const that = this;
+    const params = {
+      deviceId: deviceId,
+    }
+    APP.Get(APP.Url.getVolume, params,false).then(res => {
+      that.setData({
+        setInfo: res.data
+      })
+    })
+  },
+})

+ 3 - 0
pages/set/volume/volume.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "声音设置"
+}

+ 26 - 0
pages/set/volume/volume.wxml

@@ -0,0 +1,26 @@
+<form catchsubmit="submit">
+	<view class="white-block">
+		<view class="form-item">
+			<view class="label">通话音量:</view>
+			<view class="slider">
+				<slider name="phoneVol" value="{{setInfo.phoneVol}}" show-value activeColor="#5D88FF" block-size="24" max="6" />
+			</view>
+		</view>
+		<view class="form-item">
+			<view class="label">系统音量:</view>
+			<view class="slider">
+				<slider name="msgVol" value="{{setInfo.msgVol}}" show-value activeColor="#5D88FF" block-size="24" max="6" />
+			</view>
+		</view>
+
+		<view class="form-item">
+			<view class="label">铃声音量:</view>
+			<view class="slider">
+				<slider name="ringVol" value="{{setInfo.ringVol}}" show-value activeColor="#5D88FF" block-size="24" max="6" />
+			</view>
+		</view>
+
+	</view>
+
+	<button class="button-normal" form-type="submit">保存</button>
+</form>

+ 36 - 0
pages/set/volume/volume.wxss

@@ -0,0 +1,36 @@
+page {
+  background: #F3F5F9;
+}
+
+.form-item .slider {
+  overflow: hidden;
+  height: 100%;
+  width: 100%;
+  box-sizing: border-box;
+}
+
+.slider slider {
+  margin: 0 !important;
+}
+
+.list {
+  display: block;
+  padding-left: 30rpx;
+  font-size: 28rpx;
+  margin-top: 10rpx;
+  line-height: 70rpx;
+  width: 100%;
+  height: 70rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx dashed #eee;
+}
+
+.list radio {
+  float: right;
+}
+
+radio .wx-radio-input {
+  width: 35rpx;
+  height: 35rpx;
+
+}

+ 92 - 0
pages/track/track.js

@@ -0,0 +1,92 @@
+const APP = getApp();
+let mapContext; //地图对象
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    mapCenter: { //地图聚焦中心 默认北京
+      latitude: 39.5395312,
+      longitude: 116.7265250,
+    },
+    markers: [
+      {
+        id: 1,
+        iconPath: "/imgs/marker.png",
+        latitude: 39.54843965881564,
+        longitude: 116.77418632902149,
+        width: 35,
+        height: 35
+      },
+      {
+        id: 2,
+        iconPath: "/imgs/marker.png",
+        latitude: 39.547527631306934,
+        longitude: 116.77166040587744,
+        width: 35,
+        height: 35
+      },
+      {
+        id: 3,
+        iconPath: "/imgs/marker.png",
+        latitude: 39.5434256,
+        longitude: 116.7548242,
+        width: 35,
+        height: 35
+      }, {
+        id: 4,
+        iconPath: "/imgs/marker.png",
+        latitude: 39.5395312,
+        longitude: 116.7265250,
+        width: 35,
+        height: 35
+      }
+      , {
+        id: 5,
+        iconPath: "/imgs/marker.png",
+        latitude: 39.5368093,
+        longitude: 116.7186292,
+        width: 35,
+        height: 35
+      }],
+    polyline: [{
+      points: [
+        {
+          latitude: 39.54843965881564,
+          longitude: 116.77418632902149
+        }, {
+          latitude: 39.547527631306934,
+          longitude: 116.77166040587744
+        }, {
+          latitude: 39.5434256,
+          longitude: 116.7548242
+        }, {
+          latitude: 39.5395312,
+          longitude: 116.7265250
+        },
+        {
+          latitude: 39.5368093,
+          longitude: 116.7186292
+        }],
+      width: 5,
+      arrowLine: true,
+      color: "#5D88FF"
+    }],
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    // 获取地图对象
+    mapContext = wx.createMapContext('map');
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+})

+ 3 - 0
pages/track/track.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
pages/track/track.wxml

@@ -0,0 +1,2 @@
+<map id="map" longitude="{{mapCenter.longitude}}" latitude="{{mapCenter.latitude}}" scale="13" markers="{{markers}}"
+  show-location polyline="{{polyline}}" class="map"></map>

+ 11 - 0
pages/track/track.wxss

@@ -0,0 +1,11 @@
+page {
+  overflow: hidden;
+  width: 100%;
+  height: 100%;
+}
+
+.map {
+  z-index: 1;
+  width: 100%;
+  height: 100%;
+}

+ 43 - 0
pages/welcome/welcome.js

@@ -0,0 +1,43 @@
+const APP = getApp();
+Page({
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.login();
+  },
+  /**
+   * 登录
+   */
+  login: function () {
+    const that = this;
+    wx.login({
+      success: res => {
+        const params = {
+          code: res.code
+        }
+        //登录
+        APP.Post(APP.Url.login, params).then(res => {
+          APP.globalData.openId = res.data;
+          //请求设备集合
+          that.getDeviceList(res.data);
+        })
+      }
+    })
+  },
+
+  /**
+   * 获取设备列表
+   */
+  getDeviceList: function (userId) {
+    const params = {
+      userId: userId,
+    }
+    APP.Get(APP.Url.getListByUserId, params).then(res => {
+      APP.globalData.deviceList = res.data;
+      wx.switchTab({
+        url: '/pages/index/index',
+      })
+    })
+  }
+})

+ 2 - 0
pages/welcome/welcome.json

@@ -0,0 +1,2 @@
+{
+}

+ 2 - 0
pages/welcome/welcome.wxml

@@ -0,0 +1,2 @@
+<view class="title">智 能 定 位 手 机</view>
+<view class="little">让 / 生 / 活 / 更 / 智 / 慧</view>

File diff suppressed because it is too large
+ 3 - 0
pages/welcome/welcome.wxss


+ 61 - 0
project.config.json

@@ -0,0 +1,61 @@
+{
+  "description": "项目配置文件",
+  "packOptions": {
+    "ignore": []
+  },
+  "setting": {
+    "urlCheck": false,
+    "es6": true,
+    "postcss": true,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "useMultiFrameRuntime": true,
+    "useApiHook": true,
+    "useApiHostProcess": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "bundle": false,
+    "useIsolateContext": true,
+    "useCompilerModule": true,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "userConfirmedBundleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.17.0",
+  "appid": "wxe90699b45e28a0b6",
+  "projectname": "4G-talk",
+  "debugOptions": {
+    "hidedInDevtools": []
+  },
+  "isGameTourist": false,
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "condition": {
+    "search": {
+      "list": []
+    },
+    "conversation": {
+      "list": []
+    },
+    "game": {
+      "currentL": -1,
+      "list": []
+    },
+    "miniprogram": {
+      "list": []
+    }
+  }
+}

+ 7 - 0
sitemap.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

Some files were not shown because too many files changed in this diff