From 8809cc1975b7b2593ac58d1b94812cf79efb4199 Mon Sep 17 00:00:00 2001 From: yangzhq68909 <993367776@qq.com> Date: Thu, 26 Sep 2024 12:06:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E8=AF=B7=E5=81=87=E7=B1=BB=E5=9E=8B=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- api/api.js | 3 +- api/login.js | 7 + components/treeSelect/interface.ts | 0 pages/leave/application.vue | 12 +- pages/login/login.vue | 45 +--- pages/login/login22.vue | 280 +++++++++++++++++++++ pages/tab/index.vue | 1 + pages/useredit/useredit.vue | 3 +- store/update.js | 5 +- unpackage/dist/dev/app-plus/app-service.js | 108 ++++---- utils/index.js | 5 +- 12 files changed, 355 insertions(+), 116 deletions(-) delete mode 100644 components/treeSelect/interface.ts create mode 100644 pages/login/login22.vue diff --git a/.env.development b/.env.development index b6fc12c..00e98bc 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ # 开发环境 # 请求接口地址 -VITE_REQUEST_BASE_URL = https://36.112.48.190 +VITE_REQUEST_BASE_URL = http://10.75.166.174:8080 diff --git a/api/api.js b/api/api.js index f2c68ad..508cb36 100644 --- a/api/api.js +++ b/api/api.js @@ -60,7 +60,6 @@ export function queryMyDeptTreeListApi(config) { // 部门 } export function userListApi(config) { // 所有人员列表 return https({ - // url: '/appConnet/app/userList', url: '/sys/user/userList', method: 'get', data: config @@ -82,7 +81,7 @@ export function indexChartScdtDataApi(config) { // 首页 } export function bpmlistApi(config) { // 公文 return https({ - url: '/appConnet/app/bpmlist', + url: '/cxcoagwfb/cxcOaGwfb/bpmlist', method: 'get', data: config }) diff --git a/api/login.js b/api/login.js index d62ade8..b1895f3 100644 --- a/api/login.js +++ b/api/login.js @@ -6,6 +6,13 @@ export function loginApi(config) { // 登录 data: config }) } +export function localLoginApi(config) { // 本地登录 + return https({ + url: '/sys/login', + method: 'post', + data: config + }) +} export function queryRoleApi(config) { // 获取角色职位 return https({ url: '/appConnet/app/queryRoleByRoleIds', diff --git a/components/treeSelect/interface.ts b/components/treeSelect/interface.ts deleted file mode 100644 index e69de29..0000000 diff --git a/pages/leave/application.vue b/pages/leave/application.vue index 79f55b9..c0f60ab 100644 --- a/pages/leave/application.vue +++ b/pages/leave/application.vue @@ -19,12 +19,11 @@ - 请假类型: - + @@ -170,6 +169,8 @@ }).then((res) => { if (res.success) { startMutilProcess(res.message) + } else { + proxy.$toast(res.message); } }) } @@ -191,18 +192,19 @@ }) } const loadData = () => { - getCategoryItemsApi('1838487445813645313').then((res) => { //请假类型 + getCategoryItemsApi('1838487445813645313').then((res) => { //请假类型 if (res.success) { dataSource.value = res.result + console.log('--',res.result) } }) - + queryDepByCode(store.userinfo.orgCode).then((res) => { //部门翻译 if (res.success) { depart.value = res.result } }) - + } diff --git a/pages/login/login.vue b/pages/login/login.vue index 087a27a..750d27f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -16,6 +16,7 @@ + @@ -41,7 +42,7 @@ watch } from 'vue'; import { - loginApi, + localLoginApi, queryRoleApi } from '@/api/login.js'; import Base64 from 'base-64'; @@ -81,15 +82,13 @@ if (!username.value.trim()) return proxy.$toast('请输入账号') if (!password.value.trim()) return proxy.$toast('请输入密码') - let un = Base64.encode(encodeURIComponent(username.value)) - let pw = Base64.encode(encodeURIComponent(password.value)) uni.showLoading({ title: '登录中...' }); - loginApi({ - username: un, - password: pw, - ip: getDeviceIp() + localLoginApi({ + username: username.value, + password: password.value, + captcha: 'app' }).then((loginres) => { if (loginres.success) { uni.setStorageSync('token', loginres.result.token) @@ -131,39 +130,7 @@ username.value = obj.un ? obj.un : '' password.value = obj.pw ? obj.pw : '' } - // localAccountArr = uni.getStorageSync('accountArr') ? JSON.parse(uni.getStorageSync('accountArr')) : [] - // accountArr.value = localAccountArr }) - function getDeviceIp() { - // #ifdef APP-PLUS - - let deviceIp - if (plus.os.name == "Android") { - let Context = plus.android.importClass('android.content.Context') - let main = plus.android.runtimeMainActivity() - let cm = main.getSystemService(Context.CONNECTIVITY_SERVICE) - plus.android.importClass(cm) - let linkProperties = cm.getLinkProperties(cm.getActiveNetwork()) - let linkAddrs = plus.android.invoke(linkProperties, 'getLinkAddresses') - plus.android.importClass(linkAddrs) - for (var i = 0; i < linkAddrs.size(); i++) { - let inetAddr = plus.android.invoke(linkAddrs.get(i), 'getAddress') - deviceIp = plus.android.invoke(inetAddr, 'getHostAddress') - } - //再看有没有wifi - if (deviceIp == '') { - var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE); - var wifiInfo = plus.android.invoke(wifiManager, "getConnectionInfo"); - var ipAddress = plus.android.invoke(wifiInfo, "getIpAddress"); - if (ipAddress != 0) { - deviceIp = ((ipAddress & 0xff) + "." + (ipAddress >> 8 & 0xff) + "." + (ipAddress >> 16 & - 0xff) + "." + (ipAddress >> 24 & 0xff)); - } - } - } - return deviceIp; - // #endif - } \ No newline at end of file diff --git a/pages/tab/index.vue b/pages/tab/index.vue index c66f97b..3aeba63 100644 --- a/pages/tab/index.vue +++ b/pages/tab/index.vue @@ -268,6 +268,7 @@ pageNo, pageSize }).then((res) => { + console.log('---',res) if (res.success) { list.value = [...list.value, ...formatObj(res.result.records, 'fwbt', 'fwtime', null)] } diff --git a/pages/useredit/useredit.vue b/pages/useredit/useredit.vue index 0d4e414..ac42f62 100644 --- a/pages/useredit/useredit.vue +++ b/pages/useredit/useredit.vue @@ -71,6 +71,7 @@ import { useStore } from '@/store'; + const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot' const store = useStore() const sexIndex = ref(null) @@ -100,7 +101,7 @@ success: (chooseImageRes) => { const tempFilePaths = chooseImageRes.tempFilePaths; uni.uploadFile({ - url: 'https://36.112.48.190/jeecg-boot/sys/common/upload', //仅为示例,非真实的接口地址 + url: baseUrl + '/sys/common/upload', //仅为示例,非真实的接口地址 filePath: tempFilePaths[0], name: 'file', header: { diff --git a/store/update.js b/store/update.js index f1e8183..18912b5 100644 --- a/store/update.js +++ b/store/update.js @@ -12,6 +12,7 @@ import { hasNewVersion, onClickUpdate } from '@/utils/index.js'; +const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot/sys/common/static/' export const useUpdateApp = defineStore('updateApp', () => { const updateOptions = reactive({ @@ -34,8 +35,8 @@ export const useUpdateApp = defineStore('updateApp', () => { let { result } = res - result.apkUrl = 'https://36.112.48.190/jeecg-boot/sys/common/static/' + result.apkUrl; - result.wgtUrl = 'https://36.112.48.190/jeecg-boot/sys/common/static/' + result.wgtUrl + result.apkUrl = baseUrl + result.apkUrl; + result.wgtUrl = baseUrl + result.wgtUrl console.log('更新', result); // res = { // "update": "wgt", diff --git a/unpackage/dist/dev/app-plus/app-service.js b/unpackage/dist/dev/app-plus/app-service.js index 1a4501b..b75727d 100644 --- a/unpackage/dist/dev/app-plus/app-service.js +++ b/unpackage/dist/dev/app-plus/app-service.js @@ -61,7 +61,7 @@ if (uni.restoreGlobal) { const _imports_4 = "/static/login/eye-off.png"; const _imports_5 = "/static/login/nocheck.png"; const _imports_6 = "/static/login/checked.png"; - let baseUrl = "https://36.112.48.190/jeecg-boot"; + let baseUrl$1 = "http://10.75.166.174:8080/jeecg-boot"; let loading = false; function https(config) { if (loading) @@ -76,7 +76,7 @@ if (uni.restoreGlobal) { loading = false; return; } - config.url = baseUrl + config.url; + config.url = baseUrl$1 + config.url; let token = uni.getStorageSync("token") || ""; config.header = { //返回数据类型 @@ -130,9 +130,9 @@ if (uni.restoreGlobal) { }); return promise; } - function loginApi(config) { + function localLoginApi(config) { return https({ - url: "/sys/sinopecLogin", + url: "/sys/login", method: "post", data: config }); @@ -256,8 +256,7 @@ if (uni.restoreGlobal) { } })(commonjsGlobal); })(base64, base64.exports); - var base64Exports = base64.exports; - const Base64 = /* @__PURE__ */ getDefaultExportFromCjs(base64Exports); + base64.exports; var isVue2 = false; function set(target, key, val) { if (Array.isArray(target)) { @@ -1779,15 +1778,13 @@ This will fail in production.`); return proxy.$toast("请输入账号"); if (!password.value.trim()) return proxy.$toast("请输入密码"); - let un = Base64.encode(encodeURIComponent(username.value)); - let pw = Base64.encode(encodeURIComponent(password.value)); uni.showLoading({ title: "登录中..." }); - loginApi({ - username: un, - password: pw, - ip: getDeviceIp() + localLoginApi({ + username: username.value, + password: password.value, + captcha: "app" }).then((loginres) => { if (loginres.success) { uni.setStorageSync("token", loginres.result.token); @@ -1807,7 +1804,7 @@ This will fail in production.`); }); } }).catch((err) => { - formatAppLog("log", "at pages/login/login.vue:122", err); + formatAppLog("log", "at pages/login/login.vue:121", err); }); }; vue.ref([]); @@ -1818,31 +1815,6 @@ This will fail in production.`); password.value = obj.pw ? obj.pw : ""; } }); - function getDeviceIp() { - let deviceIp; - if (plus.os.name == "Android") { - let Context = plus.android.importClass("android.content.Context"); - let main = plus.android.runtimeMainActivity(); - let cm = main.getSystemService(Context.CONNECTIVITY_SERVICE); - plus.android.importClass(cm); - let linkProperties = cm.getLinkProperties(cm.getActiveNetwork()); - let linkAddrs = plus.android.invoke(linkProperties, "getLinkAddresses"); - plus.android.importClass(linkAddrs); - for (var i2 = 0; i2 < linkAddrs.size(); i2++) { - let inetAddr = plus.android.invoke(linkAddrs.get(i2), "getAddress"); - deviceIp = plus.android.invoke(inetAddr, "getHostAddress"); - } - if (deviceIp == "") { - var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE); - var wifiInfo = plus.android.invoke(wifiManager, "getConnectionInfo"); - var ipAddress = plus.android.invoke(wifiInfo, "getIpAddress"); - if (ipAddress != 0) { - deviceIp = (ipAddress & 255) + "." + (ipAddress >> 8 & 255) + "." + (ipAddress >> 16 & 255) + "." + (ipAddress >> 24 & 255); - } - } - } - return deviceIp; - } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "view", @@ -6277,7 +6249,7 @@ This will fail in production.`); } function bpmlistApi(config) { return https({ - url: "/appConnet/app/bpmlist", + url: "/cxcoagwfb/cxcOaGwfb/bpmlist", method: "get", data: config }); @@ -6465,6 +6437,7 @@ This will fail in production.`); } }; const customNav = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-420daeb5"], ["__file", "D:/projects/cxc-szcx-uniapp/bpm/customNav.vue"]]); + const baseurl = "http://10.75.166.174:8080/jeecg-boot/sys/common/static"; const toast = (title, icon, duration) => { uni.showToast({ title, @@ -6488,7 +6461,7 @@ This will fail in production.`); } } }).catch((err) => { - formatAppLog("log", "at utils/index.js:34", "err@", err); + formatAppLog("log", "at utils/index.js:35", "err@", err); }); }; const handleAllowPage = (menu, arr = []) => { @@ -6518,14 +6491,14 @@ This will fail in production.`); }); }; function downloadApp(url) { - formatAppLog("log", "at utils/index.js:77", "url", url); + formatAppLog("log", "at utils/index.js:78", "url", url); var dtask = plus.downloader.createDownload(url, { filename: `_downloads/wgt-${Date.now()}.wgt` //利用保存路径,实现下载文件的重命名 }, function(d2, status) { if (status == 200) { var fileSaveUrl = plus.io.convertLocalFileSystemURL(d2.filename); - formatAppLog("log", "at utils/index.js:85", "fileSaveUrl", fileSaveUrl); + formatAppLog("log", "at utils/index.js:86", "fileSaveUrl", fileSaveUrl); installApp(fileSaveUrl); } else { plus.downloader.clear(); @@ -6621,12 +6594,12 @@ This will fail in production.`); store.setPosition(info); getWeather(position.latitude, position.longitude); } else { - formatAppLog("log", "at utils/index.js:223", data.message); + formatAppLog("log", "at utils/index.js:224", data.message); } }, fail: function(err) { toast("获取定位失败"); - formatAppLog("log", "at utils/index.js:228", "地址解析失败" + err); + formatAppLog("log", "at utils/index.js:229", "地址解析失败" + err); } }); } @@ -6656,27 +6629,27 @@ This will fail in production.`); }, fail: function(err) { toast("天气获取失败"); - formatAppLog("log", "at utils/index.js:269", "天气获取失败" + err); + formatAppLog("log", "at utils/index.js:270", "天气获取失败" + err); } }); }; const opendocument = (url) => { uni.downloadFile({ - url: "https://36.112.48.190/jeecg-boot/sys/common/static/" + url, + url: baseurl + url, success: function(res) { var filePath = res.tempFilePath; uni.openDocument({ filePath, showMenu: true, success: function(res2) { - formatAppLog("log", "at utils/index.js:283", "打开文档成功"); + formatAppLog("log", "at utils/index.js:284", "打开文档成功"); } }); } }); }; const imgUrl = (url) => { - return `https://36.112.48.190/jeecg-boot/sys/common/static/${url}`; + return baseurl + `/${url}`; }; const _sfc_main$F = { __name: "index", @@ -6684,7 +6657,7 @@ This will fail in production.`); vue.useCssVars((_ctx) => ({ "ae0729d5-cusnavbarheight": cusnavbarheight })); - const baseurl = "https://36.112.48.190/jeecg-boot"; + const baseurl2 = "http://10.75.166.174:8080/jeecg-boot"; const store = useStore(); onShow(() => { cxcDaping(); @@ -6699,7 +6672,7 @@ This will fail in production.`); if (res2.success) { let arr = res2.result.records[0].wenjian.split(","); banner.value = arr.map((item) => { - return baseurl + "/sys/common/static/" + item; + return baseurl2 + "/sys/common/static/" + item; }); } }); @@ -6770,12 +6743,13 @@ This will fail in production.`); pageNo, pageSize }).then((res2) => { + formatAppLog("log", "at pages/tab/index.vue:271", "---", res2); if (res2.success) { list.value = [...list.value, ...formatObj(res2.result.records, "fwbt", "fwtime", null)]; } loading2 = false; }).catch((err) => { - formatAppLog("log", "at pages/tab/index.vue:276", "err", err); + formatAppLog("log", "at pages/tab/index.vue:277", "err", err); }); }; const gonggaolist = () => { @@ -6789,7 +6763,7 @@ This will fail in production.`); } loading2 = false; }).catch((err) => { - formatAppLog("log", "at pages/tab/index.vue:291", "err", err); + formatAppLog("log", "at pages/tab/index.vue:292", "err", err); }); }; const zhibanArr = vue.ref([]); @@ -6799,7 +6773,7 @@ This will fail in production.`); zhibanArr.value = res2.result.records.slice(0, 2); } }).catch((err) => { - formatAppLog("log", "at pages/tab/index.vue:302", "err", err); + formatAppLog("log", "at pages/tab/index.vue:303", "err", err); }); }; const fagui = () => { @@ -6813,7 +6787,7 @@ This will fail in production.`); } loading2 = false; }).catch((err) => { - formatAppLog("log", "at pages/tab/index.vue:318", "err", err); + formatAppLog("log", "at pages/tab/index.vue:319", "err", err); }); }; const zhidu = () => { @@ -6829,7 +6803,7 @@ This will fail in production.`); } loading2 = false; }).catch((err) => { - formatAppLog("log", "at pages/tab/index.vue:335", "err", err); + formatAppLog("log", "at pages/tab/index.vue:336", "err", err); }); }; const formatObj = (arr, title, time, depart) => { @@ -12066,6 +12040,8 @@ This will fail in production.`); }).then((res) => { if (res.success) { startMutilProcess(res.message); + } else { + proxy.$toast(res.message); } }); }; @@ -12084,13 +12060,14 @@ This will fail in production.`); }, 2e3); } }).catch((err) => { - formatAppLog("log", "at pages/leave/application.vue:190", err); + formatAppLog("log", "at pages/leave/application.vue:191", err); }); }; const loadData = () => { getCategoryItemsApi("1838487445813645313").then((res) => { if (res.success) { dataSource.value = res.result; + formatAppLog("log", "at pages/leave/application.vue:198", "--", res.result); } }); queryDepByCode(store.userinfo.orgCode).then((res) => { @@ -12157,7 +12134,8 @@ This will fail in production.`); vue.createVNode(treeSelect, { dataSource: dataSource.value, modelValue: type.value, - "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => type.value = $event) + "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => type.value = $event), + dataValue: "name" }, null, 8, ["dataSource", "modelValue"]) ]), vue.createElementVNode("picker", { @@ -12365,6 +12343,7 @@ This will fail in production.`); const _sfc_main$j = { __name: "useredit", setup(__props) { + const baseUrl2 = "http://10.75.166.174:8080/jeecg-boot"; const store = useStore(); vue.ref(null); const chooseAvatar = () => { @@ -12373,7 +12352,7 @@ This will fail in production.`); success: (chooseImageRes) => { const tempFilePaths = chooseImageRes.tempFilePaths; uni.uploadFile({ - url: "https://36.112.48.190/jeecg-boot/sys/common/upload", + url: baseUrl2 + "/sys/common/upload", //仅为示例,非真实的接口地址 filePath: tempFilePaths[0], name: "file", @@ -12393,11 +12372,11 @@ This will fail in production.`); userProfile(); } }).catch((err) => { - formatAppLog("log", "at pages/useredit/useredit.vue:122", err); + formatAppLog("log", "at pages/useredit/useredit.vue:123", err); }); }, fail(err) { - formatAppLog("log", "at pages/useredit/useredit.vue:126", "图片上传出错", err); + formatAppLog("log", "at pages/useredit/useredit.vue:127", "图片上传出错", err); } }); } @@ -12417,7 +12396,7 @@ This will fail in production.`); store.setUserInfo(res.result.records[0]); } }).catch((err) => { - formatAppLog("log", "at pages/useredit/useredit.vue:160", err); + formatAppLog("log", "at pages/useredit/useredit.vue:161", err); }); }; const loginout = () => { @@ -18217,6 +18196,7 @@ ${i3} __definePage("pages/safe/detail", PagesSafeDetail); __definePage("pages/zhiban/index", PagesZhibanIndex); __definePage("pages/task/self", PagesTaskSelf); + const baseUrl = "http://10.75.166.174:8080/jeecg-boot/sys/common/static/"; const useUpdateApp = defineStore("updateApp", () => { const updateOptions = vue.reactive({ force: false, @@ -18232,9 +18212,9 @@ ${i3} let { result } = res; - result.apkUrl = "https://36.112.48.190/jeecg-boot/sys/common/static/" + result.apkUrl; - result.wgtUrl = "https://36.112.48.190/jeecg-boot/sys/common/static/" + result.wgtUrl; - formatAppLog("log", "at store/update.js:39", "更新", result); + result.apkUrl = baseUrl + result.apkUrl; + result.wgtUrl = baseUrl + result.wgtUrl; + formatAppLog("log", "at store/update.js:40", "更新", result); updateOptions.wgtUrl = result.wgtUrl; if (systemInfo.osName === "android") { updateOptions.apkUrl = result.apkUrl; diff --git a/utils/index.js b/utils/index.js index 16ec76c..afe6b70 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,3 +1,4 @@ +const baseurl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot/sys/common/static' /**提示*/ export const toast = (title, icon, duration) => { uni.showToast({ @@ -273,7 +274,7 @@ const weatherRequest = (params) => { export const opendocument = (url) => { uni.downloadFile({ - url: 'https://36.112.48.190/jeecg-boot/sys/common/static/' + url, + url: baseurl + url, success: function(res) { var filePath = res.tempFilePath; uni.openDocument({ @@ -306,5 +307,5 @@ export const preview = (current, urls) => { }); } export const imgUrl = (url) => { - return `https://36.112.48.190/jeecg-boot/sys/common/static/${url}` + return baseurl + `/${url}` } \ No newline at end of file