Ejemplo n.º 1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, AppTemplatesEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        public string PageBuilder(AppTemplatesEntity page, List <AppTemplatesEntity> component)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                AppPageAttrModel attr     = page.F_Content.ToObject <AppPageAttrModel>();
                string           pageName = "page" + page.F_Id.Replace("-", "");
                if (attr.isTabed == "true")
                {
                    sb.Append("<ion-view hide-nav-bar=\"" + attr.isHeadHide + "\" view-title=\"" + page.F_Name + "\">\r\n");
                    sb.Append("<ion-content padding=\"" + attr.isPadding + "\" style=\"background-color:" + attr.bgColor + ";\">\r\n");
                    sb.Append(ComponentBuilder(component));
                    sb.Append("</ion-content>\r\n");
                    sb.Append("</ion-view>\r\n");
                }
                else
                {
                    sb.Append("<ion-modal-view ng-controller=\"" + pageName + "Ctrl\">\r\n");
                    sb.Append("<ion-header-bar class=\"bar-stable nav-bar-block nav-title-slide-ios7\">\r\n");
                    sb.Append("<button class=\"button button-clear\" ng-click=\"closePageModel()\"><i class=\"icon ion-ios-arrow-left\"></i></button>\r\n");
                    sb.Append("<h1 class=\"title\">" + page.F_Name + "</h1>\r\n");
                    sb.Append("/ion-header-bar>\r\n");
                    sb.Append("<ion-content>\r\n");
                    sb.Append(ComponentBuilder(component));
                    sb.Append("</ion-content>\r\n");
                    sb.Append("</ion-modal-view>\r\n");
                }


                return(sb.ToString());
            }
            catch {
                throw;
            }
        }
Ejemplo n.º 3
0
        public string TabBuilder(AppTemplatesEntity tab, List <AppTemplatesEntity> tabs)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                AppTabsAttrModel attrTabs = tab.F_Content.ToObject <AppTabsAttrModel>();
                sb.Append("<ion-tabs class=\"tabs-icon-" + attrTabs.iconType + " tabs-background-" + attrTabs.bgColor + " tabs-color-" + attrTabs.iconColor + "\" >\r\n");
                foreach (var item in tabs)
                {
                    AppTabAttrModel attr = item.F_Content.ToObject <AppTabAttrModel>();
                    sb.Append("<ion-tab title=\"" + item.F_Name + "\" icon-on=\"" + attr.iconOn + "\" icon-off=\"" + attr.iconOff + "\" href=\"#/tab/" + attr.innerTabPage + "\">\r\n");
                    sb.Append("<ion-nav-view name=\"tab-" + item.F_Id.Replace("-", "") + "\"></ion-nav-view>\r\n");
                    sb.Append("</ion-tab>\r\n");
                }
                sb.Append("</ion-tabs>\r\n");

                return(sb.ToString());
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 产生html页面
        /// </summary>
        /// <param name="lists"></param>
        /// <returns></returns>
        public string AppBuilder(List <AppTemplatesEntity> lists, AppProjectEntity projectEntity, string outputDirectory)
        {
            string path = "";
            Dictionary <string, AppTemplatesEntity>         pageEntitys      = new Dictionary <string, AppTemplatesEntity>();
            Dictionary <string, List <AppTemplatesEntity> > componentEntitys = new Dictionary <string, List <AppTemplatesEntity> >();
            List <AppTemplatesEntity> tabsEntitys = new List <AppTemplatesEntity>();
            AppTemplatesEntity        tabEntity   = null;

            try
            {
                //将数据做分类处理
                foreach (var item in lists)
                {
                    if (item.F_Value == "lrTabs")
                    {
                        tabEntity = item;
                    }
                    else if (item.F_Value == "lrTab")
                    {
                        tabsEntitys.Add(item);
                    }
                    if (item.F_Type == "Page" && item.F_Value != "lrTabs")
                    {
                        pageEntitys.Add(item.F_Id, item);
                    }
                    else if (item.F_Type == "Component")
                    {
                        if (componentEntitys.ContainsKey(item.F_Parent))
                        {
                            componentEntitys[item.F_Parent].Add(item);
                        }
                        else
                        {
                            List <AppTemplatesEntity> componentlists = new List <AppTemplatesEntity>();
                            componentlists.Add(item);
                            componentEntitys.Add(item.F_Parent, componentlists);
                        }
                    }
                }
                //JS文件
                string jsPath = outputDirectory + "\\js";

                #region 创建appJs文件
                string appJsPath = jsPath + "\\learun-app.js";
                if (!System.IO.File.Exists(appJsPath))
                {
                    DirFileHelper.CreateFileContent(appJsPath, JSApp());
                }
                #endregion

                #region 创建路由文件
                string routerJsPath = jsPath + "\\learun-uirouter.js";
                if (!System.IO.File.Exists(routerJsPath))
                {
                    DirFileHelper.CreateFileContent(routerJsPath, JSRouter(pageEntitys, tabsEntitys, projectEntity));
                }
                #endregion

                #region 创建controllers文件
                string controllersJsPath = jsPath + "\\learun-controllers.js";
                if (!System.IO.File.Exists(controllersJsPath))
                {
                    DirFileHelper.CreateFileContent(controllersJsPath, JSControllers(pageEntitys));
                }
                #endregion

                //html文件
                string htmlPath = outputDirectory + "\\templates";
                #region 创建页面
                foreach (var item in pageEntitys)
                {
                    string htmlPagePath = htmlPath + "\\page" + item.Value.F_Id.Replace("-", "") + ".html";
                    if (!System.IO.File.Exists(htmlPagePath))
                    {
                        DirFileHelper.CreateFileContent(htmlPagePath, PageBuilder(item.Value, componentEntitys[item.Key]));
                    }
                }
                #endregion

                #region 创建tabs页
                string htmlTabsPath = htmlPath + "\\tabs.html";
                if (!System.IO.File.Exists(htmlTabsPath))
                {
                    DirFileHelper.CreateFileContent(htmlTabsPath, TabBuilder(tabEntity, tabsEntitys));
                }
                #endregion

                ZipHelper.CreateZip(outputDirectory, outputDirectory + ".zip");

                return(outputDirectory + ".zip");
            }
            catch {
                throw;
            }
        }