searchWeb.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. },
  7. onLoad: function () {
  8. wx.hideShareMenu();
  9. var that = this;
  10. that.setData({
  11. Containnerheight: main.getWindowHeight(),
  12. });
  13. },
  14. onShow:function(){
  15. var that = this;
  16. var arr = wx.getStorageSync("SearchWord2");
  17. if (!arr)
  18. arr = [];
  19. var list=[];
  20. for(var i=0;i<10;i++){
  21. if (!arr[i].Type)
  22. arr[i].Type="zici";
  23. switch(arr[i].Type){
  24. case 'zici':
  25. arr[i].TypeName = '字词';
  26. break;
  27. case 'shici':
  28. arr[i].TypeName = '诗词';
  29. break;
  30. case 'eng':
  31. arr[i].TypeName = '外语';
  32. break;
  33. }
  34. list.push(arr[i]);
  35. }
  36. that.setData({
  37. SelectList: list,
  38. });
  39. },
  40. onSearch: function (e) {
  41. wx.navigateTo({
  42. url: './searchWeb1',
  43. })
  44. },
  45. onSearchHistory: function (e) {
  46. var search = e.currentTarget.dataset.search;
  47. var searchType = e.currentTarget.dataset.searchtype;
  48. var author = e.currentTarget.dataset.author;
  49. wx.navigateTo({
  50. url: './searchWeb2?back=2&search=' + search + '&searchType=' + searchType+'&author='+author,
  51. });
  52. },
  53. onShareAppMessage: function () {
  54. return {
  55. title: app.globalData.ShareTitle,
  56. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  57. imageUrl: app.globalData.ShareImage,
  58. }
  59. },
  60. })