Donate_Admin.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. @using Masuit.MyBlogs.Core.Common
  2. @model List<Masuit.MyBlogs.Core.Models.Entity.Donate>
  3. @{
  4. ViewBag.Title = "网站打赏";
  5. Layout = "~/Views/Shared/_Layout.cshtml";
  6. Random r = new Random();
  7. }
  8. <style>
  9. .bg-title {
  10. height: 50vh;
  11. max-height: 400px;
  12. position: relative;
  13. background: url(/Content/images/@(r.Next(1, 9)).jpg) no-repeat center;
  14. background-size: cover;
  15. background-attachment: fixed;
  16. }
  17. .flex-box {
  18. display: flex;
  19. flex-wrap: wrap;
  20. justify-content: center;
  21. width: 100%;
  22. height: 100%;
  23. }
  24. .flex-box>div{
  25. margin: 0 15px;
  26. width: 18%;
  27. }
  28. @@media only screen and (max-width: 1080px) {
  29. .flex-box>div{
  30. width: 29.8%;
  31. }
  32. }
  33. </style>
  34. <link href="~/Assets/jedate/jedate.min.css" rel="stylesheet" />
  35. <script src="https://cdn.staticfile.org/lodash.js/3.10.1/lodash.min.js"></script>
  36. <script src="https://cdn.staticfile.org/angular.js/1.7.7/angular.min.js"></script>
  37. <script src="~/Scripts/tm.pagination.js"></script>
  38. <script src="~/Scripts/ng-table.min.js"></script>
  39. <script src="~/Assets/jedate/jquery.jedate.min.js"></script>
  40. <ol class="cd-breadcrumb triangle">
  41. <li><a asp-controller="Home" asp-action="Index">首页</a></li>
  42. <li class="current">
  43. <em>@ViewBag.Title</em>
  44. </li>
  45. </ol>
  46. <div class="bg-title">
  47. <div class="header-content text-center">
  48. <h1 class="size48">
  49. 喜欢我的作品和文章?
  50. </h1>
  51. <div class="divider"></div>
  52. <p class="size24">
  53. 您的捐助就是给我最大的鼓励
  54. </p>
  55. </div>
  56. </div>
  57. <div class="container-fluid">
  58. <div class="flex-box">
  59. <div>
  60. <div class="page-header margin-clear margin-top10">
  61. <h2 class="size28">
  62. 支付宝二维码
  63. </h2>
  64. </div>
  65. <img class="img-responsive img-thumbnail" style="width: 100%" src="@CommonHelper.SystemSettings["Donate"]" />
  66. </div>
  67. <div>
  68. <div class="page-header margin-clear margin-top10">
  69. <h2 class="size28">
  70. 微信二维码
  71. </h2>
  72. </div>
  73. <img class="img-responsive img-thumbnail" style="width: 100%" src="@CommonHelper.SystemSettings["DonateWechat"]" />
  74. </div>
  75. <div>
  76. <div class="page-header margin-clear margin-top10">
  77. <h2 class="size28">
  78. QQ二维码
  79. </h2>
  80. </div>
  81. <img class="img-responsive img-thumbnail" style="width: 100%" src="@CommonHelper.SystemSettings["DonateQQ"]" />
  82. </div>
  83. </div>
  84. </div>
  85. <div class="container margintop20">
  86. <div class="text-green size20" style="line-height: 26px;">
  87. <p>
  88. 本网站由博主一个人打造,开发和运营均为博主本人,如果您是真心喜欢本博客,您可以对博主表示一下感谢,以支持后期发布更多好资源,5毛也好、1元也罢,都是你们的心意。网站运营也需要成本,有你的援助,一切会更好。
  89. </p>
  90. <p class="text-red size20">
  91. 打赏时最好能够附上你的完整信息,包括:您的昵称或真名、邮箱地址、QQ或微信、金额等;因为不能保证能够完全的清楚打赏者的基本信息,如果你完成了打赏,推荐你在网站留言板备注一下,或者QQ私信告知你是谁。
  92. </p>
  93. <p>
  94. 您可以尽您所能地打赏,如果您临时改变主意,您可以在事后一个月之内联系作者申请退款!
  95. </p>
  96. <p>
  97. 本站的宗旨是:互联网分享精神,乐于发现,勤于分享;
  98. </p>
  99. <p>
  100. 我希望的:您将我的网站告诉你的朋友,让更多的人来这里学习,共同进步。
  101. </p>
  102. </div>
  103. </div>
  104. <div class="container-fluid" ng-app="myApp" ng-controller="home as list">
  105. <div class="page-header margin-clear">
  106. <h2 class="size24" style="display: inline">
  107. 打赏名单(排名不分先后):
  108. </h2>
  109. <button class="btn btn-info pull-right" ng-click="save()">添加打赏</button>
  110. </div>
  111. <table ng-table="list.tableParams" class="table table-bordered table-hover table-condensed margin-clear" ng-form="list.tableForm" disable-filter="list.isAdding" tracked-table="list.tableTracker">
  112. <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
  113. <td title="'打赏时间'">
  114. {{row.DonateTime|date:'yyyy-MM-dd'}}
  115. </td>
  116. <td title="'昵称'">
  117. {{row.NickName}}
  118. </td>
  119. <td title="'金额'">
  120. {{row.Amount}}
  121. </td>
  122. <td title="'打赏方式'">
  123. {{row.Via}}
  124. </td>
  125. <td title="'Email'">
  126. {{row.Email}}
  127. </td>
  128. <td title="'QQ或微信'">
  129. {{row.QQorWechat}}
  130. </td>
  131. <td title="'显示邮箱'">
  132. {{row.EmailDisplay}}
  133. </td>
  134. <td title="'显示QQ或微信'">
  135. {{row.QQorWechatDisplay}}
  136. </td>
  137. <td title="'操作'">
  138. <button class="btn btn-default btn-sm" ng-click="save(row)">编辑</button>
  139. <button class="btn btn-danger btn-sm" ng-click="list.del(row)">删除</button>
  140. </td>
  141. </tr>
  142. </table>
  143. <tm-pagination conf="paginationConf"></tm-pagination>
  144. </div>
  145. <script>
  146. var app = angular.module('myApp', ["ngTable", "tm.pagination"]);
  147. app.config(["$httpProvider", function ($httpProvider) {
  148. $httpProvider.defaults.transformRequest = function (obj) {
  149. var str = [];
  150. for (var p in obj) {
  151. if (obj.hasOwnProperty(p)) {
  152. str.push(window.encodeURIComponent(p) + "=" + window.encodeURIComponent(obj[p]));
  153. }
  154. }
  155. return str.join("&");
  156. };
  157. $httpProvider.defaults.headers.post = {
  158. 'Content-Type': 'application/x-www-form-urlencoded; charser=UTF-8'
  159. }
  160. }]);
  161. app.controller("home", ["$scope", "$http", "NgTableParams", function ($scope, $http, NgTableParams) {
  162. var self = this;
  163. $scope.paginationConf = {
  164. currentPage: 1,
  165. itemsPerPage: 10,
  166. pagesLength: 15,
  167. perPageOptions: [10, 15, 20, 30, 50, 100],
  168. rememberPerPage: 'perPageItems',
  169. onChange: function () {
  170. window.loading();
  171. $http.post("/donate/getpagedata", {
  172. page: $scope.paginationConf.currentPage,
  173. size: $scope.paginationConf.itemsPerPage
  174. }).then(function (res) {
  175. $scope.paginationConf.totalItems = res.data.TotalCount;
  176. $("div[ng-table-pagination]").remove();
  177. self.tableParams = new NgTableParams({
  178. count: 50000
  179. }, {
  180. filterDelay: 0,
  181. dataset: res.data.Data
  182. });
  183. window.loadingDone();
  184. });
  185. }
  186. };
  187. self.del = function (row) {
  188. swal({
  189. title: "确认删除这条打赏记录吗?",
  190. text: row.NickName,
  191. showCancelButton: true,
  192. confirmButtonColor: "#DD6B55",
  193. confirmButtonText: "确定",
  194. cancelButtonText: "取消",
  195. showLoaderOnConfirm: true,
  196. animation: true,
  197. allowOutsideClick: false
  198. }).then(function () {
  199. $http.post("/donate/delete", {
  200. id: row.Id
  201. }).then(function (res) {
  202. window.notie.alert({
  203. type: 1,
  204. text: res.data.Message,
  205. time: 4
  206. });
  207. _.remove(self.tableParams.settings().dataset, function (item) {
  208. return row === item;
  209. });
  210. self.tableParams.reload().then(function (data) {
  211. if (data.length === 0 && self.tableParams.total() > 0) {
  212. self.tableParams.page(self.tableParams.page() - 1);
  213. self.tableParams.reload();
  214. }
  215. });
  216. });
  217. }, function () {
  218. });
  219. }
  220. $scope.save = function (row) {
  221. if (row == null) {
  222. row = {
  223. NickName: "",
  224. DonateTime: "",
  225. Amount: "",
  226. Email: "",
  227. EmailDisplay: "",
  228. QQorWechat: "",
  229. QQorWechatDisplay: "",
  230. Via: ""
  231. };
  232. }
  233. swal({
  234. title: '添加打赏记录',
  235. html:
  236. '<div class="input-group"><span class="input-group-addon">昵称: </span><input type="text" id="name" class="form-control input-lg" placeholder="请输入昵称" value="' + row.NickName + '"></div>' +
  237. '<div class="input-group"><span class="input-group-addon">打赏时间: </span><input id="date" type="text" class="form-control input-lg date datainp dateicon" readonly placeholder="请输入打赏时间" value="' + row.DonateTime + '"></div> ' +
  238. '<div class="input-group"><span class="input-group-addon">打赏金额: </span><input id="amount" type="text" class="form-control input-lg" placeholder="请输入金额" value="' + row.Amount + '"></div>' +
  239. '<div class="input-group"><span class="input-group-addon">打赏方式: </span><input id="via" type="text" class="form-control input-lg" placeholder="请输入打赏方式" value="' + row.Via + '"></div>' +
  240. '<div class="input-group"><span class="input-group-addon">Email: </span><input type="email" id="email" class="form-control input-lg" placeholder="请输入Email" value="' + row.Email + '"></div>' +
  241. '<div class="input-group"><span class="input-group-addon">QQ或微信: </span><input type="text" id="qq" class="form-control input-lg" placeholder="请输入QQ或微信" value="' + row.QQorWechat + '"></div>' +
  242. '<div class="input-group"><span class="input-group-addon">显示Email: </span><input type="text" id="demail" class="form-control input-lg" placeholder="请输入显示Email" value="' + row.EmailDisplay + '"></div>' +
  243. '<div class="input-group"><span class="input-group-addon">显示QQ或微信: </span><input type="text" id="dqq" class="form-control input-lg" placeholder="请输入显示QQ或微信" value="' + row.QQorWechatDisplay + '"></div>',
  244. showCloseButton: true,
  245. confirmButtonColor: "#DD6B55",
  246. confirmButtonText: "确定",
  247. cancelButtonText: "取消",
  248. showLoaderOnConfirm: true,
  249. animation: true,
  250. allowOutsideClick: false,
  251. preConfirm: function () {
  252. return new Promise(function (resolve, reject) {
  253. row.NickName = $("#name").val();
  254. row.DonateTime = $("#date").val();
  255. row.Amount = $("#amount").val();
  256. row.Via = $("#via").val();
  257. row.Email = $("#email").val();
  258. row.QQorWechat = $("#qq").val();
  259. row.EmailDisplay = $("#demail").val();
  260. row.QQorWechatDisplay = $("#dqq").val();
  261. $http.post("/donate/save", row).then(function (res) {
  262. if (res.data.Success) {
  263. resolve(res.data);
  264. } else {
  265. reject(res.data.Message);
  266. }
  267. }, function (error) {
  268. reject("服务请求失败!");
  269. });
  270. });
  271. }
  272. }).then(function (result) {
  273. if (result) {
  274. if (result.Success) {
  275. swal(result.Message, "", "success");
  276. self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
  277. } else {
  278. swal(result.Message, "", "error");
  279. }
  280. }
  281. }).catch(swal.noop);
  282. $(".date").jeDate({
  283. isinitVal: true,
  284. format: "YYYY-MM-DD",
  285. okfun: function (elem) {
  286. $("#date").val(elem.val);
  287. }
  288. });
  289. }
  290. }]);
  291. </script>