wechatMp.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. use yii\widgets\ActiveForm;
  3. use common\helpers\Url;
  4. use common\enums\StatusEnum;
  5. use unclead\multipleinput\MultipleInput;
  6. $form = ActiveForm::begin([
  7. 'id' => $model->formName(),
  8. 'enableAjaxValidation' => true,
  9. 'validationUrl' => Url::to(['ajax-edit', 'name' => $model['name'], 'type' => $model['type']]),
  10. 'fieldConfig' => [
  11. 'template' => "<div class='row'><div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div></div>",
  12. ],
  13. ]);
  14. ?>
  15. <div class="modal-header">
  16. <h4 class="modal-title"><?= $nameMap[$model['name']] . ' - ' . $typeMap[$model['type']]; ?></h4>
  17. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  18. </div>
  19. <div class="modal-body">
  20. <?= $form->field($model, 'template_id')->textInput()->hint('注意:请自行去微信公众号后台申请微信模板消息ID'); ?>
  21. <?= $form->field($model, 'content')->widget(MultipleInput::class, [
  22. 'iconSource' => 'fa',
  23. 'max' => 10,
  24. 'columns' => [
  25. [
  26. 'name' => 'key',
  27. 'title' => '参数名',
  28. 'enableError' => false,
  29. 'options' => [
  30. 'class' => 'input-priority'
  31. ]
  32. ],
  33. [
  34. 'name' => 'value',
  35. 'title' => '参数值',
  36. 'enableError' => false,
  37. 'options' => [
  38. 'class' => 'input-priority'
  39. ]
  40. ],
  41. [
  42. 'name' => 'color',
  43. 'title' => '颜色(默认:#000000)',
  44. 'enableError' => false,
  45. 'options' => [
  46. 'class' => 'input-priority',
  47. ]
  48. ],
  49. ]
  50. ])->label(false);
  51. ?>
  52. <?= $form->field($model, 'url')->textInput()->hint('例如: https://www.baidu.com/index?foo=bar'); ?>
  53. <?= $form->field($model, 'status')->radioList(StatusEnum::getMap()); ?>
  54. </div>
  55. <div class="modal-footer">
  56. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  57. <button class="btn btn-primary" type="submit">保存</button>
  58. </div>
  59. <?php ActiveForm::end(); ?>
粤ICP备19079148号