diff --git a/.env b/.env index 5d59f08..ac3612c 100644 --- a/.env +++ b/.env @@ -1,7 +1,8 @@ # ******************** start 开发环境 start ******************** -VITE_APP_DEV_SERVICE =http://localhost:48080/app-api +# 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 # ******************** end 开发环境 end ******************** diff --git a/src/pages.json b/src/pages.json index a4cd9b1..974bde0 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,249 +1,268 @@ { - "easycom": { - "autoscan": true, - "custom": { - "^base-(.*)": "@/sheep/components/base/base-$1/base-$1.vue", - "^crud-(.*)": "@/sheep/components/crud/crud-$1/crud-$1.vue", - "^tm-(.*)": "@/uni_modules/tm-ui/components/tm-$1/tm-$1.vue", - "^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue" - } - }, - "pages": [ - { - "path": "pages/tabbar/home", - "style": { - "navigationBarTitleText": "首页", - "disableScroll": true - } - }, - { - "path": "pages/tabbar/order", - "style": { - "navigationBarTitleText": "订单", - "disableScroll": true - } - }, - { - "path": "pages/tabbar/my", - "style": { - "navigationBarTitleText": "我的", - "disableScroll": true - } - } - ], - "subPackages": [ - { - "root": "pages/order", - "pages": [] - }, - { - "root": "pages/shop", - "pages": [] - }, - { - "root": "pages/apply", - "pages": [ - { - "path": "foreign-apply", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "foreign-list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "foreign-items", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "stride-apply", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "stride-list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "stride-items", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/boxes", - "pages": [ - { - "path": "apply", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "apply-list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/merchant", - "pages": [ - { - "path": "detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "food", - "style": { - "navigationBarTitleText": "菜谱", - "navigationBarBackgroundColor": "#1777FF", - "disableScroll": true - } - }, - { - "path": "product-detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/order", - "pages": [ - { - "path": "detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/refund", - "pages": [ - { - "path": "apply", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "history", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/test", - "pages": [ - { - "path": "login", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, - { - "root": "pages/wallet", - "pages": [ - { - "path": "list", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "detail", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "recharge", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "浦江小程序", - "navigationBarBackgroundColor": "#1777FF", - "backgroundColor": "#ecf4f9", - "navigationStyle": "custom" - }, - "tabBar": { - "list": [ - { - "pagePath": "pages/tabbar/home", - "text": "首页", - "iconPath": "static/tabbar/home.png", - "selectedIconPath": "static/tabbar/home-select.png" - }, - { - "pagePath": "pages/tabbar/order", - "text": "订单", - "iconPath": "static/tabbar/order.png", - "selectedIconPath": "static/tabbar/order-select.png" - }, - { - "pagePath": "pages/tabbar/my", - "text": "我的", - "iconPath": "static/tabbar/my.png", - "selectedIconPath": "static/tabbar/my-select.png" - } - ] - } -} \ No newline at end of file + "easycom": { + "autoscan": true, + "custom": { + "^base-(.*)": "@/sheep/components/base/base-$1/base-$1.vue", + "^crud-(.*)": "@/sheep/components/crud/crud-$1/crud-$1.vue", + "^tm-(.*)": "@/uni_modules/tm-ui/components/tm-$1/tm-$1.vue", + "^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue" + } + }, + "pages": [ + { + "path": "pages/tabbar/home", + "style": { + "navigationBarTitleText": "首页", + "disableScroll": true + } + }, + { + "path": "pages/tabbar/order", + "style": { + "navigationBarTitleText": "订单", + "disableScroll": true + } + }, + { + "path": "pages/tabbar/my", + "style": { + "navigationBarTitleText": "我的", + "disableScroll": true + } + } + ], + "subPackages": [ + { + "root": "pages/order", + "pages": [] + }, + { + "root": "pages/shop", + "pages": [] + }, + { + "root": "pages/apply", + "pages": [ + { + "path": "foreign-apply", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "foreign-list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "foreign-items", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "stride-apply", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "stride-list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "stride-items", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/boxes", + "pages": [ + { + "path": "apply", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "detail", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "apply-list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/merchant", + "pages": [ + { + "path": "detail", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "food", + "style": { + "navigationBarTitleText": "菜谱", + "navigationBarBackgroundColor": "#1777FF", + "disableScroll": true + } + }, + { + "path": "product-detail", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/order", + "pages": [ + { + "path": "detail", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/refund", + "pages": [ + { + "path": "apply", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "history", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/test", + "pages": [ + { + "path": "login", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/wallet", + "pages": [ + { + "path": "list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "detail", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "recharge", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, + { + "root": "pages/humanFace", + "pages": [ + { + "path": "list", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "apply", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "浦江小程序", + "navigationBarBackgroundColor": "#1777FF", + "backgroundColor": "#ecf4f9", + "navigationStyle": "custom" + }, + "tabBar": { + "list": [ + { + "pagePath": "pages/tabbar/home", + "text": "首页", + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home-select.png" + }, + { + "pagePath": "pages/tabbar/order", + "text": "订单", + "iconPath": "static/tabbar/order.png", + "selectedIconPath": "static/tabbar/order-select.png" + }, + { + "pagePath": "pages/tabbar/my", + "text": "我的", + "iconPath": "static/tabbar/my.png", + "selectedIconPath": "static/tabbar/my-select.png" + } + ] + } +} diff --git a/src/pages/humanFace/apply.vue b/src/pages/humanFace/apply.vue new file mode 100644 index 0000000..e4bd496 --- /dev/null +++ b/src/pages/humanFace/apply.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/src/pages/humanFace/list.vue b/src/pages/humanFace/list.vue new file mode 100644 index 0000000..ac657b6 --- /dev/null +++ b/src/pages/humanFace/list.vue @@ -0,0 +1,77 @@ + + + diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 2578f9c..4b1731c 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -3,162 +3,161 @@ import { ref, reactive } from "vue"; import { onLoad, onShow } from "@dcloudio/uni-app"; import { isEmpty } from "radash"; -import { hooks, router, constant } from "@@/index" -import { merchantApi, userApi, walletApi } from "@@/api" +import { hooks, router, constant } from "@@/index"; +import { merchantApi, userApi, walletApi } from "@@/api"; const data = { - serviceList: [ - { text: '钱包管理', icon: '/static/icon/service_3.png', router: '/pages/wallet/list' }, - { text: '包厢预定', icon: '/static/icon/service_4.png', router: '/pages/boxes/apply-list' }, - // { text: '车牌管理', icon: '/static/icon/service_2.png', router: '/pages/user/diff-price' }, - { 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/test/login' }, - ] + serviceList: [ + { text: "钱包管理", icon: "/static/icon/service_3.png", router: "/pages/wallet/list" }, + { text: "包厢预定", icon: "/static/icon/service_4.png", router: "/pages/boxes/apply-list" }, + // { text: '车牌管理', icon: '/static/icon/service_2.png', router: '/pages/user/diff-price' }, + { 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" }, + ], }; const state = reactive({ - wallet: [], - userInfo: {}, -}) - + wallet: [], + userInfo: {}, +}); onLoad((options) => { - (window as any).CP2.getAppInfo().then((res) => { - console.log(res); - if (res.code == 1) { - //诗画 - console.log("诗画环境"); - (window as any).CP2.getUserInfo().then((res) => { - let accountId = res.data.accountId; - let sessionId = res.sessionId; - doLogin(1, null, accountId, sessionId) - }); - } else { - //浙政钉或者h5 - const url = window.location.href; - const params = new URL(url).searchParams; - const token = params.get('uabaseToken'); // 获取 uabaseToken 参数值 - console.log('Token:', token); - if (null != token) { - //浙政钉 - doLogin(2, token, null, null) - } - - } - }); + (window as any).CP2.getAppInfo().then((res) => { + console.log(res); + if (res.code == 1) { + //诗画 + console.log("诗画环境"); + (window as any).CP2.getUserInfo().then((res) => { + let accountId = res.data.accountId; + let sessionId = res.sessionId; + doLogin(1, null, accountId, sessionId); + }); + } else { + //浙政钉或者h5 + const url = window.location.href; + const params = new URL(url).searchParams; + const token = params.get("uabaseToken"); // 获取 uabaseToken 参数值 + console.log("Token:", token); + if (null != token) { + //浙政钉 + doLogin(2, token, null, null); + } + } + }); }); onShow(() => { - getUserInfo() -}) + getUserInfo(); +}); const getUserInfo = () => { - const userInfoKey = constant.storageConstant.USERINFO - const userStorage = uni.getStorageSync(userInfoKey) - if (!isEmpty(userStorage)) { - state.userInfo = userStorage - } -} + const userInfoKey = constant.storageConstant.USERINFO; + const userStorage = uni.getStorageSync(userInfoKey); + if (!isEmpty(userStorage)) { + state.userInfo = userStorage; + } +}; const doLogin = async (loginType, token, accountId, sessionId) => { - const tokenKey = constant.storageConstant.TOKEN - const userInfoKey = constant.storageConstant.USERINFO - const tokenStorage = uni.getStorageSync(tokenKey) - const userStorage = uni.getStorageSync(userInfoKey) - if (isEmpty(tokenStorage) || isEmpty(userStorage)) { - uni.showLoading({ - title: '登录中...', - mask: true - }); - let authData; - if (loginType == 1) { - // 诗画 - const params = { - accountId: accountId, - sessionId: sessionId - } - const response = await userApi.authsh(params); - authData = response.data; - } else if (loginType == 2) { - //浙政钉 - const response = await userApi.auth(token); - authData = response.data; - } else { - //后期手机号+验证码登录 - router.jump('/pages/test/login') - uni.hideLoading() - return - } - // const {data: authData} = await userApi.auth(token); - uni.setStorageSync(tokenKey, authData) - const { data: userData } = await userApi.userInfo(); - uni.setStorageSync(userInfoKey, userData) - getUserInfo() - uni.hideLoading() - uni.showToast({ title: '登录成功', icon: "none" }); + const tokenKey = constant.storageConstant.TOKEN; + const userInfoKey = constant.storageConstant.USERINFO; + const tokenStorage = uni.getStorageSync(tokenKey); + const userStorage = uni.getStorageSync(userInfoKey); + if (isEmpty(tokenStorage) || isEmpty(userStorage)) { + uni.showLoading({ + title: "登录中...", + mask: true, + }); + let authData; + if (loginType == 1) { + // 诗画 + const params = { + accountId: accountId, + sessionId: sessionId, + }; + const response = await userApi.authsh(params); + authData = response.data; + } else if (loginType == 2) { + //浙政钉 + const response = await userApi.auth(token); + authData = response.data; + } else { + //后期手机号+验证码登录 + router.jump("/pages/test/login"); + uni.hideLoading(); + return; } -} + // const {data: authData} = await userApi.auth(token); + uni.setStorageSync(tokenKey, authData); + const { data: userData } = await userApi.userInfo(); + uni.setStorageSync(userInfoKey, userData); + getUserInfo(); + uni.hideLoading(); + uni.showToast({ title: "登录成功", icon: "none" }); + } +}; const doLogout = async () => { - uni.showLoading({ - title: '退出登录中...', - mask: true - }); - const tokenKey = constant.storageConstant.TOKEN - const userInfoKey = constant.storageConstant.USERINFO - uni.removeStorageSync(tokenKey) - uni.removeStorageSync(userInfoKey) - state.userInfo = {} - uni.hideLoading() - uni.showToast({ title: '退出登录成功', icon: "none" }); -} + uni.showLoading({ + title: "退出登录中...", + mask: true, + }); + const tokenKey = constant.storageConstant.TOKEN; + const userInfoKey = constant.storageConstant.USERINFO; + uni.removeStorageSync(tokenKey); + uni.removeStorageSync(userInfoKey); + state.userInfo = {}; + uni.hideLoading(); + uni.showToast({ title: "退出登录成功", icon: "none" }); +}; - diff --git a/src/sheep/api/face.ts b/src/sheep/api/face.ts new file mode 100644 index 0000000..4b12762 --- /dev/null +++ b/src/sheep/api/face.ts @@ -0,0 +1,49 @@ +import request from "@/sheep/utils/request"; + +export default { + page: (params: any) => + request({ + url: `/sys/user/face-page-join`, + method: "GET", + params, + custom: { + 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, + // }, + // }), +}; diff --git a/src/sheep/api/index.ts b/src/sheep/api/index.ts index 42acaf0..3a976f5 100644 --- a/src/sheep/api/index.ts +++ b/src/sheep/api/index.ts @@ -19,3 +19,5 @@ export { default as refundApi } from "./refund"; export { default as userApi } from "./user"; export { default as walletApi } from "./wallet"; + +export { default as faceApi } from "./face"; diff --git a/src/sheep/utils/request.ts b/src/sheep/utils/request.ts index 6078103..4d52103 100644 --- a/src/sheep/utils/request.ts +++ b/src/sheep/utils/request.ts @@ -73,16 +73,9 @@ http.interceptors.request.use( http.interceptors.response.use( async (response) => { - response.config && - response.config.custom && - response.config.custom.showLoading && - closeLoading(); + response.config && response.config.custom && response.config.custom.showLoading && closeLoading(); if (response.data.code !== 0) { - if ( - response.config && - response.config.custom && - response.config.custom.showError - ) { + if (response.config && response.config.custom && response.config.custom.showError) { switch (response.data.code) { case 401: setTimeout(() => { @@ -118,10 +111,7 @@ http.interceptors.response.use( } const tokenKey = constant.storageConstant.TOKEN; const tokenStorage = uni.getStorageSync(tokenKey); - if ( - !isEmpty(tokenStorage) && - response.config.url != "/sys/auth/refresh-token" - ) { + if (!isEmpty(tokenStorage) && response.config.url != "/sys/auth/refresh-token") { const { refreshToken, expiresTime } = tokenStorage; const now = new Date().getTime(); const remain = expiresTime - now;