consoledesk.js 13 KB

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