Browse Source

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

李广朋 9 năm trước cách đây
mục cha
commit
5c7c348679

+ 12 - 9
core/src/qfw/member/yellowpage.go

@@ -35,7 +35,7 @@ type Yellowpage struct {
 	showEnterprise xweb.Mapper `xweb:"/member/yellowpage/show/enterprise/(\\w+)"`  //显示企黄页信息
 	showService    xweb.Mapper `xweb:"/member/yellowpage/show/showService/(\\w+)"` //显示添加服务页面
 	editService    xweb.Mapper `xweb:"/member/yellowpage/edit/showService/(\\w+)"` //编辑服务页面
-	updateEntLogo  xweb.Mapper `xweb:"POST /member/yellowpage/updateEntLogo"`      //修改企业logo
+	upLoadEntImg   xweb.Mapper `xweb:"POST /member/yellowpage/upLoadEntImg"`       //上传企业相关图片
 
 	addService    xweb.Mapper `xweb:"/member/yellowpage/add/service/addservice"` //增加服务
 	delservice    xweb.Mapper `xweb:"POST /member/service/delservice"`           //删除数据
@@ -211,11 +211,6 @@ func (yp *Yellowpage) Dosave() error {
 	data["s_enturl"] = Repl(yp.GetString("s_enturl"))
 	data["s_qq"] = Repl(yp.GetString("s_qq"))
 	data["s_weixin"] = Repl(yp.GetString("s_weixin"))
-	images := yp.GetString("imgurl")
-	//上传二维码图片
-	if len(images) > 0 {
-		data["s_weixinbarcode"] = images
-	}
 	province, _ := yp.GetInt("province")
 	data["i_province"] = province
 	city, _ := yp.GetInt("city")
@@ -636,12 +631,20 @@ func checkuser(yp *Yellowpage) bool {
 }
 
 //上传企业logo
-func (yp *Yellowpage) UpdateEntLogo() error {
+func (yp *Yellowpage) UpLoadEntImg() error {
 	//更新企业logo
 	entid := yp.GetSession("entid").(string)
-	bol := mongodb.Update("enterprise", "{'_id':'"+entid+"'}", map[string]interface{}{"$set": map[string]interface{}{"s_avatar": yp.GetString("url")}}, false, false)
+	field := yp.GetString("field")
+	if field == "s_avatar" {
+		field = "s_avatar"
+	} else {
+		field = "s_qrcode"
+	}
+	bol := mongodb.Update("enterprise", "{'_id':'"+entid+"'}", map[string]interface{}{"$set": map[string]interface{}{field: yp.GetString("url")}}, false, false)
 	redis.Del("enterprise", "enterpriseInfo_"+entid, "newIndentEnts")
-	redis.DelByCodePattern("enterprise", "ipcity_*")
+	if field == "s_avatar" {
+		redis.DelByCodePattern("enterprise", "ipcity_*")
+	}
 	if bol {
 		elastic.UpdateEntDoc(entid)
 		return yp.Write("y")

+ 7 - 1
core/src/qfw/microwebsite/microwebsite.go

@@ -301,7 +301,13 @@ func (m *MicroWebsite) AjaxPorcess() error {
 			elastic.DelById("service", "service", _id) //删除该企业的elastic数据
 		}
 	} else if reqType == "entImg" { //修改企业logo
-		b := Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": M{m.GetString("field"): m.GetString("src")}}, false, false)
+		field := m.GetString("field")
+		if field == "s_avatar" {
+			field = "s_avatar"
+		} else {
+			field = "s_qrcode"
+		}
+		b := Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": M{field: m.GetString("src")}}, false, false)
 		if b {
 			elastic.UpdateEntDoc(entId) //更新该企业的elastic数据
 			result["status"] = "y"

+ 35 - 17
core/src/web/templates/member/editenterprise.html

@@ -105,11 +105,11 @@ var entType="企业"
 						<div class="two"><script>document.write(entType)</script>LOGO:</div> 
 						<div class="three" id="logoArea">
 							{{if .T.entinfo.s_avatar}}
-							<img class='ent-LOGO cursor-pointer' src='{{.T.entinfo.s_avatar}}' onerror="$(this).next().removeClass('hide');$(this).remove();" onclick="document.getElementById('upload').click();">
+							<img class='ent-LOGO cursor-pointer' src='{{.T.entinfo.s_avatar}}' onerror="$(this).next().removeClass('hide');$(this).remove();" onclick="document.getElementById('upload').click();uploadType=0;">
 							{{end}}
 							<div{{if .T.entinfo.s_avatar}} class="hide"{{end}}>
-								<img src="/images/services/default.png" style="width: 90px; height: 90px;cursor: pointer;" onclick="document.getElementById('upload').click();">
-								<div id="tips" style="cursor: pointer;text-align: center; width: 90px; position: absolute; color: #fff; top: 64px; background-color: #cccccc;"  onclick="document.getElementById('upload').click();">上传logo</div>
+								<img src="/images/services/default.png" style="width: 90px; height: 90px;cursor: pointer;" onclick="document.getElementById('upload').click();uploadType=0;">
+								<div id="tips" style="cursor: pointer;text-align: center; width: 90px; position: absolute; color: #fff; top: 64px; background-color: #cccccc;"  onclick="document.getElementById('upload').click();uploadType=0;">上传logo</div>
 								<span class="margin-l-10" style="position: relative;top: 33px;">上传一张不超过10M的图片,支持jpg、png、bmp格式。建议尺寸260*260像素</span>
 							</div>
 						</div> 
@@ -132,14 +132,8 @@ var entType="企业"
 						<div class="one"><span class="glyphicon weixinhao icon_gray"></span></div> 
 						<div class="two" style="letter-spacing: 4.5px;">微信号&nbsp;:</div> 
 						<div class="three" id="mblocation"><input type="text" name="s_weixin" class="form-control" id="s_weixin" value="{{.T.entinfo.s_weixin}}" maxlength="20">
-						 <a href="#" class="text-primary "  onClick="uploadBarCode();">上传二维码</a>
-						 <img class="imgs barcode" alt="预览" name="imgurl" style="margin-left:10px;width:35px;height:35px;" src="{{Msg "seo" "cdn"}}{{.T.entinfo.s_weixinbarcode}}">
-						<div  style="display:none;">
-							<div class="mupload"></div>
-							<ul  class="pic">
-							</ul>
-							<input type="hidden" value=""  class="imgs" name="imgurl"/>
-						</div>
+							<a href="#" class="text-primary "  onClick="document.getElementById('upload').click();uploadType=1;">上传二维码</a>
+							<img class="imgs barcode" style="margin-left:10px;width:35px;height:35px;{{if not .T.entinfo.s_qrcode}}display:none;{{end}}" src="{{Msg "seo" "cdn"}}{{.T.entinfo.s_qrcode}}" onerror="$(this).hide();">
 						</div> 
 					</div> 
 				</div>
@@ -210,30 +204,51 @@ var entType="企业"
 </body>
 
 <script>
+var uploadType = 0;
 //
 var option={
 	btnname:"",
 	action:"/filemanage/upload",
 	btnClass:"",
 	afterError:function(data,e){
-		alert("上传LOGO失败,请重新上传。");
+		if(uploadType == 1){
+			alert("上传二维码失败,请重新上传。");
+		}else{
+			alert("上传LOGO失败,请重新上传。");
+		}
 	},
 	afterUpload:function(data){ //此处可以重写,上传后的处理
 		if(data.flag == true){
+			var field = "s_avatar";
+			if(uploadType == 1){
+				field = "s_qrcode";
+			}
 			$.ajax({
 			  	type: "POST",
-			  	url: "/member/yellowpage/updateEntLogo",
-			  	data: "url="+data.url,
+			  	url: "/member/yellowpage/upLoadEntImg",
+			  	data: "field="+field+"&url="+data.url,
 			 	dataType: "text",
 			  	success: function(result){
 					if (result == "y"){
-						$("#logoArea").html('<img class="ent-LOGO cursor-pointer" src="'+data.url+'" onclick="document.getElementById(\'upload\').click();">');
+						if(uploadType == 1){
+							$(".barcode").attr("src",data.url).show();
+						}else{
+							$("#logoArea").html('<img class="ent-LOGO cursor-pointer" src="'+data.url+'" onclick="document.getElementById(\'upload\').click();uploadType=0;">');
+						}
 					}else{
-						alert("上传LOGO失败,请重新上传。");
+						if(uploadType == 1){
+							alert("上传二维码失败,请重新上传。");
+						}else{
+							alert("上传LOGO失败,请重新上传。");
+						}
 					}
 				},
 				error: function(){
-					alert("上传LOGO失败,请重新上传。");
+					if(uploadType == 1){
+						alert("上传二维码失败,请重新上传。");
+					}else{
+						alert("上传LOGO失败,请重新上传。");
+					}
 				}
 			});
 		}else{
@@ -245,6 +260,9 @@ try{
 	$("#uploadLogo").upload(option);
 }catch(e){}
      //
+function uploadProcess(url,field){
+	
+}
 $("#s_persion").blur(function(){
 	var str = $("#s_persion").val();
 	if (str == ""){

+ 4 - 4
core/src/web/templates/member/showenterprise.html

@@ -136,8 +136,8 @@ var entType="企业"
 						<div class="one"><span class="glyphicon weixinhao icon_gray"></span></div> 
 						<div class="two" style="letter-spacing: 4.5px;">微信号&nbsp;:</div> 
 						<div class="three"><span class="span999">{{.T.entinfo.s_weixin}}</span> 
-						{{if .T.entinfo.s_weixinbarcode}}
-						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.entinfo.s_weixinbarcode}});">扫一扫</a>
+						{{if .T.entinfo.s_qrcode}}
+						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.entinfo.s_qrcode}});">扫一扫</a>
 						{{end}}
 						</div>
 					</div> 
@@ -501,8 +501,8 @@ function clearWeixin(){
 	}
 }
 //
-var s_weixinbarcode = {{.T.entinfo.s_weixinbarcode}}
-  if (s_weixinbarcode == ""){
+var s_qrcode = {{.T.entinfo.s_qrcode}}
+  if (s_qrcode == ""){
 	$(".span999").next().css("display","none")
 }
 //手机号

+ 2 - 2
core/src/web/templates/yellowpage/ungxenterpriseinfo.html

@@ -132,8 +132,8 @@
 						<div class="one"><span class="glyphicon weixinhao icon_gray"></span></div> 
 						<div class="two" style="letter-spacing: 5px;">微信号:</div> 
 						<div class="three"><span class="span999">{{.T.res.s_weixin}}</span>
-						{{if .T.res.s_weixinbarcode}}
-						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_weixinbarcode}});">扫一扫</a>
+						{{if .T.res.s_qrcode}}
+						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_qrcode}});">扫一扫</a>
 						{{end}}
 						</div>
 					</div> 

+ 2 - 2
core/src/web/templates/yellowpage/unrzenterpriseinfo.html

@@ -132,8 +132,8 @@
 						<div class="one"><span class="glyphicon weixinhao icon_gray"></span></div> 
 						<div class="two" style="letter-spacing: 5px;">微信号:</div> 
 						<div class="three"><span class="span999">{{.T.res.s_weixin}}</span>
-						{{if .T.res.s_weixinbarcode}}
-						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_weixinbarcode}});">扫一扫</a>
+						{{if .T.res.s_qrcode}}
+						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_qrcode}});">扫一扫</a>
 						{{end}}
 						</div>
 					</div> 

+ 2 - 2
core/src/web/templates/yellowpage/wxentinfo.html

@@ -128,8 +128,8 @@ var entType="企业"
 						<div class="one"><span class="glyphicon weixinhao icon_gray"></span></div> 
 						<div class="two" style="letter-spacing: 5px;">微信号:</div> 
 						<div class="three"><span class="span999">{{.T.res.s_weixin}}</span>
-						{{if .T.res.s_weixinbarcode}}
-						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_weixinbarcode}});">扫一扫</a>
+						{{if .T.res.s_qrcode}}
+						&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="text-primary " onClick="viewBarCode({{.T.res.s_qrcode}});">扫一扫</a>
 						{{end}}
 						</div>
 					</div>