您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. import md5 from './md5.js';
  2. // import sha1 from '../sys/sha1.js';
  3. import datas from './datas.js';
  4. // import ksort from '../sys/ksort.js';
  5. import theme from './theme.js';
  6. // import config from '../../config/config.js';
  7. // import urlConfig from '../../config/urlConfig.js';
  8. // import http from './http.js'; //身份类型
  9. const common_vendor = require("../../common/vendor.js");
  10. var uni = common_vendor.index
  11. const identityData = [{
  12. id: 101,
  13. name: '身份证(含临时身份证)'
  14. },
  15. {
  16. id: 102,
  17. name: '护照(限外籍人士)'
  18. },
  19. {
  20. id: 103,
  21. name: '港澳居民来往内地通行证'
  22. },
  23. {
  24. id: 104,
  25. name: '台湾居民来往大陆通行证'
  26. },
  27. {
  28. id: 105,
  29. name: '军官证'
  30. },
  31. {
  32. id: 106,
  33. name: '武警警察身份证'
  34. },
  35. {
  36. id: 201,
  37. name: '统一社会信用代码证书'
  38. },
  39. {
  40. id: 202,
  41. name: '组织机构代码证'
  42. },
  43. {
  44. id: 203,
  45. name: '营业执照'
  46. },
  47. {
  48. id: 204,
  49. name: '事业单位法人证书'
  50. },
  51. {
  52. id: 205,
  53. name: '社会团体法人登记证书'
  54. },
  55. {
  56. id: 206,
  57. name: '律师事务所执业许可证'
  58. },
  59. {
  60. id: 217,
  61. name: '公司商业登记副本(3个月内)'
  62. },
  63. {
  64. id: 218,
  65. name: '公司营业税单M8副本'
  66. },
  67. {
  68. id: 219,
  69. name: '公司营业税开业/更改M1副本'
  70. }
  71. ];
  72. const deviceModel = [{
  73. name: '万集',
  74. value: 'WJ'
  75. },
  76. {
  77. name: '聚利',
  78. value: 'JL'
  79. },
  80. {
  81. name: '金溢',
  82. value: 'JY'
  83. },
  84. {
  85. name: '埃特斯',
  86. value: 'AT'
  87. },
  88. {
  89. name: '建投',
  90. value: 'JT'
  91. },
  92. {
  93. name: '握奇',
  94. value: 'WQ'
  95. },
  96. {
  97. name: '成谷',
  98. value: 'CG'
  99. },
  100. {
  101. name: '天地融',
  102. value: 'TD'
  103. },
  104. {
  105. name: '智载',
  106. value: 'ZZ'
  107. }
  108. ];
  109. /********************** 路由跳转 **********************/
  110. //保留当前页面,跳转到应用内的某个页面
  111. function toUrl(url) {
  112. uni.showToast({
  113. //显示消息提示框 此处是提升用户体验的作用
  114. title: '加载中',
  115. icon: 'loading'
  116. }); // if (url.indexOf("?")==-1){
  117. // url += '?rand=' + datas.randomNum(1000,9999)
  118. // }else{
  119. // url += '&rand=' + datas.randomNum(1000,9999)
  120. // }
  121. console.log('url:*****' + url);
  122. uni.navigateTo({
  123. url: url,
  124. complete: function(response) {
  125. uni.hideToast();
  126. }
  127. });
  128. } //关闭当前页面,返回上一页面或多级页面。
  129. function navigateBack(delta, successFunc = null, failFunc = null) {
  130. uni.navigateBack({
  131. delta: delta,
  132. success: function(res) {
  133. //接口调用成功的回调函数
  134. if (successFunc != null) {
  135. successFunc(res);
  136. }
  137. },
  138. fail: function(res) {
  139. //接口调用失败的回调函数
  140. if (failFunc != null) {
  141. failFunc(res);
  142. }
  143. },
  144. complete: function(res) {} //接口调用结束的回调函数(调用成功、失败都会执行)
  145. });
  146. }
  147. /********************** showModalAlert ************************/
  148. function showModalAlert(content, successFunc = null, failFunc = null, title = '温馨提示', showCancel = false) {
  149. console.log("温馨提示", title, content != "")
  150. if (content != "") {
  151. if (content == 'timeout' || content == 'creatConnectionFailure') {
  152. content = "请重新打开OBU设备蓝牙后在手机上重新搜索蓝牙设备"
  153. }
  154. // if (content.indexOf("发送数据失败")) {
  155. // content = "OBU设备蓝牙已关闭,请返回到【选择蓝牙设备】界面重新连接蓝牙设备"
  156. // }
  157. uni.showModal({
  158. title: title,
  159. content: content,
  160. showCancel: showCancel,
  161. //是否显示取消按钮
  162. cancelText: '取消',
  163. //默认是“取消”
  164. cancelColor: theme.cancelModalColor,
  165. //取消文字的颜色
  166. confirmText: '确定',
  167. //默认是“确定”
  168. confirmColor: theme.modalColor,
  169. //确定文字的颜色
  170. success: function(res) {
  171. //接口调用成功的回调函数
  172. if (successFunc != null) {
  173. successFunc(res);
  174. }
  175. },
  176. fail: function(res) {
  177. //接口调用失败的回调函数
  178. if (failFunc != null) {
  179. failFunc(res);
  180. }
  181. },
  182. complete: function(res) {} //接口调用结束的回调函数(调用成功、失败都会执行)
  183. });
  184. }
  185. }
  186. /*******************showToastAlert********************/
  187. function showToastAlert(title = '成功', icon = 'none', image = '', duration = 2000, mask = true, successFunc = null,
  188. failFunc = null, completeFun = null) {
  189. uni.showToast({
  190. title: title,
  191. icon: icon,
  192. //success显示成功图标,loading显示加载图标,none不显示图标
  193. image: image,
  194. duration: duration,
  195. mask: mask,
  196. ////是否显示透明蒙层,防止触摸穿透
  197. success: function(res) {
  198. //接口调用成功的回调函数
  199. if (successFunc != null) {
  200. successFunc(res);
  201. }
  202. },
  203. fail: function(res) {
  204. //接口调用失败的回调函数
  205. if (failFunc != null) {
  206. failFunc(res);
  207. }
  208. },
  209. complete: function(res) {
  210. //接口调用结束的回调函数(调用成功、失败都会执行)
  211. if (completeFun != null) {
  212. completeFun(res);
  213. }
  214. }
  215. });
  216. }
  217. /******************showLoadingAlert************************/
  218. function showLoadingAlert(title = '加载中...', mask = true, successFunc = null, failFunc = null, completeFun = null) {
  219. uni.showLoading({
  220. title: title,
  221. mask: mask,
  222. //是否显示透明蒙层,防止触摸穿透
  223. success: function(res) {
  224. //接口调用成功的回调函数
  225. if (successFunc != null) {
  226. successFunc(res);
  227. }
  228. },
  229. fail: function(res) {
  230. //接口调用失败的回调函数
  231. if (failFunc != null) {
  232. failFunc(res);
  233. }
  234. },
  235. complete: function(res) {
  236. //接口调用结束的回调函数(调用成功、失败都会执行)
  237. if (completeFun != null) {
  238. completeFun(res);
  239. }
  240. //添加安全锁,防止Loading不会关闭
  241. setTimeout(() => {
  242. hideLoadingAlert()
  243. }, 5000)
  244. }
  245. });
  246. }
  247. function hideLoadingAlert(successFunc = null, failFunc = null, completeFun = null) {
  248. uni.hideLoading({
  249. success: function(res) {
  250. //接口调用成功的回调函数
  251. if (successFunc != null) {
  252. successFunc(res);
  253. }
  254. },
  255. fail: function(res) {
  256. //接口调用失败的回调函数
  257. if (failFunc != null) {
  258. failFunc(res);
  259. }
  260. },
  261. complete: function(res) {
  262. //接口调用结束的回调函数(调用成功、失败都会执行)
  263. if (completeFun != null) {
  264. completeFun(res);
  265. }
  266. }
  267. });
  268. } //签名
  269. function alertF(msg) {
  270. //隐藏加载框
  271. hideLoadingAlert(); //提示对话框
  272. showModalAlert(msg);
  273. }
  274. function alertFback(msg, backcall) {
  275. //隐藏加载框
  276. hideLoadingAlert(); //提示对话框
  277. showModalAlert(msg, backcall);
  278. }
  279. /**
  280. * 车牌数字转车牌中文
  281. */
  282. function vehiclePlateStr(num, successFun) {
  283. var vehicleColorStr;
  284. switch (num) {
  285. case 0:
  286. vehicleColorStr = '蓝色';
  287. successFun(vehicleColorStr);
  288. break;
  289. case 1:
  290. vehicleColorStr = '黄色';
  291. successFun(vehicleColorStr);
  292. break;
  293. case 2:
  294. vehicleColorStr = '黑色';
  295. successFun(vehicleColorStr);
  296. break;
  297. case 3:
  298. vehicleColorStr = '白色';
  299. successFun(vehicleColorStr);
  300. break;
  301. case 4:
  302. vehicleColorStr = '渐变绿色';
  303. successFun(vehicleColorStr);
  304. break;
  305. case 5:
  306. vehicleColorStr = '黄绿双拼色';
  307. successFun(vehicleColorStr);
  308. break;
  309. case 6:
  310. vehicleColorStr = '蓝白渐变色';
  311. successFun(vehicleColorStr);
  312. break;
  313. case 7:
  314. vehicleColorStr = '临时牌照';
  315. successFun(vehicleColorStr);
  316. break;
  317. case 9:
  318. vehicleColorStr = '未确定';
  319. successFun(vehicleColorStr);
  320. break;
  321. case 11:
  322. vehicleColorStr = '绿色';
  323. successFun(vehicleColorStr);
  324. break;
  325. case 12:
  326. vehicleColorStr = '红色';
  327. successFun(vehicleColorStr);
  328. break;
  329. default:
  330. vehicleColorStr = '未知';
  331. successFun(vehicleColorStr);
  332. break;
  333. }
  334. }
  335. //字符串加密
  336. function md5Str(str) {
  337. var _str = md5.i(str);
  338. return _str;
  339. }
  340. module.exports = {
  341. toUrl,
  342. navigateBack,
  343. showModalAlert,
  344. showToastAlert,
  345. showLoadingAlert,
  346. hideLoadingAlert,
  347. // getEtcBankList,
  348. // showAlertv2,
  349. // loading,
  350. md5Str,
  351. // sha1Str,
  352. alertF,
  353. alertFback,
  354. identityData,
  355. deviceModel,
  356. // isFollow,
  357. vehiclePlateStr
  358. };