| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import animation from '../../utils/animation';
- const app = getApp();
- Page({
- data: {
- IsShowRemind:false,
- IsNew:0,
- },
- onLoad: function (options) {
- let that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- main.checkGenerating();
- that.getData(app.globalData.userInfo.UserID);
- },
- onShow:function(e){
- let that=this;
- if (that.data.IsNew){
- setTimeout(function(){
- that.getData(app.globalData.userInfo.UserID);
- },1000);
- }
- },
- getData:function(userID){
- wx.showLoading({
- title: '请稍候',
- });
- let that=this;
- let url='GetYJBDCArticleList?UserID=' + userID;
- //debugger;
- if (that.data.IsNew==1)
- url+="&IsNew=1";
- console.log(url);
- main.getData(url, function (data) {
- wx.hideLoading();
- if (data) {
- for(let i=0;i<data.length;i++){
- let item=data[i];
- item.WordsStr=item.Words.split(",").join(" ");
- }
- that.setData({
- List:data,
- });
- }
- });
- },
- 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){
- animation.toggleRemindWithAnimation(this);
- this.setData({
- ID:e.currentTarget.dataset.id
- });
- },
- showRemind:function(e){
- let that=this;
- const confirm=e.currentTarget.dataset.confirm;
- animation.toggleRemindWithAnimation(this);
- if (confirm=="1") {
- main.getData('DeleteYJBDCArticleList?UserID=' + app.globalData.userInfo.UserID+"&ID="+that.data.ID, function (data) {
- wx.showToast({
- title: '删除完成',
- });
- that.setData({
- IsNew:1,
- });
- that.getData(app.globalData.userInfo.UserID);
- });
- }
- },
- setGotoID:function(e){
- let that=this;
- if (app.globalData.userInfo.UserID<4){
- wx.showModal({
- title: '输入用户ID,获得生成的文章',
- content: '',
- editable:true,
- complete: (res) => {
- if (res.confirm) {
- if (res.content)
- that.getData(res.content);
- }
- }
- })
- }
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|