微信API 需要查看图片缺失问题
This commit is contained in:
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';
|
||||
function buildURL(url, needToken) {
|
||||
let userId = wx.getStorageSync('userId');
|
||||
console.log(url)
|
||||
if (!userId && url != '/user/login') {
|
||||
wx.redirectTo({
|
||||
url: '../myself/index'
|
||||
@@ -17,7 +16,7 @@ function buildURL(url, needToken) {
|
||||
})
|
||||
setTimeout(function () {
|
||||
wx.hideLoading()
|
||||
}, 4000)
|
||||
}, 2000)
|
||||
return;
|
||||
}
|
||||
if (url != '/user/login'){
|
||||
@@ -239,72 +238,33 @@ export function fetchGet(url, params, needToken) {
|
||||
// 暴露接口
|
||||
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) {
|
||||
return fetchPost('/user/login',params,true,false);
|
||||
},
|
||||
|
||||
getSetting(params) {
|
||||
return fetchPost('user/setting/' + params,true,false);
|
||||
},
|
||||
addSetting(params) {
|
||||
return fetchPost('user/settings/add',params,true,false);
|
||||
},
|
||||
deleteSetting(params) {
|
||||
return fetchPost('user/settings/delete',params,true,false);
|
||||
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;
|
||||
}
|
||||
})
|
||||
getSettings() {
|
||||
// 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;
|
||||
// }
|
||||
return fetchPost('/user/settings', null, true, false);
|
||||
},
|
||||
|
||||
getSettingsExpend(){
|
||||
|
||||
Reference in New Issue
Block a user