Commit 5d4da860 authored by lujunye's avatar lujunye

l;i;lj;lh;h;

parent a35fa39b
......@@ -10,13 +10,23 @@ import UIKit
import Photos
import SwiftyJSON
class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, GeliAlertTextViewDelegate ,DZSH_Two_Btn_Cell_Delegate, Location_Cell_Delegate, DZSH_UPLOAD_IMG_CELL_Delegate, UIPickerViewDataSource, UIPickerViewDelegate, DZSH_Date_Cell_Delegate, GLAlertSelectViewDelegate, OnlyTimeSelectView_Delegate{
class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, GeliAlertTextViewDelegate ,DZSH_Two_Btn_Cell_Delegate, Location_Cell_Delegate, DZSH_UPLOAD_IMG_CELL_Delegate, UIPickerViewDataSource, UIPickerViewDelegate, DZSH_Date_Cell_Delegate, GLAlertSelectViewDelegate, OnlyTimeSelectView_Delegate,DZSH_Upload_Cer_Cell_Delegate, TitleAndTFCellDelegate, CLLocationManagerDelegate{
var manger:CLLocationManager = CLLocationManager()
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
manger.stopUpdatingLocation()
let location = locations.last
let coo = JZLocationConverter.wgs84(toGcj02: CLLocationCoordinate2D(latitude: (location?.coordinate.latitude)!, longitude: (location?.coordinate.longitude)!))
lat = "\(coo.latitude)"
lng = "\(coo.longitude)"
list_view.reloadData()
}
var work_time_str = "09:00~18:00"
var get_time_str = "09:00~18:00"
func OnlyTimeSelectView_submitAction(view: OnlyTimeSelectView, sh: Int, sm: Int, eh: Int, em: Int) {
timeSelect_view!.removeFromSuperview()
timeSelect_view = nil
if view.tag == 99 {//营业时间
var s1 = StringByInt(number: sh)
if s1.count == 1 {
s1 = "0" + StringByInt(number: sh)
......@@ -36,9 +46,10 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
if s4.count == 1 {
s4 = "0" + StringByInt(number: em)
}
if view.tag == 99 {//营业时间
work_time_str = s1 + ":" + s2 + "~" + s3 + ":" + s4
}else{
get_time_str = s1 + ":" + s2 + "~" + s3 + ":" + s4
}
list_view.reloadData()
......@@ -50,13 +61,24 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
print(view.tag)
switch view.tag {
case 99:
case 0:
type_num = selectNum
break
case 22:
startDayIdx = selectNum
break
default:
case 23:
endDayIdx = selectNum
break
case 30:
getProdutStart = selectNum
break
case 31:
getProductEnd = selectNum
default:
break
}
list_view.reloadData()
view.removeFromSuperview()
......@@ -68,20 +90,26 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var startDayIdx = 1
var endDayIdx = 5
var getProdutStart = 1
var getProductEnd = 5
var timeSelect_view:OnlyTimeSelectView?
func DZSH_Date_Cell_SelectAction(sender: UIButton, cell: DZSH_Date_Cell) {
print(sender.tag)
switch sender.tag {
case 0:
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = 99
view.tag = cell.tag
view.titleLbl.text = "请选择日期"
view.delegate = self
view.dataArr = date_arr
view.is_center_select = true
if cell.tag < 30 {
view.selectNum = startDayIdx
}else{
view.selectNum = getProdutStart
}
self.view.addSubview(view)
glSelectView = view
}
......@@ -89,12 +117,16 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
case 1:
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = 100
view.tag = cell.tag + 1
view.titleLbl.text = "请选择日期"
view.delegate = self
view.dataArr = date_arr
view.is_center_select = true
if cell.tag < 30 {
view.selectNum = endDayIdx
}else{
view.selectNum = getProductEnd
}
self.view.addSubview(view)
glSelectView = view
}
......@@ -103,6 +135,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
if timeSelect_view == nil {
let view = OnlyTimeSelectView(frame: self.view.bounds)
view.tag = 99
if cell.tag == 30 {
view.tag = 100
}
view.delegate = self
view.titleStr = (sender.titleLabel?.text)!
self.view.addSubview(view)
......@@ -111,11 +146,18 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
break
}
}
func DZSH_UPLOAD_IMG_CELL_SelectImg(cell: DZSH_UPLOAD_IMG_CELL) {
print(cell.tag)
selectUpLoadImg(tag: cell.tag)
}
func DZSH_UPLOAD_IMG_CELL_Input(str: String, cell: DZSH_UPLOAD_IMG_CELL) {
if cell.tag == 11 {
short_name = str
}
if cell.tag == 21 {//公司简称/logo
short_name = str
}
}
func DZSH_UPLOAD_IMG_CELL_Btn_Action(select: Int, cell: DZSH_UPLOAD_IMG_CELL) {
......@@ -126,7 +168,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
}
if cell.tag == 21 {
if cell.tag == 21 {//公司简称/logo
show_logo = true
if select == 0 {
show_logo = false
......@@ -137,6 +179,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
func Location_Cell_action() {
print("获取lat,lng")
manger.startUpdatingLocation()
}
func Location_Cell_input_tf(idx: Int, str: String) {
......@@ -254,6 +297,11 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
super.viewDidLoad()
// navbar.title = "信息审核"
manger.delegate = self
manger.requestAlwaysAuthorization()
manger.requestWhenInUseAuthorization()
hourArr.removeAll()
minArr.removeAll()
......@@ -451,6 +499,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.nameLbl.text = part0[indexPath.row]
cell.contentLbl.text = type_arr[type_num]
cell.btn.isUserInteractionEnabled = false
return cell
default:
let cell = tableView.dequeueReusableCell(withIdentifier: "Location_Cell") as! Location_Cell
......@@ -461,11 +510,6 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
case 1:
switch indexPath.row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.textTF.placeholder = "等待填写"
cell.textTF.text = name
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "DZSH_UPLOAD_IMG_CELL") as! DZSH_UPLOAD_IMG_CELL
cell.tag = 11
......@@ -495,17 +539,24 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
break
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.delegate = self
cell.tag = indexPath.row + 10
cell.nameLbl.text = part1[indexPath.row]
cell.textTF.isUserInteractionEnabled = true
if indexPath.row == 3{
cell.textTF.isUserInteractionEnabled = false
cell.textTF.placeholder = "请选择城市"
cell.textTF.text = dzStr
}else{
if indexPath.row == 0 {
cell.textTF.placeholder = "等待填写"
cell.textTF.text = name
}else{
cell.textTF.placeholder = "等待填写"
cell.textTF.text = adr_str
}
}
return cell
case 2:
if indexPath.row == 0 {
......@@ -553,16 +604,19 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "DZSH_Date_Cell") as! DZSH_Date_Cell
cell.nameLbl.text = part2[indexPath.row]
cell.tag = 32
cell.tag = 30
cell.delegate = self
cell.indexPath = indexPath
cell.startDateLbl.text = date_arr[startDayIdx]
cell.endDateLbl.text = date_arr[endDayIdx]
cell.startDateLbl.text = date_arr[getProdutStart]
cell.endDateLbl.text = date_arr[getProductEnd]
cell.timeLbl.text = get_time_str
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.tag = indexPath.row + 30
cell.delegate = self
cell.textTF.placeholder = "等待填写"
cell.textTF.isUserInteractionEnabled = true
cell.nameLbl.text = part2[indexPath.row]
switch indexPath.row {
case 1:
......@@ -590,6 +644,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.delegate = self
cell.tag = indexPath.row + 40
cell.textTF.isUserInteractionEnabled = true
cell.textTF.placeholder = "等待填写"
cell.nameLbl.text = part3[indexPath.row]
switch indexPath.row {
......@@ -612,6 +669,8 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
case 5:
if indexPath.row > 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "DZSH_Upload_Cer_Cell") as! DZSH_Upload_Cer_Cell
cell.tag = indexPath.row + 50
cell.delegate = self
cell.nameLbl.text = part4[indexPath.row]
switch indexPath.row {
......@@ -646,11 +705,11 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
return cell
}
default:
break
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.delegate = self
cell.tag = indexPath.row + 50
cell.textTF.placeholder = "等待填写"
cell.textTF.isUserInteractionEnabled = true
cell.nameLbl.text = part4[indexPath.row]
if indexPath.row == 0 {
cell.textTF.text = zhizhao_str
......@@ -659,6 +718,12 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
return cell
default:
break
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
return cell
}
......@@ -666,15 +731,26 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.section {
case 0:
if indexPath.row == 2 {
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = 0
view.titleLbl.text = "请选择店铺类型"
view.delegate = self
view.dataArr = type_arr
view.is_center_select = true
view.selectNum = type_num
self.view.addSubview(view)
glSelectView = view
}
}
break
case 1:
if indexPath.row == 3 {
print_bottom_cell_select_place_action()
}
break
case 2:
if indexPath.row == 1 {
}
break
case 4:
if indexPath.row == 2 {
let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
......@@ -688,107 +764,24 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
default:
break
}
// switch indexPath.section {
// case 0:
// if indexPath.row == 4 {
// let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
// alterView.tag = 4
// alterView.delegate = self
// alterView.titleLbl.text = "请填写公司简介"
// alterView.placerLbl.text = "请填写公司简介..."
// alterView.content = intro_str
// self.view.window?.addSubview(alterView)
// }
//
// if indexPath.row == 6 {
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.uploadImg(imge: image!, isOriginal: true, tag: 6)
// })
// }
// self.list_view.reloadData()
// }
// }
//
// break
// case 1:
// if indexPath.row == 2 {
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.uploadImg(imge: image!, isOriginal: true, tag: 12)
// })
// }
// self.list_view.reloadData()
// }
// }
// break
// case 2 :
// if indexPath.row == 2 {
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.uploadImg(imge: image!, isOriginal: true, tag: 22)
// })
// }
// self.list_view.reloadData()
// }
// }
// if indexPath.row == 3 {
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.uploadImg(imge: image!, isOriginal: true, tag: 23)
// })
// }
// self.list_view.reloadData()
// }
// }
// break
// default:
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.uploadImg(imge: image!, isOriginal: true, tag: 0)
// })
// }
// self.list_view.reloadData()
// }
// break
// }
}
func selectUpLoadImg(tag:Int){
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.uploadImg(imge: image!, isOriginal: true, tag: tag)
})
}
self.list_view.reloadData()
}
}
//MARK: - 不通过原因
func sureGeliAlertTextViewAction(sender: String, view: GeliAlertTextView) {
......@@ -854,20 +847,22 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
print("图片上传成功\(dataM.data?.url)")
switch tag {
case 6:
case 21:
self.logo_url_str = (dataM.data?.url)!
break
case 12:
case 52:
self.conect_id_url_str = (dataM.data?.url)!
break
case 22:
case 53:
self.ruzhu_url_str = (dataM.data?.url)!
break
case 54:
self.zhizhao_url_str = (dataM.data?.url)!
break
case 23:
case 55:
self.xuke_url_str = (dataM.data?.url)!
break
default:
self.ruzhu_url_str = (dataM.data?.url)!
break
}
self.list_view.reloadData()
......@@ -1220,4 +1215,49 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var tempProvince_select = -1//临时省id
var tempCity_select = -1//临时市id
var tempArea_select = -1//临时区id
//MARK: - 上传图片
func DZSH_Upload_Cer_Cell_UpLoadImg(cell: DZSH_Upload_Cer_Cell) {
print(cell.tag)
selectUpLoadImg(tag: cell.tag)
}
//MARK: - 填写内容
func textFieldContent(content: String, cell: TitleAndTFCell) {
switch cell.tag {
case 10:
name = content
break
case 14:
adr_str = content
break
case 31:
connect_number = content
break
case 32:
get_product_adr = content
break
case 33:
phone_str = content
break
case 40:
company_phone = content
break
case 41:
size_str = content
break
case 43:
connect_name = content
break
case 44:
mail_str = content
break
case 50:
zhizhao_str = content
break
case 51:
jing_ying_fan_wei_str = content
break
default:
break
}
}
}
......@@ -10,6 +10,7 @@ import UIKit
protocol DZSH_UPLOAD_IMG_CELL_Delegate {
func DZSH_UPLOAD_IMG_CELL_Btn_Action(select:Int,cell:DZSH_UPLOAD_IMG_CELL)
func DZSH_UPLOAD_IMG_CELL_Input(str:String,cell:DZSH_UPLOAD_IMG_CELL)
func DZSH_UPLOAD_IMG_CELL_SelectImg(cell:DZSH_UPLOAD_IMG_CELL)
}
class DZSH_UPLOAD_IMG_CELL: UITableViewCell {
@IBAction func btn_click(_ sender: UIButton) {
......@@ -29,8 +30,13 @@ class DZSH_UPLOAD_IMG_CELL: UITableViewCell {
super.awakeFromNib()
self.selectionStyle = .none
input_tf.addTarget(self, action: #selector(textChange(tf:)), for: .allEditingEvents)
let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction))
img_view.addGestureRecognizer(tap)
// Initialization code
}
@objc func tapAction(){
delegate?.DZSH_UPLOAD_IMG_CELL_SelectImg(cell: self)
}
@objc func textChange(tf:UITextField){
delegate?.DZSH_UPLOAD_IMG_CELL_Input(str: tf.text!, cell: self)
}
......
......@@ -24,7 +24,7 @@
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="shangchuantupian" translatesAutoresizingMaskIntoConstraints="NO" id="8TI-5w-kaC">
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="shangchuantupian" translatesAutoresizingMaskIntoConstraints="NO" id="8TI-5w-kaC">
<rect key="frame" x="132.5" y="85.5" width="110" height="110"/>
<constraints>
<constraint firstAttribute="height" constant="110" id="Rk4-Ab-dYv"/>
......
......@@ -7,9 +7,11 @@
//
import UIKit
protocol DZSH_Upload_Cer_Cell_Delegate {
func DZSH_Upload_Cer_Cell_UpLoadImg(cell:DZSH_Upload_Cer_Cell)
}
class DZSH_Upload_Cer_Cell: UITableViewCell {
var delegate:DZSH_Upload_Cer_Cell_Delegate?
@IBOutlet weak var img_view: UIImageView!
@IBOutlet weak var nameLbl: UILabel!
override func awakeFromNib() {
......@@ -17,6 +19,12 @@ class DZSH_Upload_Cer_Cell: UITableViewCell {
self.selectionStyle = .none
// Initialization code
let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction))
img_view.addGestureRecognizer(tap)
// Initialization code
}
@objc func tapAction(){
delegate?.DZSH_Upload_Cer_Cell_UpLoadImg(cell: self)
}
override func setSelected(_ selected: Bool, animated: Bool) {
......
......@@ -24,7 +24,7 @@
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="upload_1" translatesAutoresizingMaskIntoConstraints="NO" id="HUt-8u-7iR">
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="upload_1" translatesAutoresizingMaskIntoConstraints="NO" id="HUt-8u-7iR">
<rect key="frame" x="75" y="43.5" width="225" height="125"/>
<constraints>
<constraint firstAttribute="width" constant="225" id="azg-mK-lWG"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment