App.vue 11 KB

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