| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- },
- onLoad: function () {
- wx.hideShareMenu();
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- IsShowNull: false,
- });
- },
- onShow:function(){
- if (wx.getStorageSync("SearchNull")){
- this.setData({
- IsShowNull:true,
- })
- wx.removeStorageSync("SearchNull");
- }
- },
- onKeyInput: function (e) {
- var search = e.detail.value;
- var that = this;
- that.setData({
- SearchInfo: search,
- });
- },
- onSearch: function (e) {
- if (this.data.SearchInfo && this.data.SearchInfo.length>0){
- var search = this.data.SearchInfo;
- var arr=wx.getStorageSync("SearchWord");
- if (!arr)
- arr=[];
- var obj = {};
- obj.Key = search;
- for(var i=0;i<arr.length;i++){
- if (arr[i].Key == search){
- obj.Key = arr[i].Key;
- obj.Value = arr[i].Value;
- arr.splice(i,1);
- break;
- }
- }
- arr.unshift(obj);
- wx.setStorageSync("SearchWord", arr);
- wx.navigateTo({
- url: './searchWeb2?back=3&search=' + search+'&type=0',
- })
- }
- else{
- wx.showToast({
- title: '请输搜索内容',
- })
- }
- },
- onSearchHistory: function (e) {
- var search = e.currentTarget.dataset.search;
- var arr = wx.getStorageSync("SearchWord");
- if (!arr)
- arr = [];
- var obj = {};
- obj.Key = search;
- var b=false,type=0;
- for (var i = 0; i < arr.length; i++) {
- if (arr[i].Key == search) {
- obj.Key = arr[i].Key;
- obj.Value = arr[i].Value;
- arr.splice(i, 1);
- b=true;
- type=1
- break;
- }
- }
- if (b){
- arr.unshift(obj);
- wx.setStorageSync("SearchWord", arr);
- }
- wx.navigateTo({
- url: './searchWeb2?back=2&search=' + search + '&type='+type,
- });
- },
- close: function (e) {
- wx.navigateBack({
- delta: 1,
- });
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|