From 680597131b8548c2f48053b26fbca8916a9d8794 Mon Sep 17 00:00:00 2001 From: chinahu-woker <3557732712@qq.com> Date: Sat, 1 Mar 2025 17:46:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=EF=BC=8C=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=9B=BE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../firstui/fui-upload/fui-upload.js | 488 ------------------ .../firstui/fui-upload/fui-upload.json | 6 - .../firstui/fui-upload/fui-upload.wxml | 1 - .../firstui/fui-upload/fui-upload.wxss | 115 ----- dist/dev/mp-weixin/pages/index/index.js | 5 +- src/pages/index/index.vue | 11 +- 6 files changed, 9 insertions(+), 617 deletions(-) delete mode 100644 dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.js delete mode 100644 dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.json delete mode 100644 dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxml delete mode 100644 dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxss diff --git a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.js b/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.js deleted file mode 100644 index 9c71650e..00000000 --- a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.js +++ /dev/null @@ -1,488 +0,0 @@ -"use strict"; -const common_vendor = require("../../../common/vendor.js"); -const _sfc_main = { - name: "fui-upload", - emits: ["success", "error", "complete", "preview", "reupload", "delete"], - // components:{ - // fuiIcon - // }, - props: { - width: { - type: [Number, String], - default: 200 - }, - height: { - type: [Number, String], - default: 200 - }, - fileList: { - type: Array, - default() { - return []; - } - }, - max: { - type: [Number, String], - default: 9 - }, - isAdd: { - type: Boolean, - default: true - }, - addColor: { - type: String, - default: "#333" - }, - addSize: { - type: [Number, String], - default: 88 - }, - background: { - type: String, - default: "#eee" - }, - radius: { - type: [Number, String], - default: 0 - }, - borderColor: { - type: String, - default: "" - }, - //solid、dashed、dotted - borderSytle: { - type: String, - default: "solid" - }, - isDel: { - type: Boolean, - default: true - }, - delColor: { - type: String, - default: "rgba(0,0,0,.6)" - }, - confirmDel: { - type: Boolean, - default: false - }, - url: { - type: String, - default: "" - }, - immediate: { - type: Boolean, - default: false - }, - //V1.9.8+ 是否调用upload 方法进行上传操作 - callUpload: { - type: Boolean, - default: false - }, - sizeType: { - type: Array, - default() { - return ["original", "compressed"]; - } - }, - sourceType: { - type: Array, - default() { - return ["album", "camera"]; - } - }, - //图片后缀名限制 - suffix: { - type: Array, - default() { - return []; - } - }, - //单张图片大小限制 MB - size: { - type: [Number, String], - default: 4 - }, - name: { - type: String, - default: "file" - }, - header: { - type: Object, - default() { - return {}; - } - }, - formData: { - type: Object, - default() { - return {}; - } - }, - param: { - type: [Number, String], - default: 0 - } - }, - data() { - return { - urls: [], - tempFiles: [], - //preupload、uploading、success、error - status: [] - }; - }, - created() { - this.initData(this.fileList); - }, - watch: { - fileList(vals) { - this.initData(vals); - } - }, - computed: { - showAdd() { - let show = true; - let len = this.urls.length; - if (!this.isAdd || this.max == -1 && len >= 9 || this.max != -1 && len >= this.max) { - show = false; - } - return show; - } - }, - methods: { - initData(urls) { - urls = urls || []; - this.status = []; - let status = []; - let tempFiles = []; - urls.forEach((item) => { - status.push("success"); - tempFiles.push({ - path: item - }); - }); - this.urls = [...urls]; - this.tempFiles = tempFiles; - this.status = status; - }, - reUpload(index) { - this.$set(this.status, index, "uploading"); - if (this.callUpload) { - this.$emit("reupload", { - index - }); - } else { - this.uploadImage(index, this.urls[index]).then((res) => { - this._success(res); - }).catch((res) => { - this._error(res); - }); - } - }, - getStatus() { - if (this.status.length === 0) - return ""; - let status = "preupload"; - if (this.status.indexOf("preupload") === -1) { - status = ~this.status.indexOf("uploading") ? "uploading" : "success"; - if (status !== "uploading" && ~this.status.indexOf("error")) { - status = "error"; - } - } - return status; - }, - onComplete(action) { - let status = this.getStatus(); - this.$emit("complete", { - status, - urls: this.urls, - tempFiles: this.tempFiles, - action, - param: this.param - }); - }, - _success(res) { - let status = this.getStatus(); - this.$emit("success", { - status, - ...res, - param: this.param - }); - }, - _error(res) { - let status = this.getStatus(); - this.$emit("error", { - status, - ...res, - param: this.param - }); - }, - result(url, index) { - if (!url || index === void 0) - return; - this.$set(this.urls, index, url); - setTimeout(() => { - this.onComplete("upload"); - }, 0); - }, - toast(text) { - text && common_vendor.index.showToast({ - title: text, - icon: "none" - }); - }, - chooseImage() { - let max = Number(this.max); - common_vendor.index.chooseImage({ - count: max === -1 ? 9 : max - this.urls.length, - sizeType: this.sizeType, - sourceType: this.sourceType, - success: (e) => { - let imageArr = []; - for (let i = 0; i < e.tempFiles.length; i++) { - let len = this.urls.length; - if (len >= max && max !== -1) { - this.toast(`最多可上传${max}张图片`); - break; - } - let path = e.tempFiles[i].path; - if (this.suffix.length > 0) { - let format = ""; - format = path.split(".")[path.split(".").length - 1]; - if (this.suffix.indexOf(format) == -1) { - let text = `只能上传 ${this.suffix.join(",")} 格式图片!`; - this.toast(text); - continue; - } - } - let size = e.tempFiles[i].size; - if (Number(this.size) * 1024 * 1024 < size) { - let err = `单张图片大小不能超过:${this.size}MB`; - this.toast(err); - continue; - } - imageArr.push(path); - this.urls.push(path); - this.tempFiles.push(e.tempFiles[i]); - this.status.push(this.immediate ? "uploading" : "preupload"); - } - this.onComplete("choose"); - let start = this.urls.length - imageArr.length; - if (this.immediate) { - for (let j = 0; j < imageArr.length; j++) { - let index = start + j; - this.uploadImage(index, imageArr[j]).then((res) => { - this._success(res); - }).catch((res) => { - this._error(res); - }); - } - } - } - }); - }, - uploadImage(index, imgUrl, url) { - return new Promise((resolve, reject) => { - common_vendor.index.uploadFile({ - url: this.url || url, - name: this.name, - header: this.header, - formData: this.formData, - filePath: imgUrl, - success: (res) => { - if (res.statusCode === 200) { - this.$set(this.status, index, "success"); - resolve({ - res, - index - }); - } else { - this.$set(this.status, index, "error"); - reject({ - res, - index - }); - } - }, - fail: (res) => { - this.$set(this.status, index, "error"); - reject({ - res, - index - }); - } - }); - }); - }, - deleteImage(index) { - let status = this.getStatus(); - if (status === "uploading") { - this.toast("请等待上传结束再进行删除!"); - } else { - if (this.confirmDel) { - let _this = this; - common_vendor.index.showModal({ - content: "确定将该图片删除吗?", - showCancel: true, - confirmText: "确定", - success(res) { - if (res.confirm) { - _this.urls.splice(index, 1); - _this.tempFiles.splice(index, 1); - _this.status.splice(index, 1); - _this.onComplete("delete"); - _this.$emit("delete", { - index - }); - } - } - }); - } else { - this.urls.splice(index, 1); - this.tempFiles.splice(index, 1); - this.status.splice(index, 1); - this.onComplete("delete"); - this.$emit("delete", { - index - }); - } - } - }, - previewImage(index) { - if (this.status.length === 0) - return; - common_vendor.index.previewImage({ - current: this.urls[index], - loop: true, - urls: this.urls - }); - this.$emit("preview", { - index, - urls: this.urls - }); - }, - start() { - if (!this.url) { - this.toast("请传入服务器接口地址!"); - return; - } - let urls = [...this.urls]; - const len = urls.length; - for (let i = 0; i < len; i++) { - if (urls[i].startsWith("https")) { - continue; - } else { - this.$set(this.status, i, "uploading"); - this.uploadImage(i, urls[i], this.url).then((res) => { - this._success(res); - }).catch((error) => { - this._error(error); - }); - } - } - }, - upload(callback, index) { - if (index === void 0 || index === null) { - let urls = [...this.urls]; - const len = urls.length; - for (let i = 0; i < len; i++) { - if (urls[i].startsWith("https")) { - continue; - } else { - this.$set(this.status, i, "uploading"); - if (typeof callback === "function") { - callback(this.tempFiles[i]).then((res) => { - this.$set(this.status, i, "success"); - this.result(res, i); - }).catch((err) => { - this.$set(this.status, i, "error"); - }); - } - } - } - } else { - this.$set(this.status, index, "uploading"); - if (typeof callback === "function") { - callback(this.tempFiles[index]).then((res) => { - this.$set(this.status, index, "success"); - this.result(res, index); - }).catch((err) => { - this.$set(this.status, index, "error"); - }); - } - } - } - } -}; -if (!Array) { - const _easycom_fui_icon2 = common_vendor.resolveComponent("fui-icon"); - _easycom_fui_icon2(); -} -const _easycom_fui_icon = () => "../fui-icon/fui-icon.js"; -if (!Math) { - _easycom_fui_icon(); -} -function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { - return common_vendor.e({ - a: common_vendor.f($data.urls, (item, index, i0) => { - return common_vendor.e({ - a: item, - b: common_vendor.o(($event) => $options.previewImage(index), index), - c: $data.status[index] !== "success" && $data.status[index] !== "preupload" - }, $data.status[index] !== "success" && $data.status[index] !== "preupload" ? common_vendor.e({ - d: $data.status[index] === "error" - }, $data.status[index] === "error" ? { - e: "2d5d0fa0-0-" + i0, - f: common_vendor.p({ - name: "warning-fill", - color: "#fff", - size: 48 - }) - } : {}, { - g: $data.status[index] === "error" - }, $data.status[index] === "error" ? { - h: common_vendor.o(($event) => $options.reUpload(index), index) - } : {}, { - i: $data.status[index] === "uploading" - }, $data.status[index] === "uploading" ? {} : {}, { - j: $data.status[index] === "uploading" - }, $data.status[index] === "uploading" ? {} : {}) : {}, $props.isDel ? { - k: "2d5d0fa0-1-" + i0, - l: common_vendor.p({ - name: "close", - color: "#fff", - size: 32 - }), - m: $props.delColor, - n: common_vendor.o(($event) => $options.deleteImage(index), index) - } : {}, { - o: index - }); - }), - b: $props.width + "rpx", - c: $props.height + "rpx", - d: $props.radius + "rpx", - e: $props.isDel, - f: $props.width + "rpx", - g: $props.height + "rpx", - h: $props.radius + "rpx", - i: $options.showAdd - }, $options.showAdd ? { - j: common_vendor.p({ - name: "plus", - size: $props.addSize, - color: $props.addColor - }), - k: common_vendor.n($props.borderColor && $props.borderColor !== true ? "fui-upload__border" : "fui-upload__noborder"), - l: $props.width + "rpx", - m: $props.height + "rpx", - n: $props.background, - o: $props.radius + "rpx", - p: $props.borderColor, - q: $props.borderSytle, - r: common_vendor.o((...args) => $options.chooseImage && $options.chooseImage(...args)) - } : {}); -} -const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2d5d0fa0"]]); -wx.createComponent(Component); diff --git a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.json b/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.json deleted file mode 100644 index c5ac200d..00000000 --- a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "fui-icon": "../fui-icon/fui-icon" - } -} \ No newline at end of file diff --git a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxml b/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxml deleted file mode 100644 index 448e0d79..00000000 --- a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxml +++ /dev/null @@ -1 +0,0 @@ -重新上传请稍候... \ No newline at end of file diff --git a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxss b/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxss deleted file mode 100644 index 4bfedf39..00000000 --- a/dist/dev/mp-weixin/components/firstui/fui-upload/fui-upload.wxss +++ /dev/null @@ -1,115 +0,0 @@ - -.fui-upload__wrap.data-v-2d5d0fa0 { - - display: flex; - - flex-direction: row; - flex-wrap: wrap; -} -.fui-upload__item.data-v-2d5d0fa0 { - - display: flex; - - align-items: center; - justify-content: center; - margin-right: 20rpx; - margin-bottom: 20rpx; - - - - position: relative; - - - box-sizing: border-box; -} -.fui-upload__noborder.data-v-2d5d0fa0 { - border-width: 0; -} -.fui-upload__border.data-v-2d5d0fa0 { - border-width: 1px; -} -.fui-upload__del.data-v-2d5d0fa0 { - position: absolute; - top: 8rpx; - right: 8rpx; - height: 40rpx; - width: 40rpx; - - border-radius: 50%; - display: flex; - - - - - - align-items: center; - justify-content: center; - z-index: 10; -} -.fui-upload__mask.data-v-2d5d0fa0 { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - background: rgba(0, 0, 0, .6); - - display: flex; - - flex-direction: column; - align-items: center; - justify-content: center; -} -.fui-reupload__btn.data-v-2d5d0fa0 { - width: 144rpx; - - display: flex; - - align-items: center; - justify-content: center; - text-align: center; - padding: 4rpx 0; - font-size: 24rpx; - border: 1px solid #FFFFFF; - color: #fff; - border-radius: 32rpx; - margin-top: 16rpx; - font-weight: normal; -} -.fui-reupload__btn.data-v-2d5d0fa0:active { - opacity: .5; -} -.fui-upload__loading.data-v-2d5d0fa0 { - width: 32rpx; - height: 32rpx; - border-width: 2px; - border-style: solid; - border-top-color: #FFFFFF; - border-left-color: #7F7F7F; - border-right-color: #7F7F7F; - border-bottom-color: #7F7F7F; - - - - - border-radius: 50%; - animation: fui-rotate-2d5d0fa0 0.7s linear infinite; - - margin-bottom: 8rpx; -} -.fui-upload__text.data-v-2d5d0fa0 { - font-size: 24rpx; - color: #fff; - margin-top: 16rpx; - font-weight: normal; -} -@keyframes fui-rotate-2d5d0fa0 { -0% { - transform: rotate(0); -} -100% { - transform: rotate(360deg); -} -} - - diff --git a/dist/dev/mp-weixin/pages/index/index.js b/dist/dev/mp-weixin/pages/index/index.js index ee2fcad0..ee5083b3 100644 --- a/dist/dev/mp-weixin/pages/index/index.js +++ b/dist/dev/mp-weixin/pages/index/index.js @@ -386,7 +386,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ const { uniPlatform } = common_vendor.index.getSystemInfoSync(); if (uniPlatform !== "web") { handleLoginByWechat(); - Kongzhitai(); } else { const user2 = await composables_useCommon.loginByUsername({ username: "test456", @@ -406,6 +405,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ common_vendor.index.hideLoading(); console.log("------------result--------", result); common_vendor.index.setStorageSync("refreshToken", result.refresh_token); + role.value = true; }, fail: function(err) { common_vendor.index.showToast({ @@ -415,6 +415,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ } }); chatAiGetToken(); + Kongzhitai(); }; const { socketInit } = composables_useWorkFlow.useWorkFlow(); const handlePayMessage = async (order_id) => { @@ -433,9 +434,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ title: "正在退出登录...", mask: true }); - role.value = false; composables_useCommon.loginOut(); common_vendor.index.hideLoading(); + role.value = false; common_vendor.index.showToast({ title: "退出成功", icon: "none" diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index cbd9e1db..1f4745f0 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -326,14 +326,12 @@ const role = ref(false) function Kongzhitai() { if (!isLogin.value) { - role.value = false return 0 } const UserInfor = uni.getStorageSync('userInfo') console.log("-----------userInfo---------------",UserInfor) const roltList = ['operator', 'manager', 'admin'] - if (roltList.includes(UserInfor.role[0])) { role.value = true } @@ -763,11 +761,11 @@ }) //获取平台信息 const { uniPlatform } = uni.getSystemInfoSync() - + if (uniPlatform !== 'web') { // 非开发者工具环境,执行登录操作 handleLoginByWechat() - Kongzhitai() + } else { // console.log('dev') // 开发者工具环境,模拟登录 todo @@ -781,6 +779,7 @@ } chatAiGetToken() name_value.value = '我的' + } /** 通过微信登录 */ @@ -792,6 +791,7 @@ uni.hideLoading() console.log("------------result--------", result) uni.setStorageSync('refreshToken', result.refresh_token) + role.value = true }, fail: function (err) { @@ -802,6 +802,7 @@ } }) chatAiGetToken() + Kongzhitai() } const { socketInit } = useWorkFlow() @@ -823,11 +824,11 @@ title: '正在退出登录...', mask: true }) - role.value = false loginOut() uni.hideLoading() + role.value = false uni.showToast({ title: '退出成功', icon: 'none'