| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052 |
- <template>
- <div class="app-container">
- <el-row>
- <el-col :span="24">
- <div class="cell">
- <div class="cell-title">
- <div class="title-left">
- <div class="title">攻略管理</div>
- </div>
- </div>
- <div class="cell-body">
- <div class="controls">
- <el-form :inline="true" :model="formInline" class="demo-form-inline">
- <el-form-item label="">
- <el-input v-model="formInline.key" style="width: 280px;" prefix-icon="el-icon-search" clearable
- placeholder="请输入标题"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" class="btn-search" @click="btn_search">查询</el-button>
- </el-form-item>
- </el-form>
- <div>
- <el-button class="export" size="small" @click="add_strategy">
- <i class="el-icon el-icon-circle-plus-outline" style="font-size: 20px;"></i>
- <span style="font-size: 16px;">新增攻略</span>
- </el-button>
- <el-button class="export" size="small" @click="showSetPublisher">
- <i class="el-icon el-icon-setting" style="font-size: 20px;"></i>
- <span style="font-size: 16px;">发布人设置</span>
- </el-button>
- </div>
- </div>
- <el-table ref="multipleTable" :data="tableData" height="560" style="width: 100%" :cell-style="cell_style" v-loading="loading"
- :header-cell-style="header_cell_style">
- <el-table-column label="序号" align="center" width="66">
- <template slot-scope="scope">
- <span>{{ scope.row.xuhao }}</span>
- </template>
- </el-table-column>
- <el-table-column label="标题" align="center" width="180">
- <template slot-scope="scope">
- <span>{{ scope.row.title }}</span>
- </template>
- </el-table-column>
- <el-table-column label="描述" align="left">
- <template slot-scope="scope">
- <div style="height: 200px; overflow-y: auto;" class="scroll-container">
- <span v-html="scope.row.content"></span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="视频/图片" align="center" width="260">
- <template slot-scope="scope">
- <span v-if="typeof scope.row.image !== 'undefined'">
- <viewer>
- <el-carousel v-if="typeof scope.row.image == 'string'" height="180px">
- <el-carousel-item v-for="item in 1" :key="item">
- <img :src="scope.row.image" style="height: 180px; object-fit: contain; cursor: pointer;" />
- </el-carousel-item>
- </el-carousel>
- <el-carousel v-else height="180px">
- <el-carousel-item v-for="item in scope.row.image" :key="item">
- <img :src="item" style="height: 180px; object-fit: contain; cursor: pointer;" />
- </el-carousel-item>
- </el-carousel>
- </viewer>
- </span>
- <span v-else-if="typeof scope.row.video !== 'undefined'">
- <video-player class="video-player vjs-custom-skin" @play="onPlayerPlay($event)" :playsinline="true"
- :options="scope.row.video"></video-player>
- </span>
- </template>
- </el-table-column>
- <el-table-column label="选择地点" align="center" width="130">
- <template slot-scope="scope">
- <span>{{ scope.row.townName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="发布时间" align="center" width="160">
- <template slot-scope="scope">
- <span>{{ scope.row.createDate }}</span>
- </template>
- </el-table-column>
- <el-table-column label="来源" align="center" width="88">
- <template slot-scope="scope">
- <span>{{ scope.row.publishWay }}</span>
- </template>
- </el-table-column>
- <el-table-column label="发布人" align="center" width="88">
- <template slot-scope="scope">
- <span>{{ scope.row.userName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="180">
- <template slot-scope="scope">
- <el-button v-if="scope.row.isTop == 0" @click="handleSetTop(scope.row.id, 1)" type="text"
- style="color: rgba(9, 101, 98, 1);" size="small">置顶</el-button>
- <el-button v-else @click="handleSetTop(scope.row.id, 0)" type="text" style="color: rgba(212, 48, 48, 1);"
- size="small">取消置顶</el-button>
- <el-button v-if="scope.row.publishWay !== '小程序'" @click="handleModifyClick(scope.row)" type="text"
- style="color: rgba(9, 101, 98, 1);" size="small">编辑</el-button>
- <el-button @click="handleDelClick(scope.row)" type="text" style="color: rgba(212, 48, 48, 1);" size="small">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="pagination-table">
- <el-pagination @current-change="currentPageChange" :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
- layout="prev, pager, next, jumper" :total="pagination.total">
- </el-pagination>
- </div>
- </div>
- </div>
- </el-col>
- </el-row>
- <!-- 发布人设置 -->
- <el-dialog title="发布人设置" custom-class="configuration-window" :visible.sync="setPublisherVisible" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="setPublisherVisible = false">
- <el-row style="display: none;">
- <el-col :span="24" style="display: flex; justify-content: space-between; padding: 0;">
- <div>
- <el-input v-model="publisherSearch.key" style="width: 180px; margin-right: 10px;" clearable placeholder="请输入用户名"></el-input>
- <el-button type="primary" class="configure-btn" @click="btn_search">查询</el-button>
- </div>
- <el-button class="configure-btn" @click="show_add_publisher_dialog = true">确定设置</el-button>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24" style="padding: 0;margin: 10px 0;">
- <el-table :data="tableData_publisher" height="380" style="width: 100%" :cell-style="cell_style" v-loading="loading"
- :header-cell-style="header_cell_style">
- <el-table-column label="序号" align="center" width="55">
- <template slot-scope="scope">
- <span>{{ scope.row.xuhao }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.id }}</span>
- </template>
- </el-table-column>
- <el-table-column label="账号名" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button v-if="scope.row.mark == 0" @click="bindingPuhlisherIds(scope.row.id, 'add')" type="text"
- style="color: rgba(9, 101, 98, 1);" size="small">绑定</el-button>
- <el-button v-else @click="bindingPuhlisherIds(scope.row.id, 'del')" type="text" style="color: rgba(212, 48, 48, 1);"
- size="small">取消绑定</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-row>
- </el-dialog>
- <!-- 新增攻略 -->
- <el-dialog title="新增攻略" custom-class="add-dlg-class" :visible.sync="dialogAddStrategyVisible" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="dialogAddStrategyVisible = false">
- <div style="height: 675px; padding-right: 10px; overflow-y: auto;" class="scroll-container">
- <el-form :model="formAddDialog" ref="addDialogForm" :rules="addDialogFormRules">
- <el-form-item label="标题" :required="true" :label-width="formLabelWidth" prop="title">
- <el-input v-model="formAddDialog.title" placeholder="请输入标题"></el-input>
- </el-form-item>
- <el-form-item label="发布人" :required="true" :label-width="formLabelWidth" prop="publisher">
- <el-select v-model="formAddDialog.publisher" filterable clearable placeholder="请选择发布人">
- <el-option v-for="item in options" :key="item.publisher" :label="item.label" :value="item.publisher">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="内容" :required="true" :label-width="formLabelWidth" prop="content">
- <quill-editor v-model="formAddDialog.content" :options="editorOption"></quill-editor>
- </el-form-item>
- <el-form-item label="图片/视频" :required="true" :label-width="formLabelWidth" prop="imgs">
- <div class="add-strategy-img">
- <div v-for="(item, index) in formAddDialog.imgs">
- <div v-if="item.img == ''" class="add-strategy-img-box" @click="openImageUploadDialog(index, 'add')">
- <div class="add-strategy-img-plus"><i class="el-icon-plus"></i></div>
- <div class="add-strategy-img-txt">上传图片 {{index + 1}}</div>
- </div>
- <div v-else class="add-strategy-img-box">
- <viewer>
- <img :src="item.img" style="height: 120px; width: 120px; margin-bottom: -14px; cursor: pointer; border-radius: 5px;" />
- <div @click="del_local_display_img('formAddDialog.img', index)" class="add-strategy-img-clear">×</div>
- </viewer>
- </div>
- </div>
- <input type="file" ref="addImageUploadInput" style="display:none" accept=".jpg,.png"
- @change="uploadImageVideo($event, 'img', formAddDialog.imgIndex)" />
- <div v-if="formAddDialog.show_video == ''" class="add-strategy-img-box" style="border: 2px dashed #ff4949;"
- @click="openVideoUploadDialog('add')">
- <div class="add-strategy-img-plus" style="color: #ff4949; font-weight: bold;"><i class="el-icon-plus"></i></div>
- <div class="add-strategy-img-txt" style="color: #ff4949; font-weight: bold;">上传视频</div>
- </div>
- <div v-else class="add-strategy-img-box-video">
- <video-player class="video-player vjs-custom-skin" style="margin-top: 25px; overflow: hidden;" @play="onPlayerPlay($event)"
- :playsinline="true" :options="formAddDialog.show_video"></video-player>
- <div @click="del_local_display_img('formAddDialog.show_video', -1)" class="add-strategy-img-clear"
- style="color: #fff; background-color: #ff4949;">×</div>
- </div>
- <input type="file" ref="addVideoUploadInput" style="display:none" accept=".mp4" @change="uploadImageVideo($event, 'video', -1)" />
- </div>
- </el-form-item>
- <el-form-item label="选择地点" :required="true" :label-width="formLabelWidth" prop="rtownId">
- <el-select v-model="formAddDialog.rtownId" @change="handleAddAdressStrategy" placeholder="请选择地点">
- <el-option v-for="item in formAddDialog.rtownOptions" :key="item.id" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" :required="true" :label-width="formLabelWidth" prop="hotelIds">
- <div style="display: flex; flex-wrap: wrap; justify-content: space-between;">
- <div v-for="(hotel, index) in formAddDialog.hotelNames" :label="hotel.name" :key="hotel.id">
- <viewer>
- <div class="hotel-box" :class="{'bg-color': hotel.checked}">
- <img :src="hotel.coverImg" style="width: 114px; height: 70px; border-radius: 5px;">
- <div class="hotel-box-txt" @click="getHotelIds(index, hotel.id)">
- <div style="margin: 0 0 10px 0;" class="hotel-list">{{hotel.name}}</div>
- <div v-if="hotel.type == 1" class="hotel-list">银宿级</div>
- <div v-else-if="hotel.type == 2" class="hotel-list">金宿级</div>
- <div v-else-if="hotel.type == 3" class="hotel-list">白金级</div>
- <div v-else class="hotel-list">等级未知</div>
- </div>
- </div>
- </viewer>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="是否置顶" :label-width="formLabelWidth">
- <el-switch v-model="formAddDialog.istop" active-color="#096562" inactive-color="#ff4949"></el-switch>
- </el-form-item>
- </el-form>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="add-info-cancel-btn" @click="dialogAddStrategyVisible = false">取 消</el-button>
- <el-button class="add-info-confirm-btn" @click="handleAddStrategy">确 认</el-button>
- </div>
- </el-dialog>
- <!-- 编辑攻略 -->
- <el-dialog title="编辑攻略" custom-class="add-dlg-class" :visible.sync="dialogModifyVisible" :close-on-click-modal="false" :close-on-press-escape="false"
- @close="dialogModifyVisible = false">
- <div style="height: 675px; padding-right: 10px; overflow-y: auto;" class="scroll-container">
- <el-form :model="formModifyDialog" ref="modifyDialogForm" :rules="modifyDialogFormRules">
- <el-form-item label="标题" :required="true" :label-width="formLabelWidth" prop="title">
- <el-input v-model="formModifyDialog.title" placeholder="请输入标题"></el-input>
- </el-form-item>
- <el-form-item label="发布人" :required="true" :label-width="formLabelWidth" prop="publisher">
- <el-select v-model="formModifyDialog.publisher" filterable placeholder="请选择发布人">
- <el-option v-for="item in options" :key="item.publisher" :label="item.label" :value="item.publisher">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="内容" :required="true" :label-width="formLabelWidth" prop="content">
- <quill-editor v-model="formModifyDialog.content" :options="editorOption"></quill-editor>
- </el-form-item>
- <el-form-item label="图片/视频" :required="true" :label-width="formLabelWidth" prop="imgs">
- <div class="add-strategy-img">
- <div v-for="(item, index) in formModifyDialog.imgs">
- <div v-if="item.img == ''" class="add-strategy-img-box" @click="openImageUploadDialog(index, 'modify')">
- <div class="add-strategy-img-plus"><i class="el-icon-plus"></i></div>
- <div class="add-strategy-img-txt">上传图片 {{index + 1}}</div>
- </div>
- <div v-else class="add-strategy-img-box">
- <viewer>
- <img :src="item.img" style="height: 120px; width: 120px; margin-bottom: -14px; cursor: pointer; border-radius: 5px;" />
- <div @click="del_local_display_img('formModifyDialog.img', index)" class="add-strategy-img-clear">×</div>
- </viewer>
- </div>
- </div>
- <input type="file" ref="modifyImageUploadInput" style="display:none" accept=".jpg,.png"
- @change="uploadModifyImageVideo($event, 'img', formModifyDialog.imgIndex)" />
- <div v-if="formModifyDialog.show_video == ''" class="add-strategy-img-box" style="border: 2px dashed #ff4949;"
- @click="openVideoUploadDialog('modify')">
- <div class="add-strategy-img-plus" style="color: #ff4949; font-weight: bold;"><i class="el-icon-plus"></i></div>
- <div class="add-strategy-img-txt" style="color: #ff4949; font-weight: bold;">上传视频</div>
- </div>
- <div v-else class="add-strategy-img-box-video">
- <video-player class="video-player vjs-custom-skin" style="margin-top: 25px; overflow: hidden;" @play="onPlayerPlay($event)"
- :playsinline="true" :options="formModifyDialog.show_video"></video-player>
- <div @click="del_local_display_img('formModifyDialog.show_video', -1)" class="add-strategy-img-clear"
- style="color: #fff; background-color: #ff4949;">×</div>
- </div>
- <input type="file" ref="modifyVideoUploadInput" style="display:none" accept=".mp4"
- @change="uploadModifyImageVideo($event, 'video', -1)" />
- </div>
- </el-form-item>
- <el-form-item label="选择地点" :required="true" :label-width="formLabelWidth" prop="rtownId">
- <el-select v-model="formModifyDialog.rtownId" @change="handleModifyAdressStrategy('change')" placeholder="请选择地点">
- <el-option v-for="item in formModifyDialog.rtownOptions" :key="item.id" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" :required="true" :label-width="formLabelWidth" prop="hotelIds">
- <div style="display: flex; flex-wrap: wrap; justify-content: space-between;">
- <div v-for="(hotel, index) in formModifyDialog.hotelNames" :label="hotel.name" :key="hotel.id">
- <viewer>
- <div class="hotel-box" :class="{'bg-color': hotel.checked}">
- <img :src="hotel.coverImg" style="width: 114px; height: 70px; border-radius: 5px;">
- <div class="hotel-box-txt" @click="getModifyHotelIds(index, hotel.id)">
- <div style="margin: 0 0 10px 0;" class="hotel-list">{{hotel.name}}</div>
- <div v-if="hotel.type == 1" class="hotel-list">银宿级</div>
- <div v-else-if="hotel.type == 2" class="hotel-list">金宿级</div>
- <div v-else-if="hotel.type == 3" class="hotel-list">白金级</div>
- <div v-else class="hotel-list">等级未知</div>
- </div>
- </div>
- </viewer>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="是否置顶" :label-width="formLabelWidth">
- <el-switch v-model="formModifyDialog.istop" active-color="#096562" inactive-color="#ff4949"></el-switch>
- </el-form-item>
- </el-form>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="add-info-cancel-btn" @click="dialogModifyVisible = false">取 消</el-button>
- <el-button class="add-info-confirm-btn" @click="handleModifyStrategy">确 认</el-button>
- </div>
- </el-dialog>
- <!-- 删除攻略确认对话框 -->
- <el-dialog custom-class="el-dialog-delete-account" :visible.sync="dialogDeleteVisible" :close-on-click-modal="false" :close-on-press-escape="false"
- :show-close="false">
- <div slot="" class="del-account-body">
- <img src="../../icons/serveAC/del_warning.png" alt="">
- <div class="del-account-body-txt">是否确定从列表中删除?</div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="add-user-cancel-btn" @click="dialogDeleteVisible = false"> 否 </el-button>
- <el-button class="add-user-confirm-btn" @click="dialogDeleteStrategy"> 是 </el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getTableData,
- setTop,
- getTown,
- getHotels,
- getPublisher,
- uploadFiles,
- insertStrategy,
- updateStrategy,
- delStrategy,
- bindingPublisher,
- publisherList
- } from '@/api/strategyMgr'
- import {
- isEmpty,
- cos
- } from '@/js/common'
- import {
- valid
- } from 'mockjs'
- import COS from 'cos-js-sdk-v5'
- import {
- config
- } from '@vue/test-utils'
- export default {
- data() {
- return {
- videoList: [],
- currentUserLevel: this.$store.state.user.level, // 当前用户的权限
- //currentUserCreateId: this.$store.state.user.create_id, // 当前用户的createId
- currentUserId: this.$store.state.user.user_id, // 当前用户的userId
- formLabelWidth: '100px',
- // 表格单元格样式
- cell_style: {
- color: '#1A202B',
- 'font-size': '14px',
- 'font-family': 'Microsoft YaHei-3970(82674968)'
- },
- // 表格头部样式
- header_cell_style: {
- background: '#E6ECFE',
- color: '#1A202B',
- 'font-size': '16px',
- 'font-family': 'Microsoft YaHei-3970(82674968)'
- },
- addDialogFormRules: { // 新增攻略验证规则
- title: [{
- required: true,
- message: '请输入标题',
- trigger: 'blur'
- }, {
- pattern: /^[\s\S]*[\u4e00-\u9fa5]{2,}[\s\S]*$/,
- message: '至少2个汉字,其它字符不限',
- trigger: 'blur'
- }],
- publisher: [{
- required: true,
- message: '请选择发布人',
- trigger: 'blur'
- }, {
- required: true,
- message: '请选择发布人',
- trigger: 'change'
- }],
- content: [{
- required: true,
- message: '请输入内容',
- trigger: 'blur'
- }, {
- pattern: /^[\s\S]*[\u4e00-\u9fa5]{3,}[\s\S]*$/,
- message: '至少3个汉字,其它字符不限',
- trigger: 'blur'
- }],
- imgs: [{
- required: true,
- message: '请选择图片或视频',
- trigger: 'blur'
- }, {
- validator: this.validateImgVideo,
- trigger: 'blur'
- }],
- rtownId: [{
- required: true,
- message: '请选择乡镇',
- trigger: 'blur'
- }],
- hotelIds: [{
- required: true,
- message: '请选择民宿',
- trigger: 'change'
- }]
- },
- // 富文本编辑器配置
- editorOption: {
- modules: {
- toolbar: [
- ['bold', 'italic', 'underline', 'strike'], // 加粗、斜体、下划线、删除线按钮
- [{
- 'list': 'ordered'
- }, {
- 'list': 'bullet'
- }], // 有序列表和无序列表按钮
- [{
- 'indent': '-1'
- }, {
- 'indent': '+1'
- }], // 减少缩进和增加缩进按钮
- [{
- 'size': ['small', false, 'large', 'huge']
- }], // 自定义下拉菜单,表示字体大小
- [{
- 'color': []
- }, {
- 'background': []
- }], // 下拉菜单,使用主题中的默认颜色和背景色
- [{
- 'align': []
- }], // 下拉菜单,选择对齐方式
- ['clean'] // 清除格式按钮,移除所有格式
- ]
- },
- placeholder: '请输入内容'
- },
- modifyDialogFormRules: { // 编辑周边验证规则
- title: [{
- required: true,
- message: '请输入标题',
- trigger: 'blur'
- }, {
- pattern: /^[\s\S]*[\u4e00-\u9fa5]{2,}[\s\S]*$/,
- message: '至少2个汉字,其它字符不限',
- trigger: 'blur'
- }],
- publisher: [{
- required: true,
- message: '请选择发布人',
- trigger: 'blur'
- }, {
- required: true,
- message: '请选择发布人',
- trigger: 'change'
- }],
- content: [{
- required: true,
- message: '请输入内容',
- trigger: 'blur'
- }, {
- pattern: /^[\s\S]*[\u4e00-\u9fa5]{3,}[\s\S]*$/,
- message: '至少3个汉字,其它字符不限',
- trigger: 'blur'
- }],
- imgs: [{
- required: true,
- message: '请选择图片或视频',
- trigger: 'blur'
- }, {
- validator: this.validateModifyImgVideo,
- trigger: 'blur'
- }],
- rtownId: [{
- required: true,
- message: '请选择乡镇',
- trigger: 'blur'
- }],
- hotelIds: [{
- required: true,
- message: '请选择民宿',
- trigger: 'change'
- }]
- },
- // 查询数据
- formInline: {
- key: ''
- },
- publisherSearch: {
- key: ''
- }, // 搜索用户名
- bindedPublisherIds: '', // 绑定的用户ids
- videoOptions: {
- playbackRates: [0.5, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0], //播放速度
- autoplay: false, // 如果true,浏览器准备好时开始回放。
- muted: false, // 默认情况下将会消除任何音频。
- loop: false, // 导致视频一结束就重新开始。
- preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
- language: "zh-CN",
- aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
- fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
- sources: [{
- withCredentials: false,
- type: "video/mp4", // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
- src: '', // https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4
- }],
- controls: true,
- hls: true,
- poster: "", // 你的封面地址
- notSupportedMessage: "此视频暂无法播放,请稍后再试", // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
- controlBar: {
- progressControl: true,
- currentTimeDisplay: true,
- timeDivider: true,
- durationDisplay: true,
- remainingTimeDisplay: false,
- fullscreenToggle: true, // 全屏按钮
- },
- flash: {
- hls: {
- withCredentials: false
- }
- },
- html5: {
- hls: {
- withCredentials: false
- }
- }
- },
- addVideoUploadFileDisable: false, // 添加视频无效
- addImgsUploadFileDisable: false, // 添加图片无效
- modifyVideoUploadFileDisable: false, // 修改添加视频无效
- modifyImgsUploadFileDisable: false, // 修改添加图片无效
- options: [],
- formAddDialog: {
- title: '',
- publisher: '',
- content: '',
- rtownId: '',
- rtownOptions: [],
- hotelIds: [],
- hotelNames: [],
- showHotels: false,
- imgIndex: '',
- imgs: [{
- id: 1,
- img: ''
- }, {
- id: 2,
- img: ''
- }, {
- id: 3,
- img: ''
- }, {
- id: 4,
- img: ''
- }, {
- id: 5,
- img: ''
- }, {
- id: 6,
- img: ''
- }, {
- id: 7,
- img: ''
- }, {
- id: 8,
- img: ''
- }, {
- id: 9,
- img: ''
- }],
- show_video: '',
- post_video: '',
- istop: false
- },
- formModifyDialog: {
- id: '',
- title: '',
- publisher: '',
- content: '',
- rtownId: '',
- rtownOptions: [],
- hotelIds: [],
- hotelNames: [],
- showHotels: false,
- imgIndex: '',
- imgs: [{
- id: 1,
- img: ''
- }, {
- id: 2,
- img: ''
- }, {
- id: 3,
- img: ''
- }, {
- id: 4,
- img: ''
- }, {
- id: 5,
- img: ''
- }, {
- id: 6,
- img: ''
- }, {
- id: 7,
- img: ''
- }, {
- id: 8,
- img: ''
- }, {
- id: 9,
- img: ''
- }],
- show_video: '',
- post_video: '',
- istop: false
- },
- tableData: [], // 攻略分页列表
- tableData_publisher: [], // 发布人列表
- cond_data: {},
- // 分页参数
- pagination: {
- currentPage: 1,
- pageSize: 9,
- total: 0
- },
- loading: true,
- setPublisherVisible: false, // 发布人设置
- dialogAddStrategyVisible: false, // 新增攻略
- dialogModifyVisible: false, // 修改攻略
- dialogDeleteVisible: false, // 删除确认对话框
- delStrategyId: '', // 要删除的攻略id
- cosVal: {
- SecretId: "AKIDJSP9gz469yZv77tQjotsgHguvjIgtvkL",
- SecretKey: "b3MVRD1g8RYS9g195oMkvukQvDKZfbOz",
- SecurityToken: "1320402385",
- Bucket: "jinganminsu-1320402385",
- Region: "ap-nanjing",
- }
- }
- },
- created() {
- // 检测权限
- if (this.currentUserLevel !== 2) {
- this.$router.replace({
- path: '/data'
- })
- return
- }
- // 获取消费记录,表格数据
- this.get_table_data('list');
- // 绑定的发布人列表
- this.getPublisherOptions();
- this.getTown();
- this.videoList.push({
- playerOptions: {
- playbackRates: [0.5, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0], //播放速度
- autoplay: false, // 如果true,浏览器准备好时开始回放。
- muted: false, // 默认情况下将会消除任何音频。
- loop: false, // 导致视频一结束就重新开始。
- preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
- language: "zh-CN",
- aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
- fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
- sources: [{
- withCredentials: false,
- type: "video/mp4", // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
- src: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
- }],
- controls: true,
- hls: true,
- poster: "", // 你的封面地址
- notSupportedMessage: "此视频暂无法播放,请稍后再试", // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
- controlBar: {
- progressControl: true,
- currentTimeDisplay: true,
- timeDivider: true,
- durationDisplay: true,
- remainingTimeDisplay: false,
- fullscreenToggle: true, // 全屏按钮
- },
- flash: {
- hls: {
- withCredentials: false
- }
- },
- html5: {
- hls: {
- withCredentials: false
- }
- }
- }
- })
- },
- watch: {
- dialogAddStrategyVisible(newVal, oldVal) {
- if (newVal == true) {
- this.$nextTick(() => {
- this.$refs.addDialogForm.resetFields(); // 重置表单
- for (let i = 0; i < 9; i++) {
- this.del_local_display_img('formAddDialog.img', i);
- }
- this.del_local_display_img('formAddDialog.show_video', -1);
- });
- }
- }
- },
- mounted() {
- document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳至";
- document.addEventListener('fullscreenchange', this.handleFullScreenChange);
- },
- beforeDestroy() {
- document.removeEventListener('fullscreenchange', this.handleFullScreenChange);
- },
- methods: {
- // 绑定 或 解绑发布人
- bindingPuhlisherIds(id, param) {
- if (param == 'add') {
- if (this.bindedPublisherIds == '') {
- this.bindedPublisherIds = id;
- } else {
- this.bindedPublisherIds = this.bindedPublisherIds + ',' + id;
- }
- } else if (param == 'del') {
- if (this.bindedPublisherIds.includes(id + ',')) {
- this.bindedPublisherIds = this.bindedPublisherIds.replace(id + ',', '');
- } else if (this.bindedPublisherIds.includes(',' + id)) {
- this.bindedPublisherIds = this.bindedPublisherIds.replace(',' + id, '');
- } else {
- this.bindedPublisherIds = this.bindedPublisherIds.replace(id, '');
- //this.$message.warning('至少保留一个发布人');
- //return
- }
- }
- let data = {
- id: this.currentUserId,
- userId: this.bindedPublisherIds
- }
- let that = this;
- bindingPublisher(data).then((res) => {
- if (res.code === 200) {
- if (param == 'add') {
- that.$message.success('绑定成功')
- } else if (param == 'del') {
- that.$message.success('解绑成功')
- }
- // 发布人列表
- that.showSetPublisher()
- // 绑定的发布人列表
- this.getPublisherOptions();
- } else {
- that.$message.warning(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- },
- // 发布人列表
- showSetPublisher() {
- let that = this;
- publisherList(that.currentUserId).then((res) => {
- // console.log(res.data.pageList);
- if (res.code === 200) {
- let tempData = res.data.pageList;
- that.tableData_publisher = [];
- if (typeof tempData !== 'undefined' && tempData !== '') {
- let ids = '';
- for (let i = 0; i < tempData.length; i++) {
- let tdata = {
- xuhao: i + 1,
- id: tempData[i].id,
- name: tempData[i].user_name,
- mark: tempData[i].mark
- };
- that.tableData_publisher.push(tdata);
- if (tempData[i].mark == 1) {
- ids = ids + tempData[i].id + ',';
- }
- }
- that.bindedPublisherIds = ids.substring(0, ids.length - 1);
- } else {
- that.tableData_publisher = [];
- that.$message.warning('没有符合条件的数据!')
- }
- } else {
- that.tableData_publisher = [];
- that.$message.warning('没有符合条件的数据!')
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- // 显示对话框窗口
- that.setPublisherVisible = true;
- },
- // 获取发布人
- getPublisherOptions() {
- var that = this;
- getPublisher(this.currentUserId).then((res) => {
- // console.log(res.data.pageList);
- if (res.code === 200) {
- let tempData = res.data.pageList;
- if (typeof tempData !== 'undefined' && tempData !== '') {
- that.options = []
- for (var i = 0; i < tempData.length; i++) {
- let tmp = {
- publisher: tempData[i].id,
- label: tempData[i].user_name
- }
- that.options.push(tmp)
- }
- that.options.sort((a, b) => a.label.localeCompare(b.label))
- } else {
- that.options = []
- that.$message.warning('没有符合条件的数据!')
- }
- } else {
- that.options = []
- that.$message.warning('没有符合条件的数据!')
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- },
- // 验证图片和视频必须选择一个
- validateImgVideo(rule, value, callback) {
- let imgsEmpty = true;
- for (let i = 0; i < this.formAddDialog.imgs.length; i++) {
- if (this.formAddDialog.imgs[i].img !== '') {
- imgsEmpty = false;
- }
- };
- if (!this.formAddDialog.show_video && imgsEmpty) {
- callback(new Error('图片/视频需要选择一项'));
- } else {
- callback();
- }
- },
- validateModifyImgVideo(rule, value, callback) {
- let imgsEmpty = true;
- for (let i = 0; i < this.formModifyDialog.imgs.length; i++) {
- if (this.formModifyDialog.imgs[i].img !== '') {
- imgsEmpty = false;
- }
- };
- if (!this.formModifyDialog.show_video && imgsEmpty) {
- callback(new Error('图片/视频需要选择一项'));
- } else {
- callback();
- }
- },
- handleSetTop(id, istop) {
- if (typeof id == 'undefined' || id == '') {
- this.$message.error('id值无效!');
- return;
- }
- var that = this;
- setTop(id, istop).then((res) => {
- if (res.code === 200) {
- that.get_table_data('list')
- if (istop == 1) {
- that.$message.success('置顶成功!')
- } else {
- that.$message.success('取消置顶成功!')
- }
- } else {
- that.$message.warning(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- },
- // 全屏
- handleFullScreenChange() {
- if (!document.fullscreenElement) {
- // 退出全屏逻辑
- this.playering.pause()
- }
- },
- // 定义点击播放按钮,自动全屏化的方法
- full(e) {
- // 做兼容处理
- if (e.requestFullscreen) {
- e.requestFullscreen()
- } else if (e.mozRequestFullScreen) {
- e.mozRequestFullScreen()
- } else if (e.msRequestFullscreen) {
- e.msRequestFullscreen()
- } else if (e.oRequestFullscreen) {
- e.oRequestFullscreen()
- } else if (e.webkitRequestFullscreen) {
- e.webkitRequestFullScreen()
- } else {
- // var docHtml = document.documentElement;
- // var docBody = document.body;
- var videobox = document.getElementsByClassName('video-player')
- var cssText = 'width:100%;height:100%;overflow:hidden;'
- // docHtml.style.cssText = cssText;
- // docBody.style.cssText = cssText;
- videobox.style.cssText = cssText + ';' + 'margin:0px;padding:0px;'
- document.IsFullScreen = true
- }
- },
- /**
- * 获取攻略记录,表格数据
- */
- get_table_data(param) {
- this.loading = true
- this.get_condtion();
- let data = this.cond_data;
- if (param == 'search') {
- data.page = 1
- this.pagination.currentPage = 1
- }
- var that = this;
- // console.log(data);
- getTableData(data).then((res) => {
- // console.log(res.data.pageList);
- if (res.code === 200) {
- let tempData = res.data.pageList;
- if (typeof tempData !== 'undefined' && tempData !== '') {
- that.pagination.total = res.data.total
- that.tableData = []
- for (var i = 0; i < tempData.length; i++) {
- tempData[i].xuhao = (that.pagination.currentPage - 1) * that.pagination.pageSize + i + 1
- tempData[i].createDate = tempData[i].createDate.substring(0, tempData[i].createDate.length - 2)
- if (typeof tempData[i].video !== 'undefined') {
- let tmpOption = JSON.parse(JSON.stringify(that.videoOptions))
- tmpOption.sources[0].src = tempData[i].video
- tempData[i].video = tmpOption
- }
- that.tableData.push(tempData[i])
- }
- } else {
- that.tableData = []
- that.$message.warning('没有符合条件的数据!')
- }
- } else {
- that.tableData = []
- that.$message.warning('没有符合条件的数据!')
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- that.loading = false;
- },
- getTown() {
- var that = this;
- getTown().then((res) => {
- if (res.code === 200) {
- that.formAddDialog.rtownOptions = res.data
- that.formModifyDialog.rtownOptions = res.data
- } else {
- that.$message.warning(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- that.$message.error(err.message)
- });
- },
- // 定义点击播放按钮,调用全屏化的方法
- onPlayerPlay(player) {
- // console.log('player play===>>>', player)
- this.playering = player
- this.full(player)
- },
- // 添加/修改 对话框单击上传图片
- openImageUploadDialog(index, param) {
- if (param == 'add') {
- if (this.addImgsUploadFileDisable == true) {
- this.$message.warning('图片 和 视频只能选其一');
- return;
- }
- this.formAddDialog.imgIndex = index;
- this.$refs.addImageUploadInput.click();
- } else if (param == 'modify') {
- if (this.modifyImgsUploadFileDisable == true) {
- this.$message.warning('图片 和 视频只能选其一');
- return;
- }
- this.formModifyDialog.imgIndex = index;
- this.$refs.modifyImageUploadInput.click();
- }
- },
- // 添加/修改 对话框单击上传视频
- openVideoUploadDialog(param) {
- if (param == 'add') {
- if (this.addVideoUploadFileDisable == true) {
- this.$message.warning('图片 和 视频只能选其一');
- return;
- }
- this.$refs.addVideoUploadInput.click();
- } else if (param == 'modify') {
- if (this.modifyVideoUploadFileDisable == true) {
- this.$message.warning('图片 和 视频只能选其一');
- return;
- }
- this.$refs.modifyVideoUploadInput.click();
- }
- },
- // 修改对话框单击上传详情图
- openImageDetailUploadDialog_modify() {
- this.$refs.modifyImageDetailUploadInput.click();
- },
- // 攻略新增上传文件
- uploadImageVideo(event, imgOrVideo, index) {
- // 点击取消,长度为0
- if (event.target.files.length == 0)
- return;
- const file = event.target.files[0];
- const key = `/uploads/gonglue/${new Date().getTime()}`; // 设置上传到 COS 后的文件名
- var that = this
- const cos = new COS(that.cosVal);
- cos.putObject({
- Bucket: "jinganminsu-1320402385",
- Region: "ap-nanjing",
- Key: key,
- Body: file,
- },
- function(err, data) {
- if (err) {
- // console.error(err);
- that.$message.error(err);
- if (imgOrVideo == 'img') {
- that.$set(that.formAddDialog.imgs[index], 'img', '')
- } else {
- that.$set(that.formAddDialog, 'video', '')
- }
- return;
- } else {
- // console.log(data);
- if (!isEmpty(`${data.Location}`)) {
- if (imgOrVideo == 'img') {
- that.$set(that.formAddDialog.imgs[index], 'img', `https://${data.Location}`)
- } else {
- var tmpOption = that.videoOptions
- tmpOption.sources[0].src = `https://${data.Location}`
- that.$set(that.formAddDialog, 'show_video', tmpOption)
- that.$set(that.formAddDialog, 'post_video', `https://${data.Location}`)
- }
- } else {
- if (imgOrVideo == 'img') {
- that.$set(that.formAddDialog.imgs[index], 'img', '')
- } else {
- that.$set(that.formAddDialog, 'show_video', '')
- }
- }
- }
- event.target.value = null;
- that.onlyOneFileClass('add');
- }
- );
- },
- // 添加攻略时,只能添加图片或视频中的一种,不能两个同时上传
- onlyOneFileClass(param) {
- if (param == 'add') {
- let imgsEmpty = true;
- let tmpImgs = this.formAddDialog.imgs;
- for (let i = 0; i < tmpImgs.length; i++) {
- if (tmpImgs[i].img !== '') {
- imgsEmpty = false;
- }
- };
- if (!imgsEmpty) {
- this.addVideoUploadFileDisable = true;
- } else {
- this.addVideoUploadFileDisable = false;
- }
- if (this.formAddDialog.show_video) {
- this.addImgsUploadFileDisable = true;
- } else {
- this.addImgsUploadFileDisable = false;
- }
- } else {
- let imgsEmpty = true;
- let tmpImgs = this.formModifyDialog.imgs;
- for (let i = 0; i < tmpImgs.length; i++) {
- if (tmpImgs[i].img !== '') {
- imgsEmpty = false;
- }
- };
- if (!imgsEmpty) {
- this.modifyVideoUploadFileDisable = true;
- } else {
- this.modifyVideoUploadFileDisable = false;
- }
- if (this.formModifyDialog.show_video) {
- this.modifyImgsUploadFileDisable = true;
- } else {
- this.modifyImgsUploadFileDisable = false;
- }
- }
- },
- // 攻略修改上传文件
- uploadModifyImageVideo(event, imgOrVideo, index) {
- // 点击取消,长度为0
- if (event.target.files.length == 0)
- return;
- const file = event.target.files[0];
- const key = `/uploads/gonglue/${new Date().getTime()}`; // 设置上传到 COS 后的文件名
- var that = this
- const cos = new COS(this.cosVal);
- cos.putObject({
- Bucket: "jinganminsu-1320402385",
- Region: "ap-nanjing",
- Key: key,
- Body: file,
- },
- function(err, data) {
- if (err) {
- // console.error(err);
- that.$message.error(err);
- if (imgOrVideo == 'img') {
- that.$set(that.formModifyDialog.imgs[index], 'img', '')
- } else {
- that.$set(that.formModifyDialog, 'show_video', '')
- }
- return;
- } else {
- // console.log(data);
- if (!isEmpty(`${data.Location}`)) {
- if (imgOrVideo == 'img') {
- that.$set(that.formModifyDialog.imgs[index], 'img', `https://${data.Location}`)
- } else {
- var tmpOption = this.videoOptions
- tmpOption.sources[0].src = `https://${data.Location}`
- that.$set(that.formModifyDialog, 'show_video', tmpOption)
- that.$set(that.formModifyDialog, 'post_video', `https://${data.Location}`)
- }
- } else {
- if (imgOrVideo == 'img') {
- that.$set(that.formModifyDialog.imgs[index], 'img', '')
- } else {
- that.$set(that.formModifyDialog, 'show_video', '')
- }
- }
- }
- event.target.value = null;
- that.onlyOneFileClass('modify');
- }
- );
- },
- // 删除本地显示的图片或视频
- del_local_display_img(param, index) {
- if (param === 'formAddDialog.img') {
- this.$set(this.formAddDialog.imgs[index], 'img', '');
- } else if (param === 'formAddDialog.show_video') {
- this.$set(this.formAddDialog, 'show_video', '');
- } else if (param === 'formModifyDialog.img') {
- this.$set(this.formModifyDialog.imgs[index], 'img', '');
- } else if (param === 'formModifyDialog.show_video') {
- this.$set(this.formModifyDialog, 'show_video', '');
- this.$set(this.formModifyDialog, 'post_video', '');
- }
- this.onlyOneFileClass('add');
- },
- // 获取民宿ids
- getHotelIds(index, id) {
- this.formAddDialog.hotelNames[index].checked = !this.formAddDialog.hotelNames[index].checked;
- if (this.formAddDialog.hotelNames[index].checked == true) {
- this.formAddDialog.hotelIds.push(id);
- } else {
- let newArr = this.formAddDialog.hotelIds.filter(item => item !== id);
- this.formAddDialog.hotelIds = newArr;
- }
- },
- // 获取修改民宿ids
- getModifyHotelIds(index, id) {
- this.formModifyDialog.hotelNames[index].checked = !this.formModifyDialog.hotelNames[index].checked;
- if (this.formModifyDialog.hotelNames[index].checked == true) {
- this.formModifyDialog.hotelIds.push(id);
- } else {
- let newArr = this.formModifyDialog.hotelIds.filter(item => item !== id);
- this.formModifyDialog.hotelIds = newArr;
- }
- },
- // 添加地点,选择乡镇后显示民宿
- handleAddAdressStrategy() {
- var that = this;
- if (this.formAddDialog.rtownId !== '') {
- getHotels(this.formAddDialog.rtownId).then((res) => {
- // console.log(res);
- if (res.code == 200) {
- that.formAddDialog.showHotels = true;
- for (let i = 0; i < res.data.pageList.length; i++) {
- res.data.pageList[i].checked = false;
- }
- that.formAddDialog.hotelNames = res.data.pageList;
- } else {
- that.$message.error(res.message)
- }
- })
- }
- },
- // 编辑地点,选择乡镇后显示民宿
- handleModifyAdressStrategy(param) {
- var that = this;
- if (that.formModifyDialog.rtownId !== '') {
- getHotels(that.formModifyDialog.rtownId).then((res) => {
- // console.log(res);
- if (res.code == 200) {
- let tmpdata = res.data.pageList;
- that.formModifyDialog.showHotels = true;
- if (param == 'change') {
- that.$set(that.formModifyDialog, 'hotelIds', [])
- for (let i = 0; i < tmpdata.length; i++) {
- tmpdata[i].checked = false;
- }
- } else {
- for (let i = 0; i < tmpdata.length; i++) {
- let mhotelIds = that.formModifyDialog.hotelIds;
- let tf = false;
- for (let j = 0; j < mhotelIds.length; j++) {
- if (tmpdata[i].id == mhotelIds[j]) {
- tf = true;
- }
- }
- tmpdata[i].checked = tf;
- }
- }
- that.formModifyDialog.hotelNames = tmpdata;
- } else {
- that.$message.error(res.message)
- }
- })
- }
- },
- // 添加攻略
- handleAddStrategy() {
- var that = this;
- var v = true;
- this.$refs.addDialogForm.validate(valid => {
- if (valid == false) {
- v = false;
- }
- });
- if (v == false || that.formAddDialog.rtownId == '' || that.formAddDialog.hotelIds.length == 0) {
- return;
- }
- that.formAddDialog.create_id = this.formAddDialog.publisher;
- var data = that.formAddDialog;
- insertStrategy(data).then((res) => {
- // console.log(res);
- if (res.code == 200) {
- that.get_table_data('list')
- that.dialogAddStrategyVisible = false
- that.$message.success('攻略添加成功!')
- that.resetFormAddDialog();
- } else {
- that.$message.error(res.message)
- }
- })
- },
- // 重置添加表单
- resetFormAddDialog() {
- this.formAddDialog = {
- title: '',
- publisher: '',
- content: '',
- rtownId: '',
- rtownOptions: this.formAddDialog.rtownOptions,
- hotelIds: [],
- hotelNames: [],
- showHotels: false,
- imgIndex: '',
- imgs: [{
- id: 1,
- img: ''
- }, {
- id: 2,
- img: ''
- }, {
- id: 3,
- img: ''
- }, {
- id: 4,
- img: ''
- }, {
- id: 5,
- img: ''
- }, {
- id: 6,
- img: ''
- }, {
- id: 7,
- img: ''
- }, {
- id: 8,
- img: ''
- }, {
- id: 9,
- img: ''
- }],
- show_video: '',
- post_video: '',
- create_id: '',
- istop: false
- }
- },
- // 编辑攻略
- handleModifyStrategy() {
- var that = this;
- var v = true;
- this.$refs.modifyDialogForm.validate(valid => {
- if (valid == false) {
- v = false;
- }
- });
- if (v == false || that.formModifyDialog.rtownId == '' || that.formModifyDialog.hotelIds.length == 0) {
- return;
- }
- that.formModifyDialog.create_id = this.formModifyDialog.publisher;
- var data = that.formModifyDialog;
- updateStrategy(data).then((res) => {
- // console.log(res);
- if (res.code == 200) {
- that.get_table_data('list')
- that.dialogModifyVisible = false
- that.$message.success('攻略修改成功!')
- that.resetFormModifyDialog();
- } else {
- that.$message.error(res.message)
- }
- });
- },
- // 重置修改表单变量
- resetFormModifyDialog() {
- this.formModifyDialog = {
- id: '',
- title: '',
- publisher: '',
- content: '',
- rtownId: '',
- rtownOptions: this.formModifyDialog.rtownOptions,
- hotelIds: [],
- hotelNames: [],
- showHotels: false,
- imgIndex: '',
- imgs: [{
- id: 1,
- img: ''
- }, {
- id: 2,
- img: ''
- }, {
- id: 3,
- img: ''
- }, {
- id: 4,
- img: ''
- }, {
- id: 5,
- img: ''
- }, {
- id: 6,
- img: ''
- }, {
- id: 7,
- img: ''
- }, {
- id: 8,
- img: ''
- }, {
- id: 9,
- img: ''
- }],
- show_video: '',
- post_video: '',
- istop: false
- }
- },
- /**
- * 新增攻略
- */
- add_strategy() {
- this.dialogAddStrategyVisible = true;
- this.resetFormAddDialog();
- },
- /**
- * 打开编辑攻略
- * @param {Object} row
- */
- handleModifyClick(row) {
- //console.log(row);
- this.resetFormModifyDialog();
- this.$set(this.formModifyDialog, 'id', row.id)
- this.$set(this.formModifyDialog, 'title', row.title)
- this.$set(this.formModifyDialog, 'publisher', row.userId)
- this.$set(this.formModifyDialog, 'rtownId', row.townId)
- let strArray = row.hotelId.split(',');
- let numArray = strArray.map(Number);
- this.$set(this.formModifyDialog, 'hotelIds', numArray)
- this.handleModifyAdressStrategy('none');
- this.$set(this.formModifyDialog, 'content', row.content)
- if (typeof row.image !== 'undefined') {
- let imgs = row.image;
- for (let i = 0; i < imgs.length; i++) {
- if (imgs[i] !== '') {
- this.$set(this.formModifyDialog.imgs[i], 'img', imgs[i])
- }
- }
- }
- if (row.isTop == 1) {
- this.$set(this.formModifyDialog, 'istop', true)
- } else {
- this.$set(this.formModifyDialog, 'istop', false)
- }
- if (typeof row.video !== 'undefined') {
- var tmpOption = JSON.parse(JSON.stringify(row.video));
- this.$set(this.formModifyDialog, 'show_video', tmpOption)
- this.$set(this.formModifyDialog, 'post_video', row.video.sources[0].src)
- }
- this.onlyOneFileClass('modify');
- this.dialogModifyVisible = true
- },
- /**
- * 显示删除攻略
- */
- handleDelClick(row) {
- this.delStrategyId = row.id;
- this.dialogDeleteVisible = true;
- },
- /**
- * 删除攻略记录
- */
- dialogDeleteStrategy() {
- var that = this;
- delStrategy(that.delStrategyId).then((res) => {
- // console.log(res);
- if (res.code == 200) {
- that.get_table_data('list');
- that.dialogDeleteVisible = false;
- that.$message.success('攻略删除成功!');
- } else {
- that.$message.error(res.message);
- }
- });
- },
- /**
- * 查询条件
- */
- get_condtion() {
- let data = {
- page: this.pagination.currentPage,
- rows: this.pagination.pageSize
- }
- if (this.formInline.key !== '') {
- data.key = this.formInline.key
- }
- this.cond_data = data;
- },
- /**
- * 搜索
- */
- btn_search() {
- this.get_table_data('search')
- },
- /**
- * currentPage 改变时会触发
- * @param {Object} val
- */
- currentPageChange(val) {
- this.pagination.currentPage = val
- this.get_table_data('pages')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .app-container {
- background-color: #EFF2F7;
- padding: 10px;
- .el-row {
- .el-col {
- padding: 10px;
- .cell {
- padding: 30px;
- border-radius: 10px;
- background-color: #FFFFFF;
- box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
- .cell-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 30px;
- padding-bottom: 30px;
- border-bottom: 1px solid #CCCCCC;
- .title-left {
- display: flex;
- align-items: center;
- .title {
- font-size: 22px;
- font-family: Microsoft YaHei-3970(82674968);
- font-weight: bold;
- color: #1A202B;
- }
- .title-detail {
- margin-left: 50px;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #1A202B;
- }
- }
- .title-right {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .el-button {
- width: 110px;
- height: 46px;
- background: #2B4CFE;
- font-size: 18px;
- color: #FFFFFF;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 5px;
- }
- .el-button--warning {
- background: #F88A64;
- }
- }
- }
- .cell-body {
- .controls {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .demo-form-inline {
- display: inline-flex;
- flex-wrap: wrap;
- align-items: center;
- justify-content: flex-start;
- .btn-search {
- background: rgba(9, 101, 98, 1);
- font-size: 14px;
- color: #FFFFFF;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 5px;
- border: none;
- }
- }
- .export {
- background: rgba(9, 101, 98, 1);
- font-size: 14px;
- color: #FFFFFF;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 5px;
- margin-bottom: 22px;
- border: none;
- }
- }
- .pagination-table {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- height: 30px;
- margin-top: 20px;
- .txt-notice {
- span {
- font-size: 28px;
- font-weight: 500;
- font-family: '微软雅黑';
- }
- }
- ::v-deep .el-pagination {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- ::v-deep .el-pagination ul {
- display: flex;
- }
- ::v-deep .el-pagination button,
- ::v-deep .el-pagination li {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 50px;
- height: 36px;
- border: 1px solid #626262;
- border-radius: 3px;
- font-size: 14px;
- margin: 0 5px;
- }
- ::v-deep .el-pagination span {
- margin-left: 10px;
- }
- ::v-deep .el-pagination .el-pagination__jump {
- font-size: 16px;
- }
- ::v-deep .el-pagination .el-pagination__editor {
- width: 50px;
- height: 36px;
- margin: 0 5px;
- }
- ::v-deep .el-pagination .el-input__inner {
- width: 50px;
- height: 36px;
- border: 1px solid #626262;
- margin: -4px 0 0 0;
- }
- }
- }
- }
- }
- }
- ::v-deep .el-dialog {
- margin: 0 !important;
- width: 600px;
- height: 560px;
- background: #FFFFFF;
- box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.29);
- border-radius: 6px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- .el-dialog__header {
- display: flex;
- align-items: center;
- width: 100%;
- height: 58px;
- padding: 30px;
- border-radius: 6px 6px 0px 0px;
- font-weight: bold;
- border-bottom: 1px solid rgba(230, 230, 230, 1);
- }
- .el-dialog__body {
- padding-bottom: 0;
- .el-form-item__label,
- .el-form-item__content {
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #53575A;
- }
- }
- // 删除对话框的样式
- .del-account-body {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 180px;
- img {
- width: 72px;
- }
- .del-account-body-txt {
- height: 58px;
- line-height: 58px;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #333333;
- }
- }
- .el-dialog__footer {
- padding-bottom: 0 !important;
- text-align: center;
- .el-button.el-button--default {
- width: 75px;
- height: 40px;
- border: 1px solid #2B4CFE;
- border-radius: 6px;
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #2B4CFE;
- }
- .el-button.el-button--primary {
- width: 75px;
- height: 40px;
- background: #2B4CFE;
- border-radius: 6px;
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #FFFFFF;
- margin-left: 60px;
- }
- }
- }
- }
- </style>
- <style>
- .perimeter-class {
- width: 900px !important;
- height: 760px !important;
- }
- .el-date-editor--daterange.el-input__inner {
- width: 280px !important;
- }
- .demo-table-expand {
- font-size: 0;
- }
- .demo-table-expand label {
- width: 180px;
- color: #99a9bf;
- }
- .demo-table-expand .el-form-item {
- margin-right: 0;
- margin-bottom: 0;
- width: 33%;
- }
- .show-imgs {
- display: flex;
- }
- .imgs {
- display: flex;
- flex-direction: row;
- margin-left: 20px;
- }
- .lbl-cls {
- display: inline-block;
- width: 100px;
- text-align: right;
- padding-right: 10px;
- color: #bbb;
- }
- .export {
- background: rgba(9, 101, 98, 1) !important;
- font-size: 14px !important;
- color: #FFFFFF !important;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 5px !important;
- margin-bottom: 22px !important;
- border: none !important;
- }
- .add-class {
- height: 450px !important;
- width: 800px !important;
- }
- .dialog-footer {
- display: flex;
- justify-content: flex-end;
- }
- .add-info-cancel-btn {
- color: rgba(9, 101, 98, 1) !important;
- border: 1px solid rgba(9, 101, 98, 1) !important;
- }
- .add-info-confirm-btn {
- border: none !important;
- background: rgba(9, 101, 98, 1) !important;
- color: #fff !important;
- border-radius: 5px !important;
- margin-left: 28px !important;
- }
- .el-form-item>label {
- color: rgba(128, 128, 128, 1) !important;
- }
- .custom-input {
- width: 7rem !important;
- }
- .custom-input input {
- width: 7rem !important;
- }
- .el-radio {
- margin-right: 10px;
- }
- .el-form-item {
- margin-bottom: 16px !important;
- }
- .add-dlg-class {
- width: 830px !important;
- height: 850px !important;
- }
- .el-carousel__indicators {
- display: none !important;
- }
- .el-tabs__item {
- width: 100px !important;
- text-align: center !important;
- font-size: 20px !important;
- }
- .el-tabs__item.is-active,
- .el-tabs__item:hover {
- color: rgba(9, 101, 98, 1) !important;
- }
- .el-tabs__active-bar {
- color: rgba(9, 101, 98, 1) !important;
- background-color: rgba(9, 101, 98, 1) !important;
- }
- .el-dialog-delete-account {
- height: 300px !important;
- width: 500px !important;
- }
- .el-dialog-delete-account .el-dialog__header {
- display: none !important;
- }
- .add-user-cancel-btn {
- color: rgba(9, 101, 98, 1) !important;
- border: 1px solid rgba(9, 101, 98, 1) !important;
- }
- .add-user-confirm-btn {
- border: none !important;
- background: rgba(9, 101, 98, 1) !important;
- color: #fff !important;
- border-radius: 5px !important;
- margin-left: 28px !important;
- }
- .ql-container {
- height: 150px;
- }
- .add-strategy-img {
- display: flex;
- justify-content: space-between;
- flex-flow: row wrap;
- }
- .add-strategy-img-box {
- position: relative;
- margin: 0 0 10px 0;
- width: 128px;
- height: 128px;
- border: dashed 1px #096562;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- border-radius: 5px;
- cursor: pointer;
- }
- .add-strategy-img-box-video {
- position: relative;
- margin: 0 0 10px 0;
- width: 128px;
- height: 128px;
- border: dashed 1px #096562;
- border-radius: 5px;
- cursor: pointer;
- border: 2px dashed #ff4949;
- }
- .add-strategy-img-plus {
- color: #096562;
- font-size: 30px;
- height: 30px;
- line-height: 30px;
- }
- .add-strategy-img-txt {
- color: #096562;
- }
- .add-strategy-img-clear {
- position: absolute;
- top: 5px;
- right: 5px;
- width: 22px;
- height: 22px;
- background: rgba(9, 108, 98, 1.0);
- border-radius: 50%;
- font-size: 22px;
- color: #fff;
- cursor: pointer;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .scroll-container::-webkit-scrollbar {
- width: 1px;
- /* 根据需要调整滚动条的宽度 */
- }
- .scroll-container::-webkit-scrollbar-track {
- background-color: #ccc;
- /* 设置滚动条轨道的颜色 */
- }
- .scroll-container::-webkit-scrollbar-thumb {
- background-color: rgba(9, 101, 98, 1);
- /* 设置滚动条滑块的颜色 */
- }
- .hotel-box {
- display: flex;
- align-items: center;
- margin: 5px 0;
- padding: 5px;
- cursor: pointer;
- border-radius: 5px;
- border: 1px solid #096562;
- }
- .hotel-box-txt {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- align-items: flex-start;
- font-size: 16px;
- padding: 10px;
- }
- .hotel-list {
- width: 186px;
- text-align: left;
- line-height: 1.2em;
- }
- .bg-color {
- color: #FFFFFF;
- background-color: #096562;
- }
- .configure-btn-position {
- display: flex;
- justify-content: flex-end;
- }
- .configure-btn {
- border: none !important;
- background: rgba(9, 101, 98, 1) !important;
- color: #fff !important;
- border-radius: 5px !important;
- }
- .action-btns {
- display: flex;
- justify-content: space-around;
- }
- .bg-btn {
- color: rgba(9, 101, 98, 1);
- }
- .add-ms-class {
- width: 400px !important;
- height: 280px !important;
- }
- .add-ms-class .el-input__inner {
- width: 220px !important;
- }
- </style>
|