| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 | const Parse = getApp().Parseconst company = getApp().globalData.companyconst dateF = require('../../../../utils/date')const rechText = require('../../../../utils/rech-text')Page({    /**     * 页面的初始数据     */    data: {        twoModal: false,        tives: 1,        region: ['江西省', '南昌市', '东湖区'], // 初始值        showheader: true,        showfoot: false,        type: '',        title: "",        show: false,        nextShow: false,        name: '',        mobile: '',        company: '',        product: ''    },    bindRegionChange: function(e) { // picker值发生改变都会触发该方法        console.log('picker发送选择改变,携带值为', e.detail.value)        this.setData({            region: e.detail.value        })    },    hideRule: function() {        this.setData({            twoModal: false        })    },    nextstep(e) {        let {            tives        } = e.currentTarget.dataset        let name = this.data.name        let mobile = this.data.mobile        if (!name || !mobile) {            wx.showToast({                title: '请将信息填写完整',                icon: 'none'            })            return        }        let myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;        if (!myreg.test(mobile)) {            wx.showToast({                title: '请填写正确手机号',                icon: 'none'            })            return        }        this.setData({            tives        })    },    prostep() {        let {            tives        } = e.currentTarget.dataset        this.setData({            tives        })    },    shopsubmit: function() {        this.setData({            twoModal: true        })    },    submit() {        let company = this.data.company        let product = this.data.product        if (!company || product) {            wx.showToast({                title: '请将信息填写完整',                icon: 'none'            })            return        }        wx.showToast({            title: '提交成功',            icon: 'success'        })    },    shoppreventTouchMove: function() {        this.setData({            twoModal: false        })    },    cancenlClicknext: function() {        this.setData({            twoModal: false        })    },    confirmClick1: function() {        console.log('确认收货了')        this.setData({            twoModal: false        })    },    go1: function() {        this.setData({            twoModal: false        })    },    showPopup() {        this.setData({            show: true        });    },    nextPopup() {        this.setData({            nextShow: true        });    },    onClose() {        this.setData({            show: false        });    },    /**     * 生命周期函数--监听页面加载     */    onLoad: async function(options) {        let title = options.title        let aid = options.aid        let showheader = true        console.log(options)        let article = await this.getArticle(aid)            // let user = article.getUser        if (options.showheader) {            showheader = true            this.setData({                showheader: true            })        }        let showfoot = false        let type = ''        if (title == '链商城') {            showfoot = true            type = 'open-shop'        }        console.log(article)        if (article && article.objectId) {            this.setData({                title: title,                article: article,                showfoot: showfoot,                type: type            })        }    },    async getArticle(aid) {        let Article = new Parse.Query('Article')        Article.include('author')        let article = await Article.get(aid)        if (article && article.id) {            console.log(article)            let articleJSON = article.toJSON()            articleJSON.date = articleJSON.publishDate ? dateF.formatTime("YYYY-mm-dd", articleJSON.publishDate.iso) : dateF.formatTime("YYYY-mm-dd", articleJSON.createdAt)            if (articleJSON.content) {                articleJSON.content = rechText.formatRichText(articleJSON.content)            }            return articleJSON        }    },    blur(e) {        let name = e.currentTarget.dataset.name        this.setData({            [name]: e.detail.value        })    },    /**     * 生命周期函数--监听页面初次渲染完成     */    onReady: function() {    },    /**     * 生命周期函数--监听页面显示     */    onShow: function() {    },    /**     * 生命周期函数--监听页面隐藏     */    onHide: function() {    },    /**     * 生命周期函数--监听页面卸载     */    onUnload: function() {    },    /**     * 页面相关事件处理函数--监听用户下拉动作     */    onPullDownRefresh: function() {    },    /**     * 页面上拉触底事件的处理函数     */    onReachBottom: function() {    },    /**     * 用户点击右上角分享     */    onShareAppMessage: function() {        let user = Parse.User.current()        let title = this.data.article.title        let aid = this.data.article.objectId        let image = this.data.article.image        let query        if (user) {            query = `invite=${user.id}&aid=${aid}`        } else {            query = `aid=${aid}`        }        return {            title: title,            query: query,            imageUrl: image,            success: function(res) {                // 转发成功            },            fail: function(res) {                // 转发失败            },        };    }})
 |