Administrator
2021-06-16 e6fef74ea3867d282dff1bc26dccf46a0518b837
1.新增点击头像上传
2.新增用户昵称,手机号,邮箱,生日可修改
10 files modified
241 ■■■■ changed files
manifest.json 2 ●●● patch | view | raw | blame | history
pages.json 32 ●●●●● patch | view | raw | blame | history
pages/article/article.vue 8 ●●●●● patch | view | raw | blame | history
pages/myself/childen/aboutUs.vue 12 ●●●●● patch | view | raw | blame | history
pages/myself/childen/xinxi.vue 104 ●●●● patch | view | raw | blame | history
pages/myself/myself.vue 69 ●●●●● patch | view | raw | blame | history
store/actions.js 2 ●●●●● patch | view | raw | blame | history
store/mutations.js 1 ●●●● patch | view | raw | blame | history
store/state.js 7 ●●●●● patch | view | raw | blame | history
xcxjingqingmap_patrol/js/vueMain.js 4 ●●●● patch | view | raw | blame | history
manifest.json
@@ -1,6 +1,6 @@
{
    "name" : "jfpt",
    "appid" : "__UNI__647B57F",
    "appid" : "__UNI__88EDF2B",
    "description" : "",
    "versionName" : "1.0.0",
    "versionCode" : "100",
pages.json
@@ -60,6 +60,38 @@
            }
        },
        {
            "path": "pages/myself/childen/info/nickName",
            "name": "nickName",
            "style": {
                "navigationBarTitleText": "修改昵称",
                "navigationBarBackgroundColor": "#F56968"
            }
        },
        {
            "path": "pages/myself/childen/info/phone",
            "name": "phone",
            "style": {
                "navigationBarTitleText": "修改电话",
                "navigationBarBackgroundColor": "#F56968"
            }
        },
        {
            "path": "pages/myself/childen/info/email",
            "name": "email",
            "style": {
                "navigationBarTitleText": "修改邮箱",
                "navigationBarBackgroundColor": "#F56968"
            }
        },
        {
            "path": "pages/myself/childen/info/birthday",
            "name": "birthday",
            "style": {
                "navigationBarTitleText": "修改生日",
                "navigationBarBackgroundColor": "#F56968"
            }
        },
        {
            "path": "pages/business/business",
            "name": "business",
            "style": {
pages/article/article.vue
@@ -120,7 +120,6 @@
                                this.loadStatus='nomore';
                            }
                        }
                    }
                });
            }
@@ -217,14 +216,7 @@
                    border-radius: 5px;
                }
            }
        }
    }
    
    
pages/myself/childen/aboutUs.vue
@@ -69,13 +69,17 @@
        }
    }
</script>
<style lang="scss">
    page{
        background-color: rgba($color: #F5F0F6, $alpha: 0.5);
    }
</style>
<style lang="scss" scoped>
    .aboutUs {
        width: 100%;
        height: 100%;
        // background-color: rgba(128,128,128,0.1);
        background-color: #F5F0F6;
        // background-color: #F5F0F6;
        
        .up{
            width: 100%;
@@ -161,8 +165,8 @@
                bottom: 1.5%;
                // left: calc((100% - 640rpx)/2);
                // text-align: center;
                font-size: 22rpx;
                color: #808080;
                font-size: 20rpx;
                // color: #808080;
            }
        }
    }
pages/myself/childen/xinxi.vue
@@ -14,21 +14,25 @@
                <view class="title">编号</view>
                <view class="msg">{{user.id}}</view>
            </view>
            <view class="row row-base-info">
            <view class="row row-base-info" @click="updateNickName()">
                <view class="title">昵称</view>
                <view class="msg">{{user.name}}</view>
                <image src="../../../static/workbench/bracket.png">
                <view class="msg-update">{{user.name}}</view>
            </view>
            <view class="row row-base-info">
            <view class="row row-base-info" @click="updatePhone()">
                <view class="title">电话</view>
                <view class="msg">{{user.phone}}</view>
                <image src="../../../static/workbench/bracket.png">
                <view class="msg-update">{{user.phone}}</view>
            </view>
            <view class="row row-base-info">
            <view class="row row-base-info" @click="updateEmail()">
                <view class="title">邮箱</view>
                <view class="msg">{{user.email}}</view>
                <image src="../../../static/workbench/bracket.png">
                <view class="msg-update">{{user.email}}</view>
            </view>
            <view class="row row-base-info-birthday">
            <view class="row row-base-info-birthday" @click="updateBirthday()">
                <view class="title">生日</view>
                <view class="msg">{{user.birthday}}</view>
                <image src="../../../static/workbench/bracket.png">
                <view class="msg-update">{{user.birthday}}</view>
            </view>
        </view>
        
@@ -72,6 +76,27 @@
        this.getUserInfo();
    },
    methods:{
        //跳转至修改昵称页面
        updateNickName(){
            uni.navigateTo({
                url: 'info/nickName?name='+this.user.name
            });
        },
        updatePhone(){
            uni.navigateTo({
                url: 'info/phone?phone='+this.user.phone
            });
        },
        updateEmail(){
            uni.navigateTo({
                url: 'info/email?email='+this.user.email
            });
        },
        updateBirthday(){
            uni.navigateTo({
                url: 'info/birthday?birthday='+this.user.birthday
            });
        },
        //获取客户信息
        getUserInfo(){
            var that = this;
@@ -90,12 +115,16 @@
    }
}
</script>
<style lang="scss">
    page{
        background-color: rgba($color: #F5F0F6, $alpha: 0.5);
    }
</style>
<style lang="scss" scoped>
.user-info{
    width: 100%;
    height: 100%;
    background-color: #F5F0F6;
    // background-color: #F5F0F6;
    letter-spacing: 1rpx;
    
    .base-info-title{
@@ -109,47 +138,68 @@
    
    .base-info{
        width: 100%;
        height: 565rpx;
        height: 635rpx;
        background-color: #FFFFFF;
        
        .row-base-info{
            width: 94%;
            margin: 0 auto;
            height: 80rpx;
            height: 90rpx;
            border-bottom: 1px solid rgba(128,128,128,0.1);
            line-height: 90rpx;
            
            .title{
                line-height: 80rpx;
                float: left;
                font-size: 28rpx;
            }
            
            .msg{
                line-height: 80rpx;
                position: absolute;
                right: 30rpx;
                color: #808080;
                font-size: 24rpx;
            }
            .msg-update{
                position: absolute;
                right: 90rpx;
                color: #808080;
                font-size: 24rpx;
            }
            image{
                position: absolute;
                margin-top: 20rpx;
                right: 30rpx;
                width: 40rpx;
                height: 40rpx;
            }
        }
        
        .row-base-info-birthday{
            width: 94%;
            margin: 0 auto;
            height: 80rpx;
            height: 90rpx;
            line-height: 90rpx;
            
            .title{
                line-height: 80rpx;
                float: left;
                font-size: 28rpx;
            }
            
            .msg{
                line-height: 80rpx;
            .msg-update{
                position: absolute;
                right: 30rpx;
                right: 90rpx;
                color: #808080;
                font-size: 24rpx;
            }
            image{
                position: absolute;
                margin-top: 20rpx;
                right: 30rpx;
                width: 40rpx;
                height: 40rpx;
            }
        }
    }
@@ -158,30 +208,30 @@
        height: 60rpx;
        line-height: 60rpx;
        position: relative;
        left: -60rpx;
        left: 20rpx;
        font-size: 24rpx;
        color: #808080;
    }
    
    .dept-info{
        width: 100%;
        height: 160rpx;
        height: 180rpx;
        background-color: #FFFFFF;
        
        .row-dept-info{
            width: 94%;
            margin: 0 auto;
            height: 80rpx;
            height: 90rpx;
            border-bottom: 1px solid rgba(128,128,128,0.1);
            
            .title{
                line-height: 80rpx;
                line-height: 90rpx;
                float: left;
                font-size: 28rpx;
            }
            
            .msg{
                line-height: 80rpx;
                line-height: 90rpx;
                position: absolute;
                right: 30rpx;
                color: #808080;
@@ -192,16 +242,16 @@
        .row-dept-info-post{
            width: 94%;
            margin: 0 auto;
            height: 80rpx;
            height: 90rpx;
            
            .title{
                line-height: 80rpx;
                line-height: 90rpx;
                float: left;
                font-size: 28rpx;
            }
            
            .msg{
                line-height: 80rpx;
                line-height: 90rpx;
                position: absolute;
                right: 30rpx;
                color: #808080;
pages/myself/myself.vue
@@ -4,7 +4,7 @@
        <view class="m-top">
            <view class="m-t-left">
                <view class="userImg">
                    <img class="img" :src="useimg" alt="">
                    <img class="img" :src="useimg" @click="ChooseImage">
                </view>
                <view class="usermsg">
                    <view>{{userName}}</view>
@@ -102,10 +102,11 @@
            butTitle() {
                return this.$store.state.loging == true ? '登出' : '登入'
            }
        },
        onLoad() {
            if(this.$store.state.avatar!=null && this.$store.state.avatar!=''){
                this.useimg = this.$store.state.avatar;
            }
        },
        methods: {
            openThere(fn) {
@@ -165,6 +166,68 @@
                    that.showTextmsg = false;
                }
            },
            //图片上传
            ChooseImage() {
                var that = this;
                    uni.chooseImage({
                        count: 1, //可选择数量,默认9
                        sizeType: ['compressed','original'], //上传压缩图,原图
                        sourceType: ['album','camera'], //从相册选择或从使用相机
                        success: async (res) => {
                            for (var i = 0; i < res.tempFiles.length; i++) {
                                if(res.tempFiles[i].size > 10 * 1024 * 1000){  //上传图片大小限制
                                    uni.showToast({
                                        title: "照片大小不能10MB",
                                        icon: "none"
                                    })
                                    return
                                }
                            }
                            var tempFilePath = res.tempFilePaths;
                            try{
                                uni.showLoading({
                                    title:"上传中...",
                                    mask:true
                                })
                                var that = this;
                                // 文件上传
                                uni.uploadFile({
                                    // url: 'https://web.byisf.com/api/blade-jfpts/depl/put-depl', //仅为示例,非真实的接口地址
                                    url: 'http://web.byisf.com:82/blade-jfpts/depl/put-depl',
                                    filePath: tempFilePath[0],
                                    name: 'file',
                                    formData: {
                                        'user': 'test'  // 上传附带参数
                                    },
                                    success: (data) => {
                                        that.useimg = JSON.parse(data.data).data;
                                        //修改用户头像信息
                                        uni.request({
                                            url:"http://s16s652780.51mypc.cn/api/blade-user/updateUserInfo",
                                            method:"POST",
                                            data:{
                                                id: this.$store.state.puserID,
                                                avatar:that.useimg
                                            },
                                            success:(res)=> {
                                                if(res.data.code==200){
                                                    uni.showToast({
                                                        title: '上传成功!',
                                                        duration: 2000
                                                    });
                                                }
                                            }
                                        })
                                    }
                                });
                            }catch(e){
                                console.log(e);
                            }finally{
                                uni.hideLoading();
                            }
                        }
                    });
                }
            // geton() {
            //     wx.navigateTo({
            //         url: '../poput/workbench/policeDetails/policeDetails?id=111'
store/actions.js
@@ -45,9 +45,11 @@
            success: (res) => {
                if (res.statusCode == 200) {
                    store.commit('getUserData',res.data)
                    console.log(res.data,123542);
                    data.isit = true;
                    data.userName = res.data.real_name; //警袁姓名
                    data.userID = res.data.user_id; //警袁id
                    data.avatar = res.data.avatar; //头像
                    // data.userPhon = res.user_id;
                    store.commit('login', data);
                } 
store/mutations.js
@@ -8,6 +8,7 @@
            state.message.useName = data.userName;
            state.puserName = data.userName;
            state.puserID = data.userID;
            state.avatar = data.avatar;
        }
        //储存用户
        WxStorage.set("init", "true");
store/state.js
@@ -5,9 +5,10 @@
    },
    logPath: '',
    piAPI: 'http://s16s652780.51mypc.cn/api/',
    puserName: '陈慧英',
    puserID: '1370564873280430082',
    puserIphone:'15649685246',
    puserName: '',
    puserID: '',
    puserIphone:'',
    avatar:"",
    UserData: {},
}
xcxjingqingmap_patrol/js/vueMain.js
@@ -9,8 +9,8 @@
        nowIndex: 1,
        //基础路径
        pathUrl: "http://localhost:89",
        // pathUrl: "https://web.byisf.com/api/blade-jfpts",
        // pathUrl: "http://localhost:89",
        pathUrl: "http://s16s652780.51mypc.cn/api/blade-jfpts",
        layer: null,