App.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <script>
  2. import StringUtil from '@/utils/StringUtil.js'
  3. var md5 = require("./utils/md5.js");
  4. export default {
  5. data() {
  6. return {
  7. param: null
  8. };
  9. },
  10. onLaunch: function(e) {
  11. // uni.setEnableDebug({
  12. // enableDebug: true
  13. // })
  14. //更新版本
  15. const updateManager = uni.getUpdateManager();
  16. updateManager.onCheckForUpdate(function (res) {
  17. // 请求完新版本信息的回调
  18. console.log("是否有新版本:",res.hasUpdate);
  19. });
  20. updateManager.onUpdateReady(function (res) {
  21. uni.showModal({
  22. title: '更新提示',
  23. content: '新版本已经准备好,是否重启应用?',
  24. success(res) {
  25. if (res.confirm) {
  26. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  27. updateManager.applyUpdate();
  28. }
  29. }
  30. });
  31. });
  32. updateManager.onUpdateFailed(function (res) {
  33. // 新的版本下载失败
  34. });
  35. this.param = e;
  36. this.execParam();
  37. this.globalData.checkIsIPhoneX();
  38. },
  39. onShow: function(e) {
  40. this.param = e;
  41. this.execParam();
  42. },
  43. onHide: function() {
  44. console.log('App Hide')
  45. },
  46. methods: {
  47. execParam() {
  48. if (this.param == null || this.param.referrerInfo == null) return;
  49. let path = this.param.path;
  50. if (StringUtil.startEqualsIgnoreCase(path, 'pages/pages/')) {
  51. path = StringUtil.replace(path, 'pages/pages/', 'pages/');
  52. if (StringUtil.eqlObjIgnoreCase(path, '/pagesM/pages/goods_des')) {
  53. let query = this.param.query;
  54. if (query == null || query.id == null || parseInt(query.id) == null || parseInt(query.id) <= 0) {
  55. path = `pages/life`;
  56. } else {
  57. path = `pages/life?type=share&id=${query.id}&path=${path}`;
  58. }
  59. }
  60. this.param.path = path;
  61. uni.reLaunch({ url: path });
  62. return;
  63. }
  64. this.param.path = path;
  65. let reqParam = this.param.referrerInfo.extraData;
  66. wx.setStorageSync('reqParam', reqParam);
  67. this.param.referrerInfo = null;
  68. }
  69. },
  70. globalData: {
  71. //机构id
  72. org_id: "1",
  73. token: "j2qctr89u1xfmbjkp69hegfmqhwquycw",
  74. //对接后台的api地址
  75. //远程的
  76. // apiurl: "https://community.58fo.com/api/app/",
  77. // apiurl: "http://192.168.1.19:9082/app/",
  78. apiurl: "http://192.168.1.117:9082/app/",
  79. member: null,
  80. //用户信息--后台
  81. userInfo: null,
  82. //小程序用户信息,
  83. room_list: null,
  84. //会员的房屋列表
  85. own_room_list: null,
  86. //业主身份的房子
  87. device_list: null,
  88. //会员的授权设备列表
  89. anyHousePass: false, //判断是否是第二次认证,
  90. //封装request请求
  91. /**
  92. * params 参数
  93. * operation 操作
  94. * callBack 回调函数
  95. */
  96. postRequest: function (params, operation, callBack) {
  97. let that = this; //公共参数
  98. params['org_id'] = that.org_id;
  99. params['token'] = that.token;
  100. // uni.showLoading({
  101. // mask: true
  102. // });
  103. let jsonStr = JSON.stringify(params); //数据md5签名
  104. let dataSign = md5.hex_md5(jsonStr);
  105. uni.request({
  106. url: that.apiurl + operation,
  107. method: 'POST',
  108. header: {
  109. 'content-type': 'application/json',
  110. 'data-sign': dataSign
  111. },
  112. data: jsonStr,
  113. success: function (res) {
  114. // console.info(res.header['data-sign']);
  115. // console.info(md5.hex_md5(JSON.stringify(res.data)));
  116. // uni.hideLoading();
  117. callBack(res);
  118. },
  119. fail: function (res) {
  120. uni.hideLoading();
  121. uni.showModal({
  122. title: '警告',
  123. content: '网络异常' + res.errMsg,
  124. showCancel: false,
  125. confirmText: '确认'
  126. });
  127. }
  128. });
  129. },
  130. postRequestAsync: function (params,operation) {
  131. let that = this; //公共参数
  132. params['org_id'] = that.org_id;
  133. params['token'] = that.token;
  134. let jsonStr = JSON.stringify(params); //数据md5签名
  135. let dataSign = md5.hex_md5(jsonStr);
  136. return new Promise((resolve,reject)=>{
  137. uni.request({
  138. url: that.apiurl + operation,
  139. method: 'POST',
  140. header: {
  141. 'content-type': 'application/json',
  142. 'data-sign': dataSign
  143. },
  144. data: jsonStr,
  145. success: (res)=>{
  146. resolve(res)
  147. },
  148. fail: (err)=>{
  149. uni.hideLoading();
  150. uni.showModal({
  151. title: '警告',
  152. content: '网络异常' + res.errMsg,
  153. showCancel: false,
  154. confirmText: '确认'
  155. });
  156. }
  157. })
  158. })
  159. },
  160. //上传文件
  161. uploadBase64: function (base_64_str, is_need_md5, callback) {
  162. let that = this;
  163. let params = {};
  164. params['base_64_str'] = base_64_str;
  165. params['is_need_md5'] = is_need_md5; //公共参数
  166. params['org_id'] = that.org_id;
  167. params['token'] = that.token;
  168. let operation = 'applyUser/uploadBase64File';
  169. that.postRequest(params, operation, function (res) {
  170. if (res.data.result_code == 1) {
  171. callback(res);
  172. } else {
  173. that.autoFailHint(res.data.result_msg);
  174. }
  175. });
  176. },
  177. /**
  178. * 失败提示方法方法--单按钮--手动点击关闭
  179. */
  180. oneFailHint: function (result_msg, callBack) {
  181. uni.showModal({
  182. content: result_msg,
  183. showCancel: false,
  184. confirmText: '确认',
  185. success: function (res) {
  186. if (res.confirm) {
  187. if (callBack) {
  188. callBack();
  189. }
  190. }
  191. }
  192. });
  193. },
  194. /**
  195. * 失败提示方法方法--双按钮--手动点击关闭
  196. */
  197. twoFailHint: function (result_msg, callBack) {
  198. uni.showModal({
  199. content: result_msg,
  200. confirmText: '确认',
  201. success: function (res) {
  202. if (res.confirm) {
  203. if (callBack) {
  204. callBack();
  205. }
  206. }
  207. }
  208. });
  209. },
  210. /**
  211. * 失败提示方法方法--自动关闭
  212. */
  213. autoFailHint: function (result_msg, callBack) {
  214. uni.showToast({
  215. title: result_msg,
  216. icon: 'none',
  217. duration: 2000,
  218. success: function () {
  219. if (callBack) {
  220. callBack();
  221. }
  222. }
  223. });
  224. },
  225. /**
  226. * 提示用户身份注册
  227. */
  228. footaddmore: function () {
  229. uni.showModal({
  230. title: '提示',
  231. content: ' 请先完成注册',
  232. //cancelText:'去绑定',
  233. cancelText: '取消',
  234. confirmText: '去注册',
  235. success: function (res) {
  236. if (res.confirm) {
  237. //跳转到认证页面
  238. uni.navigateTo({
  239. url:"/pages/register/register"
  240. })
  241. } else {//res.cancel
  242. //绑定界面--暂时不用
  243. // wx.navigateTo({
  244. // url: '/pages/binding/binding',
  245. // })
  246. }
  247. }
  248. });
  249. },
  250. //房屋信息完善
  251. choosePlot: function () {
  252. uni.showModal({
  253. title: '提示',
  254. content: ' 未获取到房屋信息,是否去完善',
  255. //cancelText:'去绑定',
  256. cancelText: '取消',
  257. confirmText: '去完善',
  258. success: function (res) {
  259. if (res.confirm) {
  260. console.log('用户点击了确认-去完善'); //跳转到认证页面
  261. if(!this.$isEmpty(this.globalData.totalStep)){
  262. this.globalData.totalStep=2
  263. }
  264. uni.navigateTo({
  265. url: "/pages/auth/auth"
  266. });
  267. }
  268. }
  269. });
  270. },
  271. //检测是否是iphonex以上的机型
  272. checkIsIPhoneX: function () {
  273. const self = this;
  274. uni.getSystemInfo({
  275. success: function (res) {
  276. // 根据 model 进行判断
  277. if (res.model.search('iPhone X') != -1) {
  278. //self.isIPX = true
  279. uni.setStorageSync("isIPX", true);
  280. } else {
  281. uni.setStorageSync("isIPX", false);
  282. }
  283. }
  284. });
  285. }
  286. },
  287. }
  288. </script>
  289. <style lang="scss">
  290. // 引入样式
  291. @import '@/assets/css/app.scss';
  292. @import "uview-ui/index.scss";
  293. @import "@/assets/css/main.css";
  294. @import "@/assets/css/icon.css";
  295. @import "@/assets/css/app.css";
  296. // 社区样式 begin
  297. navigator-hover {
  298. background-color: rgba(0, 0, 0, 0.1);
  299. opacity: 0.7;
  300. }
  301. input {
  302. font-family: "PingFang SC",
  303. "Hiragino Sans GB",
  304. "Heiti SC",
  305. "Microsoft YaHei",
  306. "WenQuanYi Micro Hei",
  307. sans-serif;
  308. }
  309. .fix_nav_wp-IPX {
  310. padding-bottom:68rpx;
  311. }
  312. .mt20 {
  313. margin-top: 20rpx;
  314. }
  315. .submit_btn {
  316. position: fixed;
  317. bottom: 0;
  318. left: 0;
  319. padding: 0rpx 0rpx;
  320. width: 100%;
  321. box-sizing: border-box;
  322. background: #fff;
  323. }
  324. .ar_btn {
  325. background: $base-btn-color;
  326. font-size: 32rpx;
  327. color: #fff;
  328. // border-radius: 10rpx;
  329. margin: 0rpx 0rpx;
  330. padding: 0rpx 60rpx;
  331. height: 100rpx;
  332. line-height: 100rpx;
  333. }
  334. /* 小图标 */
  335. @font-face {
  336. font-family: 'iconfont'; /* project id 930679 */
  337. src: url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.eot');
  338. src: url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.eot?#iefix') format('embedded-opentype'),
  339. url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.woff') format('woff'),
  340. url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.ttf') format('truetype'),
  341. url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.svg#iconfont') format('svg');
  342. }
  343. .iconfont {
  344. font-family: "iconfont" !important;
  345. font-size: 16px;
  346. font-style: normal;
  347. -webkit-font-smoothing: antialiased;
  348. -moz-osx-font-smoothing: grayscale;
  349. }
  350. .icon-lianxigray:before { content: "\e61b"; }
  351. .icon-dispirited:before { content: "\e650"; }
  352. .icon-cha:before { content: "\e601"; }
  353. .icon-arrow-left:before { content: "\e604"; }
  354. .icon-mima:before { content: "\e603"; }
  355. .icon-xiaoxi:before { content: "\e633"; }
  356. .icon-shuoming:before { content: "\e605"; }
  357. .icon-icon-test:before { content: "\e626"; }
  358. .icon-shiming:before { content: "\e6d4"; }
  359. .icon-dingwei:before { content: "\e822"; }
  360. .icon-yemian:before { content: "\e659"; }
  361. .icon-icon-test1:before { content: "\e600"; }
  362. .icon-user:before { content: "\e602"; }
  363. .flex {
  364. display: -webkit-flex;
  365. display: flex;
  366. width: 100%;
  367. }
  368. /* 底部悬浮导航 */
  369. .fix_nav_wp {
  370. margin-top: 110rpx;
  371. height: 110rpx;
  372. position: fixed;
  373. left: 0;
  374. bottom: 0;
  375. background: #fff;
  376. z-index: 10;
  377. }
  378. .fix_nav_wp .nav_link {
  379. flex: 1;
  380. }
  381. .fix_nav_wp button {
  382. height: 110rpx;
  383. display: flex;
  384. justify-content: space-between;
  385. align-items: center;
  386. padding: 0;
  387. font-size: 22rpx;
  388. flex-direction: column;
  389. color: #999;
  390. position: relative;
  391. }
  392. .fix_nav_wp .tip_tip {
  393. position: absolute;
  394. right: 25rpx;
  395. top: 5rpx;
  396. min-width: 28rpx;
  397. line-height: 32rpx;
  398. height: 32rpx;
  399. padding: 0 8rpx;
  400. color: #fff;
  401. background: #f00;
  402. border-radius: 50em;
  403. border: 1rpx solid #fff;
  404. }
  405. .fix_nav_wp .nav_link .iconfont {
  406. height: 60rpx;
  407. font-size: 48rpx;
  408. line-height: 80rpx;
  409. color: #c4c8cc;
  410. }
  411. .fix_nav_wp .nav_link .plus_wp {
  412. width: 120rpx;
  413. height: 120rpx;
  414. margin-top: -60rpx;
  415. }
  416. .fix_nav_wp .nav_link image {
  417. width: 120rpx;
  418. height: 120rpx;
  419. }
  420. .fix_nav_wp .nav_link .txt {
  421. height: 70rpx;
  422. line-height: 60rpx;
  423. color: #444;
  424. font-size: 28rpx;
  425. }
  426. .fix_nav_wp .nav_link .iconfont {
  427. color: #444;
  428. }
  429. .fix_nav_wp .nav_link .del_ico {
  430. display: block;
  431. }
  432. .fix_nav_wp .nav_link .cur_ico {
  433. display: none;
  434. }
  435. .fix_nav_wp .nav_link.current .del_ico {
  436. display: none;
  437. }
  438. .fix_nav_wp .nav_link.current .cur_ico {
  439. display: block;
  440. color: $base-btn-color;
  441. }
  442. .fix_nav_wp .nav_link .txt_fb {
  443. line-height: 60rpx;
  444. }
  445. .fix_nav_wp .nav_link .mp_ico {
  446. font-size: 50rpx;
  447. line-height: 80rpx;
  448. }
  449. .fix_nav_wp .nav_link .xiaox_ico {
  450. font-size: 64rpx;
  451. line-height: 70rpx;
  452. }
  453. .fix_nav_wp .nav_link .my_ico {
  454. font-size: 56rpx;
  455. }
  456. .fix_nav_wp .on_cor .del_ico, .fix_nav_wp .on_cor .txt {
  457. color: $base-btn-color;
  458. }
  459. /* 清楚按钮的默认样式 */
  460. .defalut_btn {
  461. background: transparent;
  462. border: none;
  463. overflow: visible;
  464. padding-left: 0;
  465. padding-right: 0;
  466. margin-left: 0;
  467. margin-right: 0;
  468. border-radius: 0;
  469. }
  470. .defalut_btn:after {
  471. display: none;
  472. }
  473. .text-primary {
  474. color: $base-btn-color;
  475. }
  476. .submit_btn1 {
  477. margin: 60rpx 0 20rpx;
  478. padding: 0rpx 80rpx;
  479. width: 100%;
  480. box-sizing: border-box;
  481. }
  482. //社区样式 end
  483. // 商城
  484. ::-webkit-scrollbar {
  485. display: none;
  486. width: 0 !important;
  487. height: 0 !important;
  488. -webkit-appearance: none;
  489. background: transparent;
  490. }
  491. .pageBg {
  492. background: #f2f2f2;
  493. height: auto;
  494. min-height: 100vh;
  495. }
  496. .one_line_ellipsis {
  497. display: -webkit-box;
  498. overflow: hidden;
  499. -webkit-line-clamp: 1;
  500. -webkit-box-orient: vertical;
  501. }
  502. .two_line_ellipsis {
  503. display: -webkit-box;
  504. overflow: hidden;
  505. -webkit-line-clamp: 2;
  506. -webkit-box-orient: vertical;
  507. }
  508. .three_line_ellipsis {
  509. display: -webkit-box;
  510. overflow: hidden;
  511. -webkit-line-clamp: 3;
  512. -webkit-box-orient: vertical;
  513. }
  514. </style>