diff --git a/api/information.js b/api/information.js
new file mode 100644
index 0000000..64ed887
--- /dev/null
+++ b/api/information.js
@@ -0,0 +1,14 @@
+import fetch from '@/common/fetch.js';
+import BASE_URL from './base.js';
+import useNetWork from '@/common/useNetWork.js';
+
+const Submit = BASE_URL + '/visitor/apply/submit'
+
+/**
+ * 提交访客记录
+ * @param {*}
+ */
+export function getSubmit(data) {
+ useNetWork();
+ return fetch.post(Submit,data).then(res => res);
+}
\ No newline at end of file
diff --git a/api/information.js b/api/information.js
new file mode 100644
index 0000000..64ed887
--- /dev/null
+++ b/api/information.js
@@ -0,0 +1,14 @@
+import fetch from '@/common/fetch.js';
+import BASE_URL from './base.js';
+import useNetWork from '@/common/useNetWork.js';
+
+const Submit = BASE_URL + '/visitor/apply/submit'
+
+/**
+ * 提交访客记录
+ * @param {*}
+ */
+export function getSubmit(data) {
+ useNetWork();
+ return fetch.post(Submit,data).then(res => res);
+}
\ No newline at end of file
diff --git a/api/user.js b/api/user.js
index aa157f6..5172366 100644
--- a/api/user.js
+++ b/api/user.js
@@ -1,11 +1,37 @@
-import fetch from '@/common/fetch.js';
-import BASE_URL from './base.js';
-import useNetWork from '@/common/useNetWork.js';
-
-const LOGIN = BASE_URL + '/user/getLoginToken';
+import fetch from "@/common/fetch.js";
+import BASE_URL from "./base.js";
+import useNetWork from "@/common/useNetWork.js";
+const LOGIN = BASE_URL + "/user/getLoginToken";
+const UserType = BASE_URL + "/user/getUserType";
+const UserRegister = BASE_URL + "/user/userRegister";
+const UpdateUserImg = BASE_URL + "/user/updateUserImg";
export function login(code) {
- useNetWork();
+ useNetWork();
const params = `${LOGIN}?code=${code}`;
- return fetch.get(params).then(res => res);
-}
\ No newline at end of file
+ return fetch.get(params).then((res) => res);
+}
+
+/**
+ * 获取到用户类型
+ * @param {*}
+ */
+export function getUserType() {
+ useNetWork();
+ return fetch.get(UserType).then((res) => res);
+}
+
+/**
+ * 注册
+ * @param {*}
+ */
+export function getUserRegister(data) {
+ useNetWork();
+ const params = {
+ phone: data.phone,
+ account: data.account,
+ name: data.name,
+ salt: data.salt,
+ };
+ return fetch.post(UserRegister, params).then((res) => res);
+}
diff --git a/api/information.js b/api/information.js
new file mode 100644
index 0000000..64ed887
--- /dev/null
+++ b/api/information.js
@@ -0,0 +1,14 @@
+import fetch from '@/common/fetch.js';
+import BASE_URL from './base.js';
+import useNetWork from '@/common/useNetWork.js';
+
+const Submit = BASE_URL + '/visitor/apply/submit'
+
+/**
+ * 提交访客记录
+ * @param {*}
+ */
+export function getSubmit(data) {
+ useNetWork();
+ return fetch.post(Submit,data).then(res => res);
+}
\ No newline at end of file
diff --git a/api/user.js b/api/user.js
index aa157f6..5172366 100644
--- a/api/user.js
+++ b/api/user.js
@@ -1,11 +1,37 @@
-import fetch from '@/common/fetch.js';
-import BASE_URL from './base.js';
-import useNetWork from '@/common/useNetWork.js';
-
-const LOGIN = BASE_URL + '/user/getLoginToken';
+import fetch from "@/common/fetch.js";
+import BASE_URL from "./base.js";
+import useNetWork from "@/common/useNetWork.js";
+const LOGIN = BASE_URL + "/user/getLoginToken";
+const UserType = BASE_URL + "/user/getUserType";
+const UserRegister = BASE_URL + "/user/userRegister";
+const UpdateUserImg = BASE_URL + "/user/updateUserImg";
export function login(code) {
- useNetWork();
+ useNetWork();
const params = `${LOGIN}?code=${code}`;
- return fetch.get(params).then(res => res);
-}
\ No newline at end of file
+ return fetch.get(params).then((res) => res);
+}
+
+/**
+ * 获取到用户类型
+ * @param {*}
+ */
+export function getUserType() {
+ useNetWork();
+ return fetch.get(UserType).then((res) => res);
+}
+
+/**
+ * 注册
+ * @param {*}
+ */
+export function getUserRegister(data) {
+ useNetWork();
+ const params = {
+ phone: data.phone,
+ account: data.account,
+ name: data.name,
+ salt: data.salt,
+ };
+ return fetch.post(UserRegister, params).then((res) => res);
+}
diff --git a/common/fetch.js b/common/fetch.js
index c3fef09..ff5a1ed 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -1,37 +1,38 @@
import useNetWork from "./useNetWork.js";
-import { useStore } from 'vuex';
-import { getLogin } from '@/utils/auth.js';
+import { useStore } from "vuex";
+import { getLogin } from "@/utils/auth.js";
function fetch(method) {
- return function(url, data, otherParams = {}) {
-
+ return function (url, data, otherParams = {}) {
// if (method === 'POST' || method === 'PUT') {
// data = {
// param: data,
// };
// }
- const sessionId = uni.getStorageSync('sessionId');
- //定时器
+ const sessionId = uni.getStorageSync("sessionId");
+ //定时器
return new Promise((resolve, reject) => {
uni.request({
url,
method,
data,
- header: {
- token: sessionId
- },
+ header: {
+ token: sessionId,
+ },
success(data) {
if (data.statusCode === 200) {
if (data.data.code === 200) {
resolve(data.data.data);
- } else if(data.data.code === 2401) { //登陆过期
- getLogin();
- } else {
- uni.showToast({
- title: '系统异常,请稍后再试!',
- icon: 'none',
- duration: 2000,
- })
+ } else if (data.data.code === 2401) {
+ //登陆过期
+ getLogin();
+ } else {
+ uni.showToast({
+ title: "系统异常,请稍后再试!",
+ title: `${data.data.message}`,
+ icon: "none",
+ duration: 2000,
+ });
reject(data);
}
} else {
@@ -48,12 +49,12 @@
}
export default {
- get: fetch('GET'),
- post: fetch('POST'),
- put: fetch('PUT'),
- delete: fetch('DELETE'),
- connect: fetch('CONNECT'),
- head: fetch('HEAD'),
- options: fetch('OPTIONS'),
- trace: fetch('TRACE'),
-}
\ No newline at end of file
+ get: fetch("GET"),
+ post: fetch("POST"),
+ put: fetch("PUT"),
+ delete: fetch("DELETE"),
+ connect: fetch("CONNECT"),
+ head: fetch("HEAD"),
+ options: fetch("OPTIONS"),
+ trace: fetch("TRACE"),
+};
diff --git a/api/information.js b/api/information.js
new file mode 100644
index 0000000..64ed887
--- /dev/null
+++ b/api/information.js
@@ -0,0 +1,14 @@
+import fetch from '@/common/fetch.js';
+import BASE_URL from './base.js';
+import useNetWork from '@/common/useNetWork.js';
+
+const Submit = BASE_URL + '/visitor/apply/submit'
+
+/**
+ * 提交访客记录
+ * @param {*}
+ */
+export function getSubmit(data) {
+ useNetWork();
+ return fetch.post(Submit,data).then(res => res);
+}
\ No newline at end of file
diff --git a/api/user.js b/api/user.js
index aa157f6..5172366 100644
--- a/api/user.js
+++ b/api/user.js
@@ -1,11 +1,37 @@
-import fetch from '@/common/fetch.js';
-import BASE_URL from './base.js';
-import useNetWork from '@/common/useNetWork.js';
-
-const LOGIN = BASE_URL + '/user/getLoginToken';
+import fetch from "@/common/fetch.js";
+import BASE_URL from "./base.js";
+import useNetWork from "@/common/useNetWork.js";
+const LOGIN = BASE_URL + "/user/getLoginToken";
+const UserType = BASE_URL + "/user/getUserType";
+const UserRegister = BASE_URL + "/user/userRegister";
+const UpdateUserImg = BASE_URL + "/user/updateUserImg";
export function login(code) {
- useNetWork();
+ useNetWork();
const params = `${LOGIN}?code=${code}`;
- return fetch.get(params).then(res => res);
-}
\ No newline at end of file
+ return fetch.get(params).then((res) => res);
+}
+
+/**
+ * 获取到用户类型
+ * @param {*}
+ */
+export function getUserType() {
+ useNetWork();
+ return fetch.get(UserType).then((res) => res);
+}
+
+/**
+ * 注册
+ * @param {*}
+ */
+export function getUserRegister(data) {
+ useNetWork();
+ const params = {
+ phone: data.phone,
+ account: data.account,
+ name: data.name,
+ salt: data.salt,
+ };
+ return fetch.post(UserRegister, params).then((res) => res);
+}
diff --git a/common/fetch.js b/common/fetch.js
index c3fef09..ff5a1ed 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -1,37 +1,38 @@
import useNetWork from "./useNetWork.js";
-import { useStore } from 'vuex';
-import { getLogin } from '@/utils/auth.js';
+import { useStore } from "vuex";
+import { getLogin } from "@/utils/auth.js";
function fetch(method) {
- return function(url, data, otherParams = {}) {
-
+ return function (url, data, otherParams = {}) {
// if (method === 'POST' || method === 'PUT') {
// data = {
// param: data,
// };
// }
- const sessionId = uni.getStorageSync('sessionId');
- //定时器
+ const sessionId = uni.getStorageSync("sessionId");
+ //定时器
return new Promise((resolve, reject) => {
uni.request({
url,
method,
data,
- header: {
- token: sessionId
- },
+ header: {
+ token: sessionId,
+ },
success(data) {
if (data.statusCode === 200) {
if (data.data.code === 200) {
resolve(data.data.data);
- } else if(data.data.code === 2401) { //登陆过期
- getLogin();
- } else {
- uni.showToast({
- title: '系统异常,请稍后再试!',
- icon: 'none',
- duration: 2000,
- })
+ } else if (data.data.code === 2401) {
+ //登陆过期
+ getLogin();
+ } else {
+ uni.showToast({
+ title: "系统异常,请稍后再试!",
+ title: `${data.data.message}`,
+ icon: "none",
+ duration: 2000,
+ });
reject(data);
}
} else {
@@ -48,12 +49,12 @@
}
export default {
- get: fetch('GET'),
- post: fetch('POST'),
- put: fetch('PUT'),
- delete: fetch('DELETE'),
- connect: fetch('CONNECT'),
- head: fetch('HEAD'),
- options: fetch('OPTIONS'),
- trace: fetch('TRACE'),
-}
\ No newline at end of file
+ get: fetch("GET"),
+ post: fetch("POST"),
+ put: fetch("PUT"),
+ delete: fetch("DELETE"),
+ connect: fetch("CONNECT"),
+ head: fetch("HEAD"),
+ options: fetch("OPTIONS"),
+ trace: fetch("TRACE"),
+};
diff --git a/pages/information/information.vue b/pages/information/information.vue
index 9031fe3..fac0620 100644
--- a/pages/information/information.vue
+++ b/pages/information/information.vue
@@ -1,197 +1,217 @@
-
-
-
-
-
-
-
-
-
-
-
- {{callerInfo.purpose || '请选择访客目的'}}
-
-
-
-
- {{callerInfo.building || '请选择访客楼栋'}}
-
-
-
-
-
- {{`开始时间:${callerInfo.time}`}}
- {{`结束时间:${callerInfo.endTime}`}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 信息提交成功,请等待物业管理员处理。
-
+
+
+
+
+
+
+
+
+
+
+
+ {{callerInfo.visitReason || '请选择访客目的'}}
+
+
+
+
+
+ {{callerInfo.visitPosition || '请选择访客楼栋'}}
+
+
+
+
+
+ {{`开始时间:${callerInfo.inTime}`}}
+ {{`结束时间:${callerInfo.outTime}`}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+ 信息提交成功,请等待物业管理员处理。
+
+
+
+
+
+
+
+
- {{isForm ? '提交' : '完成'}}
+ {{isForm ? '提交' : '完成'}}