邹能昇 4 mēneši atpakaļ
vecāks
revīzija
8f2cafd02b

+ 2 - 1
app.json

@@ -8,7 +8,8 @@
             "name": "werun",
             "pages": [
                 "pages/index/index",
-                "pages/circle-detail/index"
+                "pages/circle-detail/index",
+                "pages/send-circle/index"
             ]
         },
         {

+ 45 - 38
nova-werun/components/circle/index.js

@@ -22,9 +22,9 @@ Component({
         contentpadding: 0, //顶部padding高度
 
         //朋友圈
-        cardList:[],
+        cardList: [],
+
 
-        
     },
     lifetimes: {
 
@@ -40,7 +40,7 @@ Component({
             const custom = wx.getMenuButtonBoundingClientRect();
             const customHeight = custom.height + 10 + 2 || 0;
             const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-            const contentHeight = (screenHeight - 50-bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+            const contentHeight = (screenHeight - 50 - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
             this.setData({
                 statusBarHeight,
                 screenHeight,
@@ -58,42 +58,49 @@ Component({
      * 组件的方法列表
      */
     methods: {
-    
-                //查全部朋友圈
-                async getcircle() {
-                    const currentUser = Parse.User.current();
-                    let Profilequery2 = new Parse.Query('Profile');
-                    Profilequery2.equalTo('company', company);
-                    Profilequery2.equalTo('user', currentUser.id);
-                    Profilequery2.equalTo('isCheck', true);
-                    Profilequery2.notEqualTo('isDeleted', true)
-                    let P2 = await Profilequery2.find();
-                    let profile1List2 = P2.map(item => item.toJSON());
-                    const department = profile1List2[0].department.objectId
-                    console.log(department);
-                    let queryWhere = {
-                        where: {
-                            profile: {
-                                $inQuery: {
-                                    where: {
-                                        department: department
-                                    },
-                                    className: 'Profile',
-                                },
-                            }
-                        }
+
+        //查全部朋友圈
+        async getcircle() {
+            const currentUser = Parse.User.current();
+            let Profilequery2 = new Parse.Query('Profile');
+            Profilequery2.equalTo('company', company);
+            Profilequery2.equalTo('user', currentUser.id);
+            Profilequery2.equalTo('isCheck', true);
+            Profilequery2.notEqualTo('isDeleted', true)
+            let P2 = await Profilequery2.find();
+            let profile1List2 = P2.map(item => item.toJSON());
+            const department = profile1List2[0].department.objectId
+            console.log(department);
+            let queryWhere = {
+                where: {
+                    profile: {
+                        $inQuery: {
+                            where: {
+                                department: department
+                            },
+                            className: 'Profile',
+                        },
                     }
-                    let Profilequery = Parse.Query.fromJSON('AIMoment', queryWhere);
-                    Profilequery.equalTo('company', company);
-                    Profilequery.equalTo('isVisible', true);
-                    Profilequery.notEqualTo('isDeleted', true)
-                    let P = await Profilequery.find();
-                    let profile1List = P.map(item => item.toJSON());
-                    console.log(profile1List);
-                    this.setData({
-                        cardList:profile1List
-                    })
-                },
+                }
+            }
+            let Profilequery = Parse.Query.fromJSON('AIMoment', queryWhere);
+            Profilequery.equalTo('company', company);
+            Profilequery.equalTo('isVisible', true);
+            Profilequery.notEqualTo('isDeleted', true)
+            let P = await Profilequery.find();
+            let profile1List = P.map(item => item.toJSON());
+            console.log(profile1List);
+            this.setData({
+                cardList: profile1List
+            })
+        },
+        //跳转
+        gourl(e) {
+            const url = e.currentTarget.dataset.url
+            wx.navigateTo({
+                url: `${url}`// 目标页面的路径
+            });
+        },
 
 
     }

+ 3 - 3
nova-werun/components/circle/index.wxml

@@ -6,7 +6,7 @@
             <circle-card objectId='{{item.objectId}}' type='surface'></circle-card>
         </block>
     </view>
-    <view class="publishbox">
-            <image src="https://file-cloud.fmode.cn/qpFbRRSZrO/20241105/8qes51030838243.png?imageView2/1/w/200/h/200"></image>
-        </view>
+    <view class="publishbox" bindtap="gourl" data-url="../../pages/send-circle/index">
+        <image src="https://file-cloud.fmode.cn/qpFbRRSZrO/20241105/8qes51030838243.png?imageView2/1/w/200/h/200"></image>
+    </view>
 </view>

+ 31 - 31
nova-werun/pages/circle-detail/index.js

@@ -5,16 +5,16 @@ Page({
      * 页面的初始数据
      */
     data: {
-                //屏幕高度
-                statusBarHeight: 0, // 状态栏高度
-                screenHeight: 0, // 屏幕高度
-                customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
-                bottomNavHeight: 0, // 底部导航栏高度
-                contentHeight: 0, // 可用内容高度
-                contentHeight2: 0,
-                contentpadding: 0, //顶部padding高度
-                //
-                objectId1:""
+        //屏幕高度
+        statusBarHeight: 0, // 状态栏高度
+        screenHeight: 0, // 屏幕高度
+        customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
+        bottomNavHeight: 0, // 底部导航栏高度
+        contentHeight: 0, // 可用内容高度
+        contentHeight2: 0,
+        contentpadding: 0, //顶部padding高度
+        //
+        objectId1: ""
 
     },
 
@@ -24,26 +24,26 @@ Page({
     onLoad: function (options) {
         console.log(options);
         this.setData({
-            id:options.id
+            id: options.id
         })
-            // 计算
-            const systemInfo = wx.getSystemInfoSync();
-            const statusBarHeight = systemInfo.statusBarHeight || 0;
-            const screenHeight = systemInfo.screenHeight || 0;
-            const custom = wx.getMenuButtonBoundingClientRect();
-            const customHeight = custom.height + 10 + 2 || 0;
-            const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-            const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
-            const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-            this.setData({
-                statusBarHeight,
-                screenHeight,
-                customHeight,
-                bottomNavHeight,
-                contentpadding,
-                contentHeight
-            });
+        // 计算
+        const systemInfo = wx.getSystemInfoSync();
+        const statusBarHeight = systemInfo.statusBarHeight || 0;
+        const screenHeight = systemInfo.screenHeight || 0;
+        const custom = wx.getMenuButtonBoundingClientRect();
+        const customHeight = custom.height + 10 + 2 || 0;
+        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
+
+        const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
+        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+        this.setData({
+            statusBarHeight,
+            screenHeight,
+            customHeight,
+            bottomNavHeight,
+            contentpadding,
+            contentHeight
+        });
     },
 
 
@@ -51,7 +51,7 @@ Page({
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady: function () {
-        
+
     },
 
     /**
@@ -96,7 +96,7 @@ Page({
 
     },
 
-    goback(){
+    goback() {
         wx.navigateBack({
             delta: 1 // 返回上一页
         });

+ 160 - 0
nova-werun/pages/send-circle/index.js

@@ -0,0 +1,160 @@
+// nova-werun/pages/send-circle/index.js
+const Parse = getApp().Parse;
+const company = getApp().globalData.company;
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        //屏幕高度
+        statusBarHeight: 0, // 状态栏高度
+        screenHeight: 0, // 屏幕高度
+        customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
+        bottomNavHeight: 0, // 底部导航栏高度
+        contentHeight: 0, // 可用内容高度
+        contentHeight2: 0,
+        contentpadding: 0, //顶部padding高度
+        //输入框
+        inputValue: '', // 用于存储输入的内容
+        textareaHeight: 52, // 初始高度,单位为 rpx
+        // 图片
+        fileList: [],
+        uptokenURL: '',
+        domain: '',
+        uploadURL: '',
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        // 计算
+        const systemInfo = wx.getSystemInfoSync();
+        const statusBarHeight = systemInfo.statusBarHeight || 0;
+        const screenHeight = systemInfo.screenHeight || 0;
+        const custom = wx.getMenuButtonBoundingClientRect();
+        const customHeight = custom.height + 10 + 2 || 0;
+        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
+
+        const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
+        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+        this.setData({
+            statusBarHeight,
+            screenHeight,
+            customHeight,
+            bottomNavHeight,
+            contentpadding,
+            contentHeight
+        });
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    },
+    //输入框高度随字体增多而变大
+    onInput: function (event) {
+        const value = event.detail.value; // 获取当前输入的值
+        this.setData({
+            inputValue: value,
+        });
+        console.log(this.data.inputValue);
+    },
+    //获取图片数组
+    picture(event) {
+        console.log('event', event);
+        let FileList = event.detail
+        let url = []
+        for (let i = 0; i < FileList.length; i++) {
+            url.push(FileList[i].url)
+        }
+        this.setData({
+            fileList: url
+        })
+        console.log('图片', this.data.fileList);
+    },
+    //上传函数
+    async send() {
+        const currentUser = Parse.User.current();
+        let Profilequery = new Parse.Query('Profile');
+        Profilequery.equalTo('company', company);
+        Profilequery.notEqualTo('isDeleted', true);
+        Profilequery.equalTo('user', currentUser.id);
+        let p = await Profilequery.first()
+
+        let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
+        let Comment = new Parse.Object('AIMoment');
+        Comment.set('profile', p.toPointer())
+        Comment.set('company', companyPointer);
+        Comment.set('isVisible', true);
+        Comment.set('images', this.data.fileList);
+        Comment.set('content', this.data.inputValue);
+        try {
+            if(this.data.fileList.length==0&& !this.data.inputValue){
+                console.log('新数据保存失败');
+               
+            }else{
+                let saveDate2 = await Comment.save();
+                console.log(saveDate2);
+                console.log("新数据保存成功");
+                this.goback()
+            }
+            
+            
+        } catch (error) {
+            console.error("保存数据时出现错误:", error);
+        }
+
+    },
+    goback(){
+        wx.redirectTo({
+            url: '../../components/circle/index'
+          });
+    }
+})

+ 6 - 0
nova-werun/pages/send-circle/index.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "van-field": "@vant/weapp/field/index",
+    "van-uploader": "@vant/weapp/uploader/index"
+  }
+}

+ 26 - 0
nova-werun/pages/send-circle/index.less

@@ -0,0 +1,26 @@
+/* nova-werun/pages/send-circle/index.wxss */
+.all{
+    width: 100vw;
+    padding-top: 10rpx;
+    padding-left: 20rpx;
+    padding-right: 20rpx;
+    .send{
+        margin-left: auto;
+        width: 100rpx;
+        height: 50rpx;
+        font-size: 30rpx;
+        color: white;
+        background-color: rgb(30, 208, 30);
+        border-radius: 10rpx;
+        margin-right:20rpx ;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+    }
+    .textarea{
+        width: 100%;
+        font-size: 32rpx;
+        margin-bottom: 40rpx;
+        margin-top: 20rpx;
+    }
+}

+ 9 - 0
nova-werun/pages/send-circle/index.wxml

@@ -0,0 +1,9 @@
+<!--nova-werun/pages/send-circle/index.wxml-->
+<nav type="back"  background-color="{{'#87ceeb'}}" front-color="{{'#ffffff'}}"></nav>
+<view class="all" style="height: {{contentHeight}}rpx;">
+    <view class="send" bindtap="send">发送</view>
+    <view class="text">
+        <textarea placeholder="输入内容" class="textarea" style="height: {{textareaHeight}}rpx;"  maxlength='300' 	auto-height='true' bindinput="onInput" value="{{inputValue}}"></textarea>
+    </view>
+    <upload style="width: 50%;" bind:onChangeFile="picture" uploadURL="{{uploadURL}}" domain="{{domain}}" uptokenURL="{{uptokenURL}}" maxCount="12" />
+</view>

+ 1 - 0
nova-werun/pages/send-circle/index.wxss

@@ -0,0 +1 @@
+.all{width:100vw;padding-top:10rpx;padding-left:20rpx;padding-right:20rpx}.all .send{margin-left:auto;width:100rpx;height:50rpx;font-size:30rpx;color:white;background-color:#1ed01e;border-radius:10rpx;margin-right:20rpx ;display:flex;justify-content:center;align-items:center}.all .textarea{width:100%;font-size:32rpx;margin-bottom:40rpx;margin-top:20rpx}

+ 38 - 18
project.private.config.json

@@ -1,20 +1,40 @@
 {
-  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-  "setting": {
-    "compileHotReLoad": false,
-    "urlCheck": true,
-    "preloadBackgroundData": false
-  },
-  "game": {
-    "list": []
-  },
-  "gamePlugin": {
-    "list": []
-  },
-  "miniprogram": {
-    "list": []
-  },
-  "libVersion": "2.27.3",
-  "condition": {},
-  "projectname": "nova-wapp"
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "setting": {
+        "compileHotReLoad": false,
+        "urlCheck": true,
+        "preloadBackgroundData": false
+    },
+    "game": {
+        "list": []
+    },
+    "gamePlugin": {
+        "list": []
+    },
+    "miniprogram": {
+        "list": []
+    },
+    "libVersion": "2.27.3",
+    "projectname": "nova-wapp",
+    "condition": {
+        "plugin": {
+            "list": []
+        },
+        "game": {
+            "list": []
+        },
+        "gamePlugin": {
+            "list": []
+        },
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "发送朋友圈",
+                    "pathName": "nova-werun/pages/send-circle/index",
+                    "query": "",
+                    "scene": null
+                }
+            ]
+        }
+    }
 }