painting.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view>
  3. <!-- <view class="subsection">
  4. <tn-subsection :list="subsectionlist" mode="button" :borderRadius="50"
  5. animationType="cubic-bezier" bold :height="90" @change="getsubsection"></tn-subsection>
  6. </view> -->
  7. <wike-skeleton :count="4" v-if="showskeleton"></wike-skeleton>
  8. <view style="height: 66px;"></view>
  9. <z-paging ref="paging" refresher-complete-delay="200" v-model="drawList" @query="queryList">
  10. <!-- <view slot="top" class="z_tabs" :style="{ marginTop: 66 + 'px' ,background: 'none'}"></view> -->
  11. <view class="subsection">
  12. <tn-subsection :list="subsectionlist" mode="button" :borderRadius="50"
  13. animationType="cubic-bezier" bold :height="90" @change="getsubsection"></tn-subsection>
  14. </view>
  15. <view style="padding: 150rpx 15rpx 30rpx 15rpx;">
  16. <view v-if="homeTemplate&&homeTemplate.banner&&homeTemplate.banner.length>0" class="wike_ad">
  17. <wike-ad></wike-ad>
  18. </view>
  19. <tn-waterfall v-if="drawList.length>0" ref="waterfall" v-model="drawList" @finish="handleWaterFallFinish">
  20. <template v-slot:left="{ leftList }">
  21. <view v-for="(item, index) in leftList" :key="item.id" class="product__item" @click="tnproduct(item.id)">
  22. <view class="item__image">
  23. <tn-lazy-load :threshold="6000" height="100%" :image="item.imgs_file[0]?item.imgs_file[0]:item.origin_url" :index="item.id"
  24. imgMode="widthFix"></tn-lazy-load>
  25. </view>
  26. </view>
  27. </template>
  28. <template v-slot:right="{ rightList }">
  29. <view v-for="(item, index) in rightList" :key="item.id" class="product__item" @click="tnproduct(item.id)">
  30. <view class="item__image">
  31. <tn-lazy-load :threshold="6000" height="100%" :image="item.imgs_file[0]?item.imgs_file[0]:item.origin_url" :index="item.id"
  32. imgMode="widthFix"></tn-lazy-load>
  33. </view>
  34. </view>
  35. </template>
  36. </tn-waterfall>
  37. <!-- <wike-waterfall :dataList="data" :column="columns" @click="click" :radius="20" :margin="10"></wike-waterfall> -->
  38. </view>
  39. <view slot="bottom" class="z_tabs" :style="{ marginBottom: 72 + 'px' }"></view>
  40. </z-paging>
  41. <view @click="getcreate" class="suspension u-flex align-center justify-center">
  42. AI创作
  43. </view>
  44. <wike-tabbar2 v-if="appInfo.page_template == 3" :is_aipainting="appInfo.is_aipainting" :onTabbar="true" :isShowAnimate="true" :appInfos="appInfo.page_template"></wike-tabbar2>
  45. <wike-tabbar v-else :onTabbar="true" :is_aipainting="appInfo.is_aipainting" :isShowAnimate="true" :appInfos="appInfo.page_template"></wike-tabbar>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. mapMutations,
  51. mapActions,
  52. mapState,
  53. mapGetters
  54. } from 'vuex';
  55. import {
  56. apiurl
  57. } from '@/common/request/request';
  58. import $platform from '@/common/platform';
  59. let rewardedVideoAd = null;
  60. export default {
  61. mixins: [],
  62. components: {},
  63. data() {
  64. return {
  65. list: [],
  66. drawList: [],
  67. subsectionlist:['StableDiffusion绘图','MidJourney绘图'],
  68. engine:'sd',
  69. showskeleton:true
  70. };
  71. },
  72. computed: {
  73. ...mapGetters(['appInfo', 'userInfo','homeTemplate'])
  74. },
  75. onLoad() {
  76. // this.getRandomData()
  77. },
  78. onShow() {
  79. // 网络变化检测
  80. uni.onNetworkStatusChange(res => {
  81. this.isConnected = res.isConnected;
  82. });
  83. },
  84. onReady() {
  85. // #ifdef MP-WEIXIN
  86. if (wx.createRewardedVideoAd && this.appInfo.video_status == 1) {
  87. rewardedVideoAd = wx.createRewardedVideoAd({
  88. adUnitId: this.appInfo.video_id
  89. });
  90. rewardedVideoAd.onLoad(() => {
  91. console.log('onLoad event emit');
  92. });
  93. rewardedVideoAd.onError(err => {
  94. console.log('onError event emit', err);
  95. });
  96. rewardedVideoAd.onClose(res => {
  97. if (res && res.isEnded) {
  98. // 正常播放结束,可以下发游戏奖励
  99. this.memberAddCoin();
  100. this.showcoin = false;
  101. } else {
  102. // 播放中途退出,不下发游戏奖励
  103. uni.showToast({
  104. title: '看完广告后才可获得积分哦',
  105. icon: 'none'
  106. });
  107. }
  108. });
  109. }
  110. // #endif
  111. this.loading = false;
  112. },
  113. methods: {
  114. queryList(pageNo, pageSize) {
  115. //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  116. const params = {
  117. page: pageNo,
  118. limit: pageSize,
  119. engine: this.engine
  120. };
  121. this.$http('gallery.all', params).then(res => {
  122. if (res.code == 0) {
  123. uni.setNavigationBarTitle({
  124. title: this.appInfo.site_name
  125. });
  126. this.showskeleton = false
  127. if(pageNo == 1){
  128. this.drawList = []
  129. }
  130. this.$refs.paging.complete(res.data.data);
  131. this.isLoading = false;
  132. }
  133. });
  134. },
  135. getsubsection(e){
  136. // console.log(e);
  137. this.engine = e.index == 1?'mj':'sd'
  138. this.drawList = []
  139. this.$refs.paging.reload(true);
  140. },
  141. getcreate(){
  142. uni.navigateTo({
  143. url:'/pages/painting/draw'
  144. })
  145. },
  146. /* 瀑布流*/
  147. // 获取随机数据
  148. getRandomData() {
  149. // console.log(13);
  150. // this.loadStatus = 'loading'
  151. for (let i = 0; i < 10; i++) {
  152. let index = this.$t.number.randomInt(0, this.data.length - 1)
  153. let item = JSON.parse(JSON.stringify(this.data[index]))
  154. item.id = this.$t.uuid()
  155. this.list.push(item)
  156. // console.log(this.list);
  157. }
  158. },
  159. // 瀑布流加载完毕事件
  160. handleWaterFallFinish() {
  161. // this.loadStatus = 'loadmore'
  162. },
  163. tnproduct(id){
  164. uni.navigateTo({
  165. url:'/pages/painting/details?urls='+id
  166. })
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. .subsection{
  173. margin: 0rpx 25rpx 0;
  174. position: fixed;
  175. width: 93.8%;
  176. top: 30rpx;
  177. // top: 30rpx;
  178. z-index: 9999;
  179. }
  180. /* 瀑布流*/
  181. .product__item {
  182. background-color: #FFFFFF;
  183. overflow: hidden;
  184. margin: 0 10rpx;
  185. margin-bottom: 20rpx;
  186. // box-shadow: 0rpx 0rpx 30rpx 0rpx rgba(0, 0, 0, 0.07);
  187. .item {
  188. /* 图片 start */
  189. &__image {
  190. width: 100%;
  191. height: auto;
  192. background-color: #FFFFFF;
  193. border: 1rpx solid #F8F7F8;
  194. // border-radius: 20rpx;
  195. overflow: hidden;
  196. }
  197. /* 图片 end */
  198. /* 内容 start */
  199. &__data {
  200. padding: 14rpx 0rpx;
  201. }
  202. /* 标题 start */
  203. &__title-container {
  204. text-align: justify;
  205. line-height: 38rpx;
  206. vertical-align: middle;
  207. }
  208. &__store-type {
  209. height: 28rpx;
  210. font-size: 20rpx;
  211. position: relative;
  212. display: inline-flex;
  213. align-items: center;
  214. justify-content: center;
  215. padding: 4rpx;
  216. border-radius: 6rpx;
  217. white-space: nowrap;
  218. text-align: center;
  219. top: -2rpx;
  220. margin-right: 6rpx;
  221. }
  222. &__title {
  223. font-size: 30rpx;
  224. }
  225. /* 标题 end */
  226. /* 标签 start */
  227. &__tags-container {
  228. display: flex;
  229. flex-direction: row;
  230. flex-wrap: nowrap;
  231. align-items: center;
  232. justify-content: flex-start;
  233. }
  234. &__tag {
  235. margin: 10rpx;
  236. color: #7C8191;
  237. background-color: #F3F2F7;
  238. padding: 4rpx 14rpx 6rpx;
  239. border-radius: 10rpx;
  240. font-size: 20rpx;
  241. &:first-child {
  242. margin-left: 0rpx !important;
  243. }
  244. }
  245. /* 标签 end */
  246. /* 内容 end */
  247. }
  248. }
  249. .suspension{
  250. background: linear-gradient(to right, #00ca88, #00BCD4);
  251. color: #fff;
  252. width: 132rpx;
  253. height: 130rpx;
  254. border-radius: 50%;
  255. position: fixed;
  256. right: 30rpx;
  257. bottom: 220rpx;
  258. font-weight: bold;
  259. font-size: 30rpx;
  260. }
  261. .wike_ad{
  262. margin: 0 6px 11px;
  263. }
  264. .db{
  265. height: 83px;
  266. }
  267. </style>