Commit ab9311590736aecb8f0dc50dadefd8bbb1760678

Authored by xu
1 parent 62d73041
Exists in master

app-wx(v0.1.0 build 2)

F 修改文件名称home 改为user
app-wx/config/main.php
@@ -15,8 +15,8 @@ return [ @@ -15,8 +15,8 @@ return [
15 'defaultRoute' => 'order', 15 'defaultRoute' => 'order',
16 'modules' => [ 16 'modules' => [
17 17
18 - 'home' => [  
19 - 'class' => 'app\wx\modules\home\Module', 18 + 'user' => [
  19 + 'class' => 'app\wx\modules\user\Module',
20 ] 20 ]
21 ], 21 ],
22 'components' => [ 22 'components' => [
app-wx/config/params.php
1 <?php 1 <?php
2 return [ 2 return [
3 'adminEmail' => 'admin@example.com', 3 'adminEmail' => 'admin@example.com',
4 - 'VERSION' => 'v0.1.0 build 1', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数 4 + 'VERSION' => 'v0.1.0 build 2', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
5 ]; 5 ];
app-wx/modules/home/Module.php
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 -<?php  
2 -  
3 -namespace app\wx\modules\home;  
4 -  
5 -use yii\base\Module as BaseModule;  
6 -  
7 -/**  
8 - * Class Module  
9 - * @package app\wx\modules  
10 - */  
11 -class Module extends BaseModule  
12 -{  
13 - public function init()  
14 - {  
15 - parent::init();  
16 - }  
17 -}  
18 \ No newline at end of file 0 \ No newline at end of file
app-wx/modules/home/controllers/BaseController.php
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -<?php  
2 -  
3 -namespace app\wx\modules\home\controllers;  
4 -  
5 -use Yii;  
6 -use app\wx\controllers\BaseController as AppBaseController;  
7 -  
8 -/**  
9 - * Class BaseController  
10 - * @package app\wx\modules\toutiao\controllers  
11 - */  
12 -class BaseController extends AppBaseController  
13 -{  
14 - public $layout = 'main';  
15 -  
16 - /**  
17 - * @throws yii\web\BadRequestHttpException  
18 - */  
19 - public function init()  
20 - {  
21 - parent::init(); // TODO: Change the autogenerated stub  
22 -  
23 - }  
24 -}  
25 \ No newline at end of file 0 \ No newline at end of file
app-wx/modules/home/controllers/DefaultController.php
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -<?php  
2 -  
3 -namespace app\wx\modules\home\controllers;  
4 -  
5 -use common\helpers\ImageManager;  
6 -use common\models\EngineerProfile;  
7 -use domain\toutiao\TtDefaultImageRepository;  
8 -use domain\toutiao\TtNewsImageRepository;  
9 -use domain\toutiao\TtNewsRepository;  
10 -use domain\toutiao\TtType;  
11 -use Yii;  
12 -use stdClass;  
13 -  
14 -/**  
15 - * 控制器  
16 - */  
17 -class DefaultController extends BaseController  
18 -{  
19 -  
20 - /**  
21 - * 首页  
22 - */  
23 - public function actionIndex()  
24 - {  
25 - return $this->render('index');  
26 - }  
27 -  
28 -  
29 -}  
30 \ No newline at end of file 0 \ No newline at end of file
app-wx/modules/home/views/default/index.php
@@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
1 -<?php  
2 -  
3 -use yii\helpers\Url;  
4 -  
5 -$baseUrl = Url::base(true);  
6 -$assets = $this->getAssetManager();  
7 -$asset = $assets->getBundle('app\wx\assets\AppAsset');  
8 -  
9 -function img($file, $path = '/i/')  
10 -{  
11 - return \Yii::$app->request->baseUrl . $path.$file;  
12 -}  
13 -?>  
14 -<style>  
15 -  
16 -</style>  
17 -<div class="views">  
18 - <div class="view view-main">  
19 - <?=$this->render("@app/views/widgets/ui-loading")?>  
20 - </div>  
21 -</div>  
22 -  
23 -<?=$this->render('pages/index-template', ['asset' => $asset])?>  
24 -<?=$this->render('pages/register-template', ['asset' => $asset])?>  
25 -  
26 -<script>  
27 - require.config({baseUrl: $site.assets_url + '/js/',urlArgs : "v=" + require.version});  
28 - require([  
29 - 'home-app'  
30 - ],  
31 - function(app){  
32 - app.bootstrap({  
33 - baseUrl: $site.base_url  
34 - });  
35 - });  
36 -</script>  
37 -  
38 -<?=$this->render("@app/views/widgets/stat-code")?>  
app-wx/modules/home/views/default/pages/index-template.php
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -<?php  
2 -  
3 -use yii\helpers\Url;  
4 -  
5 -$baseUrl = Url::base(true);  
6 -?>  
7 -<style>  
8 -#index{}  
9 -  
10 -</style>  
11 -<script id="index-template" type="text/template">  
12 - <div class="pages">  
13 - <div class="page" id="index" style="background: #f2f3f6">  
14 - <div class="page-content">  
15 -  
16 - </div>  
17 -  
18 - </div>  
19 - </div>  
20 -</script>  
app-wx/modules/home/views/default/pages/register-template.php
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -<?php  
2 -  
3 -use yii\helpers\Url;  
4 -  
5 -$baseUrl = Url::base(true);  
6 -?>  
7 -<style>  
8 - body,div,p,span,input{padding: 0;margin: 0}  
9 - input{-webkit-appearance: none;}  
10 - #register{}  
11 - #register .input-list{padding:1rem;box-sizing: border-box}  
12 - #register .input-row-cls{width:100%;margin-top:0.7rem;}  
13 - #register .input-list .input-div{line-height: 1.25rem;font-size: 1rem;}  
14 - #register .input-list .input-cls{width:100%;line-height: inherit;font-size: inherit;border:1px solid #ccc;padding:0.3rem;box-sizing: border-box}  
15 - #register .input-list .validation-code{display:flex;align-items: center}  
16 - #register .input-list .get-code-cls{width: 7rem;font-size: 0.8rem;display: flex;align-items: center;justify-content:center;background:#f25601;color:#fff;padding:0.302rem 0.3rem;box-sizing: border-box;border: 1px solid #f25601;  
17 - border-left:0;}  
18 -  
19 -</style>  
20 -<script id="register-template" type="text/template">  
21 - <div class="pages">  
22 - <div class="page" id="register" style="background: #fff">  
23 - <div class="page-content">  
24 - <div class="input-list">  
25 - <div class="input-row-cls"><label class="input-label-cls">车厂名称</label><div class="input-div"><input class="input-cls" type="text" placeholder="输入车厂名称" /></div></div>  
26 -  
27 - <div class="input-row-cls"><label class="input-label-cls">手机号码</label><div class="input-div"><input class="input-cls" type="number" placeholder="输入手机号码" /></div></div>  
28 -  
29 - <div class="input-row-cls">  
30 - <label class="input-label-cls">验证码</label>  
31 - <div class="input-div validation-code">  
32 - <input class="input-cls" type="text" placeholder="" style="border-right: 0;"/>  
33 - <div class="get-code-cls">获取验证码</div>  
34 - </div>  
35 - </div>  
36 - </div>  
37 - <div style="padding:1rem;box-sizing: border-box">  
38 - <div>上传营业执照</div>  
39 - <div></div>  
40 - </div>  
41 - <div style="padding:1rem;box-sizing:border-box"><div style="width:70%; padding:1rem;text-align:center;box-sizing: border-box;color:#fff;background:#f25601;margin: 0 auto;">注册</div></div>  
42 - </div>  
43 - </div>  
44 - </div>  
45 -</script>  
app-wx/modules/home/views/layouts/main.php
@@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
1 -<?php  
2 -  
3 -use app\wx\assets\AppAsset;  
4 -use yii\helpers\Html;  
5 -  
6 -AppAsset::register($this);  
7 -  
8 -$site = $this->params['site'];  
9 -  
10 -$this->title = \yii::$app->name;  
11 -$assets = $this->getAssetManager();  
12 -$asset = $assets->getBundle('app\wx\assets\AppAsset');  
13 -?>  
14 -<?php $this->beginPage() ?>  
15 -<!DOCTYPE HTML>  
16 -  
17 -<html lang="<?= \yii::$app->language ?>">  
18 -<head>  
19 -<meta charset="<?= \yii::$app->charset ?>">  
20 -<meta name="apple-mobile-web-app-capable" content="yes">  
21 -<meta name="apple-mobile-web-app-status-bar-style" content="black">  
22 -<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">  
23 -<meta http-equiv="Pragma" content="no-cache">  
24 -<meta http-equiv="Expires" content="0">  
25 -<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">  
26 -<?= Html::csrfMetaTags() ?>  
27 -<title><?= Html::encode($this->title) ?></title>  
28 -<script>  
29 - <?=$this->render("@app/views/widgets/js-site", ['site' => $site])?>  
30 -</script>  
31 -<?php $this->head() ?>  
32 -<style>  
33 -  
34 -</style>  
35 -</head>  
36 -<body>  
37 -<?php $this->beginBody() ?>  
38 -<?=$content?>  
39 -<?php $this->endBody() ?>  
40 -</body>  
41 -</html>  
42 -<?php $this->endPage() ?>  
43 -  
app-wx/modules/user/Module.php 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\user;
  4 +
  5 +use yii\base\Module as BaseModule;
  6 +
  7 +/**
  8 + * Class Module
  9 + * @package app\wx\modules
  10 + */
  11 +class Module extends BaseModule
  12 +{
  13 + public function init()
  14 + {
  15 + parent::init();
  16 + }
  17 +}
0 \ No newline at end of file 18 \ No newline at end of file
app-wx/modules/user/controllers/BaseController.php 0 → 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\user\controllers;
  4 +
  5 +use Yii;
  6 +use app\wx\controllers\BaseController as AppBaseController;
  7 +
  8 +/**
  9 + * Class BaseController
  10 + * @package app\wx\modules\toutiao\controllers
  11 + */
  12 +class BaseController extends AppBaseController
  13 +{
  14 + public $layout = 'main';
  15 +
  16 + /**
  17 + * @throws yii\web\BadRequestHttpException
  18 + */
  19 + public function init()
  20 + {
  21 + parent::init(); // TODO: Change the autogenerated stub
  22 +
  23 + }
  24 +}
0 \ No newline at end of file 25 \ No newline at end of file
app-wx/modules/user/controllers/DefaultController.php 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +<?php
  2 +
  3 +namespace app\wx\modules\user\controllers;
  4 +
  5 +use common\helpers\ImageManager;
  6 +use common\models\EngineerProfile;
  7 +use domain\toutiao\TtDefaultImageRepository;
  8 +use domain\toutiao\TtNewsImageRepository;
  9 +use domain\toutiao\TtNewsRepository;
  10 +use domain\toutiao\TtType;
  11 +use Yii;
  12 +use stdClass;
  13 +
  14 +/**
  15 + * 控制器
  16 + */
  17 +class DefaultController extends BaseController
  18 +{
  19 +
  20 + /**
  21 + * 首页
  22 + */
  23 + public function actionIndex()
  24 + {
  25 + return $this->render('index');
  26 + }
  27 +
  28 +
  29 +}
0 \ No newline at end of file 30 \ No newline at end of file
app-wx/modules/user/views/default/index.php 0 → 100644
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +$assets = $this->getAssetManager();
  7 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  8 +
  9 +function img($file, $path = '/i/')
  10 +{
  11 + return \Yii::$app->request->baseUrl . $path.$file;
  12 +}
  13 +?>
  14 +<style>
  15 +
  16 +</style>
  17 +<div class="views">
  18 + <div class="view view-main">
  19 + <?=$this->render("@app/views/widgets/ui-loading")?>
  20 + </div>
  21 +</div>
  22 +
  23 +<?=$this->render('pages/index-template', ['asset' => $asset])?>
  24 +<?=$this->render('pages/register-template', ['asset' => $asset])?>
  25 +
  26 +<script>
  27 + require.config({baseUrl: $site.assets_url + '/js/',urlArgs : "v=" + require.version});
  28 + require([
  29 + 'user-app'
  30 + ],
  31 + function(app){
  32 + app.bootstrap({
  33 + baseUrl: $site.base_url
  34 + });
  35 + });
  36 +</script>
  37 +
  38 +<?=$this->render("@app/views/widgets/stat-code")?>
app-wx/modules/user/views/default/pages/index-template.php 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +?>
  7 +<style>
  8 +#index{}
  9 +
  10 +</style>
  11 +<script id="index-template" type="text/template">
  12 + <div class="pages">
  13 + <div class="page" id="index" style="background: #f2f3f6">
  14 + <div class="page-content">
  15 +
  16 + </div>
  17 +
  18 + </div>
  19 + </div>
  20 +</script>
app-wx/modules/user/views/default/pages/register-template.php 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +use yii\helpers\Url;
  4 +
  5 +$baseUrl = Url::base(true);
  6 +?>
  7 +<style>
  8 + body,div,p,span,input{padding: 0;margin: 0}
  9 + input{-webkit-appearance: none;}
  10 + #register{}
  11 + #register .input-list{padding:1rem;box-sizing: border-box}
  12 + #register .input-row-cls{width:100%;margin-top:0.7rem;}
  13 + #register .input-list .input-div{line-height: 1.25rem;font-size: 1rem;}
  14 + #register .input-list .input-cls{width:100%;line-height: inherit;font-size: inherit;border:1px solid #ccc;padding:0.3rem;box-sizing: border-box}
  15 + #register .input-list .validation-code{display:flex;align-items: center}
  16 + #register .input-list .get-code-cls{width: 7rem;font-size: 0.8rem;display: flex;align-items: center;justify-content:center;background:#f25601;color:#fff;padding:0.302rem 0.3rem;box-sizing: border-box;border: 1px solid #f25601;
  17 + border-left:0;}
  18 +
  19 +</style>
  20 +<script id="register-template" type="text/template">
  21 + <div class="pages">
  22 + <div class="page" id="register" style="background: #fff">
  23 + <div class="page-content">
  24 + <div class="input-list">
  25 + <div class="input-row-cls"><label class="input-label-cls">车厂名称</label><div class="input-div"><input class="input-cls" type="text" placeholder="输入车厂名称" /></div></div>
  26 +
  27 + <div class="input-row-cls"><label class="input-label-cls">手机号码</label><div class="input-div"><input class="input-cls" type="number" placeholder="输入手机号码" /></div></div>
  28 +
  29 + <div class="input-row-cls">
  30 + <label class="input-label-cls">验证码</label>
  31 + <div class="input-div validation-code">
  32 + <input class="input-cls" type="text" placeholder="" style="border-right: 0;"/>
  33 + <div class="get-code-cls">获取验证码</div>
  34 + </div>
  35 + </div>
  36 + </div>
  37 + <div style="padding:1rem;box-sizing: border-box">
  38 + <div>上传营业执照</div>
  39 + <div></div>
  40 + </div>
  41 + <div style="padding:1rem;box-sizing:border-box"><div style="width:70%; padding:1rem;text-align:center;box-sizing: border-box;color:#fff;background:#f25601;margin: 0 auto;">注册</div></div>
  42 + </div>
  43 + </div>
  44 + </div>
  45 +</script>
app-wx/modules/user/views/layouts/main.php 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +<?php
  2 +
  3 +use app\wx\assets\AppAsset;
  4 +use yii\helpers\Html;
  5 +
  6 +AppAsset::register($this);
  7 +
  8 +$site = $this->params['site'];
  9 +
  10 +$this->title = \yii::$app->name;
  11 +$assets = $this->getAssetManager();
  12 +$asset = $assets->getBundle('app\wx\assets\AppAsset');
  13 +?>
  14 +<?php $this->beginPage() ?>
  15 +<!DOCTYPE HTML>
  16 +
  17 +<html lang="<?= \yii::$app->language ?>">
  18 +<head>
  19 +<meta charset="<?= \yii::$app->charset ?>">
  20 +<meta name="apple-mobile-web-app-capable" content="yes">
  21 +<meta name="apple-mobile-web-app-status-bar-style" content="black">
  22 +<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
  23 +<meta http-equiv="Pragma" content="no-cache">
  24 +<meta http-equiv="Expires" content="0">
  25 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  26 +<?= Html::csrfMetaTags() ?>
  27 +<title><?= Html::encode($this->title) ?></title>
  28 +<script>
  29 + <?=$this->render("@app/views/widgets/js-site", ['site' => $site])?>
  30 +</script>
  31 +<?php $this->head() ?>
  32 +<style>
  33 +
  34 +</style>
  35 +</head>
  36 +<body>
  37 +<?php $this->beginBody() ?>
  38 +<?=$content?>
  39 +<?php $this->endBody() ?>
  40 +</body>
  41 +</html>
  42 +<?php $this->endPage() ?>
  43 +
web/dist/js/home-app.js
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -define("home-app",["mk7/app"],function(e){var n=Dom7,i=function(){var e=n(".ui-loading-block");0==e.length&&(n(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),n=document.createElement("p");n.className="notice",e&&(n.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(n))},window.waitingTime))},o=!0;return e.name="home",e.routes={index:function(){return o=!1,i(),e.runController("index")},register:function(){return o=!1,i(),e.runController("register")},"*":function(){return e.runController("index")}},e}),define("home/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("home/register-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,n,i){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("注册"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e});  
2 \ No newline at end of file 0 \ No newline at end of file
web/gulpfile.js
@@ -78,8 +78,8 @@ gulp.task(&#39;build&#39;, function () { @@ -78,8 +78,8 @@ gulp.task(&#39;build&#39;, function () {
78 78
79 //----------------------------------------------- 79 //-----------------------------------------------
80 //user module (用户模块) 80 //user module (用户模块)
81 - gulp.src([paths.source.scripts + 'home/*.js'])  
82 - .pipe(concat('home-app.js')) 81 + gulp.src([paths.source.scripts + 'user/*.js'])
  82 + .pipe(concat('user-app.js'))
83 .pipe(uglify()) 83 .pipe(uglify())
84 .pipe(gulp.dest(paths.dist.scripts)); 84 .pipe(gulp.dest(paths.dist.scripts));
85 //-------------------------------------------------- 85 //--------------------------------------------------
web/src/js/home/app.js
@@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
1 -/**  
2 - * 单页面应用  
3 - */  
4 -define(  
5 - "home-app",  
6 - [  
7 - 'mk7/app'  
8 - ],  
9 - function(app) {  
10 -  
11 - var $$ = Dom7;  
12 - var _autoLoading = function(){  
13 - var e = $$('.ui-loading-block');  
14 - if(0 == e.length){  
15 - //<!--预载入页面动画-->  
16 - $$('.view-main').html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>');  
17 - window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s  
18 - if(window['loaderTimer']){  
19 - clearTimeout(window['loaderTimer']);  
20 - }  
21 - window['loaderTimer'] = setTimeout(function(){  
22 - var loaderTips = document.getElementById('loader-inner');  
23 - var tips = document.createElement('p');  
24 - tips.className = 'notice';  
25 - if(loaderTips){  
26 - tips.innerHTML = '加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>';  
27 - loaderTips.appendChild(tips);  
28 - }  
29 - },window['waitingTime']);  
30 - }  
31 - };  
32 -  
33 - var fromOutside = true; // 标记是否从外部进来  
34 -  
35 - app.name = 'home';  
36 - app.routes = {  
37 - 'index': function () {  
38 - fromOutside = false;  
39 - _autoLoading();  
40 - return app.runController('index');  
41 - },  
42 - 'register': function () {  
43 - fromOutside = false;  
44 - _autoLoading();  
45 - return app.runController('register');  
46 - },  
47 - '*': function(){  
48 - return app.runController('index');  
49 - }  
50 - }  
51 - return app;  
52 - }  
53 -);  
web/src/js/home/index-controller.js
@@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
1 -/**  
2 - * 首页  
3 - */  
4 -define(  
5 - "home/index-controller",  
6 - [  
7 - 'mk7/controller',  
8 - 'mk7/url',  
9 - 'mk7/utils',  
10 - ],  
11 -  
12 - function(ctrl, url, utils) {  
13 -  
14 - var $$ = Dom7;  
15 - var t7 = Template7;  
16 - var ctrl = new ctrl();  
17 -  
18 - var pageurl = '/home/default/index-list';  
19 -  
20 -  
21 - ctrl.run = function () {  
22 - var me = this;  
23 - me.setPageTitle("首页");  
24 - me.hideAllNonBaseMenuItem(window.$site);  
25 -  
26 - me.render();  
27 -  
28 -  
29 - }  
30 - ctrl.bindEvents = function () {  
31 - var me = this;  
32 - console.log("bindEvents");  
33 -  
34 - }  
35 -  
36 - return ctrl;  
37 - }  
38 -);  
web/src/js/home/register-controller.js
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -/**  
2 - * 注册-首页  
3 - */  
4 -define(  
5 - "home/register-controller",  
6 - [  
7 - 'mk7/controller',  
8 - 'mk7/url',  
9 - 'mk7/utils',  
10 - ],  
11 -  
12 - function(ctrl, url, utils) {  
13 -  
14 - var $$ = Dom7;  
15 - var t7 = Template7;  
16 - var ctrl = new ctrl();  
17 -  
18 - var pageurl = '/home/maintainer/register';  
19 -  
20 - ctrl.run = function () {  
21 - var me = this;  
22 - me.setPageTitle("注册");  
23 - me.hideAllNonBaseMenuItem(window.$site);  
24 -  
25 - me.render();  
26 -  
27 -  
28 - }  
29 - ctrl.bindEvents = function () {  
30 - var me = this;  
31 - console.log("bindEvents");  
32 -  
33 - }  
34 -  
35 - return ctrl;  
36 - }  
37 -);  
web/src/js/user/app.js
1 /** 1 /**
2 - * 用户模块,单页面应用 2 + * 单页面应用
3 */ 3 */
4 define( 4 define(
5 "user-app", 5 "user-app",
6 [ 6 [
7 'mk7/app' 7 'mk7/app'
8 ], 8 ],
9 - function (app) { 9 + function(app) {
10 10
11 var $$ = Dom7; 11 var $$ = Dom7;
12 -  
13 - var _autoLoading = function () { 12 + var _autoLoading = function(){
14 var e = $$('.ui-loading-block'); 13 var e = $$('.ui-loading-block');
15 - if (0 == e.length) { 14 + if(0 == e.length){
16 //<!--预载入页面动画--> 15 //<!--预载入页面动画-->
17 $$('.view-main').html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'); 16 $$('.view-main').html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>');
18 window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s 17 window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s
19 - if (window['loaderTimer']) { 18 + if(window['loaderTimer']){
20 clearTimeout(window['loaderTimer']); 19 clearTimeout(window['loaderTimer']);
21 } 20 }
22 - window['loaderTimer'] = setTimeout(function () { 21 + window['loaderTimer'] = setTimeout(function(){
23 var loaderTips = document.getElementById('loader-inner'); 22 var loaderTips = document.getElementById('loader-inner');
24 var tips = document.createElement('p'); 23 var tips = document.createElement('p');
25 tips.className = 'notice'; 24 tips.className = 'notice';
26 - if (loaderTips) { 25 + if(loaderTips){
27 tips.innerHTML = '加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>'; 26 tips.innerHTML = '加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>';
28 loaderTips.appendChild(tips); 27 loaderTips.appendChild(tips);
29 } 28 }
30 - }, window['waitingTime']); 29 + },window['waitingTime']);
31 } 30 }
32 }; 31 };
33 32
34 var fromOutside = true; // 标记是否从外部进来 33 var fromOutside = true; // 标记是否从外部进来
35 34
36 - app.name = 'user',//用来 user 和 index-controller 构成完整的命名空间 user/index-controller  
37 - app.routes = {  
38 - 'index': function () {  
39 - fromOutside = false;  
40 - _autoLoading();  
41 - return app.runController('index');  
42 - },  
43 -  
44 - '*': function () {  
45 - if (redirectStatus == 1) {  
46 - window.location.href = redirect;  
47 - return;  
48 - }  
49 - fromOutside = false;  
50 - _autoLoading();  
51 - return app.runController('index');  
52 - }  
53 - 35 + app.name = 'user';
  36 + app.routes = {
  37 + 'index': function () {
  38 + fromOutside = false;
  39 + _autoLoading();
  40 + return app.runController('index');
  41 + },
  42 + 'register': function () {
  43 + fromOutside = false;
  44 + _autoLoading();
  45 + return app.runController('register');
  46 + },
  47 + '*': function(){
  48 + return app.runController('index');
54 } 49 }
55 - 50 + }
56 return app; 51 return app;
57 } 52 }
58 ); 53 );
web/src/js/user/index-controller.js
1 /** 1 /**
2 - * 用户中心首页控制器 2 + * 首页
3 */ 3 */
4 define( 4 define(
5 "user/index-controller", 5 "user/index-controller",
@@ -7,343 +7,32 @@ define( @@ -7,343 +7,32 @@ define(
7 'mk7/controller', 7 'mk7/controller',
8 'mk7/url', 8 'mk7/url',
9 'mk7/utils', 9 'mk7/utils',
10 - 'mk7/modals',  
11 - 'mk7/agreement-checker'  
12 ], 10 ],
13 - function (ctrl, url, utils, modals, agreementChecker) {  
14 - var ctrl = new ctrl(); 11 +
  12 + function(ctrl, url, utils) {
  13 +
15 var $$ = Dom7; 14 var $$ = Dom7;
16 var t7 = Template7; 15 var t7 = Template7;
17 - var STATUS_NEVER_AUTH = 0;  
18 - var STATUS_PHONE = 1;  
19 - var STATUS_REALNAME_AUTHING = 2;  
20 - var STATUS_REALNAME_AUTH = 3;  
21 - var STATUS_REALNAME_AUTH_FILE = 4;  
22 - var STATUS_SKILL_AUTH = 6;  
23 - var STATUS_SKILL_FAIL = 7;  
24 - var STATUS_DISABLE = 101; 16 + var ctrl = new ctrl();
  17 +
  18 + var pageurl = '/user/default/index-list';
25 19
26 - var DEFAULT_QRCODE_TEMPLATE_ID = 11; // 默认专属二维码模板ID定义  
27 20
28 ctrl.run = function () { 21 ctrl.run = function () {
29 - clearInterval(window.pollingTimer);  
30 var me = this; 22 var me = this;
31 - me.setPageTitle('个人中心');  
32 - me.getUserData();  
33 - agreementChecker.initServiceVersion(); 23 + me.setPageTitle("首页");
34 me.hideAllNonBaseMenuItem(window.$site); 24 me.hideAllNonBaseMenuItem(window.$site);
35 - // 初始化订单tab小红点  
36 - me.initOrderCountBadge();  
37 - };  
38 -  
39 - ctrl.bindEvents = function () {  
40 - var me = this;  
41 - console.log("bindEvents");  
42 - $$('.order_index').on('click', function () {  
43 - console.log('order_index');  
44 - window.location.replace('/order#index');  
45 - })  
46 - $$('.order_center').on('click', function () {  
47 - console.log('order_center');  
48 - window.location.replace('/order#order-center');  
49 - })  
50 - $$('.user_index').on('click', function () {  
51 - console.log('user_index');  
52 - window.location.replace('/user#index');  
53 - })  
54 - $$('.dispatch_index').on('click', function () {  
55 - window.location.replace('/dispatchorder#index');  
56 - })  
57 - };  
58 -  
59 - ctrl.getUserData = function () {  
60 - var me = this;  
61 - $$.ajax({  
62 - method: "POST",  
63 - url: url.to('user/default/get-profile'),  
64 - data: {},  
65 - dataType: "json",  
66 - beforeSend: function () {  
67 - me.showIndicator();  
68 - },  
69 - success: function (e) {  
70 - if (e.success) {  
71 - me.render(e);  
72 - me.bindEventsAfterAjax(e.engineer);  
73 - /*  
74 - if(e.pending_order_count > 0){  
75 - $$('.index-view-footer .total-count').addClass('bg-red').addClass('badge');  
76 - $$('.index-view-footer .total-count').text(e.pending_order_count);  
77 - }  
78 - */  
79 - }  
80 - },  
81 - error: function (e) {  
82 - },  
83 - complete: function (e) {  
84 - me.hideIndicator();  
85 - }  
86 - });  
87 - };  
88 -  
89 - ctrl.bindEventsAfterAjax = function (engineer) {  
90 - var me = this;  
91 - $$('.my-balance').on('click', function (e) {  
92 - me.mustRepairTypeAuth(engineer, '#wallet');  
93 - });  
94 - $$('.order-setting').on('click', function (e) {  
95 - me.mustPhoneAuth(engineer, '/user#order-setting');  
96 - });  
97 - $$('.realNameLi').on('click', function (e) {  
98 - me.mustRepairTypeAuth(engineer, '/tauth#real-name');  
99 - });  
100 - $$('.jiwoShop').on('click', function (e) {  
101 - me.mustRepairTypeAuth(engineer, '/shop#index');  
102 - });  
103 - $$('.userData').on('click', function (e) {  
104 - me.mustRepairTypeAuth(engineer, '/user#data');  
105 - });  
106 - $$('#levelScoreDetail').on('click', function (e) {  
107 - me.mustSkillAuth(engineer, '/user#level-score-detail');  
108 - });  
109 - $$('.userVip').on('click', function (e) {  
110 - me.mustRealNameAuth(engineer, '/user#vip');  
111 - });  
112 - $$('#btnTauthList').on('click', function (e) {  
113 - me.mustRealNameAuth(engineer, '/tauth#list');  
114 - });  
115 - $$('.Course').on('click', function (e) {  
116 - me.mustRepairTypeAuth(engineer, '/course#home');  
117 - });  
118 - $$('.my-order').on('click', function (e) {  
119 - if (engineer.status <= STATUS_SKILL_FAIL) {  
120 - if (engineer.status == STATUS_SKILL_AUTH) {  
121 - window.location.href = '#orders/working';  
122 - } else {  
123 - utils.toast({content: '请先完成认证'});  
124 - }  
125 - } else {  
126 - utils.toast({content: '您的账号已被禁用'});  
127 - }  
128 - });  
129 -  
130 - $$('.realname-btn').on('click', function (e) {  
131 - if (engineer.status <= STATUS_SKILL_FAIL) {  
132 - if (engineer.status == STATUS_NEVER_AUTH) {  
133 - utils.toast({content: '请先通过手机验证'});  
134 - setTimeout(function () {  
135 - window.location.href = '/tauth#mobile';  
136 - }, 1500);  
137 - } else if (engineer.status == STATUS_SKILL_AUTH) {  
138 - window.location.href = url.to('/tauth#real-name');  
139 - } else {  
140 - utils.toast({content: '请先完成认证'});  
141 - }  
142 - } else {  
143 - utils.toast({content: '您的账号已被禁用'});  
144 - }  
145 - });  
146 -  
147 - $$('.label-switch').on('click', function (e) {  
148 - var item_after_switch = $$(this).parents(".item-after-switch");  
149 - var switch_text = item_after_switch.children(".switch").text();  
150 - if (switch_text == '开') {  
151 - item_after_switch.children(".switch").text("关");  
152 - } else {  
153 - item_after_switch.children(".switch").text("开");  
154 - }  
155 - });  
156 -  
157 - var me = this;  
158 - $$('#applyQrcode').click(function () {  
159 - if (!engineer.canApplyQrcode) {  
160 - me.showTipModal();  
161 - return ;  
162 - }  
163 25
164 - window.location.href = url.to("/applyqcode#apply-code");  
165 - }) 26 + me.render();
166 27
167 - $$('#btnCreateQrcode').click(function () {  
168 - if (engineer.status <= STATUS_SKILL_FAIL) {  
169 - var tplId = DEFAULT_QRCODE_TEMPLATE_ID;  
170 - if (engineer.qrcode_template_id != "" && engineer.qrcode_template_id != null && engineer.qrcode_template_id != undefined) {  
171 - tplId = engineer.qrcode_template_id;  
172 - }  
173 - window.location.href = url.to('/applyqcode#apply-diy-code/' + tplId);  
174 - } else {  
175 - utils.toast({content: '您的账号已被禁用'});  
176 - }  
177 - })  
178 - // 联系客服打电话  
179 - $$(".contactService").on('click', function (e) {  
180 - e.preventDefault();  
181 - e.stopPropagation();  
182 - var me = this;  
183 - var pageDom = $$('#index')  
184 - var params = {'trace':'orderHelper'};  
185 - utils.httpPost(url.to('order/call/get-service-call'), params, function (res) {  
186 - if (!res.success) {  
187 - utils.toast({content: res.error});  
188 - return false;  
189 - }  
190 - if ('' != res.phone) {  
191 - utils.makePhone(pageDom, res.phone);  
192 - return false;  
193 - } else {  
194 - me.app.alert('系统异常无法拨号');  
195 - return false;  
196 - }  
197 - }, true)  
198 - })  
199 - };  
200 28
201 -  
202 -  
203 - ctrl.showTipModal = function () {  
204 - var me = this;  
205 - var ele = $$('script#tip-box-modal');  
206 - var params = {  
207 - text: "学习【绑定设备】教程<br/>并通过考试后可申领二维码"  
208 - };  
209 - var compiled = t7.compile(ele.html());  
210 - compiled = $$(compiled(params));  
211 - var content = compiled.html();  
212 -  
213 - me.app.modal({  
214 - text: content,  
215 - cssClass: 'myModal'  
216 - });  
217 -  
218 - $$('body').on('click', '#user-modal-close', function () {  
219 - me.app.closeModal();  
220 - });  
221 - $$('body').on('click', '#user-modal-confirm', function () {  
222 - me.app.closeModal();  
223 - window.location.href = url.to("/course"); // 进入接单教程首页  
224 - });  
225 - }  
226 -  
227 - ctrl.mustRealNameAuth = function (engineer, toUrl) {  
228 - if (engineer.status <= STATUS_SKILL_FAIL) {  
229 - if (engineer.status == STATUS_REALNAME_AUTH || engineer.status > STATUS_REALNAME_AUTH_FILE) {  
230 - window.location.href = toUrl;  
231 - return '';  
232 - }  
233 - if (engineer.status < STATUS_REALNAME_AUTH || engineer.status == STATUS_REALNAME_AUTH_FILE) {  
234 - //alert(url.to("/tauth#index"));  
235 - if (engineer.status == STATUS_NEVER_AUTH) {  
236 - window.location.href = url.to("/tauth#mobile");  
237 - } else {  
238 - if (engineer.selectTags) {  
239 - window.location.href = url.to("/tauth#real-name");  
240 - } else {  
241 - window.location.href = url.to("/user#repair-type");  
242 - }  
243 - }  
244 - return '';  
245 - }  
246 - // 后面统一做状态处理  
247 - utils.toast({content: '请先完成认证'});  
248 - } else {  
249 - utils.toast({content: '您的账号已被禁用'});  
250 - }  
251 - }  
252 -  
253 - ctrl.mustRepairTypeAuth = function (engineer, toUrl) {  
254 - if (engineer.status <= STATUS_SKILL_FAIL) {  
255 - if (engineer.status >= STATUS_REALNAME_AUTHING) {  
256 - if (engineer.selectTags) {  
257 - window.location.href = toUrl;  
258 - } else {  
259 - window.location.href = url.to("/user#repair-type");  
260 - }  
261 - return false;  
262 - }  
263 - if (engineer.status < STATUS_REALNAME_AUTHING) {  
264 - //alert(url.to("/tauth#index"));  
265 - if (engineer.status == STATUS_NEVER_AUTH) {  
266 - window.location.href = url.to("/tauth#mobile");  
267 - } else {  
268 - if (engineer.selectTags) {  
269 - window.location.href = toUrl;  
270 - } else {  
271 - window.location.href = url.to("/user#repair-type");  
272 - }  
273 - }  
274 - } else {  
275 - // 后面统一做状态处理  
276 - utils.toast({content: '请先完成认证'});  
277 - }  
278 - } else {  
279 - utils.toast({content: '您的账号已被禁用'});  
280 - }  
281 - }  
282 -  
283 - ctrl.mustSkillAuth = function (engineer, toUrl) {  
284 - if (engineer.status <= STATUS_SKILL_FAIL) {  
285 - if (engineer.status == STATUS_SKILL_AUTH) {  
286 - if (engineer.selectTags) {  
287 - window.location.href = toUrl;  
288 - } else {  
289 - window.location.href = url.to("/user#repair-type");  
290 - }  
291 - } else {  
292 - if (engineer.status < STATUS_SKILL_AUTH) {  
293 - //alert(url.to("/tauth#index"));  
294 - if (engineer.status == STATUS_NEVER_AUTH) {  
295 - window.location.href = url.to("/tauth#mobile");  
296 - } else {  
297 - if (engineer.selectTags) {  
298 - if (engineer.status < STATUS_REALNAME_AUTH || engineer.status == STATUS_REALNAME_AUTH_FILE) {  
299 - window.location.href = url.to("/tauth#real-name");  
300 - } else {  
301 - window.location.href = url.to("/tauth#list");  
302 - }  
303 - } else {  
304 - window.location.href = url.to("/user#repair-type");  
305 - }  
306 - }  
307 - } else {  
308 - // 后面统一做状态处理  
309 - utils.toast({content: '请先完成认证'});  
310 - }  
311 - }  
312 - } else {  
313 - utils.toast({content: '您的账号已被禁用'});  
314 - }  
315 - }  
316 -  
317 - ctrl.mustPhoneAuth = function (engineer, toUrl) {  
318 - if (engineer.status <= STATUS_SKILL_FAIL) {  
319 - if (engineer.status >= STATUS_PHONE) {  
320 - window.location.href = toUrl;  
321 - } else {  
322 - if (engineer.status == STATUS_NEVER_AUTH) {  
323 - window.location.href = url.to("/tauth#mobile");  
324 - } else {  
325 - window.location.href = toUrl;  
326 - }  
327 - }  
328 - } else {  
329 - utils.toast({content: '您的账号已被禁用'});  
330 - }  
331 } 29 }
  30 + ctrl.bindEvents = function () {
  31 + var me = this;
  32 + console.log("bindEvents");
332 33
333 - /**  
334 - * 初始化订单tab小红点  
335 - */  
336 - ctrl.initOrderCountBadge = function(){  
337 - utils.httpPost( url.to('order/default/get-each-orders-count'),{},function(res){  
338 - if (res.success) {  
339 - if (res.orders.totalOrderCount > 0) {  
340 - $$("#totalOrderBadge").css('display', 'block');  
341 - $$("#totalOrderBadge").html(res.orders.totalOrderCount);  
342 - }  
343 - }  
344 - })  
345 } 34 }
346 35
347 return ctrl; 36 return ctrl;
348 } 37 }
349 -);  
350 \ No newline at end of file 38 \ No newline at end of file
  39 +);
web/src/js/user/register-controller.js 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +/**
  2 + * 注册-首页
  3 + */
  4 +define(
  5 + "user/register-controller",
  6 + [
  7 + 'mk7/controller',
  8 + 'mk7/url',
  9 + 'mk7/utils',
  10 + ],
  11 +
  12 + function(ctrl, url, utils) {
  13 +
  14 + var $$ = Dom7;
  15 + var t7 = Template7;
  16 + var ctrl = new ctrl();
  17 +
  18 + var pageurl = '/user/maintainer/register';
  19 +
  20 + ctrl.run = function () {
  21 + var me = this;
  22 + me.setPageTitle("注册");
  23 + me.hideAllNonBaseMenuItem(window.$site);
  24 +
  25 + me.render();
  26 +
  27 +
  28 + }
  29 + ctrl.bindEvents = function () {
  30 + var me = this;
  31 + console.log("bindEvents");
  32 +
  33 + }
  34 +
  35 + return ctrl;
  36 + }
  37 +);