From daede3be8445e09aa261e1362b5a88bf7bb9d5ec Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期五, 21 三月 2025 17:33:31 +0800 Subject: [PATCH] 1.新增照片上传功能 2.新增图片配置 --- Scripts/config.js | 5 +- H5/Js/LLJ/Add.js | 29 +++++++++++++- Mst.master | 2 H5/LLJ/Add.aspx | 37 ++++++++++++++++++ 4 files changed, 67 insertions(+), 6 deletions(-) diff --git a/H5/Js/LLJ/Add.js b/H5/Js/LLJ/Add.js index 1c4521f..6e8c5be 100644 --- a/H5/Js/LLJ/Add.js +++ b/H5/Js/LLJ/Add.js @@ -280,7 +280,7 @@ } }); that.tableData = tableData; - + that.GetImageFileByGid(); //if (that.tableData.length === 0) { // that.isShowTable = true; //} @@ -405,6 +405,7 @@ async afterRead(file) { try { + //alert(APIURL_IMAGE); // 1. 鏄剧ず涓婁紶涓姸鎬� file.status = 'uploading'; file.message = '涓婁紶涓�...'; @@ -456,6 +457,30 @@ // 8. 寮哄埗鏇存柊瑙嗗浘锛圴ant 3+ 鍙兘闇�瑕侊級 this.$nextTick(); } - } + }, + //鑾峰彇鍥剧墖淇℃伅 + GetImageFileByGid() { + const that = this; + that.AxiosHttp("post", 'Llj/getImage', { + gid: that.formData.guid, + Remarks: that.remarks + }, true, 0).then(res1 => { + if (res1.status === 0) { + // 鍏抽敭杞崲锛氬皢鍚庣鏁版嵁杞崲涓� van-uploader 闇�瑕佺殑鏍煎紡 + that.fileList = res1.data.tbBillList.map(item => ({ + url: `${APIURL_IMAGE}/${item.urlPath}`, // 鎷兼帴瀹屾暣璁块棶璺緞 + status: 'done', // 鏍囪涓哄凡涓婁紶鎴愬姛 + name: item.fileTitle, // 鍙�夋樉绀烘枃浠跺悕 + message: '宸蹭笂浼�', // 鍙�夌姸鎬佹枃瀛� + // 淇濈暀鍘熷鏁版嵁锛堟寜闇�锛� + id: item.guid + })); + } else { + that.$toast.fail(res1.rtnMsg); + } + }).catch(error => { + that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�"); + }); + }, } }) \ No newline at end of file diff --git a/H5/LLJ/Add.aspx b/H5/LLJ/Add.aspx index 5c8b4d8..6e29016 100644 --- a/H5/LLJ/Add.aspx +++ b/H5/LLJ/Add.aspx @@ -233,6 +233,25 @@ padding: 8px 12px; } + /* 鍥剧墖涓婁紶澶у皬 */ + .van-uploader__preview-image { + width: 80px; + height: 80px; + object-fit: cover; + } + .van-uploader__upload{ + width: 80px; + height: 80px; + } + .uploader-container { + height: auto; + overflow-y: auto; + -webkit-overflow-scrolling: touch; /* 娴佺晠婊氬姩锛坕OS锛� */ + } + .van-uploader__preview-delete-icon{ + font-size: 1.8em; + } + </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"> @@ -329,7 +348,23 @@ </van-dialog> </van-cell-group> </div> - <div><van-uploader v-model="fileList" :after-read="afterRead" /></div> + <!-- 鏂瑰紡 --> + <div class="uploader-container"> + <!-- 浣跨敤 field 鏍峰紡鍖呰9 --> + <div class="van-cell van-field" style="padding: 10px 16px"> + <!-- 宸︿晶鏍囩 --> + <div class="van-field__label" style="width: 90px">鍥剧墖涓婁紶</div> + + <!-- 鍙充晶涓婁紶鍖哄煙 --> + <div class="van-field__body" style="flex: 1"> + <van-uploader + v-model="fileList" + :after-read="afterRead" + style="padding: 8px 0" + /> + </div> + </div> +</div> <%-- <van-button :loading="ttrre" type="info" loading-text="鍔犺浇涓�..." v-if="!isShowTable && formData.fsubmit == 0" @click="submit">妫�楠屾彁浜�</van-button> <van-button type="danger" v-if="!isShowTable && formData.fsubmit == 0" @click="removeXJ">閲嶆柊鍔犺浇椤圭洰</van-button>--%> <%-- <van-button :loading="ttrre" type="info" loading-text="鍔犺浇涓�..." @click="submit">妫�楠屾彁浜�</van-button> diff --git a/Mst.master b/Mst.master index a3bf683..b1614dc 100644 --- a/Mst.master +++ b/Mst.master @@ -11,7 +11,7 @@ <script src="/Scripts/vue.min.js"></script> <script src="/Scripts/js.cookie.min.js"></script> <script src="/scripts/axios0.25.0.js"></script> - <script src="/scripts/config.js?<%=1234 %>"></script> + <script src="/scripts/config.js?<%=1236 %>"></script> <link href="/scripts/vant/vant.css" rel="stylesheet" /> <script src="/scripts/vant/vant.js"></script> <link href="/Images/Style.css?<%=16991 %>" rel="stylesheet" /> diff --git a/Scripts/config.js b/Scripts/config.js index 6dc82ab..1076362 100644 --- a/Scripts/config.js +++ b/Scripts/config.js @@ -1,6 +1,7 @@ -锘�//var APIURL = "http://192.168.1.145:83/api/"; -var APIURL = "http://localhost:5204/api/"; +锘縱ar APIURL = "http://192.168.1.145:83/api/"; +//var APIURL = "http://localhost:5204/api/"; var APIURL_PC = "http://192.168.1.145:81/"; +var APIURL_IMAGE = APIURL_PC+"upload/"; var ISNEEDLOGIN = true; String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); -- Gitblit v1.9.3