From bcadfb6de692c138774688efd7928a973d59860f Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 23 九月 2025 13:51:42 +0800
Subject: [PATCH] H5静态化

---
 server/src/main/resources/templates/mobile/js/cooperation.js |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/server/src/main/resources/templates/mobile/js/cooperation.js b/server/src/main/resources/templates/mobile/js/cooperation.js
index e69de29..f81fc82 100644
--- a/server/src/main/resources/templates/mobile/js/cooperation.js
+++ b/server/src/main/resources/templates/mobile/js/cooperation.js
@@ -0,0 +1,72 @@
+$(document).ready(function() {
+    let url = 'http://121.41.112.139:8099'
+    var product = null
+
+    $.ajax({
+        async: false,
+        url: 'http://www.dmtt.run:81/web/productList',
+        type: 'POST',
+        success: function (res) {
+            console.log(res)
+            let options = document.getElementById('options')
+            for (const item of res.data) {
+                $('#options').append(new Option(item.name, item.id))
+            }
+        },
+        error: function (error) {
+            console.log(error)
+        }
+    })
+});
+function submitInfo() {
+        let name = $('#name').val()
+        let product = $('#options').val()
+        let phone = $('#phone').val()
+        let email = $('#email').val()
+        var tableTop = $('#name').offset().top;
+        if (!product) {
+           $(document).scrollTop(tableTop);
+            alert('璇烽�夋嫨浜у搧鍚嶇О')
+            return
+        }
+        if (!name) {
+           $(document).scrollTop(tableTop);
+           $('#name').focus()
+            alert('璇疯緭鍏ュ鍚�')
+            return
+        }
+        if (!phone) {
+           $(document).scrollTop(tableTop);
+           $('#phone').focus()
+            alert('璇疯緭鍏ョ數璇�')
+            return
+        }
+        $.ajax({
+            url: 'http://www.dmtt.run:81/web/createCustomer',
+            data: JSON.stringify({
+                productId: product,
+                name: name,
+                phone: phone,
+                email: email
+            }),
+            type: "post",
+            dataType: "json",
+            crossDomain: true,
+            contentType: "application/json",
+            success: function (res) {
+                if (res.code !== 200) {
+                    alert(res.message)
+                    return
+                }
+                alert('鎮ㄥソ锛屾偍鐨勬暟鎹凡鎻愪氦锛屾垜浠細灏藉揩鍥炲鎮紒')
+                $('#name').val('');
+                $('#phone').val('');
+                $('#email').val('');
+                $('.filter-title').val('')
+                product = null
+            },
+            error: function (error) {
+                alert('鎻愪氦澶辫触锛�')
+            }
+        });
+    }
\ No newline at end of file

--
Gitblit v1.9.3