| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641 |
- <script>
- import StringUtil from '@/utils/StringUtil.js'
- var md5 = require("./utils/md5.js");
- export default {
- data() {
- return {
- param: null
- };
- },
- onLaunch: function (e) {
- // uni.setEnableDebug({
- // enableDebug: true
- // })
- //更新版本
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log("是否有新版本:", res.hasUpdate);
- });
- updateManager.onUpdateReady(function (res) {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
- });
- updateManager.onUpdateFailed(function (res) {
- // 新的版本下载失败
- });
- this.param = e;
- this.execParam();
- this.globalData.checkIsIPhoneX();
- this.getOpenId();
- },
- onShow: function (e) {
- this.param = e;
- this.execParam();
- },
- onHide: function () {
- console.log('App Hide')
- },
- methods: {
- execParam() {
- if (this.param == null || this.param.referrerInfo == null) return;
- let path = this.param.path;
- if (StringUtil.startEqualsIgnoreCase(path, 'pages/pages/')) {
- path = StringUtil.replace(path, 'pages/pages/', 'pages/');
- if (StringUtil.eqlObjIgnoreCase(path, '/pagesM/pages/goods_des')) {
- let query = this.param.query;
- if (query == null || query.id == null || parseInt(query.id) == null || parseInt(query.id) <= 0) {
- path = `pages/life`;
- } else {
- path = `pages/life?type=share&id=${query.id}&path=${path}`;
- }
- }
- this.param.path = path;
- uni.reLaunch({url: path});
- return;
- }
- this.param.path = path;
- let reqParam = this.param.referrerInfo.extraData;
- wx.setStorageSync('reqParam', reqParam);
- this.param.referrerInfo = null;
- },
- getOpenId() {
- var that = this;
- uni.login({
- success: res => {
- let params = {};
- params['js_code'] = res.code;
- params['name'] = 'community';
- let operation = 'miniprogram/getOpenid'; //发起请求
- that.globalData.postRequest(params, operation, function (res) {
- //获取成功
- if (res.data.result_code == 1) {
- console.log("获取openid成功")
- //openid存入缓存
- uni.setStorageSync("openid", res.data.openid);
- uni.setStorageSync("appletType", res.data.appletType);
- that.$u.vuex('vuex_appletType', res.data.appletType)
- } else {
- that.globalData.oneFailHint(res.data.result_msg);
- }
- });
- }
- });
- }
- },
- globalData: {
- //机构id
- org_id: "1",
- token: "j2qctr89u1xfmbjkp69hegfmqhwquycw",
- //对接后台的api地址
- //远程的
- apiurl: "https://test-wuye.nxzhsq.cn/app-gateway/api/app/",
- // apiurl: "https://wuye.nxzhsq.cn/app-gateway/api/app/",
- // apiurl: "https://community.58fo.com/api/app/",
- // apiurl: "http://192.168.1.19:9082/app/",
- // apiurl: "http://25d3f66612.zicp.vip/wuye/app-gateway/app/",
- // apiurl: "http://192.168.1.218:9082/app/",
- // apiurl: "http://192.168.1.69:9082/app/",
- member: null,
- //用户信息--后台
- userInfo: null,
- //小程序用户信息,
- room_list: null,
- //会员的房屋列表
- own_room_list: null,
- //业主身份的房子
- device_list: null,
- //会员的授权设备列表
- anyHousePass: false, //判断是否是第二次认证,
- //封装request请求
- /**
- * params 参数
- * operation 操作
- * callBack 回调函数
- */
- postRequest: function (params, operation, callBack) {
- let that = this; //公共参数
- params['org_id'] = that.org_id;
- params['token'] = that.token;
- // uni.showLoading({
- // mask: true
- // });
- let jsonStr = JSON.stringify(params); //数据md5签名
- let dataSign = md5.hex_md5(jsonStr);
- uni.request({
- url: that.apiurl + operation,
- method: 'POST',
- header: {
- 'content-type': 'application/json',
- 'data-sign': dataSign
- },
- data: jsonStr,
- success: function (res) {
- // console.info(res.header['data-sign']);
- // console.info(md5.hex_md5(JSON.stringify(res.data)));
- // uni.hideLoading();
- callBack(res);
- },
- fail: function (res) {
- uni.hideLoading();
- uni.showModal({
- title: '警告',
- content: '网络异常' + res.errMsg,
- showCancel: false,
- confirmText: '确认'
- });
- }
- });
- },
- postRequestAsync: function (params, operation) {
- let that = this; //公共参数
- params['org_id'] = that.org_id;
- params['token'] = that.token;
- let jsonStr = JSON.stringify(params); //数据md5签名
- let dataSign = md5.hex_md5(jsonStr);
- return new Promise((resolve, reject) => {
- uni.request({
- url: that.apiurl + operation,
- method: 'POST',
- header: {
- 'content-type': 'application/json',
- 'data-sign': dataSign
- },
- data: jsonStr,
- success: (res) => {
- resolve(res)
- },
- fail: (err) => {
- uni.hideLoading();
- uni.showModal({
- title: '警告',
- content: '网络异常' + res.errMsg,
- showCancel: false,
- confirmText: '确认'
- });
- }
- })
- })
- },
- //上传文件
- uploadBase64: function (base_64_str, is_need_md5, callback) {
- let that = this;
- let params = {};
- params['base_64_str'] = base_64_str;
- params['is_need_md5'] = is_need_md5; //公共参数
- params['org_id'] = that.org_id;
- params['token'] = that.token;
- let operation = 'applyUser/uploadBase64File';
- that.postRequest(params, operation, function (res) {
- if (res.data.result_code == 1) {
- callback(res);
- } else {
- that.autoFailHint(res.data.result_msg);
- }
- });
- },
- /**
- * 失败提示方法方法--单按钮--手动点击关闭
- */
- oneFailHint: function (result_msg, callBack) {
- uni.showModal({
- content: result_msg,
- showCancel: false,
- confirmText: '确认',
- success: function (res) {
- if (res.confirm) {
- if (callBack) {
- callBack();
- }
- }
- }
- });
- },
- /**
- * 失败提示方法方法--双按钮--手动点击关闭
- */
- twoFailHint: function (result_msg, callBack) {
- uni.showModal({
- content: result_msg,
- confirmText: '确认',
- success: function (res) {
- if (res.confirm) {
- if (callBack) {
- callBack();
- }
- }
- }
- });
- },
- /**
- * 失败提示方法方法--自动关闭
- */
- autoFailHint: function (result_msg, callBack) {
- uni.showToast({
- title: result_msg,
- icon: 'none',
- duration: 2000,
- success: function () {
- if (callBack) {
- callBack();
- }
- }
- });
- },
- /**
- * 提示用户身份注册
- */
- footaddmore: function () {
- uni.showModal({
- title: '提示',
- content: ' 请先完成注册',
- //cancelText:'去绑定',
- cancelText: '取消',
- confirmText: '去注册',
- success: function (res) {
- if (res.confirm) {
- //跳转到认证页面
- uni.navigateTo({
- url: "/pages/register/register"
- })
- } else {//res.cancel
- //绑定界面--暂时不用
- // wx.navigateTo({
- // url: '/pages/binding/binding',
- // })
- }
- }
- });
- },
- //房屋信息完善
- choosePlot: function () {
- uni.showModal({
- title: '提示',
- content: ' 未获取到房屋信息,是否去完善',
- //cancelText:'去绑定',
- cancelText: '取消',
- confirmText: '去完善',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击了确认-去完善'); //跳转到认证页面
- if (!this.$isEmpty(this.globalData.totalStep)) {
- this.globalData.totalStep = 2
- }
- uni.navigateTo({
- url: "/pages/auth/auth"
- });
- }
- }
- });
- },
- //检测是否是iphonex以上的机型
- checkIsIPhoneX: function () {
- const self = this;
- uni.getSystemInfo({
- success: function (res) {
- // 根据 model 进行判断
- if (res.model.search('iPhone X') != -1) {
- //self.isIPX = true
- uni.setStorageSync("isIPX", true);
- } else {
- uni.setStorageSync("isIPX", false);
- }
- }
- });
- },
- },
- }
- </script>
- <style lang="scss">
- // 引入样式
- @import '@/assets/css/app.scss';
- @import "uview-ui/index.scss";
- @import "@/assets/css/main.css";
- @import "@/assets/css/icon.css";
- @import "@/assets/css/app.css";
- // 社区样式 begin
- navigator-hover {
- background-color: rgba(0, 0, 0, 0.1);
- opacity: 0.7;
- }
- input {
- font-family: "PingFang SC",
- "Hiragino Sans GB",
- "Heiti SC",
- "Microsoft YaHei",
- "WenQuanYi Micro Hei",
- sans-serif;
- }
- .fix_nav_wp-IPX {
- padding-bottom: 68 rpx;
- }
- .mt20 {
- margin-top: 20 rpx;
- }
- .submit_btn {
- position: fixed;
- bottom: 0;
- left: 0;
- padding: 0 rpx 0 rpx;
- width: 100%;
- box-sizing: border-box;
- background: #fff;
- }
- .ar_btn {
- background: $base-btn-color;
- font-size: 32 rpx;
- color: #fff;
- // border-radius: 10rpx;
- margin: 0 rpx 0 rpx;
- padding: 0 rpx 60 rpx;
- height: 100 rpx;
- line-height: 100 rpx;
- }
- /* 小图标 */
- @font-face {
- font-family: 'iconfont'; /* project id 930679 */
- src: url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.eot');
- src: url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.eot?#iefix') format('embedded-opentype'),
- url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.woff') format('woff'),
- url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.ttf') format('truetype'),
- url('//at.alicdn.com/t/font_930679_y7aw8dju2ha.svg#iconfont') format('svg');
- }
- .iconfont {
- font-family: "iconfont" !important;
- font-size: 16px;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- .icon-lianxigray:before {
- content: "\e61b";
- }
- .icon-dispirited:before {
- content: "\e650";
- }
- .icon-cha:before {
- content: "\e601";
- }
- .icon-arrow-left:before {
- content: "\e604";
- }
- .icon-mima:before {
- content: "\e603";
- }
- .icon-xiaoxi:before {
- content: "\e633";
- }
- .icon-shuoming:before {
- content: "\e605";
- }
- .icon-icon-test:before {
- content: "\e626";
- }
- .icon-shiming:before {
- content: "\e6d4";
- }
- .icon-dingwei:before {
- content: "\e822";
- }
- .icon-yemian:before {
- content: "\e659";
- }
- .icon-icon-test1:before {
- content: "\e600";
- }
- .icon-user:before {
- content: "\e602";
- }
- .flex {
- display: -webkit-flex;
- display: flex;
- width: 100%;
- }
- /* 底部悬浮导航 */
- .fix_nav_wp {
- margin-top: 110 rpx;
- height: 110 rpx;
- position: fixed;
- left: 0;
- bottom: 0;
- background: #fff;
- z-index: 10;
- }
- .fix_nav_wp .nav_link {
- flex: 1;
- }
- .fix_nav_wp button {
- height: 110 rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0;
- font-size: 22 rpx;
- flex-direction: column;
- color: #999;
- position: relative;
- }
- .fix_nav_wp .tip_tip {
- position: absolute;
- right: 25 rpx;
- top: 5 rpx;
- min-width: 28 rpx;
- line-height: 32 rpx;
- height: 32 rpx;
- padding: 0 8 rpx;
- color: #fff;
- background: #f00;
- border-radius: 50em;
- border: 1 rpx solid #fff;
- }
- .fix_nav_wp .nav_link .iconfont {
- height: 60 rpx;
- font-size: 48 rpx;
- line-height: 80 rpx;
- color: #c4c8cc;
- }
- .fix_nav_wp .nav_link .plus_wp {
- width: 120 rpx;
- height: 120 rpx;
- margin-top: -60rpx;
- }
- .fix_nav_wp .nav_link image {
- width: 120 rpx;
- height: 120 rpx;
- }
- .fix_nav_wp .nav_link .txt {
- height: 70 rpx;
- line-height: 60 rpx;
- color: #444;
- font-size: 28 rpx;
- }
- .fix_nav_wp .nav_link .iconfont {
- color: #444;
- }
- .fix_nav_wp .nav_link .del_ico {
- display: block;
- }
- .fix_nav_wp .nav_link .cur_ico {
- display: none;
- }
- .fix_nav_wp .nav_link.current .del_ico {
- display: none;
- }
- .fix_nav_wp .nav_link.current .cur_ico {
- display: block;
- color: $base-btn-color;
- }
- .fix_nav_wp .nav_link .txt_fb {
- line-height: 60 rpx;
- }
- .fix_nav_wp .nav_link .mp_ico {
- font-size: 50 rpx;
- line-height: 80 rpx;
- }
- .fix_nav_wp .nav_link .xiaox_ico {
- font-size: 64 rpx;
- line-height: 70 rpx;
- }
- .fix_nav_wp .nav_link .my_ico {
- font-size: 56 rpx;
- }
- .fix_nav_wp .on_cor .del_ico, .fix_nav_wp .on_cor .txt {
- color: $base-btn-color;
- }
- /* 清楚按钮的默认样式 */
- .defalut_btn {
- background: transparent;
- border: none;
- overflow: visible;
- padding-left: 0;
- padding-right: 0;
- margin-left: 0;
- margin-right: 0;
- border-radius: 0;
- }
- .defalut_btn:after {
- display: none;
- }
- .text-primary {
- color: $base-btn-color;
- }
- .submit_btn1 {
- margin: 60 rpx 0 20 rpx;
- padding: 0 rpx 80 rpx;
- width: 100%;
- box-sizing: border-box;
- }
- //社区样式 end
- // 商城
- ::-webkit-scrollbar {
- display: none;
- width: 0 !important;
- height: 0 !important;
- -webkit-appearance: none;
- background: transparent;
- }
- .pageBg {
- background: #f2f2f2;
- height: auto;
- min-height: 100vh;
- }
- .one_line_ellipsis {
- display: -webkit-box;
- overflow: hidden;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .two_line_ellipsis {
- display: -webkit-box;
- overflow: hidden;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .three_line_ellipsis {
- display: -webkit-box;
- overflow: hidden;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- </style>
|