微信API 需要查看图片缺失问题
This commit is contained in:
@@ -18,7 +18,7 @@ Page({
|
|||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
app.$api.taskList().then(x => {
|
app.$api.getSetting(1).then(x => {
|
||||||
console.log(x);
|
console.log(x);
|
||||||
})
|
})
|
||||||
if (wx.canIUse('hideHomeButton')) {
|
if (wx.canIUse('hideHomeButton')) {
|
||||||
|
|||||||
@@ -17,24 +17,33 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
loginAcc () {
|
loginAcc () {
|
||||||
|
let that = this;
|
||||||
wx.login({
|
wx.login({
|
||||||
success (res) {
|
success (res) {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
app.$api.getOpenId(res.code).then(res => {
|
let param = {
|
||||||
wx.setStorageSync("openid",res.data.openid)
|
appid:'wxb1f499f0a173865b',
|
||||||
this.setData({
|
secret:'833eefaf9206337d6c2d643f94baef7b',
|
||||||
noLogin : false
|
js_code: res.code,
|
||||||
})
|
grant_type: 'authorization_code'
|
||||||
}, err => {
|
};
|
||||||
console.log(err);
|
//发起网络请求
|
||||||
|
wx.request({
|
||||||
|
url: 'https://api.weixin.qq.com/sns/jscode2session',
|
||||||
|
data: param,
|
||||||
|
success: function(x) {
|
||||||
|
app.$api.loginAccount({"openId":x.data.openid}).then(t=>{
|
||||||
|
wx.setStorageSync("userId",t.data)
|
||||||
|
that.setData({
|
||||||
|
noLogin : false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('登录失败!' + res.errMsg)
|
console.log('登录失败!' + res.errMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
app.$api.loginAccount(wx.getStorageSync('openid')).then(res => {
|
|
||||||
wx.setStorageSync('userId',res.data)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
<view class="my_look">
|
<view class="my_look">
|
||||||
<t-cell-group theme="card">
|
<t-cell-group theme="card">
|
||||||
<t-cell wx:if="{{noLogin}}" title="点击登录" description="" bind:tap="loginAcc"/>
|
<t-cell wx:if="{{noLogin}}" title="点击登录" description="" bind:tap="loginAcc"/>
|
||||||
<t-cell wx:else title="登录成功" description="欢迎使用奎因记账!" image="/image/logo.png"/>
|
<view wx:else>
|
||||||
<t-cell title="预算管理" arrow url="/pages/budget/index" >
|
<t-cell title="登录成功" description="欢迎使用奎因记账!" image="/image/logo.png"/>
|
||||||
<t-icon name="tools" slot="left-icon" />
|
<t-cell title="预算管理" arrow url="/pages/budget/index" >
|
||||||
</t-cell>
|
<t-icon name="tools" slot="left-icon" />
|
||||||
<t-cell title="资产分类管理" arrow url="/pages/settings/account/index" >
|
</t-cell>
|
||||||
<t-icon name="setting" slot="left-icon" />
|
<t-cell title="资产分类管理" arrow url="/pages/settings/account/index" >
|
||||||
</t-cell>
|
<t-icon name="setting" slot="left-icon" />
|
||||||
<t-cell title="支出分类管理" arrow url="/pages/settings/expend/index" >
|
</t-cell>
|
||||||
<t-icon name="setting" slot="left-icon" />
|
<t-cell title="支出分类管理" arrow url="/pages/settings/expend/index" >
|
||||||
</t-cell>
|
<t-icon name="setting" slot="left-icon" />
|
||||||
<t-cell title="收入分类管理" arrow url="/pages/settings/income/index" >
|
</t-cell>
|
||||||
<t-icon name="setting" slot="left-icon" />
|
<t-cell title="收入分类管理" arrow url="/pages/settings/income/index" >
|
||||||
</t-cell>
|
<t-icon name="setting" slot="left-icon" />
|
||||||
<t-cell title="关于我们" arrow url="/pages/about/about" >
|
</t-cell>
|
||||||
<t-icon name="gift" slot="left-icon" />
|
<t-cell title="关于我们" arrow url="/pages/about/about" >
|
||||||
</t-cell>
|
<t-icon name="gift" slot="left-icon" />
|
||||||
|
</t-cell>
|
||||||
|
</view>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
</view>
|
</view>
|
||||||
<foot-tab value="label_4"/>
|
<foot-tab value="label_4"/>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ Page({
|
|||||||
isIncome: 0,
|
isIncome: 0,
|
||||||
isAdd: 0,
|
isAdd: 0,
|
||||||
showDeleteConfirm: false,
|
showDeleteConfirm: false,
|
||||||
icon : null
|
icon : null,
|
||||||
|
accType: null
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
this.setData({
|
this.setData({
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
value="{{ '假的名称' }}"
|
value="{{ '假的名称' }}"
|
||||||
/>
|
/>
|
||||||
<t-input wx:if="{{ isAccount == 1 }}" label="分类" disabled>
|
<t-input wx:if="{{ isAccount == 1 }}" label="分类" disabled>
|
||||||
<t-radio-group slot="suffix" default-value="0" borderless t-class="box">
|
<t-radio-group slot="suffix" default-value="{{accType}}" borderless t-class="box">
|
||||||
<t-radio block="{{ false }}" label="资产账户" value="0" />
|
<t-radio block="{{ false }}" label="资产账户" value="0" />
|
||||||
<t-radio block="{{ false }}" label="负债账户" value="1" />
|
<t-radio block="{{ false }}" label="负债账户" value="1" />
|
||||||
</t-radio-group>
|
</t-radio-group>
|
||||||
|
|||||||
@@ -4,9 +4,24 @@ Page({
|
|||||||
payList: null
|
payList: null
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
let payList = app.$api.getSettings('EXPEND_SETTING');
|
app.$api.getSettings().then(setting => {
|
||||||
app.$api.
|
let payList = setting.data.EXPEND_SETTING;
|
||||||
this.setData({payList})
|
app.$api.getSettingsExpend().then(res => {
|
||||||
|
let result = res.data;
|
||||||
|
payList.forEach(item => {
|
||||||
|
let money = 0
|
||||||
|
if (result[item.id]){
|
||||||
|
money = result[item.id];
|
||||||
|
}
|
||||||
|
if (!money){
|
||||||
|
money = 0
|
||||||
|
}
|
||||||
|
item.money = money;
|
||||||
|
})
|
||||||
|
console.log(payList);
|
||||||
|
this.setData({payList})
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleClick() {
|
handleClick() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const app = getApp();
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
incomeList: [
|
incomeList: [
|
||||||
@@ -6,7 +7,24 @@ Page({
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
app.$api.getSettings().then(setting => {
|
||||||
|
let incomeList = setting.data.INCOME_SETTING;
|
||||||
|
app.$api.getSettingsIncome().then(res => {
|
||||||
|
let result = res.data;
|
||||||
|
incomeList.forEach(item => {
|
||||||
|
let money = 0
|
||||||
|
if (result[item.id]){
|
||||||
|
money = result[item.id];
|
||||||
|
}
|
||||||
|
if (!money){
|
||||||
|
money = 0
|
||||||
|
}
|
||||||
|
item.money = money;
|
||||||
|
})
|
||||||
|
console.log(incomeList);
|
||||||
|
this.setData({incomeList})
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleClick() {
|
handleClick() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
|
|||||||
80
utils/api.js
80
utils/api.js
@@ -6,7 +6,6 @@ const LOGIN_URL = 'https://api.weixin.qq.com/sns/jscode2session';
|
|||||||
// const BASE_URL = 'https://www.qnforever.top/wx';
|
// const BASE_URL = 'https://www.qnforever.top/wx';
|
||||||
function buildURL(url, needToken) {
|
function buildURL(url, needToken) {
|
||||||
let userId = wx.getStorageSync('userId');
|
let userId = wx.getStorageSync('userId');
|
||||||
console.log(url)
|
|
||||||
if (!userId && url != '/user/login') {
|
if (!userId && url != '/user/login') {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '../myself/index'
|
url: '../myself/index'
|
||||||
@@ -17,7 +16,7 @@ function buildURL(url, needToken) {
|
|||||||
})
|
})
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
}, 4000)
|
}, 2000)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (url != '/user/login'){
|
if (url != '/user/login'){
|
||||||
@@ -239,72 +238,33 @@ export function fetchGet(url, params, needToken) {
|
|||||||
// 暴露接口
|
// 暴露接口
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户唯一标识openId
|
|
||||||
*/
|
|
||||||
getOpenId(code) {
|
|
||||||
let param = {
|
|
||||||
appid:'wxb1f499f0a173865b',
|
|
||||||
secret:'833eefaf9206337d6c2d643f94baef7b',
|
|
||||||
js_code: code,
|
|
||||||
grant_type: 'authorization_code'
|
|
||||||
};
|
|
||||||
//发起网络请求
|
|
||||||
return wx.request({
|
|
||||||
url: LOGIN_URL,
|
|
||||||
data: {
|
|
||||||
appid:'wxb1f499f0a173865b',
|
|
||||||
secret:'833eefaf9206337d6c2d643f94baef7b',
|
|
||||||
js_code: res.code,
|
|
||||||
grant_type: 'authorization_code'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
loginAccount(params) {
|
loginAccount(params) {
|
||||||
return fetchPost('/user/login',params,true,false);
|
return fetchPost('/user/login',params,true,false);
|
||||||
},
|
},
|
||||||
|
getSetting(params) {
|
||||||
|
return fetchPost('user/setting/' + params,true,false);
|
||||||
|
},
|
||||||
addSetting(params) {
|
addSetting(params) {
|
||||||
return fetchPost('user/settings/add',params,true,false);
|
return fetchPost('user/settings/add',params,true,false);
|
||||||
},
|
},
|
||||||
deleteSetting(params) {
|
deleteSetting(params) {
|
||||||
return fetchPost('user/settings/delete',params,true,false);
|
return fetchPost('user/settings/delete' + params,true,false);
|
||||||
},
|
},
|
||||||
getSettings(type) {
|
getSettings() {
|
||||||
let result;
|
// let result;
|
||||||
if (type == 'INCOME_SETTING'){
|
// if (type == 'INCOME_SETTING'){
|
||||||
result = wx.getStorageSync('INCOME_SETTING');
|
// result = wx.getStorageSync('INCOME_SETTING');
|
||||||
}
|
// }
|
||||||
if (type == 'EXPEND_SETTING'){
|
// if (type == 'EXPEND_SETTING'){
|
||||||
result = wx.getStorageSync('INCOME_SETTING');
|
// result = wx.getStorageSync('INCOME_SETTING');
|
||||||
}
|
// }
|
||||||
if (type == 'ACCOUNT_SETTING'){
|
// if (type == 'ACCOUNT_SETTING'){
|
||||||
result = wx.getStorageSync('INCOME_SETTING');
|
// result = wx.getStorageSync('INCOME_SETTING');
|
||||||
}
|
// }
|
||||||
if (result){
|
// if (result){
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
let income;
|
return fetchPost('/user/settings', null, true, false);
|
||||||
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(){
|
getSettingsExpend(){
|
||||||
|
|||||||
Reference in New Issue
Block a user