|
@@ -1,4 +1,5 @@
|
|
|
// pages/index/index.js
|
|
// pages/index/index.js
|
|
|
|
|
+import { wxSetSessionKey } from "../../utils/wxUtils";
|
|
|
import { postApi } from "../../apis/api";
|
|
import { postApi } from "../../apis/api";
|
|
|
Page({
|
|
Page({
|
|
|
/**
|
|
/**
|
|
@@ -9,7 +10,18 @@ Page({
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async login() {
|
|
async login() {
|
|
|
- if (!wx.getStorageSync("openId")) return;
|
|
|
|
|
|
|
+ if (!wx.getStorageSync("openId")) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: "正在初始化登录信息...",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ duration: 1500,
|
|
|
|
|
+ });
|
|
|
|
|
+ wxSetSessionKey();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: "正在登录...",
|
|
|
|
|
+ });
|
|
|
let { data } = await postApi("/login/openid", {
|
|
let { data } = await postApi("/login/openid", {
|
|
|
openId: wx.getStorageSync("openId"),
|
|
openId: wx.getStorageSync("openId"),
|
|
|
});
|
|
});
|
|
@@ -31,10 +43,11 @@ Page({
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
|
+ wx.hideLoading();
|
|
|
wx.switchTab({
|
|
wx.switchTab({
|
|
|
url: "/pages/takePhoto/takePhoto",
|
|
url: "/pages/takePhoto/takePhoto",
|
|
|
});
|
|
});
|
|
|
- }, 1500);
|
|
|
|
|
|
|
+ }, 1000);
|
|
|
},
|
|
},
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
if (wx.getStorageSync("userId") && wx.getStorageSync("shipName")) {
|
|
if (wx.getStorageSync("userId") && wx.getStorageSync("shipName")) {
|