style.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. // 顶部内容组件
  2. var specialTopConHtml = '<div>';
  3. specialTopConHtml += '<template v-if="data.style == 1">';
  4. specialTopConHtml += '<div class="goods-head">';
  5. specialTopConHtml += '<div class="title-wrap">';
  6. // specialTopConHtml += '<div class="left-icon" v-if="list.imageUrl"><img v-bind:src="$parent.$parent.changeImgUrl(list.imageUrl)" /></div>';
  7. // specialTopConHtml += '<span class="name">{{list.title}}</span>';
  8. specialTopConHtml += '<template v-for="(item, index) in list" v-if="item.style == 1">';
  9. specialTopConHtml += '<div class="left-icon" v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] == \'public\'"><img v-bind:src="imgUrl1" /></div>';
  10. specialTopConHtml += '<div class="left-icon" v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] != \'public\'"><img v-bind:src="$parent.$parent.changeImgUrl(item.imageUrl)" /></div>';
  11. specialTopConHtml += '<span class="name">{{item.title}}</span>';
  12. specialTopConHtml += '</template>';
  13. specialTopConHtml += '</div>';
  14. specialTopConHtml += '<div class="more violet" v-if="data.bgSelect==\'violet\'">';
  15. specialTopConHtml += '<span>';
  16. specialTopConHtml += '<span style="color: #8662FD;">更多</span>';
  17. specialTopConHtml += '<span style="color: #627BFD;">拼团</span>';
  18. specialTopConHtml += '</span>';
  19. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #627BFD;"></i>';
  20. specialTopConHtml += '</div>';
  21. specialTopConHtml += '<div class="more red" v-if="data.bgSelect==\'red\'">';
  22. specialTopConHtml += '<span>';
  23. specialTopConHtml += '<span style="color: #FF7B91;">更多</span>';
  24. specialTopConHtml += '<span style="color: #FF5151;">拼团</span>';
  25. specialTopConHtml += '</span>';
  26. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #FF5151;"></i>';
  27. specialTopConHtml += '</div>';
  28. specialTopConHtml += '<div class="more blue" v-if="data.bgSelect==\'blue\'">';
  29. specialTopConHtml += '<span>';
  30. specialTopConHtml += '<span style="color: #12D0AE;">更多</span>';
  31. specialTopConHtml += '<span style="color: #0ECFD3;">拼团</span>';
  32. specialTopConHtml += '</span>';
  33. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #0ECFD3;"></i>';
  34. specialTopConHtml += '</div>';
  35. specialTopConHtml += '<div class="more yellow" v-if="data.bgSelect==\'yellow\'">';
  36. specialTopConHtml += '<span>';
  37. specialTopConHtml += '<span style="color: #FEB632;">更多</span>';
  38. specialTopConHtml += '<span style="color: #FE6232;">拼团</span>';
  39. specialTopConHtml += '</span>';
  40. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #FE6232;"></i>';
  41. specialTopConHtml += '</div>';
  42. specialTopConHtml += '</div>';
  43. specialTopConHtml += '</template>';
  44. specialTopConHtml += '<template v-if="data.style == 2">';
  45. specialTopConHtml += '<div class="title-wrap title-wrap-2">';
  46. specialTopConHtml += '<div class="title-left">';
  47. specialTopConHtml += '<template v-for="(item, index) in list" v-if="item.style == 2">';
  48. specialTopConHtml += '<img v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] == \'public\'" :src="imgUrl2" />';
  49. specialTopConHtml += '<img v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] != \'public\'" :src="$parent.$parent.changeImgUrl(item.imageUrl)" />';
  50. specialTopConHtml += '</template>';
  51. specialTopConHtml += '</div>';
  52. specialTopConHtml += '<div class="title-right"><span>更多拼团</span><i class="iconfont iconyoujiantou"></i> </div>';
  53. specialTopConHtml += '</div>';
  54. specialTopConHtml += '</template>';
  55. specialTopConHtml += '<template v-if="data.style == 3">';
  56. specialTopConHtml += '<div class="title-wrap title-wrap-3">';
  57. specialTopConHtml += '<div class="title-left">';
  58. specialTopConHtml += '<template v-for="(item, index) in list" v-if="item.style == 3">';
  59. specialTopConHtml += '<img v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] == \'public\'" :src="imgUrl3" />';
  60. specialTopConHtml += '<img v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] != \'public\'" :src="$parent.$parent.changeImgUrl(item.imageUrl)" />';
  61. specialTopConHtml += '</template>';
  62. specialTopConHtml += '</div>';
  63. specialTopConHtml += '</div>';
  64. specialTopConHtml += '</template>';
  65. specialTopConHtml += '<template v-if="data.style == 4">';
  66. specialTopConHtml += '<div class="goods-head">';
  67. specialTopConHtml += '<div class="title-wrap">';
  68. specialTopConHtml += '<template v-for="(item, index) in list" v-if="item.style == 4">';
  69. specialTopConHtml += '<div class="left-icon" v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] == \'public\'"><img v-bind:src="imgUrl1" /></div>';
  70. specialTopConHtml += '<div class="left-icon" v-if="item.imageUrl && item.imageUrl.split(\'/\')[0] != \'public\'"><img v-bind:src="$parent.$parent.changeImgUrl(item.imageUrl)" /></div>';
  71. specialTopConHtml += '<span class="name">{{item.title}}</span>';
  72. specialTopConHtml += '</template>';
  73. specialTopConHtml += '</div>';
  74. specialTopConHtml += '<div class="more violet" v-if="data.bgSelect==\'violet\'">';
  75. specialTopConHtml += '<span>';
  76. specialTopConHtml += '<span style="color: #8662FD;">更多</span>';
  77. specialTopConHtml += '<span style="color: #627BFD;">拼团</span>';
  78. specialTopConHtml += '</span>';
  79. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #627BFD;"></i>';
  80. specialTopConHtml += '</div>';
  81. specialTopConHtml += '<div class="more red" v-if="data.bgSelect==\'red\'">';
  82. specialTopConHtml += '<span>';
  83. specialTopConHtml += '<span style="color: #FF7B91;">更多</span>';
  84. specialTopConHtml += '<span style="color: #FF5151;">拼团</span>';
  85. specialTopConHtml += '</span>';
  86. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #FF5151;"></i>';
  87. specialTopConHtml += '</div>';
  88. specialTopConHtml += '<div class="more blue" v-if="data.bgSelect==\'blue\'">';
  89. specialTopConHtml += '<span>';
  90. specialTopConHtml += '<span style="color: #12D0AE;">更多</span>';
  91. specialTopConHtml += '<span style="color: #0ECFD3;">拼团</span>';
  92. specialTopConHtml += '</span>';
  93. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #0ECFD3;"></i>';
  94. specialTopConHtml += '</div>';
  95. specialTopConHtml += '<div class="more yellow" v-if="data.bgSelect==\'yellow\'">';
  96. specialTopConHtml += '<span>';
  97. specialTopConHtml += '<span style="color: #FEB632;">更多</span>';
  98. specialTopConHtml += '<span style="color: #FE6232;">拼团</span>';
  99. specialTopConHtml += '</span>';
  100. specialTopConHtml += '<i class="iconfont iconyoujiantou" style="color: #FE6232;"></i>';
  101. specialTopConHtml += '</div>';
  102. specialTopConHtml += '</div>';
  103. specialTopConHtml += '</template>';
  104. /* specialTopConHtml += '<div class="more ns-red-color" v-if="listMore.title">';
  105. specialTopConHtml += '<span v-bind:style="{color: data.moreTextColor?data.moreTextColor:\'rgba(0,0,0,0)\'}">{{listMore.title}}</span>';
  106. specialTopConHtml += '<div class="right-icon" v-if="listMore.imageUrl"><img v-bind:src="$parent.$parent.changeImgUrl(listMore.imageUrl)" /></div>';
  107. specialTopConHtml += '<i class="iconfont iconyoujiantou" v-else v-bind:style="{color: data.moreTextColor?data.moreTextColor:\'rgba(0,0,0,0)\'}"></i>';
  108. specialTopConHtml += '</div>'; */
  109. specialTopConHtml +='</div>';
  110. Vue.component("special-top-content", {
  111. data: function () {
  112. return {
  113. data: this.$parent.data,
  114. list: this.$parent.data.list,
  115. listMore: this.$parent.data.listMore,
  116. imgUrl1: "",
  117. imgUrl2: "",
  118. imgUrl3: "",
  119. imgUrl4: ""
  120. }
  121. },
  122. created: function () {
  123. this.imgUrl1 = this.list[0].imageUrl;
  124. this.imgUrl2 = this.list[1].imageUrl;
  125. this.imgUrl3 = this.list[2].imageUrl;
  126. this.imgUrl4 = this.list[3].imageUrl;
  127. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  128. this.$parent.data.verify.push(this.verify);//加载验证方法
  129. },
  130. methods: {
  131. verify : function () {
  132. var res = { code : true, message : "" };
  133. return res;
  134. },
  135. },
  136. template: specialTopConHtml
  137. });
  138. /**
  139. * 空的验证组件,后续如果增加业务,则更改组件
  140. */
  141. var specialListHtml = '<div class="goods-list-edit layui-form">';
  142. specialListHtml += '<div class="layui-form-item ns-icon-radio">';
  143. specialListHtml += '<label class="layui-form-label sm">商品来源</label>';
  144. specialListHtml += '<div class="layui-input-block">';
  145. specialListHtml += '<template v-for="(item, index) in goodsSources" v-bind:k="index">';
  146. specialListHtml += '<span :class="[item.value == data.sources ? \'\' : \'layui-hide\']">{{item.text}}</span>';
  147. specialListHtml += '</template>';
  148. specialListHtml += '<ul class="ns-icon">';
  149. specialListHtml += '<li v-for="(item, index) in goodsSources" v-bind:k="index" :class="[item.value == data.sources ? \'ns-text-color ns-border-color ns-bg-color-diaphaneity\' : \'\']" @click="data.sources=item.value">';
  150. specialListHtml += '<img v-if="item.value == data.sources" :src="item.selectedSrc" />'
  151. specialListHtml += '<img v-else :src="item.src" />'
  152. specialListHtml += '</li>';
  153. specialListHtml += '</ul>';
  154. /* specialListHtml += '<template v-for="(item,index) in goodsSources" v-bind:k="index">';
  155. specialListHtml += '<div v-on:click="data.sources=item.value" v-bind:class="{ \'layui-unselect layui-form-radio\' : true,\'layui-form-radioed\' : (data.sources==item.value) }"><i class="layui-anim layui-icon">&#xe63f;</i><div>{{item.text}}</div></div>';
  156. specialListHtml += '</template>'; */
  157. specialListHtml += '</div>';
  158. specialListHtml += '</div>';
  159. specialListHtml += '<div class="layui-form-item" v-if="data.sources == \'diy\'">';
  160. specialListHtml += '<label class="layui-form-label sm">手动选择</label>';
  161. specialListHtml += '<div class="layui-input-block">';
  162. specialListHtml += '<a href="#" class="ns-input-text selected-style" v-on:click="addGoods">选择<i class="layui-icon layui-icon-right"></i></a>';
  163. specialListHtml += '</div>';
  164. specialListHtml += '</div>';
  165. /* specialListHtml += '<div class="layui-form-item" v-show="data.sources == \'default\'">';
  166. specialListHtml += '<label class="layui-form-label sm">商品数量</label>';
  167. specialListHtml += '<div class="layui-input-block">';
  168. specialListHtml += '<input type="number" class="layui-input goods-account" v-on:keyup="shopNum" v-model="data.goodsCount"/>';
  169. specialListHtml += '</div>';
  170. specialListHtml += '</div>';
  171. specialListHtml += '<div class="layui-form-item" v-show="data.sources == \'default\'">';
  172. specialListHtml += '<label class="layui-form-label sm"></label>';
  173. specialListHtml += '<div class="layui-input-block">';
  174. specialListHtml += '<template v-for="(item,index) in goodsCount" v-bind:k="index">';
  175. specialListHtml += '<div v-on:click="data.goodsCount=item" v-bind:class="{ \'layui-unselect layui-form-radio\' : true,\'layui-form-radioed\' : (data.goodsCount==item) }"><i class="layui-anim layui-icon">&#xe63f;</i><div>{{item}}</div></div>';
  176. specialListHtml += '</template>';
  177. specialListHtml += '</div>';
  178. specialListHtml += '</div>'; */
  179. specialListHtml += '<slide v-bind:data="{ field : \'goodsCount\', label: \'商品数量\', max: 9, min: 1}" v-show="data.sources == \'default\'"></slide>';
  180. // specialListHtml += '<p class="hint">商品数量选择 0 时,前台会自动上拉加载更多</p>';
  181. specialListHtml += '</div>';
  182. var select_goods_list = []; //配合商品选择器使用
  183. Vue.component("special-list", {
  184. template: specialListHtml,
  185. data: function () {
  186. return {
  187. data: this.$parent.data,
  188. goodsSources: [
  189. {
  190. text: "默认",
  191. value: "default",
  192. src: specialResourcePath + "/special/img/goods.png",
  193. selectedSrc: specialResourcePath + "/special/img/goods_1.png"
  194. },
  195. {
  196. text : "手动选择",
  197. value : "diy",
  198. src: specialResourcePath + "/special/img/manual.png",
  199. selectedSrc: specialResourcePath + "/special/img/manual_1.png"
  200. }
  201. ],
  202. categoryList: [],
  203. isLoad: false,
  204. isShow: false,
  205. selectIndex: 0,//当前选中的下标
  206. goodsCount: [6, 12, 18, 24, 30],
  207. }
  208. },
  209. created:function() {
  210. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  211. this.$parent.data.verify.push(this.verify);//加载验证方法
  212. },
  213. methods: {
  214. shopNum: function () {
  215. if (this.$parent.data.goodsCount > 50) {
  216. layer.msg("商品数量最多为50");
  217. this.$parent.data.goodsCount = 50;
  218. }
  219. if (this.$parent.data.goodsCount.length > 0 && this.$parent.data.goodsCount < 1) {
  220. layer.msg("商品数量不能小于0");
  221. this.$parent.data.goodsCount = 1;
  222. }
  223. },
  224. verify: function () {
  225. var res = {code: true, message: ""};
  226. if (this.data.goodsCount.length === 0) {
  227. res.code = false;
  228. res.message = "请输入商品数量";
  229. }
  230. if (this.data.goodsCount < 0) {
  231. res.code = false;
  232. res.message = "商品数量不能小于0";
  233. }
  234. if (this.data.goodsCount > 50) {
  235. res.message = "商品数量最多为50";
  236. }
  237. return res;
  238. },
  239. addGoods: function () {
  240. var self = this;
  241. goodsSelect(function (res) {
  242. // if (!res.length) return false;
  243. // self.$parent.data.goodsId = [];
  244. // for (var i = 0; i < res.length; i++) {
  245. // self.$parent.data.goodsId.push(res[i]);
  246. // }
  247. self.$parent.data.goodsId = res;
  248. }, self.$parent.data.goodsId, {mode: "spu", promotion: "special", disabled: 0, post: post});
  249. }
  250. }
  251. });
  252. var specialStyleHtml = '<div class="layui-form-item">';
  253. specialStyleHtml += '<label class="layui-form-label sm">选择风格</label>';
  254. specialStyleHtml += '<div class="layui-input-block">';
  255. // specialStyleHtml += '<span>{{data.styleName}}</span>';
  256. specialStyleHtml += '<div v-if="data.styleName" class="ns-input-text ns-text-color selected-style" v-on:click="selectGroupbuyStyle">{{data.styleName}} <i class="layui-icon layui-icon-right"></i></div>';
  257. specialStyleHtml += '<div v-else class="ns-input-text selected-style" v-on:click="selectGroupbuyStyle">选择 <i class="layui-icon layui-icon-right"></i></div>';
  258. specialStyleHtml += '</div>';
  259. specialStyleHtml += '</div>';
  260. Vue.component("special-style", {
  261. template: specialStyleHtml,
  262. data: function() {
  263. return {
  264. data: this.$parent.data,
  265. }
  266. },
  267. created:function() {
  268. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  269. this.$parent.data.verify.push(this.verify);//加载验证方法
  270. },
  271. methods: {
  272. verify: function () {
  273. var res = { code: true, message: "" };
  274. return res;
  275. },
  276. selectGroupbuyStyle: function() {
  277. var self = this;
  278. layer.open({
  279. type: 1,
  280. title: '风格选择',
  281. area:['930px','630px'],
  282. btn: ['确定', '返回'],
  283. content: $(".draggable-element[data-index='" + self.data.index + "'] .edit-attribute .pintuan-list-style").html(),
  284. success: function(layero, index) {
  285. $(".layui-layer-content input[name='style']").val(self.data.style);
  286. $(".layui-layer-content input[name='style_name']").val(self.data.styleName);
  287. $("body").on("click", ".layui-layer-content .style-list-con-pintuan .style-li-pintuan", function () {
  288. $(this).addClass("selected ns-border-color").siblings().removeClass("selected ns-border-color");
  289. $(".layui-layer-content input[name='style']").val($(this).index() + 1);
  290. $(".layui-layer-content input[name='style_name']").val($(this).find("span").text());
  291. });
  292. },
  293. yes: function (index, layero) {
  294. self.data.style = $(".layui-layer-content input[name='style']").val();
  295. self.data.styleName = $(".layui-layer-content input[name='style_name']").val();
  296. layer.closeAll()
  297. }
  298. });
  299. },
  300. }
  301. })
  302. // 图片上传
  303. var specialTopHtml = '<ul class="fenxiao-addon-title">';
  304. specialTopHtml += '<li>';
  305. // specialTopHtml += '<template v-if="data.style == 1">';
  306. // specialTopHtml += '<div class="layui-form-item">';
  307. // specialTopHtml += '<label class="layui-form-label sm">顶部图片</label>';
  308. // specialTopHtml += '<template v-for="(item, index) in list" v-if="item.style == data.style">';
  309. // specialTopHtml += '<div class="layui-input-block ns-img-upload">';
  310. // specialTopHtml += '<img-sec-upload v-bind:data="{ data : item, text: \'\' }"></img-sec-upload>';
  311. // specialTopHtml += '</div>';
  312. // specialTopHtml += '</template>';
  313. // specialTopHtml += '<div class="ns-word-aux ns-diy-word-aux">建议上传顶部图片大小:710px * 300px</div>';
  314. // specialTopHtml += '</div>';
  315. // specialTopHtml += '</template>';
  316. specialTopHtml += '<template v-if="data.style == 1">';
  317. specialTopHtml += '<div class="layui-form-item">';
  318. specialTopHtml += '<label class="layui-form-label sm">选择专题</label>';
  319. specialTopHtml += '<div class="layui-input-block">';
  320. specialTopHtml += '<a href="#" class="ns-input-text ns-text-color selected-style" v-on:click="addSpecial">{{data.specialName?data.specialName:"选择"}}<i class="layui-icon layui-icon-right"></i></a>';
  321. specialTopHtml += '</div>';
  322. specialTopHtml += '</div>';
  323. specialTopHtml += '</template>';
  324. specialTopHtml += '<template v-if="data.style == 2">';
  325. specialTopHtml += '<div class="layui-form-item">';
  326. specialTopHtml += '<label class="layui-form-label sm">左侧图标</label>';
  327. specialTopHtml += '<template v-for="(item, index) in list" v-if="item.style == data.style">';
  328. specialTopHtml += '<div class="layui-input-block ns-img-upload">';
  329. specialTopHtml += '<img-sec-upload v-bind:data="{ data : item, text: \'\' }"></img-sec-upload>';
  330. specialTopHtml += '</div>';
  331. specialTopHtml += '</template>';
  332. specialTopHtml += '<div class="ns-word-aux ns-diy-word-aux">建议上传图片大小:131px * 37px</div>';
  333. specialTopHtml += '</div>';
  334. specialTopHtml += '</template>';
  335. specialTopHtml += '<template v-if="data.style == 3">';
  336. specialTopHtml += '<div class="layui-form-item">';
  337. specialTopHtml += '<label class="layui-form-label sm">顶部图标</label>';
  338. specialTopHtml += '<template v-for="(item, index) in list" v-if="item.style == data.style">';
  339. specialTopHtml += '<div class="layui-input-block ns-img-upload">';
  340. specialTopHtml += '<img-sec-upload v-bind:data="{ data : item, text: \'\' }"></img-sec-upload>';
  341. specialTopHtml += '</div>';
  342. specialTopHtml += '</template>';
  343. specialTopHtml += '<div class="ns-word-aux ns-diy-word-aux">建议上传图片大小:174px * 37px</div>';
  344. specialTopHtml += '</div>';
  345. specialTopHtml += '</template>';
  346. specialTopHtml += '<template v-if="data.style == 4">';
  347. specialTopHtml += '<div class="layui-form-item">';
  348. specialTopHtml += '<label class="layui-form-label sm">左侧图标</label>';
  349. specialTopHtml += '<template v-for="(item, index) in list" v-if="item.style == data.style">';
  350. specialTopHtml += '<div class="layui-input-block ns-img-upload">';
  351. specialTopHtml += '<img-sec-upload v-bind:data="{ data : item, text: \'\' }"></img-sec-upload>';
  352. specialTopHtml += '</div>';
  353. specialTopHtml += '</template>';
  354. specialTopHtml += '<div class="ns-word-aux ns-diy-word-aux">建议上传图标大小:125px * 30px</div>';
  355. specialTopHtml += '</div>';
  356. specialTopHtml += '<div class="content-block">';
  357. specialTopHtml += '<div class="layui-form-item">';
  358. specialTopHtml += '<label class="layui-form-label sm">标题内容</label>';
  359. specialTopHtml += '<template v-for="(item, index) in list" v-if="item.style == data.style">';
  360. specialTopHtml += '<div class="layui-input-block">';
  361. specialTopHtml += '<input type="text" name=\'title\' v-model="item.title" class="layui-input" />';
  362. specialTopHtml += '</div>';
  363. specialTopHtml += '</template>';
  364. specialTopHtml += '</div>';
  365. specialTopHtml += '</div>';
  366. specialTopHtml += '</template>';
  367. // specialTopHtml += '<color v-bind:data="{ field : \'titleTextColor\', label : \'标题颜色\', defaultcolor: \'#000\' }"></color>';
  368. specialTopHtml += '</li>';
  369. /* specialTopHtml += '<li>';
  370. specialTopHtml += '<div class="content-block">';
  371. specialTopHtml += '<div class="layui-form-item">';
  372. specialTopHtml += '<label class="layui-form-label sm">文本内容</label>';
  373. specialTopHtml += '<div class="layui-input-block">';
  374. specialTopHtml += '<input type="text" name=\'title\' v-model="listMore.title" class="layui-input" />';
  375. specialTopHtml += '</div>';
  376. specialTopHtml += '</div>';
  377. specialTopHtml += '<color v-bind:data="{ field : \'moreTextColor\', defaultcolor: \'#858585\' }"></color>';
  378. specialTopHtml += '</div>';
  379. specialTopHtml += '</li>'; */
  380. specialTopHtml += '</ul>';
  381. Vue.component("special-top-list",{
  382. template : specialTopHtml,
  383. data : function(){
  384. return {
  385. data : this.$parent.data,
  386. list : this.$parent.data.list,
  387. listMore: this.$parent.data.listMore
  388. };
  389. },
  390. created : function(){
  391. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  392. this.$parent.data.verify.push(this.verify);//加载验证方法
  393. },
  394. watch : {
  395. },
  396. methods : {
  397. verify:function () {
  398. var res = { code : true, message : "" };
  399. var _self = this;
  400. if(_self.data.specialId == ""){
  401. res.code = false;
  402. res.message = "请选择专题";
  403. $(this).find(".error-msg").text("请选择专题").show();
  404. return res;
  405. }else{
  406. $(this).find(".error-msg").text("").hide();
  407. }
  408. return res;
  409. },
  410. addSpecial() {
  411. var self = this;
  412. specialSelect(function (res) {
  413. console.log(res)
  414. self.$parent.data.specialId = res.id;
  415. self.$parent.data.specialName = res.name;
  416. let style = self.$parent.data.style || 1;
  417. self.$parent.data.list[style-1].imageUrl = res.image;
  418. }, self.$parent.data.specialId, {disabled:0});
  419. }
  420. }
  421. });
  422. // 背景颜色可选
  423. var specialColorHtml = '<div class="layui-form-item ns-bg-select">';
  424. specialColorHtml += '<label class="layui-form-label sm">背景颜色</label>';
  425. specialColorHtml += '<div class="layui-input-block">';
  426. specialColorHtml += '<ul class="ns-bg-select-ul">';
  427. specialColorHtml += '<li v-for="(item, index) in colorList" v-bind:k="index" :class="[item.className == data.bgSelect ? \'ns-text-color ns-border-color\' : \'\']" @click="data.bgSelect = item.className">';
  428. specialColorHtml += '<div :style="{background: item.color}"></div>';
  429. specialColorHtml += '</li>';
  430. specialColorHtml += '</ul>';
  431. specialColorHtml += '</div>';
  432. specialColorHtml += '</div>';
  433. Vue.component("special-color", {
  434. template: specialColorHtml,
  435. data: function () {
  436. return {
  437. data: this.$parent.data,
  438. colorList: [
  439. {name: "红", className: "red", color: "#FFD7D7"},
  440. {name: "蓝", className: "blue", color: "#D7FAFF"},
  441. {name: "黄", className: "yellow", color: "#FFF4E0"},
  442. {name: "紫", className: "violet", color: "#F9E5FF"}
  443. ]
  444. };
  445. },
  446. created: function () {
  447. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  448. this.$parent.data.verify.push(this.verify);//加载验证方法
  449. },
  450. methods: {
  451. verify : function () {
  452. var res = { code : true, message : "" };
  453. return res;
  454. }
  455. },
  456. });
  457. // 切换方式
  458. var changeType = '<div class="layui-form-item ns-icon-radio">';
  459. changeType += '<label class="layui-form-label sm">滑动方式</label>';
  460. changeType += '<div class="layui-input-block align-right">';
  461. changeType += '<template v-for="(item,index) in changeTypeList" v-bind:k="index">';
  462. changeType += '<div v-on:click="data.changeType=item.value" v-bind:class="{ \'layui-unselect layui-form-radio\' : true,\'layui-form-radioed\' : (data.changeType==item.value) }"><i class="layui-anim layui-icon">&#xe63f;</i><div>{{item.name}}</div></div>';
  463. changeType += '</template>';
  464. changeType += '</div>';
  465. /* changeType += '<label class="layui-form-label sm">滑动方式</label>';
  466. changeType += '<div class="layui-input-block">';
  467. changeType += '<template v-for="(item, index) in changeTypeList" v-bind:k="index">';
  468. changeType += '<span :class="[item.value == data.changeType ? \'\' : \'layui-hide\']">{{item.name}}</span>';
  469. changeType += '</template>';
  470. changeType += '<ul class="ns-icon">';
  471. changeType += '<li v-for="(item, index) in changeTypeList" v-bind:k="index" :class="[item.value == data.changeType ? \'ns-text-color ns-border-color\' : \'\']" @click="data.changeType = item.value">';
  472. changeType += '<img v-if="item.value == data.changeType" :src="item.selectedSrc" />'
  473. changeType += '<img v-else :src="item.src" />'
  474. changeType += '</li>';
  475. changeType += '</ul>';
  476. changeType += '</div>'; */
  477. changeType += '</div>';
  478. Vue.component("change-type", {
  479. template: changeType,
  480. data: function () {
  481. return {
  482. data: this.$parent.data,
  483. changeTypeList: [
  484. {name: "平移滑动", value: 1, src: specialResourcePath + "/special/img/manual.png", selectedSrc: specialResourcePath + "/special/img/manual_1.png"},
  485. {name: "切屏滑动", value: 2, src: specialResourcePath + "/special/img/manual.png", selectedSrc: specialResourcePath + "/special/img/manual_1.png"},
  486. ]
  487. };
  488. },
  489. created: function () {
  490. if(!this.$parent.data.verify) this.$parent.data.verify = [];
  491. this.$parent.data.verify.push(this.verify);//加载验证方法
  492. },
  493. methods: {
  494. verify : function () {
  495. var res = { code : true, message : "" };
  496. return res;
  497. }
  498. },
  499. });