application.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. @extends('layouts.base')
  2. @section('content')
  3. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  4. <style>
  5. .main-panel{
  6. margin-top:50px;
  7. }
  8. .main-panel #re_content {
  9. padding: 10px;
  10. }
  11. .panel{
  12. margin-bottom:10px!important;
  13. padding-left: 20px;
  14. border-radius: 10px;
  15. }
  16. .panel .active a {
  17. background-color: #29ba9c!important;
  18. border-radius: 18px!important;
  19. color:#fff;
  20. }
  21. .panel a{
  22. border:none!important;
  23. background-color:#fff!important;
  24. }
  25. .content{
  26. background: #eff3f6;
  27. padding: 10px!important;
  28. }
  29. .con{
  30. padding-bottom:20px;
  31. position:relative;
  32. min-height:100vh;
  33. background-color:#fff;
  34. }
  35. </style>
  36. <div id='re_content' >
  37. @include('layouts.newTabs')
  38. <div class="con">
  39. <div v-if="set_show" class="setting">
  40. <el-form ref="form_data" :model="form_data" label-width="15%">
  41. <!-- 自定义名称 -->
  42. <div class="vue-head">
  43. <div class="vue-main-title">
  44. <div class="vue-main-title-left"></div>
  45. <div class="vue-main-title-content">基础设置</div>
  46. </div>
  47. <el-form-item label="接口地址:">
  48. <div style="min-height: 40px">
  49. <span>{{ request()->getSchemeAndHttpHost().'/outside/'.\YunShop::app()->uniacid.'/' }}</span>
  50. </div>
  51. </el-form-item>
  52. <div class="vue-main-form">
  53. <el-form-item label="是否开启:">
  54. <el-switch
  55. v-model="form_data.is_open"
  56. :active-value="1"
  57. :inactive-value="0"
  58. active-color="#29BA9C"
  59. inactive-color="#ccc">
  60. </el-switch>
  61. </el-form-item>
  62. <el-form-item label="签名校验:">
  63. <el-switch
  64. v-model="form_data.sign_required"
  65. :active-value="0"
  66. :inactive-value="1"
  67. active-color="#29BA9C"
  68. inactive-color="#ccc">
  69. </el-switch>
  70. </el-form-item>
  71. <el-form-item label="应用APPID:">
  72. <div>[[form_data.app_id]]</div>
  73. </el-form-item>
  74. <el-form-item label="APP_Secret:">
  75. <div style="min-height: 40px">
  76. <span v-if="secret_show">[[form_data.app_secret]]</span>
  77. <el-button size="mini" type="info" round @click="isShow()">[[button_name]]</el-button>
  78. </div>
  79. <div style="">
  80. <el-button size="mini" type="danger" round @click="updateSecret()">更新</el-button>
  81. </div>
  82. </el-form-item>
  83. </div>
  84. </div>
  85. {{--<div style="background: #eff3f6;width:100%;height:15px;"></div>--}}
  86. {{--<div class="vue-head">--}}
  87. {{--<div class="vue-main-title">--}}
  88. {{--<div class="vue-main-title-left"></div>--}}
  89. {{--<div class="vue-main-title-content"></div>--}}
  90. {{--</div>--}}
  91. {{--<div class="vue-main-form">--}}
  92. {{--</div>--}}
  93. {{--</div>--}}
  94. </el-form>
  95. <div class="vue-page">
  96. <div class="vue-center">
  97. <el-button type="primary" @click="submitForm">提交</el-button>
  98. </div>
  99. </div>
  100. </div>
  101. <div v-if="!set_show">
  102. <div class="panel panel-default">
  103. <div class="panel-body">
  104. <div style="text-align:center">
  105. <h3>设置对应APP应用</h3>
  106. </div>
  107. <div style="text-align:center">
  108. <el-button type="primary" @click="openApp()">开启对外应用</el-button>
  109. </div>
  110. <div style="margin-top: 20px; text-align:center">
  111. 注意: <span style="color: red">保存好密钥和应用ID,APPID是唯一无法更改的</span>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <script>
  119. var vm = new Vue({
  120. el: "#re_content",
  121. delimiters: ['[[', ']]'],
  122. data() {
  123. return {
  124. form_data:{
  125. is_open:0,
  126. sign_required:0,
  127. },
  128. set_show:false,
  129. secret_show:false,
  130. button_name: '显示',
  131. }
  132. },
  133. mounted () {
  134. let result = this.viewReturn();
  135. this.__initial(result);
  136. },
  137. methods: {
  138. //视图返回数据
  139. viewReturn() {
  140. return {!! $data?:'{}' !!};
  141. },
  142. //初始化页面数据,请求链接
  143. __initial(data) {
  144. if(data.set && JSON.stringify(data.set) !== '[]') {
  145. this.form_data = data.set;
  146. this.set_show = true;
  147. }
  148. },
  149. isShow() {
  150. this.secret_show = this.secret_show == true ? false: true;
  151. this.button_name = this.button_name == '显示' ? '隐藏': '显示';
  152. },
  153. openApp() {
  154. this.$confirm('确认开启对外应用吗?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  155. this.$http.post('{!! yzWebFullUrl('setting.outside-app.create-app') !!}').then(function (response) {
  156. if (response.data.result) {
  157. this.$message({type: 'success',message: '创建成功'});
  158. location.reload();
  159. } else{
  160. this.$message({type: 'error',message: response.data.msg});
  161. }
  162. },function (response) {
  163. this.$message({type: 'error',message: response.data.msg});
  164. }
  165. );
  166. }).catch(() => {
  167. this.$message({type: 'info',message: '已取消开启'});
  168. });
  169. },
  170. switchOperation(operation) {
  171. let json = {
  172. operation:operation,
  173. value:this.form_data[operation],
  174. };
  175. console.log(json);
  176. this.$http.post('{!! yzWebFullUrl('setting.outside-app.store') !!}',{data:json}).then(function (response) {
  177. if (response.data.result) {
  178. // this.$message({type: 'success',message: '操作成功'});
  179. } else{
  180. this.$message({type: 'error',message: response.data.msg});
  181. }
  182. },function (response) {
  183. this.$message({type: 'error',message: response.data.msg});
  184. }
  185. );
  186. },
  187. updateSecret() {
  188. this.$confirm('确认更新密钥吗?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  189. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  190. this.$http.post('{!! yzWebFullUrl('setting.outside-app.update-secret') !!}',{operation:'app_secret'}).then(function (response) {
  191. if (response.data.result) {
  192. this.$message({type: 'success',message: '操作成功'});
  193. location.reload();
  194. } else{
  195. this.$message({type: 'error',message: response.data.msg});
  196. }
  197. loading.close();
  198. },function (response) {
  199. this.$message({type: 'error',message: response.data.msg});
  200. loading.close();
  201. }
  202. );
  203. }).catch(() => {
  204. this.$message({type: 'info',message: '已取消操作'});
  205. });
  206. },
  207. submitForm() {
  208. let json = {
  209. is_open:this.form_data.is_open,
  210. sign_required:this.form_data.sign_required,
  211. };
  212. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  213. this.$http.post('{!! yzWebFullUrl('setting.outside-app.store') !!}',{data:json}).then(function (response){
  214. if (response.data.result) {
  215. this.$message({message: response.data.msg,type: 'success'});
  216. }else {
  217. this.$message({message: response.data.msg,type: 'error'});
  218. }
  219. loading.close();
  220. location.reload();
  221. },function (response) {
  222. this.$message({message: response.data.msg,type: 'error'});
  223. loading.close();
  224. })
  225. },
  226. },
  227. });
  228. </script>
  229. @endsection