diff --git a/app.json b/app.json index e20360c..124079b 100644 --- a/app.json +++ b/app.json @@ -18,7 +18,10 @@ "pages/rechargeDetail/index", "pages/updateInvoice/index", "pages/rechargeWay/index", - "pages/publicTransfer/index" + "pages/publicTransfer/index", + "pages/special/index", + "pages/encyclopedia/index", + "pages/encyclopediaDetail/index" ], "subPackages": [ { @@ -38,6 +41,12 @@ "iconPath": "/assets/tabbar/home.png", "selectedIconPath": "/assets/tabbar/home_select.png" }, + { + "pagePath": "pages/special/index", + "text": "专区", + "iconPath": "/assets/tabbar/special.png", + "selectedIconPath": "/assets/tabbar/special_select.png" + }, { "pagePath": "pages/my/index", "text": "我的", diff --git a/assets/tabbar/special.png b/assets/tabbar/special.png new file mode 100644 index 0000000..475ff5e Binary files /dev/null and b/assets/tabbar/special.png differ diff --git a/assets/tabbar/special_select.png b/assets/tabbar/special_select.png new file mode 100644 index 0000000..5fb8c95 Binary files /dev/null and b/assets/tabbar/special_select.png differ diff --git a/components/pagination/index.wxml b/components/pagination/index.wxml index 4005047..4d599db 100644 --- a/components/pagination/index.wxml +++ b/components/pagination/index.wxml @@ -14,4 +14,3 @@ -{{totalPage}} diff --git a/pages/encyclopedia/components/item/index.js b/pages/encyclopedia/components/item/index.js new file mode 100644 index 0000000..ac915a0 --- /dev/null +++ b/pages/encyclopedia/components/item/index.js @@ -0,0 +1,59 @@ +import { getEncyclopediaList } from "../../../../service/system"; +import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../../../utils/index"; +import request from "../../../../utils/request" +const { OK } = request; +// pages/encyclopedia/components/item/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + id: String + }, + + /** + * 组件的初始数据 + */ + data: { + page: 1, + list: [], + }, + lifetimes: { + attached() { + console.log('----------=========') + this.getData(); + } + }, + /** + * 组件的方法列表 + */ + methods: { + async getData() { + console.log(this.data.page, this.data.id, this.id) + const page = this.data.page; + const id = this.id; + const { code, data, message, total } = await getEncyclopediaList(id, page); + if (code !== OK) { + alertInfo(message) + return; + } + this.setData({ list: data, totalPage: Math.ceil(total / 20) }); + }, + jumpToDetail(e) { + console.log('e', e) + wx.navigateTo({ + url: `/pages/encyclopediaDetail/index?id=${e.currentTarget.dataset.data.id}`, + }) + }, + async onChangePage(e) { + const page = e.detail.currentIndex; + const that = this; + this.setData({ + page + }, () => { + that.getData(); + }) + }, + } +}) \ No newline at end of file diff --git a/pages/encyclopedia/components/item/index.json b/pages/encyclopedia/components/item/index.json new file mode 100644 index 0000000..be620b1 --- /dev/null +++ b/pages/encyclopedia/components/item/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "pagination": "/components/pagination/index", + "navigator": "/components/navigator/index", + "van-field": "@vant/weapp/field/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/encyclopedia/components/item/index.wxml b/pages/encyclopedia/components/item/index.wxml new file mode 100644 index 0000000..1e33446 --- /dev/null +++ b/pages/encyclopedia/components/item/index.wxml @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/pages/encyclopedia/components/item/index.wxss b/pages/encyclopedia/components/item/index.wxss new file mode 100644 index 0000000..df85e8e --- /dev/null +++ b/pages/encyclopedia/components/item/index.wxss @@ -0,0 +1 @@ +/* pages/encyclopedia/components/item/index.wxss */ \ No newline at end of file diff --git a/pages/encyclopedia/index.js b/pages/encyclopedia/index.js new file mode 100644 index 0000000..772df41 --- /dev/null +++ b/pages/encyclopedia/index.js @@ -0,0 +1,87 @@ +// pages/encyclopedia/index.js +import { getCategoryList } from '../../service/system' +import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index"; +import request from "../../utils/request" +const { OK } = request; +Page({ + + /** + * 页面的初始数据 + */ + data: { + categoryList: [], + active: 0, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.init(); + }, + + async init() { + const { data, code, message } = await getCategoryList(); + if (code !== OK) { + alertInfo(message); + return + } + this.setData({ + categoryList: data + }) + }, + onChange(e) { + console.log('e', e) + this.setData({ + active: e.detail.index, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/encyclopedia/index.json b/pages/encyclopedia/index.json new file mode 100644 index 0000000..306142e --- /dev/null +++ b/pages/encyclopedia/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "item": "./components/item/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/encyclopedia/index.wxml b/pages/encyclopedia/index.wxml new file mode 100644 index 0000000..93d41df --- /dev/null +++ b/pages/encyclopedia/index.wxml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/pages/encyclopedia/index.wxss b/pages/encyclopedia/index.wxss new file mode 100644 index 0000000..e67e696 --- /dev/null +++ b/pages/encyclopedia/index.wxss @@ -0,0 +1 @@ +/* pages/encyclopedia/index.wxss */ \ No newline at end of file diff --git a/pages/encyclopediaDetail/index.js b/pages/encyclopediaDetail/index.js new file mode 100644 index 0000000..2eacec4 --- /dev/null +++ b/pages/encyclopediaDetail/index.js @@ -0,0 +1,77 @@ +// pages/encyclopediaDetail/index.js +import { getEncyclopediaDetail } from "../../service/system"; +import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index"; +import request from "../../utils/request" +const { OK } = request; +Page({ + + /** + * 页面的初始数据 + */ + data: { + detail: {}, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.init(options.id) + }, + async init(id) { + const { code, data, message } = await getEncyclopediaDetail(id); + if (code !== OK) { + alertInfo(message) + return; + } + this.setData({ detail: data }); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/encyclopediaDetail/index.json b/pages/encyclopediaDetail/index.json new file mode 100644 index 0000000..a6d770b --- /dev/null +++ b/pages/encyclopediaDetail/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/encyclopediaDetail/index.wxml b/pages/encyclopediaDetail/index.wxml new file mode 100644 index 0000000..691d43d --- /dev/null +++ b/pages/encyclopediaDetail/index.wxml @@ -0,0 +1,6 @@ + + + + {{detail.title}} + {{detail.content}} + diff --git a/pages/encyclopediaDetail/index.wxss b/pages/encyclopediaDetail/index.wxss new file mode 100644 index 0000000..c5e5a07 --- /dev/null +++ b/pages/encyclopediaDetail/index.wxss @@ -0,0 +1,14 @@ +/* pages/encyclopediaDetail/index.wxss */ +.contentWrapper { + padding: 30rpx +} +.title { + margin-top: 12rpx; + font-weight: 600; + font-size: 48rpx; +} + +.content { + margin-top: 40rpx; + +} \ No newline at end of file diff --git a/pages/handleLogin/index.js b/pages/handleLogin/index.js index 87ab42f..2ac8d9c 100644 --- a/pages/handleLogin/index.js +++ b/pages/handleLogin/index.js @@ -22,11 +22,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - const { canBack } = options - console.log('cnaback', canBack) - if (canBack === 'false') { - this.setData({ canBack: false }) - } + }, onChangeName(e) { this.setData({ diff --git a/pages/handleLogin/index.wxml b/pages/handleLogin/index.wxml index 67a3e47..d23c8a9 100644 --- a/pages/handleLogin/index.wxml +++ b/pages/handleLogin/index.wxml @@ -1,6 +1,6 @@ - + diff --git a/pages/home/index.js b/pages/home/index.js index 25fae78..fa89ba1 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -269,9 +269,11 @@ Page({ } if (!data?.length) { alertInfo("尚无信息") + setTimeout(() => { + wx.clearStorageSync() wx.redirectTo({ - url: '/pages/handleLogin/index?back=false', + url: '/pages/login/index', }) }, 500) return; diff --git a/pages/special/index.js b/pages/special/index.js new file mode 100644 index 0000000..6b17e42 --- /dev/null +++ b/pages/special/index.js @@ -0,0 +1,96 @@ +// pages/special/index.js +import { getServicesList } from '../../service/system' +import request from '../../utils/request' +import { alertInfo } from '../../utils/index' +const { OK } = request; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + servicesList: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + async init() { + const { code, message, data } = await getServicesList() + if (code !== OK) { + alertInfo(message); + return; + } + this.setData({ servicesList: data }) + }, + clickService(e) { + console.log('e', e) + const { type, value } = e.currentTarget.dataset.data; + switch(type) { + case 0: + const [appId, path] = value.split(",") + wx.navigateToMiniProgram({ + appId: appId, + path: path + }) + break; + case 1: + wx.navigateTo({ + url: value, + }) + break; + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.init() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/special/index.json b/pages/special/index.json new file mode 100644 index 0000000..73912f2 --- /dev/null +++ b/pages/special/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "van-image": "@vant/weapp/image/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/special/index.wxml b/pages/special/index.wxml new file mode 100644 index 0000000..feca8d5 --- /dev/null +++ b/pages/special/index.wxml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pages/special/index.wxss b/pages/special/index.wxss new file mode 100644 index 0000000..4245294 --- /dev/null +++ b/pages/special/index.wxss @@ -0,0 +1,6 @@ +/* pages/special/index.wxss */ +.image { + width: 100%; + height: auto; + padding: 40rpx; +} \ No newline at end of file diff --git a/service/system.js b/service/system.js index b018172..db5407a 100644 --- a/service/system.js +++ b/service/system.js @@ -29,4 +29,24 @@ export const deleteOption = async function() { // 提交意见反馈 export const aboutUs = async function() { return await GET(`/wx/aboutUs`); +} + +// 获取特色服务列表 +export const getServicesList = async function() { + return await GET(`/wx/getServicesList?status=2`); +} + +// 获取分类列表 +export const getCategoryList = async function() { + return await GET(`/wx/getCategoryList?status=2`); +} + +// 获取分类列表 +export const getEncyclopediaList = async function(categoryId, page) { + return await GET(`/wx/getEncyclopedia?status=2&page=${page}&categoryId=${categoryId}`); +} + +// 获取分类列表 +export const getEncyclopediaDetail = async function(id) { + return await GET(`/wx/getEncyclopediaDetail/${id}`); } \ No newline at end of file