index.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <style>
  4. .code{
  5. color: #298dff;
  6. font-size: 1.4em;
  7. border: 1px solid #298dff;
  8. padding: 20px 10px;
  9. width: 30%;
  10. margin: 0 auto;
  11. visibility: visible;
  12. animation-duration: 1000ms;
  13. animation-delay: 500ms;
  14. text-align: center;
  15. cursor: pointer;
  16. border-radius: .3em;
  17. }
  18. .colore{
  19. background-color: #CCCCCC;
  20. }
  21. .code:hover{
  22. background-color:rgba(0,0,0,0.1);
  23. }
  24. </style>
  25. <div class="row">
  26. <div class="col-sm-12" id="upgrade">
  27. <div class="wrapper wrapper-content animated fadeInUp">
  28. <div class="ibox">
  29. <div class="ibox-content">
  30. <div class="row">
  31. <div class="col-sm-12">
  32. <div class="m-b-md">
  33. <h2>在线升级 <span style="font-size: 12px;color: red">当前版本为:{{version}}</span></h2>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="row">
  38. <?php if(isset($auth['code']) && $auth['code']==200 && isset($auth['data'])){if($auth['data']==1){?>
  39. <div class="col-sm-12">
  40. <h4 class="code" @click="auto_upgrad()" v-text="content">正在加载中</h4>
  41. </div>
  42. <?php }else{?>
  43. <div class="col-sm-12">
  44. <h4 class="code colore">您没有权限升级</h4>
  45. </div>
  46. <?php }}else{?>
  47. <div class="col-sm-12">
  48. <h4 class="code colore"><?php echo isset($auth['msg'])?$auth['msg']:'服务器异常';?></h4>
  49. </div>
  50. <?php }?>
  51. </div>
  52. <div class="row m-t-sm">
  53. <div class="col-sm-12">
  54. <div class="panel blank-panel">
  55. <div class="panel-heading">
  56. <div class="panel-options">
  57. <ul class="nav nav-tabs">
  58. <li><a href="javascript:;">更新详情</a></li>
  59. </ul>
  60. </div>
  61. </div>
  62. <div class="panel-body">
  63. <div class="tab-content">
  64. <div class="tab-pane active" id="tab-1">
  65. <div class="feed-activity-list">
  66. <div class="feed-element">
  67. <div class="media-body">
  68. <div class="col-sm-2">版本号</div>
  69. <div class="col-sm-8">更新内容</div>
  70. <div class="col-sm-2">更新时间</div>
  71. </div>
  72. <div v-for="item in list" v-cloak="">
  73. <hr>
  74. <div class="media-body">
  75. <div class="col-sm-2">{{item.version}}</div>
  76. <div class="col-sm-8">{{item.content}}</div>
  77. <div class="col-sm-2">{{item.add_time}}</div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="media-body" style="margin-top: 20px">
  82. <div class="col-sm-12 text-center" style="font-size: 15px;cursor:pointer;color: #FOF8FF">
  83. <div>
  84. <span v-show="load==true" @click="getlist()">点击加载</span>
  85. <div class="sk-spinner sk-spinner-circle" v-show="loading==true">
  86. <div class="sk-circle1 sk-circle"></div><div class="sk-circle2 sk-circle"></div><div class="sk-circle3 sk-circle"></div><div class="sk-circle4 sk-circle"></div><div class="sk-circle5 sk-circle"></div><div class="sk-circle6 sk-circle"></div><div class="sk-circle7 sk-circle"></div><div class="sk-circle8 sk-circle"></div><div class="sk-circle9 sk-circle"></div><div class="sk-circle10 sk-circle"></div><div class="sk-circle11 sk-circle"></div><div class="sk-circle12 sk-circle"></div>
  87. </div>
  88. <span v-show="load==false && loading==false">没有更多了</span>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <script>
  105. require(['vue','axios','layer'],function(Vue,axios,layer){
  106. var version_code=<?php echo (int)$version_code;?>,
  107. version="<?php echo $version;?>";
  108. new Vue({
  109. el:"#upgrade",
  110. data:{
  111. list:[],
  112. page:1,
  113. limit:20,
  114. version:version,
  115. version_code:version_code,
  116. loading:false,
  117. load:false,
  118. content:'正在加载中',
  119. count:0
  120. },
  121. watch:{
  122. count:function (n) {
  123. console.log(n);
  124. if(n<=0){
  125. this.content='已是最新版本';
  126. }else{
  127. this.content='还有'+this.count+'个版本未升级 点击升级';
  128. }
  129. }
  130. },
  131. methods:{
  132. getList:function () {
  133. var that=this;
  134. that.loading=true;
  135. axios.post("{:Url('get_list')}",{page:this.page,limit:this.limit}).then(function (rem) {
  136. var len=rem.data.data.list.length;
  137. if(rem.data.code==200){
  138. that.list=rem.data.data.list;
  139. }
  140. that.page=rem.data.data.page;
  141. that.loading=false;
  142. if(len<that.limit){
  143. that.load=false;
  144. }else{
  145. that.load=true;
  146. }
  147. });
  148. },
  149. auto_upgrad:function () {
  150. var that=this;
  151. if(this.count<=0) return;
  152. axios.post("{:Url('auto_upgrad')}",{id:this.version_code}).then(function (rem) {
  153. if(rem.data.code=200){
  154. that.version_code=rem.data.data.code;
  155. that.version=rem.data.data.version;
  156. that.count=0;
  157. }
  158. })
  159. },
  160. get_new_version_conte:function (){
  161. var that=this;
  162. axios.post("{:Url('get_new_version_conte')}",{id:this.version_code}).then(function (rem) {
  163. if(rem.data.code=200){
  164. that.count=rem.data.data.count;
  165. if(that.count==0) that.content='已是最新版本';
  166. }
  167. })
  168. }
  169. },
  170. mounted:function () {
  171. this.getList()
  172. this.get_new_version_conte()
  173. }
  174. })
  175. })
  176. </script>
  177. {/block}