roomedit.php
9.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
use yii\web\View;
use yii\helpers\Html;
use backend\widgets\YHGImage\Common\Images as CommonImages;
$this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
?>
<?php
$this->registerCssFile('/css/select2.css',array('postion'=>View::POS_END));
$this->registerJsFile('/js/My97DatePicker/WdatePicker.js',array('postion'=>View::POS_END));
$this->registerJsFile('/js/select2.min.js',array('postion'=>View::POS_END));
?>
<script type="text/javascript">
<?php $this->beginBlock('javascript');?>
jQuery(document).ready(function() {
// Select2
jQuery(".select-basic").select2();
if (!$('input[name=pic]').val()){
$('#pic').remove();
}
if (!$('input[name=background_pic]').val()){
$('#background_pic').remove();
}
});
/**
* 表单验证
* @returns {Boolean}
*/
function verify(){
if (!$('input[name=pic]').val()){
alert('头图不能为空。');
return false;
}
if (!$('input[name=background_pic]').val()){
alert('背景图不能为空。');
return false;
}
return true;
}
<?php
$this->endBlock();
$this->registerJs($this->blocks['javascript'],View::POS_END)
?>
</script>
<div class="col-md-9">
<form id="form" method="POST" action="">
<div class="panel panel-default">
<div class="panel-body">
<!-- 左侧表单 begin-->
<div class="col-md-6">
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label">房间号: </label>
<div class="col-sm-9">
<?=$model->room_id ? : '保存后生成'?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">直播标题: <span class="asterisk">*</span></label>
<div class="col-sm-9">
<input type="text" name="title" class="form-control" required="required" value="<?=$model->title?>">(建议不超过18个汉字)
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">水印文案: </label>
<div class="col-sm-5">
<input type="text" name="watermark" class="form-control" value="<?=$model->watermark?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">主播: <span class="asterisk">*</span></label>
<div class="col-sm-5">
<?php echo Html::dropDownList('master_id', $model->master_id,$masters, ['class' => 'width300 select-basic', 'required'=>"required"]);?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">预告开始时间: </label>
<div class="col-sm-5">
<input type="text" name="starting_time" class="form-control" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<?=$model->starting_time ? date('Y-m-d H:i:s',$model->starting_time) : ''?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">房间密钥: <span class="asterisk">*</span></label>
<div class="col-sm-5">
<input type="text" name="secret" class="form-control" required="required" value="<?=$model->secret?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否精选: </label>
<div class="col-sm-2">
<?php echo Html::dropDownList('best', $model->best,Yii::$app->params['config']['best'], ['class' => 'form-control']);?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">马甲状态: </label>
<div class="col-sm-2">
<?php echo Html::dropDownList('vest', $model->vest,Yii::$app->params['config']['vest'], ['class' => 'form-control']);?>
</div>
<div class="col-sm-2">
累加人数:<?php echo Html::checkbox('is_addup', $model->is_addup==Yii::$app->params['config']['is_addup'],['value'=>Yii::$app->params['config']['is_addup']])?>
</div>
</div>
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label">直播状态: </label>
<div class="col-sm-2">
<?php echo Html::dropDownList('living', $model->living,Yii::$app->params['config']['room_living'], ['class' => 'form-control']);?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">头图: <span class="asterisk">*</span></label>
<div class="col-sm-9">
<?=$picUploader?>
<?php if ($model->pic):?>
<div class="file-item thumbnail upload-state-done" id="pic"><img src="<?=CommonImages::getImageUrl($model->pic, 110, 110)?>"><div class="info">当前图片</div></div>
<?php endif;?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">背景图: <span class="asterisk">*</span></label>
<div class="col-sm-9">
<?=$backgroundUploader?>
<?php if ($model->background_pic):?>
<div class="file-item thumbnail upload-state-done" id="background_pic"><img src="<?=CommonImages::getImageUrl($model->background_pic, 110, 110)?>"><div class="info">当前图片</div></div>
<?php endif;?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">业务线: <span class="asterisk">*</span></label>
<div class="col-sm-5">
<?php foreach (Yii::$app->params['config']['app'] as $k=>$v):?>
<div class="checkbox block"><label><?php echo Html::checkbox('app[]', in_array($k,(array)$model->app),['value'=>$k])?> <?=$v?></label></div>
<?php endforeach;?>
</div>
</div>
</div><!-- row -->
</div>
<!-- 左侧表单 end-->
<!-- 右侧表单 begin-->
<div class="col-md-6">
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label">未开始排序: </label>
<div class="col-sm-3">
<input type="text" name="unstart_sort" class="form-control" value="<?=$model->unstart_sort?>">
</div>
<label class="col-sm-3 control-label">直播中排序: </label>
<div class="col-sm-3">
<input type="text" name="living_sort" class="form-control" value="<?=$model->living_sort?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">分享主图: </label>
<div class="col-sm-9">
<?=$sharePicUploader?>
<?php if ($model->id && $roomShare['pic']):?>
<div class="file-item thumbnail upload-state-done" id="share_pic"><img src="<?=CommonImages::getImageUrl($roomShare['pic'], 110, 110)?>"><div class="info">当前图片</div></div>
<?php endif;?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">分享标题: </label>
<div class="col-sm-9">
<input type="text" name="share_title" class="form-control" value="<?php echo ($model->id && $roomShare['title']) ? $roomShare['title']:''?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">分享内容: </label>
<div class="col-sm-9">
<!-- <input type="text" name="share_content" class="form-control" value="">-->
<textarea rows="5" name="share_content" class="form-control"><?php echo ($model->id && $roomShare['content']) ? $roomShare['content']:''?></textarea>
</div>
</div>
</div>
</div>
<!-- 右侧表单 end-->
</div><!-- panel-body -->
<div class="panel-footer">
<div class="row">
<div class="col-sm-9 col-sm-offset-3">
<button class="btn btn-primary mr5" id="upload_button" onclick="return verify()">保存</button>
<a href="<?=$_refer?>" class="btn btn-dark">取消</a>
</div>
</div>
</div><!-- panel-footer -->
</div><!-- panel -->
</form>
</div>