From 7bc9c5f7432a9533a0b552c40fb63fc07de5b5fe Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期一, 29 九月 2025 09:56:24 +0800 Subject: [PATCH] 优化 --- h5/pages/appointment/appointment.vue | 2 h5/pages/notice/notice.vue | 10 +++- h5/package.json | 1 h5/pages/login/login.vue | 14 +++--- h5/pages/driver/notice.vue | 6 +- h5/utils/service.js | 8 ++-- h5/App.vue | 27 ++++++------- h5/package-lock.json | 13 ++++++ h5/utils/getCode.js | 23 +++++++++++ h5/utils/http.interceptor.js | 10 ++-- 10 files changed, 77 insertions(+), 37 deletions(-) diff --git a/h5/App.vue b/h5/App.vue index 2fb62ad..6d141ba 100644 --- a/h5/App.vue +++ b/h5/App.vue @@ -6,20 +6,19 @@ } from '@/api' export default { onLaunch: function() { - window.addEventListener("popstate", (event) => { - const path = this.$route.fullPath - // console.log('path', path); - if (path == '/pages/login/login' || path == '/') { - window.location.href = app_url - } - if (path == '/pages/wdata/home') { - window.location.href = 'https://atwl.ahzyssl.com/zhyq_h5/#/pages/wdata/home' - } - if (path == '/pages/waybill/home') { - window.location.href = 'https://atwl.ahzyssl.com/zhyq_h5/#/pages/waybill/home' - } - }) - uni.setStorageSync('transportList', []) + // window.addEventListener("popstate", (event) => { + // const path = this.$route.fullPath + // if (path == '/pages/login/login' || path == '/') { + // window.location.href = app_url + // } + // if (path == '/pages/wdata/home') { + // window.location.href = 'https://atwl.ahzyssl.com/zhyq_h5/#/pages/wdata/home' + // } + // if (path == '/pages/waybill/home') { + // window.location.href = 'https://atwl.ahzyssl.com/zhyq_h5/#/pages/waybill/home' + // } + // }) + // uni.setStorageSync('transportList', []) console.log('onLaunch') }, onShow: function() { diff --git a/h5/package-lock.json b/h5/package-lock.json index e0ea285..da7f0a2 100644 --- a/h5/package-lock.json +++ b/h5/package-lock.json @@ -27,11 +27,24 @@ "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz", "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" }, + "dingtalk-jsapi": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/dingtalk-jsapi/-/dingtalk-jsapi-3.2.0.tgz", + "integrity": "sha512-PZhTM1T9ERdaOzjFbyokegVmf/vUVvlg0BKcMiP1bB0e3vBflroPpbW2SjrZEKuvFxFtuFDpvYpk2EhbbKH/6Q==", + "requires": { + "promise-polyfill": "^7.1.0" + } + }, "mutation-observer": { "version": "1.0.3", "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz", "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==" }, + "promise-polyfill": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/promise-polyfill/-/promise-polyfill-7.1.2.tgz", + "integrity": "sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ==" + }, "regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", diff --git a/h5/package.json b/h5/package.json index 3f666de..48cc685 100644 --- a/h5/package.json +++ b/h5/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "dayjs": "^1.11.13", + "dingtalk-jsapi": "^3.2.0", "uniapp-qrcode": "^1.0.2", "uview-ui": "^2.0.37", "vconsole": "^3.15.1" diff --git a/h5/pages/appointment/appointment.vue b/h5/pages/appointment/appointment.vue index 8ba94ad..a4833a4 100644 --- a/h5/pages/appointment/appointment.vue +++ b/h5/pages/appointment/appointment.vue @@ -459,7 +459,7 @@ name: 'file', formData: { folderCode: 'MEMBER_IMG', - isFace: 0 + // isFace: 0 }, success: (uploadFileRes) => { let res = JSON.parse(uploadFileRes.data) diff --git a/h5/pages/driver/notice.vue b/h5/pages/driver/notice.vue index 27be0c1..4d4e993 100644 --- a/h5/pages/driver/notice.vue +++ b/h5/pages/driver/notice.vue @@ -30,9 +30,9 @@ }, onLoad() { this.getInfo() - if (!this.$store.state.openId) { - // this.initToken() - } + // if (!this.$store.state.openId) { + // this.initToken() + // } }, methods: { initToken() { diff --git a/h5/pages/login/login.vue b/h5/pages/login/login.vue index 4a2ca65..e068cc0 100644 --- a/h5/pages/login/login.vue +++ b/h5/pages/login/login.vue @@ -46,13 +46,13 @@ }, onLoad(option) { console.log('onLoad'); - if (option.ywid) { - uni.setStorageSync('ywinfo', { - type: option.type, - yw: option.yw, - ywid: option.ywid - }) - } + // if (option.ywid) { + // uni.setStorageSync('ywinfo', { + // type: option.type, + // yw: option.yw, + // ywid: option.ywid + // }) + // } // https://atwl.ahzyssl.com/zhyq_h5/#/pages/login/login?type=2&yw=5&ywid=b3db2072-a453-470d-8c0d-ba3b8b256530 }, onShow() { diff --git a/h5/pages/notice/notice.vue b/h5/pages/notice/notice.vue index fcbd3ee..ea0c8d5 100644 --- a/h5/pages/notice/notice.vue +++ b/h5/pages/notice/notice.vue @@ -16,6 +16,7 @@ <script> let timer import { getSystemDictData } from "@/api" +import { getCode } from "@/utils/getCode.js"; export default { name: 'Index', data() { @@ -27,9 +28,12 @@ }, onLoad() { this.getInfo() - if (!this.$store.state.openId) { - // this.initToken() - } + getCode(code => { + console.log('code', code) + }); + // if (!this.$store.state.openId) { + // this.initToken() + // } }, methods: { initToken() { diff --git a/h5/utils/getCode.js b/h5/utils/getCode.js new file mode 100644 index 0000000..79b9ec5 --- /dev/null +++ b/h5/utils/getCode.js @@ -0,0 +1,23 @@ +import * as dd from 'dingtalk-jsapi'; +export function getCode(callback) { + let corpId = 'dingb14b7554444efe0a'; + console.log(dd.env.platform) + if (dd.env.platform !== "notInDingTalk") { + dd.ready(() => { + //浣跨敤SDK 鑾峰彇鍏嶇櫥鎺堟潈鐮� + dd.runtime.permission.requestAuthCode({ + corpId: corpId, + onSuccess: (info) => { + // 鏍规嵁閽夐拤鎻愪緵鐨刟pi 鑾峰緱code鍚�,鍐嶆璋冪敤杩欎釜callback鏂规硶 + // 鐢变簬鏄拤閽夎幏鍙朿ode鏄紓姝ユ搷浣�,涓嶇煡閬撲粈涔堟椂鍊欐墽琛屽畬姣� + // callback 鍑芥暟浼氱瓑浠栨墽琛屽畬姣曞悗鍦ㄨ嚜宸辫皟鐢ㄨ嚜宸� + callback(info.code) + }, + onFail: (err) => { + alert('fail'); + alert(JSON.stringify(err)); + }, + }); + }); + } +} \ No newline at end of file diff --git a/h5/utils/http.interceptor.js b/h5/utils/http.interceptor.js index 6d17428..a136b00 100644 --- a/h5/utils/http.interceptor.js +++ b/h5/utils/http.interceptor.js @@ -18,11 +18,11 @@ uni.$u.http.interceptors.response.use((response) => { uni.hideLoading(); // 鐧诲綍杩囨湡 - if (response.data.code === 401) { - uni.navigateTo({ - url: '/packageA/loginAgain/loginAgain' - }); - } + // if (response.data.code === 401) { + // uni.navigateTo({ + // url: '/packageA/loginAgain/loginAgain' + // }); + // } if (response.data.code !== 200) { uni.showToast({ title: response.data.message, diff --git a/h5/utils/service.js b/h5/utils/service.js index 55d60a4..4d7a31a 100644 --- a/h5/utils/service.js +++ b/h5/utils/service.js @@ -39,10 +39,10 @@ 'title': '鏈嶅姟鍣ㄥ紓甯�',icon:'none' }) } - if (data.code === 5112) { - uni.clearStorageSync() - window.location.href = app_url - } + // if (data.code === 5112) { + // uni.clearStorageSync() + // window.location.href = app_url + // } return resolve(data) } resolve(data) -- Gitblit v1.9.3