| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import animation from '../../utils/animation';
- const app = getApp();
- Page({
- data: {
- IsShowRemind:false,
- IsNew:0,
- IsShowID:false,
- IsShowMore:true,
- },
- onLoad: function (options) {
- let that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- UserID:app.globalData.userInfo.UserID,
- });
- main.checkGenerating();
- that.getData(that.data.UserID);
- },
- onShow:function(e){
- let that=this;
- if (that.data.IsNew){
- setTimeout(function(){
- that.getData(that.data.UserID);
- },1000);
- }
- },
- getData:function(userID,pageID){
- wx.showLoading({
- title: '请稍候',
- });
- let that=this;
- let url='GetYJBDCArticleList?UserID=' + userID;
- if (pageID)
- url+="&PageID="+pageID;
- if (that.data.IsNew==1)
- url+="&IsNew=1";
- console.log(url);
- main.getData(url, function (data) {
- wx.hideLoading();
- if (data) {
- if (!pageID)
- that.data.List=[];
- app.globalData.UnReadCount=0;
- for(let i=0;i<data.length;i++){
- let item=data[i];
- item.WordsStr=item.Words.split(",").join(" ");
- that.data.List.push(item);
- if (item.ReadCount==0){
- app.globalData.UnReadCount++;
- }
- }
- let isShowMore=true;
- if (that.data.List[0].RowsCount==that.data.List.length)
- isShowMore=false;
- that.setData({
- List:that.data.List,
- IsShowMore:isShowMore,
- });
- }
- });
- },
- getMore:function(e){
- this.getData(this.data.UserID,this.data.List[this.data.List.length-1].ID);
- },
- goto: function (e) {
- let that=this;
- if (e.currentTarget.dataset.readcount===0){
- that.setData({
- IsNew:1,
- });
- }
- else{
- that.setData({
- IsNew:0,
- });
- }
- var url=e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- setClipboard:function(e){
- let words=e.currentTarget.dataset.words;
- app.globalData.SelectedWords=words.split(",");
- wx.redirectTo({
- url: 'wordsinput',
- })
- },
- deleteArticle:function(e){
- let that=this;
- that.setData({
- ID:e.currentTarget.dataset.id,
- });
- animation.toggleRemindWithAnimation(this, {
- hideColor: 'rgba(0,0,0,0)',
- showColor: 'rgba(227,227,227,0.5)',
- panelAnimationKey: 'panelAnimation', // 控制内容面板的动画
- animationKey: 'parentAnimation' // 控制父容器的动画(如果需要)
- });
- },
- showRemind:function(e){
- let that=this;
- const confirm=e.currentTarget.dataset.confirm;
- animation.toggleRemindWithAnimation(this, {
- hideColor: 'rgba(0,0,0,0)',
- showColor: 'rgba(227,227,227,0.5)'
- });
- if (confirm=="1") {
- main.getData('DeleteYJBDCArticleList?UserID=' + that.data.UserID+"&ID="+that.data.ID, function (data) {
- wx.showToast({
- title: '删除完成',
- });
- that.setData({
- IsNew:1,
- });
- for(let i=0;i<that.data.List.length;i++){
- if (that.data.List[i].ID==that.data.ID){
- that.data.List.splice(i,1);
- break;
- }
- }
- that.setData({
- List:that.data.List,
- });
- });
- }
- },
- setGotoID:function(e){
- let that=this;
- if (app.globalData.userInfo.UserID<4 || app.globalData.userInfo.UserID==11){
- wx.showModal({
- title: '输入用户ID,获得生成的文章',
- content: '',
- editable:true,
- complete: (res) => {
- if (res.confirm) {
- if (res.content){
- that.setData({
- UserID:res.content,
- });
- that.getData(res.content);
- }
- }
- else{
- that.setData({
- IsShowID:!that.data.IsShowID,
- });
- }
- }
- })
- }
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|