templateStyle.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div class="mainBox">
  3. <div class="layerBox" v-if="this.$store.state.template.stepStatus">
  4. <tableTitle :name="templateStepTitle"/>
  5. <step :activeNumber="2"/>
  6. </div>
  7. <!--搜索功能 start------------------------------------------------------------>
  8. <div class="layerBox_search">
  9. <div class="layerBoxLine">
  10. <el-row>
  11. <el-col :span="8">
  12. <div class="searchBox">
  13. <div class="searchTitle">模板风格</div>
  14. <el-select v-model="getApiData.islink" placeholder="请选择..">
  15. <el-option label="全部" value="0"></el-option>
  16. <el-option label="简约" value="1"></el-option>
  17. <el-option label="商务" value="2"></el-option>
  18. <el-option label="科技" value="3"></el-option>
  19. <el-option label="金融" value="4"></el-option>
  20. <el-option label="教育" value="5"></el-option>
  21. <el-option label="医疗" value="6"></el-option>
  22. <el-option label="政府" value="7"></el-option>
  23. </el-select>
  24. </div>
  25. </el-col>
  26. <el-col :span="16">
  27. <div class="searchBtnBox">
  28. <el-button @click="clearSearchList">重置</el-button>
  29. <el-button type="primary" @click="getData('search')">搜索</el-button>
  30. </div>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. </div>
  35. <!--搜索功能 end------------------------------------------------------------>
  36. <!--表格内容 start------------------------------------------------------------>
  37. <div class="layerBox">
  38. <tableTitle :name="tableDivTitle"/>
  39. <div class="templateStyleBox">
  40. <div class="templateStyleItem" v-for="(item,index) in tableData" :key="index">
  41. <div :class="['templateStyleItemBox',{active:item.status === 1}]" @click="useIt(item.id)">
  42. <img :src="item.img">
  43. <div class="templateStyleItemTitle">{{item.title}}</div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="paginationBox">
  48. <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page" @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper" :total="allCount"></el-pagination>
  49. </div>
  50. </div>
  51. <div class="layerBox">
  52. <tableTitle :name="useTemplateName"/>
  53. <div class="thumbnailBox">
  54. <div class="thumbnailItem" @click="showImg">
  55. <div class="thumbnailItemBox">
  56. <img src="@/assets/template/style1.png">
  57. <div class="thumbnailItemTitle">首页</div>
  58. </div>
  59. </div>
  60. <div class="thumbnailItem">
  61. <div class="thumbnailItemBox">
  62. <img src="@/assets/template/style1.png">
  63. <div class="thumbnailItemTitle">分类页</div>
  64. </div>
  65. </div>
  66. <div class="thumbnailItem">
  67. <div class="thumbnailItemBox">
  68. <img src="@/assets/template/style1.png">
  69. <div class="thumbnailItemTitle">列表页</div>
  70. </div>
  71. </div>
  72. <div class="thumbnailItem">
  73. <div class="thumbnailItemBox">
  74. <img src="@/assets/template/style1.png">
  75. <div class="thumbnailItemTitle">详情页</div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <!--步骤按钮 start------------------------------------------------------------>
  81. <div class="btnBox">
  82. <el-button type="info" @click="goBase">上一步</el-button>
  83. <el-button type="primary" @click="goCreat">下一步</el-button>
  84. </div>
  85. <!--步骤按钮 end------------------------------------------------------------>
  86. <!--表格内容 end------------------------------------------------------------>
  87. <!--弹出框 start------------------------------------------------------------>
  88. <el-dialog title="模板详情" :visible.sync="windowStatus" :close-on-click-modal="false">
  89. <el-form :model="form" ref="form" :rules="formRules" label-position="left">
  90. <div class="imgZoomBox">
  91. <img src="@/assets/template/style1.png">
  92. </div>
  93. </el-form>
  94. <div slot="footer" class="dialog-footer">
  95. <div>
  96. <el-button @click="windowStatus=false">关闭</el-button>
  97. </div>
  98. </div>
  99. </el-dialog>
  100. <!--弹出框 end------------------------------------------------------------>
  101. </div>
  102. </template>
  103. <script>
  104. //表格标题
  105. import tableTitle from './public/tableTitle';
  106. //引入公用样式
  107. import '@/styles/global.less';
  108. //步骤条
  109. import step from './public/step';
  110. export default {
  111. components: {
  112. tableTitle,//表格标题
  113. step//步骤条
  114. },
  115. data() {
  116. return {
  117. //1.列表和分页相关 start ------------------------------------------------------------>
  118. templateStepTitle:"仅需四步,即可完成模板创建",
  119. tableDivTitle:"模板列表",
  120. useTemplateName:"已选择风格",
  121. windowStatus:false,//弹出框
  122. tableData:[
  123. {id:1,img:require("@/assets/template/style1.png"),title:"廉政风云",status:1},
  124. {id:2,img:require("@/assets/template/style2.png"),title:"误判",status:0},
  125. {id:3,img:require("@/assets/template/style3.png"),title:"逆转裁判",status:0},
  126. {id:4,img:require("@/assets/template/style4.png"),title:"寒战",status:0},
  127. {id:5,img:require("@/assets/template/style5.png"),title:"冲锋车",status:0},
  128. {id:6,img:require("@/assets/template/style6.png"),title:"无间道",status:0},
  129. {id:7,img:require("@/assets/template/style7.png"),title:"机动部队",status:0},
  130. {id:8,img:require("@/assets/template/style8.png"),title:"枪火",status:0},
  131. ],//内容
  132. editId:0,//要修改的网站id
  133. getApiData:{
  134. },
  135. allCount:0,//总条数
  136. //分页相关 end ------------------------------------------------------------>
  137. }
  138. },
  139. methods: {
  140. //0.全局操作 start ------------------------------------------------------------>
  141. //上一步
  142. goBase(){
  143. this.$router.push({
  144. path: '/templateBase',
  145. query: {
  146. id: this.editId
  147. }
  148. });
  149. },
  150. //下一步
  151. goCreat(id){
  152. let data = {
  153. id:id
  154. }
  155. this.$router.push({
  156. path: '/templateCreat',
  157. query: {
  158. id: this.editId
  159. }
  160. });
  161. },
  162. //放大缩略图
  163. showImg(img){
  164. this.windowStatus = true;
  165. },
  166. //0.全局操作 end ------------------------------------------------------------>
  167. //1.1 开始请求列表信息方法
  168. getData(type){
  169. if(type=="search"){
  170. this.getApiData.page = 1;
  171. }
  172. this.$store.dispatch('news/getArticleList',this.getApiData).then(res=> {
  173. //格式化:islink=0为不使用外面 islink=1为使用外链
  174. //status=1为显示 status=2为不显示
  175. let data = [];
  176. for(let item of res.data.rows){
  177. // if(item.status==0){item.status="隐藏"}
  178. // if(item.status==1){item.status="显示"}
  179. // if(item.status==404){item.status="已删除"}
  180. if(item.islink==0){item.islink="否"}
  181. if(item.islink==1){item.islink="是"}
  182. data.push(item)
  183. }
  184. this.tableData = res.data.rows; //给与内容
  185. this.allCount = res.data.count; //给与总条数
  186. }).catch(() => {
  187. this.$message({
  188. type: 'warning',
  189. message: '网络错误,请重试!'
  190. });
  191. })
  192. },
  193. //选择风格
  194. useIt(id){
  195. console.log(id)
  196. this.tableData.forEach(item=>{
  197. item.status = 0;
  198. })
  199. this.tableData.find(item=>item.id==id).status = 1;
  200. },
  201. //1.4 列表内容分页
  202. //直接跳转
  203. handleSizeChange(val) {
  204. this.getApiData.page = val;
  205. this.getData();
  206. },
  207. //1.5 点击分页
  208. handleCurrentChange(val) {
  209. this.getApiData.page = val;
  210. this.getData();
  211. },
  212. //列表和分页相关 end ------------------------------------------------------------>
  213. },
  214. mounted(){
  215. if(this.$route.query.id!=undefined){
  216. this.editId = this.$route.query.id;
  217. console.log("编辑风格!")
  218. }else{
  219. console.log("选择风格!")
  220. }
  221. }
  222. }
  223. </script>
  224. <style scoped lang="less">
  225. .searchBtnBox {
  226. padding-top: 26px;
  227. text-align: right;
  228. }
  229. .paginationBox {
  230. padding: 20px 0 0 0;
  231. text-align: center;
  232. }
  233. .btnBox {
  234. padding:0 0 40px 0;
  235. text-align: center;
  236. }
  237. .thumbnailBox {
  238. display: flex;
  239. align-items: center;
  240. flex-wrap: wrap;
  241. justify-content:flex-start;
  242. .thumbnailItem {
  243. //width: 12.5%;
  244. width: 180px;
  245. height: 180px;
  246. text-align: center;
  247. padding: 0 10px 10px 10px;
  248. .thumbnailItemBox {
  249. background: #ECEFFD;
  250. border-radius: 10px;
  251. position: relative;
  252. cursor: pointer;
  253. .thumbnailItemTitle {
  254. position: absolute;
  255. bottom: 10px;
  256. left: 10px;
  257. background: rgba(0,0,0,0.5);
  258. color: #fff;
  259. font-size: 14px;
  260. text-align: center;
  261. padding: 5px 10px;
  262. border-radius: 4px;
  263. }
  264. }
  265. }
  266. img {
  267. height: 180px;
  268. }
  269. }
  270. .templateStyleBox {
  271. padding: 20px 20px 0 20px;
  272. background-color: #F5F7FB;
  273. display: flex;
  274. flex-wrap: wrap;
  275. .templateStyleItem {
  276. width: 20%;
  277. box-sizing: border-box;
  278. padding: 10px 10px 10px 10px;
  279. text-align: center;
  280. cursor: pointer;
  281. margin-bottom: 20px;
  282. .templateStyleItemBox {
  283. background: #fff;
  284. border-radius: 10px;
  285. padding-top: 10px;
  286. border-top: 5px solid #E9EDF7;
  287. border-bottom: 5px solid #E9EDF7;
  288. border-left: 1px solid #E9EDF7;
  289. border-right: 1px solid #E9EDF7;
  290. // &:hover {
  291. // border-top: 5px solid #E9EDF7;
  292. // border-bottom: 5px solid #E9EDF7;
  293. // border-left: 1px solid #E9EDF7;
  294. // border-right: 1px solid #E9EDF7;
  295. // }
  296. }
  297. .active {
  298. border-top: 5px solid #5570F1;
  299. border-bottom: 5px solid #5570F1;
  300. border-left: 1px solid #5570F1;
  301. border-right: 1px solid #5570F1;
  302. }
  303. .templateStyleItemTitle {
  304. font-size: 14px;
  305. color: #333;
  306. text-align: center;
  307. padding: 10px 0;
  308. }
  309. img {
  310. width: 100%;
  311. }
  312. }
  313. }
  314. .imgZoomBox {
  315. img {
  316. width: 100%;
  317. }
  318. }
  319. </style>