utils.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. export function cardType(index, card) {
  2. let type = index
  3. switch (card.status){
  4. case 1:
  5. type = 5
  6. break;
  7. case 2:
  8. type = 4
  9. break;
  10. }
  11. return type
  12. }
  13. export function navigateTo(url, query){
  14. console.log('进入页面跳转事件')
  15. if (query && Object.keys(query).length != 0) {
  16. url += '?'
  17. for (let i in query) {
  18. url += i
  19. url += '='
  20. url += query[i]
  21. url += '&'
  22. }
  23. }
  24. console.log(url, 'url')
  25. wx.navigateTo({
  26. url: url
  27. })
  28. }
  29. export function redirectTo(url, query){
  30. console.log('进入页面跳转事件')
  31. if (query && Object.keys(query).length != 0) {
  32. url += '?'
  33. for (let i in query) {
  34. url += i
  35. url += '='
  36. url += query[i]
  37. url += '&'
  38. }
  39. }
  40. console.log(url, 'url')
  41. wx.redirectTo({
  42. url: url
  43. })
  44. }
  45. // 回显数据字典
  46. export function selectDictLabel(datas, value) {
  47. var actions = [];
  48. Object.keys(datas).some((key) => {
  49. if (datas[key].value == ('' + value)) {
  50. actions.push(datas[key].label);
  51. return true;
  52. }
  53. })
  54. return actions.join('');
  55. }