App.vue 12 KB

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