| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- },
- onLoad: function () {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- IsShowNull: false,
-
- });
- common.getStorageValue(that, "SearchTextList", [], function () {
- });
- },
- onShow:function(){
- this.setData({
- Focus: true,
- });
- },
- onKeyInput: function (e) {
- var search = e.detail.value;
- var that = this;
- that.setData({
- SearchInfo: search,
- });
- },
- onSearch: function (e) {
- if (e.currentTarget.dataset.search)
- this.data.SearchInfo = e.currentTarget.dataset.search;
- if (this.data.SearchInfo && this.data.SearchInfo.length > 0) {
- var search = this.data.SearchInfo;
-
- var that = this;
- var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID;
- if (search)
- url += "&Key=" + search;
- main.getData(url, function (data) {
- if (data) {
- app.globalData.CardList= data.List;
- wx.navigateTo({
- url: './searchCardList?search=' + search+'&Count='+data.Count,
- })
- }
- });
- setTimeout(function () {
- var arr = that.data.SearchTextList;
- for (var i = 0; i < arr.length; i++) {
- if (arr[i] == search) {
- arr.splice(i, 1);
- break;
- }
- }
- arr.unshift(search);
- while (arr.length > 10) {
- arr.pop();
- }
- wx.setStorageSync("SearchTextList", arr);
- that.setData({
- SearchTextList: arr,
- });
- }, 2000);
- }
- else {
- wx.showToast({
- title: '请输搜索内容',
- })
- }
- },
- close: function (e) {
- wx.navigateBack({
- delta: 1,
- });
- },
- deleteItem: function (e) {
- var that = this;
- that.setData({
- SearchTextList: [],
- });
- wx.removeStorageSync("SearchTextList");
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|