tips.js 908 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var WEEK_NAME = ['周一', '周二', '周三', '周四', '周五', '周六', '周日', '周一', '周二', '周三', '周四', '周五', '周六', '周日']
  2. function tip(str) {
  3. uni.showToast({
  4. title: str,
  5. icon:"none",
  6. duration:5000
  7. })
  8. }
  9. function tips(str) {
  10. uni.showToast({
  11. title: str,
  12. icon:"success",
  13. duration:2000
  14. })
  15. }
  16. function Loding(str) {
  17. uni.showLoading({
  18. title:str,
  19. mask:true
  20. })
  21. }
  22. function HideLoding() {
  23. uni.hideLoading();
  24. }
  25. function cutting(val){
  26. var strArr = val.split("~")
  27. return strArr
  28. }
  29. function humidity(h) {
  30. if (h) {
  31. return '湿度 ' + h + '%'
  32. }
  33. return h
  34. }
  35. function formatWeeklyDate(i) {
  36. var now = getDate()
  37. var names = ['今天', '明天', '后天']
  38. if (names[i]) {
  39. return names[i]
  40. }
  41. var curWeek = now.getDay() - 1 + i
  42. return WEEK_NAME[curWeek]
  43. }
  44. export {
  45. tip,
  46. tips,
  47. Loding,
  48. HideLoding,
  49. cutting,
  50. humidity,
  51. formatWeeklyDate
  52. }