Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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