TMRAppBle/.bin/index.js

2524 lines
61 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function() {
/*
* APICloud JavaScript Library
* Copyright (c) 2014 apicloud.com
*/
(function(window) {
var u = {};
var isAndroid = /android/gi.test(navigator.appVersion);
var uzStorage = function uzStorage() {
var ls = window.localStorage;
if (isAndroid) {
ls = os.localStorage();
}
return ls;
};
function parseArguments(url, data, fnSuc, dataType) {
if (typeof data == "function") {
dataType = fnSuc;
fnSuc = data;
data = undefined;
}
if (typeof fnSuc != "function") {
dataType = fnSuc;
fnSuc = undefined;
}
return {
url: url,
data: data,
fnSuc: fnSuc,
dataType: dataType
};
}
u.trim = function(str) {
if (String.prototype.trim) {
return str == null ? "" : String.prototype.trim.call(str);
} else {
return str.replace(/(^\s*)|(\s*$)/g, "");
}
};
u.trimAll = function(str) {
return str.replace(/\s*/g, "");
};
u.isElement = function(obj) {
return !!(obj && obj.nodeType == 1);
};
u.isArray = function(obj) {
if (Array.isArray) {
return Array.isArray(obj);
} else {
return obj instanceof Array;
}
};
u.isEmptyObject = function(obj) {
if (JSON.stringify(obj) === "{}") {
return true;
}
return false;
};
u.addEvt = function(el, name, fn, useCapture) {
if (!u.isElement(el)) {
console.warn(
"$api.addEvt Function need el param, el param must be DOM Element"
);
return;
}
useCapture = useCapture || false;
if (el.addEventListener) {
el.addEventListener(name, fn, useCapture);
}
};
u.rmEvt = function(el, name, fn, useCapture) {
if (!u.isElement(el)) {
console.warn(
"$api.rmEvt Function need el param, el param must be DOM Element"
);
return;
}
useCapture = useCapture || false;
if (el.removeEventListener) {
el.removeEventListener(name, fn, useCapture);
}
};
u.one = function(el, name, fn, useCapture) {
if (!u.isElement(el)) {
console.warn(
"$api.one Function need el param, el param must be DOM Element"
);
return;
}
useCapture = useCapture || false;
var that = this;
var cb = function cb() {
fn && fn();
that.rmEvt(el, name, cb, useCapture);
};
that.addEvt(el, name, cb, useCapture);
};
u.dom = function(el, selector) {
if (arguments.length === 1 && typeof arguments[0] == "string") {
if (document.querySelector) {
return document.querySelector(arguments[0]);
}
} else if (arguments.length === 2) {
if (el.querySelector) {
return el.querySelector(selector);
}
}
};
u.domAll = function(el, selector) {
if (arguments.length === 1 && typeof arguments[0] == "string") {
if (document.querySelectorAll) {
return document.querySelectorAll(arguments[0]);
}
} else if (arguments.length === 2) {
if (el.querySelectorAll) {
return el.querySelectorAll(selector);
}
}
};
u.byId = function(id) {
return document.getElementById(id);
};
u.first = function(el, selector) {
if (arguments.length === 1) {
if (!u.isElement(el)) {
console.warn(
"$api.first Function need el param, el param must be DOM Element"
);
return;
}
return el.children[0];
}
if (arguments.length === 2) {
return this.dom(el, selector + ":first-child");
}
};
u.last = function(el, selector) {
if (arguments.length === 1) {
if (!u.isElement(el)) {
console.warn(
"$api.last Function need el param, el param must be DOM Element"
);
return;
}
var children = el.children;
return children[children.length - 1];
}
if (arguments.length === 2) {
return this.dom(el, selector + ":last-child");
}
};
u.eq = function(el, index) {
return this.dom(el, ":nth-child(" + index + ")");
};
u.not = function(el, selector) {
return this.domAll(el, ":not(" + selector + ")");
};
u.prev = function(el) {
if (!u.isElement(el)) {
console.warn(
"$api.prev Function need el param, el param must be DOM Element"
);
return;
}
var node = el.previousSibling;
if (node.nodeType && node.nodeType === 3) {
node = node.previousSibling;
return node;
}
};
u.next = function(el) {
if (!u.isElement(el)) {
console.warn(
"$api.next Function need el param, el param must be DOM Element"
);
return;
}
var node = el.nextSibling;
if (node.nodeType && node.nodeType === 3) {
node = node.nextSibling;
return node;
}
};
u.closest = function(el, selector) {
if (!u.isElement(el)) {
console.warn(
"$api.closest Function need el param, el param must be DOM Element"
);
return;
}
var doms, targetDom;
var isSame = function isSame(doms, el) {
var i = 0,
len = doms.length;
for (i; i < len; i++) {
if (doms[i].isSameNode(el)) {
return doms[i];
}
}
return false;
};
var traversal = function traversal(el, selector) {
doms = u.domAll(el.parentNode, selector);
targetDom = isSame(doms, el);
while (!targetDom) {
el = el.parentNode;
if (el != null && el.nodeType == el.DOCUMENT_NODE) {
return false;
}
traversal(el, selector);
}
return targetDom;
};
return traversal(el, selector);
};
u.contains = function(parent, el) {
var mark = false;
if (el === parent) {
mark = true;
return mark;
} else {
do {
el = el.parentNode;
if (el === parent) {
mark = true;
return mark;
}
} while (el === document.body || el === document.documentElement);
return mark;
}
};
u.remove = function(el) {
if (el && el.parentNode) {
el.parentNode.removeChild(el);
}
};
u.attr = function(el, name, value) {
if (!u.isElement(el)) {
console.warn(
"$api.attr Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length == 2) {
return el.getAttribute(name);
} else if (arguments.length == 3) {
el.setAttribute(name, value);
return el;
}
};
u.removeAttr = function(el, name) {
if (!u.isElement(el)) {
console.warn(
"$api.removeAttr Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length === 2) {
el.removeAttribute(name);
}
};
u.hasCls = function(el, cls) {
if (!u.isElement(el)) {
console.warn(
"$api.hasCls Function need el param, el param must be DOM Element"
);
return;
}
if (el.className.indexOf(cls) > -1) {
return true;
} else {
return false;
}
};
u.addCls = function(el, cls) {
if (!u.isElement(el)) {
console.warn(
"$api.addCls Function need el param, el param must be DOM Element"
);
return;
}
if ("classList" in el) {
el.classList.add(cls);
} else {
var preCls = el.className;
var newCls = preCls + " " + cls;
el.className = newCls;
}
return el;
};
u.removeCls = function(el, cls) {
if (!u.isElement(el)) {
console.warn(
"$api.removeCls Function need el param, el param must be DOM Element"
);
return;
}
if ("classList" in el) {
el.classList.remove(cls);
} else {
var preCls = el.className;
var newCls = preCls.replace(cls, "");
el.className = newCls;
}
return el;
};
u.toggleCls = function(el, cls) {
if (!u.isElement(el)) {
console.warn(
"$api.toggleCls Function need el param, el param must be DOM Element"
);
return;
}
if ("classList" in el) {
el.classList.toggle(cls);
} else {
if (u.hasCls(el, cls)) {
u.removeCls(el, cls);
} else {
u.addCls(el, cls);
}
}
return el;
};
u.val = function(el, val) {
if (!u.isElement(el)) {
console.warn(
"$api.val Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length === 1) {
switch (el.tagName) {
case "SELECT":
var value = el.options[el.selectedIndex].value;
return value;
case "INPUT":
return el.value;
case "TEXTAREA":
return el.value;
}
}
if (arguments.length === 2) {
switch (el.tagName) {
case "SELECT":
el.options[el.selectedIndex].value = val;
return el;
case "INPUT":
el.value = val;
return el;
case "TEXTAREA":
el.value = val;
return el;
}
}
};
u.prepend = function(el, html) {
if (!u.isElement(el)) {
console.warn(
"$api.prepend Function need el param, el param must be DOM Element"
);
return;
}
el.insertAdjacentHTML("afterbegin", html);
return el;
};
u.append = function(el, html) {
if (!u.isElement(el)) {
console.warn(
"$api.append Function need el param, el param must be DOM Element"
);
return;
}
el.insertAdjacentHTML("beforeend", html);
return el;
};
u.before = function(el, html) {
if (!u.isElement(el)) {
console.warn(
"$api.before Function need el param, el param must be DOM Element"
);
return;
}
el.insertAdjacentHTML("beforebegin", html);
return el;
};
u.after = function(el, html) {
if (!u.isElement(el)) {
console.warn(
"$api.after Function need el param, el param must be DOM Element"
);
return;
}
el.insertAdjacentHTML("afterend", html);
return el;
};
u.html = function(el, html) {
if (!u.isElement(el)) {
console.warn(
"$api.html Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length === 1) {
return el.innerHTML;
} else if (arguments.length === 2) {
el.innerHTML = html;
return el;
}
};
u.text = function(el, txt) {
if (!u.isElement(el)) {
console.warn(
"$api.text Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length === 1) {
return el.textContent;
} else if (arguments.length === 2) {
el.textContent = txt;
return el;
}
};
u.offset = function(el) {
if (!u.isElement(el)) {
console.warn(
"$api.offset Function need el param, el param must be DOM Element"
);
return;
}
var sl = Math.max(
document.documentElement.scrollLeft,
document.body.scrollLeft
);
var st = Math.max(
document.documentElement.scrollTop,
document.body.scrollTop
);
var rect = el.getBoundingClientRect();
return {
l: rect.left + sl,
t: rect.top + st,
w: el.offsetWidth,
h: el.offsetHeight
};
};
u.css = function(el, css) {
if (!u.isElement(el)) {
console.warn(
"$api.css Function need el param, el param must be DOM Element"
);
return;
}
if (typeof css == "string" && css.indexOf(":") > 0) {
el.style && (el.style.cssText += ";" + css);
}
};
u.cssVal = function(el, prop) {
if (!u.isElement(el)) {
console.warn(
"$api.cssVal Function need el param, el param must be DOM Element"
);
return;
}
if (arguments.length === 2) {
var computedStyle = window.getComputedStyle(el, null);
return computedStyle.getPropertyValue(prop);
}
};
u.jsonToStr = function(json) {
if (typeof json === "object") {
return JSON && JSON.stringify(json);
}
};
u.strToJson = function(str) {
if (typeof str === "string") {
return JSON && JSON.parse(str);
}
};
u.setStorage = function(key, value) {
if (arguments.length === 2) {
var v = value;
if (typeof v == "object") {
v = JSON.stringify(v);
v = "obj-" + v;
} else {
v = "str-" + v;
}
var ls = uzStorage();
if (ls) {
ls.setItem(key, v);
}
}
};
u.getStorage = function(key) {
var ls = uzStorage();
if (ls) {
var v = ls.getItem(key);
if (!v) {
return;
}
if (v.indexOf("obj-") === 0) {
v = v.slice(4);
return JSON.parse(v);
} else if (v.indexOf("str-") === 0) {
return v.slice(4);
}
}
};
u.rmStorage = function(key) {
var ls = uzStorage();
if (ls && key) {
ls.removeItem(key);
}
};
u.clearStorage = function() {
var ls = uzStorage();
if (ls) {
ls.clear();
}
};
u.fixIos7Bar = function(el) {
return u.fixStatusBar(el);
};
u.fixStatusBar = function(el) {
if (!u.isElement(el)) {
console.warn(
"$api.fixStatusBar Function need el param, el param must be DOM Element"
);
return 0;
}
el.style.paddingTop = api.safeArea.top + "px";
return el.offsetHeight;
};
u.fixTabBar = function(el) {
if (!u.isElement(el)) {
console.warn(
"$api.fixTabBar Function need el param, el param must be DOM Element"
);
return 0;
}
el.style.paddingBottom = api.safeArea.bottom + "px";
return el.offsetHeight;
};
u.toast = function(title, text, time) {
var opts = {};
var show = function show(opts, time) {
api.showProgress(opts);
setTimeout(function() {
api.hideProgress();
}, time);
};
if (arguments.length === 1) {
var time = time || 500;
if (typeof title === "number") {
time = title;
} else {
opts.title = title + "";
}
show(opts, time);
} else if (arguments.length === 2) {
var time = time || 500;
var text = text;
if (typeof text === "number") {
var tmp = text;
time = tmp;
text = null;
}
if (title) {
opts.title = title;
}
if (text) {
opts.text = text;
}
show(opts, time);
}
if (title) {
opts.title = title;
}
if (text) {
opts.text = text;
}
time = time || 500;
show(opts, time);
};
u.post = function() /*url,data,fnSuc,dataType*/ {
var argsToJson = parseArguments.apply(null, arguments);
var json = {};
var fnSuc = argsToJson.fnSuc;
argsToJson.url && (json.url = argsToJson.url);
argsToJson.data && (json.data = argsToJson.data);
if (argsToJson.dataType) {
var type = argsToJson.dataType.toLowerCase();
if (type == "text" || type == "json") {
json.dataType = type;
}
} else {
json.dataType = "json";
}
json.method = "post";
api.ajax(json, function(ret, err) {
if (ret) {
fnSuc && fnSuc(ret);
}
});
};
u.get = function() /*url,fnSuc,dataType*/ {
var argsToJson = parseArguments.apply(null, arguments);
var json = {};
var fnSuc = argsToJson.fnSuc;
argsToJson.url && (json.url = argsToJson.url);
//argsToJson.data && (json.data = argsToJson.data);
if (argsToJson.dataType) {
var type = argsToJson.dataType.toLowerCase();
if (type == "text" || type == "json") {
json.dataType = type;
}
} else {
json.dataType = "text";
}
json.method = "get";
api.ajax(json, function(ret, err) {
if (ret) {
fnSuc && fnSuc(ret);
}
});
};
/*end*/
window.$api = u;
})(window);
var Permission = {
hasPermission: function hasPermission(one_per) {
var perms = new Array();
if (one_per) {
perms.push(one_per);
} else {
var prs = document.getElementsByName("p_list");
for (var i = 0; i < prs.length; i++) {
if (prs[i].checked) {
perms.push(prs[i].value);
}
}
}
var rets = api.hasPermission({
list: perms
});
if (!one_per) {
console.log("判断结果:" + JSON.stringify(rets));
return;
}
return rets;
},
reqPermission: function reqPermission(perm, callback) {
var perms = new Array();
perms.push(perm);
api.requestPermission(
{
list: perms,
code: 1
},
function(ret, err) {
if (ret && ret.list.length > 0) {
callback(ret);
}
}
);
},
reqPermissions: function reqPermissions(perms, callback) {
api.requestPermissions(
{
list: perms,
code: 1
},
function(ret, err) {
if (ret && ret.list.length > 0) {
callback(ret);
console.log(JSON.stringify(ret));
}
}
);
}
};
var tts;
var TTSUtil = {
initTTS: function initTTS() {
tts = api.require("iflyRecognition");
tts.createUtility(
{
android_appid: "3cbf130a"
},
function(ret, err) {
if (ret.status);
else {
console.log("tts创建失败");
}
}
);
},
readStr: function readStr(param) {
tts.stopRead();
tts.read(
{
readStr: param.str,
speed: 0,
volume: 100,
voice: param.voice,
rate: 16000,
audioPath: "fs://speechRecogniser/read.mp3"
},
function(ret, err) {
if (ret.status) {
ret.speakProgress;
} else {
console.log(JSON.stringify(err));
}
}
);
}
};
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly &&
(symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})),
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2
? ownKeys(Object(source), !0).forEach(function(key) {
_defineProperty(target, key, source[key]);
})
: Object.getOwnPropertyDescriptors
? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))
: ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(
target,
key,
Object.getOwnPropertyDescriptor(source, key)
);
});
}
return target;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
var Util = {
appOpen: function appOpen() {
var phoneInfoMore = api.require("phoneInfoMore");
var data1 = {
appDeviceid: api.deviceId,
appId: api.appId,
appName: api.appName,
appVersion: api.appVersion,
systemType: api.systemType,
systemVersion: api.systemVersion,
version: api.version,
deviceModel: api.deviceModel,
devicename: api.deviceName,
uimode: api.uimode,
platform: api.platform,
operator: api.operator,
connectiontype: api.connectionType,
screenwidth: api.screenWidth,
screenheight: api.screenHeight,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"})
};
if (api.systemVersion <= 10) {
phoneInfoMore.getBaseInfo(function(ret, err) {
if (ret) {
api.setGlobalData({key: "imei", value: ret.imei});
data1.imei = ret.imei;
POST("appOpen", data1, {})
.then(function(ret) {
// console.log(JSON.stringify(ret));
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
}
});
} else {
data1.imei = api.deviceId;
POST("appOpen", data1, {})
.then(function(ret) {
// console.log(JSON.stringify(ret));
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
}
},
getDateStr: function getDateStr(date) {
var seperator1 = "-";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate =
date.getFullYear() + seperator1 + month + seperator1 + strDate;
return currentdate;
},
//得到当前时间
currTimeFn: function currTimeFn(_date) {
var _year = _date.getFullYear();
var _month =
_date.getMonth() + 1 < 10
? "0" + (_date.getMonth() + 1)
: _date.getMonth() + 1;
var _day = _date.getDate() < 10 ? "0" + _date.getDate() : _date.getDate();
var _hour =
_date.getHours() < 10 ? "0" + _date.getHours() : _date.getHours();
var _minutes =
_date.getMinutes() < 10 ? "0" + _date.getMinutes() : _date.getMinutes();
var _seconds =
_date.getSeconds() < 10 ? "0" + _date.getSeconds() : _date.getSeconds();
return (
_year +
"-" +
_month +
"-" +
_day +
" " +
_hour +
":" +
_minutes +
":" +
_seconds
);
}
};
var config = {
// schema: 'http',
// host: '192.168.0.107:8088',
schema: "https",
host: "tmr.nxcyx.com/api/",
path: "app/tmr",
secret: "776eca99-******-11e9-9897-*******"
};
function req(options) {
var baseUrl = config.schema + "://" + config.host + "/" + config.path + "/";
options.url = baseUrl + options.url;
return new Promise(function(resolve, reject) {
api.ajax(options, function(ret, err) {
console.log(
"[" +
options.method +
"] " +
options.url +
" [" +
api.winName +
"/" +
api.frameName +
"]"
);
if (ret) {
resolve(ret);
api.hideProgress();
} else {
reject(err);
api.hideProgress();
}
});
});
}
/**
* POST 请求快捷方法
* @param url
* @param data
* @param options {Object} 附加参数
* @returns {Promise<Object>}
* @constructor
*/
function POST(url, data, options) {
if (options === void 0) {
options = {};
}
options.headers = {"Content-Type": "application/json;charset=utf-8"};
return req(
_objectSpread2(
_objectSpread2({}, options),
{},
{url: url, method: "POST", data: {body: data}}
)
);
}
var bmLocation = null;
var bmLocationUtil = {
initLoc: function initLoc() {
bmLocation = api.require("bmLocation");
bmLocation.setAgreePrivacy({
agree: true
});
},
startLoc: function startLoc() {
bmLocation.start(
{
locatingWithReGeocode: true,
backgroundLocation: true
},
function(ret) {
callback(ret);
}
);
},
singleLocation: function singleLocation(param, callback) {
bmLocation.singleLocation(
{
reGeocode: false,
netWorkState: false
},
function(ret) {
callback(ret);
}
);
}
};
var config$1 = {
// schema: 'http',
// host: '192.168.0.107:8088',
schema: "https",
host: "tmr.nxcyx.com/api/",
path: "app/tmr",
secret: "776eca99-******-11e9-9897-*******"
};
function req$1(options) {
var baseUrl =
config$1.schema + "://" + config$1.host + "/" + config$1.path + "/";
options.url = baseUrl + options.url;
return new Promise(function(resolve, reject) {
var data = options.data ? JSON.stringify(options.data.body) : "";
api.ajax(options, function(ret, err) {
console.log(
"[" +
options.method +
"] " +
options.url +
data +
" [" +
api.winName +
"/" +
api.frameName +
"]"
);
if (ret) {
resolve(ret);
api.hideProgress();
} else {
reject(err);
api.hideProgress();
}
});
});
}
/**
* GET请求快捷方法
* @constructor
* @param url {string} 地址
* @param options {Object} 附加参数
*/
function GET(url, options) {
if (options === void 0) {
options = {};
}
return req$1(
_objectSpread2(_objectSpread2({}, options), {}, {url: url, method: "GET"})
);
}
/**
* POST 请求快捷方法
* @param url
* @param data
* @param options {Object} 附加参数
* @returns {Promise<Object>}
* @constructor
*/
function POST$1(url, data, options) {
if (options === void 0) {
options = {};
}
options.headers = {"Content-Type": "application/json;charset=utf-8"};
return req$1(
_objectSpread2(
_objectSpread2({}, options),
{},
{url: url, method: "POST", data: {body: data}}
)
);
}
var DxxLoading = /*@__PURE__*/ (function(Component) {
function DxxLoading(props) {
Component.call(this, props);
}
if (Component) DxxLoading.__proto__ = Component;
DxxLoading.prototype = Object.create(Component && Component.prototype);
DxxLoading.prototype.constructor = DxxLoading;
DxxLoading.prototype.closeview = function() {
this.fire("closeview");
};
DxxLoading.prototype.render = function() {
return apivm.h(
"view",
{
class: "myloadingupview",
style: {display: this.props.show ? "flex" : "none"},
onClick: this.closeview
},
apivm.h(
"view",
{class: "myloadingview"},
apivm.h(
"view",
{class: "viewloading"},
apivm.h("image", {
class: "loadingImage",
src: "../components/loading.gif",
mode: "widthFix"
}),
apivm.h(
"view",
null,
apivm.h(
"text",
{class: "loadingtext"},
this.props.loadingtext ? this.props.loadingtext : "loading"
)
)
)
)
);
};
return DxxLoading;
})(Component);
DxxLoading.css = {
".myloadingupview": {
zIndex: "99999",
position: "absolute",
top: "0",
left: "0",
right: "0",
bottom: "0",
width: "100vw",
height: "100vh",
background: "rgba(0, 0, 0, 0.4)",
flexDirection: "row-reverse",
justifyContent: "center",
alignItems: "center"
},
".viewloading": {
width: "80px",
height: "80px",
textAlign: "center",
background: "#ffffff",
borderRadius: "6px",
padding: "10px",
justifyContent: "center",
alignItems: "center"
},
".loadingImage": {height: "30px", width: "30px"},
".loadingtext": {color: "#000000"}
};
apivm.define("dxx-loading", DxxLoading);
var LanyunSteps = /*@__PURE__*/ (function(Component) {
function LanyunSteps(props) {
Component.call(this, props);
}
if (Component) LanyunSteps.__proto__ = Component;
LanyunSteps.prototype = Object.create(Component && Component.prototype);
LanyunSteps.prototype.constructor = LanyunSteps;
LanyunSteps.prototype.install = function() {
this.render = function(props) {
var h = apivm.h;
var list = props.list;
var items = [];
var activeColor = props["active-color"] || "#06f";
var inactiveColor = props["inactive-color"] || "#9ca3af";
var direction = ["row", "column"].includes(props.direction)
? props.direction
: "row";
var icon = props.icon || "../../components/lanyun-steps/asset/gouxuan.png";
var current = props.current || 0;
if (current >= list.length) {
current = list.length - 1;
}
if (current <= 0) {
current = 0;
}
list.forEach(function(v, i) {
var isActive = current >= i;
items.push(
h(
"view",
{
class: "lanyun-steps__item lanyun-steps__item--" + direction
},
h(
"view",
{
class: "lanyun-steps__item__num",
style: {
backgroundColor: isActive ? activeColor : "rgba(0,0,0,0)",
border: "1px solid " + (isActive ? activeColor : inactiveColor)
}
},
isActive
? h("image", {
class: "lanyun-steps__item__num__icon",
src: icon,
mode: "widthFix"
})
: h(
"text",
{
class: "lanyun-steps__item__num__text"
},
i + 1
)
),
h(
"text",
{
class:
"lanyun-steps__item__text lanyun-steps__item__text--" + direction,
style: {
color: isActive ? activeColor : inactiveColor
}
},
v.name
)
)
);
if (i !== list.length - 1) {
items.push(
h(
"view",
{
class: "lanyun-steps__line lanyun-steps__line--" + direction
},
h("view", {
class:
"lanyun-steps__line__border lanyun-steps__line__border--" + direction
})
)
);
}
});
return h.apply(
void 0,
[
"view",
{
class: "lanyun-steps lanyun-steps--" + direction
}
].concat(items)
);
};
};
LanyunSteps.prototype.render = function() {
return;
};
return LanyunSteps;
})(Component);
LanyunSteps.css = {
".lanyun-steps--row": {
width: "100vw",
flexDirection: "row",
alignItems: "stretch"
},
".lanyun-steps--column": {flexDirection: "column", alignItems: "flex-start"},
".lanyun-steps__item": {justifyContent: "center", alignItems: "center"},
".lanyun-steps__item__num": {
alignItems: "center",
justifyContent: "center",
width: "20px",
height: "20px",
borderRadius: "10px"
},
".lanyun-steps__item__num__icon": {width: "80%", height: "80%"},
".lanyun-steps__item__num__text": {fontSize: "12px", color: "#9ca3af"},
".lanyun-steps__item__text": {
fontSize: "12px",
fontWeight: "900",
marginTop: "4px"
},
".lanyun-steps__line__border": {backgroundColor: "#9ca3af"},
".lanyun-steps__item--row": {flexDirection: "column"},
".lanyun-steps__item__text--row": {marginTop: "4px"},
".lanyun-steps__line--row": {
flex: "1",
height: "20px",
alignItems: "center",
justifyContent: "center"
},
".lanyun-steps__line__border--row": {width: "80%", height: "1px"},
".lanyun-steps__item--column": {flexDirection: "row"},
".lanyun-steps__item__text--column": {marginLeft: "8px"},
".lanyun-steps__line--column": {
width: "20px",
height: "20px",
alignItems: "center",
justifyContent: "center"
},
".lanyun-steps__line__border--column": {
width: "1px",
height: "16px",
backgroundColor: "#9ca3af"
}
};
apivm.define("lanyun-steps", LanyunSteps);
var Index = /*@__PURE__*/ (function(Component) {
function Index(props) {
Component.call(this, props);
this.data = {
wifiName: "",
Rssi: "",
weightStatus: false,
version: "",
ledStatus: true,
//机车手
driveName: "",
ifchanche: false,
templateName: "",
templetType: "",
sbId: "",
sbList: [],
// 设备名称
carName: "",
// 是否饲喂模式中
feedStatus: true,
//显示loading图标
isImgLoading: false,
//当前饲料名称
feedName: "",
batchName: "",
// 计划重量
plan: null,
// 装载重量
feed: 0,
// 当前车总重量
planTotal: 0,
total: 0,
//班次数据
classArr: [],
//当前班次
currClassIndex: 0,
//车次数据
carArr: [],
// 当前车次
currCarIndex: 0,
//当前的步骤状态值
activeStepsNum: 0,
//计划装料列表
stepsList: [],
url: "",
//局部操作loading
loadingShow: false,
gpsList: [],
refresh: true,
socketManager: null,
socketServerClient: null,
resultInterval: null
};
}
if (Component) Index.__proto__ = Component;
Index.prototype = Object.create(Component && Component.prototype);
Index.prototype.constructor = Index;
Index.prototype.apiready = function() {
// socketManager = api.require('socketManager');
// socketServerClient = api.require('socketServerClient');
this.initPage();
api.addEventListener(
{
name: "keyback"
},
function(ret, err) {
console.log("监听到返回按键");
}
);
// if (api.systemVersion > 10) {
// this.data.ifchanche = true
// this.startServer()
// }else{
// this.data.ifchanche = false
// }
};
Index.prototype.startServer = function() {
// 平板服务
socketServerClient.startServer(
{
port: 2223,
heart: {
heartTime: 3,
heartMsg: "",
receiveMsg: ""
},
send: {
head: "",
end: "ff",
outTime: 5,
sendByLength: {
length: 8
}
},
receive: {
head: "",
end: "ff",
outTime: 5,
sendByLength: {
length: 8
}
}
},
function(ret, err) {
if (ret.status && ret.receiveMsg) {
console.log(api.deviceName + "" + ret.receiveMsg);
}
}
);
};
Index.prototype.clientConnect = function() {
var _this = this;
socketManager.createSocket(
{
host: "192.168.2.11",
port: 2223
},
function(ret, err) {
if (ret.state == 102) {
_this.writeMsg(ret.sid);
}
}
);
};
Index.prototype.writeMsg = function(sid) {
var msg = Number(Math.random() * 10000).toFixed(2);
var _this = this;
socketManager.write(
{
sid: sid,
data: msg + "ff"
},
function(ret, err) {
if (ret.status) {
_this.closeSocket(sid);
}
}
);
};
Index.prototype.closeSocket = function(sid) {
socketManager.closeSocket(
{
sid: sid
},
function(ret, err) {
if (ret.status);
}
);
};
Index.prototype.reloadPage = function() {
var _this = this;
api.confirm(
{
title: "提醒",
msg: "确认重新初始化页面么?",
buttons: ["确认", "取消"]
},
function(ret, err) {
if (1 == ret.buttonIndex) {
_this.initPage();
}
}
);
};
Index.prototype.initPage = function() {
var _this = this;
clearInterval(_this.data.resultInterval);
_this.data.resultInterval = setInterval(function() {
var feedListCache = [];
var cacheList = api.getPrefs({sync: true, key: "feedListCache"});
// 存在
if (cacheList && cacheList != "" && cacheList != "[]") {
feedListCache = JSON.parse(cacheList);
POST$1("resultUpload", feedListCache[0], {})
.then(function(ret) {
if (ret.code === 200) {
feedListCache.splice(0, 1);
api.setPrefs({
key: "feedListCache",
value: feedListCache
});
}
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
}
}, 10000);
_this.resetData();
Util.appOpen();
_this.data.wifiName = "";
_this.data.Rssi = "";
var wifi = api.require("bgnWiFi");
wifi.getWifiInfo(function(ret, err) {
if (ret.status && ret.info) {
_this.data.wifiName = ret.info.SSID;
}
});
_this.data.version = api.appVersion;
api.clearCache(function() {
console.log("清除完成");
});
// 稳定状态false
api.setGlobalData({key: "wendin", value: false});
// 定时查询是否稳定
// setInterval(function () {
// var state = api.getGlobalData({ key: 'wendin' });
// if (state) {
// _this.handleNext()
// api.setGlobalData({ key: 'wendin', value: false });
// }
// }, 2000)
// 是否开启定位
// _this.ifHasLocation()
var classArr = api.getPrefs({
sync: true,
key: "classArr"
});
if (classArr) {
_this.data.classArr = JSON.parse(classArr);
}
var carArr = api.getPrefs({
sync: true,
key: "carArr"
});
if (carArr) {
_this.data.carArr = JSON.parse(carArr);
}
var sbList = api.getPrefs({
sync: true,
key: "sbList"
});
if (sbList) {
_this.data.sbList = JSON.parse(sbList);
_this.data.sbId = JSON.parse(sbList)[0].sbId;
_this.data.carName = JSON.parse(sbList)[0].name;
}
// 获取登录信息
var loginUser = api.getPrefs({sync: true, key: "loginUser"});
var obj = JSON.parse(loginUser);
_this.data.driveName = obj.nickName;
// 查询设备列表
_this.getSbList();
// 初始化班次
_this.initTime();
// 初始化语音播报
TTSUtil.initTTS();
};
Index.prototype.handleNext = function() {
var _this = this;
var json = _this.data.stepsList;
var date = new Date();
// 获取echarts页面饲喂结果
var feedJson = api.getGlobalData({key: "feedJson"});
if (!_this.data.isImgLoading) {
_this.data.isImgLoading = true;
_this.resultUpload(date, json, feedJson);
}
};
Index.prototype.getSbList = function() {
var that = this;
GET("sbList?sourceCow=" + api.getPrefs({sync: true, key: "sourceCow"}))
.then(function(ret) {
that.data.sbId = ret.data[0].sbId;
api.setGlobalData({key: "sbId", value: that.data.sbId});
that.data.carName = ret.data[0].name;
// that.initCamera(ret.data[0])
that.data.sbList = ret.data;
api.setPrefs({
key: "sbList",
value: that.data.sbList
});
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
};
Index.prototype.initTime = function() {
var this$1 = this;
var that = this;
that.data.classArr = [];
GET("time?sourceCow=" + api.getPrefs({sync: true, key: "sourceCow"}))
.then(function(ret) {
ret.data.forEach(function(e) {
var json = {name: e.name, time: e.start + "-" + e.end, batch: e.batch};
that.data.classArr.push(json);
});
api.setPrefs({
key: "classArr",
value: that.data.classArr
});
var param = {
classCode: that.data.classArr[0].batch,
sbId: that.data.sbId,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: Util.getDateStr(new Date())
};
this$1.initTrain(param);
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
};
Index.prototype.initTrain = function(param) {
var this$1 = this;
var that = this;
that.data.feedStatus = true;
that.data.carArr = [];
that.data.feedName = "";
that.data.batchName = "";
that.data.plan = "";
that.data.stepsList = [];
POST$1("planDay", param, {})
.then(function(ret) {
if (ret.data.length == 0) {
api.toast({
msg: "该班次暂无车次信息"
});
var path =
"../html/echarts_circle.html?id=0&plan=0&total=0&beforeWeight=0&type=1";
that.data.url = path;
} else if (ret.data.length > 0) {
ret.data.forEach(function(e) {
var json = {
id: e.id,
name: "第" + e.trainNumber + "车(" + e.templetName + ")",
trainNumber: e.trainNumber,
classCode: e.classCode
};
that.data.carArr.push(json);
});
api.setPrefs({
key: "carArr",
value: that.data.carArr
});
var param = {
classCode: that.data.carArr[0].classCode,
sbId: that.data.sbId,
trainNumber: that.data.carArr[0].trainNumber,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: Util.getDateStr(new Date())
};
this$1.initOne(param);
}
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
};
Index.prototype.initOne = function(param) {
var that = this;
POST$1("planDay", param, {})
.then(function(ret) {
if (ret.data.length == 0) {
api.toast({
msg: "该车次暂无计划信息",
location: "middle"
});
}
ret.data.forEach(function(e) {
// 饲料
var feedJson = e.feedJson;
// 合并饲料和圈舍圈舍存入步骤stepsList
var json = e.feedJson.concat(e.cowshedJson);
that.data.stepsList = json;
// 获取当前步骤下标
var index = that.data.activeStepsNum;
// 根据步骤下标取stepsList的值
// 饲料名称
that.data.feedName = json[index].name;
// 班次名称
that.data.batchName =
that.data.classArr[that.data.currClassIndex].name +
that.data.carArr[that.data.currCarIndex].trainNumber;
// 计划
that.data.plan = json[index].weight.toFixed(0);
// 获取当前车次总重量,配方名称,配方类型设备id
that.data.planTotal = e.total;
that.data.templateName = e.templetName;
that.data.templetType = e.templetType;
that.data.sbId = e.sbId;
// 设备id存入缓存
api.setGlobalData({key: "sbId", value: that.data.sbId});
// 清空之前所有feedJson
api.setGlobalData({key: "feedJson", value: {}});
// 设置下一个饲料搅拌开始时间和当前饲料名称到缓存
api.setGlobalData({key: "startTime", value: Util.currTimeFn(new Date())});
api.setGlobalData({key: "feedName", value: that.data.feedName});
// 刷新echarts图表传入饲料id计划重量当前车次计划总重量之前重量未知,装料类型
// 判断是否圈舍
var batchRation = json[index].batchRation;
var path = "";
if (undefined != batchRation) {
path =
"../html/echarts_circle.html?id=" +
json[index].id +
"&plan=" +
that.data.plan +
"&total=" +
that.data.planTotal +
"&type=2&isFirst=true&allow=" +
json[index].allow;
} else {
path =
"../html/echarts_circle.html?id=" +
json[index].id +
"&plan=" +
that.data.plan +
"&total=" +
that.data.planTotal +
"&type=1&isFirst=true&allow=" +
json[index].allow;
}
that.data.url = path;
});
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
};
Index.prototype.initCamera = function(data) {
if (!data.cameraAccessToken) {
api.alert({msg: "该设备暂无摄像头信息,请检查配置"});
} else {
api.openFrame({
name: "video",
scaleEnabled: false,
url: "../html/index.html",
rect: {
x: 555,
y: 80,
w: 220,
h: 180
},
pageParam: {
data: data
}
});
}
};
Index.prototype.resultUpload = function(date, json, feedJson) {
var dateOf = Util.getDateStr(date);
var dateTime = Util.currTimeFn(date);
var _this = this;
var param = {
dateOf: dateOf,
name: _this.data.feedName,
planWeight: feedJson.plan,
rationCowAmount: json[_this.data.activeStepsNum].cow,
batchRation: json[_this.data.activeStepsNum].batchRation,
feedWeight: feedJson.feed,
feedId: feedJson.id,
driver: _this.data.driveName,
type: feedJson.type,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
classCode: _this.data.currClassIndex + 1,
trainNumber: _this.data.currCarIndex + 1,
templet: _this.data.templateName,
templetType: _this.data.templetType,
sbId: _this.data.sbId,
createBy: _this.data.driveName,
start: api.getGlobalData({key: "startTime"}),
end: Util.currTimeFn(date),
time: Util.currTimeFn(date)
};
// 数据上传
_this.data.loadingShow = true;
var feedListCache = [];
var cacheList = api.getPrefs({sync: true, key: "feedListCache"});
// 存在
if (cacheList && cacheList != "" && cacheList != "[]") {
feedListCache = JSON.parse(cacheList);
feedListCache.push(param);
api.setPrefs({
key: "feedListCache",
value: feedListCache
});
} else {
feedListCache.push(param);
api.setPrefs({
key: "feedListCache",
value: feedListCache
});
}
_this.data.isImgLoading = false;
_this.data.loadingShow = false;
// 设置下一个饲料开始时间
api.setGlobalData({key: "startTime", value: Util.currTimeFn(new Date())});
// 读取下一个饲料信息
var data = _this.data.stepsList[_this.data.activeStepsNum + 1];
if (data == undefined) {
_this.data.refresh = true;
// 计算本车此剩料
var remainWeight =
api.getGlobalData({key: "totalWeight"}) -
api.getGlobalData({key: "beforeWeight"});
if (remainWeight > 0) {
// console.log("************************************当前车次剩料******************************" + remainWeight);
var remainData = {
cowAmount: json[_this.data.activeStepsNum].cowAmount,
cowshedId: feedJson.id,
dateOf: dateOf,
remain: remainWeight,
cowshedName: _this.data.feedName,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
createBy: "app上传"
};
POST$1("resultRemainUpload", remainData, {}).then(function(ret) {
// _this.data.isImgLoading = false;
});
}
// TTSUtil.readStr({ str: "本车饲喂完成" + str, voice: "xiaoyan" })
if (_this.data.currCarIndex + 1 == _this.data.carArr.length) {
// TTSUtil.readStr({ str: "本班次饲喂完成", voice: "xiaoyan" })
_this.data.feedStatus = false;
} else {
_this.data.currCarIndex = _this.data.currCarIndex + 1;
_this.data.activeStepsNum = 0;
var param = {
classCode: _this.data.carArr[_this.data.currCarIndex].classCode,
sbId: _this.data.sbId,
trainNumber: _this.data.carArr[_this.data.currCarIndex].trainNumber,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: dateOf
};
_this.initOne(param);
}
} else {
_this.data.refresh = false;
_this.data.activeStepsNum += 1;
// 下一个index语音播报
var index = _this.data.activeStepsNum;
_this.data.feedName = json[index].name;
_this.data.batchName =
_this.data.classArr[_this.data.currClassIndex].name +
_this.data.carArr[_this.data.currCarIndex].trainNumber;
_this.data.plan = json[index].weight.toFixed(0);
_this.data.feed = 0;
// TTSUtil.readStr({ str: _this.data.feedName + _this.data.plan + "kg", voice: "xiaoyan" })
// setTimeout(() => {
// TTSUtil.readStr({ str: _this.data.feedName + _this.data.plan + "kg", voice: "xiaoyan" })
// }, 200);
// 清空之前所有feedJson
api.setGlobalData({key: "feedJson", value: {}});
// 设置下一个饲料搅拌开始时间和当前饲料名称到缓存
api.setGlobalData({key: "startTime", value: dateTime});
api.setGlobalData({key: "feedName", value: _this.data.feedName});
_this.data.url = "";
// 是否是圈舍
var batchRation = json[index].batchRation;
if (undefined != batchRation) {
var path =
"../html/echarts_circle.html?id=" +
json[index].id +
"&plan=" +
_this.data.plan +
"&total=" +
_this.data.planTotal +
"&beforeWeight=" +
feedJson.beforeWeight +
"&type=2&isFirst=false&allow=" +
json[index].allow;
} else {
var path =
"../html/echarts_circle.html?id=" +
json[index].id +
"&plan=" +
_this.data.plan +
"&total=" +
_this.data.planTotal +
"&beforeWeight=" +
feedJson.beforeWeight +
"&type=1&isFirst=false&allow=" +
json[index].allow;
}
_this.data.url = path;
}
// POST('resultUpload', param, {}).then(ret => {
// }).catch(err => {
// api.toast({
// msg: JSON.stringify(err)
// })
// })
};
Index.prototype.startGpsService = function(timeInterval) {
var that = this;
bmLocationUtil.initLoc();
setInterval(function() {
bmLocationUtil.singleLocation({}, function(ret) {
if (that.data.gpsList.length < 10) {
that.data.gpsList.push(ret.location);
} else if (that.data.gpsList.length >= 10) {
console.log("*********************GPS信息上报*********************");
var data = {
sbId: that.data.sbId,
gpsList: that.data.gpsList
};
that.gpsUpload(data);
that.data.gpsList = [];
}
});
}, timeInterval);
};
Index.prototype.gpsUpload = function(data) {
POST$1("gpsUpload", data, {})
.then(function(ret) {})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
};
Index.prototype.carsChange = function(e) {
this.data.sbId = this.data.sbList[e.detail.value].sbId;
api.setGlobalData({key: "sbId", value: this.data.sbId});
this.data.carName = this.data.sbList[e.detail.value].name;
this.initTime();
// this.initCamera(this.data.sbList[e.detail.value])
};
Index.prototype.handleCarClick = function(index, item) {
this.data.isImgLoading = false;
this.data.activeStepsNum = 0;
this.data.currCarIndex = index;
var param = {
classCode: item.classCode,
sbId: this.data.sbId,
trainNumber: item.trainNumber,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: Util.getDateStr(new Date())
};
this.initOne(param);
};
Index.prototype.handleClassClick = function(index, item) {
this.data.isImgLoading = false;
this.data.currCarIndex = 0;
this.data.activeStepsNum = 0;
this.data.feedStatus = true;
var param = {
classCode: item.batch,
sbId: this.data.sbId,
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: Util.getDateStr(new Date())
};
this.initTrain(param);
this.data.currClassIndex = index;
};
Index.prototype.showZifuka = function() {
var size = 0;
var cacheList = api.getPrefs({sync: true, key: "feedListCache"});
// 存在
if (cacheList && cacheList != "" && cacheList != "[]") {
var feedListCache = JSON.parse(cacheList);
size = feedListCache.length;
}
var msg =
"字符卡配置 " +
api.getGlobalData({key: "zfkTcp"}) +
"字符卡地址" +
api.getGlobalData({key: "addrList"});
msg +=
", 称重配置 " +
api.getGlobalData({key: "weightTcp"}) +
",未上传数据" +
size +
"条";
api.alert({msg: msg});
};
Index.prototype.handleBackSys = function() {
$("#dialog").show();
};
Index.prototype.handldeConfirmBtn = function(type) {
$("#dialog").close();
if (type === "1") {
//跳转到login.stml
api.closeWin();
api.removePrefs({
key: "token"
});
api.removePrefs({
key: "loginUser"
});
api.removePrefs({
key: "sourceCow"
});
api.clearCache(function() {
console.log("清除完成");
});
// api.removePrefs({
// key: 'feedListCache'
// });
}
};
Index.prototype.refreshDayPlan = function() {
var this$1 = this;
api.clearCache(function() {
console.log("清除完成");
});
if (this.data.refresh) {
// this.resetData()
// // 获取登录信息
// var loginUser = api.getPrefs({ sync: true, key: 'loginUser' })
// var obj = JSON.parse(loginUser);
// this.data.driveName = obj.nickName
// // 查询设备列表
// this.getSbList()
var param = {
sourceCow: api.getPrefs({sync: true, key: "sourceCow"}),
dateOf: Util.getDateStr(new Date())
};
POST$1("planDayInit", param, {})
.then(function(ret) {
this$1.initPage();
})
.catch(function(err) {
api.toast({
msg: JSON.stringify(err)
});
});
} else {
console.log(
"**********************饲喂过程中禁止刷新**********************"
);
}
};
Index.prototype.resetData = function() {
(this.data.version = ""),
(this.data.ifchanche = false),
(this.data.wifiName = "");
this.data.Rssi = "";
(this.data.total = 0), (this.data.weightStatus = false);
this.data.ledStatus = true;
this.data.driveName = "";
this.data.templateName = "";
this.data.templetType = "";
this.data.sbId = "";
this.data.sbList = [];
this.data.carName = "";
this.data.feedStatus = true;
this.data.isImgLoading = false;
this.data.feedName = "";
this.data.batchName = "";
this.data.plan = null;
this.data.feed = 0;
this.data.planTotal = 0;
this.data.total = 0;
this.data.classArr = [];
this.data.currClassIndex = 0;
this.data.carArr = [];
this.data.currCarIndex = 0;
this.data.activeStepsNum = 0;
this.data.stepsList = [];
this.data.url = "";
this.data.loadingShow = false;
this.data.gpsList = [];
this.data.refresh = true;
};
Index.prototype.ifHasLocation = function() {
var statusJson = Permission.hasPermission("location");
if (statusJson[0].granted == true);
else {
api.confirm(
{
title: "提醒",
msg: "需要开启定位权限,去设置?",
buttons: ["确认", "取消"]
},
function(ret, err) {
if (1 == ret.buttonIndex) {
Permission.reqPermission("location", function(ret, err) {
if (ret) {
if (ret.never == true) {
return;
} else {
if (ret.list[0].granted == true);
else {
return;
}
}
}
});
}
}
);
}
};
Index.prototype.render = function() {
var this$1 = this;
return apivm.h(
"view",
{class: "index_wrap"},
apivm.h("dxx-loading", {
loadingtext: "提交中",
show: this.data.loadingShow
}),
apivm.h(
"view",
{class: "index_header"},
apivm.h(
"view",
{class: "header_left"},
apivm.h(
"picker",
{
class: "picker",
range: this.data.sbList,
"range-key": "name",
mode: "selector",
onChange: this.carsChange
},
apivm.h("text", {style: "font-weight:900"}, this.data.carName)
),
apivm.h(
"button",
{
type: "button",
class: "header_btn",
style: "margin-left:25px;",
onClick: this.reloadPage
},
"初始化"
),
apivm.h(
"view",
{class: "header_led", onClick: this.showZifuka},
apivm.h(
"text",
{class: "header_led_text"},
"WIFI:",
this.data.wifiName,
this.data.Rssi
)
)
),
apivm.h(
"view",
{class: "header_right"},
apivm.h("text", {class: "left_text"}, "机车手:"),
apivm.h("text", {class: "left_text"}, this.data.driveName),
apivm.h(
"button",
{
type: "button",
class: "header_btn1",
style: "margin-left:35px;",
onClick: this.handleBackSys
},
"退出登录"
),
apivm.h(
"button",
{
type: "button",
class: "header_btn",
style: "margin-left:5px;",
onClick: this.refreshDayPlan
},
"更新配方"
)
)
),
apivm.h(
"view",
{class: "index_section"},
apivm.h(
"scroll-view",
{class: "section_left", "scroll-y": true},
(Array.isArray(this.data.carArr)
? this.data.carArr
: Object.values(this.data.carArr)
).map(function(item$1, index$1) {
return apivm.h(
"view",
{
class: "left_item",
style: {
backgroundColor:
index$1 === this$1.data.currCarIndex ? "#1482f0" : "#ffffff"
}
},
apivm.h(
"text",
{
class: "left_item_text",
onClick: function() {
return this$1.handleCarClick(index$1, item$1);
},
style: {
color: index$1 === this$1.data.currCarIndex ? "#ffffff" : "#000000"
}
},
item$1.name
)
);
})
),
apivm.h(
"view",
{class: "section_right"},
apivm.h(
"scroll-view",
{class: "section_right_scroll", "scroll-x": true},
apivm.h("lanyun-steps", {
list: this.data.stepsList,
current: this.data.activeStepsNum,
"active-color": "#1482f0",
direction: "row"
})
),
apivm.h(
"view",
{class: "right_operation"},
apivm.h(
"view",
{class: "operation_card"},
apivm.h("frame", {name: "operationCard", url: this.data.url})
),
apivm.h(
"view",
{class: "opera_item_btn"},
apivm.h(
"view",
{class: "card_col_name"},
apivm.h(
"text",
{class: "card_col_name_text"},
this.data.batchName,
","
),
apivm.h(
"text",
{class: "card_col_name_text"},
this.data.feedName,
":"
),
apivm.h("text", {class: "card_col_name_text"}, this.data.plan, "kg")
),
this.data.feedStatus
? apivm.h(
"view",
{class: "next_btn", onClick: this.handleNext},
apivm.h("image", {
src: "../image/loading.gif",
style: {display: this.data.isImgLoading ? "flex" : "none"}
}),
apivm.h("text", {class: "next_btn_text"}, "下一步")
)
: null
)
)
)
),
apivm.h(
"view",
{class: "index_footer"},
apivm.h("text", null, " V", this.data.version),
(Array.isArray(this.data.classArr)
? this.data.classArr
: Object.values(this.data.classArr)
).map(function(item$1, index$1) {
return apivm.h(
"view",
{
class: "footer_item",
style: {
backgroundColor:
index$1 === this$1.data.currClassIndex ? "#1482f0" : "#ffffff"
},
onClick: function() {
return this$1.handleClassClick(index$1, item$1);
}
},
apivm.h(
"text",
{
style: {
color: index$1 === this$1.data.currClassIndex ? "#ffffff" : "#000000"
},
class: "footer_text_one"
},
item$1.name,
"(",
item$1.time,
")"
)
);
})
),
apivm.h(
"dialog",
{id: "dialog", class: "dialog"},
apivm.h(
"view",
{class: "d-area"},
apivm.h("text", {class: "title"}, "温馨提示"),
apivm.h(
"scroll-view",
{class: "content"},
apivm.h("text", null, "是否退出当前账号?")
),
apivm.h(
"view",
{class: "nav"},
apivm.h(
"button",
{
class: "btn",
onClick: function() {
return this$1.handldeConfirmBtn("0");
}
},
"取消"
),
apivm.h(
"button",
{
class: "btn",
style: "margin-left:40px;",
onClick: function() {
return this$1.handldeConfirmBtn("1");
}
},
"确定"
)
)
)
)
);
};
return Index;
})(Component);
Index.css = {
".index_wrap": {
width: "100%",
height: "100%",
boxSizing: "border-box",
padding: "1%",
position: "relative"
},
".index_header": {
width: "100%",
height: "8vh",
boxSizing: "border-box",
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
padding: "0 30px"
},
".header_left": {
width: "50%",
display: "flex",
flexDirection: "row",
alignItems: "center"
},
".header_led": {
display: "flex",
flexDirection: "row",
alignItems: "center",
marginLeft: "10px"
},
".header_led_text": {fontSize: "14px", fontWeight: "900", color: "#0616f8"},
".header_led_circle": {
width: "20px",
height: "20px",
borderRadius: "50%",
backgroundColor: "rgb(160, 158, 158)"
},
".header_btn": {
backgroundColor: "#407ae6",
color: "#ffffff",
fontSize: "12px",
height: "30px",
fontWeight: "900",
width: "26%"
},
".header_btn1": {
fontSize: "12px",
height: "30px",
backgroundColor: "#e60d0d",
color: "#ffffff",
fontWeight: "900"
},
".header_right": {
width: "50%",
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
},
".left_text": {fontSize: "16px", fontWeight: "900"},
".index_section": {
width: "100%",
height: "86vh",
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
boxSizing: "border-box"
},
".section_left": {
width: "20%",
height: "100%",
boxSizing: "border-box",
border: "1px solid #a3caef"
},
".left_item": {
boxSizing: "border-box",
padding: "20px 0",
textAlign: "center"
},
".left_item_text": {fontSize: "16px", fontWeight: "900"},
".section_right": {
width: "80%",
height: "100%",
boxSizing: "border-box",
padding: "10px",
borderRight: "1px solid #a3caef",
borderTop: "1px solid #a3caef",
borderBottom: "1px solid #a3caef",
borderTopRightRadius: "8px",
borderBottomRightRadius: "8px"
},
".section_right_scroll": {width: "100%", height: "15vh"},
".right_operation": {
width: "100%",
height: "100%",
boxSizing: "border-box",
padding: "10px"
},
".operation_card": {
width: "100%",
height: "80%",
boxSizing: "border-box",
display: "flex",
flexDirection: "column",
alignItems: "center"
},
".card_col_name": {
width: "100%",
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
},
".opera_item_btn": {
width: "100%",
height: "20%",
textAlign: "right",
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
},
".next_btn": {
backgroundColor: "#407ae6",
height: "100%",
width: "30%",
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
borderRadius: "4px"
},
".next_btn_text": {color: "#ffffff", fontSize: "25px", fontWeight: "900"},
".card_col_name_text": {fontSize: "25px", fontWeight: "900"},
".index_footer": {
width: "100%",
height: "7vh",
boxSizing: "border-box",
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
marginTop: "10px"
},
".footer_item": {
width: "24%",
height: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
boxSizing: "border-box",
borderRadius: "4px",
marginLeft: "10px",
border: "1px solid #1482f0"
},
".footer_text_one": {fontSize: "14px", fontWeight: "900"},
".dialog": {
position: "absolute",
top: "30%",
left: "50%",
transform: "translateX(-50%)",
height: "40%",
width: "30%",
border: "1px solid #ccc",
backgroundColor: "rgb(255, 255, 255)"
},
".d-area": {height: "100%"},
".title": {
height: "40px",
fontWeight: "900",
backgroundColor: "#ccc",
lineHeight: "40px",
paddingLeft: "8px"
},
".content": {flex: "1", padding: "10px", fontWeight: "900"},
".nav": {
height: "45px",
flexDirection: "row",
padding: "0px 30px",
justifyContent: "center",
alignItems: "center",
borderTop: "1px solid #ccc"
},
".btn": {width: "100px", height: "35px", margin: "8px"}
};
apivm.define("index", Index);
apivm.render(apivm.h("index", null), "body");
})();