| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- <template>
- <view class="content">
- <!-- <top-title :titleValue="title" :btnTop="btnPos" style="width: 100%;"></top-title> -->
- <view class="self-inf" style="margin-top:40rpx">
- <view class="img-name-box" v-if="isAuth">
- <image :src="userHeadImg ? userHeadImg : '/static/auth-icon.png'" class="heade-img" mode="aspectFill"></image>
- <!-- <p class="nickname">{{ userNickName }}</p> -->
- <button @click="goWithHouse()" class="auth-btn">{{isWith ? '解除关联': '关联住房'}}</button>
- </view>
- <view class="house-info-box" v-if="isWith">
- <view>
- <text style="width: 160rpx;">住宅地址:</text>
- <text>{{houseInfo.address}}</text>
- </view>
- <view>
- <text style="width: 160rpx;">户主姓名:</text>
- <text>{{houseInfo.master}}</text>
- </view>
- <view>
- <text style="width: 160rpx;">住宅面积:</text>
- <text>{{houseInfo.area}}</text>
- </view>
- </view>
- <view class="img-name-box" v-if="!isAuth">
- <image src="/static/auth-icon.png" class="heade-img" mode="aspectFill"></image>
- <button type='primary' class="auth-btn" v-show="!isAuth" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">立即登录</button>
- </view>
- <!-- <image class="bg-img" :src="swiperBackground" mode="aspectFill"></image> -->
- <view class="bg-img"></view>
- <image src="../../static/Intersect.svg" class="groove-img"></image>
- </view>
- <view class="options">
- <view v-for="(item, idx) in list" :key="idx" class="options-item" @click="goDetailFn(idx, item.url)" v-if="item.isShow">
- <view class="img-box">
- <img :src="item.icoin" alt="" class="options-item-img" />
- </view>
- <view class="options-item-name">
- {{ item.name }}
- </view>
- </view>
- </view>
- <foot-tabs :selectedIndex='1'></foot-tabs>
- </view>
- </template>
- <script>
- import md5 from "@/common/md5.js";
- import footTabs from '@/components/foot-tabs/footTabs.vue';
- export default {
- components: {
- 'foot-tabs': footTabs,
- },
- data() {
- return {
- isAuth: true,
- userHeadImg: "",
- userNickName: "",
- btnPos:uni.getMenuButtonBoundingClientRect().top + 6,
- houseInfo:{
- address:'千林郡5号楼1单元10层1001室',
- master:'曹**',
- area:'108'
- },
- isWith:0,
- list: [
- {
- icoin: "/static/selfCenter/sign.png",
- name: "供暖订单" ,
- url: "/pages/heatingPage/list",
- isShow:true,
- },
- {
- icoin: "/static/selfCenter/suggest.png",
- name: "我的报修" ,
- url: "/pages/selfCenter/my_fix",
- isShow:true,
- },
- /*
- {
- icoin: "/static/selfCenter/back.png",
- name: "退出登录" ,
- isShow:true,
- }
- */
- ],
- swiperBackground: "/static/poster-bg.png",
- };
- },
- onLoad() {
- //this.getSwiperList();
- //this.$forceUpdate();
- },
- onShow() {
- this.isAuth = getApp().globalData.isAuth;
- if(this.isAuth){
- this.userHeadImg = getApp().globalData.user_headUrl;
- this.userNickName = getApp().globalData.user_name;
- }
- this.getUserInfo();
- },
- methods: {
- goAuthPage() {
-
- uni.navigateTo({
- url: "../auth/index",
- });
-
-
- },
- getPhoneNumber(e){
- let res = getApp().getPhoneNumber(e);
- if (res){
- this.goHouse();
- }
- },
- goHouse(){
- uni.navigateTo({
- url: "/pages/selfCenter/with_house",
- });
- },
- withoutHouse(){
- let url = getApp().makeApiUrl("user","user","unband_owner");
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- openId: getApp().globalData.open_id,
- },
- success: (res) => {
- if (res.data.code === 200) {
- this.isWith = 0;
- this.houseInfo.address = "";
- this.houseInfo.master = "";
- this.houseInfo.area = "";
- uni.showToast({
- title: "已解除绑定",
- duration: 2500,
- icon: "none",
- });
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- goWithHouse(){
- if (this.isWith == 0)
- {
- this.goHouse();
- return;
- }
- let that = this;
- uni.showModal({
- title: "确定解除绑定?",
- success(res) {
- if (res.confirm) {
- //确定继续后续操作。
- that.withoutHouse();
- } else if (res.cancel) {
- return;
- }
- },
- });
- //解除绑定
-
-
- },
- goDetailFn(index, url) {
- let that = this;
- if(!that.isAuth){
- uni.showToast({
- title: "您还没有登录授权",
- duration: 2500,
- icon: "none",
- });
- return;
- }
- switch (index) {
- case 0: //供暖订单
- uni.navigateTo({
- url,
- });
- break;
- case 1: //我的报修
- uni.navigateTo({
- url,
- });
- break;
- case 2: //退出登录
- uni.showModal({
- title: "确定退出登录吗?",
- success(res) {
- if (res.confirm) {
- that.loginOut();
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- break;
- }
- },
- loginOut() {
- let md5Sign = md5(
- "method=" +
- "user" +
- "×tamp=" +
- getApp().globalData.globalTimestamp +
- "&secret=" +
- getApp().globalData.secret
- );
- let url =
- getApp().globalData.shareUrl +
- "api/api.php" +
- "?method=user&action=logout×tamp=" +
- getApp().globalData.globalTimestamp +
- "&sign=" +
- md5Sign;
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- openId: getApp().globalData.open_id,
- },
- success: (res) => {
- if (res.data.code === 200) {
- this.isAuth = false;
- getApp().globalData.isAuth = false;
- getApp().globalData.user_headUrl = "";
- getApp().globalData.user_name = "";
- getApp().globalData.user_phone = "";
- //this.list[2].isShow = false;
- //this.$forceUpdate();
- uni.showToast({
- title: "退出登录成功",
- duration: 2500,
- icon: "none",
- });
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- getUserInfo() {
- let md5Sign = md5(
- "method=" +
- "user" +
- "×tamp=" +
- getApp().globalData.globalTimestamp +
- "&secret=" +
- getApp().globalData.secret
- );
- let url =
- getApp().globalData.shareUrl +
- "api/api.php" +
- "?method=user&action=info_by_openid×tamp=" +
- getApp().globalData.globalTimestamp +
- "&sign=" +
- md5Sign;
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- openId: getApp().globalData.open_id,
- },
- success: (res) => {
- if (res.data.code === 200) {
- if(res.data.data.stat_user){
- this.list[3].isShow = true;
- }
- if (res.data.data.owner_info){
- let wi = res.data.data.owner_info;
- this.houseInfo.address = wi.estate_name + wi.building_name + wi.unit + wi.room;
- this.houseInfo.master = wi.owner_name;
- this.houseInfo.area = wi.area;
- this.isWith = 1;
- }
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- getSwiperList() {
- let md5Sign = md5(
- "method=" +
- "common" +
- "×tamp=" +
- getApp().globalData.globalTimestamp +
- "&secret=" +
- getApp().globalData.secret
- );
- let url =
- getApp().globalData.shareUrl +
- "api/api.php" +
- "?method=common&source=main_pics&action=list×tamp=" +
- getApp().globalData.globalTimestamp +
- "&sign=" +
- md5Sign;
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- order_by: "weight desc",
- s_status: 1,
- },
- success: (res) => {
- if (res.data.code === 200) {
- // this.swiperBackground = getApp().globalData.shareUrl + res.data.data.list[0].pic_path;
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .content {
- display: flex;
- flex-direction: column;
- .self-inf {
- position: relative;
- height: 440rpx;
- width: 100%;
- display: flex;
- margin-bottom: 80rpx;
- border-radius: 0rpx 0rpx 100% 100%;
- .img-name-box {
- height: 200rpx;
- margin-top: 120rpx;
- display: flex;
- align-items: center;
- z-index: 99999;
- flex-direction: column;
- justify-content: center;
- .auth-btn {
- margin-left: 30rpx;
- margin-top: 20rpx;
- font-size: 24rpx;
- background-color: #02a7f0;
- color: #fff;
- }
- .heade-img {
- z-index: 1;
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- margin-left: 40rpx;
- }
- }
-
- .house-info-box {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- width: 70%;
- height: 70%;
- margin-top: 80rpx;
- margin-left: 30rpx;
- view{
- display: flex;
- text {
- color: #fff;
- font-size: 28rpx;
- }
- }
- }
- .bg-img {
- z-index: -1;
- position: absolute;
- width: 100%;
- height: 100%;
- background-color: #02a7f0;
- // border-radius: 0rpx 0rpx 70rpx 70rpx;
- }
- .groove-img {
- width: 100%;
- height: 100rpx;
- bottom: -22rpx;
- position: absolute;
- }
- .nickname {
- font-weight: 600;
- font-size: 28rpx;
- margin-left: 30rpx;
- margin-top: 20rpx;
- color: #ffffff;
- letter-spacing: 1rpx;
- }
- }
- .options {
- padding: 70rpx;
- z-index: 99;
- position: relative;
- top: -160rpx;
- .options-item {
- background-color: #fff;
- display: flex;
- box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
- border-radius: 32rpx;
- margin-top: 20px;
- height: 150rpx;
- align-items: center;
- .img-box {
- margin-left: 40rpx;
- .options-item-img {
- width: 56rpx;
- height: 56rpx;
- }
- }
- .options-item-name {
- margin-left: 40rpx;
- font-weight: 600;
- font-size: 30rpx;
- margin-bottom: 10rpx;
- }
- }
- }
- }
- .fontGrey {
- color: $uni-text-color-grey;
- }
- </style>
|