ShareSetting.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div class="share">
  3. <div class="preview">
  4. <div class="phone-top"></div>
  5. <div class="phone-center"></div>
  6. <div class="content">
  7. <div class="phone-status"></div>
  8. <div class="preview-area"></div>
  9. </div>
  10. <div class="phone-bottom"></div>
  11. </div>
  12. <div class="setting">
  13. <img class="share-close" src="../assets/images/share-close.png" alt="" @click="closeBtn">
  14. <div class="share-title">分享设置</div>
  15. <div class="share-titleBox">
  16. <div class="top">
  17. <el-input type="text" placeholder="h5测试分享标题" v-model="shareModel.shareTitle" maxlength="30" show-word-limit>
  18. </el-input>
  19. </div>
  20. <div class="content">
  21. <el-input class="input" type="textarea" :rows="3" placeholder="请输入内容" v-model="shareModel.shareContent"
  22. maxlength="30" show-word-limit>
  23. </el-input>
  24. <el-upload class="upload-demo" action="no_useing" accept="image/*" ref="my-upload" :http-request="uploadFile"
  25. :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :show-file-list="false">
  26. <div class="changeCover">
  27. <img class="cover" :src="shareImg" alt="">
  28. <div class="cover-title">更换封面</div>
  29. </div>
  30. </el-upload>
  31. </div>
  32. </div>
  33. <div class="qrcode-title">渠道二维码
  34. <div class="qrcode-copy" @click="copy">
  35. <img class="qrcode-copy-img" src="../assets/images/qrcode-copy.png" alt="">
  36. 复制链接
  37. </div>
  38. </div>
  39. <!-- <div class="qrcode">
  40. <el-input v-model="input" placeholder="请输入内容"></el-input>
  41. <img class="qrcode-img" src="" alt="">
  42. <div class="qrcode-btn">
  43. <div class="qrcode-download" @click="save">下载二维码</div>
  44. <div class="qrcode-copy" @click="save">
  45. <img class="qrcode-copy-img" src="../assets/images/qrcode-copy.png" alt="">
  46. 复制链接</div>
  47. </div>
  48. </div>
  49. <div class="qrcode-add">添加渠道</div> -->
  50. <div class="share-save" @click="save">确定</div>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import editorApi from "../api/editor";
  56. import * as http from "../util/http";
  57. export default {
  58. data() {
  59. return {
  60. shareImg: ""
  61. };
  62. },
  63. props: {
  64. close: {
  65. type: Function,
  66. default: null
  67. },
  68. shareModel: ""
  69. },
  70. watch: {
  71. shareModel(val) {
  72. console.log("shareModel", this.shareModel);
  73. this.shareImg = val.shareImg;
  74. }
  75. },
  76. methods: {
  77. async uploadFile(file) {
  78. console.log("上传", file);
  79. var that = this;
  80. http.uploadMaterielFile(
  81. file.file,
  82. function(res) {
  83. that.shareImg = res;
  84. console.log("上传结果1", res);
  85. },
  86. function(res) {
  87. console.log("上传结果中", res);
  88. }
  89. );
  90. },
  91. handleAvatarSuccess() {
  92. console.log("成功");
  93. },
  94. beforeAvatarUpload() {
  95. console.log("失败");
  96. },
  97. copy() {
  98. this.$message.success("复制成功");
  99. },
  100. closeBtn() {
  101. this.close();
  102. },
  103. save() {
  104. this.shareModel["updator"] = "admin";
  105. this.shareModel["shareImg"] = this.shareImg;
  106. editorApi.saveTheme(this.shareModel).then(res => {
  107. if (res.success) {
  108. this.$message.success("保存成功");
  109. } else {
  110. this.$message.error("数据加载失败,请重试");
  111. }
  112. });
  113. console.log("XXXX", this.currItem);
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="less" scoped>
  119. .share {
  120. z-index: 1000;
  121. position: fixed;
  122. top: 0;
  123. right: 0;
  124. bottom: 0;
  125. left: 0;
  126. background: rgba(0, 0, 0, 0.6);
  127. display: flex;
  128. flex-direction: row;
  129. .preview {
  130. flex-grow: 2;
  131. display: flex;
  132. flex-direction: column;
  133. justify-content: center;
  134. align-items: center;
  135. .phone-top {
  136. width: 341px;
  137. height: 83px;
  138. background: url(../assets/images/phone-model-top.png) center no-repeat;
  139. background-size: cover;
  140. }
  141. .phone-center {
  142. position: relative;
  143. width: 346px;
  144. height: 530px;
  145. background: url(../assets/images/phone-model-center.png) repeat-y;
  146. background-size: cover;
  147. }
  148. .content {
  149. position: absolute;
  150. width: 298px;
  151. height: 530px;
  152. .phone-status {
  153. margin-left: -2px;
  154. margin-top: -2px;
  155. width: 300px;
  156. height: 50px;
  157. background: url(../assets/images/phone-model-status.png) repeat-y;
  158. background-size: cover;
  159. }
  160. .preview-area {
  161. position: relative;
  162. margin-left: -1px;
  163. width: 298px;
  164. height: 480px;
  165. border: 1px solid #000;
  166. border-top: 0px;
  167. }
  168. }
  169. .phone-bottom {
  170. width: 342px;
  171. height: 87px;
  172. background: url(../assets/images/phone-model-bottom.png) center no-repeat;
  173. background-size: cover;
  174. }
  175. }
  176. .setting {
  177. overflow: auto;
  178. width: 446px;
  179. height: 100%;
  180. background: #fff;
  181. .share-close {
  182. z-index: 1001;
  183. position: absolute;
  184. top: 0px;
  185. right: 0px;
  186. width: 63px;
  187. height: 57px;
  188. cursor: pointer;
  189. }
  190. .share-title {
  191. margin: 80px 0px 10px 18px;
  192. font-size: 16px;
  193. font-family: PingFangSC-Regular;
  194. font-weight: 400;
  195. color: rgba(0, 0, 0, 1);
  196. line-height: 22px;
  197. }
  198. .share-titleBox {
  199. margin: 0px 12px;
  200. height: 150px;
  201. border-radius: 4px;
  202. border: 1px solid rgba(204, 204, 204, 1);
  203. .top {
  204. display: flex;
  205. flex-direction: row;
  206. justify-content: space-between;
  207. margin: 10px;
  208. }
  209. .content {
  210. display: flex;
  211. position: relative;
  212. .input {
  213. width: 326px;
  214. margin-left: 10px;
  215. }
  216. .changeCover {
  217. margin: 0px 10px;
  218. width: 70px;
  219. height: 70px;
  220. background: rgba(239, 239, 239, 1);
  221. cursor: pointer;
  222. .cover {
  223. width: 100%;
  224. height: 100%;
  225. }
  226. }
  227. .cover-title {
  228. position: absolute;
  229. bottom: 0px;
  230. right: 10px;
  231. width: 70px;
  232. height: 20px;
  233. background: rgba(0, 0, 0, 0.8);
  234. color: #fff;
  235. font-size: 12px;
  236. line-height: 20px;
  237. text-align: center;
  238. }
  239. }
  240. }
  241. .qrcode-title {
  242. margin: 28px 0px 10px 18px;
  243. font-size: 16px;
  244. font-family: PingFangSC-Regular;
  245. font-weight: 400;
  246. color: rgba(0, 0, 0, 1);
  247. line-height: 22px;
  248. position: relative;
  249. .qrcode-copy {
  250. position: absolute;
  251. top: -5px;
  252. left: 100px;
  253. font-size: 14px;
  254. font-family: PingFangSC-Regular;
  255. font-weight: 400;
  256. color: rgba(78, 93, 255, 1);
  257. line-height: 30px;
  258. text-align: center;
  259. width: 125px;
  260. height: 30px;
  261. background: rgba(230, 237, 255, 1);
  262. border-radius: 15px;
  263. cursor: pointer;
  264. .qrcode-copy-img {
  265. width: 16px;
  266. height: 16px;
  267. vertical-align: middle;
  268. }
  269. }
  270. }
  271. .qrcode {
  272. margin-left: 18px;
  273. margin-bottom: 10px;
  274. width: 408px;
  275. height: 283px;
  276. border: 1px solid rgba(204, 204, 204, 1);
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. .el-input {
  281. margin-top: 16px;
  282. width: 265px;
  283. }
  284. .qrcode-img {
  285. margin-top: 16px;
  286. width: 140px;
  287. height: 140px;
  288. background: rgba(239, 239, 239, 1);
  289. }
  290. .qrcode-btn {
  291. display: flex;
  292. justify-content: space-between;
  293. width: 250px;
  294. height: 31px;
  295. margin-top: 20px;
  296. font-size: 14px;
  297. font-family: PingFangSC-Regular;
  298. font-weight: 400;
  299. color: rgba(78, 93, 255, 1);
  300. line-height: 30px;
  301. text-align: center;
  302. .qrcode-download {
  303. width: 91px;
  304. height: 30px;
  305. background: rgba(230, 237, 255, 1);
  306. border-radius: 15px;
  307. cursor: pointer;
  308. }
  309. .qrcode-copy {
  310. width: 125px;
  311. height: 30px;
  312. background: rgba(230, 237, 255, 1);
  313. border-radius: 15px;
  314. cursor: pointer;
  315. .qrcode-copy-img {
  316. width: 16px;
  317. height: 16px;
  318. vertical-align: middle;
  319. }
  320. }
  321. }
  322. }
  323. .qrcode-add {
  324. margin-left: 18px;
  325. margin-top: 20px;
  326. width: 408px;
  327. height: 44px;
  328. background: rgba(241, 241, 241, 1);
  329. border: 1px dotted rgba(192, 192, 192, 1);
  330. line-height: 44px;
  331. text-align: center;
  332. font-size: 14px;
  333. font-weight: 400;
  334. color: rgba(78, 93, 255, 1);
  335. cursor: pointer;
  336. }
  337. .share-save {
  338. text-align: center;
  339. width: 105px;
  340. height: 34px;
  341. background: rgba(78, 93, 255, 1);
  342. border-radius: 19px;
  343. margin-top: 167px;
  344. margin-bottom: 94px;
  345. margin-left: 174px;
  346. font-weight: 500;
  347. color: rgba(255, 255, 255, 1);
  348. line-height: 34px;
  349. font-size: 14px;
  350. cursor: pointer;
  351. }
  352. }
  353. }
  354. </style>