|
|
@@ -12,26 +12,12 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
-
|
|
|
+ loginStatus: false
|
|
|
},
|
|
|
- go() {
|
|
|
- if (wx.getStorageSync('userId')) {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/takePhoto/takePhoto',
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.getOpenid()
|
|
|
- }
|
|
|
- },
|
|
|
- async getOpenid() {
|
|
|
|
|
|
- let res = await cloudApi("getOpenId")
|
|
|
- let {
|
|
|
- openId
|
|
|
- } = res.result
|
|
|
- wx.setStorageSync('openId', openId)
|
|
|
+ async login() {
|
|
|
let res1 = await postApi("/user/wx/login", {
|
|
|
- openId
|
|
|
+ openId: wx.getStorageSync('openId')
|
|
|
})
|
|
|
|
|
|
if (res1.data.status == 0) {
|
|
|
@@ -63,7 +49,11 @@ Page({
|
|
|
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
- this.getOpenid()
|
|
|
+ if (wx.getStorageSync('userId') && wx.getStorageSync('shipName')) {
|
|
|
+ this.setData({
|
|
|
+ loginStatus: true
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|