|
@@ -14,12 +14,47 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
|
|
|
url : "/",
|
|
url : "/",
|
|
|
templateUrl : "static/tpl/serve/home.html",
|
|
templateUrl : "static/tpl/serve/home.html",
|
|
|
controller: 'IndexCtrl'
|
|
controller: 'IndexCtrl'
|
|
|
- }).state('question', {
|
|
|
|
|
- url : "/question",
|
|
|
|
|
- templateUrl : "static/tpl/serve/question.html"
|
|
|
|
|
- }).state('question.index', {
|
|
|
|
|
- url : "/",
|
|
|
|
|
- templateUrl : "static/tpl/serve/question_index.html"
|
|
|
|
|
|
|
+ }).state('question', {
|
|
|
|
|
+ url: "/question",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/question_index.html",
|
|
|
|
|
+ }).state('question.myFeedback', {
|
|
|
|
|
+ url: "/myFeedback",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/myFeedback.html",
|
|
|
|
|
+ controller: 'MyFeedbackCtrl'
|
|
|
|
|
+ }).state('question.common', {
|
|
|
|
|
+ url: "/common",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/question/common.html",
|
|
|
|
|
+ controller: 'CommonQuestionCtrl'
|
|
|
|
|
+ }).state('question.class', {
|
|
|
|
|
+ url: "/class/:id",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/question/class.html",
|
|
|
|
|
+ controller: 'ClassCtrl'
|
|
|
|
|
+ }).state('question.search', {
|
|
|
|
|
+ url: "/search/:question",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/question/search_result.html",
|
|
|
|
|
+ controller: 'SearchCtrl'
|
|
|
|
|
+ }).state('question.solution', {
|
|
|
|
|
+ url: "/solution/:id",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/question/solution.html",
|
|
|
|
|
+ controller: 'SolutionCtrl'
|
|
|
|
|
+ }).state('self.client',{
|
|
|
|
|
+ url: "/client",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/client.html"
|
|
|
|
|
+ }).state('self.saas',{
|
|
|
|
|
+ url: "/saas",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/saas.html"
|
|
|
|
|
+ }).state('self.add',{
|
|
|
|
|
+ url: "/add_user",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/add_user.html",
|
|
|
|
|
+ controller: 'EditUserCtrl'
|
|
|
|
|
+ }).state('self.logout',{
|
|
|
|
|
+ url: "/logout_user",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/logout_user.html",
|
|
|
|
|
+ controller: 'EditUserCtrl'
|
|
|
|
|
+ }).state('self.bind',{
|
|
|
|
|
+ url: "/bind_business",
|
|
|
|
|
+ templateUrl: "static/tpl/serve/self/bind_business.html",
|
|
|
|
|
+ controller: 'EditUserCtrl'
|
|
|
}).state('contact', {
|
|
}).state('contact', {
|
|
|
url : "/contact",
|
|
url : "/contact",
|
|
|
templateUrl : "static/tpl/serve/contact.html",
|
|
templateUrl : "static/tpl/serve/contact.html",
|
|
@@ -39,8 +74,8 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
|
|
|
controller: 'GuideCtrl'
|
|
controller: 'GuideCtrl'
|
|
|
}).state('self', {
|
|
}).state('self', {
|
|
|
url : "/self",
|
|
url : "/self",
|
|
|
- templateUrl : "static/tpl/serve/self.html"
|
|
|
|
|
- }).state('self.forget_pwd1', {
|
|
|
|
|
|
|
+ templateUrl : "static/tpl/serve/self.html"
|
|
|
|
|
+ }).state('self.forget_pwd1', { // #/self/forget_pwd1
|
|
|
url : "/forget_pwd1",
|
|
url : "/forget_pwd1",
|
|
|
templateUrl : "static/tpl/serve/self/forget_pwd1.html",
|
|
templateUrl : "static/tpl/serve/self/forget_pwd1.html",
|
|
|
controller: 'ForgetPwd1Ctrl'
|
|
controller: 'ForgetPwd1Ctrl'
|
|
@@ -165,6 +200,222 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
}]);
|
|
}]);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 显示常见问题,按hot值查找问题
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('CommonQuestionCtrl', ['$scope', 'AuthenticationService', 'QuestionService', 'ngTableParams', 'BaseService','toaster', function($scope, AuthenticationService, QuestionService, ngTableParams, BaseService, toaster){
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ $scope.user = data;
|
|
|
|
|
+ if(!$scope.user){ //用户未登录
|
|
|
|
|
+ $scope.isAuthed = false;
|
|
|
|
|
+ }else{ //用户已登录
|
|
|
|
|
+ $scope.isAuthed = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
|
|
+ page : 1,
|
|
|
|
|
+ count : 10,
|
|
|
|
|
+ sorting: {
|
|
|
|
|
+ 'hot': 'desc'
|
|
|
|
|
+ }
|
|
|
|
|
+ }, {
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ counts: [15, 25, 50, 100],
|
|
|
|
|
+ getData: function($defer, params) {
|
|
|
|
|
+ var pageParams = params.url();
|
|
|
|
|
+ pageParams.hot = 5; //常见问题热度值,自定义设置
|
|
|
|
|
+ pageParams.isAuthed = $scope.isAuthed; //登录标识
|
|
|
|
|
+ QuestionService.getCommonQuestions(BaseService.parseParams(pageParams), function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ if(data) {
|
|
|
|
|
+ params.total(data.totalElements);
|
|
|
|
|
+ $defer.resolve(data.content);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 搜索框回车
|
|
|
|
|
+ $scope.onSearch = function(question) {
|
|
|
|
|
+ if(!question){
|
|
|
|
|
+ toaster.pop('warning', '提示', '请输入您的问题!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ window.location.href = "serve#/question/search/"+question
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 按类别查找问题
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('ClassCtrl',['$scope', 'AuthenticationService', 'QuestionService','ngTableParams','BaseService', '$stateParams',function($scope, AuthenticationService, QuestionService, ngTableParams, BaseService, $stateParams){
|
|
|
|
|
+ $scope.classId = $stateParams.id;
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ $scope.user = data;
|
|
|
|
|
+ if(!$scope.user){ //用户未登录
|
|
|
|
|
+ $scope.isAuthed = false;
|
|
|
|
|
+ }else{ //用户已登录
|
|
|
|
|
+ $scope.isAuthed = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ count: 10,
|
|
|
|
|
+ sorting: {
|
|
|
|
|
+ 'hot': 'desc'
|
|
|
|
|
+ }
|
|
|
|
|
+ }, {
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ counts: [15, 25, 50, 100,],
|
|
|
|
|
+ getData: function($defer, params){
|
|
|
|
|
+ var pageParams = params.url();
|
|
|
|
|
+ pageParams.classId = $stateParams.id;
|
|
|
|
|
+ pageParams.isAuthed = $scope.isAuthed; //登录标识
|
|
|
|
|
+ QuestionService.getQuestionsByClassId(BaseService.parseParams(pageParams), function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ if(data){
|
|
|
|
|
+ params.total(data.totalElements);
|
|
|
|
|
+ $defer.resolve(data.content);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 查询单个问题
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('SolutionCtrl', ['$scope', 'QuestionService', '$stateParams', function($scope, QuestionService, $stateParams){
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+ QuestionService.getOne({questionId : $stateParams.id}, function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ $scope.question = data;
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 搜索问题
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('SearchCtrl', ['$scope', 'QuestionService', '$stateParams', 'toaster', function($scope, QuestionService, $stateParams, toaster){
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+
|
|
|
|
|
+ $scope.pageInfo = {
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ curPage: 1,
|
|
|
|
|
+ pageIndex: new Array(), //存放页码数组
|
|
|
|
|
+ totalPage: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.allQuestion;
|
|
|
|
|
+ $scope.questions = new Array(10);
|
|
|
|
|
+
|
|
|
|
|
+ QuestionService.searchQuestions({question: $stateParams.question, similarity: 0.50}, function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ if(data.length != 0){
|
|
|
|
|
+ $scope.totalQuestion = data.length; //搜索结果总数
|
|
|
|
|
+ $scope.allQuestion = data; //全部搜索结果
|
|
|
|
|
+ $scope.questions = data.slice(0,10);//第一页显示数据
|
|
|
|
|
+
|
|
|
|
|
+ //总页数
|
|
|
|
|
+ $scope.pageInfo.totalPage = (data.length % $scope.pageInfo.pageSize) == 0 ? (data.length / $scope.pageInfo.pageSize) : parseInt(data.length / $scope.pageInfo.pageSize) +1;
|
|
|
|
|
+ //存储页码
|
|
|
|
|
+ for(var i = 0; i < $scope.pageInfo.totalPage; i++){
|
|
|
|
|
+ $scope.pageInfo.pageIndex[i] = i+1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ $scope.noResult = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ toaster.pop('error', '错误', response.data);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ //分页
|
|
|
|
|
+ $scope.splitPage = function(i){
|
|
|
|
|
+ $scope.questions = $scope.allQuestion.slice((i-1)*10, i*10);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ //查询我的反馈
|
|
|
|
|
+ app.controller('MyFeedbackCtrl', ['$scope', 'AuthenticationService', 'QuestionService', 'BaseService', 'ngTableParams', 'toaster', function($scope, AuthenticationService, QuestionService, BaseService, ngTableParams, toaster){
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ $scope.user = data;
|
|
|
|
|
+ if(!$scope.user){ //用户未登录
|
|
|
|
|
+ toaster.pop('warning', '提示', '您还未登录,请登录后再查看!');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }else{ //用户已登录
|
|
|
|
|
+ $scope.uu = $scope.user.userUU;
|
|
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ count: 10,
|
|
|
|
|
+ sorting: {
|
|
|
|
|
+ createTime: 'desc' //按反馈时间降序显示
|
|
|
|
|
+ }
|
|
|
|
|
+ }, {
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ counts: [15, 25, 50 ,100],
|
|
|
|
|
+ getData: function($defer, params) {
|
|
|
|
|
+ var pageParams = params.url();
|
|
|
|
|
+ pageParams.hot = 5;
|
|
|
|
|
+ pageParams.userUU = $scope.user.userUU
|
|
|
|
|
+ QuestionService.myFeedbackQuestions(BaseService.parseParams(pageParams), function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ if(data){
|
|
|
|
|
+ params.total(data.totalElements);
|
|
|
|
|
+ $defer.resolve(data.content);
|
|
|
|
|
+ $scope.questionCount = data.content.length;
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 添加用户权限校验
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('EditUserCtrl',['$scope', 'AuthenticationService', function($scope,AuthenticationService){
|
|
|
|
|
+ $scope.sys = true;
|
|
|
|
|
+ $scope.editUser = function(){
|
|
|
|
|
+ //已登录
|
|
|
|
|
+ if(AuthenticationService.isAuthed()){
|
|
|
|
|
+ //获取当前登录用户信息,以判断是否为管理员
|
|
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
|
|
+ $scope.user = data;
|
|
|
|
|
+ if($scope.user.sys){ //是管理员,页面跳转
|
|
|
|
|
+ window.location.href="./#/account/user";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ $scope.sys =false; //非管理员,提示信息
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ //未登录
|
|
|
|
|
+ else{
|
|
|
|
|
+ window.location.href="signin#/account/user";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 搜索框,回车触发
|
|
* 搜索框,回车触发
|
|
|
*/
|
|
*/
|