123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- // pages/ruleInfo/ruleInfo.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- statusNavBarHeight:app.data.statusNavBarHeight,
- safeAreaTop: 30+app.data.safeAreaTop,
- type: ''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- id: options.id,
- user_hash: options.user_hash,
- allType: options.type?options.type:2,//视频号或视频
- follow_id: options.follow_id
- })
- this.getSet();
- this.getInfo();
- },
- goUserDetail(e){
- if(e.currentTarget.dataset.item.field_type!=0) {
- wx.navigateTo({
- url: '/pages/userDrtail/index?user_id='+e.currentTarget.dataset.id+'&type=2',
- })
- }
- },
- setType() {
- this.setData({
- showType: !this.data.showType
- })
- },
- checkType(e) {
- this.setData({
- type: e.currentTarget.dataset.type,
- videoList: [],
- showType: false
- })
- this.getInfo();
- },
-
- //消息获取
- getSet(){
- wx.showLoading({
- title: '加载中',
- })
- app.func.req('/api/notice/ruleList', 'get', {
- follow_type: this.data.allType,
- follow_id: this.data.follow_id
- }, (res) => {
- wx.hideLoading()
- wx.stopPullDownRefresh();
- if(res && res.errno == 0){
- this.setData({
- list: res.rst,
- showList: []
- })
- res.rst.forEach(item => {
- if(this.data.user_id) {
- item.field_type==4&&item.enable==1&&this.setData({
- fans_flag: true
- })
- item.field_type==5&&item.enable==1&&this.setData({
- public_flag: true
- })
- }else {
- item.field_type==1&&item.enable==1&&this.setData({
- like_flag: true
- })
- item.field_type==2&&item.enable==1&&this.setData({
- comment_flag: true
- })
- item.field_type==3&&item.enable==1&&this.setData({
- share_flag: true
- })
- }
- this.setData({
- [item.field_type==1?'like_id':item.field_type==2?'comment_id':item.field_type==3?'share_id':item.field_type==4?'fans_id':'public_id']:item.id,
- [item.field_type==1?'like_count':item.field_type==2?'comment_count':item.field_type==3?'share_count':item.field_type==4?'fans_count':'public_count']:item.threshold
- })
- })
-
- }else if(res.errno!=4003){
- wx.showToast({
- title: res.err,
- icon: 'none',
- duration: 2000
- })
- }
- },(err)=>{
- console.log(err)
- wx.hideLoading()
- })
- },
- getInfo(){
- wx.showLoading({
- title: '加载中',
- })
- app.func.req('/api/notice/msgList', 'get', {
- rule_id: this.data.id,
- user_hash: this.data.user_hash,
- field_type: this.data.type
- }, (res) => {
- wx.hideLoading()
- wx.stopPullDownRefresh();
- this.setData({
- hasAuno: res.auno==4403||res.errno==4003,
- pages: 1
- })
- if(res && res.errno == 0){
- //成功
- this.setData({
- videoList: res.rst,
- videoLength: res.rst.length>0?res.rst.length:-1
- })
- }else if(res.errno!=4003){
- wx.showToast({
- title: res.err,
- icon: 'none',
- duration: 2000
- })
- }
- },(err)=>{
- console.log(err)
- wx.hideLoading()
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function (res) {
- return app.shareEvent(res)
- }
- })
|