bayi 1 éve
szülő
commit
16bba779c4

+ 0 - 3
app.json

@@ -35,7 +35,6 @@
             "pages/score/index",
             "pages/commodity/index",
             "pages/medalStore/index",
-            "pages/aiAvatar/index",
             "pages/orderRecord/index",
             "pages/donutLogin/index"
         ]
@@ -69,7 +68,6 @@
             "pages/score/index",
             "pages/commodity/index",
             "pages/medalStore/index",
-            "pages/aiAvatar/index",
             "pages/orderRecord/index",
             "pages/donutLogin/index"
         ]
@@ -102,7 +100,6 @@
         "pages/score/index",
         "pages/commodity/index",
         "pages/medalStore/index",
-        "pages/aiAvatar/index",
         "pages/orderRecord/index"
     ],
     "subpackages": [{

+ 0 - 187
pages/aiAvatar/index.js

@@ -1,187 +0,0 @@
-import {
-    getLoraList,
-    createAiImg,
-    getTaskResult,
-} from '~/api/avatar'
-import {
-    userEvent
-} from '~/api/global'
-Page({
-    data: {
-        templates: [],
-        loading: false,
-        active: '',
-        artistic: '',
-        original: ''
-    },
-    onLoad() {
-        getLoraList().then(res => {
-            this.setData({
-                templates: res.loras,
-                active: res.loras[0] ? res.loras[0].lora_id : ''
-            })
-        })
-        userEvent({
-            action: 'AI_LOGIN'
-        })
-    },
-    async selectTemplate({
-        currentTarget
-    }) {
-        if (this.data.loading) {
-            return
-        }
-        this.setData({
-            active: currentTarget.dataset.id
-        })
-        if (this.data.original) {
-            this.createAiImg()
-        }
-        await userEvent({
-            action: "AI_STYLE",
-            targetContent: currentTarget.dataset.name
-        })
-    },
-    uploadImg() {
-        if (this.data.loading) {
-            return
-        }
-        wx.chooseMedia({
-            count: 1,
-            mediaType: ['image'],
-            sizeType: ['compressed'], //  original 原图;compressed 压缩图
-            sourceType: ['album', 'camera'],
-            camera: 'back',
-            success: (res) => {
-                this.cropper = this.selectComponent("#cropper");
-                this.cropper.init({
-                    imgPath: res.tempFiles[0].tempFilePath, //imgPath是需要裁剪图片的图片路径,只支持本地或临时路径
-                    success: (imgUrl) => {
-                        wx.getFileSystemManager().readFile({
-                            filePath: imgUrl,
-                            encoding: "base64",
-                            success: res => {
-                                //返回base64格式
-                                var base64Str = 'data:image/png' + ';base64,' + res.data
-                                this.setData({
-                                    artistic: base64Str,
-                                    original: base64Str
-                                })
-                                this.createAiImg()
-                                userEvent({
-                                    action: "AI_PHOTO"
-                                })
-                            },
-                            fail: err => {
-                                console.log(err)
-                            }
-                        })
-                    },
-                    fail(error) {
-                        console.log(error) //有两种:cancel代表点击了叉,fail代表wx.canvasToTempFilePath生成图片失败
-                    }
-                });
-            }
-        })
-    },
-    createAiImg() {
-        if (!this.data.original || this.data.loading) {
-            return
-        }
-        this.setData({
-            loading: true
-        })
-        createAiImg({
-            "width": 512, //生成图片宽度
-            "height": 512, //生成图片高度
-            "n_samples": 1, //生成图片数量
-            "controlnet_input_image_base64": this.data.original, //控制图片base64编码
-            "style_id": this.data.active //控制风格id
-        }).then(res => {
-            this.getAiImg(res.uuid)
-        }).catch(() => {
-            this.setData({
-                loading: false
-            })
-            wx.showToast({
-                title: '网络异常请重试',
-                icon: 'none',
-                duration: 2500
-            })
-        })
-    },
-    async getAiImg(uuid) {
-        let res = await getTaskResult({
-            uuid
-        })
-        if (res.data.status != 2) {
-            setTimeout(() => {
-                this.getAiImg(uuid)
-            }, 2500)
-        } else {
-            this.setData({
-                loading: false,
-                artistic: res.data.generated_imgs[0]
-            })
-        }
-    },
-    downloadImg() {
-        wx.getSetting({
-            success: (res) => {
-                if (res.authSetting['scope.writePhotosAlbum']) {
-                    this.base64ToImg()
-                } else {
-                    wx.authorize({
-                        scope: 'scope.writePhotosAlbum',
-                        success: () => {
-                            this.base64ToImg()
-                        },
-                        fail(res) {
-                            wx.showModal({
-                                title: '无法保存到相册',
-                                content: '点击右上角浮点按钮->设置,进行授权',
-                                confirmText: '我知道了',
-                                showCancel: false,
-                            })
-                        }
-                    })
-                }
-            }
-        })
-    },
-    base64ToImg() {
-        const base64 = this.data.artistic; //base64格式图片
-        if (!base64 || this.data.loading) {
-            return
-        }
-        const time = new Date().getTime();
-        const imgPath = wx.env.USER_DATA_PATH + "/poster" + time + "" + ".png";
-        //如果图片字符串不含要清空的前缀,可以不执行下行代码.
-        const imageData = base64.replace(/^data:image\/\w+;base64,/, "");
-        const file = wx.getFileSystemManager();
-        file.writeFileSync(imgPath, imageData, "base64");
-        wx.saveImageToPhotosAlbum({
-            filePath: imgPath,
-            success: async (res) => {
-                wx.showModal({
-                    title: '照片已保存至相册',
-                    content: '快去分享给小伙伴吧',
-                    confirmText: '我知道了',
-                    showCancel: false,
-                })
-                await userEvent({
-                    action: 'AI_SAVE'
-                })
-            }
-        })
-    },
-    onShareAppMessage() {
-        userEvent({
-            action: 'AI_SHARE'
-        })
-        return {
-            title: '玩转AI头像',
-            path: '/pages/index/index',
-        }
-    }
-})

+ 0 - 5
pages/aiAvatar/index.json

@@ -1,5 +0,0 @@
-{
-    "usingComponents": {
-        "cropper": "/components/yeyouzi-cropper/yeyouzi-cropper"
-    }
-}

+ 0 - 141
pages/aiAvatar/index.less

@@ -1,141 +0,0 @@
-.container {
-    position: relative;
-    min-height: 100vh;
-    background-color: #3609B8;
-    overflow: hidden;
-
-    .headerBg {
-        position: absolute;
-        width: 100%;
-        height: 598rpx;
-    }
-
-    .body {
-        position: relative;
-        z-index: 2;
-        margin: 206rpx auto 36rpx;
-        width: 700rpx;
-
-        .uploadBox {
-            position: relative;
-            width: 100%;
-            height: 790rpx;
-
-            .uploadBg {
-                width: 100%;
-                height: 100%;
-            }
-
-            .loading {
-                position: absolute;
-                width: 100%;
-                top: 300rpx;
-                text-align: center;
-                z-index: 3;
-                color: white;
-
-                .loadingImg {
-                    width: 110rpx;
-                    height: 110rpx;
-                    animation: identifier 2.6s infinite linear;
-                }
-
-                .tips1 {
-                    margin: 42rpx 0rpx 42rpx;
-                    font-size: 34rpx;
-                }
-
-                .tips2 {
-                    font-size: 26rpx;
-                }
-            }
-
-            .fillImg {
-                position: absolute;
-                width: 660rpx;
-                height: 642rpx;
-                left: 22rpx;
-                top: 118rpx;
-                border-radius: 20rpx;
-                object-fit: cover;
-            }
-
-            .imgMask::before {
-                position: absolute;
-                content: "";
-                width: 660rpx;
-                height: 642rpx;
-                background-color: rgba(0, 0, 0, 0.4);
-            }
-        }
-
-        .templateBox {
-            margin-top: 30rpx;
-
-            .tHeaderBg {
-                width: 700rpx;
-                height: 48rpx;
-            }
-
-            .templates {
-                position: relative;
-                width: 100%;
-                // height: 236rpx;
-                border-radius: 20rpx;
-
-                .tbg {
-                    position: absolute;
-                    z-index: -1;
-                    width: 100%;
-                    height: 100%;
-                }
-
-                .templateScroll {
-                    width: 100%;
-                    padding: 36rpx 0 6rpx 16rpx;
-                    white-space: nowrap;
-                    box-sizing: border-box;
-
-                    .template {
-                        margin-right: 10rpx;
-                        display: inline-block;
-
-                        .cover {
-                            width: 140rpx;
-                            height: 140rpx;
-                            margin-right: 20rpx;
-                            background-color: white;
-                            border-radius: 10rpx;
-                        }
-
-                        .name {
-                            margin-top: 12rpx;
-                            width: 140rpx;
-                            color: white;
-                            text-align: center;
-                            font-size: 26rpx;
-                        }
-                        .active {
-                            border: 4rpx solid #FDD841;
-                            box-sizing: border-box;
-                        }
-                    }
-
-                }
-            }
-        }
-    }
-
-    .btns {
-        width: 700rpx;
-        margin: 0 auto 40rpx;
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-
-        .btn {
-            width: 285rpx;
-            height: 82rpx;
-        }
-    }
-}

+ 0 - 37
pages/aiAvatar/index.wxml

@@ -1,37 +0,0 @@
-<view class="container">
-    <image src="/static/ai/headerBg.jpg" class="headerBg" />
-    <view class="body">
-        <view class="uploadBox" bindtap="uploadImg">
-            <image src="/static/ai/uploadBg.png" class="uploadBg" />
-            <view class="loading" wx:if="{{loading}}">
-                <image src="/static/ai/loading.png" class="loadingImg" />
-                <view class="tips1">
-                    图片生成中
-                </view>
-                <view class="tips2">
-                    正在制作中请稍等
-                </view>
-            </view>
-            <image src="{{artistic}}" class="fillImg {{loading?'imgMask':''}}" />
-        </view>
-        <view class="templateBox">
-            <image src="/static/ai/tHeaderBg.png" class="tHeaderBg" />
-            <view class="templates">
-                <image src="/static/ai/tbg.png" class="tbg" />
-                <scroll-view class="templateScroll" scroll-x="true" enhanced show-scrollbar="{{false}}">
-                    <view class="template" wx:for="{{templates}}" wx:key="index" bindtap="selectTemplate"
-                        data-id='{{item.lora_id}}'   data-name='{{item.name}}'>
-                        <image src="https://ai.wx.aidomore.com/v3/image/thumbnail/{{item.cover}}"
-                            class="cover {{item.lora_id==active?'active':''}}" />
-                        <view class="name textOver">{{item.name}}</view>
-                    </view>
-                </scroll-view>
-            </view>
-        </view>
-    </view>
-    <view class="btns">
-        <image src="/static/ai/reset.png" class="btn" bindtap="uploadImg" />
-        <image src="/static/ai/download.png" class="btn" bindtap="downloadImg" />
-    </view>
-    <cropper id="cropper" style="width: 100%;height: 100%;"></cropper>
-</view>

+ 0 - 119
pages/aiAvatar/index.wxss

@@ -1,119 +0,0 @@
-.container {
-  position: relative;
-  min-height: 100vh;
-  background-color: #3609B8;
-  overflow: hidden;
-}
-.container .headerBg {
-  position: absolute;
-  width: 100%;
-  height: 598rpx;
-}
-.container .body {
-  position: relative;
-  z-index: 2;
-  margin: 206rpx auto 36rpx;
-  width: 700rpx;
-}
-.container .body .uploadBox {
-  position: relative;
-  width: 100%;
-  height: 790rpx;
-}
-.container .body .uploadBox .uploadBg {
-  width: 100%;
-  height: 100%;
-}
-.container .body .uploadBox .loading {
-  position: absolute;
-  width: 100%;
-  top: 300rpx;
-  text-align: center;
-  z-index: 3;
-  color: white;
-}
-.container .body .uploadBox .loading .loadingImg {
-  width: 110rpx;
-  height: 110rpx;
-  animation: identifier 2.6s infinite linear;
-}
-.container .body .uploadBox .loading .tips1 {
-  margin: 42rpx 0rpx 42rpx;
-  font-size: 34rpx;
-}
-.container .body .uploadBox .loading .tips2 {
-  font-size: 26rpx;
-}
-.container .body .uploadBox .fillImg {
-  position: absolute;
-  width: 660rpx;
-  height: 642rpx;
-  left: 22rpx;
-  top: 118rpx;
-  border-radius: 20rpx;
-  object-fit: cover;
-}
-.container .body .uploadBox .imgMask::before {
-  position: absolute;
-  content: "";
-  width: 660rpx;
-  height: 642rpx;
-  background-color: rgba(0, 0, 0, 0.4);
-}
-.container .body .templateBox {
-  margin-top: 30rpx;
-}
-.container .body .templateBox .tHeaderBg {
-  width: 700rpx;
-  height: 48rpx;
-}
-.container .body .templateBox .templates {
-  position: relative;
-  width: 100%;
-  border-radius: 20rpx;
-}
-.container .body .templateBox .templates .tbg {
-  position: absolute;
-  z-index: -1;
-  width: 100%;
-  height: 100%;
-}
-.container .body .templateBox .templates .templateScroll {
-  width: 100%;
-  padding: 36rpx 0 6rpx 16rpx;
-  white-space: nowrap;
-  box-sizing: border-box;
-}
-.container .body .templateBox .templates .templateScroll .template {
-  margin-right: 10rpx;
-  display: inline-block;
-}
-.container .body .templateBox .templates .templateScroll .template .cover {
-  width: 140rpx;
-  height: 140rpx;
-  margin-right: 20rpx;
-  background-color: white;
-  border-radius: 10rpx;
-}
-.container .body .templateBox .templates .templateScroll .template .name {
-  margin-top: 12rpx;
-  width: 140rpx;
-  color: white;
-  text-align: center;
-  font-size: 26rpx;
-}
-.container .body .templateBox .templates .templateScroll .template .active {
-  border: 4rpx solid #FDD841;
-  box-sizing: border-box;
-}
-.container .btns {
-  width: 700rpx;
-  margin: 0 auto 40rpx;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-.container .btns .btn {
-  width: 285rpx;
-  height: 82rpx;
-}

+ 13 - 0
pages/inviteRanking/index.js

@@ -69,10 +69,23 @@ Page({
         this.selectComponent("#popUp").hideModal()
     },
     onShareAppMessage() {
+        // #if MP
         return {
             title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
             path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
             imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-2.jpg'
         }
+        // #elif ANDROID
+        return {
+            title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
+            userName: 'gh_50f61361ad1d',
+            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
+            imagePath: '/static/375-300-2.jpg',
+            webpageUrl: 'http://www.efunbox.cn',
+            withShareTicket: true,
+            miniprogramType: 1,
+            scene: 0,
+        }
+        // #endif
     }
 })

+ 14 - 0
pages/ranking/index.js

@@ -111,10 +111,24 @@ Page({
         })
     },
     onShareAppMessage() {
+        // #if MP
         return {
             title: this.data.rankingType == 3 ? '我要上热门,就差你的一个赞,快来帮帮我吧!' : '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
             path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
             imageUrl: this.data.rankingType == 3 ? '/static/375-300-3.jpg' : '/static/375-300-2.jpg'
         }
+        // #elif ANDROID
+        return {
+            title: this.data.rankingType == 3 ? '我要上热门,就差你的一个赞,快来帮帮我吧!' : '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
+            userName: 'gh_50f61361ad1d',
+            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
+            imagePath: this.data.rankingType == 3 ? '/static/375-300-3.jpg' : '/static/375-300-2.jpg',
+            webpageUrl: 'http://www.efunbox.cn',
+            withShareTicket: true,
+            miniprogramType: 1,
+            scene: 0,
+        }
+        // #endif
+
     }
 })