diff --git a/app-wx/config/main.php b/app-wx/config/main.php index 413a5c2..c4e5686 100644 --- a/app-wx/config/main.php +++ b/app-wx/config/main.php @@ -15,8 +15,8 @@ return [ 'defaultRoute' => 'order', 'modules' => [ - 'home' => [ - 'class' => 'app\wx\modules\home\Module', + 'user' => [ + 'class' => 'app\wx\modules\user\Module', ] ], 'components' => [ diff --git a/app-wx/config/params.php b/app-wx/config/params.php index 9316ece..1533d4e 100644 --- a/app-wx/config/params.php +++ b/app-wx/config/params.php @@ -1,5 +1,5 @@ 'admin@example.com', - 'VERSION' => 'v0.1.0 build 1', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数 + 'VERSION' => 'v0.1.0 build 2', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数 ]; diff --git a/app-wx/modules/home/Module.php b/app-wx/modules/home/Module.php deleted file mode 100644 index da7c449..0000000 --- a/app-wx/modules/home/Module.php +++ /dev/null @@ -1,17 +0,0 @@ -render('index'); - } - - -} \ No newline at end of file diff --git a/app-wx/modules/home/views/default/index.php b/app-wx/modules/home/views/default/index.php deleted file mode 100644 index bc76d38..0000000 --- a/app-wx/modules/home/views/default/index.php +++ /dev/null @@ -1,38 +0,0 @@ -getAssetManager(); -$asset = $assets->getBundle('app\wx\assets\AppAsset'); - -function img($file, $path = '/i/') -{ - return \Yii::$app->request->baseUrl . $path.$file; -} -?> - -
-
- render("@app/views/widgets/ui-loading")?> -
-
- -render('pages/index-template', ['asset' => $asset])?> -render('pages/register-template', ['asset' => $asset])?> - - - -render("@app/views/widgets/stat-code")?> diff --git a/app-wx/modules/home/views/default/pages/index-template.php b/app-wx/modules/home/views/default/pages/index-template.php deleted file mode 100644 index 0c9e080..0000000 --- a/app-wx/modules/home/views/default/pages/index-template.php +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/app-wx/modules/home/views/default/pages/register-template.php b/app-wx/modules/home/views/default/pages/register-template.php deleted file mode 100644 index bb67cb6..0000000 --- a/app-wx/modules/home/views/default/pages/register-template.php +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/app-wx/modules/home/views/layouts/main.php b/app-wx/modules/home/views/layouts/main.php deleted file mode 100644 index eb1fd57..0000000 --- a/app-wx/modules/home/views/layouts/main.php +++ /dev/null @@ -1,43 +0,0 @@ -params['site']; - -$this->title = \yii::$app->name; -$assets = $this->getAssetManager(); -$asset = $assets->getBundle('app\wx\assets\AppAsset'); -?> -beginPage() ?> - - - - - - - - - - - - -<?= Html::encode($this->title) ?> - -head() ?> - - - -beginBody() ?> - -endBody() ?> - - -endPage() ?> - diff --git a/app-wx/modules/user/Module.php b/app-wx/modules/user/Module.php new file mode 100644 index 0000000..621d993 --- /dev/null +++ b/app-wx/modules/user/Module.php @@ -0,0 +1,17 @@ +render('index'); + } + + +} \ No newline at end of file diff --git a/app-wx/modules/user/views/default/index.php b/app-wx/modules/user/views/default/index.php new file mode 100644 index 0000000..d01f7d5 --- /dev/null +++ b/app-wx/modules/user/views/default/index.php @@ -0,0 +1,38 @@ +getAssetManager(); +$asset = $assets->getBundle('app\wx\assets\AppAsset'); + +function img($file, $path = '/i/') +{ + return \Yii::$app->request->baseUrl . $path.$file; +} +?> + +
+
+ render("@app/views/widgets/ui-loading")?> +
+
+ +render('pages/index-template', ['asset' => $asset])?> +render('pages/register-template', ['asset' => $asset])?> + + + +render("@app/views/widgets/stat-code")?> diff --git a/app-wx/modules/user/views/default/pages/index-template.php b/app-wx/modules/user/views/default/pages/index-template.php new file mode 100644 index 0000000..0c9e080 --- /dev/null +++ b/app-wx/modules/user/views/default/pages/index-template.php @@ -0,0 +1,20 @@ + + + diff --git a/app-wx/modules/user/views/default/pages/register-template.php b/app-wx/modules/user/views/default/pages/register-template.php new file mode 100644 index 0000000..bb67cb6 --- /dev/null +++ b/app-wx/modules/user/views/default/pages/register-template.php @@ -0,0 +1,45 @@ + + + diff --git a/app-wx/modules/user/views/layouts/main.php b/app-wx/modules/user/views/layouts/main.php new file mode 100644 index 0000000..eb1fd57 --- /dev/null +++ b/app-wx/modules/user/views/layouts/main.php @@ -0,0 +1,43 @@ +params['site']; + +$this->title = \yii::$app->name; +$assets = $this->getAssetManager(); +$asset = $assets->getBundle('app\wx\assets\AppAsset'); +?> +beginPage() ?> + + + + + + + + + + + + +<?= Html::encode($this->title) ?> + +head() ?> + + + +beginBody() ?> + +endBody() ?> + + +endPage() ?> + diff --git a/web/dist/js/home-app.js b/web/dist/js/home-app.js deleted file mode 100644 index 438699f..0000000 --- a/web/dist/js/home-app.js +++ /dev/null @@ -1 +0,0 @@ -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('

'),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='加载速度太慢?试试重新加载',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}); \ No newline at end of file diff --git a/web/gulpfile.js b/web/gulpfile.js index e80e579..0b01c82 100644 --- a/web/gulpfile.js +++ b/web/gulpfile.js @@ -78,8 +78,8 @@ gulp.task('build', function () { //----------------------------------------------- //user module (用户模块) - gulp.src([paths.source.scripts + 'home/*.js']) - .pipe(concat('home-app.js')) + gulp.src([paths.source.scripts + 'user/*.js']) + .pipe(concat('user-app.js')) .pipe(uglify()) .pipe(gulp.dest(paths.dist.scripts)); //-------------------------------------------------- diff --git a/web/src/js/home/app.js b/web/src/js/home/app.js deleted file mode 100644 index 57585db..0000000 --- a/web/src/js/home/app.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 单页面应用 - */ -define( - "home-app", - [ - 'mk7/app' - ], - function(app) { - - var $$ = Dom7; - var _autoLoading = function(){ - var e = $$('.ui-loading-block'); - if(0 == e.length){ - // - $$('.view-main').html('

'); - window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s - if(window['loaderTimer']){ - clearTimeout(window['loaderTimer']); - } - window['loaderTimer'] = setTimeout(function(){ - var loaderTips = document.getElementById('loader-inner'); - var tips = document.createElement('p'); - tips.className = 'notice'; - if(loaderTips){ - tips.innerHTML = '加载速度太慢?试试重新加载'; - loaderTips.appendChild(tips); - } - },window['waitingTime']); - } - }; - - var fromOutside = true; // 标记是否从外部进来 - - app.name = 'home'; - app.routes = { - 'index': function () { - fromOutside = false; - _autoLoading(); - return app.runController('index'); - }, - 'register': function () { - fromOutside = false; - _autoLoading(); - return app.runController('register'); - }, - '*': function(){ - return app.runController('index'); - } - } - return app; - } -); diff --git a/web/src/js/home/index-controller.js b/web/src/js/home/index-controller.js deleted file mode 100644 index 935d16b..0000000 --- a/web/src/js/home/index-controller.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 首页 - */ -define( - "home/index-controller", - [ - 'mk7/controller', - 'mk7/url', - 'mk7/utils', - ], - - function(ctrl, url, utils) { - - var $$ = Dom7; - var t7 = Template7; - var ctrl = new ctrl(); - - var pageurl = '/home/default/index-list'; - - - ctrl.run = function () { - var me = this; - me.setPageTitle("首页"); - me.hideAllNonBaseMenuItem(window.$site); - - me.render(); - - - } - ctrl.bindEvents = function () { - var me = this; - console.log("bindEvents"); - - } - - return ctrl; - } -); diff --git a/web/src/js/home/register-controller.js b/web/src/js/home/register-controller.js deleted file mode 100644 index 28df619..0000000 --- a/web/src/js/home/register-controller.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 注册-首页 - */ -define( - "home/register-controller", - [ - 'mk7/controller', - 'mk7/url', - 'mk7/utils', - ], - - function(ctrl, url, utils) { - - var $$ = Dom7; - var t7 = Template7; - var ctrl = new ctrl(); - - var pageurl = '/home/maintainer/register'; - - ctrl.run = function () { - var me = this; - me.setPageTitle("注册"); - me.hideAllNonBaseMenuItem(window.$site); - - me.render(); - - - } - ctrl.bindEvents = function () { - var me = this; - console.log("bindEvents"); - - } - - return ctrl; - } -); diff --git a/web/src/js/user/app.js b/web/src/js/user/app.js index 39dd49d..4469879 100644 --- a/web/src/js/user/app.js +++ b/web/src/js/user/app.js @@ -1,58 +1,53 @@ /** - * 用户模块,单页面应用 + * 单页面应用 */ define( "user-app", [ 'mk7/app' ], - function (app) { + function(app) { var $$ = Dom7; - - var _autoLoading = function () { + var _autoLoading = function(){ var e = $$('.ui-loading-block'); - if (0 == e.length) { + if(0 == e.length){ // $$('.view-main').html('

'); window['waitingTime'] = 10000; // 显示重新加载的等待时间,默认10s - if (window['loaderTimer']) { + if(window['loaderTimer']){ clearTimeout(window['loaderTimer']); } - window['loaderTimer'] = setTimeout(function () { + window['loaderTimer'] = setTimeout(function(){ var loaderTips = document.getElementById('loader-inner'); var tips = document.createElement('p'); tips.className = 'notice'; - if (loaderTips) { + if(loaderTips){ tips.innerHTML = '加载速度太慢?试试重新加载'; loaderTips.appendChild(tips); } - }, window['waitingTime']); + },window['waitingTime']); } }; var fromOutside = true; // 标记是否从外部进来 - app.name = 'user',//用来 user 和 index-controller 构成完整的命名空间 user/index-controller - app.routes = { - 'index': function () { - fromOutside = false; - _autoLoading(); - return app.runController('index'); - }, - - '*': function () { - if (redirectStatus == 1) { - window.location.href = redirect; - return; - } - fromOutside = false; - _autoLoading(); - return app.runController('index'); - } - + app.name = 'user'; + app.routes = { + 'index': function () { + fromOutside = false; + _autoLoading(); + return app.runController('index'); + }, + 'register': function () { + fromOutside = false; + _autoLoading(); + return app.runController('register'); + }, + '*': function(){ + return app.runController('index'); } - + } return app; } ); diff --git a/web/src/js/user/index-controller.js b/web/src/js/user/index-controller.js index 918a91d..3012d41 100644 --- a/web/src/js/user/index-controller.js +++ b/web/src/js/user/index-controller.js @@ -1,5 +1,5 @@ /** - * 用户中心首页控制器 + * 首页 */ define( "user/index-controller", @@ -7,343 +7,32 @@ define( 'mk7/controller', 'mk7/url', 'mk7/utils', - 'mk7/modals', - 'mk7/agreement-checker' ], - function (ctrl, url, utils, modals, agreementChecker) { - var ctrl = new ctrl(); + + function(ctrl, url, utils) { + var $$ = Dom7; var t7 = Template7; - var STATUS_NEVER_AUTH = 0; - var STATUS_PHONE = 1; - var STATUS_REALNAME_AUTHING = 2; - var STATUS_REALNAME_AUTH = 3; - var STATUS_REALNAME_AUTH_FILE = 4; - var STATUS_SKILL_AUTH = 6; - var STATUS_SKILL_FAIL = 7; - var STATUS_DISABLE = 101; + var ctrl = new ctrl(); + + var pageurl = '/user/default/index-list'; - var DEFAULT_QRCODE_TEMPLATE_ID = 11; // 默认专属二维码模板ID定义 ctrl.run = function () { - clearInterval(window.pollingTimer); var me = this; - me.setPageTitle('个人中心'); - me.getUserData(); - agreementChecker.initServiceVersion(); + me.setPageTitle("首页"); me.hideAllNonBaseMenuItem(window.$site); - // 初始化订单tab小红点 - me.initOrderCountBadge(); - }; - - ctrl.bindEvents = function () { - var me = this; - console.log("bindEvents"); - $$('.order_index').on('click', function () { - console.log('order_index'); - window.location.replace('/order#index'); - }) - $$('.order_center').on('click', function () { - console.log('order_center'); - window.location.replace('/order#order-center'); - }) - $$('.user_index').on('click', function () { - console.log('user_index'); - window.location.replace('/user#index'); - }) - $$('.dispatch_index').on('click', function () { - window.location.replace('/dispatchorder#index'); - }) - }; - - ctrl.getUserData = function () { - var me = this; - $$.ajax({ - method: "POST", - url: url.to('user/default/get-profile'), - data: {}, - dataType: "json", - beforeSend: function () { - me.showIndicator(); - }, - success: function (e) { - if (e.success) { - me.render(e); - me.bindEventsAfterAjax(e.engineer); - /* - if(e.pending_order_count > 0){ - $$('.index-view-footer .total-count').addClass('bg-red').addClass('badge'); - $$('.index-view-footer .total-count').text(e.pending_order_count); - } - */ - } - }, - error: function (e) { - }, - complete: function (e) { - me.hideIndicator(); - } - }); - }; - - ctrl.bindEventsAfterAjax = function (engineer) { - var me = this; - $$('.my-balance').on('click', function (e) { - me.mustRepairTypeAuth(engineer, '#wallet'); - }); - $$('.order-setting').on('click', function (e) { - me.mustPhoneAuth(engineer, '/user#order-setting'); - }); - $$('.realNameLi').on('click', function (e) { - me.mustRepairTypeAuth(engineer, '/tauth#real-name'); - }); - $$('.jiwoShop').on('click', function (e) { - me.mustRepairTypeAuth(engineer, '/shop#index'); - }); - $$('.userData').on('click', function (e) { - me.mustRepairTypeAuth(engineer, '/user#data'); - }); - $$('#levelScoreDetail').on('click', function (e) { - me.mustSkillAuth(engineer, '/user#level-score-detail'); - }); - $$('.userVip').on('click', function (e) { - me.mustRealNameAuth(engineer, '/user#vip'); - }); - $$('#btnTauthList').on('click', function (e) { - me.mustRealNameAuth(engineer, '/tauth#list'); - }); - $$('.Course').on('click', function (e) { - me.mustRepairTypeAuth(engineer, '/course#home'); - }); - $$('.my-order').on('click', function (e) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status == STATUS_SKILL_AUTH) { - window.location.href = '#orders/working'; - } else { - utils.toast({content: '请先完成认证'}); - } - } else { - utils.toast({content: '您的账号已被禁用'}); - } - }); - - $$('.realname-btn').on('click', function (e) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status == STATUS_NEVER_AUTH) { - utils.toast({content: '请先通过手机验证'}); - setTimeout(function () { - window.location.href = '/tauth#mobile'; - }, 1500); - } else if (engineer.status == STATUS_SKILL_AUTH) { - window.location.href = url.to('/tauth#real-name'); - } else { - utils.toast({content: '请先完成认证'}); - } - } else { - utils.toast({content: '您的账号已被禁用'}); - } - }); - - $$('.label-switch').on('click', function (e) { - var item_after_switch = $$(this).parents(".item-after-switch"); - var switch_text = item_after_switch.children(".switch").text(); - if (switch_text == '开') { - item_after_switch.children(".switch").text("关"); - } else { - item_after_switch.children(".switch").text("开"); - } - }); - - var me = this; - $$('#applyQrcode').click(function () { - if (!engineer.canApplyQrcode) { - me.showTipModal(); - return ; - } - window.location.href = url.to("/applyqcode#apply-code"); - }) + me.render(); - $$('#btnCreateQrcode').click(function () { - if (engineer.status <= STATUS_SKILL_FAIL) { - var tplId = DEFAULT_QRCODE_TEMPLATE_ID; - if (engineer.qrcode_template_id != "" && engineer.qrcode_template_id != null && engineer.qrcode_template_id != undefined) { - tplId = engineer.qrcode_template_id; - } - window.location.href = url.to('/applyqcode#apply-diy-code/' + tplId); - } else { - utils.toast({content: '您的账号已被禁用'}); - } - }) - // 联系客服打电话 - $$(".contactService").on('click', function (e) { - e.preventDefault(); - e.stopPropagation(); - var me = this; - var pageDom = $$('#index') - var params = {'trace':'orderHelper'}; - utils.httpPost(url.to('order/call/get-service-call'), params, function (res) { - if (!res.success) { - utils.toast({content: res.error}); - return false; - } - if ('' != res.phone) { - utils.makePhone(pageDom, res.phone); - return false; - } else { - me.app.alert('系统异常无法拨号'); - return false; - } - }, true) - }) - }; - - - ctrl.showTipModal = function () { - var me = this; - var ele = $$('script#tip-box-modal'); - var params = { - text: "学习【绑定设备】教程
并通过考试后可申领二维码" - }; - var compiled = t7.compile(ele.html()); - compiled = $$(compiled(params)); - var content = compiled.html(); - - me.app.modal({ - text: content, - cssClass: 'myModal' - }); - - $$('body').on('click', '#user-modal-close', function () { - me.app.closeModal(); - }); - $$('body').on('click', '#user-modal-confirm', function () { - me.app.closeModal(); - window.location.href = url.to("/course"); // 进入接单教程首页 - }); - } - - ctrl.mustRealNameAuth = function (engineer, toUrl) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status == STATUS_REALNAME_AUTH || engineer.status > STATUS_REALNAME_AUTH_FILE) { - window.location.href = toUrl; - return ''; - } - if (engineer.status < STATUS_REALNAME_AUTH || engineer.status == STATUS_REALNAME_AUTH_FILE) { - //alert(url.to("/tauth#index")); - if (engineer.status == STATUS_NEVER_AUTH) { - window.location.href = url.to("/tauth#mobile"); - } else { - if (engineer.selectTags) { - window.location.href = url.to("/tauth#real-name"); - } else { - window.location.href = url.to("/user#repair-type"); - } - } - return ''; - } - // 后面统一做状态处理 - utils.toast({content: '请先完成认证'}); - } else { - utils.toast({content: '您的账号已被禁用'}); - } - } - - ctrl.mustRepairTypeAuth = function (engineer, toUrl) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status >= STATUS_REALNAME_AUTHING) { - if (engineer.selectTags) { - window.location.href = toUrl; - } else { - window.location.href = url.to("/user#repair-type"); - } - return false; - } - if (engineer.status < STATUS_REALNAME_AUTHING) { - //alert(url.to("/tauth#index")); - if (engineer.status == STATUS_NEVER_AUTH) { - window.location.href = url.to("/tauth#mobile"); - } else { - if (engineer.selectTags) { - window.location.href = toUrl; - } else { - window.location.href = url.to("/user#repair-type"); - } - } - } else { - // 后面统一做状态处理 - utils.toast({content: '请先完成认证'}); - } - } else { - utils.toast({content: '您的账号已被禁用'}); - } - } - - ctrl.mustSkillAuth = function (engineer, toUrl) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status == STATUS_SKILL_AUTH) { - if (engineer.selectTags) { - window.location.href = toUrl; - } else { - window.location.href = url.to("/user#repair-type"); - } - } else { - if (engineer.status < STATUS_SKILL_AUTH) { - //alert(url.to("/tauth#index")); - if (engineer.status == STATUS_NEVER_AUTH) { - window.location.href = url.to("/tauth#mobile"); - } else { - if (engineer.selectTags) { - if (engineer.status < STATUS_REALNAME_AUTH || engineer.status == STATUS_REALNAME_AUTH_FILE) { - window.location.href = url.to("/tauth#real-name"); - } else { - window.location.href = url.to("/tauth#list"); - } - } else { - window.location.href = url.to("/user#repair-type"); - } - } - } else { - // 后面统一做状态处理 - utils.toast({content: '请先完成认证'}); - } - } - } else { - utils.toast({content: '您的账号已被禁用'}); - } - } - - ctrl.mustPhoneAuth = function (engineer, toUrl) { - if (engineer.status <= STATUS_SKILL_FAIL) { - if (engineer.status >= STATUS_PHONE) { - window.location.href = toUrl; - } else { - if (engineer.status == STATUS_NEVER_AUTH) { - window.location.href = url.to("/tauth#mobile"); - } else { - window.location.href = toUrl; - } - } - } else { - utils.toast({content: '您的账号已被禁用'}); - } } + ctrl.bindEvents = function () { + var me = this; + console.log("bindEvents"); - /** - * 初始化订单tab小红点 - */ - ctrl.initOrderCountBadge = function(){ - utils.httpPost( url.to('order/default/get-each-orders-count'),{},function(res){ - if (res.success) { - if (res.orders.totalOrderCount > 0) { - $$("#totalOrderBadge").css('display', 'block'); - $$("#totalOrderBadge").html(res.orders.totalOrderCount); - } - } - }) } return ctrl; } -); \ No newline at end of file +); diff --git a/web/src/js/user/register-controller.js b/web/src/js/user/register-controller.js new file mode 100644 index 0000000..cb2aa07 --- /dev/null +++ b/web/src/js/user/register-controller.js @@ -0,0 +1,37 @@ +/** + * 注册-首页 + */ +define( + "user/register-controller", + [ + 'mk7/controller', + 'mk7/url', + 'mk7/utils', + ], + + function(ctrl, url, utils) { + + var $$ = Dom7; + var t7 = Template7; + var ctrl = new ctrl(); + + var pageurl = '/user/maintainer/register'; + + ctrl.run = function () { + var me = this; + me.setPageTitle("注册"); + me.hideAllNonBaseMenuItem(window.$site); + + me.render(); + + + } + ctrl.bindEvents = function () { + var me = this; + console.log("bindEvents"); + + } + + return ctrl; + } +); -- libgit2 0.21.0