From a32cb2d4a330753ef41c4ad28aafce6fbef97441 Mon Sep 17 00:00:00 2001 From: ctw <> Date: Fri, 3 Jan 2025 09:15:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=BA=E8=84=B8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 +- src/pages/humanFace/apply.vue | 84 +++++------ src/pages/humanFace/list.vue | 21 ++- src/pages/tabbar/my.vue | 2 +- src/pages/test/login.vue | 136 +++++++++--------- src/sheep/api/face.ts | 72 +++++----- .../tm-ui/components/tm-image/tm-image.vue | 2 +- .../tm-ui/components/tm-modal/tm-modal.vue | 2 +- .../tm-upload-photo/tm-upload-photo.vue | 2 +- 9 files changed, 170 insertions(+), 154 deletions(-) diff --git a/.env b/.env index ac3612c..c151b05 100644 --- a/.env +++ b/.env @@ -2,7 +2,8 @@ # VITE_APP_DEV_SERVICE =http://123.156.230.15:8089/app-api # VITE_APP_DEV_SERVICE =http://123.156.228.134:48080/app-api -VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api +# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api +VITE_APP_DEV_SERVICE = http://192.168.101.24:48080/app-api # ******************** end 开发环境 end ******************** diff --git a/src/pages/humanFace/apply.vue b/src/pages/humanFace/apply.vue index e4bd496..f19ae3f 100644 --- a/src/pages/humanFace/apply.vue +++ b/src/pages/humanFace/apply.vue @@ -1,10 +1,11 @@ diff --git a/src/pages/humanFace/list.vue b/src/pages/humanFace/list.vue index ac657b6..20408ad 100644 --- a/src/pages/humanFace/list.vue +++ b/src/pages/humanFace/list.vue @@ -19,7 +19,10 @@ {{ v.username }} - 删除 + 修改 + + + @@ -67,6 +70,22 @@ const doAdd = () => { router.jump("/pages/humanFace/apply"); }; +const doEdit = (id: string) => { + router.jump("/pages/humanFace/apply", { type: "edit", id }); +}; + +const doDel = (id: string) => { + faceApi.del({ id }).then( + () => { + uni.showToast({ title: "删除成功", icon: "none" }); + pageRef.value.reload(true); + }, + () => { + uni.showToast({ title: "删除失败", icon: "none" }); + } + ); +}; + const doCard = (v: any) => { // if (v.status == 2) { // router.jump("/pages/apply/stride-items", { id: v.id }); diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 4b1731c..0d57805 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -14,7 +14,7 @@ const data = { { text: "外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" }, { text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" }, { text: "人脸管理", icon: "/static/icon/login.png", router: "/pages/humanFace/list" }, - { text: "测试登陆", icon: "/static/icon/login.png", router: "/pages/test/login" }, + { text: "测试登录", icon: "/static/icon/login.png", router: "/pages/test/login" }, ], }; diff --git a/src/pages/test/login.vue b/src/pages/test/login.vue index a66a0e7..30a1319 100644 --- a/src/pages/test/login.vue +++ b/src/pages/test/login.vue @@ -2,94 +2,86 @@ import { ref, reactive } from "vue"; import { onLoad, onShow } from "@dcloudio/uni-app"; -import { hooks, constant, router } from "@@/index" -import { userApi } from "@@/api" +import { hooks, constant, router } from "@@/index"; +import { userApi } from "@@/api"; -const data = { - -} +const data = {}; const state = reactive({ - userInfo: null, -}) + userInfo: null, +}); const applyForm = reactive({ - username: "", - password: "", -}) + username: "", + password: "", +}); const applyFormRules = reactive({ - username: [ - { required: true, message: '请输入用户名' } - ], - password: [ - { required: true, message: '请输入密码' } - ], -}) + username: [{ required: true, message: "请输入用户名" }], + password: [{ required: true, message: "请输入密码" }], +}); -onLoad(() => { - -}) +onLoad(() => {}); onShow(() => { - const userInfoKey = constant.storageConstant.USERINFO - state.userInfo = uni.getStorageSync(userInfoKey) -}) + const userInfoKey = constant.storageConstant.USERINFO; + state.userInfo = uni.getStorageSync(userInfoKey); +}); -const applyFormRef = ref(null) +const applyFormRef = ref(null); const doSubmit = async () => { - applyFormRef.value.submit() - const { isPass } = applyFormRef.value.validate() - if (!isPass) return - const tokenKey = constant.storageConstant.TOKEN - const userInfoKey = constant.storageConstant.USERINFO - uni.showLoading({ title: '登录中...', mask: true }); - // try { - const _pa = { ...applyForm } - const res = await userApi.testLogin(_pa) - console.log(res) - if (res.code!=0){ - uni.showToast({ title: res.msg+'。登录失败,请重新登录', icon: "error" }); - return - } - uni.setStorageSync(tokenKey, res.data) - const { data: userData } = await userApi.userInfo(); - uni.setStorageSync(userInfoKey, userData) - // } catch (e) { - // console.log(222) - // console.log(e); - // } - uni.hideLoading() - uni.showToast({ title: '登录成功', icon: "none" }); - router.back() -} - + applyFormRef.value.submit(); + const { isPass } = applyFormRef.value.validate(); + if (!isPass) return; + const tokenKey = constant.storageConstant.TOKEN; + const userInfoKey = constant.storageConstant.USERINFO; + uni.showLoading({ title: "登录中...", mask: true }); + // try { + const _pa = { ...applyForm }; + const res = await userApi.testLogin(_pa); + console.log(res); + if (res.code != 0) { + uni.showToast({ title: res.msg + "。登录失败,请重新登录", icon: "error" }); + return; + } + uni.setStorageSync(tokenKey, res.data); + const { data: userData } = await userApi.userInfo(); + uni.setStorageSync(userInfoKey, userData); + // } catch (e) { + // console.log(222) + // console.log(e); + // } + uni.hideLoading(); + uni.showToast({ title: "登录成功", icon: "none" }); + router.back(); +}; - diff --git a/src/sheep/api/face.ts b/src/sheep/api/face.ts index 4b12762..ea92131 100644 --- a/src/sheep/api/face.ts +++ b/src/sheep/api/face.ts @@ -10,40 +10,40 @@ export default { showLoading: false, }, }), - // classify: (params: any) => - // request({ - // url: `/onlinefood/category/listFood`, - // method: "GET", - // params, - // custom: { - // showLoading: false, - // }, - // }), - // product: (params: any) => - // request({ - // url: `/onlinefood/category/list`, - // method: "GET", - // params, - // custom: { - // showLoading: false, - // }, - // }), - // getShopCar: (params: any) => - // request({ - // url: `/hardware/car/get`, - // method: "GET", - // params, - // custom: { - // showLoading: false, - // }, - // }), - // updateShopCar: (data: any) => - // request({ - // url: `/hardware/car/save-or-upload`, - // method: "POST", - // data, - // custom: { - // showLoading: false, - // }, - // }), + del: (params: any) => + request({ + url: `/sys/user/face-delete`, + method: "DELETE", + params, + custom: { + showLoading: false, + }, + }), + create: (data: any) => + request({ + url: `/sys/user/face-create`, + method: "POST", + data, + custom: { + showLoading: false, + }, + }), + get: (params: any) => + request({ + url: `/sys/user/face-get`, + method: "GET", + params, + custom: { + showLoading: false, + }, + }), + put: (data: any) => + request({ + url: `/sys/user/face-update`, + method: "PUT", + data, + custom: { + showLoading: false, + }, + }), }; diff --git a/src/uni_modules/tm-ui/components/tm-image/tm-image.vue b/src/uni_modules/tm-ui/components/tm-image/tm-image.vue index 07278af..6f545bf 100644 --- a/src/uni_modules/tm-ui/components/tm-image/tm-image.vue +++ b/src/uni_modules/tm-ui/components/tm-image/tm-image.vue @@ -18,7 +18,7 @@