Browse Source

开发邀新分享

bayi 1 năm trước cách đây
mục cha
commit
34c9e7d6c0
7 tập tin đã thay đổi với 29 bổ sung17 xóa
  1. 3 10
      mixins/share.js
  2. 6 4
      pages/chat/index.js
  3. 13 0
      pages/invite/index.js
  4. 4 0
      project.miniapp.json
  5. BIN
      static/375-300-1.jpg
  6. BIN
      static/donutLogin.png
  7. 3 3
      utils/request.js

+ 3 - 10
mixins/share.js

@@ -4,11 +4,11 @@ import {
 module.exports = Behavior({
     data: {},
     methods: {
-        // #if MP
         onShareAppMessage({
             from,
             target
         }) {
+            // #if MP
             if (from == 'button') {
                 let video = target.dataset.info
                 const promise = new Promise(resolve => {
@@ -29,12 +29,7 @@ module.exports = Behavior({
                     imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
                 }
             }
-        },
-        // #elif ANDROID
-        onShareAppMessage({
-            from,
-            target
-        }) {
+            // #elif ANDROID
             if (from == 'button') {
                 let video = target.dataset.info
                 const promise = new Promise(resolve => {
@@ -54,11 +49,9 @@ module.exports = Behavior({
                     scene: 0,
                     promise
                 }
-            } else {
-                console.log('暂不处理');
             }
+            // #endif
         },
-        // #endif
         creatShare(video) {
             return new Promise(async (resolve, reject) => {
                 let isActivity = await isActivityWork(video.userRead.id)

+ 6 - 4
pages/chat/index.js

@@ -107,11 +107,13 @@ Page({
         })
     },
     chooseImage() {
-        wx.chooseImage({
-            count: 1, // 可选择的图片数量
+        wx.chooseMedia({
+            count: 1,
+            mediaType: ['image'],
+            sourceType: ['album', 'camera'],
             sizeType: ['compressed'], // 压缩图片
-            sourceType: ['album', 'camera'], // 来源:相册或相机
-            success: (res) => {
+            camera: 'back',
+            success:(res)=> {
                 this.uploadImage(res.tempFilePaths[0]);
             }
         })

+ 13 - 0
pages/invite/index.js

@@ -373,10 +373,23 @@ Page({
      */
     onShareAppMessage() {
         const user = wx.getStorageSync('user');
+        // #if MP
         return {
             title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!',
             path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
             imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
         }
+        // #elif ANDROID
+        return {
+            title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
+            userName: 'gh_50f61361ad1d',
+            path: 'pages/index/index',
+            imagePath: '/static/375-300-1.jpg',
+            webpageUrl: 'http://www.efunbox.cn',
+            withShareTicket: true,
+            miniprogramType: 1,
+            scene: 0,
+        }
+        // #endif
     }
 })

+ 4 - 0
project.miniapp.json

@@ -59,6 +59,10 @@
     },
     "privacy": {
       "enable": false
+    },
+    "privateDescriptions": {
+      "NSPhotoLibraryUsageDescription": "用于上传头像",
+      "NSPhotoLibraryAddUsageDescription": "用于保存图片"
     }
   },
   "versionCode": 100

BIN
static/375-300-1.jpg


BIN
static/donutLogin.png


+ 3 - 3
utils/request.js

@@ -6,13 +6,13 @@ const {
         envVersion
     }
 } = wx.getAccountInfoSync();
-/* if (envVersion == 'develop') {
+if (envVersion == 'develop') {
     baseUrl = 'https://reader-api.efunbox.cn/wx'
     oldUrl = 'https://reader-api.efunbox.cn'
-} else { */
+} else {
     baseUrl = 'https://reader-api.ai160.com/wx'
     oldUrl = 'https://reader-api.ai160.com'
-// }
+}
 
 function request(url, method, data, oldBaseUrl = false, intercept = true) {
     let header = {