consoledesk.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. var App = getApp();
  2. var utils = require("../../utils/http");
  3. var nowtimestamp = 0, stoptime = 0;
  4. let loginnum = 1;
  5. Page({
  6. data: {
  7. top: App.globalData.statusBarHeight,
  8. hgt: App.globalData.titleBarHeight,
  9. imgUrl: App.globalData.imgUrl,
  10. unreadNum: 0,
  11. personobj: App.globalData.personMsg,
  12. signflag: false,
  13. instructionsflag: false,
  14. num: 0,
  15. unlogin: false,
  16. indextopnumobj: {},
  17. userflag: false,//true是有个人信息,false没有个人信息,
  18. permiss: false,
  19. unfutureflag: false,
  20. companyname: App.globalData.companyname,
  21. contribution: 0,
  22. my_ranking: 0,
  23. my_score: 0,
  24. help_people: 0,
  25. medal: 0,
  26. toolnumobj:{}
  27. },
  28. onLoad: function () {
  29. var that = this;
  30. wx.showLoading({
  31. title: '加载中......',
  32. })
  33. that.setData({
  34. top: App.globalData.statusBarHeight,
  35. hgt: App.globalData.titleBarHeight,
  36. companyname: App.globalData.companyname
  37. })
  38. that.setData({
  39. personobj: App.globalData.personMsg,
  40. })
  41. that.unreadMsg();
  42. that.getContribution();
  43. if(App.globalData.personMsg.sign!=1){
  44. that.signmsgtap();
  45. }
  46. this.getdenumfun();
  47. if (App.globalData.official_openid == 0) {
  48. wx.showModal({
  49. content: '您未关注志远装饰公众号,请及时关注',
  50. showCancel: false,
  51. confirmText: '去关注',
  52. success: function (res) {
  53. if (res.confirm) {
  54. wx.navigateTo({
  55. url: '/pages/other/other?type=090',
  56. })
  57. }
  58. }
  59. })
  60. }
  61. },
  62. getdenumfun(){
  63. const that=this;
  64. utils.$post({
  65. url: App.globalData.webUrl + 'api/index/afszxy_count',
  66. header: {
  67. 'Authorization': 'bearer ' + App.globalData.token
  68. },
  69. data: {},
  70. success: function (res) {
  71. if (res.data.code == '0') {
  72. that.setData({
  73. toolnumobj: res.data.data,
  74. })
  75. }
  76. }
  77. })
  78. },
  79. casetap:function(){
  80. wx.navigateTo({
  81. url: '/pages/decorateguide/decorateguide'
  82. })
  83. },
  84. catetap:function(){
  85. wx.navigateTo({
  86. url: '/customer/pages/publicpraise/publicpraise'
  87. })
  88. },
  89. buildtap:function(){
  90. wx.navigateTo({
  91. url: '/customer/pages/site/site',
  92. })
  93. },
  94. onReady: function () {
  95. },
  96. goidxtap: function () {
  97. wx.reLaunch({
  98. url: '/pages/index/index?state=1',
  99. })
  100. },
  101. closetap: function () {
  102. this.setData({
  103. unfutureflag: false
  104. })
  105. },
  106. setap: function () {
  107. wx.navigateTo({
  108. url: '/mycustomer/pages/set/set'
  109. })
  110. },
  111. persontap: function () {
  112. wx.navigateTo({
  113. url: '/pages/other/other?type=818&empid=' + App.globalData.currentUserId,
  114. })
  115. // wx.navigateTo({
  116. // url: '/share/pages/brokerRegister/brokerRegister'
  117. // })
  118. },
  119. arrfun: function (str) {
  120. var that = this;
  121. let arr = str.split(',');
  122. return arr;
  123. },
  124. indexmoretap: function () {
  125. var that = this;
  126. wx.navigateTo({
  127. url: '/index/pages/morecontent/morecontent'
  128. })
  129. },
  130. friendtap: function (e) {
  131. wx.navigateTo({
  132. url: '/index/pages/friendcircle/friendcircle'
  133. })
  134. },
  135. servicetap: function (e) {
  136. wx.navigateTo({
  137. url: '/mycustomer/pages/scoremsg/scoremsg',
  138. })
  139. },
  140. findwordtap: function () {
  141. wx.navigateTo({
  142. url: '/index/pages/searchword/searchword'
  143. })
  144. },
  145. sharecardtap: function () {
  146. wx.navigateTo({
  147. url: '/index/pages/namecard/namecard'
  148. })
  149. },
  150. dailytap: function (e) {
  151. this.setData({
  152. unfutureflag: true
  153. })
  154. // wx.navigateTo({
  155. // url: '/index/pages/daily/daily'
  156. // })
  157. },
  158. guestcluestap: function () {
  159. var that = this;
  160. // this.setData({
  161. // unfutureflag:true
  162. // })
  163. wx.navigateTo({
  164. url: '/mycustomer/pages/guestclues/guestclues'
  165. })
  166. },
  167. activityTap: function () {
  168. // this.setData({
  169. // unfutureflag:true
  170. // })
  171. wx.navigateTo({
  172. url: '/index/pages/activity/activity'
  173. })
  174. },
  175. schooltap1: function () {
  176. var that = this;
  177. // this.setData({
  178. // unfutureflag:true
  179. // })
  180. wx.navigateTo({
  181. url: '/index/pages/school/school?type=121'
  182. })
  183. },
  184. schooltap2: function () {
  185. var that = this;
  186. // this.setData({
  187. // unfutureflag:true
  188. // })
  189. wx.navigateTo({
  190. url: '/index/pages/school/school?type=212'
  191. })
  192. },
  193. schooltap3: function () {
  194. var that = this;
  195. // this.setData({
  196. // unfutureflag:true
  197. // })
  198. wx.navigateTo({
  199. url: '/index/pages/school/school?type=313'
  200. })
  201. },
  202. instructionstap: function () {
  203. this.setData({
  204. instructionsflag: true
  205. })
  206. },
  207. closeinstruction: function () {
  208. this.setData({
  209. instructionsflag: false
  210. })
  211. },
  212. alerttextap: function () {
  213. this.setData({
  214. instructionsflag: true
  215. })
  216. },
  217. signmsgtap: function () {
  218. var that=this;
  219. utils.$post({
  220. url: App.globalData.webUrl + 'api/profile/sign',
  221. header: {
  222. 'Authorization':'bearer '+App.globalData.token
  223. },
  224. data:{
  225. alertshow:1
  226. },
  227. success: function (res) {
  228. if(res.data.code=='0'){
  229. that.setData({
  230. signflag:!res.data.sign?false:true
  231. })
  232. let personobj = that.data.personobj;
  233. var time = !that.data.personobj.sign ? '0' : that.data.personobj.sign;
  234. personobj.sign = 1;
  235. that.setData({
  236. personobj: personobj
  237. })
  238. App.globalData.personMsg.sign=1;
  239. }else if(res.data.code=='1'){
  240. that.setData({
  241. signflag:true
  242. })
  243. }
  244. }
  245. })
  246. },
  247. signtap: function () {
  248. var that = this;
  249. let personobj = that.data.personobj;
  250. var time = !that.data.personobj.sign ? '0' : that.data.personobj.sign;
  251. personobj.sign = 1;
  252. that.setData({
  253. personobj: personobj
  254. })
  255. wx.navigateTo({
  256. url: '/mycustomer/pages/sign/sign?type=' + time
  257. })
  258. },
  259. goToMedalPage () {
  260. wx.navigateTo({
  261. url: '/pages/other/other?type=999',
  262. })
  263. },
  264. logintap: function () {
  265. this.loginbox = this.selectComponent("#loginbox");
  266. this.loginbox.loginfun();
  267. },
  268. getContribution: function () {
  269. let that = this;
  270. utils.$post({
  271. url: App.globalData.webUrl + 'api/talkskill/contribution',
  272. header: {
  273. 'Authorization': 'bearer ' + App.globalData.token
  274. },
  275. data: {},
  276. success: function (res) {
  277. if (res.data.code == '0') {
  278. that.setData({
  279. contribution: res.data.data.contribution,
  280. my_ranking: res.data.data.credits_ranking,
  281. help_people: res.data.data.help_people,
  282. my_score: res.data.data.integral,
  283. medal: res.data.data.medal
  284. })
  285. }
  286. }
  287. })
  288. },
  289. unreadMsg: function () {
  290. var that = this;
  291. App.globalData.tokenflag = true;
  292. this.setData({
  293. userflag: true,
  294. permiss: true
  295. })
  296. App.globalData.tabflag = true;
  297. that.indextopdata();
  298. utils.$post({
  299. url: App.globalData.webUrl + 'api/user_msg/unreadCount',
  300. header: {
  301. 'Authorization': 'bearer ' + App.globalData.token
  302. },
  303. data: {},
  304. success: function (res) {
  305. if (res.data.code == '0') {
  306. that.setData({
  307. unreadNum: res.data.data
  308. })
  309. App.globalData.unreadNum = res.data.data;
  310. }
  311. }
  312. })
  313. },
  314. indextopdata: function (text) {
  315. var that = this;
  316. wx.hideLoading()
  317. utils.$post({
  318. url: App.globalData.webUrl + 'api/index/datacount',
  319. header: {
  320. 'Authorization': 'bearer ' + App.globalData.token
  321. },
  322. data: {
  323. user_id: App.globalData.personMsg.id
  324. },
  325. success: function (res) {
  326. if (res.data.code == '0') {
  327. that.setData({
  328. indextopnumobj: res.data
  329. })
  330. }
  331. }
  332. })
  333. },
  334. joincompanytap: function () {
  335. var that = this;
  336. this.setData({
  337. unfutureflag: true
  338. })
  339. // wx.navigateTo({
  340. // url: '/mycustomer/pages/mycompany/mycompany',
  341. // })
  342. },
  343. dothis: function () { },
  344. findsaleTap: function () {
  345. var that = this;
  346. wx.navigateTo({
  347. url: '/mycustomer/pages/addcustomerData/addcustomerData',
  348. })
  349. },
  350. managemenTap: function () {
  351. this.setData({
  352. unfutureflag: true
  353. })
  354. },
  355. ranktap: function () {
  356. var that = this;
  357. wx.navigateTo({
  358. url: '/mycustomer/pages/rankbox/rankbox',
  359. })
  360. },
  361. videoshareTap: function () {
  362. var that = this;
  363. wx.navigateTo({
  364. url: '/pages/videosharelist/videosharelist',
  365. })
  366. },
  367. customertap: function (e) {
  368. wx.navigateTo({
  369. url: '/index/pages/caselist/caselist',
  370. })
  371. },
  372. findcustomertoolTap: function (e) {
  373. wx.navigateTo({
  374. url: '/pages/findcustomertool/findcustomertool?type=' + e.currentTarget.dataset.type,
  375. })
  376. },
  377. editnameTap: function () {
  378. var that = this;
  379. this.setData({
  380. unfutureflag: true
  381. })
  382. // wx.navigateTo({
  383. // url: '/pages/editbusinesscard/editbusinesscard',
  384. // })
  385. },
  386. namecardTap: function () {
  387. var that = this;
  388. this.setData({
  389. unfutureflag: true
  390. })
  391. // wx.navigateTo({
  392. // url: '/pages/namecard/namecard',
  393. // })
  394. },
  395. findinformationTap: function (e) {
  396. var that = this;
  397. this.setData({
  398. unfutureflag: true
  399. })
  400. // wx.navigateTo({
  401. // url: '/pages/lookreference/lookreference',//网盘
  402. // })
  403. },
  404. informTap: function (e) {
  405. var that = this;
  406. wx.navigateTo({
  407. url: '/mycustomer/pages/information/information',
  408. })
  409. },
  410. onPlay: function () {
  411. },
  412. onPlayNav: function () {
  413. },
  414. onShow: function (e) {
  415. var that = this;
  416. that.setData({
  417. top: App.globalData.statusBarHeight,
  418. hgt: App.globalData.titleBarHeight,
  419. companyname: App.globalData.companyname
  420. })
  421. that.unreadMsg();
  422. this.setData({
  423. personMsg: App.globalData.personMsg
  424. })
  425. },
  426. /**
  427. * 生命周期函数--监听页面隐藏
  428. */
  429. onHide: function () {
  430. var timearr = App.globalData.timearr, flag = false;
  431. for (var i = 0; i < timearr.length; i++) {
  432. if (timearr[i].type == 'index') {
  433. timearr[i].time = timearr[i].time * 1 + stoptime * 1;
  434. flag = true;
  435. }
  436. }
  437. if (!flag) {
  438. var obj = {
  439. type: 'index',
  440. time: stoptime
  441. };
  442. App.globalData.timearr.push(obj);
  443. } else {
  444. App.globalData.timearr = timearr;
  445. }
  446. },
  447. /**
  448. * 生命周期函数--监听页面卸载
  449. */
  450. onUnload: function () {
  451. },
  452. /**
  453. * 页面相关事件处理函数--监听用户下拉动作
  454. */
  455. onPullDownRefresh: function () {
  456. var that = this;
  457. this.getdenumfun();
  458. that.unreadMsg();
  459. setTimeout(function () {
  460. wx.stopPullDownRefresh();
  461. }, 500)
  462. },
  463. /**
  464. * 页面上拉触底事件的处理函数
  465. */
  466. onReachBottom: function () {
  467. var that = this;
  468. }
  469. })