auth.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. {extend name="public/container" /}
  2. {block name="head"}
  3. <style>
  4. .section1 {
  5. height: 248px;
  6. padding-top: 78px;
  7. background: url("{__FRAME_PATH}img/auth-bg.jpg") left top/100% 248px no-repeat;
  8. text-align: center;
  9. font-weight: 500;
  10. font-size: 16px;
  11. line-height: 22px;
  12. color: #FFFFFF;
  13. }
  14. .section1 .title {
  15. margin-bottom: 27px;
  16. font-weight: 600;
  17. font-size: 30px;
  18. line-height: 42px;
  19. }
  20. .section2 {
  21. height: 288px;
  22. padding-top: 100px;
  23. background: url("{__FRAME_PATH}img/auth-icon1.png") center 20px/36px 55px no-repeat;
  24. text-align: center;
  25. }
  26. .section2 .list {
  27. display: inline-block;
  28. width: 280px;
  29. }
  30. .section2 .item {
  31. text-align: left;
  32. font-size: 16px;
  33. line-height: 30px;
  34. color: #333333;
  35. }
  36. .section2 .name {
  37. display: inline-block;
  38. width: 5em;
  39. color: #999999;
  40. }
  41. .section2 .layui-btn-container {
  42. margin-top: 30px;
  43. margin-bottom: -10px;
  44. }
  45. .section2 .layui-btn-container .layui-btn {
  46. margin-right: 30px;
  47. }
  48. .section2 .layui-btn-container .layui-btn:last-child {
  49. margin-right: 0;
  50. }
  51. .section2 .layui-btn {
  52. width: 92px;
  53. }
  54. .section3 {
  55. height: 288px;
  56. padding-top: 100px;
  57. background: url("{__FRAME_PATH}img/auth-icon2.png") center 20px/36px 43px no-repeat;
  58. }
  59. .section3 .layui-form-item:first-child {
  60. padding-right: 46px;
  61. padding-left: 49px;
  62. }
  63. .section3 .layui-form-item:last-child {
  64. margin-top: 82px;
  65. text-align: center;
  66. }
  67. .section3 .layui-btn {
  68. width: 92px;
  69. }
  70. </style>
  71. {/block}
  72. {block name="content"}
  73. <div v-cloak id="app" class="layui-fluid">
  74. <div class="layui-row layui-col-space15">
  75. <div class="layui-col-md12">
  76. <div class="section1">
  77. <div class="title">商业使用授权证书,保护您的合法权益</div>
  78. <div>您的支持是我们不断进步的动力,商业授权更多是一个保障和附加的增值服务,让您优先享受新版本的强大功能和安全保障</div>
  79. </div>
  80. </div>
  81. <div class="layui-col-md6">
  82. <div class="layui-card">
  83. <div class="layui-card-body">
  84. <div class="section2">
  85. <ul class="list">
  86. <li class="item"><span class="name">授权状态:</span>{{ msg || '——' }}</li>
  87. <li class="item"><span class="name">授权期限:</span>{{ authCode ? '永久' : (day + '天') }}</li>
  88. <li class="item"><span class="name">授权码:</span>{{ authCode || '——' }}</li>
  89. </ul>
  90. <div class="layui-btn-container">
  91. <a href="http://www.crmeb.com/web/auth/query.html" target="_blank" rel="noopener noreferrer" class="layui-btn layui-btn-normal layui-btn-sm">查询授权</a>
  92. <button v-if="!authCode" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="goAuth">获取授权</button>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div v-if="hasCopyright" class="layui-col-md6">
  99. <div class="layui-card">
  100. <div class="layui-card-body">
  101. <div class="section3">
  102. <form class="layui-form" action="">
  103. <div class="layui-form-item">
  104. <label class="layui-form-label">修改授权信息:</label>
  105. <div class="layui-input-block">
  106. <input v-model.trim="copyrightContent" type="text" name="copyrightContent" required lay-verify="required" autocomplete="off" class="layui-input">
  107. </div>
  108. </div>
  109. <div class="layui-form-item">
  110. <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="save_copyright">保存</button>
  111. </div>
  112. </form>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div v-else-if="copyrightLoaded" class="layui-col-md6">
  118. <div class="layui-card">
  119. <div class="layui-card-body">
  120. <div class="section2">
  121. <ul class="list">
  122. <li class="item"><span class="name">服务类型:</span>去版权服务</li>
  123. <li class="item"><span class="name">版权信息:</span>购买之后可以设置</li>
  124. </ul>
  125. <div class="layui-btn-container">
  126. <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="goBuy">去版权</button>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. {/block}
  135. {block name="script"}
  136. <script>
  137. window.addEventListener('message', function (e) {
  138. if (e.data.event === 'onCancel') {
  139. layui.layer.closeAll();
  140. layui.layer.load(1);
  141. $.getJSON("{:url('get_auth_data')}", function () {
  142. window.location.reload();
  143. });
  144. }
  145. });
  146. require(['vue'], function (Vue) {
  147. var shopZsffUrl = 'https://shop.crmeb.net/html/index.html?product=zsff&label=4&venrsion={$curent_version.version}&url=' + window.location.hostname;
  148. var shopCopyrightUrl = 'https://shop.crmeb.net/html/index.html?product=copyright&label=4&venrsion={$curent_version.version}&url=' + window.location.hostname;
  149. window.vm = new Vue({
  150. el: "#app",
  151. data: {
  152. msg: '',
  153. day: 0,
  154. authCode: '',
  155. hasCopyright: false,
  156. product: {
  157. price: 0
  158. },
  159. copyrightContent: '',
  160. copyrightLoaded: false
  161. },
  162. created: function () {
  163. this.check_auth_data();
  164. },
  165. methods: {
  166. check_auth_data: function () {
  167. var self = this;
  168. layui.layer.load(1);
  169. $.when($.getJSON("{:url('check_auth')}"), $.getJSON("{:url('auth_data')}")).done(function (res1, res2) {
  170. layui.layer.closeAll();
  171. self.copyrightLoaded = true;
  172. if (res2[0].code === 200) {
  173. self.msg = res2[0].data.msg;
  174. self.day = res2[0].data.day;
  175. self.authCode = res2[0].data.authCode;
  176. self.hasCopyright = res2[0].data.copyright;
  177. if (self.hasCopyright) {
  178. self.get_copyright();
  179. } else {
  180. self.get_zsff_store();
  181. }
  182. }
  183. });
  184. },
  185. get_zsff_store:function () {
  186. var self = this;
  187. $.getJSON("{:url('get_zsff_copyright')}", function (res) {
  188. if (res.code === 200) {
  189. if (res.data) {
  190. self.product = res.data.data.product;
  191. }
  192. } else {
  193. layui.layer.msg(res.msg, {icon: 5});
  194. }
  195. });
  196. },
  197. // 获取授权
  198. goAuth: function () {
  199. layui.layer.open({
  200. type: 2,
  201. title: ' ',
  202. area: ['800px', '600px'],
  203. content: shopZsffUrl
  204. });
  205. },
  206. // 立即购买
  207. goBuy: function () {
  208. if (!this.authCode) {
  209. return layui.layer.msg('请先去申请授权', {icon: 5});;
  210. }
  211. layui.layer.open({
  212. type: 2,
  213. title: ' ',
  214. area: ['800px', '600px'],
  215. content: shopCopyrightUrl
  216. });
  217. },
  218. // 保存版权信息
  219. save_copyright: function () {
  220. var self = this;
  221. if (!this.copyrightContent) {
  222. return layui.layer.msg('请输入版权信息', {icon: 5});
  223. }
  224. layui.layer.load(1);
  225. $.post("{:url('save_copyright')}", {
  226. copyrightContent: self.copyrightContent
  227. }, function (res) {
  228. layui.layer.closeAll();
  229. if (res.code === 200) {
  230. layui.layer.msg('保存成功', {icon: 1});
  231. } else {
  232. layui.layer.msg(res.msg, {icon: 5});
  233. }
  234. }, 'json');
  235. },
  236. // 获取版权信息
  237. get_copyright: function () {
  238. var self = this;
  239. layui.layer.load(1);
  240. $.getJSON("{:url('login/get_copyright')}", function (res) {
  241. layui.layer.closeAll();
  242. if (res.code === 200) {
  243. if (typeof res.data === 'string') {
  244. self.copyrightContent = res.data;
  245. }
  246. } else {
  247. layui.layer.msg(res.msg, {icon: 5});
  248. }
  249. });
  250. }
  251. }
  252. });
  253. });
  254. </script>
  255. {/block}