update news
parent
a4c44e59a2
commit
8d2aeba7e4
|
|
@ -0,0 +1,92 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Dapper;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Web;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using Dapper.Contrib.Extensions;
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Dynamic;
|
||||
using NPOI;
|
||||
using NPOI.HPSF;
|
||||
using NPOI.HSSF;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.XSSF;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using NPOI.POIFS;
|
||||
using NPOI.Util;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Security.Policy;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using static DbTableClass;
|
||||
using System.Runtime.InteropServices.ObjectiveC;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using static Journeys_WantHome.Controllers.AuthApiController;
|
||||
|
||||
|
||||
namespace Journeys_WantHome.Controllers
|
||||
{
|
||||
[Route("Api")]
|
||||
public class ApiController : ControllerBase
|
||||
{
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
DbConn dbConn = new DbConn();
|
||||
SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
|
||||
SqlConnection elabConn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:ElabConnectionString"));
|
||||
|
||||
|
||||
public ApiController(IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
this._httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
[Route("optionItemList")]
|
||||
public ActionResult OptionItemList(IFormCollection obj)
|
||||
{
|
||||
optionListResult ret = new optionListResult();
|
||||
|
||||
authToken token = new authToken(this._httpContextAccessor);
|
||||
if (token.user_isLogin == false)
|
||||
{
|
||||
HttpContext.Response.Cookies.Delete("token_key");
|
||||
ret.ret = "no";
|
||||
ret.err_code = "99999";
|
||||
ret.message = "非登入狀態!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string option_uid = obj["option_uid"].ToString();
|
||||
|
||||
if (option_uid == "")
|
||||
{
|
||||
ret.ret = "no";
|
||||
ret.err_code = "00001";
|
||||
ret.message = "無option_uid資料!";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
ret.optionItems = conn.Query<optionItem>("select * from optionItem where optionItem_ishide = 'N' and option_uid = @option_uid order by optionItem_order ", new { option_uid = option_uid }).ToList();
|
||||
ret.ret = "yes";
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +55,8 @@ namespace Journeys_WantHome.Controllers
|
|||
public AuthApiController(IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
this._httpContextAccessor = httpContextAccessor;
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Route("optionItemOrder")]
|
||||
|
|
@ -685,6 +687,29 @@ namespace Journeys_WantHome.Controllers
|
|||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
[Route("logout")]
|
||||
public ActionResult Logout() {
|
||||
signinResult ret = new signinResult();
|
||||
|
||||
authToken _objToken = new authToken(this._httpContextAccessor);
|
||||
|
||||
if (_objToken.user_isLogin == true)
|
||||
{
|
||||
string token_key = _httpContextAccessor.HttpContext.Request.Cookies["token_key"];
|
||||
|
||||
|
||||
conn.Execute("delete token where token_key = @token_key", new { token_key = token_key});
|
||||
|
||||
}
|
||||
|
||||
HttpContext.Response.Cookies.Delete("token_key");
|
||||
|
||||
ret.ret = "yes";
|
||||
|
||||
|
||||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
[Route("signin")]
|
||||
public ActionResult Signin(IFormCollection obj) {
|
||||
signinResult ret = new signinResult();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,18 @@ namespace Journeys_WantHome.Controllers
|
|||
kolDetial kolD = new kolDetial(myKol);
|
||||
}
|
||||
|
||||
public IActionResult KolList()
|
||||
{
|
||||
if (checkToken() == false)
|
||||
{
|
||||
HttpContext.Response.Cookies.Delete("token_key");
|
||||
return Redirect("~/Root/Login");
|
||||
}
|
||||
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult OptionList()
|
||||
{
|
||||
if (checkToken() == false)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public class DbTableClass
|
|||
|
||||
public string kol_name { get; set; } = "";
|
||||
|
||||
public string kol_photo { get; set; } = "";
|
||||
|
||||
public string kol_descript { get; set; } = "";
|
||||
|
||||
public string kol_men_ratio { get; set; } = "";
|
||||
|
|
|
|||
|
|
@ -77,10 +77,22 @@ public class kolCooperateTypeDetail : kolCooperateType {
|
|||
public bool dataUpdate() {
|
||||
if (this._kolCooperateType != null)
|
||||
{
|
||||
Type dataType = _kolCooperateType.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kolCooperateType.GetType().GetProperty(propName).SetValue(_kolCooperateType, propValue);
|
||||
}
|
||||
|
||||
if (this._kolCooperateType.kolCooperateType_uid == "")
|
||||
{
|
||||
|
||||
this._kolCooperateType.kolCooperateType_uid = "KCT_" + GlobalClass.CreateRandomCode(16);
|
||||
|
||||
this.kolCooperateType_uid = this._kolCooperateType.kolCooperateType_uid;
|
||||
try
|
||||
{
|
||||
conn.Insert(this._kolCooperateType);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dapper;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Data.SqlClient;
|
||||
using static DbTableClass;
|
||||
|
|
@ -8,14 +9,16 @@ public class kolDetial : kol
|
|||
DbConn dbConn = new DbConn();
|
||||
SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
|
||||
|
||||
public List<kolCooperateType> cooperateTypes = new List<kolCooperateType>();
|
||||
public List<kolFansType> fansTypes = new List<kolFansType>();
|
||||
public List<kolMakeup> makeups = new List<kolMakeup>();
|
||||
public List<kolMedia> medias = new List<kolMedia>();
|
||||
public List<kolStyle> styles = new List<kolStyle>();
|
||||
public List<kolCooperateTypeDetail> cooperateTypes = new List<kolCooperateTypeDetail>();
|
||||
public List<kolFansTypeDetail> fansTypes = new List<kolFansTypeDetail>();
|
||||
public List<kolMakeupDetail> makeups = new List<kolMakeupDetail>();
|
||||
public List<kolMediaDetail> medias = new List<kolMediaDetail>();
|
||||
public List<kolStyleDetail> styles = new List<kolStyleDetail>();
|
||||
public string updateResult { get; set; } = "";
|
||||
private kol _kol;
|
||||
|
||||
public kolDetial() {
|
||||
|
||||
public kolDetial() {
|
||||
_kol = new kol();
|
||||
}
|
||||
|
||||
public kolDetial(kol kolObj)
|
||||
|
|
@ -31,21 +34,150 @@ public class kolDetial : kol
|
|||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
|
||||
_kol = kolObj;
|
||||
loadList();
|
||||
}
|
||||
|
||||
private void loadList() {
|
||||
if (this.kol_uid != "") {
|
||||
this.cooperateTypes.Clear();
|
||||
this.fansTypes.Clear();
|
||||
this.makeups.Clear();
|
||||
this.medias.Clear();
|
||||
this.styles.Clear();
|
||||
public kolDetial(string kol_uid)
|
||||
{
|
||||
_kol = conn.QueryFirstOrDefault<kol>("select * from kol where kol_uid = @kol_uid", new { kol_uid = kol_uid});
|
||||
|
||||
this.cooperateTypes = conn.Query<kolCooperateType>("select * from ").ToList();
|
||||
if (_kol != null) {
|
||||
Type dataType = _kol.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(_kol, null);
|
||||
|
||||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
loadList();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadList() {
|
||||
if (this.kol_uid != "") {
|
||||
cooperateTypes.Clear();
|
||||
fansTypes.Clear();
|
||||
makeups.Clear();
|
||||
medias.Clear();
|
||||
styles.Clear();
|
||||
|
||||
List <kolCooperateType> kolCooperateTypes = conn.Query<kolCooperateType>("select A.* from kolCooperateType A, optionItem B where A.option_uid = B.option_uid and A.optionItem_uid = B.optionItem_uid and A.kol_uid = @kol_uid order by B.optionItem_order", new { kol_uid = this.kol_uid} ).ToList();
|
||||
List<kolFansType> kolFansTypes = conn.Query<kolFansType>("select A.* from kolFansType A, optionItem B where A.option_uid = B.option_uid and A.optionItem_uid = B.optionItem_uid and A.kol_uid = @kol_uid order by B.optionItem_order", new { kol_uid = this.kol_uid }).ToList();
|
||||
List<kolMakeup> kolMakeups = conn.Query<kolMakeup>("select A.* from kolMakeup A, optionItem B where A.option_uid = B.option_uid and A.optionItem_uid = B.optionItem_uid and A.kol_uid = @kol_uid order by B.optionItem_order", new { kol_uid = this.kol_uid }).ToList();
|
||||
List<kolMedia> kolMedias = conn.Query<kolMedia>("select A.* from kolMedia A, optionItem B where A.option_uid = B.option_uid and A.optionItem_uid = B.optionItem_uid and A.kol_uid = @kol_uid order by B.optionItem_order", new { kol_uid = this.kol_uid }).ToList();
|
||||
List<kolStyle> kolStyles = conn.Query<kolStyle>("select A.* from kolStyle A, optionItem B where A.option_uid = B.option_uid and A.optionItem_uid = B.optionItem_uid and A.kol_uid = @kol_uid order by B.optionItem_order", new { kol_uid = this.kol_uid }).ToList();
|
||||
|
||||
foreach (kolCooperateType objItem in kolCooperateTypes)
|
||||
{
|
||||
kolCooperateTypeDetail objDetail = new kolCooperateTypeDetail(objItem);
|
||||
cooperateTypes.Add(objDetail);
|
||||
}
|
||||
|
||||
foreach (kolFansType objItem in kolFansTypes) {
|
||||
kolFansTypeDetail objDetail = new kolFansTypeDetail(objItem);
|
||||
fansTypes.Add(objDetail);
|
||||
}
|
||||
|
||||
foreach (kolMakeup objItem in kolMakeups)
|
||||
{
|
||||
kolMakeupDetail objDetail = new kolMakeupDetail(objItem);
|
||||
kolMakeups.Add(objDetail);
|
||||
}
|
||||
|
||||
foreach (kolMedia objItem in kolMedias)
|
||||
{
|
||||
kolMediaDetail objDetail = new kolMediaDetail(objItem);
|
||||
kolMedias.Add(objDetail);
|
||||
}
|
||||
|
||||
foreach (kolStyle objItem in kolStyles)
|
||||
{
|
||||
kolStyleDetail objDetail = new kolStyleDetail(objItem);
|
||||
kolStyles.Add(objDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool dataUpdate()
|
||||
{
|
||||
if (_kol != null)
|
||||
{
|
||||
Type dataType = _kol.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kol.GetType().GetProperty(propName).SetValue(_kol, propValue);
|
||||
}
|
||||
|
||||
if (_kol.kol_uid == "") {
|
||||
this._kol.kol_uid = "KOL_" + GlobalClass.CreateRandomCode(12);
|
||||
this.kol_uid = this._kol.kol_uid;
|
||||
try
|
||||
{
|
||||
conn.Insert(this._kol);
|
||||
updateResult = "success";
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
updateResult = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Update(this._kol);
|
||||
updateResult = "success";
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
updateResult = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
updateResult = "null 物件無法更新";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateList()
|
||||
{
|
||||
foreach (var item in cooperateTypes) {
|
||||
item.dataUpdate();
|
||||
}
|
||||
|
||||
foreach (var item in fansTypes)
|
||||
{
|
||||
item.dataUpdate();
|
||||
}
|
||||
|
||||
foreach (var item in makeups)
|
||||
{
|
||||
item.dataUpdate();
|
||||
}
|
||||
|
||||
foreach (var item in medias)
|
||||
{
|
||||
item.dataUpdate();
|
||||
}
|
||||
|
||||
foreach (var item in styles)
|
||||
{
|
||||
item.dataUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,21 @@ public class kolFansTypeDetail : kolFansType
|
|||
{
|
||||
if (this._kolFansType != null)
|
||||
{
|
||||
Type dataType = _kolFansType.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kolFansType.GetType().GetProperty(propName).SetValue(_kolFansType, propValue);
|
||||
}
|
||||
|
||||
if (this._kolFansType.kolFansType_uid == "")
|
||||
{
|
||||
this._kolFansType.kolFansType_uid = "KFT_" + GlobalClass.CreateRandomCode(16);
|
||||
this.kolFansType_uid = this._kolFansType.kolFansType_uid;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,10 +79,21 @@ public class kolMakeupDetail : kolMakeup
|
|||
{
|
||||
if (this._kolMakeup != null)
|
||||
{
|
||||
Type dataType = _kolMakeup.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kolMakeup.GetType().GetProperty(propName).SetValue(_kolMakeup, propValue);
|
||||
}
|
||||
|
||||
if (this._kolMakeup.kolMakeup_uid == "")
|
||||
{
|
||||
this._kolMakeup.kolMakeup_uid = "KMK_" + GlobalClass.CreateRandomCode(16);
|
||||
|
||||
this.kolMakeup_uid = this._kolMakeup.kolMakeup_uid;
|
||||
try
|
||||
{
|
||||
conn.Insert(this._kolMakeup);
|
||||
|
|
|
|||
|
|
@ -79,9 +79,21 @@ public class kolMediaDetail : kolMedia
|
|||
{
|
||||
if (this._kolMedia != null)
|
||||
{
|
||||
Type dataType = _kolMedia.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kolMedia.GetType().GetProperty(propName).SetValue(_kolMedia, propValue);
|
||||
}
|
||||
|
||||
if (this._kolMedia.kolMedia_uid == "")
|
||||
{
|
||||
this._kolMedia.kolMedia_uid = "KME_" + GlobalClass.CreateRandomCode(16);
|
||||
this.kolMedia_uid = this._kolMedia.kolMedia_uid;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class kolStyleDetail : kolStyle
|
|||
|
||||
public kolStyleDetail(string kolMakeup_uid)
|
||||
{
|
||||
_kolStyle = conn.QueryFirstOrDefault<kolStylea>("select * from kolStyle where kolStyle_uid = @kolStyle_uid", new { kolStyle_uid = kolStyle_uid });
|
||||
_kolStyle = conn.QueryFirstOrDefault<kolStyle>("select * from kolStyle where kolStyle_uid = @kolStyle_uid", new { kolStyle_uid = kolStyle_uid });
|
||||
|
||||
if (_kolStyle != null)
|
||||
{
|
||||
|
|
@ -79,10 +79,21 @@ public class kolStyleDetail : kolStyle
|
|||
{
|
||||
if (this._kolStyle != null)
|
||||
{
|
||||
Type dataType = _kolStyle.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(this, null);
|
||||
|
||||
_kolStyle.GetType().GetProperty(propName).SetValue(_kolStyle, propValue);
|
||||
}
|
||||
|
||||
if (this._kolStyle.kolStyle_uid == "")
|
||||
{
|
||||
this._kolStyle.kolStyle_uid = "KST_" + GlobalClass.CreateRandomCode(16);
|
||||
|
||||
this.kolStyle_uid = this._kolStyle.kolStyle_uid;
|
||||
try
|
||||
{
|
||||
conn.Insert(this._kolStyle);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
}
|
||||
|
||||
@section Script {
|
||||
<script src="~/assets/javascript/custom/dashboard.js?v=1"></script>
|
||||
<script src="~/assets/javascript/custom/dashboard.js" asp-append-version="true"></script>
|
||||
<script>
|
||||
const numberInput = document.getElementById('myNumberInput');
|
||||
numberInput.addEventListener('input', function (event) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,152 @@
|
|||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
Layout = "_LooperLayout";
|
||||
}
|
||||
@section Script {
|
||||
<script src="~/assets/vendor/datatables.net/js/jquery.dataTables.min.js"></script>
|
||||
<script src="~/assets/vendor/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="~/assets/vendor/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
|
||||
<script src="~/assets/javascript/pages/dataTables.bootstrap.js"></script>
|
||||
<script src="~/assets/javascript/custom/kollist.js" asp-append-version="true"></script>
|
||||
}
|
||||
<!-- .page-inner -->
|
||||
<div class="page-inner">
|
||||
<!-- .page-title-bar -->
|
||||
<header class="page-title-bar">
|
||||
<!-- .breadcrumb -->
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active">
|
||||
<a href="#"><i class="breadcrumb-icon fa fa-angle-left mr-2"></i>KOL清單</a>
|
||||
</li>
|
||||
</ol>
|
||||
</nav><!-- /.breadcrumb -->
|
||||
<!-- title -->
|
||||
<h1 class="page-title"> KOL清單 </h1>
|
||||
<p class="text-muted"> </p><!-- /title -->
|
||||
</header><!-- /.page-title-bar -->
|
||||
<!-- .page-section -->
|
||||
<div class="page-section">
|
||||
<button type="button" id="kolNewModal" class="btn btn-primary btn-floated position-absolute" title="Add new client"><i class="fa fa-plus"></i></button>
|
||||
<!-- .card -->
|
||||
<div class="card card-fluid">
|
||||
<!-- .card-body -->
|
||||
<div class="card-body">
|
||||
<!-- .table -->
|
||||
<table id="dt-responsive" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> 名稱 </th>
|
||||
<th> 組成類型 </th>
|
||||
<th> KOL類型 </th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table><!-- /.table -->
|
||||
</div><!-- /.card-body -->
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.page-section -->
|
||||
</div><!-- /.page-inner -->
|
||||
|
||||
<!-- Keep in mind that modals should be placed outsite of page sidebar -->
|
||||
<!-- .modal -->
|
||||
<form id="clientNewForm" name="clientNewForm">
|
||||
<div class="modal fade" id="clientNewModal" tabindex="-1" role="dialog" aria-labelledby="clientNewModalLabel" data-backdrop="static"
|
||||
data-keyboard="false" aria-hidden="true">
|
||||
<!-- .modal-dialog -->
|
||||
<div class="modal-dialog" role="document">
|
||||
<!-- .modal-content -->
|
||||
<div class="modal-content">
|
||||
<!-- .modal-header -->
|
||||
<div class="modal-header">
|
||||
<h6 id="clientNewModalLabel" class="modal-title inline-editable">
|
||||
<span class="sr-only">Client name</span> <input id="modelTitle" type="text" class="form-control form-control-lg" placeholder="KOL 資料維護" required="">
|
||||
</h6>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
|
||||
</button>
|
||||
</div><!-- /.modal-header -->
|
||||
<!-- .modal-body -->
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="method" />
|
||||
<input type="hidden" id="kol_uid" />
|
||||
<!-- .form-row -->
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<div class="col-md-12" id="user_name_div">
|
||||
<div class="form-group">
|
||||
<label for="user_name">KOL頻道名稱</label> <input type="text" id="kol_name" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" id="user_id_div">
|
||||
<div class="form-group">
|
||||
<label for="tf6">KOL介紹</label>
|
||||
<textarea class="form-control" id="kol_descript" rows="5"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" id="kolMakeup_div">
|
||||
<div class="form-group">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" id="kolStyle_div">
|
||||
<div class="form-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" id="kolFansType_div">
|
||||
<div class="form-group"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<!-- .form-group -->
|
||||
|
||||
<label class="control-label" for="kol_men_ratio">男女比</label> <input type="text" value="50" id="kol_men_ratio" data-toggle="touchspin" data-min="0" data-max="100" data-step="0.1" data-decimals="1" data-boostat="5" data-maxboostedstep="10" data-postfix="%" data-verticalbuttons="true">
|
||||
<!-- /.form-group -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<!-- .form-group -->
|
||||
|
||||
<label class="control-label" for="kol_women_ratio"> </label> <input type="text" value="50" id="kol_women_ratio" data-toggle="touchspin" data-min="0" data-max="100" data-step="0.1" data-decimals="1" data-boostat="5" data-maxboostedstep="10" data-postfix="%" data-verticalbuttons="true">
|
||||
<!-- /.form-group -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group"></div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card-body">
|
||||
<!-- .media -->
|
||||
<div class="media">
|
||||
<div class="user-avatar user-avatar-xxl fileinput-button">
|
||||
<div class="fileinput-button-label"> Change photo </div><img src="~/assets/images/avatars/unknown-profile.jpg" alt=""> <input id="fileupload-avatar" type="file" name="avatar">
|
||||
</div>
|
||||
<div class="media-body pl-3">
|
||||
<h3 class="card-title"> KOL 照片 </h3>
|
||||
<p class="card-text"> 點擊頭像可更換照片. </p>
|
||||
<p class="card-text text-muted"> 最大容許檔案大小為 5MB. </p>
|
||||
</div>
|
||||
</div><!-- /.media -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!-- /.form-row -->
|
||||
</div><!-- /.modal-body -->
|
||||
<!-- .modal-footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="saveBtn" class="btn btn-primary">儲存</button> <button id="closeBtn" type="button" class="btn btn-light" data-dismiss="modal">關閉</button>
|
||||
</div><!-- /.modal-footer -->
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</form><!-- /.modal -->
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
@section Script {
|
||||
<script src="~/assets/vendor/sortablejs/Sortable.min.js"></script>
|
||||
<script src="~/assets/vendor/nestable2/jquery.nestable.min.js"></script>
|
||||
<script src="~/assets/javascript/custom/optionlist.js?v=3"></script>
|
||||
<script src="~/assets/javascript/custom/optionlist.js" asp-append-version="true"></script>
|
||||
}
|
||||
<!-- .page-inner -->
|
||||
<div class="page-inner">
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<script src="~/assets/vendor/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="~/assets/vendor/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
|
||||
<script src="~/assets/javascript/pages/dataTables.bootstrap.js"></script>
|
||||
<script src="~/assets/javascript/custom/userlist.js?v=1"></script>
|
||||
<script src="~/assets/javascript/custom/userlist.js" asp-append-version="true"></script>
|
||||
}
|
||||
|
||||
<!-- .page-inner -->
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
// add flag class to html immediately
|
||||
if (isCompact == true) document.querySelector('html').classList.add('preparing-compact-menu');
|
||||
</script><!-- END THEME STYLES -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- .app -->
|
||||
|
|
@ -93,8 +94,8 @@
|
|||
<div class="dropdown-menu">
|
||||
<div class="dropdown-arrow d-lg-none" x-arrow=""></div>
|
||||
<div class="dropdown-arrow ml-3 d-none d-lg-block"></div>
|
||||
<h6 class="dropdown-header d-none d-sm-block d-lg-none"> Beni Arisandi </h6><a class="dropdown-item" href="user-profile.html"><span class="dropdown-icon oi oi-person"></span> Profile</a> <a class="dropdown-item" href="auth-signin-v1.html"><span class="dropdown-icon oi oi-account-logout"></span> Logout</a>
|
||||
<div class="dropdown-divider"></div><a class="dropdown-item" href="#">Help Center</a> <a class="dropdown-item" href="#">Ask Forum</a> <a class="dropdown-item" href="#">Keyboard Shortcuts</a>
|
||||
<h6 class="dropdown-header d-none d-sm-block d-lg-none"> Beni Arisandi </h6>@* <a class="dropdown-item" href="user-profile.html"><span class="dropdown-icon oi oi-person"></span> Profile</a> *@ <a class="dropdown-item" href="javascript: void();" onclick="logout()"><span class="dropdown-icon oi oi-account-logout"></span> Logout</a>
|
||||
@* <div class="dropdown-divider"></div><a class="dropdown-item" href="#">Help Center</a> <a class="dropdown-item" href="#">Ask Forum</a> <a class="dropdown-item" href="#">Keyboard Shortcuts</a> *@
|
||||
</div><!-- /.dropdown-menu -->
|
||||
</div><!-- /.btn-account -->
|
||||
</div><!-- /.top-bar-item -->
|
||||
|
|
@ -129,6 +130,10 @@
|
|||
<a href="~/" class="menu-link"><span class="menu-icon fas fa-home"></span> <span class="menu-text">Dashboard</span></a>
|
||||
</li><!-- /.menu-item -->
|
||||
<!-- .menu-item -->
|
||||
<li class="menu-item">
|
||||
<a href="~/Home/KolList" class="menu-link"><span class="menu-icon oi oi-people"></span> <span class="menu-text">KOL 清單</span></a>
|
||||
</li><!-- /.menu-item -->
|
||||
<!-- .menu-item -->
|
||||
<li class="menu-item has-child" id="authMenu" style='@ViewData["authMenu"]'>
|
||||
<a href="#" class="menu-link"><span class="menu-icon oi oi-wrench"></span> <span class="menu-text">Auth</span></a> <!-- child menu -->
|
||||
<ul class="menu">
|
||||
|
|
@ -183,7 +188,7 @@
|
|||
<!-- BEGIN BASE JS -->
|
||||
<script src="~/assets/vendor/jquery/jquery.min.js"></script>
|
||||
<script src="~/assets/vendor/jquery.cookie/jquery.cookie.js"></script>
|
||||
<script src="~/assets/javascript/custom/globaljs.js"></script>
|
||||
<script src="~/assets/javascript/custom/globalJS.js" asp-append-version="true"></script>
|
||||
<script src="~/assets/vendor/popper.js/umd/popper.min.js"></script>
|
||||
<script src="~/assets/vendor/bootstrap/js/bootstrap.min.js"></script> <!-- END BASE JS -->
|
||||
<!-- BEGIN PLUGINS JS -->
|
||||
|
|
|
|||
|
|
@ -188,7 +188,29 @@ $(document).ready(function () {
|
|||
|
||||
});
|
||||
|
||||
function logout() {
|
||||
|
||||
if (confirm('確認要登出系統?')) {
|
||||
$.ajax({
|
||||
url: "/AuthApi/logout",
|
||||
type: "POST",
|
||||
data: null,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
location.href = "/Root/Login";
|
||||
//location.href = "/BackEnd/nounsList";
|
||||
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
String.prototype.isDate = function () {
|
||||
var p;
|
||||
var re1 = /(\d{4})[年./-](\d{1,2})[月./-](\d{1,2})[日]?$/;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
$(document).ready(function () {
|
||||
|
||||
loadKolMakeupCheckboxItem();
|
||||
loadKolStyleCheckboxItem();
|
||||
loadKolFansTypeCheckboxItem();
|
||||
|
||||
$('#kolNewModal').on('click', function () {
|
||||
$('#method').val('add');
|
||||
|
||||
$('#clientNewModal').modal('toggle');
|
||||
});
|
||||
});
|
||||
|
||||
function loadKolFansTypeCheckboxItem() {
|
||||
var formData = {
|
||||
option_uid: 'fansType'
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/optionItemList",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.optionItems;
|
||||
var items = "";
|
||||
$.each(obj, function (index, item) {
|
||||
items += optionItemHtml(item);
|
||||
});
|
||||
|
||||
items = "<label class=\"d-block\">粉絲輪廓</label>" + items;
|
||||
|
||||
|
||||
$('#kolFansType_div').children().first().html(items);
|
||||
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
||||
if (data.err_code == "99999") {
|
||||
location.href = "/Root/Login";
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadKolStyleCheckboxItem() {
|
||||
var formData = {
|
||||
option_uid: 'kolStyle'
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/optionItemList",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.optionItems;
|
||||
var items = "";
|
||||
$.each(obj, function (index, item) {
|
||||
items += optionItemHtml(item);
|
||||
});
|
||||
|
||||
items = "<label class=\"d-block\">KOL 類型</label>" + items;
|
||||
|
||||
|
||||
$('#kolStyle_div').children().html(items);
|
||||
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
||||
if (data.err_code == "99999") {
|
||||
location.href = "/Root/Login";
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadKolMakeupCheckboxItem() {
|
||||
var formData = {
|
||||
option_uid: 'kolMakeup'
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Api/optionItemList",
|
||||
type: "post",
|
||||
data: formData,
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data.ret == "yes") {
|
||||
var obj = data.optionItems;
|
||||
var items = "";
|
||||
$.each(obj, function (index, item) {
|
||||
items += optionItemHtml(item);
|
||||
});
|
||||
|
||||
items = "<label class=\"d-block\">成員</label>" + items;
|
||||
|
||||
|
||||
$('#kolMakeup_div').children().html(items);
|
||||
|
||||
} else {
|
||||
alert(data.message);
|
||||
|
||||
if (data.err_code == "99999") {
|
||||
location.href = "/Root/Login";
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('網路或伺服器發生錯誤,請稍後重試!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function optionItemHtml(item) {
|
||||
var html = "";
|
||||
|
||||
html += "<div class=\"custom-control custom-control-inline custom-checkbox\">";
|
||||
html += " <input type=\"checkbox\" class=\"custom-control-input\" name=\"kolMakeup[]\" value=\"" + item.optionItem_uid + "\" id=\"" + item.optionItem_uid + "\"> <label class=\"custom-control-label\" for=\"" + item.optionItem_uid + "\">" + item.optionItem_name + "</label>";
|
||||
html += "</div>";
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue