Kaynağa Gözat

Merge branch 'develop'

master
chenJinxu 11 ay önce
ebeveyn
işleme
363adaddc1
22 değiştirilmiş dosya ile 2230 ekleme ve 97 silme
  1. +6
    -0
      README.md
  2. +27
    -0
      src/api/command-list.js
  3. +245
    -0
      src/api/command.js
  4. +111
    -0
      src/api/core.js
  5. +1
    -1
      src/api/demo.js
  6. +355
    -0
      src/api/device.js
  7. +222
    -0
      src/api/heathly.js
  8. +74
    -19
      src/api/user.js
  9. +32
    -0
      src/api/wx.js
  10. +116
    -0
      src/components/SubmenuList.vue
  11. +85
    -0
      src/config/models.js
  12. +85
    -0
      src/config/request.js
  13. +2
    -1
      src/main.js
  14. +30
    -0
      src/services/dialog-service.js
  15. +77
    -0
      src/services/toast-service.js
  16. +195
    -0
      src/services/utils-service.js
  17. +2
    -1
      src/store/getters.js
  18. +291
    -1
      src/store/index.js
  19. +2
    -0
      src/store/prefix.js
  20. +0
    -58
      src/utils/request.js
  21. +90
    -7
      src/views/myself/index.scss
  22. +182
    -9
      src/views/myself/index.vue

+ 6
- 0
README.md Dosyayı Görüntüle

@@ -38,3 +38,9 @@ npm run lint
- 增加 navbar 组件
- 增加 样式初始化 css
- 增加 day.js,echarts 和高德地图

`2023年12月16日` FETURE

- 增加 接口文件
- 增加 store 文件
- 增加 封装的 toast 和 dialog 文件

+ 27
- 0
src/api/command-list.js Dosyayı Görüntüle

@@ -0,0 +1,27 @@
import store from '@/store';
import request from '@/config/request';
import { DeviceCommandModel } from '@/config/models';
import { isNotNull } from '@/services/utils-service';

const APICommandList = {
getClocks() {
const data = { deviceId: store.getters.deviceId };
return request({ url: '/api/Command/CommandList', method: 'post', data });
},
setClocks(cmdValue) {
const data = {
deviceId: store.getters.deviceId,
userId: store.getters.userId,
serialNo: store.getters.serialNo,
cmdCode: DeviceCommandModel.clock,
cmdValue
};
return request({ url: '/api/Command/SendCommand', method: 'post', data });
},
getCmdValue(data, deviceCommandModel) {
const result = data.filter(v => v.cmdCode === deviceCommandModel);
return isNotNull(result) ? JSON.parse(result[0].cmdValue).Items : [];
}
};

export default APICommandList;

+ 245
- 0
src/api/command.js Dosyayı Görüntüle

@@ -0,0 +1,245 @@
import request from '@/config/request';

export const APICommand = {
commandList, //获取设备所有指令列表
sendCommand, //发送一个指令给设备
SetIotWhiteList, // 设置白名单
Effective, //中亿SIM自动激活接口
CheckImei, //检查imei属于哪家厂商
GetCardInfo, //获取小台风物联网卡信息
HealthCode, //健康码
ocr, //ocr识别
GetHealthCodeList, ///api/Command/GetHealthCodeList
CheckHealthCodeAuth, //检查该设备 健康码是否已经授权
SetPayPassword, //修改支付密码
NucleicCode, // 新增核酸码
GetNucleicCode, //获取核酸码记录
GetIotCardWiteList, //获取第三方亲情号码同步状态
CheckImeiHealth, //检查是否可以显示核酸码菜单
setFlyModePwd, //设置飞行模式密码
setPicUrl, //设置设备卡片头像参数
getPicUrl, //获取设备头像参数
setSchoolName, //设置设备卡片学校名称参数
getSchoolName, //获取设备卡片学校名称参数
setClassAndName, //设置设备卡片班级名称参数
getClassAndName, //获取设备卡片班级名称参数
setIotCtlMode, //设置设备iot连接控制属性
getIotCtlMode, //获取设备iot连接控制属性
SetBloodPressCalibrationConfig, //设置设备血压标定参数
GetBloodPressCalibrationConfig //获取设备血压标定参数
};

// 获取设备所有指令列表
function commandList(params) {
return request({
url: '/api/Command/CommandList',
method: 'post',
data: params
});
}

//发送一个指令给设备
function sendCommand(params) {
return request({
url: '/api/Command/SendCommand',
method: 'post',
data: params
});
}
//设置白名单
function SetIotWhiteList(params) {
return request({
url: '/api/Command/SetIotWhiteList',
method: 'post',
data: params
});
}

// 中亿SIM自动激活接口
function Effective(params) {
return request({
url: '/api/Command/Effective',
method: 'post',
data: params
});
}
//检查imei属于哪家厂商
function CheckImei(params) {
return request({
url: '/api/Command/CheckImei',
method: 'post',
data: params
});
}
//获取小台风物联网卡信息
function GetCardInfo(params) {
return request({
url: '/api/Command/GetCardInfo',
method: 'post',
data: params
});
}
function HealthCode(params) {
return request({
url: '/api/Command/HealthCode',
headers: { AuthKey: 'key1' },
method: 'post',
data: params
});
}
function ocr(params) {
return request({
url: '/api/Command/WxIdCardOcr',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function GetHealthCodeList(imei) {
return request({
url: '/api/Command/GetHealthCodeList',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function CheckHealthCodeAuth(params) {
return request({
url: '/api/Command/CheckHealthCodeAuth',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function SetPayPassword(params) {
return request({
url: '/api/Command/SetPayPassword',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}

function NucleicCode(params) {
return request({
url: '/api/Command/NucleicCode',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function GetNucleicCode(params) {
return request({
url: '/api/Command/GetNucleicCode',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function GetIotCardWiteList(imei) {
return request({
url: '/api/Command/GetIotCardWiteList',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function CheckImeiHealth(params) {
return request({
url: '/api/Command/CheckImeiHealth',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function setFlyModePwd(params) {
return request({
url: '/api/Command/setFlyModePwd',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function setPicUrl(params) {
return request({
url: '/api/Command/SetPicUrl',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getPicUrl(imei) {
return request({
url: '/api/Command/GetPicUrl',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}

function setSchoolName(params) {
return request({
url: '/api/Command/SetSchoolName',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getSchoolName(imei) {
return request({
url: '/api/Command/GetSchoolName',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setClassAndName(params) {
return request({
url: '/api/Command/SetClassAndName',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getClassAndName(imei) {
return request({
url: '/api/Command/GetClassAndName',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setIotCtlMode(params) {
return request({
url: '/api/Command/SetIotCtlMode',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function SetBloodPressCalibrationConfig(params) {
return request({
url: '/api/Command/SetBloodPressCalibrationConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}

function getIotCtlMode(imei) {
return request({
url: '/api/Command/GetIotCtlMode',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function GetBloodPressCalibrationConfig(imei) {
return request({
url: '/api/Command/GetBloodPressCalibrationConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
export default APICommand;

+ 111
- 0
src/api/core.js Dosyayı Görüntüle

@@ -0,0 +1,111 @@
// b端的接口, 每次调用前先获取token
import axios from 'axios';
const baseUrl = process.env.VUE_APP_BASE_API.replace('webapi', 'gateway');
const service = axios.create({
baseURL: baseUrl
});
service.interceptors.request.use(request => {
if (localStorage.getItem('gatewayToken')) {
request.headers.AccessToken = localStorage.getItem('gatewayToken');
}
return request;
});
export const APIAlarm = {
areaAlarmDetail, //获取告警详情
getAuth, //获取b端接口token
changeAlarmStatus, //修改非法区域告警推送状态
QueryLiveBasePackage, //获取基本套餐
payLiveBaseDevice, //微信统一下单
GpsDeviceFence, //围栏 redis
drownReportFilterAdd, //添加过滤危险水域区域
getDrownReportFilterQuery, //获取水域告警白名单
drownReportFilterDelete, //删除过滤危险水域区域
devicePayPackage,
CheckWzLocation //定位校准
};
/* const headerAuth = this.$store.getters.gatewayToken; */
// 获取告警详情
function areaAlarmDetail(data) {
return service({
url: `${baseUrl}/core/api/v1/Fence/AreaAlarmDetail`,
method: 'get',
params: data
});
}
// 获取告警授权token
function getAuth(params) {
return service({
url: `${baseUrl}/core/api/v1/Ability/study_ai/terminal/auth`,
method: 'post',
data: params
});
}
function changeAlarmStatus(params) {
return service({
url: `${baseUrl}/core/api/v1/Fence/AddAreaUserFilter`,
method: 'post',
data: params
});
}
function GpsDeviceFence(params) {
return service({
url: `${baseUrl}/core/api/v1/Redis/GpsDeviceFence`,
method: 'post',
data: params
});
}
// 获取基本套餐信息
function QueryLiveBasePackage(params) {
return service({
url: `${baseUrl}/core/api/v1/Device/QueryLiveBasePackage`,
method: 'post',
data: params
});
}
// 统一下单
// 获取基本套餐信息
function payLiveBaseDevice(params) {
return service({
url: `${baseUrl}/core/api/v1/Device/PayLiveBaseDevice`,
method: 'post',
data: params
});
}
function drownReportFilterAdd(data) {
return service({
url: `${baseUrl}/core/api/v1/Device/DrownReportFilterAdd`,
method: 'post',
data
});
}
function getDrownReportFilterQuery(data) {
return service({
url: `${baseUrl}/core/api/v1/Device/DrownReportFilterQuery`,
method: 'get',
params: data
});
}
function devicePayPackage(imei) {
return service({
url: `${baseUrl}/core/api/v1/open/card/GetDevicePayPackage`,
method: 'get',
params: { imei }
});
}
function drownReportFilterDelete(data) {
return service({
url: `${baseUrl}/core/api/v1/Device/DrownReportFilterDelete`,
method: 'get',
params: data
});
}

function CheckWzLocation(params) {
return service({
url: `${baseUrl}/core/api/v1/GeoCode/CheckWzLocation`,
method: 'post',
data: params
});
}

export default APIAlarm;

+ 1
- 1
src/api/demo.js Dosyayı Görüntüle

@@ -1,5 +1,5 @@
// axios
import request from '@/utils/request';
import request from '@/config/request';

export const APIUser = {
getUser,


+ 355
- 0
src/api/device.js Dosyayı Görüntüle

@@ -0,0 +1,355 @@
import request from '@/config/request';

export const APIDevice = {
addPolygonFence,
editPolygonFence,
delPolygonFence,
getPolygonFence,
deleteGeofence, //删除围栏
getAllFence, //获取全部围栏列表
geofenceList, //围栏列表
editGeofence, //编辑围栏
addGeofence, //增加围栏
getPersonInfo, //获取宝贝信息
deviceTimeRelatedParam, //查看设备激活时间,有效时间
updatePersonInfo, //编辑宝贝信息
bindingScan, //设备绑定-扫码
bindingInput, //设备绑定-输入
deviceList, //获取设备列表
locateInstance, //立即定位设备
sendCommand, //发送一个指令给设备
unbindDevice, //解绑设备
getCallLogList, //通话清单
setSMSLog, //短信代收
getDeviceStep, //健康计步
temperatureInfoList, //健康温度
historyDetailList, //查询设备历史轨迹
historyDetailListByIMEI, //根据时间段查看设备历史轨迹
history, //历史轨迹
bindDevice, //绑定设备
bindDeviceSsjl, //设备绑定, 只接受
bindDeviceResult, //设备绑定结果
addVoiceMessage, //上传录音文件
queryVoicePage, //获取分页
decodeSerialNo, //通过密文解析获取imei
LckjCreateOrderPackage, //零川物联网卡加油包订购
LckjGetOrderPackageShow, //查询零川物联网卡加油包订购记录
checkWxPayResult, //查询微信支付状态
updateDrownReportAiStatus, //修改溺水告警状态(ai-呼叫)
psychQuestionAutoCommit //自动提交心里问卷调查答案
};
const baseUrl =
process.env.NODE_ENV === 'production'
? 'https://ai.ssjlai.com/telpopay/api/wx/order/callback'
: 'https://id.ssjlai.com/telpopay/api/wx/order/callback';
export default APIDevice;
// 增加多边形围栏
function addPolygonFence({ fencePoints, fenceName, serialNo, appType, address }) {
return request({
url: '/api/Geofence/AddPolygonFence',
method: 'post',
headers: { AuthKey: 'key1' },
data: { fencePoints, fenceName, serialNo, appType, address }
});
}

// 修改多边形围栏
function editPolygonFence({ fenceId, fencePoints, fenceName, serialNo, address }) {
return request({
url: '/api/Geofence/EditPolygonFence',
method: 'post',
headers: { AuthKey: 'key1' },
data: { fenceId, fencePoints, fenceName, serialNo, address }
});
}

// 删除多边形围栏
function delPolygonFence({ geofenceId }) {
return request({
url: '/api/Geofence/DeletePolygonFence',
method: 'post',
headers: { AuthKey: 'key1' },
data: { geofenceId }
});
}
// 删除围栏
function deleteGeofence(params) {
return request({
url: '/api/Geofence/Delete',
method: 'post',
data: params
});
}

// 获取全部围栏:包括圆形和多边形
function getPolygonFence(serialNo) {
return request({
url: '/api/Geofence/GetPolygonFence',
method: 'get',
headers: { AuthKey: 'key1' },
params: { serialNo }
});
}

// 获取全部围栏:包括圆形和多边形
function getAllFence(deviceId) {
return request({
url: '/api/Geofence/GeofenceList',
method: 'post',
data: { deviceId }
});
}

// 围栏列表
function geofenceList(params) {
return request({
url: '/api/Geofence/GeofenceList',
method: 'post',
data: params
});
}
// 编辑围栏
function editGeofence(params) {
return request({
url: '/api/Geofence/Edit',
method: 'post',
data: params
});
}

// 增加围栏
function addGeofence(params) {
return request({
url: '/api/Geofence/Add',
method: 'post',
data: params
});
}
// 获取宝贝信息
function getPersonInfo(params) {
return request({
url: '/api/Device/GetPersonInfo',
method: 'post',
data: params
});
}
//查看设备激活时间,有效时间
function deviceTimeRelatedParam(sn) {
return request({
url: '/api/DeviceFeatures/DeviceTimeRelatedParam',
method: 'get',
headers: { AuthKey: 'key1' },
params: { sn }
});
}
// 编辑宝贝信息
function updatePersonInfo(params) {
return request({
url: '/api/Device/UpdatePersonInfo',
method: 'post',
data: params
});
}
// 设备绑定-扫码
function bindingScan({ url }) {
return request({
url: '/api/Device/BindingScan',
method: 'post',
data: { url }
});
}
// 通过密文解析获取imei
function decodeSerialNo({ code }) {
return request({
url: '/api/Device/DecodeImei',
method: 'post',
headers: { authKey: 'key1' },
data: { code }
});
}
// 设备绑定-输入
function bindingInput({ serialNo }) {
return request({
url: '/api/Device/BindingInput',
method: 'post',
data: { serialNo }
});
}
// 获取设备列表
function deviceList(params) {
return request({
url: '/api/Location/DeviceList',
method: 'post',
data: params
});
}
//立即定位设备
function locateInstance(params) {
return request({
url: '/api/Command/LocateInstance',
method: 'post',
data: params
});
}
//发送一个指令给设备
function sendCommand(params) {
return request({
url: '/api/Command/SendCommand',
method: 'post',
data: params
});
}
//解绑设备
function unbindDevice(params) {
return request({
url: '/api/Device/UnbindDevice',
method: 'post',
data: params
});
}
//通话清单
function getCallLogList(params) {
return request({
url: '/api/DeviceCommunication/GetCallLogList',
method: 'post',
data: params
});
}
//短信代收
function setSMSLog(params) {
return request({
url: '/api/DeviceCommunication/SetSMSLog',
method: 'post',
data: params
});
}
//健康计步
function getDeviceStep(params) {
return request({
url: '/api/DeviceFeatures/GetDeviceStep',
method: 'post',
data: params
});
}
//健康温度
function temperatureInfoList({ sn, c }) {
return request({
url: '/api/DeviceFeatures/TemperatureInfoList',
method: 'get',
headers: { authKey: 'key1' },
params: { sn, c }
});
}

//查询设备历史轨迹
function historyDetailList({ imei, queryDate }) {
return request({
url: '/api/Location/HistoryDetailList',
method: 'get',
params: { imei, queryDate }
});
}
//根据时间段查询设备历史轨迹
function historyDetailListByIMEI(params) {
return request({
url: '/api/Location/HistoryListByIMEI',
method: 'post',
data: params
});
}
//历史轨迹
function history(params) {
return request({
url: '/api/Location/History',
method: 'post',
data: params
});
}

// 设备绑定
function bindDevice({ headers, body }) {
return request({
url: '/api/Device/BindDevice',
method: 'post',
headers: headers,
data: body
});
}

// 设备绑定,只接收
function bindDeviceSsjl({ headers, body }) {
return request({
url: '/api/Device/BindDeviceSsjl',
method: 'post',
headers: headers,
data: body
});
}

// 设备绑定结果
function bindDeviceResult({ headers, body }) {
return request({
url: '/api/Device/BindDeviceResult',
method: 'post',
headers: headers,
data: body
});
}

// 上传录音文件
function addVoiceMessage(params) {
return request({
url: '/voicemessage/voiceMessage/addVoiceMessage',
method: 'post',
data: params
});
}
// 获取录音文件和文字留言分页
function queryVoicePage({ gpsUserId, pageNum, pageSize }) {
return request({
url: '/voicemessage/voiceMessage/queryVoicePage',
method: 'get',
params: { gpsUserId, pageNum, pageSize }
});
}

// 随手精灵(零川物联卡加油包套餐订购)
function LckjCreateOrderPackage(params) {
return request({
url: 'api/IOTCard/LckjCreateOrderPackage',
method: 'post',
data: params
});
}

// 随手精灵(查询零川物联卡加油包已订购套餐)
function LckjGetOrderPackageShow({ iccid, imei }) {
return request({
url: '/api/IOTCard/LckjGetOrderPackageShow',
method: 'get',
params: { iccid, imei }
});
}

function checkWxPayResult(params) {
return request({
url: `${baseUrl}`,
method: 'post',
data: params
});
}

function updateDrownReportAiStatus(data) {
return request({
url: '/api/Device/UpdateDrownReportAiStatus',
method: 'get',
params: data
});
}
function psychQuestionAutoCommit(data) {
return request({
url: '/api/Device/PsychQuestionAutoCommit',
method: 'get',
params: data
});
}

+ 222
- 0
src/api/heathly.js Dosyayı Görüntüle

@@ -0,0 +1,222 @@
import request from '@/config/request';
export const APIHealthy = {
getSpoList, //获取血氧列表
getHeartRateList, //获取心率列表
getTemperatureList, //获取体温列表
setLocationConfig, //设置设备定位控制参数
getLocationConfig, //获取设备定位控制参数
getHealthConfig, //获取设备健康控制参数(心率、血氧、测温)
setHealthConfig, //设置设备健康控制参数(心率、血氧、测温)
setUploadConfig, //置设备上报周期参数
getUploadConfig, //取设备上报周期参数
setDrownConfig, //设置设备防溺水参数
getDrownConfig, //获取设备防溺水参数
setNowearConfig, //设置设备未佩戴检测参数
getNowearConfig, //设置设备未佩戴检测参数
setWatchConfig, //设置设备未佩戴检测参数
getWatchConfig, //设置设备未佩戴检测参数
setBloodPressConfig, //设置设备血压检测参数
getBloodPressConfig, //获取设备血压检测参数
getBloodPressList, //获取设备血压数据
setPsychAbilityConfig, //心理监测能力开通(下发参数)
getPsychAbilityConfig, //获取心理监测能力开通参数
setLongSitReminder, //设置设备久坐提醒参数
getLongSitReminder, //获取设备久坐提醒参数
setRaiseToLightScreen, //设置设备抬腕亮屏参数
getRaiseToLightScreen //获取设备抬腕亮屏参数
};
export default APIHealthy;

function getSpoList(params) {
return request({
url: '/api/Healthy/SpoList',
method: 'post',
data: params
});
}

function getHeartRateList(params) {
return request({
url: '/api/Healthy/HeartRateList',
method: 'post',
data: params
});
}
function getTemperatureList(params) {
return request({
url: '/api/Healthy/TemperatureList',
method: 'post',
data: params
});
}

function setLocationConfig(params) {
return request({
url: '/api/Command/SetLocationConfig',
method: 'post',
headers: { authKey: 'key1' },
data: params
});
}
function getLocationConfig({ imei }) {
return request({
url: '/api/Command/GetLocationConfig',
method: 'get',
headers: { authKey: 'key1' },
params: { imei }
});
}
function setHealthConfig(params) {
return request({
url: '/api/Command/SetHealthConfig',
method: 'post',
headers: { authKey: 'key1' },
data: params
});
}
function getHealthConfig({ imei }) {
return request({
url: '/api/Command/GetHealthConfig',
method: 'get',
headers: { authKey: 'key1' },
params: { imei }
});
}

function setUploadConfig(params) {
return request({
url: '/api/Command/SetUploadConfig',
method: 'post',
headers: { authKey: 'key1' },
data: params
});
}
function getUploadConfig({ imei }) {
return request({
url: '/api/Command/GetUploadConfig',
method: 'get',
headers: { authKey: 'key1' },
params: { imei }
});
}
function setDrownConfig(params) {
return request({
url: '/api/Command/SetDrownConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getDrownConfig(imei) {
return request({
url: '/api/Command/GetDrownConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}

function setNowearConfig(params) {
return request({
url: '/api/Command/SetNowearConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getNowearConfig(imei) {
return request({
url: '/api/Command/GetNowearConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setWatchConfig(params) {
return request({
url: '/api/Device/SetWatchConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getWatchConfig(imei) {
return request({
url: '/api/Device/GetWatchConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setBloodPressConfig(params) {
return request({
url: '/api/Command/SetBloodPressConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getBloodPressConfig(imei) {
return request({
url: '/api/Command/GetBloodPressConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function getBloodPressList(params) {
return request({
url: '/api/Healthy/BloodPressList',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function setPsychAbilityConfig(params) {
return request({
url: '/api/Command/SetPsychAbilityConfig',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getPsychAbilityConfig(imei) {
return request({
url: '/api/Command/GetPsychAbilityConfig',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setLongSitReminder(params) {
return request({
url: '/api/Command/SetLongSitReminder',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getLongSitReminder(imei) {
return request({
url: '/api/Command/GetLongSitReminder',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}
function setRaiseToLightScreen(params) {
return request({
url: '/api/Command/SetRaiseToLightScreen',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}
function getRaiseToLightScreen(imei) {
return request({
url: '/api/Command/GetRaiseToLightScreen',
method: 'get',
headers: { AuthKey: 'key1' },
params: { imei }
});
}

+ 74
- 19
src/api/user.js Dosyayı Görüntüle

@@ -1,32 +1,87 @@
import api from './index';
// axios
import request from '@/utils/request';
import request from '@/config/request';

// 登录
export function login(data) {
export const APIUser = {
getUserInfos,
updateUserInfo,
loginOut,
processList,
process,
modifyPassword,
alarmList,
getAdminList, //管理员列表
wxAutoLogin //微信自动登录
};
export default APIUser;
// 获取用户信息
function getUserInfos(params) {
return request({
url: api.Login,
url: `/api/User/UserInfo`,
method: 'post',
data
data: params
});
}

// 用户信息 get 方法
export function getUserInfo(data) {
// 编辑用户信息
function updateUserInfo(params) {
return request({
url: `/api/User/UpdateUserInfo`,
method: 'post',
data: params
});
}
// 退出登录
function loginOut({ headers, body }) {
return request({
url: `/api/User/WxLoginOut`, //2022.1.5 接口修改 LoginOut => WxLoginOut
method: 'post',
headers: headers,
data: body
});
}
// 获取用户系统消息
function processList(params) {
return request({
url: `/api/Request/ProcessList`,
method: 'post',
data: params
});
}
// 是否同意申请关注
function process(params) {
return request({
url: api.UserInfo,
url: `/api/Request/Process`,
method: 'post',
data,
hideloading: true
data: params
});
}
// 修改密码
function modifyPassword(params) {
return request({
url: `/api/User/ModifyPassword`,
method: 'post',
data: params
});
}
// 消息通知
function alarmList(params) {
return request({
url: `/api/Alarm/AlarmList`,
method: 'post',
data: params
});
}
// 管理员列表
function getAdminList(params) {
return request({
url: `/api/User/AdminList`,
method: 'post',
data: params
});
}

// 用户名称 get 方法
export function getUserName(params) {
function wxAutoLogin(params) {
return request({
url: api.UserName,
method: 'get',
params,
hideloading: true
url: `/api/User/WxAutoLogin`,
method: 'post',
data: params
});
}

+ 32
- 0
src/api/wx.js Dosyayı Görüntüle

@@ -0,0 +1,32 @@
import request from '@/config/request';

export const APIWx = {
createJSSDK,
checkIsNewCustomer, //获取微信用户是否首次关注,即是否是新用户
ocr //ocr识别
};
export default APIWx;
function createJSSDK({ userId, sUrl, appId }) {
return request({
url: '/api/WX/CreateJsSdk',
method: 'get',
params: { userId, sUrl, appId }
});
}
function checkIsNewCustomer(params) {
return request({
url: '/api/User/getOpenId',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}

function ocr(params) {
return request({
url: '/api/WX/ocr',
method: 'post',
headers: { AuthKey: 'key1' },
data: params
});
}

+ 116
- 0
src/components/SubmenuList.vue Dosyayı Görüntüle

@@ -0,0 +1,116 @@
<!-- -->
<template>
<div class="submenu-list">
<div class="header">
<div class="left">
<p>{{ title }}</p>
</div>
<div class="right"></div>
</div>
<div class="main">
<div class="list">
<div class="item" v-for="(item, index) in list" :key="index" @click="onItemClick(item)">
<div class="img-icon-con" :style="{ borderRadius: rounded ? '50%' : '8px', backgroundColor: item.bgColor }">
<img :src="item.imgPath" alt="" />
</div>
<div class="text">
<span>{{ item.text }}</span>
</div>
</div>
<slot name="addDevice"></slot>
</div>
</div>
<!-- <div class="footer"></div> -->
</div>
</template>

<script>
export default {
name: 'SubmenuList',
props: {
title: {
type: String,
default: ''
},
list: {
type: Array,
default: '' || []
},
rounded: {
type: Boolean,
default: null || false
}
},
data() {
return {};
},
created() {},
mounted() {},
methods: {
onItemClick(item) {
console.log('点击的item', item);
if (item.showType) {
if (item.showType === 'newPage') {
this.$router.push({
name: `${item.routerName}`
});
}
}
}
}
};
</script>
<style scoped lang="scss">
.submenu-list {
height: 100%;
width: 100%;
position: relative;
.header {
position: relative;
font-weight: bold;
padding: 10px 20px;
@include flexbox(flex-start, center, row, wrap);
.left {
p {
font-size: 42px;
}
}
}
.main {
position: relative;
@include flexbox(flex-start, center, row, wrap);
width: 100%;
.list {
position: relative;
padding-left: 20px;
/* @include flexbox(flex-start, flex-start, row, wrap); */
display: grid;
grid-template-columns: repeat(4, auto);
grid-gap: 40px;
/* grid-template-rows: auto auto; */
.item {
position: relative;
/* height: 140px; */
/* max-width: 180px; */
/* padding: 0 20px; */
@include flexbox(center, center, column, nowrap);
.img-icon-con {
padding: 20px;
@include flexbox(space-around, center, column, wrap);
img {
height: 80px;
widows: 80px;
}
}
.text {
@include flexbox(flex-start, center, column, wrap);
padding: 5px;
font-size: 28px;
font-weight: 400;
}
}
}
}
}
/* @import url(); 引入css类 */
</style>

+ 85
- 0
src/config/models.js Dosyayı Görüntüle

@@ -1,2 +1,87 @@
// 项目版本号
export const VersionModel = '1.0.1';
export const DeviceCommandModel = {
locate: '0001', // 立即定位
locateType: '0002', // 定位模式
prohibition: '0003', // 上课禁用时段
sleep: '0004', // 休眠时段
remoteSetting: '0005', // 远程设置
familyNum: '0006', // 亲情号码
remoteListening: '0007', // 远程监听
clock: '0008', // 闹钟设置
safeArea: '0009', // 电子围栏
sim: '0010', // 设置sim卡
activateDevice: '0011', // 激活设备
deviceName: '0012', // 设备昵称
deviceCode: '0013', // 设备安全码
sendMsg: '0014' // 下发信息
};
export const FamilyNumberModel = {
appType: {
parentWeb: 0,
manufactor: 1,
commonWeb: 2
},
editable: {
parentWeb: true,
manufactor: false,
commonWeb: true
},
level: 1,
callOut: 1,
outtime: '0000~2400|1+2+3+4+5+6+7',
inComing: 1,
incomingTime: '0000~2400|1+2+3+4+5+6+7'
};
export const ProhibitModel = {
recordType: {
parentWeb: 0,
manufactor: 1,
commonWeb: 2
},
editable: {
parentWeb: true,
manufactor: false,
commonWeb: true
}
};

export const SafeAreaModel = {
appType: {
parentWeb: 0,
manufactor: 1
},
fenceType: {
circle: 1, // 圆形
polygon: 2 // 多边形
}
};
export const WechatHomeModel = {
production: 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU2NzkxNjI2MA==&scene=124#wechat_redirect', // 随手精灵公众号
test: 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI5ODIxNTU0MQ==&scene=124#wechat_redirect', // 校乐园
development: 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI5ODIxNTU0MQ==&scene=124#wechat_redirect' // 校乐园
};
export const LocationType = {
GPS: 1,
LBS: 2,
WIFI: 3
};
export const msgType = {
record: 1,
text: 2
};
export const MsgStatus = {
alreadyRead: 1,
notRead: 2
};
export const BaiduStatisticsModel = {
production: 'https://hm.baidu.com/hm.js?ef364e6446439911bc4ced79bece7715', // 随手精灵百度流量统计 正式环境
test: 'https://hm.baidu.com/hm.js?d1eec257a45f71d12db8b1eacb43ba18', // 随手精灵百度流量统计 测试环境
development: 'https://hm.baidu.com/hm.js?d1eec257a45f71d12db8b1eacb43ba18' // 随手精灵百度流量统计 测试环境
};
// 微信ocr Service ID
export const WxOcrServiceId = {
production: 'wx79ac3de8be320b71',
test: 'wx79ac3de8be320b71',
development: 'wx79ac3de8be320b71'
};

+ 85
- 0
src/config/request.js Dosyayı Görüntüle

@@ -0,0 +1,85 @@
/*
* @Author: linwl
* @Date: 2020-04-13 14:47:59
* @LastEditTime: 2023-06-15 10:32:04
* @LastEditors: JinxChen
* @Description: axios请求配置
* @FilePath: \ParentWeb\src\config\request.js
*/
import axios from 'axios';
import router from '@/router';
import { baseApi } from '@/config';
import prefix from '@/store/prefix';
const httpProxyPrefix = baseApi;

// create an axios instance axios.create创建一个实例
const service = axios.create({
// baseURL: process.env.VUE_APP_BASE_API,
baseURL: httpProxyPrefix
// timeout: 5000 // request timeout
});

const errorHandler = error => {
// const status = get(error, 'response.status');
const status = error.response.status;
console.log(status);
switch (status) {
case 400:
error.message = '请求错误';
break;
case 401:
error.message = '未授权,请登录';
break;
case 403:
error.message = '拒绝访问';
break;
case 404:
error.message = '请求地址出错';
break;
case 408:
error.message = '请求超时';
break;
case 500:
error.message = '服务器内部错误';
break;
case 501:
error.message = '服务未实现';
break;
case 502:
error.message = '网关错误';
break;
case 503:
error.message = '服务器不可用';
break;
case 504:
error.message = '网关超时';
break;
case 505:
error.message = 'HTTP版本不受支持';
break;
default:
break;
}
this.$notify({ message: `您的网络异常(${error.message})`, type: 'warning' });
return Promise.reject(error);
};

// 请求拦截器,增加 token interceptors拦截
service.interceptors.request.use(request => {
if (localStorage.getItem(prefix + 'authToken')) {
request.headers.AuthToken = localStorage.getItem(prefix + 'authToken');
} else if (
window.location.href.indexOf('login') < 0 &&
window.location.href.indexOf('forgetPassword') < 0 &&
window.location.href.indexOf('verifyInfos') < 0 &&
window.location.href.indexOf('register') < 0 &&
window.location.href.indexOf('verificationLogin') < 0 &&
window.location.href.indexOf('changePassword') < 0
) {
router.push({ name: 'login' });
return request;
}
return request;
}, errorHandler);

export default service;

+ 2
- 1
src/main.js Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import 'regenerator-runtime/runtime';
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import store from './store/index';
// 设置 js中可以访问 $cdn
import { $cdn } from '@/config';
Vue.prototype.$cdn = $cdn;
@@ -21,6 +21,7 @@ import '@/assets/css/index.scss';
import 'amfe-flexible';
Vue.prototype.$dayjs = dayjs;
Vue.prototype.$echarts = echarts;
Vue.prototype.$store = store;

// filters
import './filters';


+ 30
- 0
src/services/dialog-service.js Dosyayı Görüntüle

@@ -0,0 +1,30 @@
import { Dialog } from 'vant';

let DialogService = {
confirm({
title,
message,
className,
showCancelButton,
confirmButtonColor,
messageAlign,
confirmButtonText,
cancelButtonText
}) {
return Dialog.confirm({
title: title || '信息提示',
message: message || '',
className: className || 'device_confirm',
showCancelButton: showCancelButton || false,
confirmButtonColor: confirmButtonColor || '#1989fa', //确认按钮颜色
messageAlign: messageAlign || 'center', //文字对齐方式
confirmButtonText: confirmButtonText || '确认', //确认文字
cancelButtonText: cancelButtonText || '取消'
});
},
close() {
return Dialog.close();
}
};

export default DialogService;

+ 77
- 0
src/services/toast-service.js Dosyayı Görüntüle

@@ -0,0 +1,77 @@
import { Toast } from 'vant';

/**
*
* @type {{loading: (function({message?: *, className?: *, loadingType?: *, overlay?: *, forbidClick?: *, duration?: *})), success: (function({message?: *, className?: *, loadingType?: *, overlay?: *, forbidClick?: *, duration?: *})), fail: (function({message?: *, className?: *, loadingType?: *, overlay?: *, forbidClick?: *, duration?: *})), clear: (function())}}
*/
let ToastService = {
loading({
message,
className,
loadingType,
overlay,
forbidClick,
duration,
getContainer,
closeOnClick,
onClose
} = {}) {
const sec = 2000;
if (onClose) {
const timer = setTimeout(() => {
onClose();
clearTimeout(timer);
}, duration || sec);
}
return Toast.loading({
message: message || '',
className: className || 'device_toast',
loadingType: loadingType || 'circular',
overlay: overlay || false,
forbidClick: forbidClick || true,
duration: duration || 0,
getContainer: getContainer || 'body',
closeOnClick: closeOnClick || true
});
},
success({ message, className, loadingType, overlay, forbidClick, duration, onClose }) {
const sec = 2000;
if (onClose) {
const timer = setTimeout(() => {
onClose();
clearTimeout(timer);
}, duration || sec);
}
return Toast.success({
message: message || '',
className: className || 'device_toast',
loadingType: loadingType || 'circular',
overlay: overlay || false,
forbidClick: forbidClick || true,
duration: duration || sec
});
},
fail({ message, className, loadingType, overlay, forbidClick, duration, onClose }) {
const sec = 2000;
// 官方的onoClose方法有bug,已暂停使用
if (onClose) {
const timer = setTimeout(() => {
onClose();
clearTimeout(timer);
}, duration || sec);
}
return Toast.fail({
message: message || '操作失败',
className: className || 'device_toast',
loadingType: loadingType || 'circular',
overlay: overlay || false,
forbidClick: forbidClick || true,
duration: duration || 2000
});
},
clear() {
return Toast.clear();
}
};

export default ToastService;

+ 195
- 0
src/services/utils-service.js Dosyayı Görüntüle

@@ -0,0 +1,195 @@
/**
* 判断是否为空
*/
export function isNull(o) {
if (o === null || o === undefined || o === '') {
return true;
// eslint-disable-next-line
} else if (Array.prototype.isPrototypeOf(o) && o.length === 0) {
return true;
// eslint-disable-next-line
} else if (Object.prototype.isPrototypeOf(o) && Object.keys(o).length === 0) {
return true;
}
return false;
}

/**
* 判断是否为非空
*/
export function isNotNull(o) {
return !isNull(o);
}

/**
* 防抖
* vue中method的this指向为vue实例,所以在调用时 fnName 得写函数名
* @param fnName
* @param time
* @returns {Function}
*/
export function debounce(fnName, time = 500) {
let timer = null;
return function () {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
this[fnName]();
}, time);
};
}

/**
* 节流
* @param fnName
* @param time
* @returns {Function}
*/
export function throttle(fnName, time = 500) {
let canRun = true;
return function () {
if (!canRun) return;
canRun = false;
setTimeout(() => {
this[fnName]();
canRun = true;
}, time);
};
}

/**
* 例如:生成x轴单位:过去一周(包括今天),'yyyy-mm-dd'
* return ['2020-01-20'] | ['01-20']
* 假如出现跨年,字符串带上年份,反之不带
* @returns [ date_string ]
*/
export function generateDayPassed(number = 7) {
let arr = [];
for (let i = 0; i < number; i++) {
arr.push(getDay(i - (number - 1)));
}
// 假如出现跨年,字符串带上年份,反之不带
let tempYear = arr[0].slice(0, 4);
arr = arr.map(item => {
if (tempYear === item.slice(0, 4)) {
return item.slice(5); // '03-31'
} else {
return item; // '2020-03-31'
}
});
return arr;
}

// 工具:参数为整数,0为当天,1为明天,-1为昨天;return 2020-01-20
function getDay(day) {
let today = new Date(),
targetDay_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetDay_milliseconds); //注意,这行是关键代码
let tYear = today.getFullYear(),
tMonth = today.getMonth(),
tDate = today.getDate();
tMonth = doHandleMonth(tMonth + 1);
tDate = doHandleMonth(tDate);
return tYear + '-' + tMonth + '-' + tDate;
}

// 补零
function doHandleMonth(month) {
let m = month;
if (month.toString().length == 1) {
m = '0' + month;
}
return m;
}
// 判断开始时间不能大于结束时间
export function checkStartAndEnd(target = { startTime: '', endTime: '' }) {
console.log('', target.startTime, target.endTime);
let isTimeContained = false;
const target_startTime = stringTimeToNumber(target.startTime);
const target_endTime = stringTimeToNumber(target.endTime);
if (target_startTime < target_endTime) {
isTimeContained = true;
}
return isTimeContained;
}
/**
* 判断时间是否在参数时间区间中
* 先判断 周期
* 再判断 时间区间
* 参数:时间类型为 'HH:mm',weekdays为 '1234567'
* target 新增的
* origin 存在的
*/
export function checkPeriodExist(target = { startTime: '', endTime: '', weekdays: '' }, origin) {
let isWeekdaysContained = false;
let isTimeContained = false;
if (isNotNull(target.weekdays) && isNotNull(origin.weekdays)) {
// 存在周期
target.weekdays.split('').forEach(d => {
if (origin.weekdays.indexOf(d) >= 0) {
isWeekdaysContained = true;
}
});
}
if (isWeekdaysContained) {
// 周期存在交叉时,判断时间区间
// 先改为数字
const target_startTime = stringTimeToNumber(target.startTime);
const target_endTime = stringTimeToNumber(target.endTime);
const origin_startTime = stringTimeToNumber(origin.startTime);
const origin_endTime = stringTimeToNumber(origin.endTime);
if (
(target_startTime >= origin_startTime && target_startTime < origin_endTime) ||
(target_endTime > origin_startTime && target_endTime <= origin_endTime)
) {
isTimeContained = true;
}
}
return isTimeContained;
}

export function stringTimeToNumber(strTime) {
let result = null;
try {
result = parseInt(strTime.replace(':', ''));
} catch (e) {
console.error('时间区间判断:::时间格式转换发生错误:::stringTimeToNumber()', e);
}
return result;
}

// 判断是否存在逗号, 存在以逗号分割成一个数组并且返回第二个数据, 否者直接返回该数据
export function isComma(o) {
let index = o.indexOf(',');
if (index > 0) {
// 大于0 则存在
let newArray = o.split(',');
console.log('扫码返回的参数::', o);
if (newArray.length === 3) {
// 兼容 imei,rfid,iccid 方式
return { type: 'rfIdAndiccId', data: newArray[2], imei: newArray[0] };
} else {
// 正常 imei和iccid
return newArray[1].length <= 10
? { type: 'rfId', data: newArray[1], imei: newArray[0] }
: { type: 'iccId', data: newArray[1], imei: newArray[0] };
}
} else if (index < 0) {
// 只有imei
return o;
}
}

// 名字脱敏
export function nameConvert(name) {
let userName = '';
if (name.length == 2) {
userName = name.substring(0, 1) + '*'; //截取name 字符串截取第一个字符,
} else if (name.length == 3) {
userName = name.substring(0, 1) + '*' + name.substring(2, 3); //截取第一个和第三个字符
} else if (name.length > 3) {
userName = name.substring(0, 1) + '*' + '*' + name.substring(3, name.length); //截取第一个和大于第4个字符
}
return userName;
}

+ 2
- 1
src/store/getters.js Dosyayı Görüntüle

@@ -7,6 +7,7 @@ const getters = {
}
}, */
userName: state => state.app.userName,
testName: state => state.app.testName
testName: state => state.app.testName,
userId: state => state.app.userId
};
export default getters;

+ 291
- 1
src/store/index.js Dosyayı Görüntüle

@@ -1,4 +1,4 @@
import Vue from 'vue';
/* import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters';
import app from './modules/app';
@@ -13,3 +13,293 @@ const store = new Vuex.Store({
});

export default store;
*/
import Vue from 'vue';
import Vuex from 'vuex';
import prefix from '@/store/prefix';
import { isNotNull } from '@/services/utils-service';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
authToken: '',
userId: '',
deviceId: '',
code: '',
serialNo: '',
isAdmin: '', // 绑定时申请人是否管理员/家属
openId: '',
bindSerialNo: '', //设备绑定成功时的输入的serialNo
loginName: '', //用户登录用的手机号码
fenceNameList: '', //用户所拥有的全部围栏名字
familyNameList: '', //用户所拥有的全部亲情名字
currentAddressAndPostion: '', //导航界面用户当前地址
wxRecAuth: false, //获取微信第一次授权
familyShortKeyList: '', //亲情号码快捷键
isRegister: '', //判断用户是否是第一次进入公众号并且注册成功
isLogin: '', //判断用户是否是已经登录成功
gatewayToken: '', //gateway接口token
isFromWx: '', //是否从微信过来的
uniPhone: '', //物联网卡号
roleUser: '', //身份角色, 1 学生; 2 长辈
deviceType: '', //设备类型 1 电子设备 2 手表
uploadinteval: '', //设备-手表采集频率
notJump: null,
showLogin: '', //是否显示登录
watchRole: '',
iotCardTitle: '', //物联网卡商名字
fromRuoter: null,
deviceVersion: '' //设备版本号
},
mutations: {
authToken(state, token) {
state.authToken = token;
window.localStorage[prefix + 'authToken'] = token;
},
userId(state, userId) {
state.userId = userId;
window.localStorage[prefix + 'userId'] = userId;
},
deviceId(state, deviceId) {
state.deviceId = deviceId;
window.localStorage[prefix + 'deviceId'] = deviceId;
},
code(state, code) {
state.code = code;
window.localStorage[prefix + 'code'] = code;
},
serialNo(state, serialNo) {
state.serialNo = serialNo;
window.localStorage[prefix + 'serialNo'] = serialNo;
},
isAdmin(state, isAdmin) {
const result = isAdmin ? 1 : 0;
state.isAdmin = result;
window.localStorage[prefix + 'isAdmin'] = result;
},
openId(state, openId) {
state.openId = openId;
window.localStorage[prefix + 'openId'] = openId;
},
bindSerialNo(state, bindSerialNo) {
state.bindSerialNo = bindSerialNo;
window.localStorage[prefix + 'bindSerialNo'] = bindSerialNo;
},
// 用户登录用的手机号码
loginName(state, loginName) {
state.loginName = loginName;
window.localStorage[prefix + 'loginName'] = loginName;
},
// 圆形围栏和多边形围栏
fenceNameList(state, fenceNameList) {
state.fenceNameList = fenceNameList;
window.localStorage[prefix + 'fenceNameList'] = fenceNameList;
},
// 亲情号码名字
familyNameList(state, familyNameList) {
state.familyNameList = familyNameList;
window.localStorage[prefix + 'familyNameList'] = familyNameList;
},
// currentAddressAndPostion
currentAddressAndPostion(state, currentAddressAndPostion) {
state.currentAddressAndPostion = currentAddressAndPostion;
window.localStorage[prefix + 'currentAddressAndPostion'] = currentAddressAndPostion;
},
wxRecAuth(state, wxRecAuth) {
state.wxRecAuth = wxRecAuth;
window.localStorage[prefix + 'wxRecAuth'] = wxRecAuth;
},
familyShortKeyList(state, familyShortKeyList) {
state.familyShortKeyList = familyShortKeyList;
window.localStorage[prefix + 'familyShortKeyList'] = familyShortKeyList;
},
isRegister(state, isRegister) {
state.isRegister = isRegister;
window.localStorage[prefix + 'isRegister'] = isRegister;
},
isLogin(state, isLogin) {
state.isLogin = isLogin;
window.localStorage[prefix + 'isLogin'] = isLogin;
},
gatewayToken(state, gatewayToken) {
state.gatewayToken = gatewayToken;
window.localStorage[prefix + 'gatewayToken'] = gatewayToken;
},
isFromWx(state, isFromWx) {
state.isFromWx = isFromWx;
window.localStorage[prefix + 'isFromWx'] = isFromWx;
},
uniPhone(state, uniPhone) {
state.uniPhone = uniPhone;
window.localStorage[prefix + 'uniPhone'] = uniPhone;
},
roleUser(state, roleUser) {
state.roleUser = roleUser;
window.localStorage[prefix + 'roleUser'] = roleUser;
},
deviceType(state, deviceType) {
state.deviceType = deviceType;
window.localStorage[prefix + 'deviceType'] = deviceType;
},
uploadinteval(state, uploadinteval) {
state.uploadinteval = uploadinteval;
window.localStorage[prefix + 'uploadinteval'] = uploadinteval;
},
notJump(state, notJump) {
state.notJump = notJump;
window.localStorage[prefix + 'notJump'] = notJump;
},
showLogin(state, showLogin) {
state.showLogin = showLogin;
window.localStorage[prefix + 'showLogin'] = showLogin;
},
watchRole(state, watchRole) {
state.watchRole = watchRole;
window.localStorage[prefix + 'watchRole'] = watchRole;
},
iotCardTitle(state, iotCardTitle) {
state.iotCardTitle = iotCardTitle;
window.localStorage[prefix + 'iotCardTitle'] = iotCardTitle;
},
fromRuoter(state, fromRuoter) {
state.fromRuoter = fromRuoter;
window.localStorage[prefix + 'fromRuoter'] = fromRuoter;
},
deviceVersion(state, deviceVersion) {
state.deviceVersion = deviceVersion;
window.localStorage[prefix + 'deviceVersion'] = deviceVersion;
}
},
getters: {
authToken: state => {
if (state.authToken != '') {
return state.authToken;
} else {
return window.localStorage[prefix + 'authToken'] == null ? '' : window.localStorage[prefix + 'authToken'];
}
},
userId: state => {
if (state.userId != '') return state.userId;
return window.localStorage[prefix + 'userId'] == null ? '' : window.localStorage[prefix + 'userId'];
},
deviceId: state => {
if (state.deviceId != '') return state.deviceId;
return window.localStorage[prefix + 'deviceId'] == null ? '' : window.localStorage[prefix + 'deviceId'];
},
code: state => {
if (state.code != '') return state.code;
return window.localStorage[prefix + 'code'] == null ? '' : window.localStorage[prefix + 'code'];
},
serialNo: state => {
if (state.serialNo != '') return state.serialNo;
return window.localStorage[prefix + 'serialNo'] == null ? '' : window.localStorage[prefix + 'serialNo'];
},
isAdmin: state => {
if (state.isAdmin != '') return state.isAdmin;
return window.localStorage[prefix + 'isAdmin'] == null ? '' : window.localStorage[prefix + 'isAdmin'];
},
openId: state => {
if (state.openId != '') return state.openId;
return window.localStorage[prefix + 'openId'] == null ? '' : window.localStorage[prefix + 'openId'];
},
bindSerialNo: state => {
if (state.bindSerialNo != '') return state.bindSerialNo;
return window.localStorage[prefix + 'bindSerialNo'] == null ? '' : window.localStorage[prefix + 'bindSerialNo'];
},
loginName: state => {
if (state.loginName != '') return state.loginName;
return window.localStorage[prefix + 'loginName'] == null ? '' : window.localStorage[prefix + 'loginName'];
},
// 圆形围栏和多边形围栏
fenceNameList: state => {
if (isNotNull(state.fenceNameList)) return state.fenceNameList;
else
return window.localStorage[prefix + 'fenceNameList'] == null
? ''
: window.localStorage[prefix + 'fenceNameList'];
},
familyNameList: state => {
if (isNotNull(state.familyNameList)) return state.familyNameList;
else
return window.localStorage[prefix + 'familyNameList'] == null
? ''
: window.localStorage[prefix + 'familyNameList'];
},
// currentAddressAndPostion
currentAddressAndPostion: state => {
if (isNotNull(state.currentAddressAndPostion)) return state.currentAddressAndPostion;
else
return window.localStorage[prefix + 'currentAddressAndPostion'] == null
? ''
: window.localStorage[prefix + 'currentAddressAndPostion'];
},
wxRecAuth: state => {
if (isNotNull(state.wxRecAuth)) return state.wxRecAuth;
else return window.localStorage[prefix + 'wxRecAuth'] == null ? '' : window.localStorage[prefix + 'wxRecAuth'];
},
familyShortKeyList: state => {
if (state.familyShortKeyList != '') return state.familyShortKeyList;
return window.localStorage[prefix + 'familyShortKeyList'] == null
? ''
: window.localStorage[prefix + 'familyShortKeyList'];
},
isRegister: state => {
if (state.isRegister != '') return state.isRegister;
return window.localStorage[prefix + 'isRegister'] == null ? '' : window.localStorage[prefix + 'isRegister'];
},
isLogin: state => {
if (state.isLogin != '') return state.isLogin;
return window.localStorage[prefix + 'isLogin'] == null ? '' : window.localStorage[prefix + 'isLogin'];
},
gatewayToken: state => {
if (state.gatewayToken != '') return state.gatewayToken;
return window.localStorage[prefix + 'gatewayToken'] == null ? '' : window.localStorage[prefix + 'gatewayToken'];
},
isFromWx: state => {
if (state.isFromWx != '') return state.isFromWx;
return window.localStorage[prefix + 'isFromWx'] == null ? '' : window.localStorage[prefix + 'isFromWx'];
},
uniPhone: state => {
if (state.uniPhone != '') return state.uniPhone;
return window.localStorage[prefix + 'uniPhone'] == null ? '' : window.localStorage[prefix + 'uniPhone'];
},
roleUser: state => {
if (state.roleUser != '') return state.roleUser;
return window.localStorage[prefix + 'roleUser'] == null ? '' : window.localStorage[prefix + 'roleUser'];
},
deviceType: state => {
if (state.deviceType != '') return state.deviceType;
return window.localStorage[prefix + 'deviceType'] == null ? '' : window.localStorage[prefix + 'deviceType'];
},
uploadinteval: state => {
if (state.uploadinteval != '') return state.uploadinteval;
return window.localStorage[prefix + 'uploadinteval'] == null ? '' : window.localStorage[prefix + 'uploadinteval'];
},
notJump: state => {
if (state.notJump != '') return state.notJump;
return window.localStorage[prefix + 'notJump'] == null ? '' : window.localStorage[prefix + 'notJump'];
},
showLogin: state => {
if (state.showLogin != '') return state.showLogin;
return window.localStorage[prefix + 'showLogin'] == null ? '' : window.localStorage[prefix + 'showLogin'];
},
watchRole: state => {
if (state.watchRole != '') return state.watchRole;
return window.localStorage[prefix + 'watchRole'] == null ? '' : window.localStorage[prefix + 'watchRole'];
},
iotCardTitle: state => {
if (state.iotCardTitle != '') return state.iotCardTitle;
return window.localStorage[prefix + 'iotCardTitle'] == null ? '' : window.localStorage[prefix + 'iotCardTitle'];
},

fromRuoter: state => {
if (state.fromRuoter != '') return state.fromRuoter;
return window.localStorage[prefix + 'fromRuoter'] == null ? '' : window.localStorage[prefix + 'fromRuoter'];
},
deviceVersion: state => {
if (state.deviceVersion != '') return state.deviceVersion;
return window.localStorage[prefix + 'deviceVersion'] == null ? '' : window.localStorage[prefix + 'deviceVersion'];
}
},
actions: {},
modules: {}
});

+ 2
- 0
src/store/prefix.js Dosyayı Görüntüle

@@ -0,0 +1,2 @@
const prefix = 'card_parent_';
export default prefix;

+ 0
- 58
src/utils/request.js Dosyayı Görüntüle

@@ -1,58 +0,0 @@
import axios from 'axios';
import store from '@/store';
import { Toast } from 'vant';
// 根据环境不同引入不同api地址
import { baseApi } from '@/config';
// create an axios instance
const service = axios.create({
baseURL: baseApi, // url = base api url + request url
withCredentials: true, // send cookies when cross-domain requests
timeout: 5000 // request timeout
});

// request拦截器 request interceptor
service.interceptors.request.use(
config => {
// 不传递默认开启loading
if (!config.hideloading) {
// loading
Toast.loading({
forbidClick: true
});
}
if (store.getters.token) {
config.headers['X-Token'] = '';
}
return config;
},
error => {
// do something with request error
console.log(error); // for debug
return Promise.reject(error);
}
);
// respone拦截器
service.interceptors.response.use(
response => {
Toast.clear();
const res = response.data;
if (res.status && res.status !== 200) {
// 登录超时,重新登录
if (res.status === 401) {
store.dispatch('FedLogOut').then(() => {
location.reload();
});
}
return Promise.reject(res || 'error');
} else {
return Promise.resolve(res);
}
},
error => {
Toast.clear();
console.log('err' + error); // for debug
return Promise.reject(error);
}
);

export default service;

+ 90
- 7
src/views/myself/index.scss Dosyayı Görüntüle

@@ -4,14 +4,97 @@
width: 100%;
overflow: hidden;
.container {
height: calc(100vh - 200px);
padding-top: 100px;
position: relative;
height: calc(100vh - 160px);
padding: 30px;
overflow: scroll;
.box-scor {
position: relative;
.item {
font-size: 32px;
height: 200px;
.banner {
height: 420px;
width: 100%;
background-color: greenyellow;
border-radius: 60px;
.top {
height: 320px;
@include flexbox(center, center, column, nowrap);
.avatar {
height: 200px;
width: 200px;
@include flexbox(flex-end, center, column, nowrap);
img {
position: relative;
height: 130px;
width: 130px;
padding: 10px;
object-fit: cover;
border-radius: 50%;
border: 2px solid #333;
}
}
.nick-name {
padding: 20px 0;
span {
font-size: 42px;
font-weight: bold;
}
}
}
.bottom {
height: 80px;
padding: 5px 0;
@include flexbox(flex-end, center, column, nowrap);
span {
font-size: 24px;
color: #fff;
}
}
}
.submenu {
flex: 1;
margin-top: 20px;
padding-top: 20px;
&.device-manage {
.add-device {
position: relative;
height: 160px;
max-width: 90px;
min-width: 90px;
border-radius: 10px;
background-color: green;
@include flexbox(center, center, column, nowrap);
}
}
&.safe-helper {
.title {
font-size: 42px;
font-weight: bold;
padding: 20px;
}
.safe-helper-container {
font-size: 32px;
padding: 60px 0px 0 30px;
border: 1px solid green;
border-radius: 30px;
.top {
@include flexbox(flex-start, flex-start, column, wrap);
p {
font-weight: bold;
}
span {
padding: 10px 0;
font-size: 24px;
}
}
.bottom {
@include flexbox(flex-end, center, column, nowrap);
padding: 30px 0 15px 0;
p {
color: red;
span {
color: #000;
}
}
}
}
}
}
}

+ 182
- 9
src/views/myself/index.vue Dosyayı Görüntüle

@@ -1,27 +1,200 @@
<!-- -->
<template>
<div class="myself">
<NavBar></NavBar>
<!-- <NavBar></NavBar> -->
<div class="container">
<div class="box-scor">
<div v-for="(item, index) in 20" :key="index" class="item">
{{ index }}
<div class="banner">
<div class="top">
<div class="avatar">
<img :src="userInfos.imagePath" alt="" />
</div>
<div class="nick-name">
<span>{{ userInfos.username }}</span>
</div>
</div>
<div class="bottom">
<span>已绑定{{ userInfos.deviceNumber }}台设备</span>
</div>
</div>
<div class="submenu device-manage">
<SubmenuList :title="device.title" :list="device.list" rounded>
<template #addDevice>
<div class="add-device"><span>+</span></div>
</template>
</SubmenuList>
</div>
<div class="submenu family">
<SubmenuList :title="family.title" :list="family.list"> </SubmenuList>
</div>
<div class="submenu safe-helper">
<div class="title">
<p>安全助手</p>
</div>
<div class="safe-helper-container">
<div class="top">
<p>桂城街道深海路105号平洲桂城广东天波教育科技有限公司</p>
<span>纬度:23.0263313634643 经度:113.175114274988</span>
</div>
<div class="bottom">
<p>进入地图 <span>></span></p>
</div>
</div>
</div>
<div class="submenu study-helper">
<SubmenuList :title="studyHelper.title" :list="studyHelper.list"> </SubmenuList>
</div>
<div class="submenu life-helper">
<SubmenuList :title="lifeHelper.title" :list="lifeHelper.list"> </SubmenuList>
</div>
<div class="submenu param-setting">
<SubmenuList :title="paramSetting.title" :list="paramSetting.list"> </SubmenuList>
</div>
<div class="submenu others-setting">
<SubmenuList :title="othersSetting.title" :list="othersSetting.list"> </SubmenuList>
</div>
</div>
</div>
</template>

<script>
import NavBar from '@/components/NavBar.vue';
/* import NavBar from '@/components/NavBar.vue'; */
import SubmenuList from '@/components/SubmenuList.vue';
import APIUser from '@/api/user';
import APIDevice from '@/api/device';
import ToastService from '@/services/toast-service';
import { isNotNull } from '@/services/utils-service';
export default {
components: { NavBar },
components: { /* NavBar, */ SubmenuList },
data() {
return {};
return {
userInfos: {},
listData: [],
family: {
title: '亲情沟通',
list: [
{ imgPath: require('../../assets/logo.png'), text: '亲情号码', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '留言', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '通话记录', bgColor: 'red' }
]
},
device: {
title: '孩子管理',
list: [
/* { imgPath: require('../../assets/logo.png'), text: '测试设置', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '测试设置', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '测试设置', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '留言', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '留言', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '测试设置', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '留言', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '留言', bgColor: 'green' } */
]
},
studyHelper: {
title: '学习助手',
list: [
{ imgPath: require('../../assets/logo.png'), text: '课堂禁用', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '课程表', bgColor: 'red' }
]
},
lifeHelper: {
title: '生活助手',
list: [
{ imgPath: require('../../assets/logo.png'), text: '闹钟', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '支付密码修改', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '短信修改', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '亲友关注', bgColor: 'red' }
]
},
paramSetting: {
title: '参数设置',
list: [
{ imgPath: require('../../assets/logo.png'), text: '参数设置', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '远程设置', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '休眠设置', bgColor: 'red' }
]
},
othersSetting: {
title: '其他设置',
list: [
{ imgPath: require('../../assets/logo.png'), text: '账号安全', bgColor: 'green' },
{ imgPath: require('../../assets/logo.png'), text: '常见问题', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '版本信息', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '关于我们', bgColor: 'red' },
{ imgPath: require('../../assets/logo.png'), text: '退出登录', bgColor: 'red' }
]
},

userImg: require('../../assets/logo.png') //用户头像
};
},
created() {},
mounted() {},
methods: {}
mounted() {
this.getUserInfos();
this.getDeviceList();
},
methods: {
getUserInfos() {
APIUser.getUserInfos({
userId: this.$store.getters.userId
})
.then(res => {
console.log('res', res);
if (res.data.stateCode === 1) {
if (res.data) {
this.userInfos = { ...res.data };
}
}
})
.catch(err => {
console.log(err);
})
.finally(() => {
ToastService.clear();
});
},
getDeviceList() {
ToastService.loading({ message: '正在加载', forbidClick: false });
let that = this;
APIDevice.deviceList({
userId: this.$store.getters.userId,
mapType: 'gaode',
timeOffset: -new Date().getTimezoneOffset() / 60
})
.then(res => {
let item = res.data;
this.longName = item.longName;
this.device.list =
item.devicesList == null
? []
: item.devicesList.map(device => {
return {
imgPath: device.imagePath,
text: device.nickName ? device.nickName : device.serialNo.slice(-3),
bgColor: 'green'
};
});

if (isNotNull(item.devicesList)) {
item.devicesList.forEach(val => {
if (val.deviceId == that.$store.getters.deviceId) {
this.$store.commit('roleUser', val.roleUser);
this.$store.commit('deviceType', val.deviceType);
}
});
} else {
this.$store.commit('deviceId', '');
this.$store.commit('serialNo', '');
}
})
.catch(err => {
console.log(err);
})
.finally(() => {
ToastService.clear();
});
}
}
};
</script>
<style scoped lang="scss">


Yükleniyor…
İptal
Kaydet