完成助教端 页面
This commit is contained in:
parent
80c472c1b7
commit
2caaffc581
@ -34,7 +34,6 @@ function toHome(data: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLoad(async (data: any) => {
|
onLoad(async (data: any) => {
|
||||||
console.log(data);
|
|
||||||
if (data && data.openId) {
|
if (data && data.openId) {
|
||||||
setGlobal(data);
|
setGlobal(data);
|
||||||
checkOpenId({
|
checkOpenId({
|
||||||
|
|||||||
@ -96,7 +96,6 @@ import {
|
|||||||
updateUserApi,
|
updateUserApi,
|
||||||
} from "@/api/system/login";
|
} from "@/api/system/login";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import pages from "@/pages.json";
|
|
||||||
const { getGlobal } = useDataStore();
|
const { getGlobal } = useDataStore();
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
loginName: "",
|
loginName: "",
|
||||||
@ -179,30 +178,34 @@ const handleVerify = async () => {
|
|||||||
appCode: getGlobal.type == 1 ? "ZB" : "JS",
|
appCode: getGlobal.type == 1 ? "ZB" : "JS",
|
||||||
});
|
});
|
||||||
if (result.resultCode == 1) {
|
if (result.resultCode == 1) {
|
||||||
afterLoginAction(result.result);
|
if (result.result) {
|
||||||
uni.showToast({ title: "验证成功", icon: "success" });
|
afterLoginAction(result.result);
|
||||||
if (getGlobal.type == 1) {
|
uni.showToast({ title: "验证成功", icon: "success" });
|
||||||
toHome(getGlobal);
|
if (getGlobal.type == 1) {
|
||||||
} else {
|
toHome(getGlobal);
|
||||||
const findJsByPhoneResult = await findJsByPhoneApi({
|
} else {
|
||||||
phone: formData.phone,
|
const findJsByPhoneResult = await findJsByPhoneApi({
|
||||||
});
|
phone: formData.phone,
|
||||||
if (findJsByPhoneResult.resultCode == 1) {
|
});
|
||||||
if (findJsByPhoneResult.result) {
|
if (findJsByPhoneResult.resultCode == 1) {
|
||||||
if (findJsByPhoneResult.result["confirmStatus"] == "A") {
|
if (findJsByPhoneResult.result) {
|
||||||
toHome(getGlobal);
|
if (findJsByPhoneResult.result["confirmStatus"] == "A") {
|
||||||
|
toHome(getGlobal);
|
||||||
|
} else {
|
||||||
|
setFile(findJsByPhoneResult.result);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pages/view/hr/teacherProfile/index",
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setFile(findJsByPhoneResult.result);
|
toHome(getGlobal);
|
||||||
setTimeout(() => {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: "/pages/view/hr/teacherProfile/index",
|
|
||||||
});
|
|
||||||
}, 1500);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
toHome(getGlobal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: result.message || "验证失败", icon: "none" });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: result.message || "验证失败", icon: "none" });
|
uni.showToast({ title: result.message || "验证失败", icon: "none" });
|
||||||
|
|||||||
@ -1,133 +1,189 @@
|
|||||||
import {AUTH_KEY, BASE_URL, HOMEAGENT, RESULT_CODE_NOT_LOGIN} from "@/config";
|
import { AUTH_KEY, BASE_URL, HOMEAGENT, RESULT_CODE_NOT_LOGIN } from "@/config";
|
||||||
import {useUserStore} from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import {getLogin} from "../permission";
|
import { getLogin } from "../permission";
|
||||||
import {request} from "@/utils/request/request";
|
import { request } from "@/utils/request/request";
|
||||||
import {showToast} from "@/utils/uniapp";
|
import { showToast } from "@/utils/uniapp";
|
||||||
|
|
||||||
let count: boolean = false;
|
let count: boolean = false;
|
||||||
|
|
||||||
function _loginExpiredModal() {
|
function _loginExpiredModal() {
|
||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
store.logout()
|
store.logout();
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: "提示",
|
||||||
content: '登录过期,请重新登录',
|
content: "登录过期,请重新登录",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
count = false
|
count = false;
|
||||||
getLogin()
|
getLogin();
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
count = false
|
count = false;
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.log(err)
|
console.log(err);
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
baseUrl: process.env.NODE_ENV == 'development' ? HOMEAGENT ? '/base' : BASE_URL : BASE_URL,
|
baseUrl:
|
||||||
header: {}
|
process.env.NODE_ENV == "development"
|
||||||
}
|
? HOMEAGENT
|
||||||
|
? "/base"
|
||||||
|
: BASE_URL
|
||||||
|
: BASE_URL,
|
||||||
|
header: {},
|
||||||
|
};
|
||||||
export const interceptor = {
|
export const interceptor = {
|
||||||
request: (config: UniNamespace.UploadFileOption | UniNamespace.RequestOptions) => {
|
request: (
|
||||||
const store = useUserStore();
|
config: UniNamespace.UploadFileOption | UniNamespace.RequestOptions
|
||||||
if (store.getToken) {
|
) => {
|
||||||
config.header = {
|
const store = useUserStore();
|
||||||
[AUTH_KEY]: store.getToken
|
if (store.getToken) {
|
||||||
};
|
config.header = {
|
||||||
}
|
[AUTH_KEY]: store.getToken,
|
||||||
},
|
};
|
||||||
response: (response: any) => {
|
|
||||||
if (response.data && RESULT_CODE_NOT_LOGIN == response.data.resultCode) {
|
|
||||||
if (!count) {
|
|
||||||
_loginExpiredModal()
|
|
||||||
}
|
|
||||||
count = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (response.config.name === "files") {
|
|
||||||
return JSON.parse(response.data);
|
|
||||||
}
|
|
||||||
if (response.data) {
|
|
||||||
return response.data;
|
|
||||||
} else {
|
|
||||||
console.log('接口无返回值', response)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
response: (response: any) => {
|
||||||
|
if (response.data && RESULT_CODE_NOT_LOGIN == response.data.resultCode) {
|
||||||
|
if (!count) {
|
||||||
|
_loginExpiredModal();
|
||||||
|
}
|
||||||
|
count = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.config.name === "files") {
|
||||||
|
return JSON.parse(response.data);
|
||||||
|
}
|
||||||
|
if (response.data) {
|
||||||
|
return response.data;
|
||||||
|
} else {
|
||||||
|
console.log("接口无返回值", response);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export function get<T = any>(
|
||||||
|
url: string,
|
||||||
|
data?: any,
|
||||||
|
options?: UniNamespace.RequestOptions
|
||||||
|
): Promise<Requests<T>> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request(
|
||||||
|
Object.assign(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
url,
|
||||||
|
data,
|
||||||
|
method: "GET",
|
||||||
|
dataType: "json",
|
||||||
|
responseType: "text",
|
||||||
|
},
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).then((res) => {
|
||||||
|
if (res.resultCode == 1) {
|
||||||
|
resolve(res);
|
||||||
|
} else {
|
||||||
|
if (res.resultCode) {
|
||||||
|
if (res.resultCode != RESULT_CODE_NOT_LOGIN) {
|
||||||
|
showToast(res.message || "接口异常");
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (res.rows) {
|
||||||
|
resolve(res);
|
||||||
|
} else {
|
||||||
|
showToast(res.message || "接口异常");
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get<T = any>(url: string, data?: any, options?: UniNamespace.RequestOptions): Promise<Requests<T>> {
|
export function post<T = any>(
|
||||||
return new Promise((resolve, reject) => {
|
url: string,
|
||||||
request(Object.assign({}, {
|
data?: any,
|
||||||
url,
|
options?: UniNamespace.RequestOptions
|
||||||
data,
|
): Promise<Requests<T>> {
|
||||||
method: 'GET',
|
return new Promise((resolve, reject) => {
|
||||||
dataType: 'json',
|
request(
|
||||||
responseType: 'text',
|
Object.assign(
|
||||||
}, options)).then(res => {
|
{},
|
||||||
if (res.resultCode == 1) {
|
{
|
||||||
resolve(res)
|
url,
|
||||||
} else {
|
data,
|
||||||
if (res.resultCode) {
|
method: "POST",
|
||||||
if (res.resultCode != RESULT_CODE_NOT_LOGIN) {
|
dataType: "json",
|
||||||
showToast(res.message || '接口异常')
|
responseType: "text",
|
||||||
reject(res)
|
},
|
||||||
}
|
options
|
||||||
} else {
|
)
|
||||||
if (res.rows) {
|
).then((res) => {
|
||||||
resolve(res)
|
if (res.resultCode == 1) {
|
||||||
} else {
|
resolve(res);
|
||||||
showToast(res.message || '接口异常')
|
} else {
|
||||||
reject(res)
|
if (res.resultCode) {
|
||||||
}
|
if (res.resultCode != RESULT_CODE_NOT_LOGIN) {
|
||||||
}
|
showToast(res.message || "接口异常");
|
||||||
}
|
reject(res);
|
||||||
})
|
}
|
||||||
})
|
} else {
|
||||||
|
if (res.rows) {
|
||||||
|
resolve(res);
|
||||||
|
} else {
|
||||||
|
showToast(res.message || "接口异常");
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function file(
|
||||||
export function post<T = any>(url: string, data?: any, options?: UniNamespace.RequestOptions): Promise<Requests<T>> {
|
url: string,
|
||||||
return new Promise((resolve, reject) => {
|
data: Blob,
|
||||||
request(Object.assign({}, {
|
options?: UniNamespace.UploadFileOption
|
||||||
url,
|
) {
|
||||||
data,
|
return new Promise((resolve, reject) => {
|
||||||
method: 'POST',
|
request(
|
||||||
dataType: 'json',
|
Object.assign(
|
||||||
responseType: 'text',
|
{},
|
||||||
}, options)).then(res => {
|
{
|
||||||
if (res.resultCode == 1) {
|
url,
|
||||||
resolve(res)
|
filePath: data,
|
||||||
} else {
|
name: "files",
|
||||||
if (res.resultCode) {
|
},
|
||||||
if (res.resultCode != RESULT_CODE_NOT_LOGIN) {
|
options
|
||||||
showToast(res.message || '接口异常')
|
),
|
||||||
reject(res)
|
true
|
||||||
}
|
).then((res) => {
|
||||||
} else {
|
if (res.resultCode == 1) {
|
||||||
if (res.rows) {
|
resolve(res);
|
||||||
resolve(res)
|
} else {
|
||||||
} else {
|
if (res.resultCode) {
|
||||||
showToast(res.message || '接口异常')
|
if (res.resultCode != RESULT_CODE_NOT_LOGIN) {
|
||||||
reject(res)
|
showToast(res.message || "接口异常");
|
||||||
}
|
reject(res);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
})
|
if (res.rows) {
|
||||||
})
|
resolve(res);
|
||||||
|
} else {
|
||||||
|
showToast(res.message || "接口异常");
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function file(url: string, data: Blob, options?: UniNamespace.UploadFileOption) {
|
|
||||||
return request(Object.assign({}, {
|
|
||||||
url,
|
|
||||||
filePath: data,
|
|
||||||
name: 'files',
|
|
||||||
}, options), true)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user