add.blade.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. @extends('layouts.base')
  2. @section('title', '创建链接')
  3. @section('content')
  4. <style>
  5. .rightlist #app .el-breadcrumb{padding:30px 0;font-size:16px;}
  6. .rightlist #app{margin-left:30px;}
  7. .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
  8. .el-form-item__label{padding-right:30px;}
  9. .el-button{margin-right:30px;}
  10. .attribute-label{display:inline-block;padding:20px 20px 20px 7%;}
  11. /* .el-textarea__inner{height:400px;margin:30px 5%;width:80%;} */
  12. /* 上传图片 */
  13. .avatar-uploader .el-upload {margin-top:15px;border: 1px dashed #d9d9d9;border-radius: 6px;cursor: pointer;position: relative;overflow: hidden;}
  14. .avatar-uploader .el-upload:hover {border-color: #409EFF;}
  15. .avatar-uploader-icon {font-size: 28px;color: #8c939d;width: 178px;height: 178px;line-height: 178px;text-align: center;}
  16. .avatar {width: 178px;height: 178px;display: block;}
  17. .el-upload-tip{width:178px;margin:0;padding:0;color:#999;text-align:center;}
  18. input[type=file] {display: none;}
  19. .avatar-uploader-box{position:relative;width:200px;}
  20. .el-icon-circle-close{position:absolute;top:10px;right:0;color:#999;}
  21. /* 滑块选择小白点 */
  22. .el-switch.is-checked .el-switch__core::after {left: 100%;margin-left: -17px;}
  23. .el-switch__core::after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;transition: all .3s;width: 16px;height: 16px;background-color: #fff;}
  24. .tip{color:#999;font-size:12px;}
  25. .add-tip{font-size:14px;font-weight:600;}
  26. .add-tip span{margin:0 15px;cursor:pointer;color:#409EFF}
  27. .upload-box:hover {
  28. border-color: #29ba9c;
  29. color: #29ba9c;
  30. }
  31. .upload-box {
  32. width: 150px;
  33. height: 150px;
  34. display: flex;
  35. cursor: pointer;
  36. border: 1px dashed #dde2ee;
  37. justify-content: center;
  38. align-items: center;
  39. border-radius: 5px;
  40. flex-direction: column;
  41. }
  42. .upload-boxed {
  43. width: 150px;
  44. height: 150px;
  45. position: relative;
  46. border-radius: 5px;
  47. }
  48. .upload-boxed-text {
  49. position: absolute;
  50. bottom: 0;
  51. line-height: 32px;
  52. color: #fff;
  53. text-align: center;
  54. width: 100%;
  55. background: #000;
  56. opacity: 0.7;
  57. border-radius: 0px 0px 5px 5px;
  58. }
  59. .upload-boxed-list {
  60. display: flex;
  61. position: relative;
  62. border-radius: 5px;
  63. flex-wrap: wrap;
  64. }
  65. .upload-boxed-list-a {
  66. width:150px;
  67. height:150px;
  68. margin:0 10px 5px 0;
  69. position: relative;
  70. }
  71. .upload-boxed-list-a .el-icon-close {
  72. position: absolute;
  73. top: -5px;
  74. right: -5px;
  75. color: #fff;
  76. background: #333;
  77. border-radius: 50%;
  78. cursor: pointer;
  79. }
  80. </style>
  81. <div id="app-add">
  82. <template>
  83. <el-form ref="form" :model="form" v-loading="loading" label-width="15%">
  84. <el-tabs type="card" v-model="activeName" style="padding: 20px">
  85. <el-tab-pane label="基础设置" name="base_set">@include('Yunshop\LinkTool::link.base-set')</el-tab-pane>
  86. </el-tabs>
  87. <el-form-item>
  88. <a href="#">
  89. <el-button type="success" @click="submitForm('form')">提交</el-button>
  90. </a>
  91. <a href="#">
  92. <el-button @click="goBack()">返回列表</el-button>
  93. </a>
  94. </el-form-item>
  95. </el-form>
  96. </template>
  97. </div>
  98. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  99. <script src="{{resource_get('static/yunshop/tinymceTemplate.js')}}"></script>
  100. <script>
  101. var app = new Vue({
  102. el: '#app-add',
  103. delimiters: ['[[', ']]'],
  104. data() {
  105. let set = {!! $set ?: '{}' !!};
  106. let id = {!! $id ?: '{}' !!};
  107. console.log(set);
  108. if(set.countdown_time) {
  109. set.countdown_time[0] = set.countdown_time[0]*1000;
  110. set.countdown_time[1] = set.countdown_time[1]*1000;
  111. }
  112. console.log(set.countdown_time);
  113. return {
  114. cuttentTime:'',
  115. content:'',
  116. ImgList: [],
  117. activeName2: "first",
  118. radio1: "不限", //年
  119. radio2: "不限", //月
  120. loading : false,
  121. pageSize: 0,
  122. current_page: 0,
  123. total: 0,
  124. submit_loading:"",
  125. form : {
  126. 'app_id':'',
  127. 'path' : '',
  128. 'params' : '',
  129. 'remark' : '',
  130. 'validity' : 0,
  131. 'countdown_time' : [new Date().getTime(), new Date().getTime() + 7 * 24 * 3600 * 1000],
  132. ...set
  133. },
  134. id : id,
  135. activeName : 'base_set',
  136. pickerOptions: {
  137. onPick: ({ maxDate, minDate }) => {
  138. this.cuttentTime = minDate.getTime()
  139. if (maxDate) {
  140. this.cuttentTime = ''
  141. }
  142. },
  143. disabledDate: (time) => {
  144. if (this.cuttentTime !== '') {
  145. const one = 30 * 24 * 3600 * 1000
  146. const minTime = this.cuttentTime - one
  147. const maxTime = this.cuttentTime + one
  148. return time.getTime() < minTime || time.getTime() > maxTime;
  149. }
  150. }
  151. }
  152. }
  153. },
  154. mounted: function () {
  155. window.addEventListener('beforeunload', e => {
  156. window.onbeforeunload =null
  157. });
  158. },
  159. created(){
  160. // this.currentChange(1);
  161. },
  162. methods:{
  163. goBack() {
  164. history.back(-1);
  165. },
  166. submitForm(form) {
  167. if(this.form.countdown_time){
  168. this.form.countdown_time[0] = Math.round(this.form.countdown_time[0]/1000).valueOf();
  169. this.form.countdown_time[1] = Math.round(this.form.countdown_time[1]/1000).valueOf();
  170. }
  171. else{
  172. this.form.countdown_time = [];
  173. this.form.countdown_time.push(new Date().getTime()/1000,(new Date().getTime() + 7 * 24 * 3600 * 1000)/1000)
  174. }
  175. delete(this.form.goods)
  176. delete(this.form.browse_count)
  177. delete(this.form.end_time)
  178. delete(this.form.diy_form)
  179. delete(this.form.browse)
  180. delete(this.form.diyform_title)
  181. delete(this.form.goods_thumb)
  182. delete(this.form.goods_title)
  183. delete(this.form.created_at)
  184. delete(this.form.updated_at)
  185. delete(this.form.has_one_good)
  186. console.log(this.form);
  187. this.$refs[form].validate((valid) => {
  188. if (valid) {
  189. this.loading = true;
  190. this.$http.post("{!! yzWebFullUrl('plugin.link-tool.admin.link.add.index') !!}",{'form':this.form, 'id':this.id}).then(response => {
  191. if (response.data.result) {
  192. this.$message({message: "操作成功",type: 'success'});
  193. window.location.href='{!! yzWebFullUrl('plugin.link-tool.admin.link.manage.index') !!}';
  194. }
  195. else {
  196. this.$message({message: response.data.msg,type: 'error'});
  197. this.loading = false;
  198. }
  199. },response => {
  200. this.$message({message: response.data.msg,type: 'error'});
  201. this.loading = false;
  202. });
  203. } else {
  204. console.log('error submit!!');
  205. return false;
  206. }
  207. });
  208. },
  209. // 字符转义
  210. escapeHTML(a) {
  211. a = "" + a;
  212. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  213. },
  214. },
  215. });
  216. </script>
  217. <style>
  218. /*弹窗上传图片*/
  219. #upload-img .avatar {
  220. width: 100px;
  221. height: 100px;
  222. display: block;
  223. }
  224. #upload-img .avatar-uploader-box {
  225. position: relative;
  226. margin: 20px 0 0 10px;
  227. width: 110px;
  228. }
  229. #upload-img .el-icon-circle-close {
  230. position: absolute;
  231. top: -7px;
  232. right: 1px;
  233. color: #999;
  234. }
  235. .imgList {
  236. display: flex;
  237. flex-wrap: wrap;
  238. margin: 10px auto;
  239. }
  240. </style>
  241. @endsection