pages/search/search.js

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

var app = getApp();
Page({
    data: {
        book_name: "",
        is_alot: false,
        books: [],
        book_count: -1,
        loading: false,
        scroll_height: 0,
        button_bcolor: "#b2b2b2",
        has_school: false,
        choose_school: false,
        school: "",
        school_name: "",
        provinces: [],
        province_index: 0,
        schools: [],
        school_index: 0,
    },
    bindSearchInput: function (e) {
        this.setData({
            book_name: e.detail.value,
            book_count: -1,
            is_alot: false
        });
        if (this.data.book_name.replace(/\s+/g, "") == "") {
            this.setData({
                button_bcolor: "#b2b2b2"
            });
        } else {
            this.setData({
                button_bcolor: "#04BE02"
            });
        }
    },
    searchBooks: function (e) {
        var that = this;
        if (that.data.book_name === "") return;
        that.setData({ loading: true });
        console.log(e.detail.value)
        that.searchRequest(that.data.book_name)
    },
    searchRequest: function (book_name) {
        var that = this
        wx.request({
            url: 'https://api.getweapp.com/vendor/cornerapp/api/search',
            data: 'book=' + book_name + '&school=' + that.data.school,
            header: {
                'Content-Type': 'application/json'
            },
            success: function (res) {
                if (res.statusCode == 500) {
                    wx.showToast({
                        title: '服务器连接错误',
                        icon: 'loading',
                        duration: 1500
                    });
                    that.setData({
                        loading: false,
                    });
后面还有 147 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。