123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- @using WeOnlineApp.Configuration
- @using WeOnlineApp.Helpers
- @using WeOnlineApp.Views.Shared.Modals
- @using WeOnlineApp.Views.Shared.SearchForm
- @using WeOnlineApp.Views.Shared.Table
- @{
- var table = new TableViewModel(IwbConsts.ApiAppUrl + "Question/GetAll", tableId: "table-q", hasBox: false).SetPageArray(4)
- .SetFields(new List<FieldItem>()
- {
- //new FieldItem("subjectCategory", "课程类型"),
- new FieldItem("title", "问题标题",isSort:false),
- //new FieldItem("contentInfo", "问题内容"),
- new FieldItem("campName", "课程名称","CampFormatter",isSort:false),
- new FieldItem("questionState", "问题状态","StateFormatter",isSort:false),
- new FieldItem("answerDateTime", "解答时间","AnswerDateTimeFormatter",isSort:false),
- new FieldItem("id", "查看详情","ActionFormatter",isSort:false),
- });
- }
- <style>
-
- .table-sm .iwb-checkbox > span {
- border-radius: 3px;
- top: -1px;
- left: 6PX;
- height: 15px;
- width: 15px;
- color: #008080;
- }
- .table-sm th, .table-sm td {
- font-size: 14px;
- padding-top: 2px !important;
- padding-bottom: 2px !important;
- }
- .table-sm .fixed-table-container thead th .th-inner, .table-sm .fixed-table-container tbody td .th-inner {
- line-height: 1;
- font-size: 14px;
- }
- .bootstrap-table .table thead > tr > th {
- padding: 0;
- margin: 0;
- background: #008080;
- color: #fff;
- }
- .bootstrap-table .fixed-table-container {
- border: 1px solid #008080;
- border-top: none;
- }
- .fixed-table-container tbody tr td {
- color: #008080;
- }
- .fixed-table-container tbody tr.selected td {
- background: #008080;
- color: #fff;
- }
- .fixed-table-container tbody tr.selected .iwb-checkbox > span {
- background: #fff;
- }
- .fixed-table-pagination .pagination-info {
- color: #008080;
- line-height: 20px;
- font-size: 12px;
- }
- .fixed-table-pagination div.pagination, .fixed-table-pagination .pagination-detail {
- margin-top: 3px;
- margin-bottom: 0px;
- }
- .page-link {
- color: #008080;
- background-color: #f5f5f5;
- }
- .page-item.active .page-link {
- z-index: 1;
- color: #fff;
- background-color: #008080;
- border-color: #008080;
- }
- .fixed-table-pagination div.pagination .pagination {
- margin-top: 2px;
- }
- .fixed-table-pagination .pagination a {
- padding: 2px 8px;
- line-height: 1.25;
- font-size: 12px;
- }
- .table-action {
- cursor: pointer;
- }
- </style>
- <div class="table-sm" style="display: none">
- @Html.Partial("Table/_Table", table)
- </div>
- @{
- var modal = new ModalViewModel("我要提问", "", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new InputHide("subjectCategoryNo", "课程类型"),
- new InputHide("campNo", "课程名称"),
- new Input("campName", "课程名称",placeholder:"未选择课程").SetNotRequired().SetDisabled(),
- new Input("title", "问题标题"),
- new InputTextarea("contentInfo", "问题内容"),
- }, "form-q"), "modal-q");
- var modal2 = new ModalViewModel("我要答疑", "", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new InputHide("questionNo"),
- new Input("campName", "课程名称",placeholder:"未选择课程").SetNotRequired().SetDisabled(),
- new Input("title", "问题标题").SetDisabled(),
- new InputTextarea("contentInfo", "答疑内容"),
- }, "form-a"), "modal-a");
- }
- @using (Html.BeginScripts())
- {
- @Html.Partial("Modals/_Modal", modal)
- @Html.Partial("Modals/_Modal", modal2)
- <script type="text/javascript">
- var tableQueryType, initFlag=false;
- function LoadQuestion(that) {
- $(that).closest('.nav-tabs').find('.active').removeClass('active');
- $(that).addClass('active');
- tableQueryType = $(that).data('type');
- if (!initFlag) {
- initFlag = true;
- LoadTable({
- table: 'table-q',
- queryParams: QueryParams,
- height:183,
- });
- $('.table-sm').fadeIn(500);
- } else {
- RefreshTable('table-q',true);
- }
- }
- function QueryParams(params) {
- var searchList = [],kf='';
- searchList.push({
- KeyWords:window.curCampNo,
- KeyField: 'campNo',
- FieldType: @((int)FieldType.S),
- ExpType: @((int)ExpType.Equal)
- });
- if (tableQueryType == 2) {//我的问题
- searchList.push({
- KeyWords: '@AbpSession.UserId',
- KeyField: 'CreatorUserId',
- FieldType: @((int)FieldType.L),
- ExpType: @((int)ExpType.Equal)
- });
- } else if (tableQueryType == 3) {//我的收藏
- kf = "1";
- }
- return {
- MaxResultCount: params.limit,
- SkipCount: params.offset,
- sorting: params.sort ? params.sort + ' ' + params.order : '',
- keyField: kf,
- fieldType: 0,
- expType: 0,
- keyWords: window.curSubjectCategoryNo,
- SearchList: searchList
- };
- }
- </script>
- <script type="text/javascript">
- function Question() {
-
- OpenModal({
- url: abp.appUrl + "Question/create",
- modal: "modal-q",
- table: 'table-q',
- data: { id: "", subjectCategoryNo: window.curSubjectCategoryNo, campNo: window.curCampNo, campName: window.curCampName }
- });
- }
- function Answer() {
- var row = $('#table-q').bootstrapTable("getSelections")[0];
- if (row) {
- OpenModal({
- url: abp.appUrl + "Question/AddAnswer",
- modal: "modal-a",
- data: {
- questionNo: row.id,
- title: row.title,
- campName: row.campName
- }
- });
- } else {
- abp.message.warn("请选择一个问题进行答疑!");
- }
- }
- function Favorite(that) {
- var favorite = $(that).data('favorite'), id = $(that).data('id');
- $.iwbAjax({
- table: 'table-q',
- isValidate: false,
- data: {
- id: id,
- isFavorite: !favorite
- },
- success: function () {
- $(that).data('favorite', !favorite);
- }
- });
- }
- function QuestionDetail(id) {
- window.location.href = "@Url.Action("Detail","Question")/"+id;
- //$.iwbAjax4({
- // url: abp.appUrl + "Question/GeQuestionDetail?no=" + id,
- // success: function(res) {
- // }
- //});
- }
- </script>
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- function TypeFormatter(v) {
- var name = $('#hid-type option[value="' + v + '"]').text();
- switch (v) {
- case 0:
- return '<span class="label label-danger">' + name + '</span>';
- default:
- return '<span class="label label-info">' + name + '</span>';
- }
- }
- function CampFormatter(v) {
- if (v) {
- return '<span class="label label-warning">' + v + '</span>';
- }
- return '';
- }
- function StateFormatter(v) {
- if (v == @(QuestionStateDefinition.New)) {
- return '<span class="label label-danger">未解答</span>';
- } else if (v == @(QuestionStateDefinition.Answer)) {
- return '<span class="label label-success">已解答</span>';
- }
- return '';
- }
- function AnswerDateTimeFormatter(v,r,f,d) {
- if (r.questionState == @(QuestionStateDefinition.New)) {
- return "";
- }
- return DateTimeFormatter(v, r, f, d);
- }
- function ActionFormatter(v) {
- return '<span class="table-action" onclick="QuestionDetail(\'' + v +'\')"><i class="iconfont icon-eye" style="cursor:pointer;margin-right:5px;"></i>查看</span> ';
- }
- </script>
- }
- <section style="display: none">
- <select id="hid-type">
- <option value=""></option>
- </select>
- @*@Html.DropDownList("hid-type", type)*@
- </section>
|