draw.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. <template>
  2. <view>
  3. <view style="color: #fff;">
  4. <tn-nav-bar backgroundColor="#207CF7" :bottomShadow="false">绘画记录</tn-nav-bar>
  5. </view>
  6. <z-paging ref="paging" refresher-complete-delay="200" v-model="drawList" @query="queryList">
  7. <view slot="top" class="z_tabs" :style="{ marginTop: tobheight + 'px' }"></view>
  8. <view class="u-flex flex-wrap">
  9. <block v-for="(item,index) in drawList" :key="index">
  10. <!-- 艺术照记录 -->
  11. <view class="draw_view" v-if="item.engine=='rh'" style="margin:30rpx">
  12. <view class="draw_image u-flex align-center">
  13. <image @click="preview_ysz(item.origin_url)" :src="item.origin_url" mode="widthFix"></image>
  14. </view>
  15. <view class="prompt"><u-parse content="" :selectable="true"></u-parse></view>
  16. <view class="create_time">AI绘画:Face(艺术照)绘图
  17. </view>
  18. <view class="create_time">创建时间:{{item.create_time}}</view>
  19. <view class="tn-flex justify-between operate">
  20. <view @click="tnproduct_ysz(item.rh_id)" hover-class="hoversubmit" class="onekey"
  21. style="width: 100%;">
  22. 绘画详情</view>
  23. </view>
  24. <view class="circle" @click.stop="gallerydel_ysz(item.id)">
  25. <u-icon name="close-circle-fill" color="#999999" size="24"></u-icon>
  26. </view>
  27. </view>
  28. <view v-else class="draw_view" :style="{margin:item.status?'30rpx':'0'}">
  29. <view v-if="item.imgs_file.length>1" class="sheets">
  30. {{item.imgs_file.length}}张
  31. </view>
  32. <view v-if="item.done == 1&&item.status == 1" class="draw_image u-flex align-center">
  33. <image @click="preview(index)"
  34. :src="item.imgs_file[item.steps]?item.imgs_file[item.steps]:item.origin_url"
  35. mode="widthFix"></image>
  36. <view v-if="item.imgs_file.length>1" class="imgs_arrow u-flex align-center justify-between">
  37. <view @click.stop="item.steps==0?'':item.steps--" class="arrow"><u-icon
  38. name="arrow-left" color="#fff" size="28"></u-icon></view>
  39. <view @click.stop="item.steps==item.imgs_file.length - 1?'':item.steps++" class="arrow">
  40. <u-icon name="arrow-right" color="#fff" size="28"></u-icon>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 只显示生成成功的绘画记录 -->
  45. <view class="" v-if="item.status">
  46. <view class="prompt"><u-parse :content="item.prompt|filterPro(item.prompt)"
  47. :selectable="true"></u-parse></view>
  48. <view class="create_time">AI绘画:{{item.engine == 'sd'?'StableDiffusion绘图':'MidJourney绘图'}}
  49. </view>
  50. <view class="create_time" style="word-break: break-all;">关键词:{{item.prompt}}</view>
  51. <view class="create_time">创建时间:{{item.create_time}}</view>
  52. <!-- <view v-if="item.done == 1&&item.status == 1" @click="createPoster(index)" hover-class="hoversubmit" class="onekey">生成海报</view> -->
  53. <block v-if="item.engine == 'sd'">
  54. <view v-if="item.done == 1&&item.status == 1" class="tn-flex justify-between operate">
  55. <view @click="tnproduct(item.id,item.engine)" hover-class="hoversubmit"
  56. class="onekey">
  57. 绘画详情</view>
  58. <view @click="createPoster(index,item.steps)" hover-class="hoversubmit"
  59. class="onekey" style="background: #FFC107;">生成海报</view>
  60. </view>
  61. </block>
  62. <block v-else>
  63. <view v-if="item.done == 1&&item.status == 1&&isInHour24(item)"
  64. class="tn-flex justify-between operate">
  65. <!-- 24小时二次创作 -->
  66. <!-- <view @click="tnproduct(item.id,item.engine)" hover-class="hoversubmit" class="onekey">
  67. 绘画详情</view> -->
  68. <view @click="twoProduct(item)" hover-class="hoversubmit" class="onekey">
  69. 二次创作(24小时内)</view>
  70. <view @click="createPoster(index,item.steps)" hover-class="hoversubmit"
  71. class="onekey" style="background: #FFC107;">生成海报</view>
  72. </view>
  73. <view v-if="item.done == 1&&item.status == 1&&!isInHour24(item)"
  74. class="tn-flex justify-between operate">
  75. <view @click="createPoster(index,item.steps)" hover-class="hoversubmit"
  76. class="onekey" style="background: #FFC107;width: 100%;">生成海报</view>
  77. </view>
  78. </block>
  79. <view v-if="item.done > 0&&item.status > 0" class="circle" @click.stop="gallerydel(index)">
  80. <u-icon name="close-circle-fill" color="#999999" size="24"></u-icon>
  81. </view>
  82. </view>
  83. </view>
  84. </block>
  85. </view>
  86. </z-paging>
  87. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  88. <u-popup :show="showPoster" mode="bottom" @close="showPoster = false">
  89. <scroll-view scroll-y="true" :style="{maxHeight: (posterheight) +'px'}">
  90. <wike-painter :board="posterObj" @done="posterSuccess" ref="painter"></wike-painter>
  91. <view style="height: 78px;"></view>
  92. <view class="dygbhg">
  93. <view class="whole" @click="showPoster = false">取消</view>
  94. <view class="distinguish" @click="toSave">保存/分享</view>
  95. </view>
  96. </scroll-view>
  97. </u-popup>
  98. </view>
  99. </template>
  100. <script>
  101. import {
  102. mapMutations,
  103. mapActions,
  104. mapState,
  105. mapGetters
  106. } from 'vuex';
  107. export default {
  108. data() {
  109. return {
  110. tobheight: 45,
  111. platform: this.$platform.get(),
  112. isLoading: true,
  113. drawList: [],
  114. showPoster: false,
  115. posterheight: '',
  116. qrcode: '',
  117. posterObj: {},
  118. subsectionlist: ['第1张图片', '第2张图片', '第3张图片'],
  119. current: 0
  120. }
  121. },
  122. computed: {
  123. ...mapGetters(['appInfo', 'userInfo', 'isLogin'])
  124. },
  125. onLoad() {
  126. const that = this;
  127. if (this.platform == 'wxMiniProgram') {
  128. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight;
  129. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop;
  130. this.tobheight = menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height;
  131. }
  132. this.posterheight = uni.$u.sys().windowHeight - this.tobheight
  133. this.commonqrcodePath();
  134. },
  135. filters: {
  136. filterPro(prompt) {
  137. console.log('prompt', prompt);
  138. if (prompt.includes('http') && prompt.includes('.png')) {
  139. let tempKeyWord = ''
  140. prompt.split('.png').forEach((item, index) => {
  141. if (!item.includes('http')) {
  142. tempKeyWord += item
  143. }
  144. })
  145. return tempKeyWord
  146. } else if (prompt.includes('http') && prompt.includes('.jpeg')) {
  147. let tempKeyWord = ''
  148. prompt.split('.jpeg').forEach((item, index) => {
  149. if (!item.includes('http')) {
  150. tempKeyWord += item
  151. }
  152. })
  153. return tempKeyWord
  154. } else if (prompt.includes('http') && prompt.includes('.jpg')) {
  155. let tempKeyWord = ''
  156. prompt.split('.jpg').forEach((item, index) => {
  157. if (!item.includes('http')) {
  158. tempKeyWord += item
  159. }
  160. })
  161. return tempKeyWord
  162. }
  163. }
  164. },
  165. methods: {
  166. gallerydel_ysz(id) {
  167. var that = this;
  168. uni.showModal({
  169. confirmText: '删除',
  170. content: '是否删除此绘画记录',
  171. title: '提示',
  172. confirmColor: '#1F79F0',
  173. success(res) {
  174. // console.log(res);
  175. if (res.confirm) {
  176. that.$http('gallery.del', {
  177. id
  178. }).then(res => {
  179. if (res.code == 0) {
  180. uni.showToast({
  181. title: '删除成功'
  182. })
  183. // that.drawList = []
  184. that.$refs.paging.reload(true);
  185. } else {
  186. uni.showToast({
  187. title: '删除失败',
  188. icon: 'none'
  189. })
  190. }
  191. });
  192. }
  193. }
  194. })
  195. },
  196. tnproduct_ysz(id) {
  197. uni.navigateTo({
  198. url: '/pages/painting/details?from=rh&urls=' + id
  199. })
  200. },
  201. preview_ysz(url) {
  202. uni.previewImage({
  203. urls: [url],
  204. longPressActions: {
  205. itemList: ['发送给朋友', '保存图片', '收藏'],
  206. success: function(data) {},
  207. fail: function(err) {
  208. console.log(err.errMsg);
  209. }
  210. }
  211. });
  212. },
  213. isInHour24(item) {
  214. // item.create_time = '2023-08-18 10:36:12'
  215. // console.log('要判断是否在24h内的那一项:', item.create_time, Date.now(), new Date(item.create_time).getTime());
  216. if (Date.now() - new Date(item.create_time).getTime() <= 24 * 3600000) {
  217. return true
  218. } else {
  219. return false
  220. }
  221. },
  222. queryList(pageNo, pageSize) {
  223. //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  224. const params = {
  225. page: pageNo,
  226. limit: pageSize
  227. };
  228. this.$http('gallery.list', params).then(res => {
  229. if (res.code == 0) {
  230. uni.setNavigationBarTitle({
  231. title: this.appInfo.site_name
  232. });
  233. console.log('绘画记录返回值:', res.data.data);
  234. // let addRh = {
  235. // api_id: 0,
  236. // avatar: "https://v.swdz.com/addons/wike_aging/public/static/storage/20230517/7a01df223b06717edca445b333de2741.png",
  237. // create_time: "2024-02-07 14:50:26",
  238. // delete_time: null,
  239. // done: 1,
  240. // engine: "rh",
  241. // height: 0,
  242. // id: 9291,
  243. // id_number: "7498213065",
  244. // img: null,
  245. // imgs: null,
  246. // imgs_file: "",
  247. // imgs_path: "",
  248. // is_open: 0,
  249. // job_id: "ad967e16-c7a9-0fdb-8db0-ccfd915a1752",
  250. // mj_action: "generate",
  251. // mj_api_engine: "zsy",
  252. // mj_hash: null,
  253. // mj_id: "1204680700574302259",
  254. // mj_index: 1,
  255. // mode: null,
  256. // model_id: null,
  257. // n_samples: 0,
  258. // nickname: "roobe",
  259. // origin_url: "https://midjourney.cdn.zhishuyun.com/attachments/1124768570157564029/1204680700574302259/kylejohnsongfa8_Venom_and_Carnage_fight_character_realistic_bod_672a83b4-49a9-4e61-aea0-1ba59ba8cc71.png?ex=65d59d54&is=65c32854&hm=8fdcaf884db53bf81136e666e037a20d7a42b105f622e38b58e59b4981aaae18&width=1024&height=1024",
  260. // paid_coin: "5",
  261. // pid: 0,
  262. // prompt: " Venom and Carnage fight, character, realistic body, realistic muscle cyberpunk, glowing fire, film lens, octane render, 8K--niji",
  263. // real_prompt: null,
  264. // scheduler: null,
  265. // seed: null,
  266. // sort: 0,
  267. // status: 1,
  268. // steps: 0,
  269. // uid: 4825,
  270. // uniacid: 5059,
  271. // update_time: "2024-02-07 14:50:26",
  272. // uuid: "ad967e16-c7a9-0fdb-8db0-ccfd915a1752",
  273. // width: 0
  274. // }
  275. // res.data.data = [addRh, ...res.data.data]
  276. // let sucList = res.data.data.filter((item, index) => {
  277. // return item.status
  278. // })
  279. this.$refs.paging.complete(res.data.data);
  280. this.isLoading = false;
  281. }
  282. });
  283. },
  284. commonqrcodePath() {
  285. let spm = this.userInfo.id + '.1.0.' + this.spmplatform + '.1';
  286. this.$http('common.qrcodePath', {
  287. spm: spm
  288. }).then(res => {
  289. if (res.code == 0) {
  290. this.qrcode = res.data;
  291. }
  292. });
  293. },
  294. getdownload(e, type) {
  295. return new Promise((resolve, reject) => {
  296. // uni.getImageInfo({
  297. // src: e,
  298. // success: res => {
  299. // uni.downloadFile({
  300. // url: e,
  301. // success: (res) => {
  302. // if (res.statusCode === 200) {
  303. // resolve(res.tempFilePath);
  304. // }
  305. // if(res.statusCode === 404){
  306. // let head = '/static/images/head.jpg',open = '/static/images/open.png';
  307. // if(type == 1){
  308. // resolve(head);
  309. // }else{
  310. // resolve(open);
  311. // }
  312. // }
  313. // }
  314. // });
  315. // },
  316. // fail: err => {
  317. // let head = '/static/images/head.jpg',open = '/static/images/open.png';
  318. // if(type == 1){
  319. // resolve(head);
  320. // }else{
  321. // resolve(open);
  322. // }
  323. // }
  324. // })
  325. uni.request({
  326. url: e,
  327. method: 'GET',
  328. responseType: 'arraybuffer',
  329. success: ress => {
  330. let base64 = wx.arrayBufferToBase64(ress.data);
  331. base64 = 'data:image/jpeg;base64,' + base64
  332. resolve(base64);
  333. },
  334. fail: (e) => {
  335. let head = '/static/images/head.jpg',
  336. open = '/static/images/open.png';
  337. if (type == 1) {
  338. resolve(head);
  339. } else {
  340. resolve(open);
  341. }
  342. }
  343. })
  344. });
  345. },
  346. toSave() {
  347. uni.showLoading({
  348. title: '海报生成中'
  349. });
  350. this.$refs.painter.canvasToTempFilePathSync({
  351. // 在nvue里是jpeg
  352. fileType: 'jpg',
  353. quality: 1,
  354. success: res => {
  355. // this.path = res.tempFilePath;
  356. // this.$refs.posterImg.open();
  357. // this.show_poster = true;
  358. // console.log(res.tempFilePath);
  359. // 非H5 保存到相册
  360. // H5 提示用户长按图另存
  361. // #ifdef MP-WEIXIN
  362. // uni.saveImageToPhotosAlbum({
  363. // filePath: res.tempFilePath,
  364. // success: function() {
  365. // uni.showToast({
  366. // title: '保存成功'
  367. // });
  368. // that.showPoster = false;
  369. // }
  370. // });
  371. wx.showShareImageMenu({
  372. path: res.tempFilePath
  373. })
  374. this.showPoster = false;
  375. uni.hideLoading();
  376. // #endif
  377. // #ifdef H5
  378. this.showPoster = false;
  379. uni.hideLoading();
  380. uni.showModal({
  381. confirmColor: '#26B3A0',
  382. confirmText: '查看图片',
  383. title: '提示',
  384. content: '查看图片后长按图片即可保存或分享',
  385. success(src) {
  386. if (src.confirm) {
  387. uni.previewImage({
  388. urls: [res.tempFilePath]
  389. });
  390. } else if (src.cancel) {
  391. this.showPoster = true;
  392. }
  393. }
  394. });
  395. // #endif
  396. }
  397. });
  398. },
  399. posterSuccess() {
  400. uni.hideLoading();
  401. },
  402. tnproduct(id, engine) {
  403. uni.navigateTo({
  404. url: engine == 'sd' ? '/pages/painting/details?from=sd&urls=' + id :
  405. '/pages/painting/generate?from=mj&urls=' +
  406. id
  407. })
  408. },
  409. // 二次创作(24h内)
  410. twoProduct(item) {
  411. console.log('能够二次创作的那一项:', item);
  412. // return
  413. // uni.navigateTo({
  414. // url: '/pages/painting/generate?from=mj&urls=' + item
  415. // .id + '&prompt=' + item.prompt + "&model_id=" + item.model_id + '&needCoin=' + item
  416. // .paid_coin + '&version=undefined'
  417. // })
  418. uni.navigateTo({
  419. url: '/pages/painting/generate?urls=' + item
  420. .id
  421. })
  422. },
  423. async createPoster(e, steps) {
  424. let that = this;
  425. let stays = '';
  426. let site_logo = '';
  427. uni.showLoading({
  428. title: '海报渲染中'
  429. });
  430. // that.userInfo.avatar =
  431. // "https://midjourney.cdn.zhishuyun.com/attachments/1124768570157564029/1204680700574302259/kylejohnsongfa8_Venom_and_Carnage_fight_character_realistic_bod_672a83b4-49a9-4e61-aea0-1ba59ba8cc71.png?ex=65d59d54&is=65c32854&hm=8fdcaf884db53bf81136e666e037a20d7a42b105f622e38b58e59b4981aaae18&width=1024&height=1024"
  432. // that.appInfo.site_logo_path =
  433. // "https://midjourney.cdn.zhishuyun.com/attachments/1124768570157564029/1204680700574302259/kylejohnsongfa8_Venom_and_Carnage_fight_character_realistic_bod_672a83b4-49a9-4e61-aea0-1ba59ba8cc71.png?ex=65d59d54&is=65c32854&hm=8fdcaf884db53bf81136e666e037a20d7a42b105f622e38b58e59b4981aaae18&width=1024&height=1024"
  434. let mode = that.drawList[e].engine == 'sd' ? 'StableDiffusion绘图' : 'MidJourney绘图';
  435. let avatar_logo = that.userInfo.avatar ? await this.getdownload(that.userInfo.avatar, 1) :
  436. '/static/images/head.jpg';
  437. if (that.appInfo.site_logo_path.indexOf("https") < 0) {
  438. site_logo = that.appInfo.site_logo_path ? await that.getdownload(that.appInfo.site_logo_path
  439. .replace("http:", "https:"), 2) : '/static/images/open.png';
  440. } else {
  441. site_logo = that.appInfo.site_logo_path ? await that.getdownload(that.appInfo.site_logo_path, 2) :
  442. '/static/images/open.png';
  443. }
  444. // console.log(that.drawList[e].imgs_file[steps]);
  445. if (that.drawList[e].imgs_file) {
  446. if (that.drawList[e].imgs_file[steps].indexOf("https") < 0) {
  447. stays = await that.getdownload(that.drawList[e].imgs_file[steps].replace("http:", "https:"),
  448. 2);
  449. } else {
  450. stays = await that.getdownload(that.drawList[e].imgs_file[steps], 2);
  451. }
  452. } else {
  453. if (that.drawList[e].origin_url.indexOf("https") < 0) {
  454. stays = await that.getdownload(that.drawList[e].origin_url.replace("http:", "https:"), 2);
  455. } else {
  456. stays = await that.getdownload(that.drawList[e].origin_url, 2);
  457. }
  458. }
  459. if (stays == '/static/images/open.png') {
  460. uni.hideLoading();
  461. uni.showToast({
  462. title: '生成失败',
  463. icon: 'none'
  464. })
  465. return;
  466. }
  467. (that.posterObj = {
  468. width: uni.$u.sys().windowWidth + 'px',
  469. background: 'linear-gradient(to right, #00ca88 0%, #00BCD4 100%)',
  470. css: {
  471. // 根节点若无尺寸,自动获取父级节点
  472. width: uni.$u.sys().windowWidth + 'px'
  473. },
  474. views: [{
  475. type: 'view',
  476. css: {
  477. marginTop: '20rpx',
  478. paddingLeft: '10rpx',
  479. display: 'flex'
  480. },
  481. views: [{
  482. type: 'image',
  483. src: avatar_logo,
  484. css: {
  485. marginTop: '10rpx',
  486. marginLeft: '20rpx',
  487. borderRadius: '16rpx',
  488. width: '80rpx',
  489. height: '80rpx',
  490. border: '2rpx solid #fff',
  491. objectFit: 'cover'
  492. }
  493. },
  494. {
  495. type: 'view',
  496. css: {
  497. marginTop: '10rpx',
  498. marginLeft: '20rpx'
  499. },
  500. views: [{
  501. type: 'view',
  502. views: [{
  503. type: 'text',
  504. text: this.userInfo.nickname ? this.userInfo
  505. .nickname : '提问者',
  506. css: {
  507. marginTop: '10rpx',
  508. fontSize: '28rpx',
  509. fontWeight: 'bold',
  510. color: '#32324A',
  511. lineHeight: '28rpx'
  512. }
  513. }]
  514. },
  515. {
  516. type: 'view',
  517. views: [{
  518. type: 'text',
  519. text: '绘图描述词📝',
  520. css: {
  521. marginTop: '15rpx',
  522. fontSize: '20rpx',
  523. color: '#fff',
  524. lineHeight: '25rpx',
  525. }
  526. }]
  527. }
  528. ]
  529. }
  530. ]
  531. },
  532. {
  533. type: 'view',
  534. css: {
  535. marginTop: '20rpx',
  536. width: (uni.$u.sys().windowWidth - 48) + 'px',
  537. padding: '15rpx',
  538. background: '#fff',
  539. borderRadius: '16rpx',
  540. marginLeft: '30rpx',
  541. },
  542. views: [{
  543. type: 'text',
  544. text: that.drawList[e].prompt,
  545. css: {
  546. fontSize: '28rpx',
  547. color: '#000',
  548. // lineHeight: '45rpx',
  549. // lineClamp: 2,
  550. width: (uni.$u.sys().windowWidth - 48) + 'px'
  551. }
  552. }]
  553. },
  554. {
  555. type: 'view',
  556. css: {
  557. marginTop: '20rpx',
  558. paddingLeft: '10rpx',
  559. display: 'flex'
  560. },
  561. views: [{
  562. type: 'image',
  563. src: site_logo,
  564. css: {
  565. marginTop: '10rpx',
  566. marginLeft: '20rpx',
  567. borderRadius: '16rpx',
  568. width: '80rpx',
  569. height: '80rpx',
  570. border: '2rpx solid #fff',
  571. objectFit: 'cover'
  572. }
  573. },
  574. {
  575. type: 'view',
  576. css: {
  577. marginTop: '10rpx',
  578. marginLeft: '20rpx'
  579. },
  580. views: [{
  581. type: 'view',
  582. views: [{
  583. type: 'text',
  584. text: this.appInfo.site_name ? this.appInfo
  585. .site_name : 'AI智能问答机器人',
  586. css: {
  587. marginTop: '10rpx',
  588. fontSize: '28rpx',
  589. fontWeight: 'bold',
  590. color: '#32324A',
  591. lineHeight: '28rpx'
  592. }
  593. }]
  594. },
  595. {
  596. type: 'view',
  597. views: [{
  598. type: 'text',
  599. text: mode + '结果📝',
  600. css: {
  601. marginTop: '15rpx',
  602. fontSize: '20rpx',
  603. color: '#fff',
  604. lineHeight: '25rpx',
  605. }
  606. }]
  607. }
  608. ]
  609. }
  610. ]
  611. },
  612. {
  613. type: 'image',
  614. src: stays,
  615. css: {
  616. marginTop: '20rpx',
  617. width: (uni.$u.sys().windowWidth - 32) + 'px',
  618. objectFit: 'contain',
  619. borderRadius: '16rpx',
  620. marginLeft: '30rpx',
  621. }
  622. },
  623. {
  624. type: 'view',
  625. css: {
  626. marginTop: '30rpx',
  627. width: '100%',
  628. textAlign: 'center',
  629. },
  630. // #ifdef H5
  631. views: [{
  632. type: 'qrcode',
  633. text: this.qrcode,
  634. css: {
  635. width: '200rpx',
  636. height: '200rpx',
  637. borderRadius: '16rpx',
  638. }
  639. }],
  640. // #endif
  641. // #ifdef MP-WEIXIN
  642. views: [{
  643. type: 'image',
  644. src: this.qrcode,
  645. css: {
  646. width: '200rpx',
  647. height: '200rpx',
  648. borderRadius: '16rpx',
  649. }
  650. }]
  651. // #endif
  652. },
  653. {
  654. type: 'text',
  655. text: '———— ' + '长按识别 | 欢迎使用' + ' ————',
  656. css: {
  657. marginTop: '20rpx',
  658. marginBottom: '20rpx',
  659. width: '100%',
  660. textAlign: 'center',
  661. fontSize: '24rpx',
  662. color: '#fff',
  663. lineHeight: '33rpx'
  664. }
  665. }
  666. ]
  667. }),
  668. (this.showPoster = true);
  669. },
  670. preview(e) {
  671. if (this.drawList[e].done == 1 && this.drawList[e].status == 1) {
  672. uni.previewImage({
  673. urls: this.drawList[e].imgs_file ? this.drawList[e].imgs_file : [this.drawList[e]
  674. .origin_url
  675. ],
  676. current: 0
  677. });
  678. }
  679. },
  680. gallerydel(e) {
  681. var that = this;
  682. uni.showModal({
  683. confirmText: '删除',
  684. content: '是否删除此绘画记录',
  685. title: '提示',
  686. confirmColor: '#1F79F0',
  687. success(res) {
  688. // console.log(res);
  689. if (res.confirm) {
  690. that.$http('gallery.del', {
  691. id: that.drawList[e].id
  692. }).then(res => {
  693. if (res.code == 0) {
  694. uni.showToast({
  695. title: '删除成功'
  696. })
  697. // that.drawList = []
  698. that.$refs.paging.reload(true);
  699. } else {
  700. uni.showToast({
  701. title: '删除失败',
  702. icon: 'none'
  703. })
  704. }
  705. });
  706. }
  707. }
  708. })
  709. }
  710. }
  711. }
  712. </script>
  713. <style lang="scss">
  714. page {
  715. background: #f6f7fb;
  716. }
  717. .draw_view {
  718. // margin: 30rpx;
  719. width: 100%;
  720. background: #fff;
  721. border-radius: 20rpx;
  722. // padding: 30rpx;
  723. position: relative;
  724. .draw_image {
  725. position: relative;
  726. image {
  727. width: 100%;
  728. height: 280rpx;
  729. border-radius: 20rpx 20rpx 0 0;
  730. }
  731. }
  732. .sheets {
  733. position: absolute;
  734. z-index: 9;
  735. padding: 4px 12px;
  736. background: #0000007d;
  737. color: #fff;
  738. top: 15px;
  739. left: 15px;
  740. border-radius: 48px;
  741. font-size: 13px;
  742. }
  743. .draw_done {
  744. height: 280rpx;
  745. font-size: 30px;
  746. border-radius: 11px 11px 0 0;
  747. background: #000;
  748. color: #fff;
  749. }
  750. .prompt {
  751. padding: 20rpx 30rpx 30rpx;
  752. }
  753. .create_time {
  754. font-size: 26rpx;
  755. color: #9e9e9e;
  756. padding: 0rpx 30rpx 30rpx;
  757. }
  758. // .onekey {
  759. // background: linear-gradient(to right, #00ca88, #00BCD4);
  760. // color: #fff;
  761. // padding: 15rpx 0;
  762. // text-align: center;
  763. // font-size: 24rpx;
  764. // border-radius: 0 0 22rpx 22rpx;
  765. // }
  766. .operate {
  767. padding: 0px 16px 16px;
  768. }
  769. .onekey {
  770. background: linear-gradient(to right, $tc, $tc2);
  771. color: #fff;
  772. padding: 15rpx;
  773. // font-weight: bold;
  774. border-radius: 40rpx;
  775. text-align: center;
  776. font-size: 24rpx;
  777. width: 48%;
  778. }
  779. .hoversubmit {
  780. background: #f7f7f7;
  781. color: #acacb3;
  782. }
  783. .circle {
  784. position: absolute;
  785. right: -14rpx;
  786. top: -14rpx;
  787. background: #fff;
  788. border-radius: 50%;
  789. }
  790. .imgs_arrow {
  791. position: absolute;
  792. // top: 300rpx;
  793. width: 92%;
  794. margin: 0 30rpx;
  795. .arrow {
  796. background: #0000007d;
  797. border-radius: 50%;
  798. padding: 10rpx;
  799. }
  800. }
  801. }
  802. .dygbhg {
  803. background: #ffffff;
  804. border-radius: 15rpx 15rpx 0 0;
  805. position: fixed;
  806. bottom: 0;
  807. left: 0;
  808. width: 100%;
  809. box-shadow: 0px 0px 10px #00000024;
  810. display: flex;
  811. align-items: center;
  812. justify-content: space-evenly;
  813. }
  814. .whole {
  815. width: 45%;
  816. height: 88rpx;
  817. display: flex;
  818. color: #ffffff;
  819. align-items: center;
  820. justify-content: center;
  821. background: #f3f3f3;
  822. font-weight: bold;
  823. border-radius: 60rpx;
  824. color: #3d7eff;
  825. }
  826. .distinguish {
  827. width: 45%;
  828. height: 88rpx;
  829. display: flex;
  830. color: #ffffff;
  831. align-items: center;
  832. justify-content: center;
  833. background: #3d7eff;
  834. font-weight: bold;
  835. border-radius: 60rpx;
  836. margin: 38rpx 0;
  837. margin-left: 4%;
  838. }
  839. /* 全屏轮播 start*/
  840. .card-swiper {
  841. height: 100vh !important;
  842. }
  843. .card-swiper swiper-item {
  844. width: 750rpx !important;
  845. left: 0rpx;
  846. box-sizing: border-box;
  847. overflow: initial;
  848. background: #000;
  849. }
  850. .card-swiper swiper-item .swiper-item {
  851. display: flex;
  852. align-items: center;
  853. justify-content: center;
  854. height: 100%;
  855. background: #000;
  856. }
  857. .card-swiper swiper-item.cur .swiper-item {
  858. transform: scale(1);
  859. transition: all 0.2s ease-in 0s;
  860. will-change: transform;
  861. }
  862. </style>