App.vue 12 KB

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