|
- const app = getApp()
- const config = require("../../config/config")
- const Http = require("../../utils/HttpBasics.js")
- const navigationBarHeight = (getApp().statusBarHeight + 44) + "px"
- Page({
- data: {
- imgHttps: app.globalData.imgHttps,
- navigationBarHeight,
- inputValue: '',
- pageNum: 1,
- list: [],
- showFlog:false,
- id:"",//选中id
- },
- setSearchValue(e) {
- let value = e.detail.value
- this.setData({
- inputValue: value
- })
- },
- searchBtn() {
- this.setData({
- list: [],
- pageNum: 1
- })
- this.search()
- },
- cancel(){
- Http.get({
- url:config.api.Fcollect,
- data:{
- id:this.data.id
- }
- }).then(res=>{{
- tt.showToast({
- title: '已取消收藏', // 内容
- icon: "none"
- });
- }}).catch(err=>{
- tt.showToast({
- title: err.message, // 内容
- icon:"none"
- });
- })
- },
- hie(){
- this.setData({
- showFlog:false
- })
- },
- showHie(e){
- let id = e.currentTarget.dataset.id
- this.setData({
- showFlog:true,
- id:id
- })
- },
- search() {
- Http.get({
- url: config.api.mainCollet,
- data: {
- title: this.data.inputValue,
- pageNum: this.data.pageNum,
- pageSize: 8
- }
- }).then(res => {
- console.log(res);
- let temp = this.data.list
- if (this.data.pageNum > 1) {
- temp.push(res.data.list)
- this.setData({
- list: temp
- })
- } else {
- this.setData({
- list: res.data.list
- })
- }
- })
- },
- onLoad() {
- this.search()
- },
- onReachBottom: function() {
- this.setData({
- pageNum:this.data.pageNum+1
- })
- this.search()
-
- }
- })
|