diff --git a/app.js b/app.js index 8da0b5b..50367a9 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,8 @@ import updateManager from './common/updateManager'; -export const ServerBasePath = 'http://localhost:8888/api/'; +// export const ServerBasePath = 'http://localhost:8888/api/'; // export const ServerBasePath = 'http://192.168.1.102:8888/api/'; -// export const ServerBasePath = 'http://mall.api.aerwen.net/api/'; +export const ServerBasePath = 'http://emo-api.aerwen.net/api/'; App({ onLaunch: function () {}, diff --git a/pages/emoticon/result/index.js b/pages/emoticon/result/index.js index 159b1b6..16e7325 100644 --- a/pages/emoticon/result/index.js +++ b/pages/emoticon/result/index.js @@ -1,5 +1,8 @@ /* eslint-disable no-param-reassign */ - +import { + getEmotionCategoryList, + getEmoticonDataList, +} from '~/services/emoticon/index'; import Toast from 'tdesign-miniprogram/toast/index'; const initFilters = { @@ -9,20 +12,11 @@ const initFilters = { Page({ data: { - emoticonDataList: [{ - emoticonDataId: 1, - emoticonDataImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emoticonDataName: "loopy表情包" - },], + emoticonDataList: [], tabList: [{ - text: "全部", - key: 0, - }, - { - text: "可爱loopy", - key: 1, - }, - ], + text: "全部", + key: 0, + }], categoryGuid: 0, overall: 1, show: false, @@ -48,14 +42,20 @@ Page({ keywords: searchValue, }, () => { + this.getCategotyList() this.init(true); }, ); }, + OnShow() { + this.getCategotyList() + }, + generalQueryData(reset = false) { const { keywords, + categoryGuid } = this.data; const { pageNum, @@ -64,8 +64,9 @@ Page({ const params = { pageNum: 1, - pageSize: 6, - goodsName: keywords, + pageSize: 10, + search: keywords, + emoticonCategoryGuid: categoryGuid }; if (reset) return params; @@ -74,16 +75,28 @@ Page({ pageNum: pageNum + 1, pageSize, }; + + }, + + getCategotyList() { + // 获取表情包分类列表 + getEmotionCategoryList().then((res) => { + if (res.code == 200) { + this.setData({ + tabList: this.data.tabList.concat(res.data), + }); + } else {} + }); }, // 点击分类 - tabChangeHandle(e) { - this.privateData.tabIndex = e.detail; + async tabChangeHandle(e) { this.setData({ categoryGuid: e.detail.value, + keywords: "" }); // 刷新列表 - this.init() + await this.init() }, async init(reset = true) { @@ -97,49 +110,49 @@ Page({ loadMoreStatus: 1, loading: true, }); - // try { - // const result = await getemoticonList(params); - // const data = result.data; - // if (result.code == 200) { - // const { - // result, - // totalPage = 0 - // } = data; - // if (totalPage === 0 && reset) { - // this.total = totalPage; - // this.setData({ - // emptyInfo: { - // tip: '抱歉,未找到相关商品', - // }, - // hasLoaded: true, - // loadMoreStatus: 0, - // loading: false, - // emoticonDataList: [], - // }); - // return; - // } + try { + const result = await getEmoticonDataList(params); + const data = result.data; + if (result.code == 200) { + const { + result, + totalPage = 0 + } = data; + if (totalPage === 0 && reset) { + this.total = totalPage; + this.setData({ + emptyInfo: { + tip: '抱歉,未找到相关表情包', + }, + hasLoaded: true, + loadMoreStatus: 0, + loading: false, + emoticonDataList: [], + }); + return; + } - // const _emoticonDataList = reset ? result : emoticonDataList.concat(result); - // const _loadMoreStatus = _emoticonDataList.length === totalPage ? 2 : 0; - // this.pageNum = params.pageNum || 1; - // this.total = totalPage; - // this.setData({ - // emoticonDataList: _emoticonDataList, - // loadMoreStatus: _loadMoreStatus, - // }); - // } else { - // this.setData({ - // loading: false, - // }); - // wx.showToast({ - // title: '查询失败,请稍候重试', - // }); - // } - // } catch (error) { - // this.setData({ - // loading: false, - // }); - // } + const _emoticonDataList = reset ? result : emoticonDataList.concat(result); + const _loadMoreStatus = _emoticonDataList.length === totalPage ? 2 : 0; + this.pageNum = params.pageNum || 1; + this.total = totalPage; + this.setData({ + emoticonDataList: _emoticonDataList, + loadMoreStatus: _loadMoreStatus, + }); + } else { + this.setData({ + loading: false, + }); + wx.showToast({ + title: '查询失败,请稍候重试', + }); + } + } catch (error) { + this.setData({ + loading: false, + }); + } this.setData({ hasLoaded: true, loading: false, diff --git a/pages/emoticon/result/index.wxml b/pages/emoticon/result/index.wxml index 23492dc..9323589 100644 --- a/pages/emoticon/result/index.wxml +++ b/pages/emoticon/result/index.wxml @@ -6,7 +6,7 @@ t-class-input="t-search__input" value="{{keywords}}" leftIcon="" - placeholder="搜索你想要的表情/头像/壁纸" + placeholder="搜索你想要的表情 / 获取码" bind:submit="handleSubmit" > diff --git a/pages/emoticon/result/index.wxss b/pages/emoticon/result/index.wxss index a88f27e..4778472 100644 --- a/pages/emoticon/result/index.wxss +++ b/pages/emoticon/result/index.wxss @@ -132,11 +132,11 @@ page view { } .last-updated-list-item{ - width: 200rpx; - height: 200rpx; + width: 220rpx; + height: 220rpx; border: 1rpx solid #E0E0E0; border-radius: 10rpx; - margin: 15rpx; + margin: 15.5rpx; overflow: hidden; } diff --git a/pages/home/home.js b/pages/home/home.js index 42dd883..3b55603 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -7,6 +7,10 @@ import { import { getSearchRecList } from '~/services/home/getSearchRecList'; +import { + getHotEmotionCategoryList, + getEmoticonDataList, +} from '~/services/emoticon/index'; import Toast from 'tdesign-miniprogram/toast/index'; Page({ @@ -17,44 +21,10 @@ Page({ key: 0, categoryGuid: 1, }], - hotCategoryList: [{ - emotionCategoryId: 1, - emotionCategoryImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emotionCategoryName: "loopy表情包" - }, - { - emotionCategoryId: 2, - emotionCategoryImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emotionCategoryName: "loopy表情包" - }, - { - emotionCategoryId: 2, - emotionCategoryImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emotionCategoryName: "loopy表情包" - }, - { - emotionCategoryId: 2, - emotionCategoryImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emotionCategoryName: "loopy表情包" - }, - { - emotionCategoryId: 2, - emotionCategoryImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emotionCategoryName: "loopy表情包" - }, - ], - lastUpdatedList: [{ - emoticonDataId: 1, - emoticonDataImg: "http://mall.api.aerwen.net/Uploads/uploads/20231029/C59225894486D6A4.jpg", - emoticonDataName: "loopy表情包" - }, ], + hotCategoryList: [], + lastUpdatedList: [], noticeList: [], popularWords: [], - marquee: { - speed: 40, - loop: -1, - delay: 0, - }, pageLoading: false, current: 0, autoplay: true, @@ -67,9 +37,13 @@ Page({ mode: 'scaleToFill', }, categoryGuid: 0, + loadMoreStatus: 0 }, - + page: { + size: 20, + num: 1, + }, privateData: { tabIndex: 0, }, @@ -84,7 +58,7 @@ Page({ // 划到底部触发 onReachBottom() { - + this.getEmocticonLastData() }, onPullDownRefresh() { @@ -102,6 +76,15 @@ Page({ pageLoading: true, }); + this.getBanner() + this.getRec() + // this.getNotice() + this.getHot() + this.getEmocticonLastData() + }, + + + getBanner() { // 获取轮播图列表 getbannerList().then((res) => { if (res.code == 200) { @@ -110,7 +93,9 @@ Page({ }); } }); + }, + getRec() { // 获取搜索推荐 getSearchRecList().then((res) => { if (res.code == 200) { @@ -120,34 +105,59 @@ Page({ }); } else {} }); - - // 获取公告列表 - // getNoticeList().then((res) => { - // if (res.code == 200) { - // const _noticeData = res.data.map((v) => { - // return { - // ...v, - // visible: true - // }; - // }); - // this.setData({ - // noticeList: _noticeData, - // pageLoading: false - // }); - // } - // }); }, - // 点击分类 - tabChangeHandle(e) { - this.privateData.tabIndex = e.detail; - this.setData({ - categoryGuid: e.detail.value, + getHot() { + // 获取热门表情包分类列表 + getHotEmotionCategoryList().then((res) => { + if (res.code == 200) { + this.setData({ + hotCategoryList: res.data, + }); + } else {} }); - // 刷新列表 - }, + getEmocticonLastData() { + const params = { + pageSize: this.page.size, + pageNum: this.page.num, + isLastUpdate: true + }; + this.setData({ + loadMoreStatus: 1, + }); + // 获取最近更新表情包列表 + getEmoticonDataList(params).then((res) => { + if (res.code == 200) { + this.page.num++; + + this.setData({ + lastUpdatedList: this.data.lastUpdatedList.concat(res.data.result), + loadMoreStatus: 0 + }); + + } else {} + }); + }, + + getNotice() { + // 获取公告列表 + getNoticeList().then((res) => { + if (res.code == 200) { + const _noticeData = res.data.map((v) => { + return { + ...v, + visible: true + }; + }); + this.setData({ + noticeList: _noticeData, + pageLoading: false + }); + } + }); + }, navToSearchPage() { diff --git a/pages/home/home.wxml b/pages/home/home.wxml index 19f3bb0..158b0c5 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -23,7 +23,7 @@ - + @@ -96,6 +96,7 @@ + diff --git a/pages/home/search/index.wxml b/pages/home/search/index.wxml index b3f8a37..dd4319d 100644 --- a/pages/home/search/index.wxml +++ b/pages/home/search/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/pages/login/login.wxml b/pages/login/login.wxml index 418aa66..4aa9944 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -2,7 +2,7 @@ - + @@ -12,19 +12,17 @@ + --> diff --git a/pages/login/login.wxss b/pages/login/login.wxss index aa4faf5..baacd8d 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -29,8 +29,8 @@ .login-container-box{ width: 90%; position: absolute; - bottom: 25%; - height: 430rpx; + top: 20%; + height: 220rpx; background-color: white; border-radius: 20rpx; } diff --git a/pages/usercenter/goods-collect/index.js b/pages/usercenter/goods-collect/index.js index fc5da62..6ca3b7a 100644 --- a/pages/usercenter/goods-collect/index.js +++ b/pages/usercenter/goods-collect/index.js @@ -35,7 +35,6 @@ Page({ return getGoodsCollectionList(params) .then((res) => { this.page.num++; - let list = []; if (res && res.data && res.data.result) { this.setData({ diff --git a/services/emoticon/index.js b/services/emoticon/index.js new file mode 100644 index 0000000..223853f --- /dev/null +++ b/services/emoticon/index.js @@ -0,0 +1,52 @@ +import { + request +} from '../_utils/request'; + +/** 获取热门表情包分类列表 */ +export function getHotEmotionCategoryList() { + return new Promise((resolve, reject) => { + request({ + url: `EmotionCategoryApi/getHotEmotionCategoryList`, + method: 'GET', + success: function (res) { + resolve(res); + }, + fail: function (error) { + reject(error); + } + }); + }); +} + +/** 获取表情包分类列表 */ +export function getEmotionCategoryList() { + return new Promise((resolve, reject) => { + request({ + url: `EmotionCategoryApi/getEmotionCategoryList`, + method: 'GET', + success: function (res) { + resolve(res); + }, + fail: function (error) { + reject(error); + } + }); + }); +} + +/** 获取表情包列表 */ +export function getEmoticonDataList(parm) { + return new Promise((resolve, reject) => { + request({ + url: `EmoticonDataApi/getEmoticonDataList`, + method: 'GET', + data: parm, + success: function (res) { + resolve(res); + }, + fail: function (error) { + reject(error); + } + }); + }); +} \ No newline at end of file diff --git a/style/theme.wxss b/style/theme.wxss index d40a9df..24da6b1 100644 --- a/style/theme.wxss +++ b/style/theme.wxss @@ -1,6 +1,6 @@ /* 主题定制 */ .root-bg-color { - background-color: #1989fa; + background-color: #F4E6CF; } .t-input { @@ -14,7 +14,7 @@ } .t-cascader { - --td-cascader-active-color: #1989fa; + --td-cascader-active-color: #F4E6CF; } .t-switch { @@ -25,13 +25,13 @@ --td-button-font-weight: 500; --td-button-medium-font-size: 32rpx; --td-button-default-color: #fff; - --td-button-default-bg-color: #1989fa; - --td-button-default-border-color: #1989fa; + --td-button-default-bg-color: #F4E6CF; + --td-button-default-border-color: #F4E6CF; --td-button-default-disabled-color: #fff; --td-button-default-disabled-bg: #cccccc; --td-button-default-disabled-border-color: #cccccc; - --td-button-default-active-bg-color: #1989fa; - --td-button-default-active-border-color: #1989fa; + --td-button-default-active-bg-color: #F4E6CF; + --td-button-default-active-border-color: #F4E6CF; } .t-textarea { @@ -39,26 +39,26 @@ } .t-checkbox { - --td-checkbox-icon-checked-color: #1989fa; + --td-checkbox-icon-checked-color: #F4E6CF; } .t-tabs { - --td-tab-item-active-color: #1989fa; - --td-tab-track-color: #1989fa; + --td-tab-item-active-color: #F4E6CF; + --td-tab-track-color: #F4E6CF; } .t-button { --td-button-default-color: #000; - --td-button-primary-text-color: #1989fa; + --td-button-primary-text-color: #F4E6CF; } .t-side-bar{ - --td-side-bar-active-color: #1989fa; - --td-side-bar-disabled-color: #1989fa; + --td-side-bar-active-color: #F4E6CF; + --td-side-bar-disabled-color: #F4E6CF; } .dialog__button-confirm { - color: #1989fa !important; + color: #F4E6CF !important; } .dialog__button-cancel {