123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- <template>
- <!-- <view class="container">
- <uni-list>
- <uni-list-item title="个人资料" @click="navTo('/pages/set/userinfo')" ></uni-list-item>
- <uni-list-item title="修改密码" @click="navTo('/pages/set/password')" ></uni-list-item>
- <uni-list-item title="实名认证" @click="navTo('/pages/set/phone')" ></uni-list-item>
- <uni-list-item title="收货地址" @click="navTo('/pages/set/address')" ></uni-list-item>
- </uni-list>
- <uni-list class="margin-t-20">
- <uni-list-item title="消息推送" :switch-checked='true' :show-switch="true" :show-arrow="false" switch-color='#5dbc7c' @switchChange='switchChange'>
- </uni-list-item>
- </uni-list>
-
- <uni-list class="margin-t-20">
- <uni-list-item title="清除缓存" ></uni-list-item>
- <uni-list-item title="检查更新" >
- <template slot="right">
- 当前版本 1.0.3
- </template>
- </uni-list-item>
- </uni-list>
- <view class="list-cell log-out-btn" @click="toLogout">
- <text class="cell-tit">退出登录</text>
- </view>
- </view> -->
- <view class="container">
- <view class="row b-b flex jg">
- <text class="tit">头像</text>
- <image :src="userInfo.avatar" @click="imgsub"></image>
- </view>
- <view class="row b-b flex">
- <text class="tit">昵称</text>
- <input class="input" v-model="userInfo.nickname" type="text" placeholder-class="placeholder" />
- </view>
- <view class="row b-b flex">
- <text class="tit">邀请码</text>
- <input class="input" v-model="userInfo.uid" type="text" disabled="true" placeholder-class="placeholder"
- style="color: #999;" />
- </view>
- <!-- v-if="agents!=''" -->
- <!-- <view class="row b-b flex" v-if="!Array.isArray(userInfo.agent)">
- <text class="tit">代理区域</text>
- <view class="agents" style="color: #999;text-align: right;">
- <view class="agent" v-for="(item,index) in userInfo.agent" :key="index">
- {{item}}
- </view>
- </view>
- </view> -->
- <view class="row b-b flex" v-if="userInfo.account || userInfo.phone">
- <text class="tit">用户账号</text>
- <input class="input" v-model="userInfo.account || userInfo.phone" type="number" disabled="true"
- placeholder-class="placeholder" />
- </view>
- <view class="submit-box flex">
- <view class="submit" @click="edit">确认修改</view>
- <view class="submit dl" @click="toLogout">退出登录</view>
- <view class="submit zx" @click="zhuxiao">
- 注销账号
- </view>
- </view>
- <uni-popup ref="popupYue" type="center">
- <view class="yue-box">
- <view class="yue-title">
- 注销账号
- </view>
- <view class="yue-cont">
- <input type="number" class="yue-content" placeholder="请输入账号" v-model="userName">
- <input type="password" class="yue-content" placeholder="请输入密码" v-model="password">
- </view>
- <view class="comfirm-box">
- <view class="cancel" @click="quxiao()">取消</view>
- <view class="comfirm" @click="quire()">确定</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- // import uniList from "@/components/uni-list/uni-list.vue"
- // import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
- // import { logout } from '@/api/set.js';
- // import {
- // mapMutations
- // } from 'vuex';
- // export default {
- // components: {
- // uniList,uniListItem
- // },
- // data() {
- // return {
- // };
- // },
- // methods:{
- // ...mapMutations('user',['logout']),
- // navTo(url){
- // uni.navigateTo({
- // url:url
- // })
- // },
- // //退出登录
- // toLogout(){
- // let obj = this;
- // uni.showModal({
- // content: '确定要退出登录么',
- // success: (e)=>{
- // if(e.confirm){
- // logout({}).then((e) => {
- // uni.navigateBack();
- // }).catch((e) => {
- // console.log(e);
- // })
- // obj.logout();
- // }
- // }
- // });
- // },
- // //switch切换触发方法
- // switchChange(e){
- // console.log(e);
- // let statusTip = e.value ? '打开': '关闭';
- // this.$api.msg(`${statusTip}消息推送`);
- // },
- // }
- // }
- import uniList from '@/components/uni-list/uni-list.vue';
- import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- logout
- } from '@/api/set.js';
- import {
- edit
- } from '@/api/user.js';
- import {
- upload
- } from '@/api/order.js'
- export default {
- components: {
- uniList,
- uniListItem
- },
- data() {
- return {
- userInfo: {},
- pics: [],
- userName: '',
- password: '',
- isTijiao: false
- };
- },
- onLoad() {
- this.userInfo = uni.getStorageSync('userInfo') || '';
- console.log(this.userInfo)
- },
- methods: {
- ...mapMutations('user', ['logout']),
- //退出登录
- toLogout() {
- let obj = this;
- uni.showModal({
- content: '确定要退出登录么',
- success: e => {
- if (e.confirm) {
- logout({}).then(e => {
- obj.logout();
- uni.switchTab({
- url: '/pages/index/index'
- })
- })
- .catch(e => {
- console.log(e);
- });
- }
- }
- });
- },
- zhuxiao() {
- let shenhe = uni.getStorage({
- key:'shenhe',
- success: (res) => {
- console.log(res,'www');
- if(res.data == false){
- this.$api.msg('审核中')
-
- }
- // this.$refs.popupYue.open()
-
- },fail: (err) => {
- console.log(err);
-
- this.$refs.popupYue.open()
- }
- })
-
- console.log(shenhe,'2222');
- },
- quire() {
- if (this.userName == '' || this.password == '') {
- this.$api.msg('账号密码不得为空')
- } else if (this.userName != this.userInfo.phone) {
- this.$api.msg('请输入正确手机号')
- } else {
- uni.setStorage({
- key: 'shenhe',
- data: this.isTijiao
- })
- this.$refs.popupYue.close()
- }
- },
- quxiao(){
- this.$refs.popupYue.close()
- },
- imgsub() {
- let obj = this
- console.log('上传头像')
- // this.$util.uploadImageOne('upload/image', function(res) {
- // console.log('------',res);
- // this.pics.push(res.data.pathreplace(/http:\/\/mer.crmeb.net/,'https://hy.liuniu946.com'));
- // // obj.userInfo.avatar = res.data.path.replace(/http:\/\/mer.crmeb.net/,'http://zccy.frp.liuniu946.com')
- // obj.$set(this, 'pics', this.pics);
- // obj.$set(this, 'extract_pic', this.pics[0])
- // });
- // uploads({
- // filename: ''
- // }).then(data => {
- // console.log("data",data);
- // this.userInfo.avatar = data[0].url;
- // })
- upload({
- filename: ''
- }).then(res => {
- console.log(res[0].url)
- obj.userInfo.avatar = res[0].url
- // console.log(obj.userInfo.avatar)
- });
- },
- edit() {
- const that = this;
- uni.showLoading({
- title: '提交中...',
- mask: true
- })
- edit({
- avatar: this.userInfo.avatar,
- nickname: this.userInfo.nickname
- }).then(e => {
- uni.hideLoading()
- that.$api.msg('修改成功');
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/user/user'
- });
- }, 1000);
- }).catch(e => {
- console.log(e);
- that.$api.msg('修改失败');
- })
- }
- }
- };
- </script>
- <style lang='scss'>
- /* page{
- background: $page-color-base;
- }
- .list-cell{
- display:flex;
- align-items:baseline;
- padding: 20rpx $page-row-spacing;
- line-height:60rpx;
- position:relative;
- background: #fff;
- justify-content: center;
- &.log-out-btn{
- margin-top: 40rpx;
- .cell-tit{
- color: $uni-color-primary;
- text-align: center;
- margin-right: 0;
- }
- }
- .cell-tit{
- flex: 1;
- font-size: $font-base + 2rpx;
- color: $font-color-dark;
- margin-right:10rpx;
- }
- .cell-tip{
- font-size: $font-base;
- color: $font-color-light;
- }
- switch{
- transform: translateX(16rpx) scale(.84);
- }
- } */
- page {
- background-color: #f3f3f3;
- min-height: 100%;
- .container {
- height: 100%;
- }
- }
- .row {
- background-color: #fff;
- padding: 42rpx 25rpx;
- font-size: 30rpx;
- color: #333333;
- image {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- }
- .input {
- text-align: right;
- color: #333333;
- }
- }
- .submit-box {
- display: flex;
- flex-direction: column;
- padding-top: 157rpx;
- .submit {
- margin: 40rpx auto;
- width: 560rpx;
- background-color: #ff4c4b;
- color: #FFFFFF;
- text-align: center;
- padding: 26rpx 0rpx;
- border-radius: 50rpx;
- }
- .dl {
- background-color: #FFFFFF;
- color: #ff4c4b;
- }
- .zx {
- color: #FFFFFF;
- background-color: gray;
- }
- }
- .jg {
- margin-bottom: 20rpx;
- }
- .yue-box {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-around;
- width: 582rpx;
- height: 377rpx;
- background: #FFFFFF;
- border-radius: 20rpx;
- .yue-title{
- font-size: 32rpx;
- font-weight: 500;margin-top: 20rpx;
- }
- .yue-tit {
- align-items: center;
- font-size: 42rpx;
- font-weight: 500;
- color: #0C1732;
- line-height: 56rpx;
- }
- .password {
- text-align: center;
- align-items: center;
- }
- // .yue-cont{
- // border-color: #5655EF;
- // width: 400rpx;
- // height: 80rpx;
- // }
- .yue-content {
- margin: 20rpx 0;
- text-align: center;
- // width: 300rpx;
- height: 70rpx;
- border-radius: 20rpx;
- border: 2rpx solid gray;
- font-size: 36rpx;
- font-weight: 500;
- // color: red;
- }
- .comfirm-box {
- width: 90%;
- display: flex;
- justify-content: space-between;
- .cancel {
- text-align: center;
- line-height: 78rpx;
- width: 200rpx;
- height: 62rpx;
- border: 2rpx solid #999999;
- border-radius: 10rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #333333;
- }
- .comfirm {
- text-align: center;
- width: 200rpx;
- height: 62rpx;
- background: #FF5454;
- border-radius: 10rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #FFFFFF;
- line-height: 78rpx;
- }
- }
- }
- </style>
|