123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- // nova-werun/components/circle-card/index.js
- const Parse = getApp().Parse;
- const company = getApp().globalData.company;
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- objectId: '',
- type: ''
- },
- /**
- * 组件的初始数据
- */
- data: {
- //图片
- images: [],
- imageclass: '',
- //是否展示点赞评论按钮
- isgood: false,
- isclick: false,
- //朋友圈
- cicleList: []
- },
- lifetimes: {
- detached: function () {
- // 在组件实例被从页面节点树移除时执行
- },
- attached: async function () {
- // 在组件实例进入页面节点树时执行
- this.getcircle()
- },
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onImageLoad: function (e) {
- const {
- width,
- height
- } = e.detail; // 获取图片的宽高
- console.log('11', e.detail);
- const imageClass = width > height ? 'image-landscape' : 'image-portrait'; // 判断横竖屏
- this.setData({
- imageclass: imageClass // 动态设置图片的类名
- });
- },
- previewImage: function (e) {
- const index = e.currentTarget.dataset.index; // 获取当前点击图片的索引
- const images = this.data.images; // 获取所有图片的链接
- wx.previewImage({
- current: images[index], // 当前显示图片的链接
- urls: images // 需要预览的图片链接列表
- });
- },
- gourl(e) {
- const url = e.currentTarget.dataset.url
- const objectId = e.currentTarget.dataset.id
- wx.navigateTo({
- url: `${url}?id=` + objectId // 目标页面的路径
- });
- },
- showgood() {
- this.setData({
- isgood: !this.data.isgood
- })
- console.log(this.data.isgood);
- },
- isclick() {
- this.setData({
- isclick: !this.data.isclick
- })
- setTimeout(() => {
- this.showgood()
- }, 400)
- console.log(this.data.isclick);
- },
- async getcircle() {
- console.log('数据',this.data.objectId,this.data.type);
- let AIMomentquery = new Parse.Query('AIMoment');
- AIMomentquery.equalTo('company', company);
- AIMomentquery.equalTo('objectId', this.data.objectId);
- AIMomentquery.equalTo('isVisible', true);
- AIMomentquery.include('profile.user');
- AIMomentquery.include('profile');
- AIMomentquery.notEqualTo('isDeleted', true)
- let P = await AIMomentquery.find();
- let AIMoment1List = P.map(item => item.toJSON());
- this.setData({
- cicleList: AIMoment1List,
- })
- this.setData({
- images: this.data.cicleList[0].images
- })
- console.log('动态', this.data.cicleList);
- console.log('动态', this.data.type);
- }
- }
- })
|