微信接口

This commit is contained in:
limqhz
2023-02-03 17:19:29 +08:00
parent c8a16e91b6
commit 23a10593c8
5 changed files with 63 additions and 13 deletions

3
app.js
View File

@@ -5,6 +5,9 @@ App({
onLaunch() {
},
globalData: {
INCOME_SETTING: 'INCOME_SETTING',
EXPEND_SETTING: 'EXPEND_SETTING',
ACCOUNT_SETTING: 'ACCOUNT_SETTING',
billIcon : [
{label: '度假', icon: '/image/bill/0.png'},
{label: '电影', icon: '/image/bill/1.png'},

View File

@@ -49,8 +49,9 @@ Page({
})
},
onConfirm (e) {
app.$api.deleteSetting();
wx.navigateBack();
this.closeDialog()
this.closeDialog();
},
closeDialog() {
this.setData({

View File

@@ -1,13 +1,12 @@
const app = getApp();
Page({
data: {
payList: [
{"name":"数码产品","money":"5000.00"},
{"name":"虚拟产品","money":"2000.00"},
{"name":"红包","money":"0.23"}
]
payList: null
},
onLoad: function (options) {
let payList = app.$api.getSettings('EXPEND_SETTING');
app.$api.
this.setData({payList})
},
handleClick() {
wx.navigateTo({

View File

@@ -8,6 +8,7 @@
</view>
</view>
</view>
<view wx:if="{{payList != null && payList.length > 0}}">
<t-cell-group theme="card">
<t-cell wx:for="{{payList}}" wx:key="index"
title="{{item.name}}"
@@ -17,4 +18,8 @@
url="../edit/index?isAccount=0&isIncome=0&isAdd=0"
/>
</t-cell-group>
</view>
<view wx:else class="empty-view" >
<t-empty icon="chart-bubble" description="暂无支出分类" />
</view>
<t-fab icon="add" bind:click="handleClick" aria-label="新增支出类型"/>

View File

@@ -17,7 +17,7 @@ function buildURL(url, needToken) {
})
setTimeout(function () {
wx.hideLoading()
}, 2000)
}, 4000)
return;
}
if (url != '/user/login'){
@@ -265,10 +265,52 @@ export default {
return fetchPost('/user/login',params,true,false);
},
/**
* 任务清单
*/
taskList(params) {
return fetchPost('/test', params, true,false);
addSetting(params) {
return fetchPost('user/settings/add',params,true,false);
},
deleteSetting(params) {
return fetchPost('user/settings/delete',params,true,false);
},
getSettings(type) {
let result;
if (type == 'INCOME_SETTING'){
result = wx.getStorageSync('INCOME_SETTING');
}
if (type == 'EXPEND_SETTING'){
result = wx.getStorageSync('INCOME_SETTING');
}
if (type == 'ACCOUNT_SETTING'){
result = wx.getStorageSync('INCOME_SETTING');
}
if (result){
return result;
}
let income;
let expend;
let account;
fetchPost('/user/settings', null, true,false).then(res => {
income = res.INCOME_SETTING;
expend = res.INCOME_SETTING;
account = res.INCOME_SETTING;
wx.setStorageSync('INCOME_SETTING',income)
wx.setStorageSync('EXPEND_SETTING',expend)
wx.setStorageSync('ACCOUNT_SETTING',account)
if (type == 'INCOME_SETTING'){
return income;
}
if (type == 'EXPEND_SETTING'){
return expend;
}
if (type == 'ACCOUNT_SETTING'){
return account;
}
})
},
getSettingsExpend(){
return fetchPost('/user/settings/expend',null,true,false);
},
getSettingsIncome(){
return fetchPost('/user/settings/income',null,true,false);
},
}