123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- $(function(){
-
- $(document).ready(function () {
-
-
- $('#uploadButton').click(function () {
- $('#imagePic').click();
- });
- $("#imagePic").on("change", function (e) {
- var file = e.target.files[0]; //获取图片资源
- var fileTypes = ["bmp", "jpg", "png", "jpeg"];
- var bTypeMatch = false
- for (var i = 0; i < fileTypes.length; i++) {
- var start = file.name.lastIndexOf(".");
- var fileType = file.name.substring(start + 1);
- if (fileType.toLowerCase() == fileTypes[i]) {
- bTypeMatch = true;
- break;
- }
- }
- if (bTypeMatch) {
- if (file.size <= 1024 * 1024 * 10) {
- var reader = new FileReader();
- reader.readAsDataURL(file); // 读取文件
- // 渲染文件
- reader.onload = function (arg) {
- $("#uploadButtonInput").val(arg.target.result);
- $("#uploadButton").css("background", "url("+arg.target.result+") no-repeat center")
- $("#uploadButton").css("border", '1px solid #b8b9ba')
- $("#uploadButton").css("border-radius",'10px')
-
- }
- } else {
- alert('仅支持不超过10M的图片');
-
- // btnUploadText = '上传'
- // $("#uploadButton").text(btnUploadText)
- return false;
- }
- } else {
- alert('仅限bmp,jpg,png,jpeg图片格式');
-
- // btnUploadText = '上传'
- // $("#uploadButton").text(btnUploadText)
- return false;
- }
- });
- })
- //---------初始化数据部分-----------
- var contact_number_list=["+86","+87","+88"]
- var location=[{
- icon:"🇨🇳",
- name:"China"
- },{
- icon:"🇺🇸",
- name:"USA"
- },{
- icon:"🇪🇸",
- name:"Spain"
- }
- ]
-
- var province=["aaa","bbb","ccc"]
- var city=["aaa1","bbb2","ccc3"]
- //---------初始化数据部分end-----------
- //页面初始化
- contact_number_list.forEach(item=>{
- var li=$("<option>"+item+"</option>")
- $(".showqulist").append(li)
- })
- location.forEach(item=>{
- var li=$("<option>"+item.icon+' '+item.name+"</li>")
- $(".showlistLocation1").append(li)
- })
- province.forEach(item=>{
- //var li=$("<li class='contact_location2_li' txt="+item+"><a >"+item+"</a></li>")
- var li=$("<option>"+item+"</option>")
- $(".showlistLocation2").append(li)
- })
- city.forEach(item=>{
- //var li=$("<li class='contact_location3_li' txt="+item+"><a >"+item+"</a></li>")
- var li=$("<option>"+item+"</option>")
- $(".showlistLocation3").append(li)
- })
-
-
- var html_contact_number=$("#contact_number").html();
- var html_contact_email=$("#contact_email").html();
- var html_contact_location=$("#contact_location").html();
-
-
- $("#contact_number_add").click(function(){
- $("#contact_number").append(html_contact_number)
-
- $("#contact_number_remove").show()
- })
- $("#contact_number_remove").click(function(){
- $("#contact_number .row-fluid").eq(-1).remove();
- if($("#contact_number .row-fluid").length==1){
- $("#contact_number_remove").hide()
- }
- })
-
- $("#contact_email_add").click(function(){
- $("#contact_email").append(html_contact_email)
-
- $("#contact_email_remove").show()
- })
- $("#contact_email_remove").click(function(){
- $("#contact_email input").eq(-1).remove();
- if($("#contact_email input").length==1){
- $("#contact_email_remove").hide()
- }
- })
-
-
- $("#contact_location_add").click(function(){
- $("#contact_location").append(html_contact_location)
-
- $("#contact_location_remove").show()
- })
- $("#contact_location_remove").click(function(){
- $("#contact_location .row-fluid").eq(-1).remove();
- if($("#contact_location .row-fluid").length==1){
- $("#contact_location_remove").hide()
- }
- })
-
-
-
-
- $.validator.setDefaults({
- submitHandler: function() {
- var submitlogo=$("#uploadButtonInput").val();
- if(!submitlogo){
- alert("请上传公司logo")
- }
- }
- });
- $("#form").validate()
-
-
- //页面初始化end
- })
|