chengjie vor 1 Jahr
Ursprung
Commit
9ac9f63416

BIN
pages/images/universalpic_face_default_blue_120x120.png.png


BIN
pages/images/universalpic_wrong_white_120x120.png


+ 119 - 62
pages/main/wish.js

@@ -3,103 +3,160 @@ import main from '../../utils/main';
3 3
 import constant from '../../utils/constant';
4 4
 
5 5
 const app = getApp();
6
+var isViolate1 = false;
7
+var isViolate2 = false;
6 8
 
7 9
 Page({
8 10
   data: {
9
-    InputValue:"",
10
-    ToWhomIndex:0,
11
-    IsOpen:true,
12
-    ArrToWhom:[{Name:"给孩子",CSS:"btn11"},{Name:"给自己",CSS:""},{Name:"给同学",CSS:""}],
11
+    InputValue: "",
12
+    ToWhomIndex: 0,
13
+    IsOpen: true,
14
+    ArrToWhom: [{
15
+      Name: "给孩子",
16
+      CSS: "btn11"
17
+    }, {
18
+      Name: "给自己",
19
+      CSS: ""
20
+    }, {
21
+      Name: "给同学",
22
+      CSS: ""
23
+    }],
13 24
   },
14 25
   onLoad: function (options) {
15 26
     var that = this;
16 27
     that.setData({
17 28
       Containnerheight: main.getWindowHeight(),
18
-      SchoolID:options.SchoolID,
19
-      ID:0,
29
+      SchoolID: options.SchoolID,
30
+      ID: 0,
20 31
     });
21 32
 
22
-    if (options.type=="edit"){
23
-      var mywish=app.globalData.MyWish;
33
+    if (options.type == "edit") {
34
+      var mywish = app.globalData.MyWish;
24 35
 
25
-      for(var i=0;i<that.data.ArrToWhom.length;i++){
26
-        if (mywish.ToWhom==that.data.ArrToWhom[i].Name)
27
-          that.data.ArrToWhom[i].CSS="btn11";
36
+      for (var i = 0; i < that.data.ArrToWhom.length; i++) {
37
+        if (mywish.ToWhom == that.data.ArrToWhom[i].Name)
38
+          that.data.ArrToWhom[i].CSS = "btn11";
28 39
       }
29 40
 
30 41
       that.setData({
31
-        inputName:mywish.ToName,
32
-        inputContent:mywish.WishContent,
33
-        SchoolID:mywish.SchoolID,
34
-        IsOpen:mywish.IsOpen?true:false,
35
-        ArrToWhom:that.data.ArrToWhom,
36
-        ID:mywish.ID,
42
+        inputName: mywish.ToName,
43
+        inputContent: mywish.WishContent,
44
+        SchoolID: mywish.SchoolID,
45
+        IsOpen: mywish.IsOpen ? true : false,
46
+        ArrToWhom: that.data.ArrToWhom,
47
+        ID: mywish.ID,
37 48
       });
38 49
     }
39 50
   },
40
-  selectToWhom:function(event){
41
-    var index=event.currentTarget.dataset.index;
42
-    this.data.ArrToWhom[0].CSS="";
43
-    this.data.ArrToWhom[1].CSS="";
44
-    this.data.ArrToWhom[2].CSS="";
45
-    this.data.ArrToWhom[index].CSS="btn11";
51
+  selectToWhom: function (event) {
52
+    var index = event.currentTarget.dataset.index;
53
+    this.data.ArrToWhom[0].CSS = "";
54
+    this.data.ArrToWhom[1].CSS = "";
55
+    this.data.ArrToWhom[2].CSS = "";
56
+    this.data.ArrToWhom[index].CSS = "btn11";
46 57
     this.setData({
47
-      ArrToWhom:this.data.ArrToWhom,
48
-      ToWhomIndex:index,
58
+      ArrToWhom: this.data.ArrToWhom,
59
+      ToWhomIndex: index,
49 60
     });
50 61
   },
51
-  randomWish:function(){
52
-    var list=constant.arrWishInfo[this.data.ToWhomIndex].List;
53
-    var index=common.random(0,list.length-1);
62
+  randomWish: function () {
63
+    var list = constant.arrWishInfo[this.data.ToWhomIndex].List;
64
+    var index = common.random(0, list.length - 1);
54 65
     this.setData({
55
-      inputContent:list[index],
66
+      inputContent: list[index],
56 67
     });
57 68
   },
58
-  bindKeyInputName:function(e){
59
-    var that=this;
69
+  bindKeyInputName: function (e) {
70
+    var that = this;
60 71
     that.setData({
61
-      inputName:e.detail.value,
72
+      inputName: e.detail.value,
62 73
     });
74
+    that.onCheck(e.detail.value,1);
63 75
   },
64
-  bindKeyInputContent:function(e){
65
-    var that=this;
76
+  bindKeyInputContent: function (e) {
77
+    var that = this;
66 78
     that.setData({
67
-      inputContent:e.detail.value,
79
+      inputContent: e.detail.value,
68 80
     });
81
+    that.onCheck(e.detail.value,2);
69 82
   },
70
-  clickCheckbox:function(){
71
-    var that=this;
83
+  clickCheckbox: function () {
84
+    var that = this;
72 85
     that.setData({
73
-      IsOpen:!that.data.IsOpen,
86
+      IsOpen: !that.data.IsOpen,
74 87
     });
75 88
   },
76
-  onSubmit:function(){
77
-    var that=this;
78
-
79
-    if (app.globalData.userInfo.NickName=="陌生用户"){
80
-      wx.navigateTo({
81
-        url: 'userinfo',
89
+  onCheck: function (content,num) {
90
+    if (num==1)
91
+      isViolate1 = false;
92
+    else if (num==2)
93
+      isViolate2 = false;
94
+    main.postData("MsgSecCheck2", {
95
+        Content: content,
96
+        UserID: app.globalData.userInfo.UserID,
97
+      },
98
+      function (data) {
99
+        if (data && data.errcode == 0) {
100
+          
101
+        } else {
102
+          if (data.errmsg) {
103
+            wx.showToast({
104
+              title: data.errmsg,
105
+              duration: 2000,
106
+              image: "../images/universalpic_wrong_white_120x120.png",
107
+            });
108
+            if (num==1)
109
+              isViolate1 = true;
110
+            else if (num==2)
111
+              isViolate2 = true;
112
+          }
113
+        }
114
+      });
115
+  },
116
+  onSubmit: function () {
117
+    var that = this;
118
+    if (isViolate1) {
119
+      wx.showModal({
120
+        title: '生成失败',
121
+        content: '抱歉,您填写的名字未能通过微信敏感词检查故无法生成福帖。敏感词由微信官方功能判定,建议您调整内容多尝试几次。',
122
+        showCancel: false,
123
+        confirmText: '返回',
82 124
       });
83 125
     }
84
-    else{
85
-      var param={};
86
-      param.ID=that.data.ID;
87
-      param.UserID=app.globalData.userInfo.UserID;
88
-      param.SchoolID=that.data.SchoolID;
89
-      param.ToWhom=that.data.ArrToWhom[that.data.ToWhomIndex].Name;
90
-      param.ToName=that.data.inputName;
91
-      param.WishContent=that.data.inputContent;
92
-      param.IsOpen=that.data.IsOpen?1:0;
93
-
94
-      console.log(param);
95
-      main.postData('MPSWish', param, function (data) {
96
-        app.globalData.MyWish=data;
97
-        //debugger;
98
-        wx.redirectTo({
99
-          url: './wishinfo',
100
-        })
126
+    else if (isViolate2) {
127
+      wx.showModal({
128
+        title: '生成失败',
129
+        content: '抱歉,您填写的祝福语未能通过微信敏感词检查故无法生成福帖。敏感词由微信官方功能判定,建议您调整内容多尝试几次。',
130
+        showCancel: false,
131
+        confirmText: '返回',
101 132
       });
102 133
     }
134
+    else {
135
+
136
+      if (app.globalData.userInfo.NickName == "陌生用户") {
137
+        wx.navigateTo({
138
+          url: 'userinfo',
139
+        });
140
+      } else {
141
+        var param = {};
142
+        param.ID = that.data.ID;
143
+        param.UserID = app.globalData.userInfo.UserID;
144
+        param.SchoolID = that.data.SchoolID;
145
+        param.ToWhom = that.data.ArrToWhom[that.data.ToWhomIndex].Name;
146
+        param.ToName = that.data.inputName;
147
+        param.WishContent = that.data.inputContent;
148
+        param.IsOpen = that.data.IsOpen ? 1 : 0;
149
+
150
+        console.log(param);
151
+        main.postData('MPSWish', param, function (data) {
152
+          app.globalData.MyWish = data;
153
+          //debugger;
154
+          wx.redirectTo({
155
+            url: './wishinfo',
156
+          })
157
+        });
158
+      }
159
+    }
103 160
   },
104 161
   onShareAppMessage: function () {
105 162
     return {
@@ -108,4 +165,4 @@ Page({
108 165
       imageUrl: app.globalData.ShareImage,
109 166
     }
110 167
   },
111
-})
168
+})

+ 1 - 0
pages/main/wishinfo.js

@@ -18,6 +18,7 @@ Page({
18 18
   },
19 19
   onShow:function(){
20 20
     var that = this;
21
+    
21 22
     if (that.data.ID){
22 23
       main.getData("GetMPSWish?WishType=person&ID="+that.data.ID, function (data2) {
23 24
         //debugger;