Skip to content

Commit

Permalink
1)增加手机弹窗交互;2)增加页面初始化「加载中」提示。
Browse files Browse the repository at this point in the history
  • Loading branch information
binnng committed Aug 9, 2014
1 parent dde4e26 commit e198ad4
Show file tree
Hide file tree
Showing 33 changed files with 543 additions and 191 deletions.
Binary file added app/images/init-loading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,28 @@
<p class="browsehappy">你的浏览器版本<strong>太低</strong> browser. 去<a href="http://browsehappy.com/">升级</a>吧!</p>
<![endif]-->

<div class="root" ng-controller="rootCtrl" ng-class="{ios: IsIOS, android: IsAndroid, iphone: IsIPhone, ipad: IsIPad, chrome: IsChrome, weixin: IsWeixin, mobile: IsMobile, ie: IsIE, 'ie-mobile': IsIEMobile, 'm-menu-open': isMMenuOpen, logined: isLogin}">
<div class="root" ng-controller="rootCtrl" ng-class="{ios: IsIOS, android: IsAndroid, 'android-pad': IsAndroidPad, iphone: IsIPhone, ipad: IsIPad, chrome: IsChrome, weixin: IsWeixin, mobile: IsMobile, ie: IsIE, 'ie-mobile': IsIEMobile, phone: IsPhone, 'm-menu-open': isMMenuOpen, 'm-design-open': isMDesignOpen, logined: isLogin}">

<!-- 手机交互弹出 -->
<div ng-include="'views/m-design.html'" class="m-design"></div>

<!-- 手机侧边栏 -->
<div ng-include="'views/m-menu.html'" class="m-menu"></div>

<div class="m-body" tap="scroll1Px()">
<div class="m-body" tap="scrollBody1Px()">
<div ng-include="'views/head.html'"></div>
<div class="m-wrap" id="m-wrap">
<div ng-view class="main-view"></div>
<div ng-view class="m-view"></div>
<div ng-include="'views/foot.html'"></div>
</div>

<!-- 遮罩 -->
<div class="m-menu-mask" ng-click="toggleMMenu()" ng-show="isMMenuOpen"></div>
<div class="m-mask"></div>


<!-- 返回顶部 设置hidden-xs,手机页面初始化时不显示 -->
<b class="back-top hidden-xs" ng-click="backToTop()" ng-if="!IsTouch"><i class="glyphicon glyphicon-arrow-up"></i></b>
</div>

</div>
Expand Down
53 changes: 45 additions & 8 deletions app/scripts/controllers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/scripts/controllers/global.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Mifan.controller "globalCtrl", ($scope) ->

# HTC Flyer平板的UA字符串中不包含Android关键词
IsAndroid = (/Android|HTC/i.test(UA) or /Linux/i.test(NA.platform + ""))
IsAndroidPad = IsAndroid and /Pad/i.test(UA)

IsIPad = not IsAndroid and /iPad/i.test(UA)

Expand All @@ -39,6 +40,8 @@ Mifan.controller "globalCtrl", ($scope) ->
IsWeixin = /MicroMessenger/i.test(UA)
IsChrome = !!WIN['chrome']

IsPhone = IsIPhone or (IsAndroid and not IsAndroidPad)

NG = WIN['angular']

$scope.WIN = WIN
Expand All @@ -53,6 +56,7 @@ Mifan.controller "globalCtrl", ($scope) ->
$scope.IsIOS = IsIOS

$scope.IsAndroid = IsAndroid
$scope.IsAndroidPad = IsAndroidPad

$scope.IsIEMobile = IsIEMobile

Expand All @@ -63,6 +67,8 @@ Mifan.controller "globalCtrl", ($scope) ->
$scope.IsChrome = IsChrome
$scope.IsIE = IsIE

$scope.IsPhone = IsPhone


IsDebug = LOC["port"] is "9000"

Expand Down
6 changes: 5 additions & 1 deletion app/scripts/controllers/global.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions app/scripts/controllers/m_design.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Mifan.controller "mDesginCtrl", ($scope, $timeout) ->

DOC = $scope.DOC

elMDesignTextarea = DOC["getElementById"] "m-design-input"

# 设置展示界面类型
# ask => 提问
#
$scope.$on "setMDesignType", (detail, msg) ->
$scope.viewType = msg

$timeout ->
elMDesignTextarea.focus()
, 400

# 取消内容发送的展示
# 实际上后台还会继续网络请求发送
$scope.$on "cancelMDesingSending", ->
$scope.isSending = no
$scope.mDesignContent = ""

$scope.onSubmit = ->
$scope.isSending = yes

19 changes: 19 additions & 0 deletions app/scripts/controllers/m_design.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/scripts/controllers/m_menu.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

Mifan.controller "mMenuCtrl", ($scope) ->
Mifan.controller "mMenuCtrl", ($scope, $timeout) ->



2 changes: 1 addition & 1 deletion app/scripts/controllers/m_menu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 30 additions & 3 deletions app/scripts/controllers/root.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Mifan.controller "rootCtrl", ($scope, $cookieStore, $http) ->
WIN = $scope.WIN
DOC = $scope.DOC
LOC = $scope.LOC
BODY = $scope.BODY

API = $scope.API
IsDebug = $scope.IsDebug
Expand Down Expand Up @@ -97,6 +98,20 @@ Mifan.controller "rootCtrl", ($scope, $cookieStore, $http) ->
$scope.toggleMMenu = toggleMMenu = ->
$scope.isMMenuOpen = not $scope.isMMenuOpen


# 设置手机交互弹出菜单状态
$scope.isMDesignOpen = no

$scope.toggleMDesign = toggleMDesign = (type) ->
$scope.isMDesignOpen = not $scope.isMDesignOpen

# 如果打开mDesign
# 广播到 mDesignCtrl 里设置展示类型
$scope.$broadcast "setMDesignType", type if type and $scope.isMDesignOpen

# 如果关闭 mDesign,取消内容发送
$scope.$broadcast "cancelMDesingSending" if not $scope.isMDesignOpen

$scope.logout = ->
$scope.user = {}
$cookieStore.remove "mUID"
Expand All @@ -108,10 +123,22 @@ Mifan.controller "rootCtrl", ($scope, $cookieStore, $http) ->
LOC["href"] = url
toggleMMenu() if isToggleMmenu

elMMwrap = DOC["getElementById"] "m-wrap"

# 手指碰到页面,滚动1px
$scope.scroll1Px = ->
el = DOC["getElementById"] "m-wrap"
el.scrollTop = 1 if el.scrollTop is 0
$scope.scrollBody1Px = ->
elMMwrap["scrollTop"] = 1 if elMMwrap["scrollTop"] is 0

# 返回顶部
$scope.backToTop = (isM)->
(if isM then elMMwrap else BODY)["scrollTop"] = 0

# 刷新m-menu
# refreshMMenu = -> $scope.$broadcast "refreshMMenu"

# 会造成死循环
# $broadcast 也会向自身广播
# $scope.$on "refreshMMenu", refreshMMenu



Expand Down
25 changes: 19 additions & 6 deletions app/scripts/controllers/root.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e198ad4

Please sign in to comment.