index.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-image');
  4. ComponentHelper::loadComponentView('com-attachment');
  5. ComponentHelper::loadComponentView('com-rich-text');
  6. ?>
  7. <div id="app" v-cloak>
  8. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  9. <div class="form_box">
  10. <template>
  11. <el-card>
  12. <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px">
  13. <el-tabs v-model="activeName" type="card">
  14. <el-tab-pane label="系统设置" name="system">
  15. <?=ComponentHelper::loadComponentView('system', __DIR__ . '/'); ?>
  16. </el-tab-pane>
  17. <el-tab-pane label="存储设置" name="storage">
  18. <?=ComponentHelper::loadComponentView('storage', __DIR__ . '/'); ?>
  19. </el-tab-pane>
  20. <el-tab-pane label="超限设置" name="limit">
  21. <?=ComponentHelper::loadComponentView('limit', __DIR__ . '/'); ?>
  22. </el-tab-pane>
  23. <el-tab-pane label="商城创建同步设置" name="mall-create-syn">
  24. <?=ComponentHelper::loadComponentView('mall-create-syn', __DIR__ . '/'); ?>
  25. </el-tab-pane>
  26. <el-tab-pane label="地图设置" name="map">
  27. <?=ComponentHelper::loadComponentView('map', __DIR__ . '/'); ?>
  28. </el-tab-pane>
  29. <el-tab-pane label="短信设置" name="sms">
  30. <?=ComponentHelper::loadComponentView('sms', __DIR__ . '/'); ?>
  31. </el-tab-pane>
  32. <el-tab-pane label="备份设置" name="backups">
  33. <?=ComponentHelper::loadComponentView('backups', __DIR__ . '/'); ?>
  34. </el-tab-pane>
  35. </el-tabs>
  36. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;" @click="submit" size="small">保存
  37. </el-button>
  38. </el-form>
  39. </el-card>
  40. </template>
  41. </div>
  42. </el-card>
  43. </div>
  44. <script>
  45. const app = new Vue({
  46. el: '#app',
  47. data() {
  48. return {
  49. loading: false,
  50. btnLoading: false,
  51. params: {},
  52. activeName: 'system',
  53. setting_group_name:{
  54. system:'系统设置',
  55. storage:'存储设置',
  56. limit:'超限设置',
  57. map:'地图设置',
  58. sms:'短信设置',
  59. backups:'备份设置',
  60. },
  61. mallId:'',
  62. mallList:[],
  63. mode:[],
  64. goods:0,
  65. diy:0,
  66. material:0,
  67. aliyunActive: 'domestic',
  68. submailActive: 'domestic',
  69. qcloudActive: 'domestic',
  70. smsSystem: {
  71. 'platform': {
  72. 'aliyun': '阿里云',
  73. 'qcloud': '腾讯云',
  74. 'submail': '赛邮云',
  75. }
  76. },
  77. ruleForm: {
  78. // 基础设置
  79. system: {
  80. logo:{title:'站点logo',value:'',remark: '仅支持上传 .jpg .png .ico 格式文件'},
  81. name:{title:'网站名称',value:'',remark: '网站名称,最多不超过20个字符'},
  82. brief_name:{title:'网站简称',value:'',remark: ''},
  83. keyword:{title:'网站关键字',value:'',remark: ''},
  84. logo_url:{title:'版权LOGO图片',value:'',remark: ''},
  85. copyright:{title:'底部版权信息',value:'',remark: ''},
  86. copyright_url:{title:'底部版权url',value:'',remark: '例如:https://www.baidu.com'},
  87. copyright_status:{title:'版权开关',value:0,remark: '开启后所有商城都将显示版权信息'},
  88. contact_tel:{title:'客服电话',value:'',remark: ''},
  89. web_service_url:{title:'客服地址',value:'',remark: '例如:https://www.baidu.com'},
  90. product_url:{title:'产品动态链接',value:'',remark: '例如:https://www.baidu.com'},
  91. official_url:{title:'官网链接',value:'',remark: '例如:https://www.baidu.com'},
  92. h5_url:{title:'H5链接',value:'',remark: '例如:https://h5.qijianshirjcs.com'},
  93. cat_h5_url:{title:'发薪猫H5链接',value:'',remark: '例如:https://h5.qijianshirjcs.com'},
  94. api_url:{title:'api接口域名',value:'',remark: '例如:https://www.baidu.com'},
  95. backend_url:{title:'系统管理后台域名',value:'',remark: '例如:https://www.baidu.com'},
  96. static_url:{title:'静态文件域名',value:'',remark: '例如:https://www.baidu.com'},
  97. login_desc:{title:'登录页简介',value:'',remark: ''},
  98. login_logo:{title:'登录页LOGO',value:'',remark: '建议尺寸:高度100px,宽度自由'},
  99. login_bg:{title:'登录页背景图',value:'',remark: '建议尺寸1920*1080'},
  100. manage_bg:{title:'管理页背景图',value:'',remark: '建议尺寸1920*1080'},
  101. open_register:{title:'开启注册功能',value:'1',remark: ''},
  102. credentials:{title:'证件信息是否必填',value:'',remark: ''},
  103. open_mobile_login_verify:{title:'是否开启手机验证登录',value:0,remark: ' 开启短信验证码登录,需要开启短信服务,请在"系统设置->短信设置"中开启短信服务,及在"账号管理->账户列表"确认账户已经填写了手机号码。'},
  104. registered_bg:{title:'注册页背景图',value:'',remark: '建议尺寸1920*1080'},
  105. record_number:{title:'备案号',value:'',remark: '如:粤ICP备17128303号'},
  106. record_belong:{title:'备案版权所属',value:'',remark: '如: Copyright © 2018-2020 广东七件事网络科技有限公司版权所有'},
  107. public_record:{title:'公网备案',value:'',remark: '如:粤公网安备 44010502001439号'},
  108. register_protocol:{title:'注册协议',value:'',remark: ''},
  109. },
  110. storage:{
  111. driver:{
  112. title:'存储方式',
  113. value:'oss',
  114. extra:{
  115. local:'本地存储',
  116. cos:'腾讯云存储',
  117. oss:'阿里云存储',
  118. qiniu:'七牛云存储'
  119. }
  120. }
  121. },
  122. storage_driver:{
  123. local:{title:'本地存储',value:'',remark:'本地服务器存储无需额外配置'},
  124. cos:{
  125. title:'腾讯云存储',
  126. value:{
  127. bucket: '',
  128. area:'',
  129. domain:'',
  130. secret_id:'',
  131. secret_key:'',
  132. }
  133. },
  134. oss:{
  135. title:'阿里云存储',
  136. value:{
  137. storage_aliyun_bucket: '',
  138. storage_aliyun_endpoint:'',
  139. storage_aliyun_accesskeyid:'',
  140. storage_aliyun_accesskeysecret:'',
  141. storage_aliyun_user_url:'',
  142. storage_aliyun_transport_protocols:'',
  143. img_style_interface:'',
  144. arn: '',
  145. }
  146. },
  147. qiniu:{
  148. title:'七牛云存储',
  149. value:{
  150. bucket: '',
  151. domain:'',
  152. access_key_id:'',
  153. access_key_secret:'',
  154. img_style_interface:'',
  155. }
  156. }
  157. },
  158. limit:{
  159. img:{title:'上传图片限制',value:'',remark: '-1:表示无限制,单位:MB'},
  160. video:{title:'上传视频限制',value:'',remark: '-1:表示无限制,单位:MB'},
  161. diy:{title:'diy组件限制',value:'',remark: '-1:表示无限制,单位:个'}
  162. },
  163. mall_create_syn:{
  164. mall:{title:'商城',value:'',remark: '商城'},
  165. goods:{title:'商品',value:'',remark: '商品'},
  166. diy:{title:'装修',value:0,remark: '装修'},
  167. material:{title:'素材中心',value:0,remark: '素材中心'},
  168. mode:{title:'模式',value:[],remark: '模式'},
  169. },
  170. map:{
  171. amap_jsapi_key:{title:'高德地图key',value:'',remark: '请前往高德地图开发者平台申请'},
  172. amap_jsapi_secret:{title:'高德地图安全秘钥',value:'',remark: '请前往高德地图开发者平台申请'},
  173. qq_jsapi_key:{title:'腾讯地图KEY',value:'',remark: '腾讯地图开发者平台申请'},
  174. qq_jsapi_secret:{title:'腾讯地图SECRET',value:'',remark: '腾讯地图开发者平台申请'},
  175. is_location:{title:'开启实时定位',value:'0',remark: '开启该功能,需额外花费费用开通地图功能'},
  176. qq_jsapi_key_h5: {title: 'H5端腾讯地图KEY', value: '',remark: 'H5端使用的腾讯地图KEY, 请前往腾讯地图开发者平台申请, 使用域名白名单方式'},
  177. },
  178. sms:{
  179. status: {title:"状态",value:'0',remark:''},
  180. platform: {title:"平台",value:'aliyun',remark:''},
  181. access_key_id: {title:"access_key_id",value:'',remark:''},
  182. access_key_secret: {title:"access_key_secret",value:'',remark:''},
  183. template_name: {title:"模板签名",value:'',remark:''},
  184. int_access_key_id: {title:"access_key_id",value:'',remark:''},
  185. int_access_key_secret: {title:"access_key_secret",value:'',remark:''},
  186. int_template_name: {title:"模板签名",value:'',remark:''},
  187. int_captcha_template_id: {title:"模板ID",value:'',remark:''},
  188. int_captcha_template_variable:{title:"模板变量",value:'number',remark:''},
  189. mobile: {title:"手机号",value:'',remark:''},
  190. captcha_template_id: {title:"模板ID",value:'',remark:''},
  191. captcha_template_variable:{title:"模板变量",value:'number',remark:''},
  192. // 腾讯云短信
  193. qcloud_sdk_app_id: {title:"sdk_app_id", value:'', remark:''}, // 腾讯云SDK AppID
  194. qcloud_app_key: {title:"app_key", value:'', remark:''}, // 腾讯云SDK AppID
  195. qcloud_secret_id: {title:"secret_id", value:'', remark:''}, // 腾讯云SecretId
  196. qcloud_secret_key: {title:"secret_key", value:'', remark:''}, // 腾讯云SecretKey
  197. qcloud_mobile: {title:"mobile", value:'', remark:''}, // 手机号
  198. qcloud_domestic_sign_name: {title:"sign_name", value:'', remark:''}, // 国内短信签名
  199. qcloud_international_sign_name: {title:"sign_name", value:'', remark:''}, // 国际短信签名
  200. // 腾讯云短信国内信息
  201. domestic_captcha_template_id: {title:"captcha_template_id", value:'', remark:''}, // 验证码模板ID
  202. domestic_captcha_template_sign: {title:"captcha_template_sign", value:'', remark:''}, // 验证码模板签名
  203. // 腾讯云短信国际信息
  204. international_captcha_template_id: {title:"captcha_template_id", value:'', remark:''}, // 验证码模板ID
  205. international_captcha_template_sign: {title:"captcha_template_sign", value:'', remark:''}, // 验证码模板签名
  206. //赛邮云短信配置
  207. submail_app_id:{title: 'submail_app_id', value:'', remark:'',},//appId
  208. submail_app_key:{title: 'submail_app_key', value:'', remark:'',},//appKey
  209. submail_mobile:{title: 'submail_mobile', value:'', remark:'',},//测试手机号
  210. submail_domestic_captcha_template_id: {title:"submail_domestic_captcha_template_id", value:'', remark:''}, // 验证码模板ID
  211. submail_domestic_captcha_template_sign: {title:"submail_domestic_captcha_template_sign", value:'', remark:''}, // 验证码模板签名
  212. },
  213. backups: {
  214. is_enable: {title:"是否开启备份", value: 1, remark:''},
  215. is_auto: {title:"自动备份", value: 1, remark:''},
  216. }
  217. }
  218. }
  219. },
  220. mounted: function() {
  221. this.loadData();
  222. },
  223. methods: {
  224. loadData() {
  225. if(this.loading === true) return;
  226. this.loading = true;
  227. request({
  228. params: {
  229. r: 'admin/setting/index',
  230. },
  231. method: 'get'
  232. }).then(e => {
  233. this.loading = false;
  234. if (e.data.code == 0) {
  235. if(e.data.data){//有选中的
  236. var data = e.data.data;
  237. this.mallList = e.data.data.mallList;
  238. Object.keys(this.ruleForm).forEach((key) => {
  239. Object.keys(this.ruleForm[key]).forEach((k) => {
  240. if (data[key][k]) {
  241. if (typeof data[key][k].value == 'string' && data[key][k].value.indexOf("{") !== -1) {
  242. // 将json字符串转为对象
  243. this.ruleForm[key][k].value = JSON.parse(data[key][k].value);
  244. }else{
  245. this.ruleForm[key][k].value = data[key][k].value;
  246. }
  247. }
  248. });
  249. });
  250. }
  251. }
  252. }).catch(e => {
  253. this.loading = false;
  254. })
  255. },
  256. submit() {
  257. this.btnLoading = true;
  258. this.$request({
  259. params: {
  260. r: 'admin/setting/index',
  261. },
  262. method: 'post',
  263. data: {
  264. setting: this.ruleForm,
  265. },
  266. }).then(e => {
  267. this.btnLoading = false;
  268. if (e.data.code === 0) {
  269. this.$message.success(e.data.msg);
  270. } else {
  271. this.$message.error(e.data.msg);
  272. }
  273. }).catch(e => {
  274. this.btnLoading = false;
  275. });
  276. },
  277. updateSuccess(e) {
  278. this.$message.success('上传成功')
  279. },
  280. mapOpen(val) {
  281. if (val == 1) {
  282. this.ruleForm.map.is_location.value = 0;
  283. this.$confirm('该功能需额外花费费用开通地图功能才可生效,是否继续开启', '提示', {
  284. confirmButtonText: '确定',
  285. cancelButtonText: '取消',
  286. type: 'warning'
  287. }).then(() => {
  288. this.ruleForm.map.is_location.value = 1;
  289. }).catch(() => {
  290. this.ruleForm.map.is_location.value = 0;
  291. });
  292. }
  293. }
  294. }
  295. });
  296. </script>