123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- const { getCategoryAPI, getAllGoods, getUserInfo, getUserInfoList, getRecommend} = require('../../API/appraise')
- const { formatTime } = require('../../utils/util')
- var getOrderOption = {
- data: {
- id: wx.getStorageSync('uid'),
- }
- }
- Page({
-
- data: {
-
- classifyList: [],
-
- scrollTop: 0,
-
- allGoods: [],
- page: 1,
- pageSize: 6,
- isLoading: false,
- time: Number,
- id: 0,
- uid: String,
- ownerId: [],
- ownerMsg: [],
- user_id: wx.getStorageSync('uid'),
- recommendNum: 6,
- newMsg: [],
- },
- userTo() {
- wx.switchTab({
- url: '/pages/user/user',
- })
- },
- classifyTo() {
- wx.switchTab({
- url: '/pages/classify/classify',
- })
- },
- messageTo() {
- wx.switchTab({
- url: '/pages/message/message',
- })
- },
- searchTo() {
- wx.navigateTo({
- url: '/pages/search/search',
- })
- },
-
- detailClassifyTo({ currentTarget }) {
- const id = currentTarget.dataset.num;
- const title = currentTarget.dataset.title;
- wx.navigateTo({
- url: '/pages/classify_detail/classify_detail?classify_id=' + id + '&title=' + title,
- })
- },
-
- onLoad(options) {
- this.getClassifyList();
-
- this.getRecommendGoods();
- this.setData({
- avatarUrl:wx.getStorageSync('avatarUrl'),
- nickName:wx.getStorageSync('nickName')
- })
- },
- getClassifyList() {
- getCategoryAPI(this.data)
- .then((res) => {
- const { code, data, mesage } = res.data;
- this.setData({
- classifyList: data
- })
- })
- },
-
- getRecommendGoods() {
- var time = formatTime(new Date());
- this.setData({
- time: time
- })
-
- wx.showLoading({
- title: '数据获取中',
- })
- getRecommend(this.data)
- .then((res) => {
- const { code, data, message } = res.data;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.setData({
- allGoods: [...this.data.allGoods, ...data],
- isLoading: true
- })
-
- }).catch((err) => {
- console.log(err);
- })
- this.setData({
- isLoading: false
- })
- },
- sendOwnerId() {
- },
-
- detailTo(e) {
- const id = e.currentTarget.dataset.id;
- const title = e.currentTarget.dataset.title;
- const price = e.currentTarget.dataset.price;
- const comImg = e.currentTarget.dataset.pic;
- const uid = e.currentTarget.dataset.uid;
-
-
-
-
-
- wx.navigateTo({
- url: '/pages/details/details?id=' + id + '&title=' + title + '&price=' + price + '&img=' + comImg + '&uid=' + uid,
- })
- },
-
- onReady() {
- },
-
- onShow() {
- },
-
- onHide() {
- },
-
- onUnload() {
- },
-
- onPullDownRefresh() {
- },
-
- onReachBottom() {
- if(this.data.isLoading) {
- this.setData({
- recommendNum: this.data.recommendNum + 6
- })
- this.getRecommendGoods()
- }
- },
-
- onShareAppMessage() {
- }
- })
|