adPlaceList.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. <template>
  2. <!-- 广告位管理 -->
  3. <div>
  4. <!-- 头部搜索框部分 -->
  5. <div class="title">
  6. <el-row>
  7. <el-col :span="6" class="left">
  8. <div class="searchBox">
  9. <div class="searchTitle">网站名称</div>
  10. <el-select v-model="webSiteName_id" :multiple="false" :multiple-limit="1" filterable remote
  11. reserve-keyword placeholder="请输入网站名称" clearable :remote-method="getWebNavLists"
  12. :loading="webSiteLoading" @change="selectWebSite">
  13. <el-option v-for="item in webSiteLists" :key="item.value" :label="item.label"
  14. :value="item.value">
  15. </el-option>
  16. </el-select>
  17. </div>
  18. </el-col>
  19. <el-col :span="6" class="left">
  20. <div class="searchBox">
  21. <div class="searchTitle">广告位名称</div>
  22. <el-input v-model="adPlaceName" class="input" clearable placeholder="请输入广告位名称"></el-input>
  23. </div>
  24. </el-col>
  25. <el-col :span="8" class="right">
  26. <div class="btnList">
  27. <button class="search" @click="goSearch">搜索</button>
  28. <button class="reset" @click="goReset">重置</button>
  29. </div>
  30. </el-col>
  31. </el-row>
  32. </div>
  33. <!--表格内容 start------------------------------------------------------------>
  34. <div class="layerBox">
  35. <tableTitle :name="tableDivTitle" />
  36. <button class="btn" @click="addWebsite">添加广告位</button>
  37. <el-row>
  38. <template>
  39. <el-table class="my-table" v-loading="loading" :data="tableData" style="width: 100%">
  40. <el-table-column fixed prop="id" label="编号" width="90">
  41. </el-table-column>
  42. <el-table-column prop="website_name" label="网站名称" width="160">
  43. </el-table-column>
  44. <el-table-column prop="name" label="广告位名称" width="220">
  45. </el-table-column>
  46. <el-table-column prop="type_name" label="广告类型" width="110">
  47. </el-table-column>
  48. <el-table-column prop="size" label="宽/高 (PX)" width="120">
  49. </el-table-column>
  50. <el-table-column prop="price" label="价格 (天)" width="110">
  51. </el-table-column>
  52. <el-table-column prop="created_at" label="创建时间" >
  53. </el-table-column>
  54. <el-table-column prop="updated_at" label="修改时间" >
  55. </el-table-column>
  56. <el-table-column fixed="right" label="操作" width="200">
  57. <template slot-scope="scope">
  58. <div class="listBtnBox">
  59. <div class="listEditBtn" @click="goEdit(scope.row.id, scope.row)"><i
  60. class="el-icon-edit-outline"></i>编辑</div>
  61. <div class="listLookBtn" @click="goLook(scope.row.id)"><i
  62. class="el-icon-view"></i>查看</div>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. <!-- <el-table-column prop="created_at" label="创建时间" width="190">
  67. </el-table-column>
  68. <el-table-column prop="updated_at" label="修改时间" width="190">
  69. </el-table-column> -->
  70. <!-- <el-table-column fixed="right" label="操作" width="300">
  71. <template slot-scope="scope">
  72. <div class="listBtnBox">
  73. <div class="listDeleteBtn" @click="deleteRow(scope.row.id)"><i
  74. class="el-icon-delete"></i>删除</div>
  75. <div class="listEditBtn" @click="goEdit(scope.row.id, scope.row)"><i
  76. class="el-icon-edit-outline"></i>编辑</div>
  77. <div class="listLookBtn" @click="goLook(scope.row.id)"><i
  78. class="el-icon-view"></i>查看</div>
  79. </div>
  80. </template>
  81. </el-table-column> -->
  82. </el-table>
  83. </template>
  84. </el-row>
  85. </div>
  86. <!--分页 start------------------------------------------------------------>
  87. <div class="alignBox">
  88. <el-row>
  89. <el-col :span="24">
  90. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  91. :current-page="page" :page-size="pageSize" layout="total, prev, pager, next, jumper"
  92. :total="total">
  93. </el-pagination>
  94. </el-col>
  95. </el-row>
  96. </div>
  97. <!--分页 end------------------------------------------------------------>
  98. <!--表格内容 end------------------------------------------------------------>
  99. <!-- 弹出框 编辑 start----------------------------------------------------------->
  100. <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" top="8vh"
  101. :close-on-click-modal="false">
  102. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  103. <div class="dialogText">
  104. <el-form-item label="网站名称:" prop="webName">
  105. <el-select v-model="ruleForm.webName" :multiple="false" :multiple-limit="1" filterable remote
  106. reserve-keyword placeholder="请输入网站名称" :remote-method="getWebNavList"
  107. :loading="webSiteLoading" @change="detectionWebSite" :disabled="disabledFields.webName">
  108. <el-option v-for="item in webSiteList" :key="item.value" :label="item.label"
  109. :value="item.value">
  110. </el-option>
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item label="广告位名称:" prop="adName">
  114. <el-input v-model="ruleForm.adName" placeholder="请输入广告位名称"></el-input>
  115. </el-form-item>
  116. <el-form-item label="广告位标识:" prop="adTag">
  117. <el-input v-model="ruleForm.adTag" placeholder="请输入广告位标识" :disabled="disabledFields.adTag"></el-input>
  118. </el-form-item>
  119. <el-form-item label="广告位介绍:" prop="adDesc">
  120. <el-input v-model="ruleForm.adDesc" type="textarea" :rows="2" placeholder="请输入广告位介绍"
  121. resize="none">
  122. </el-input>
  123. </el-form-item>
  124. <el-form-item label="广告示例图:" prop="adPhoto" :label-width="formLabelWidth"
  125. :class="['custom-form-item']" class="custom-align-right">
  126. <div class="uploaderBox">
  127. <!--图片上传组件 start ------------------------------------------------------------>
  128. <div class="avatar-upload-container" @mouseenter="hovering = true"
  129. @mouseleave="hovering = false">
  130. <!-- 上传组件 -->
  131. <el-upload class="avatar-uploader" action="#" :show-file-list="false"
  132. :before-upload="beforeAvatarUpload">
  133. <!-- 预览图片 -->
  134. <img v-if="logoUrl" :src="logoUrl" class="avatar">
  135. <div v-else class="chooseImgDiv">
  136. <div>
  137. <img src="@/assets/public/upload/noImage.png">
  138. <div>选择图片</div>
  139. </div>
  140. </div>
  141. <input type="hidden" name="logo" v-model="ruleForm.adPhoto">
  142. </el-upload>
  143. <!-- 删除按钮,当鼠标悬浮时显示 -->
  144. <div v-if="hovering && logoUrl" class="delete-button" @click="handleDelete">
  145. <i class="el-icon-delete"></i>
  146. </div>
  147. </div>
  148. <!--图片上传组件 end ------------------------------------------------------------>
  149. </div>
  150. </el-form-item>
  151. <el-form-item label="广告类型:" prop="adType">
  152. <el-radio v-model="ruleForm.adType" label='2' :disabled="disabledFields.adType">图片</el-radio>
  153. </el-form-item>
  154. <el-form-item label="广告位大小:" prop="adSize">
  155. <el-select v-model="ruleForm.adSize" placeholder="请选择广告位大小" @change="change" :disabled="disabledFields.adSize">
  156. <el-option v-for="item in options" :key="item.id" :label="item.size" :value="item.id" >
  157. </el-option>
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item label="价格:" prop="price">
  161. <el-input v-model="ruleForm.price" placeholder="请输入价格"></el-input>
  162. </el-form-item>
  163. <el-form-item label="状态:" prop="status">
  164. <el-radio v-model="ruleForm.status" label="1">通过</el-radio>
  165. <el-radio v-model="ruleForm.status" label="2">下架</el-radio>
  166. </el-form-item>
  167. </div>
  168. <div class="dialogBtn">
  169. <!-- <button class="cancel" @click="cancelForm">取消</button>
  170. <button class="submit" @click="submitForm">提交</button> -->
  171. <el-button type="info" @click="cancelForm">取消</el-button>
  172. <el-button type="primary" @click="submitForm">提交</el-button>
  173. </div>
  174. </el-form>
  175. </el-dialog>
  176. <!-- 弹出框 编辑 end----------------------------------------------------------->
  177. </div>
  178. </template>
  179. <script>
  180. //表格标题
  181. import tableTitle from './components/tableTitle.vue';
  182. //引入公用样式
  183. import '@/styles/global.less';
  184. import { createAdPlace, getAdPlaceList, delAdPlace, updateAdPlace, getAdList, getAdPlaceInfo, getSize } from '@/api/advertise'
  185. export default {
  186. components: {
  187. tableTitle,//表格标题-
  188. },
  189. data() {
  190. const validateEmpty = (rule, value, callback) => {
  191. if (value.length == 0) {
  192. callback(new Error('该项不能为空!'))
  193. } else {
  194. callback()
  195. }
  196. }
  197. return {
  198. tableDivTitle: "广告位列表", //列表标题
  199. dialogTableVisible: false, //编辑弹框
  200. dialogName: '编辑', //编辑弹窗名称
  201. loading: true, //加载中
  202. tableData: [],//表格数据
  203. // 可以输入的搜索框相关
  204. webSiteList: [],//获取关联网站列表
  205. webSiteLists: [],
  206. webSiteLoading: false,
  207. //3.4 上传logo图片
  208. logoUrl: '',
  209. hovering: false, // 鼠标悬浮状态 悬浮时显示删除
  210. value: '',
  211. //活动id
  212. activeid: "",
  213. // 分页相关
  214. page: 1,
  215. pageSize: 10,
  216. total: 0,
  217. options: [], //广告尺寸
  218. formLabelWidth: '', //广告示例图相关
  219. // 搜索框相关
  220. webSiteName_id: '', //网站名称id
  221. adPlaceName: '', //广告位名称
  222. website_id: "", //网站id
  223. disabledFields: {
  224. webName: false,
  225. adTag: false,
  226. adType: false,
  227. adSize: false
  228. },
  229. ruleForm: {
  230. webName: '', //网站名称
  231. adName: '', //广告位名称
  232. adTag: '', //广告位标识
  233. adDesc: '',//广告位介绍
  234. adPhoto: '', //广告示例图
  235. adType: '',//广告类型
  236. adSize: '', //广告位大小
  237. ad_size_id: 1, //广告位大小
  238. price: '', //价格
  239. status: '', //状态
  240. },
  241. rules: {
  242. webName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  243. adName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  244. adTag: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  245. adDesc: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  246. adPhoto: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  247. adType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  248. adSize: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  249. price: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  250. status: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  251. }
  252. }
  253. },
  254. methods: {
  255. //1.列表和分页相关 start ------------------------------------------------------------>
  256. //1.1 开始请求列表信息方法
  257. getData() {
  258. if (this.adPlaceName !== '' || this.webSiteName_id !== '') {
  259. getAdPlaceList({
  260. page: this.page,
  261. pageSize: this.pageSize,
  262. name: this.adPlaceName,
  263. website_id: this.webSiteName_id, //广告位名称 id
  264. }).then(data => {
  265. console.log(data);
  266. this.tableData = data.data.rows
  267. this.total = data.data.count
  268. for (let item of this.tableData) {
  269. item.size = item.width + 'x' + item.height
  270. if (item.typeid == 2) {
  271. item.type_name = '图文'
  272. } else if (item.typeid == 1) {
  273. item.type_name = '文字'
  274. }
  275. }
  276. })
  277. } else {
  278. getAdPlaceList({
  279. page: this.page,
  280. pageSize: this.pageSize
  281. }).then(data => {
  282. this.loading = false
  283. console.log(data.data.rows);
  284. this.tableData = data.data.rows
  285. this.total = data.data.count
  286. for (let item of this.tableData) {
  287. item.size = item.width + 'x' + item.height
  288. if (item.typeid == 2) {
  289. item.type_name = '图文'
  290. } else if (item.typeid == 1) {
  291. item.type_name = '文字'
  292. }
  293. }
  294. })
  295. }
  296. },
  297. //获取广告尺寸
  298. getSize() {
  299. getSize().then(data => {
  300. console.log(data.data);
  301. this.options = data.data
  302. for (let item of this.options) {
  303. item.size = item.width + 'x' + item.height
  304. }
  305. console.log(this.options);
  306. })
  307. },
  308. change(val) {
  309. console.log('val1111111111', val);
  310. this.ruleForm.ad_size_id = val
  311. console.log('this.ruleForm.adSize', this.ruleForm.adSize);
  312. },
  313. //1.2 删除内容
  314. deleteRow(id) {
  315. console.log(id);
  316. let data = new FormData()
  317. data.append('id', id)
  318. this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
  319. confirmButtonText: '确定',
  320. cancelButtonText: '取消',
  321. }).then(() => {
  322. console.log("当前删除:" + id)
  323. delAdPlace({
  324. id: id
  325. }).then(data => {
  326. console.log(data);
  327. if (data.code = 200) {
  328. this.$message({
  329. message: '删除成功',
  330. type: 'success'
  331. })
  332. this.getData()
  333. } else if (data.code == 0) {
  334. this.$message({
  335. message: data.message,
  336. type: 'error'
  337. })
  338. }
  339. })
  340. }).catch(() => {
  341. this.$message({
  342. type: 'warning',
  343. message: '已取消删除'
  344. });
  345. });
  346. },
  347. //1.3 查看示例图
  348. // goGraph() {
  349. // this.dialogVisible = true
  350. // },
  351. //1.4 列表内容分页
  352. //直接跳转
  353. handleSizeChange(val) {
  354. this.page = val;
  355. this.getData();
  356. },
  357. //1.5 点击分页
  358. handleCurrentChange(val) {
  359. this.page = val;
  360. this.getData();
  361. },
  362. // 1.6 搜索按钮
  363. goSearch() {
  364. getAdPlaceList({
  365. page: this.page,
  366. pageSize: this.pageSize,
  367. name: this.adPlaceName,
  368. website_id: this.webSiteName_id, //广告位名称 id
  369. }).then(data => {
  370. console.log(data);
  371. this.tableData = data.data.rows
  372. this.total = data.data.count
  373. for (let item of this.tableData) {
  374. item.size = item.width + 'x' + item.height
  375. if (item.typeid == 2) {
  376. item.type_name = '图文'
  377. } else if (item.typeid == 1) {
  378. item.type_name = '文字'
  379. }
  380. }
  381. })
  382. },
  383. //1.7 重置按钮
  384. goReset() {
  385. this.webSiteName_id = ""
  386. this.adPlaceName = ""
  387. this.getData()
  388. },
  389. //列表和分页相关 end ------------------------------------------------------------>
  390. //1.8 编辑
  391. goEdit(id, val) {
  392. // console.log(id);
  393. this.dialogName = '编辑'
  394. this.activeid = id
  395. this.dialogTableVisible = true
  396. console.log(id, val);
  397. // console.log("状态", val.status);
  398. // 检查 website_column_arr_id 数组是否包含 2
  399. const shouldDisable = val.website_column_arr_id && val.website_column_arr_id.includes(2);
  400. this.disabledFields = {
  401. webName: shouldDisable,
  402. adTag: shouldDisable,
  403. adType: shouldDisable,
  404. adSize: shouldDisable
  405. };
  406. //数据回显
  407. this.website_id = val.website_id
  408. this.ruleForm.webName = val.website_name //网站名称
  409. this.ruleForm.adName = val.name //广告位名称
  410. this.ruleForm.adTag = val.ad_tag //广告位标识
  411. this.ruleForm.adDesc = val.introduce //广告位介绍
  412. this.logoUrl = val.thumb //广告示例图
  413. this.ruleForm.adPhoto = val.thumb //广告示例图
  414. this.ruleForm.price = val.price //价格
  415. this.ruleForm.status = val.status //状态
  416. this.ad_size_id=val.ad_size_id //广告尺寸
  417. this.ruleForm.adSize=val.width+'x'+val.height //广告尺寸
  418. if (val.typeid == 2) {
  419. this.ruleForm.adType = '2' //广告类型
  420. }
  421. if (val.status == 1) {
  422. this.ruleForm.status = '1' //状态
  423. } else if (val.status == 2) {
  424. this.ruleForm.status = '2' //状态
  425. }
  426. },
  427. //1.9 查看
  428. goLook(id) {
  429. this.activeid = id
  430. this.$router.push({
  431. path: '/adPlaceDetail',
  432. query: {
  433. id: this.activeid
  434. }
  435. })
  436. },
  437. //2.0 添加
  438. addWebsite() {
  439. this.dialogTableVisible = true
  440. this.dialogName = "添加"
  441. //添加时清空回显回来的数据
  442. this.ruleForm.webName = '' //网站名称
  443. this.ruleForm.adName = '' //广告位名称
  444. this.ruleForm.adTag = '' //广告位标识
  445. this.ruleForm.adDesc = '' //广告位介绍
  446. this.ruleForm.adPhoto = '' //广告示例图
  447. this.ruleForm.adSize = '' //广告尺寸
  448. this.ruleForm.adType = '2' //广告类型
  449. this.ruleForm.price = '' //价格
  450. this.ruleForm.status = '' //状态
  451. this.logoUrl = ''
  452. },
  453. // 2.1 弹出层相关方法
  454. // 提交表单
  455. submitForm() {
  456. // 判断用户是否输入数据
  457. if (this.ruleForm.webName == '') {
  458. this.$message({
  459. message: '请将数据填写完整',
  460. type: 'error'
  461. })
  462. return
  463. }
  464. if (this.ruleForm.adTag == '') {
  465. this.$message({
  466. message: '请将数据填写完整',
  467. type: 'error'
  468. })
  469. return
  470. }
  471. if (this.dialogName == "添加") {
  472. createAdPlace({
  473. name: this.ruleForm.adName,
  474. website_id: this.website_id,
  475. ad_tag: this.ruleForm.adTag,
  476. price: this.ruleForm.price,
  477. thumb: this.ruleForm.adPhoto,
  478. typeid: this.ruleForm.adType,
  479. ad_size_id: this.ruleForm.adSize,
  480. status: this.ruleForm.status,
  481. introduce: this.ruleForm.adDesc,
  482. }).then(data => {
  483. console.log(data);
  484. if (data.code == 200) {
  485. this.$message({
  486. message: '添加成功',
  487. type: 'success'
  488. })
  489. this.dialogTableVisible = false
  490. this.getData()
  491. } else if (data.code == 0) {
  492. this.$message({
  493. message: data.message,
  494. type: 'error'
  495. })
  496. this.dialogTableVisible = true
  497. return
  498. } else {
  499. this.$message({
  500. message: data.message,
  501. type: 'error'
  502. })
  503. this.dialogTableVisible = true
  504. return
  505. }
  506. })
  507. }
  508. if (this.website_id == '') {
  509. this.$message({
  510. message: '请输入并选择网站名称',
  511. type: 'error'
  512. })
  513. this.dialogVisible = true
  514. }
  515. if (this.ruleForm.adTag == '') {
  516. this.$message({
  517. message: '请将数据填写完整',
  518. type: 'error'
  519. })
  520. return
  521. }
  522. if (this.dialogName == "编辑") {
  523. updateAdPlace({
  524. name: this.ruleForm.adName,
  525. website_id: this.website_id,
  526. ad_tag: this.ruleForm.adTag,
  527. price: this.ruleForm.price,
  528. thumb: this.ruleForm.adPhoto,
  529. typeid: Number(this.ruleForm.adType),
  530. ad_size_id: Number(this.ruleForm.ad_size_id),
  531. status: Number(this.ruleForm.status),
  532. introduce: this.ruleForm.adDesc,
  533. id: this.activeid
  534. }).then(data => {
  535. console.log(data);
  536. if (data.code == 200) {
  537. this.$message({
  538. message: '编辑成功',
  539. type: 'success'
  540. })
  541. this.dialogTableVisible = false
  542. }
  543. if (data.code == 0) {
  544. this.$message({
  545. message: data.message,
  546. type: 'error'
  547. })
  548. this.dialogTableVisible = true
  549. }
  550. this.getData()
  551. })
  552. }
  553. },
  554. //取消添加或编辑
  555. cancelForm() {
  556. this.dialogTableVisible = false
  557. },
  558. //3.6 上传图片操作
  559. beforeAvatarUpload(file) {
  560. const isJPG = file.type === 'image/jpeg';
  561. const isPNG = file.type === 'image/png';
  562. const isLt2M = file.size / 1024 / 1024 < 2;
  563. if (!isJPG && !isPNG) {
  564. this.$message.error('上传图片只能是 JPG 或 PNG 格式!');
  565. return false;
  566. }
  567. if (!isLt2M) {
  568. this.$message.error('上传图片大小不能超过 2MB!');
  569. return false;
  570. }
  571. const formData = new FormData();
  572. formData.append('file', file);
  573. this.$store.dispatch('pool/uploadFile', formData).then(res => {
  574. this.logoUrl = res.data.imgUrl;//显示缩略图
  575. this.ruleForm.adPhoto = res.data.imgUrl;//提供表单地址
  576. console.log(res.data.imgUrl)
  577. }).catch(() => {
  578. this.$message({
  579. type: 'info',
  580. message: '网络错误,请重试!'
  581. });
  582. })
  583. // 阻止默认的上传行为
  584. return false;
  585. },
  586. handleDelete() {
  587. // 删除图片
  588. this.logoUrl = ''; // 清空图片 URL
  589. },
  590. //搜索部分的输入关键词下拉框
  591. selectWebSite(value) {
  592. this.webSiteName_id = value
  593. },
  594. //添加 / 编辑弹窗中输入关键词下拉框
  595. // 判断是否已经关联了网站
  596. detectionWebSite(value) {
  597. console.log(value);
  598. this.website_id = value
  599. console.log(this.website_id);
  600. },
  601. //
  602. getWebNavList(query) {
  603. if (query !== '') {
  604. this.webSiteLoading = true;
  605. let data = { keyword: query ,website_column_id:2}
  606. let dataArr = [];
  607. this.$store.dispatch('pool/getNavWebList', data).then(res => {
  608. console.log(res.data)
  609. for (let item of res.data) {
  610. let data = {};
  611. data.key = item.id;
  612. data.value = item.id;
  613. data.label = item.website_name;
  614. dataArr.push(data)
  615. }
  616. this.webSiteList = dataArr;
  617. this.webSiteLoading = false;
  618. }).catch(() => {
  619. this.$message({
  620. type: 'info',
  621. message: '网络错误,请重试!'
  622. });
  623. })
  624. } else {
  625. this.navList = [];
  626. }
  627. },
  628. getWebNavLists(query) {
  629. if (query !== '') {
  630. this.webSiteLoading = true;
  631. let data = { keyword: query}
  632. let dataArr = [];
  633. this.$store.dispatch('pool/getNavWebList', data).then(res => {
  634. console.log(res.data)
  635. for (let item of res.data) {
  636. let data = {};
  637. data.key = item.id;
  638. data.value = item.id;
  639. data.label = item.website_name;
  640. dataArr.push(data)
  641. }
  642. this.webSiteLists = dataArr;
  643. this.webSiteLoading = false;
  644. }).catch(() => {
  645. this.$message({
  646. type: 'info',
  647. message: '网络错误,请重试!'
  648. });
  649. })
  650. } else {
  651. this.navList = [];
  652. }
  653. },
  654. },
  655. mounted() {
  656. this.getData()
  657. this.getSize()
  658. },
  659. }
  660. </script>
  661. <style scoped lang="less">
  662. input[aria-hidden=true] {
  663. display: none !important;
  664. }
  665. // 提示信息
  666. .tips {
  667. margin: 30px;
  668. background-color: #e9ecf9;
  669. border-radius: 11px;
  670. .tipsIcon {
  671. margin: 10px 15px;
  672. display: inline-block;
  673. width: 24px;
  674. height: 24px;
  675. background: url("../../assets/advertise/Info Circle.png") no-repeat;
  676. vertical-align: middle;
  677. }
  678. .tipsText {
  679. font-size: 14px;
  680. color: #666666;
  681. }
  682. }
  683. // 头部
  684. .title {
  685. margin: 30px 30px 20px 30px;
  686. padding: 30px 30px 40px 30px;
  687. background-color: #fff;
  688. border-radius: 20px 20px 20px 20px;
  689. border: 1px solid #E9EDF7;
  690. .left {
  691. float: left;
  692. }
  693. .right {
  694. float: right;
  695. }
  696. .searchBox {
  697. ::v-deep .el-input {
  698. position: relative;
  699. font-size: 14px;
  700. display: inline-block;
  701. width: 80%;
  702. }
  703. .searchTitle {
  704. padding-bottom: 10px;
  705. font-family: Microsoft YaHei, Microsoft YaHei;
  706. font-weight: 400;
  707. font-size: 14px;
  708. color: #999999;
  709. line-height: 16px;
  710. }
  711. .el-select {
  712. width: 100%;
  713. display: inline-block;
  714. position: relative;
  715. }
  716. }
  717. .btnList {
  718. float: right;
  719. padding-top: 28px;
  720. button {
  721. height: 38px;
  722. border: none;
  723. border-radius: 8px;
  724. padding: 0 30px;
  725. }
  726. .search {
  727. background-color: #5570f1;
  728. color: #fff;
  729. margin-right: 20px;
  730. }
  731. .reset {
  732. font-family: Microsoft YaHei, Microsoft YaHei;
  733. font-weight: 400;
  734. font-size: 16px;
  735. color: #333333;
  736. background: #F5F7FB;
  737. border-radius: 8px 8px 8px 8px;
  738. border: 1px solid rgba(85, 112, 241, 0.11);
  739. }
  740. }
  741. }
  742. .layerBox {
  743. padding: 30px 20px;
  744. position: relative;
  745. .btn {
  746. position: absolute;
  747. top: 30px;
  748. right: 20px;
  749. height: 38px;
  750. color: #fff;
  751. background-color: #5570f1;
  752. border: none;
  753. border-radius: 8px;
  754. padding: 8px 28px 9px;
  755. box-sizing: border-box;
  756. }
  757. .listBtnBox {
  758. justify-content: left;
  759. }
  760. .listDeleteBtn,
  761. .listEditBtn,
  762. .listLookBtn {
  763. margin-left: 0px;
  764. padding-left: 0px;
  765. margin-right: 20px;
  766. width: 76px;
  767. height: 36px;
  768. line-height: 36px;
  769. }
  770. .listLookBtn {
  771. text-align: center;
  772. border-radius: 8px;
  773. cursor: pointer;
  774. color: #55b5f1;
  775. background-color: rgba(85, 181, 241, 0.16);
  776. >i {
  777. padding-right: 8px;
  778. }
  779. }
  780. ::v-deep .el-form-item {
  781. margin-bottom: 50px;
  782. }
  783. ::v-deep .el-select {
  784. width: 100%;
  785. }
  786. ::v-deep .el-input--medium,
  787. ::v-deep .el-form-item__label {
  788. line-height: 36px;
  789. font-size: 16px;
  790. }
  791. }
  792. // 弹出层内容
  793. .dialogText {
  794. margin: 0 7px 0 3px;
  795. padding-bottom: 1px;
  796. padding: 30px 60px 1px 20px;
  797. background-color: #f5f7fb;
  798. .adImage {
  799. width: 140px;
  800. height: 140px;
  801. line-height: 210px;
  802. border-radius: 12px;
  803. border: 1px solid rgba(85, 112, 241, 0.11);
  804. img {
  805. width: 140px;
  806. height: 80px;
  807. }
  808. }
  809. ::v-deep .avatar {
  810. width: 140px;
  811. height: auto;
  812. }
  813. .price {
  814. ::v-deep .el-input {
  815. width: 29%;
  816. }
  817. }
  818. .example {
  819. font-family: Microsoft YaHei;
  820. color: #5570F1;
  821. }
  822. .el_btnList {
  823. margin-right: 15px;
  824. margin-top: 20px;
  825. }
  826. //日期时间选择器的宽
  827. ::v-deep .el-date-editor.el-input {
  828. width: 48%;
  829. }
  830. ::v-deep .el-button+.el-button {
  831. margin-left: 0px;
  832. }
  833. ::v-deep .el-select {
  834. width: 100%;
  835. }
  836. ::v-deep .el-form-item {
  837. margin-bottom: 50px;
  838. }
  839. }
  840. // 弹出层按钮
  841. .dialogBtn {
  842. text-align: center;
  843. margin: 50px auto 20px;
  844. button {
  845. width: 184px;
  846. padding: 16px;
  847. font-family: Microsoft YaHei, Microsoft YaHei;
  848. font-weight: 400;
  849. font-size: 20px;
  850. border: none;
  851. border-radius: 12px 12px 12px 12px;
  852. }
  853. // 取消
  854. .cancel {
  855. color: #333333;
  856. background-color: #f5f7fb;
  857. border: 2px solid rgba(85, 112, 241, 0.11);
  858. }
  859. // 提交
  860. .submit {
  861. color: #fff;
  862. background-color: #5570F1;
  863. margin-left: 40px;
  864. }
  865. }
  866. //审核弹出框
  867. .radioGroup {
  868. ::v-deep .el-form-item {
  869. margin-top: 40px;
  870. margin-bottom: 0;
  871. }
  872. }
  873. .graph {
  874. background-color: #f5f7fb;
  875. padding: 60px 100px;
  876. overflow: hidden;
  877. li {
  878. float: left;
  879. }
  880. >li:first-child {
  881. margin-right: 100px;
  882. }
  883. }
  884. .dialog-footer {
  885. margin: 0 auto;
  886. }
  887. </style>