其他分享
首页 > 其他分享> > CoffeeScript编写简单新闻页(仅UI)

CoffeeScript编写简单新闻页(仅UI)

作者:互联网

CoffeeScript编写简单新闻页(仅UI)

1. 配置(在公司搭建好的环境下配置)

  1. omnisocials-backend/src/backend/modules/member/config/main.php文件夹下配置如下代码:
[
    'order' => 6,
    'title' => 'member_myNews',
    'name' => 'myNews',
    'state' => 'member-myNews'
],
  1. omnisocials-frontend/src/static/portal/modules/member/i18n/locate-zh_cn.json配置title,代码如下:
"member_myNews": "创建新闻",
  1. omnisocials-frontend/src/static/portal/modules/member/config.json配置state,代码如下:
"member-myNews",
  1. omnisocials-frontend/src/static/portal/modules/member/partials写页面右侧链接html页面,例如:myNews.html.
  2. omnisocials-frontend/src/static/portal/modules/member/styles写页面右侧链接html页面的样式代码,例如: myNews.css。
  3. omnisocials-frontend/src/static/portal/modules/member/index.scss 把css页面配到里面,这样html才会有样式。
  4. /home/user/omnisocials/omnisocials-frontend/src/static/portal/modules/member/controllers写coffee脚本。

2. 各文件代码

<div wm-breadcrumb="myNews.breadcrumb"></div>
<form>
    <div>
        <div class="plate-category">
            <span class="required-sign">*</span><span class="required-content">新闻作者</span>
            <input type="text" />
        </div>
    </div>
    <div>
        <div class="plate-category">
            <span class="required-sign">*</span ><span class="required-content">新闻标题</span>
            <input type="text"/>
        </div>
    </div>
    <div>
        <div class="plate-category">
            <span class="required-sign">*</span><span class="required-content">新闻内容</span>
            <textarea class="textarea-filed"></textarea>
        </div>
    </div>
    <input class="submit-button" type="submit" value="保存"/>
</form>
$required-sign-color:red;
$border-color:#e2e2e2;
$submit-button-color:#fff;
$submit-button-background-color:#37c3aa;

body {
    font-size: 14px;
}
input {
    display: block;
    width: 50%;
    height: 30px;
    border: 1px solid $border-color;
}
.plate-category {
    margin-top: 50px;
}
.required-sign {
        color: $required-sign-color;
}

.required-content {
        font-family: Arial,'Microsoft YaHei';
}

.textarea-filed {
    width: 50%;
    height: 106px;
    padding: 10px;
    border: 1px solid $border-color;
    border-radius: 2px;
    resize: vertical;
    box-sizing: border-box;
    box-shadow: none;
    display: block;
}

.submit-button {
    color: $submit-button-color;
    background-color: $submit-button-background-color;
    border-color: transparent;
    width: 10%;
    margin-top: 50px;
}
define [
'wm/app'
'wm/config'
], (app, config) ->
app.registerController 'wm.ctrl.member.myNews', [
    'restService'
    '$filter'
    '$location'
    'notificationService'
    'utilService'
    (restService, $filter, $location, notificationService, utilService) ->
    vm = this
    
    initBreadcrumb = ->
        vm.breadcrumb = [
        text: 'member_myNews'
        icon: 'statmember'
        ]
    init = ->
        initBreadcrumb()
    init()
    vm
]

标签:myNews,src,color,member,CoffeeScript,UI,新闻页,border,omnisocials
来源: https://blog.51cto.com/u_11462036/2794948