| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- <style>
- .form-body {
- padding: 20px 50% 20px 20px;
- background-color: #fff;
- margin-bottom: 20px;
- min-width: 1000px
- }
- .form-button {
- margin: 0;
- }
- .form-button .el-form-item__content {
- margin-left: 0 !important;
- }
- .button-item {
- padding: 9px 25px;
- }
- .red {
- color: #ff4544
- }
- .id-card {
- position: relative;
- /*height: 170px;*/
- width: 190px;
- float: left;
- text-align: center;
- /*margin-bottom: 20px;*/
- font-size: 12px;
- color: #666;
- margin-right: 30px;
- }
- .id-card img {
- max-height: 134px;
- max-width: 190px;
- background-color: #EEEFF3;
- }
- .card-upload .el-button {
- position: absolute;
- left: 50%;
- top: 50%;
- margin-top: -16px;
- margin-left: -16px;
- z-index: 1;
- }
- .com-attachment .card-upload{
- width: 100%;
- height: 100%;
- }
- .background-box{
- width:100%;
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- padding-top: 100px;
- }
- .background-box .title{
- width: 280px;
- height: 138px;
- margin: auto;
- background-size: contain;
- background-repeat: no-repeat;
- margin-bottom: 50px;
- }
- .all-components {
- background: #fff;
- padding: 20px;
- }
- .all-components .component-group {
- border: 1px solid #eeeeee;
- width: 300px;
- margin-bottom: 20px;
- }
- .all-components .component-group:last-child {
- margin-bottom: 0;
- }
- .all-components .component-group-name {
- height: 35px;
- line-height: 35px;
- background: #f7f7f7;
- padding: 0 20px;
- border-bottom: 1px solid #eeeeee;
- }
- .all-components .component-list {
- margin-right: -2px;
- margin-top: -2px;
- flex-wrap: wrap;
- }
- .all-components .component-list .component-item {
- width: 100px;
- height: 100px;
- border: 0 solid #eeeeee;
- border-width: 0 1px 1px 0;
- text-align: center;
- padding: 15px 0 0;
- cursor: pointer;
- }
- .all-components .component-list .component-icon {
- width: 40px;
- height: 40px;
- /*border: 1px solid #eee;*/
- }
- .all-components .component-list .component-name {
- }
- #diy-list {
- width: 95%;
- padding: 20px;
- float: left;
- margin: 20px;
- border: 1px solid #eeeeee;
- }
- .all-components {
- background: #fff;
- padding: 20px;
- }
- .all-components .component-group {
- border: 1px solid #eeeeee;
- width: 300px;
- margin-bottom: 20px;
- }
- .all-components .component-group:last-child {
- margin-bottom: 0;
- }
- .all-components .component-group-name {
- height: 35px;
- line-height: 35px;
- background: #f7f7f7;
- padding: 0 20px;
- border-bottom: 1px solid #eeeeee;
- }
- .all-components .component-list {
- margin-right: -2px;
- margin-top: -2px;
- flex-wrap: wrap;
- }
- .all-components .component-list .component-item {
- width: 100px;
- height: 100px;
- border: 0 solid #eeeeee;
- border-width: 0 1px 1px 0;
- text-align: center;
- padding: 15px 0 0;
- cursor: pointer;
- }
- .all-components .component-list .component-icon {
- width: 40px;
- height: 40px;
- /*border: 1px solid #eee;*/
- }
- .all-components .component-list .component-name {
- }
- .mobile-framework {
- width: 375px;
- height: 100%;
- }
- .mobile-framework-header {
- height: 60px;
- line-height: 60px;
- background: #333;
- color: #fff;
- text-align: center;
- background: url('/resources/addons/sudoku/img/head.png') no-repeat;
- }
- .mobile-framework-body {
- min-height: 645px;
- border: 1px solid #e2e2e2;
- background: #f5f7f9;
- }
- .mobile-framework .diy-component-preview {
- cursor: pointer;
- position: relative;
- zoom: 0.5;
- -moz-transform: scale(0.5);
- -moz-transform-origin: top left;
- font-size: 28px;
- }
- @-moz-document url-prefix() {
- .mobile-framework .diy-component-preview {
- cursor: pointer;
- position: relative;
- -moz-transform: scale(0.5);
- -moz-transform-origin: top left;
- font-size: 28px;
- width: 200% !important;
- height: 100%;
- margin-bottom: auto;
- }
- .mobile-framework .active .diy-component-preview {
- border: 2px dashed #409EFF;
- left: -2px;
- right: -2px;
- width: calc(200% + 4px) !important;
- }
- }
- .mobile-framework .diy-component-preview:hover {
- box-shadow: inset 0 0 10000px rgba(0, 0, 0, .03);
- }
- .mobile-framework .diy-component-edit {
- width: 100%;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 465px;
- right: 0;
- background: #fff;
- padding: 20px;
- display: none;
- overflow: auto;
- }
- .diy-component-options {
- position: relative;
- }
- .diy-component-options .el-button {
- height: 25px;
- line-height: 25px;
- width: 25px;
- padding: 0;
- text-align: center;
- border: none;
- border-radius: 0;
- position: absolute;
- margin-left: 0;
- }
- .mobile-framework .active .diy-component-preview {
- border: 2px dashed #409EFF;
- left: -2px;
- right: -2px;
- width: calc(100% + 4px);
- }
- .mobile-framework .active .diy-component-edit {
- display: block;
- padding-right: 20%;
- min-width: 650px;
- }
- .all-components {
- max-height: 725px;
- overflow-y: auto;
- }
- .bottom-menu {
- text-align: center;
- height: 54px;
- width: 100%;
- }
- .bottom-menu .el-card__body {
- padding-top: 10px;
- }
- .el-dialog {
- min-width: 800px;
- }
- /* 公共样式 */
- .flex {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- }
- .flex-x-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- }
- .flex-x-between {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: space-between;
- -webkit-justify-content: space-between;
- -ms-flex-pack: space-between;
- justify-content: space-between;
- }
- .flex-y-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-align: center;
- -webkit-align-items: center;
- -ms-flex-align: center;
- -ms-grid-row-align: center;
- align-items: center;
- }
- /* 溢出隐藏 */
- .over1 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .over2 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .sava_btn .el-button {
- width: 150px;
- height: 40px;
- border-radius: 5px;
- }
- .page_msg_box {
- padding: 22px 23px;
- border-radius: 5px 5px 0 0;
- }
- </style>
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-rich-text');
- ?>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>九宫格抽奖设置</span>
- </div>
- <el-tabs type="border-card">
- <el-tab-pane label="基础设置">
- <div class="form-body">
- <el-form :model="form" label-width="120px" ref="form" size="small" v-loading="loading" :rules="FormRules">
- <el-form-item label="抽奖时间" prop="open_time">
- <el-date-picker v-model="form.open_time" unlink-panels type="datetimerange" size="small"
- value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 设置抽奖活动时间
- </div>
- </el-form-item>
- <el-form-item label="抽奖规则" prop="type">
- <el-radio v-model="form.type" :label="1">一天{{ form.lucky_number }}次</el-radio>
- <el-radio v-model="form.type" :label="2">一人{{ form.lucky_number }}次</el-radio>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 设置抽奖规则类型,是按每天发放还是每个人给固定的次数
- </div>
- </el-form-item>
- <el-form-item label="中奖名单" prop="is_show">
- <el-switch v-model="form.is_show" :active-value="1" :inactive-value="0">
- </el-switch>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 开启后,前端显示中奖名单。
- </div>
- </el-form-item>
- <el-form-item label="邮费方式" prop="shipping_type">
- <el-radio v-model="form.shipping_type" :label="1">包邮</el-radio>
- <el-radio v-model="form.shipping_type" :label="2">不包邮</el-radio>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 赠品奖品是否包邮
- </div>
- </el-form-item>
- <el-form-item label="抽奖次数" prop="lucky_number">
- <el-input size="small" type="number" v-model="form.lucky_number" autocomplete="off" ></el-input>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 对应规则设置抽奖次数
- </div>
- </el-form-item>
- <el-form-item label="消耗积分" prop="use_point">
- <el-input size="small" type="number" v-model="form.use_point" autocomplete="off"></el-input>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 抽奖是否需要消耗积分,如有设置则每抽一次消耗一次积分
- </div>
- </el-form-item>
- <el-form-item label="规则说明" prop="rule_explain">
- <com-rich-text style="width: 750px" :simple-attachment="true" v-model="form.rule_explain"></com-rich-text>
- <br/>
- <div class="tips-text" style="line-height: 24px;">
- 抽奖规则说明,亦可以图片形式展示
- </div>
- </el-form-item>
- </el-form>
- </div>
- <el-button type="primary" class="button-item" size="small" :loading=btnLoading @click="onSubmit">提交</el-button>
- </el-tab-pane>
- <el-tab-pane label="背景图设置">
- <div class="form_box">
- <el-form :model="form1"
- style="position: relative"
- size="small" label-width="160px" >
- <div flex="box:first" style="margin-bottom: 10px;min-width: 1280px; background-color: #ffffff;">
- <div class="all-components" style="max-height: 100%; overflow-y: auto;">
- <div style="overflow-y: auto;padding: 0 25px;width: 435px;">
- <div class="mobile-framework" style="height: 705px;">
- <div class="mobile-framework-header"></div>
- <div class="mobile-framework-body" id='framework-img' :style="'background:'+ form.bg_color" >
- <div class="background-box" :style=' "background-image:url(" + form.bg_img + ")" '>
- <div class="title" style="background-image: url('/resources/addons/sudoku/img/title.png');">
- </div>
- <div style="width: 280px;height: 280px;margin: 0 auto 75px;background-image: url('/resources/addons/sudoku/img/box.png');background-size: contain;background-repeat: no-repeat;">
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="diy-list" style="padding-left: 2px;position: relative;">
- <el-form-item label="背景图" prop="id_card_reverse">
- <div class="id-card">
- <com-attachment v-model="form.bg_img" :simple="false">
- <div class="card-upload">
- <img v-if="form.bg_img"
- :src="form.bg_img">
- <img v-else src="/resources/addons/sudoku/img/indexbg2.png">
- <el-button icon="el-icon-plus" circle type="primary"></el-button>
- </div>
- </com-attachment>
- </div>
- </el-form-item>
- <el-form-item label="下半部背景颜色">
- <el-color-picker v-model="form.bg_color"></el-color-picker>
- </el-form-item>
- <div>
- <div style="width:100%; float: left; padding: 20px;">
- <el-button class="button-item" type="primary" style="margin-top: 24px;" @click="onSubmit" size="small">保存</el-button>
- </div>
- </div>
- </div>
- </div>
- </el-form>
- </div>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </div>
- <style>
- .el-textarea__inner {
- padding: 0 15px;
- }
- </style>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- loading: false,
- time: null,
- btnLoading: false,
- form: {
- bg_img: "",
- bg_color: "#6d0505",
- probability_points: 0,
- open_time: [],
- type: '',
- lucky_number: '',
- use_point: '',
- rule_explain: '',
- shipping_type: '1',
- is_show: 1,
- },
- form1:{},
- FormRules: {
- probability_points: [
- {required: true, message: '概率不能为空', trigger: 'blur'},
- {
- validator: (rule, value, callback) => {
- if(value>10000||value<0){
- callback('必须大于0');
- }
- if(value.toString().split(".")[1].length>3){
- callback('最大三位小数');
- }
- callback();
- }
- }
- ],
- lucky_number: [
- {required: true, message: '抽奖次数不能为空', trigger: 'blur'},
- {
- validator: (rule, value, callback) => {
- if(value>100000||value<0){
- callback('必须大于0,小于100000');
- }
- callback();
- }
- }
- ],
- type: [
- {required: true, message: '抽奖规则不能为空', trigger: 'blur'},
- ],
- shipping_type: [
- {required: true, message: '邮费方式不能为空', trigger: 'blur'},
- ],
- open_time: [
- {required: true, message: '抽奖时间不能为空', trigger: 'blur'},
- ],
- },
- };
- },
- methods: {
- onSubmit() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- this.form.start_at = this.form.open_time[0];
- this.form.end_at = this.form.open_time[1];
- this.btnLoading = true;
- let para = Object.assign(this.form);
- console.log(para);
- request({
- params: {
- r: 'sudoku/setting/index',
- },
- data: para,
- method: 'post'
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- this.$message({
- message: e.data.msg,
- type: 'success'
- });
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- this.$message.error(e.data.msg);
- });
- }
- });
- },
- getList() {
- this.loading = true;
- request({
- params: {
- r: 'sudoku/setting/index',
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- let data = e.data.data
- if(e.data.data.length>0|| e.data.data.length == undefined) this.form = e.data.data;
- if(this.form.start_at && this.form.end_at) this.$set(this.form, 'open_time', [data.start_at, data.end_at]);
- this.form.bg_img = this.form.bg_img?this.form.bg_img:data.api_url+'/resources/addons/sudoku/img/indexbg2.png';
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- },
- },
- mounted: function () {
- this.getList();
- }
- })
- </script>
|