From 1baab1f4a769102bccf002fd99bc24949aa18bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 6 Jun 2025 11:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/agreement.js | 2 +- assets/js/audit.js | 160 ++++++++++++++++++++-------------------- assets/js/brand.js | 2 +- assets/js/carlist.js | 2 +- assets/js/dict.js | 2 +- assets/js/email.js | 2 +- assets/js/energy.js | 2 +- assets/js/model.js | 2 +- assets/js/newcarlist.js | 2 +- assets/js/seo.js | 2 +- assets/js/type.js | 2 +- assets/js/userList1.js | 156 +++++++++++++++++++-------------------- assets/main.js | 5 +- index.html | 20 +++-- 14 files changed, 183 insertions(+), 178 deletions(-) diff --git a/assets/js/agreement.js b/assets/js/agreement.js index 9198b94..7a20290 100755 --- a/assets/js/agreement.js +++ b/assets/js/agreement.js @@ -22,7 +22,7 @@ layui.use(['form','table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/agt/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/audit.js b/assets/js/audit.js index 46ea651..4b13ffe 100755 --- a/assets/js/audit.js +++ b/assets/js/audit.js @@ -1,7 +1,7 @@ -layui.use(['form', 'table'], function () { - var $ = layui.jquery, - form = layui.form, - table = layui.table; +layui.use(['form', 'table'], function () { + var $ = layui.jquery, + form = layui.form, + table = layui.table; // 获取当前语言 var currentLang = localStorage.getItem('language') || 'zh'; var lang = langConfig[currentLang]; @@ -23,12 +23,12 @@ layui.use(['form', 'table'], function () { .replace(/待审核/g, lang.audit.applied) .replace(/已审核/g, lang.audit.not_applied) $('#toolbarDemo').html(newHtmlt); - } - var tableInitb = table.render({ + } + var tableInitb = table.render({ elem: '#currentTableId', url: lang.baseUrl+'console/apply/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', @@ -45,12 +45,12 @@ layui.use(['form', 'table'], function () { "count": res.data.meta.total, //解析数据长度 "data": res.data.list //解析数据列表 }; - }, - cols: [[ - {type: "checkbox"}, - {field: 'id',title:"ID", sort: true}, - // {field: 'admin_name',minWidth: 100, title: lang.audit.admin_name}, - {field: 'name',minWidth: 100, title: lang.audit.product_name}, + }, + cols: [[ + {type: "checkbox"}, + {field: 'id',title:"ID", sort: true}, + // {field: 'admin_name',minWidth: 100, title: lang.audit.admin_name}, + {field: 'name',minWidth: 100, title: lang.audit.product_name}, {field: 'desc',minWidth: 150, title: lang.audit.audit_desc, templet: function (d) { var v='' @@ -61,7 +61,7 @@ layui.use(['form', 'table'], function () { } return v } - }, + }, {field: 'apply_status', title: lang.audit.status, templet: function (d) { var v='' @@ -76,38 +76,38 @@ layui.use(['form', 'table'], function () { } return v } - }, - {field: 'created_at',minWidth: 150,title: lang.audit.create_time}, - {field: 'updated_at',minWidth: 150,title: lang.audit.update_time}, - {title:lang.audit.operation, minWidth: 200, toolbar: '#currentTableBar', align: "center",fixed:'right'} - ]], - limits: [10, 15, 20, 25, 50, 100], - limit: 10, - page: true, + }, + {field: 'created_at',minWidth: 150,title: lang.audit.create_time}, + {field: 'updated_at',minWidth: 150,title: lang.audit.update_time}, + {title:lang.audit.operation, minWidth: 200, toolbar: '#currentTableBar', align: "center",fixed:'right'} + ]], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, skin: 'line', done: function(res, curr, count){ window.i18n.updatePageContent(); - } - }); - // 监听搜索操作 - form.on('submit(data-search-btn)', function (data) { - //执行搜索重载 - table.reload('currentTableId', { - page: { - curr: 1 - } - , where: { - vehicle_data_name: data.field.vehicle_data_name - } - }, 'data'); - - return false; - }); - - /** - * toolbar监听事件 - */ - table.on('toolbar(currentTableFilter)', function (obj) { + } + }); + // 监听搜索操作 + form.on('submit(data-search-btn)', function (data) { + //执行搜索重载 + table.reload('currentTableId', { + page: { + curr: 1 + } + , where: { + vehicle_data_name: data.field.vehicle_data_name + } + }, 'data'); + + return false; + }); + + /** + * toolbar监听事件 + */ + table.on('toolbar(currentTableFilter)', function (obj) { if (obj.event === 'all') { // 监听添加操作 table.reload('currentTableId', { page: { @@ -117,7 +117,7 @@ layui.use(['form', 'table'], function () { apply_status:'' } }, 'data'); - + } else if (obj.event === 'apply') { table.reload('currentTableId', { page: { @@ -126,7 +126,7 @@ layui.use(['form', 'table'], function () { , where: { apply_status: 1 } - }, 'data'); + }, 'data'); } else if (obj.event === 'noapply') { table.reload('currentTableId', { page: { @@ -135,34 +135,34 @@ layui.use(['form', 'table'], function () { , where: { apply_status: 0 } - }, 'data'); - } - }); - - //监听表格复选框选择 - table.on('checkbox(currentTableFilter)', function (obj) { - console.log(obj) - }); - - table.on('tool(currentTableFilter)', function (obj) { - var data = obj.data; - if (obj.event === 'edit') { - - var index = layer.open({ - title: lang.audit.edit_title, - type: 2, - shade: 0.2, - maxmin:true, - shadeClose: true, + }, 'data'); + } + }); + + //监听表格复选框选择 + table.on('checkbox(currentTableFilter)', function (obj) { + console.log(obj) + }); + + table.on('tool(currentTableFilter)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { + + var index = layer.open({ + title: lang.audit.edit_title, + type: 2, + shade: 0.2, + maxmin:true, + shadeClose: true, area: ['70%', '90%'], - btn: [lang.audit.confirm, lang.audit.cancel], - content: '../page/table/carlistedit.html?id='+data.id, - }); - $(window).on("resize", function () { - layer.full(index); - }); - return false; - } else if (obj.event === 'delete') { + btn: [lang.audit.confirm, lang.audit.cancel], + content: '../page/table/carlistedit.html?id='+data.id, + }); + $(window).on("resize", function () { + layer.full(index); + }); + return false; + } else if (obj.event === 'delete') { layer.confirm(lang.audit.confirm_delete, function(index) { self.applydelete({ type:'post', @@ -180,8 +180,8 @@ layui.use(['form', 'table'], function () { } }) - }); - } else if (obj.event === 'check') { // 监听删除操作 + }); + } else if (obj.event === 'check') { // 监听删除操作 var index = layer.open({ title: lang.audit.check, type: 2, @@ -215,8 +215,8 @@ layui.use(['form', 'table'], function () { }); submit.trigger('click'); } - }); - } else if (obj.event === 'show') { // 监听删除操作 + }); + } else if (obj.event === 'show') { // 监听删除操作 var index = layer.open({ title: lang.audit.show, type: 2, @@ -225,8 +225,8 @@ layui.use(['form', 'table'], function () { shadeClose: false, area: ['60%', '85%'], content: '../page/table/auditshow.html?id='+data.id - }); - } - }); - + }); + } + }); + }); \ No newline at end of file diff --git a/assets/js/brand.js b/assets/js/brand.js index 231b857..de66ee4 100755 --- a/assets/js/brand.js +++ b/assets/js/brand.js @@ -22,7 +22,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/brand/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/carlist.js b/assets/js/carlist.js index 8dc5f77..52d07ca 100755 --- a/assets/js/carlist.js +++ b/assets/js/carlist.js @@ -33,7 +33,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/vehicle/data/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/dict.js b/assets/js/dict.js index 3a7aff3..4c2fca1 100755 --- a/assets/js/dict.js +++ b/assets/js/dict.js @@ -7,7 +7,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: 'console/brand/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/email.js b/assets/js/email.js index 0b741fe..a2f1378 100755 --- a/assets/js/email.js +++ b/assets/js/email.js @@ -9,7 +9,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/email/subscribe', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, // toolbar: '#toolbarDemo', diff --git a/assets/js/energy.js b/assets/js/energy.js index b4e73e8..16f3018 100755 --- a/assets/js/energy.js +++ b/assets/js/energy.js @@ -22,7 +22,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/energy/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/model.js b/assets/js/model.js index 806bef4..59f4614 100755 --- a/assets/js/model.js +++ b/assets/js/model.js @@ -22,7 +22,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/models/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/newcarlist.js b/assets/js/newcarlist.js index a18f81d..f027364 100755 --- a/assets/js/newcarlist.js +++ b/assets/js/newcarlist.js @@ -33,7 +33,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/vehicle/new/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/seo.js b/assets/js/seo.js index 2ba1148..415bc76 100755 --- a/assets/js/seo.js +++ b/assets/js/seo.js @@ -22,7 +22,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/seo/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/type.js b/assets/js/type.js index 3697e1f..88ca1ef 100755 --- a/assets/js/type.js +++ b/assets/js/type.js @@ -22,7 +22,7 @@ layui.use(['form', 'table'], function () { elem: '#currentTableId', url: lang.baseUrl+'console/types/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, toolbar: '#toolbarDemo', diff --git a/assets/js/userList1.js b/assets/js/userList1.js index 1399cfa..f4abea8 100755 --- a/assets/js/userList1.js +++ b/assets/js/userList1.js @@ -1,8 +1,8 @@ -layui.use(['form', 'table','laytpl','laypage'], function () { - var $ = layui.jquery, +layui.use(['form', 'table','laytpl','laypage'], function () { + var $ = layui.jquery, form = layui.form, - laytpl = layui.laytpl, - laypage = layui.laypage, + laytpl = layui.laytpl, + laypage = layui.laypage, table = layui.table; // 获取当前语言 var currentLang = localStorage.getItem('language') || 'zh'; @@ -15,12 +15,12 @@ layui.use(['form', 'table','laytpl','laypage'], function () { $('#currentTableBar').html(newHtml); } form.render(); - - var tableInitb = table.render({ + + var tableInitb = table.render({ elem: '#currentTableId', url: lang.baseUrl+'console/users/list', headers: { - Authorization: sessionStorage.tokencar, + Authorization: 'Bearer ' + sessionStorage.tokencar, lang:localStorage.getItem('language')?localStorage.getItem('language'):"zh" }, // toolbar: '#toolbarDemo', @@ -37,22 +37,22 @@ layui.use(['form', 'table','laytpl','laypage'], function () { "count": res.data.meta.total, //解析数据长度 "data": res.data.list //解析数据列表 }; - }, - cols: [[ - {type: "checkbox"}, - {field: 'id', title: 'ID', sort: true}, - {field: 'user_sn', title: lang.userlist.user_id, sort: true}, - {field: 'username', title: lang.userlist.nickname}, + }, + cols: [[ + {type: "checkbox"}, + {field: 'id', title: 'ID', sort: true}, + {field: 'user_sn', title: lang.userlist.user_id, sort: true}, + {field: 'username', title: lang.userlist.nickname}, {field: 'avatar',title: lang.userlist.head, templet: function(d){ var img= '' return img; } - }, - {field: 'realname', title:lang.userlist.realname}, - {field: 'phone',title: lang.userlist.phone_number}, - {field: 'company', title: lang.userlist.company}, - {field: 'openid', title: lang.userlist.wechat_id}, + }, + {field: 'realname', title:lang.userlist.realname}, + {field: 'phone',title: lang.userlist.phone_number}, + {field: 'company', title: lang.userlist.company}, + {field: 'openid', title: lang.userlist.wechat_id}, {field: 'status', title:lang.alllist.status, templet: function(d){ var v='' @@ -64,42 +64,42 @@ layui.use(['form', 'table','laytpl','laypage'], function () { } return v }, - }, - {field: 'created_at',title: lang.userlist.create_time}, - {field: 'updated_at',title: lang.userlist.update_time}, - {title: lang.carlist.operation, minWidth: 150, toolbar: '#currentTableBar', align: "center"} - ]], - limits: [10, 15, 20, 25, 50, 100], - limit: 10, - page: true, - skin: 'line' - }); - // 监听搜索操作 - form.on('submit(data-search-btn)', function (data) { - var result = JSON.stringify(data.field); - - //执行搜索重载 - table.reload('currentTableId', { - page: { - curr: 1 - } - , where: { + }, + {field: 'created_at',title: lang.userlist.create_time}, + {field: 'updated_at',title: lang.userlist.update_time}, + {title: lang.carlist.operation, minWidth: 150, toolbar: '#currentTableBar', align: "center"} + ]], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + skin: 'line' + }); + // 监听搜索操作 + form.on('submit(data-search-btn)', function (data) { + var result = JSON.stringify(data.field); + + //执行搜索重载 + table.reload('currentTableId', { + page: { + curr: 1 + } + , where: { user_sn: data.field.user_sn, - nickname: data.field.nickname, - realname: data.field.realname, - phone: data.field.phone, - openid: data.field.openid, - } - }, 'data'); - - return false; - }); - - /** - * toolbar监听事件 - */ - table.on('toolbar(currentTableFilter)', function (obj) { - if (obj.event === 'add') { // 监听添加操作 + nickname: data.field.nickname, + realname: data.field.realname, + phone: data.field.phone, + openid: data.field.openid, + } + }, 'data'); + + return false; + }); + + /** + * toolbar监听事件 + */ + table.on('toolbar(currentTableFilter)', function (obj) { + if (obj.event === 'add') { // 监听添加操作 var index = layer.open({ title: lang.userlist.add, type: 2, @@ -133,25 +133,25 @@ layui.use(['form', 'table','laytpl','laypage'], function () { }); submit.trigger('click'); } - }); - $(window).on("resize", function () { - layer.full(index); - }); - } else if (obj.event === 'delete') { // 监听删除操作 - var checkStatus = table.checkStatus('currentTableId') - , data = checkStatus.data; - layer.alert(JSON.stringify(data)); - } - }); - - //监听表格复选框选择 - table.on('checkbox(currentTableFilter)', function (obj) { - console.log(obj) - }); - - table.on('tool(currentTableFilter)', function (obj) { - var data = obj.data; - if (obj.event === 'edit') { + }); + $(window).on("resize", function () { + layer.full(index); + }); + } else if (obj.event === 'delete') { // 监听删除操作 + var checkStatus = table.checkStatus('currentTableId') + , data = checkStatus.data; + layer.alert(JSON.stringify(data)); + } + }); + + //监听表格复选框选择 + table.on('checkbox(currentTableFilter)', function (obj) { + console.log(obj) + }); + + table.on('tool(currentTableFilter)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { var index = layer.open({ title:lang.audit.edit_title, type: 2, @@ -187,8 +187,8 @@ layui.use(['form', 'table','laytpl','laypage'], function () { $(window).on("resize", function () { layer.full(index); }); - return false; - } else if (obj.event === 'delete') { + return false; + } else if (obj.event === 'delete') { layer.confirm(lang.audit.confirm_delete, function(index) { self.usersdelete({ type:'post', @@ -206,8 +206,8 @@ layui.use(['form', 'table','laytpl','laypage'], function () { } }) - }); - } - }); - + }); + } + }); + }); \ No newline at end of file diff --git a/assets/main.js b/assets/main.js index 821b874..2392154 100755 --- a/assets/main.js +++ b/assets/main.js @@ -3,7 +3,8 @@ var ajax = null,queue = []; var isAjaxLock=false; var Utils={} var userinfowifi=''; -var baseUrl = "https://server.orzar.shop/"; +// var baseUrl = "https://server.orzar.shop/"; +var baseUrl = "https://usedcar.server.hnxinyouhe.com/"; // var baseUrl = "http://192.168.50.6:8787/"; if(sessionStorage.wifiuserinfo){ userinfowifi=JSON.parse(sessionStorage.wifiuserinfo) @@ -117,7 +118,7 @@ ajax = function(options){ async: options.async, cache: options.cache, beforeSend: function(request) { - // request.setRequestHeader("Authorization",'Bearer ' + sessionStorage.tokencar); + request.setRequestHeader("Authorization",'Bearer ' + sessionStorage.tokencar); request.setRequestHeader("lang",localStorage.getItem('language')?localStorage.getItem('language'):"zh"); }, diff --git a/index.html b/index.html index 8dfa420..4b0f02d 100644 --- a/index.html +++ b/index.html @@ -100,12 +100,12 @@
- +
- +
@@ -157,7 +157,8 @@ $(this).addClass('icon-check'); } }); - + // var baseUrl = "https://server.orzar.shop/"; + var baseUrl = "https://usedcar.server.hnxinyouhe.com/"; // 进行登录操作 form.on('submit(login)', function (data) { data = data.field; @@ -171,16 +172,19 @@ } // $(".login-btn").attr('disabled', 'disabled') // var loading = layer.load(0, {shade: false}); - window.location = 'home.html'; - return false; + // window.location = 'home.html'; + // return false; $.ajax({ - url:'/Api/server/login', + url:baseUrl+'console/user/login', type:'POST', + beforeSend: function(request) { + request.setRequestHeader("lang",localStorage.getItem('language')?localStorage.getItem('language'):"zh"); + }, data:data, success: function(result, textStatus){ - if(result.token){ + if(result.code==0){ layer.msg(window.i18n.translate('login.success'), function () { - sessionStorage.tokencar= result.token + sessionStorage.tokencar= result.data.token window.location = 'home.html'; }); }else{