Commit 6c53cb2b by fengzhaoyu

fix:login minguserId ===>username

parent 6d50c0f3
const login = () => { const login = () => {
const app = getApp() const app = getApp()
let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data
let username = dd.getStorageSync({ key: 'username' }).data
// 有token // 有token
if(dd.getStorageSync({ key: 'token' }).data && dd.getStorageSync({ key: 'token' }).data.access_token) { if(dd.getStorageSync({ key: 'token' }).data && dd.getStorageSync({ key: 'token' }).data.access_token) {
let hasToken = dd.getStorageSync({ key: 'token' }).data; // token let hasToken = dd.getStorageSync({ key: 'token' }).data; // token
...@@ -92,8 +93,8 @@ const login = () => { ...@@ -92,8 +93,8 @@ const login = () => {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
data: { data: {
username: mingUserId, username: username,
password: mingUserId, password: username,
scope: 'server', scope: 'server',
grant_type: 'password' grant_type: 'password'
}, },
......
...@@ -54,10 +54,13 @@ Page({ ...@@ -54,10 +54,13 @@ Page({
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
success: function(res) { success: function(res) {
console.log(res,'11111111')
if(res.data.resultCode == 0) { if(res.data.resultCode == 0) {
const data = res.data.data const data = res.data.data
dd.setStorageSync({ dd.setStorageSync({
key: 'username',
data: data.username
})
dd.setStorageSync({
key: 'mingUserId', key: 'mingUserId',
data: data.mingUserId data: data.mingUserId
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment