resource.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const Resource = {
  2. init() {
  3. this.leftMenuClick()
  4. this.downloadEvent()
  5. this.formSubmitEvent()
  6. },
  7. leftMenuClick() {
  8. $("#category").on("click", "li a", (e) => {
  9. const className = $(e.target).attr('class').split(" ")[0]
  10. if (className.includes('content-')) {
  11. var temp = className.split('-')
  12. temp.pop()
  13. temp = '.' + temp.join("-")
  14. console.log(temp)
  15. $(temp).siblings().removeClass("show")
  16. $(temp).addClass("show")
  17. }
  18. })
  19. },
  20. downloadEvent() {
  21. $("#download-btn").click(() => {
  22. $("#download-email-dialog").removeClass("dialog-hide")
  23. $(".dialog-mask").removeClass("dialog-hide")
  24. })
  25. },
  26. formSubmitEvent() {
  27. $("#downloadFormBtn").click(() => {
  28. alert(1)
  29. Self.formAjax({
  30. email: '#formEmail',
  31. content: '#formMessage'
  32. }, 'download', this.fileDialogShow)
  33. })
  34. },
  35. fileDialogShow() {
  36. $("#download-email-dialog").addClass("dialog-hide")
  37. $("#download-file-dialog").removeClass("dialog-hide")
  38. }
  39. }
  40. Resource.init()