Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
e2d70e4a
Commit
e2d70e4a
authored
Apr 28, 2020
by
刘俊宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正登录bug+添加蓝牙连接模块
parent
56be3208
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
103 additions
and
12 deletions
+103
-12
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Define/Bridge_Header.h
GeliBusinessPlatform/Define/Bridge_Header.h
+1
-0
GeliBusinessPlatform/Define/Define.swift
GeliBusinessPlatform/Define/Define.swift
+0
-1
GeliBusinessPlatform/Define/NetworkRequest.swift
GeliBusinessPlatform/Define/NetworkRequest.swift
+4
-2
GeliBusinessPlatform/Info.plist
GeliBusinessPlatform/Info.plist
+8
-4
GeliBusinessPlatform/SceneDelegate.swift
GeliBusinessPlatform/SceneDelegate.swift
+2
-0
GeliBusinessPlatform/ViewController/个人中心/PersonCenterViewController.swift
...form/ViewController/个人中心/PersonCenterViewController.swift
+2
-0
GeliBusinessPlatform/ViewController/修改密码/ChangePassViewController.swift
...atform/ViewController/修改密码/ChangePassViewController.swift
+2
-0
GeliBusinessPlatform/ViewController/商品管理/GoodsManageListVC.swift
...inessPlatform/ViewController/商品管理/GoodsManageListVC.swift
+4
-0
GeliBusinessPlatform/ViewController/商家信息/ShopInfoViewController.swift
...Platform/ViewController/商家信息/ShopInfoViewController.swift
+2
-0
GeliBusinessPlatform/ViewController/支付账号(设置,修改)/PayViewController.swift
...atform/ViewController/支付账号(设置,修改)/PayViewController.swift
+2
-0
GeliBusinessPlatform/ViewController/登录/LoginViewController.swift
...inessPlatform/ViewController/登录/LoginViewController.swift
+1
-1
GeliBusinessPlatform/ViewController/蓝牙连接/BluetoothConnectViewController.swift
.../ViewController/蓝牙连接/BluetoothConnectViewController.swift
+75
-4
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
e2d70e4a
No preview for this file type
GeliBusinessPlatform/Define/Bridge_Header.h
View file @
e2d70e4a
...
...
@@ -12,5 +12,6 @@
#import "MJRefresh.h"
#import "WYHead.h"
#import "FSCalendar.h"
#import "BabyBluetooth.h"
#endif
/* Bridge_Header_h */
GeliBusinessPlatform/Define/Define.swift
View file @
e2d70e4a
...
...
@@ -47,7 +47,6 @@ let NavCGRect = CGRect(x: 0, y: 0, width: Int(UIScreen.main.bounds.size.width),
let
LoopHeight
=
UIScreen
.
main
.
bounds
.
size
.
width
/
1.25
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
func
IsOldIos
()
->
Bool
{
...
...
GeliBusinessPlatform/Define/NetworkRequest.swift
View file @
e2d70e4a
...
...
@@ -123,10 +123,12 @@ extension NetworkRequest {
HUD
.
flash
(
.
label
(
json
[
"message"
]
.
stringValue
),
delay
:
1.5
)
failture
(
DogError
.
DataInvalidError
)
}
else
if
json
[
"code"
]
.
intValue
==
10
{
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"logout"
),
object
:
nil
)
HUD
.
flash
(
.
label
(
json
[
"message"
]
.
stringValue
),
delay
:
1.5
)
failture
(
DogError
.
DataInvalidError
)
delay
(
1.5
)
{
UserDefaults
.
standard
.
removeObject
(
forKey
:
"user_token"
)
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"logout"
),
object
:
nil
)
}
}
else
if
json
[
"code"
]
.
intValue
==
11
{
HUD
.
flash
(
.
label
(
json
[
"message"
]
.
stringValue
),
delay
:
1.5
)
failture
(
DogError
.
DataInvalidError
)
...
...
GeliBusinessPlatform/Info.plist
View file @
e2d70e4a
...
...
@@ -61,17 +61,21 @@
<key>
NSAllowsArbitraryLoads
</key>
<true/>
</dict>
<key>
NSBluetoothAlwaysUsageDescription
</key>
<string>
我们需要通过您同意使用蓝牙,才能获取相关数据
</string>
<key>
NSBluetoothPeripheralUsageDescription
</key>
<string>
我们需要通过您同意使用蓝牙,才能获取相关数据
</string>
<key>
NSCameraUsageDescription
</key>
<string>
我们需要通过您同意使用相机,才能获取
回收柜的二维码
相关数据
</string>
<string>
我们需要通过您同意使用相机,才能获取相关数据
</string>
<key>
NSContactsUsageDescription
</key>
<string>
我们需要通过您同意使用通讯录,才能访问您的好友列表
</string>
<key>
NSLocationAlwaysUsageDescription
</key>
<string>
我们需要通过您同意获取地理位置,查询周边
回收柜
的相关数据
</string>
<string>
我们需要通过您同意获取地理位置,查询周边的相关数据
</string>
<key>
NSLocationWhenInUseUsageDescription
</key>
<string>
我们需要通过您同意获取地理位置,查询周边
回收柜
的相关数据
</string>
<string>
我们需要通过您同意获取地理位置,查询周边的相关数据
</string>
<key>
NSMicrophoneUsageDescription
</key>
<string>
我们需要通过您同意使用麦克风,才能与你进行语音交流
</string>
<key>
NSPhotoLibraryUsageDescription
</key>
<string>
我们需要通过您同意使用相册,才能修改
头像
</string>
<string>
我们需要通过您同意使用相册,才能修改
图片
</string>
</dict>
</plist>
GeliBusinessPlatform/SceneDelegate.swift
View file @
e2d70e4a
...
...
@@ -18,6 +18,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
func
scene
(
_
scene
:
UIScene
,
willConnectTo
session
:
UISceneSession
,
options
connectionOptions
:
UIScene
.
ConnectionOptions
)
{
sceneC
=
scene
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
if
UserToken
==
nil
{
addLoginVc
(
isAgain
:
false
)
}
else
{
...
...
GeliBusinessPlatform/ViewController/个人中心/PersonCenterViewController.swift
View file @
e2d70e4a
...
...
@@ -20,6 +20,8 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
let
listArray
=
[
"格利支付"
,
"蓝牙打印设置"
,
"权限设置"
]
//MARK:--加载数据
func
loadData
(){
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
adminInfo
([
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
self
.
dataModel
=
(
data
as!
AdminInfoModel
)
self
.
iconImg
.
kf
.
setImage
(
with
:
URL
(
string
:
SERVERCE_HOST
+
(
self
.
dataModel
?
.
data
?
.
shop_img
)
!
))
...
...
GeliBusinessPlatform/ViewController/修改密码/ChangePassViewController.swift
View file @
e2d70e4a
...
...
@@ -58,6 +58,8 @@ class ChangePassViewController: BaseViewController {
oldPassTF
.
isSecureTextEntry
=
!
oldPBtn
.
isSelected
}
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
changePwd
([
"user_token"
:
UserToken
as
Any
,
"pwd"
:
oldPassTF
.
text
as
Any
,
"new_pwd"
:
newPassTF
.
text
as
Any
],
success
:
{
(
data
)
in
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"修改成功"
),
delay
:
1.5
)
delay
(
1.5
)
{
...
...
GeliBusinessPlatform/ViewController/商品管理/GoodsManageListVC.swift
View file @
e2d70e4a
...
...
@@ -118,6 +118,8 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
page
=
pageNum
}
getSortData
()
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
goodsList
([
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyword
,
"goods_type"
:
goodsType
,
"sort"
:
sort
,
"is_show"
:
isShow
,
"page"
:
page
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
GoodsListModel
if
self
.
isSearch
{
...
...
@@ -159,6 +161,8 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
page
=
pageNum
}
getSortData
()
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
goodsList
([
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyword
,
"goods_type"
:
goodsType
,
"sort"
:
sort
,
"is_show"
:
isShow
,
"page"
:
page
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
GoodsListModel
if
(
dataM
.
data
?
.
goods_res
!.
count
)
!
>
0
{
...
...
GeliBusinessPlatform/ViewController/商家信息/ShopInfoViewController.swift
View file @
e2d70e4a
...
...
@@ -24,6 +24,8 @@ class ShopInfoViewController: BaseViewController {
}
//MARK:--加载数据
func
loadData
(){
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
shopInfo
([
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
self
.
dataModel
=
(
data
as!
ShopInfoModel
)
self
.
shopImgV
.
kf
.
setImage
(
with
:
URL
(
string
:
SERVERCE_HOST
+
(
self
.
dataModel
?
.
data
?
.
shop_img
)
!
))
...
...
GeliBusinessPlatform/ViewController/支付账号(设置,修改)/PayViewController.swift
View file @
e2d70e4a
...
...
@@ -24,6 +24,8 @@ class PayViewController: BaseViewController {
navbar
.
title
=
"支付账号"
self
.
view
.
addSubview
(
navbar
)
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
geliPayInfo
([
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
GeliPayInfoModel
if
dataM
.
data
?
.
status
==
3
{
...
...
GeliBusinessPlatform/ViewController/登录/LoginViewController.swift
View file @
e2d70e4a
...
...
@@ -96,7 +96,7 @@ class LoginViewController: BaseViewController, CodeViewDelegate,GeliAlertViewDel
login
([
"user_name"
:
phoneTF
.
text
as
Any
,
"pwd"
:
passTF
.
text
as
Any
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
LoginModel
UserDefaults
.
standard
.
set
(
dataM
.
data
?
.
user_token
,
forKey
:
"user_token"
)
//
UserDefaults.standard.synchronize()
UserDefaults
.
standard
.
synchronize
()
self
.
loginBtn
.
isLoading
=
false
self
.
delegate
?
.
successLogin
()
})
{
(
error
)
in
...
...
GeliBusinessPlatform/ViewController/蓝牙连接/BluetoothConnectViewController.swift
View file @
e2d70e4a
...
...
@@ -7,13 +7,17 @@
//
import
UIKit
import
Dollar
class
BluetoothConnectViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
{
@IBOutlet
weak
var
bottomView
:
UIView
!
@IBOutlet
weak
var
tableView
:
UITableView
!
let
baby
=
BabyBluetooth
.
share
()
var
peripheralDataArray
:
Array
<
CBPeripheral
>
=
[]
var
selectDataArray
:
Array
<
CBPeripheral
>
=
[]
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
navbar
.
title
=
"蓝牙打印设置"
...
...
@@ -28,22 +32,80 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
}
tableView
?
.
register
(
UINib
(
nibName
:
"BlueToothCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"BlueTooth"
)
baby
?
.
setBlockOnDiscoverToPeripherals
({
(
mangan
,
peripheral
,
adv
,
RSSI
)
in
})
baby
?
.
setFilterOnDiscoverPeripherals
({
(
periName
,
adv
,
RSSI
)
->
Bool
in
if
periName
!=
nil
{
print
(
"是否需要过滤
\(
periName
)
"
)
return
true
}
return
false
})
baby
?
.
setBlockOnDiscoverToPeripherals
({
(
central
,
peripheral
,
adv
,
RSSI
)
in
print
(
"搜索到的
\(
peripheral
?
.
name
)
"
)
if
!
self
.
peripheralDataArray
.
contains
(
peripheral
!
){
self
.
peripheralDataArray
.
insert
(
peripheral
!
,
at
:
0
)
self
.
tableView
.
reloadData
()
}
})
baby
?
.
scanForPeripherals
()
baby
?
.
begin
()
//尝试链接
baby
?
.
setBlockOnConnected
({
(
central
,
peripheral
)
in
print
(
"设备
\(
peripheral
?
.
name
)
连接成功"
)
self
.
selectDataArray
.
removeAll
()
if
self
.
peripheralDataArray
.
contains
(
peripheral
!
){
Dollar
.
remove
(
self
.
peripheralDataArray
,
value
:
peripheral
)
}
self
.
selectDataArray
.
insert
(
peripheral
!
,
at
:
0
)
self
.
tableView
.
reloadData
()
})
baby
?
.
setBlockOnCancelAllPeripheralsConnectionBlock
({
(
cetral
)
in
print
(
"断开连接2223333"
)
let
currPeripheral
:
CBPeripheral
=
self
.
selectDataArray
[
0
]
self
.
peripheralDataArray
.
insert
(
currPeripheral
,
at
:
0
)
self
.
selectDataArray
.
removeAll
()
self
.
tableView
.
reloadData
()
})
}
//MARK: -方法
@IBAction
func
searchAction
(
_
sender
:
Any
)
{
print
(
"搜索"
)
baby
?
.
scanForPeripherals
()
baby
?
.
begin
()
}
//MARK: -Cell delegate
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
indexPath
.
section
==
0
{
print
(
"准备取消所有连接11"
)
self
.
baby
?
.
cancelAllPeripheralsConnection
()
}
else
{
let
currPeripheral
:
CBPeripheral
=
self
.
peripheralDataArray
[
indexPath
.
row
]
print
(
"准备连接的设备:
\(
currPeripheral
.
name
)
"
)
self
.
baby
?
.
having
(
currPeripheral
)?
.
and
()?
.
channel
(
"peripheralView"
)?
.
then
()?
.
connectToPeripherals
()?
.
begin
()
}
}
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
2
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
section
==
0
{
return
1
return
self
.
selectDataArray
.
count
}
return
10
return
self
.
peripheralDataArray
.
count
}
//header
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
...
...
@@ -101,9 +163,18 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"BlueTooth"
)
as!
BlueToothCell
if
indexPath
.
section
!=
0
{
if
indexPath
.
section
==
0
{
let
currPeripheral
:
CBPeripheral
=
self
.
selectDataArray
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
currPeripheral
.
name
cell
.
statusIcon
.
isHidden
=
false
}
else
{
cell
.
statusIcon
.
isHidden
=
true
let
currPeripheral
:
CBPeripheral
=
self
.
peripheralDataArray
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
currPeripheral
.
name
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment