微信API 需要查看图片缺失问题
This commit is contained in:
@@ -17,24 +17,33 @@ Page({
|
||||
}
|
||||
},
|
||||
loginAcc () {
|
||||
let that = this;
|
||||
wx.login({
|
||||
success (res) {
|
||||
if (res.code) {
|
||||
app.$api.getOpenId(res.code).then(res => {
|
||||
wx.setStorageSync("openid",res.data.openid)
|
||||
this.setData({
|
||||
noLogin : false
|
||||
})
|
||||
}, err => {
|
||||
console.log(err);
|
||||
let param = {
|
||||
appid:'wxb1f499f0a173865b',
|
||||
secret:'833eefaf9206337d6c2d643f94baef7b',
|
||||
js_code: res.code,
|
||||
grant_type: 'authorization_code'
|
||||
};
|
||||
//发起网络请求
|
||||
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 {
|
||||
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">
|
||||
<t-cell-group theme="card">
|
||||
<t-cell wx:if="{{noLogin}}" title="点击登录" description="" bind:tap="loginAcc"/>
|
||||
<t-cell wx:else title="登录成功" description="欢迎使用奎因记账!" image="/image/logo.png"/>
|
||||
<t-cell title="预算管理" arrow url="/pages/budget/index" >
|
||||
<t-icon name="tools" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="资产分类管理" arrow url="/pages/settings/account/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="支出分类管理" arrow url="/pages/settings/expend/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="收入分类管理" arrow url="/pages/settings/income/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="关于我们" arrow url="/pages/about/about" >
|
||||
<t-icon name="gift" slot="left-icon" />
|
||||
</t-cell>
|
||||
<view wx:else>
|
||||
<t-cell title="登录成功" description="欢迎使用奎因记账!" image="/image/logo.png"/>
|
||||
<t-cell title="预算管理" arrow url="/pages/budget/index" >
|
||||
<t-icon name="tools" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="资产分类管理" arrow url="/pages/settings/account/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="支出分类管理" arrow url="/pages/settings/expend/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="收入分类管理" arrow url="/pages/settings/income/index" >
|
||||
<t-icon name="setting" slot="left-icon" />
|
||||
</t-cell>
|
||||
<t-cell title="关于我们" arrow url="/pages/about/about" >
|
||||
<t-icon name="gift" slot="left-icon" />
|
||||
</t-cell>
|
||||
</view>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
<foot-tab value="label_4"/>
|
||||
|
||||
Reference in New Issue
Block a user