利用ai绘画小程序生成漫画脸的操作,附代码!,有没有可玩性----ai绘画小程序

本人一手独立开发小程序----附代码
在这里插入图片描述在这里插入图片描述
导入我们的图片
在这里插入图片描述
最后。我们看一下效果
在这里插入图片描述
是不是美美哒?

看一下代码

<view class="index">
    <scroll-view scroll-y="true" style="height:{{hg}}px;" bind:scrolltolower="scrolltolower">
        <view style="width: 100%;">
            <view class="container">
            <view style=" display: inline-block;" wx:for="{{a.data}}">
            <view style="width: {{w}}px;">
            <image src="{{item.en}}" mode="widthFix" style="width: {{w}}px;height: 200rpx;border-radius: 15rpx;position: relative;">
            <view style="position: absolute;bottom: 3%;left: 3%;font-size: 30rpx;color: rgb(226, 226, 226);width: 200rpx;height: 40rpx;background: rgb(240, 228, 228);border-radius: 30rpx;opacity: 0.5;display: flex;align-items: center;justify-content: center;">
            </view>
            <view style="position: absolute;bottom: 3%;left: 3%;font-size: 30rpx;color: rgb(255, 255, 255);width: 200rpx;height: 40rpx;border-radius: 30rpx;display: flex;align-items: center;overflow: hidden;font-size: 22rpx;font-weight: bold;">
            <image src="https://img.zcool.cn/community/01ccaf58c65411a801219c77b0a16c.png@1280w_1l_2o_100sh.png" style="width: 40rpx;height: 40rpx;border-radius: 50%;"></image>
            {{item.zh}}
            </view>
            </image>
        </view>
            </view>
</view>

    </view>
    </scroll-view>
</view>
// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
      okl:"",
      hg:"",
      list: [
        {"url":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-4c2d237a-afe3-4d95-94cf-e0d8f6b312f0/9f66b2f5-4025-45ab-8214-3ef9538bc756.png"},
        {"url":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-4c2d237a-afe3-4d95-94cf-e0d8f6b312f0/9f66b2f5-4025-45ab-8214-3ef9538bc756.png"},
        {"url":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-4c2d237a-afe3-4d95-94cf-e0d8f6b312f0/7281c9a3-10cb-4ca3-a203-6db193476cfe.png"},
        ],
        w:"",
      okna:"",
      w1:"",
      ks:'0',
      js:"10",
      a:"",
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    canIUseGetUserProfile: false,
    canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
  },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  keysearch(res){
      console.log(res)
      this.setData({
        okna:res.detail.value
      })
  },
  tj(res){

      wx.navigateTo({
        url: '/pages/search/search?name='+this.data.okna,
      })
  },
  zt(res){
      console.log(res.currentTarget.dataset.id)
      wx.navigateTo({
        url: '/pages/pge/pge?id='+res.currentTarget.dataset.id,
      })
  },
  scrolltolower(){
      let a=this;
      a.setData({
          ks:Number(a.data.js)+Number(1),
          js:Number(a.data.js)+Number(10),
      })
    wx.request({
        url: 'https://api.phpcos.cn/aihh.php',
        data:{
            mc:'香蕉',
            ks:a.data.ks,
            js:a.data.js,
        },
        success(res){
            console.log(res)
            a.setData({
                a:[...a.data.a,...res.data]
            })
        }
      })
  },
  onLoad() {
      console.log(123)
      var data= wx.getWindowInfo()
      console.log(data.safeArea.width)
      console.log(data.safeArea.height)
      let a=this;
      a.setData({
          hg:data.safeArea.height,
         // w:Number(data.safeArea.width)/2,
          w:Number(Number(data.safeArea.width)/2)-(18)
      })
      wx.request({
        url: '/aihh.php',
        data:{
            mc:'香蕉',
            ks:a.data.ks,
            js:a.data.js
        },
        success(res){
            console.log(res)
            a.setData({
                a:res.data
            })
        }
      })
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
  },
  zc(res){
      console.log(res)
wx.navigateTo({
  url: '/pages/zcwc/zcwc?lx='+res.currentTarget.dataset.lx,
})
  },
  getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
    wx.getUserProfile({
      desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
      success: (res) => {
        console.log(res)
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    })
  },
  onShow: function () {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 1
      })
    }
  },
  getUserInfo(e) {
    // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
    console.log(e)
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值