|
|
@@ -40,11 +40,13 @@
|
|
|
</view>
|
|
|
<view class='item acea-row row-between-wrapper'>
|
|
|
<view>昵称</view>
|
|
|
- <view class='input'><input type='text' name='nickname' :value='userInfo.nickname'></input></view>
|
|
|
+ <view class='input'><input type='text' name='nickname' :value='userInfo.nickname'></input>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class='item acea-row row-between-wrapper'>
|
|
|
<view>手机号码</view>
|
|
|
- <navigator url="/pages/users/user_phone/index" hover-class="none" class="input" v-if="!userInfo.phone">
|
|
|
+ <navigator url="/pages/users/user_phone/index" hover-class="none" class="input"
|
|
|
+ v-if="!userInfo.phone">
|
|
|
点击绑定手机号<text class="iconfont icon-xiangyou"></text>
|
|
|
</navigator>
|
|
|
<view class='input acea-row row-between-wrapper' v-else>
|
|
|
@@ -75,7 +77,12 @@
|
|
|
</navigator>
|
|
|
</view>
|
|
|
<!-- #endif -->
|
|
|
-
|
|
|
+ <view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
|
|
|
+ <view>更换手机号码</view>
|
|
|
+ <navigator url="/pages/users/user_phone/index?type=1" hover-class="none" class="input">
|
|
|
+ 点击更换手机号码<text class="iconfont icon-xiangyou"></text>
|
|
|
+ </navigator>
|
|
|
+ </view>
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
<view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
|
|
|
<view>密码</view>
|
|
|
@@ -83,18 +90,21 @@
|
|
|
点击修改密码<text class="iconfont icon-xiangyou"></text>
|
|
|
</navigator>
|
|
|
</view>
|
|
|
+ <view class="item acea-row row-between-wrapper" @click="initData">
|
|
|
+ <view>缓存大小</view>
|
|
|
+ <view class="input">
|
|
|
+ {{fileSizeString}}<text class="iconfont icon-xiangyou"></text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<!-- #endif -->
|
|
|
|
|
|
- <view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
|
|
|
- <view>更换手机号码</view>
|
|
|
- <navigator url="/pages/users/user_phone/index?type=1" hover-class="none" class="input">
|
|
|
- 点击更换手机号码<text class="iconfont icon-xiangyou"></text>
|
|
|
- </navigator>
|
|
|
- </view>
|
|
|
+
|
|
|
</view>
|
|
|
+
|
|
|
<button class='modifyBnt bg-color' formType="submit">保存修改</button>
|
|
|
<!-- #ifdef H5 -->
|
|
|
- <view class="logOut cartcolor acea-row row-center-wrapper" @click="outLogin" v-if="!this.$wechat.isWeixin()">退出登录</view>
|
|
|
+ <view class="logOut cartcolor acea-row row-center-wrapper" @click="outLogin"
|
|
|
+ v-if="!this.$wechat.isWeixin()">退出登录</view>
|
|
|
<!-- #endif -->
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
<view class="logOut cartcolor acea-row row-center-wrapper" @click="outLogin">退出登录</view>
|
|
|
@@ -104,7 +114,8 @@
|
|
|
<!-- #ifdef MP -->
|
|
|
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
|
|
<!-- #endif -->
|
|
|
- <canvas canvas-id="canvas" v-if="canvasStatus" :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
|
|
|
+ <canvas canvas-id="canvas" v-if="canvasStatus"
|
|
|
+ :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -134,7 +145,7 @@
|
|
|
authorize
|
|
|
// #endif
|
|
|
},
|
|
|
- mixins:[colors],
|
|
|
+ mixins: [colors],
|
|
|
data() {
|
|
|
return {
|
|
|
userInfo: {},
|
|
|
@@ -145,7 +156,8 @@
|
|
|
isShowAuth: false, //是否隐藏授权
|
|
|
canvasWidth: "",
|
|
|
canvasHeight: "",
|
|
|
- canvasStatus: false
|
|
|
+ canvasStatus: false,
|
|
|
+ fileSizeString: ''
|
|
|
};
|
|
|
},
|
|
|
computed: mapGetters(['isLogin']),
|
|
|
@@ -162,11 +174,84 @@
|
|
|
onLoad() {
|
|
|
if (this.isLogin) {
|
|
|
this.getUserInfo();
|
|
|
+ this.formatSize()
|
|
|
} else {
|
|
|
toLogin();
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ formatSize() {
|
|
|
+ let that = this;
|
|
|
+ plus.cache.calculate(function(size) {
|
|
|
+ let sizeCache = parseInt(size);
|
|
|
+ if (sizeCache == 0) {
|
|
|
+ that.fileSizeString = "0B";
|
|
|
+ } else if (sizeCache < 1024) {
|
|
|
+ that.fileSizeString = sizeCache + "B";
|
|
|
+ } else if (sizeCache < 1048576) {
|
|
|
+ that.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
|
|
|
+ } else if (sizeCache < 1073741824) {
|
|
|
+ that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
|
|
|
+ } else {
|
|
|
+ that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ initData() {
|
|
|
+ uni.showModal({
|
|
|
+ title: '清楚缓存',
|
|
|
+ content: '确定清楚本地缓存数据吗?',
|
|
|
+ success: (res)=> {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.clearCache()
|
|
|
+ this.formatSize()
|
|
|
+ } else if (res.cancel) {
|
|
|
+ return that.$util.Tips({
|
|
|
+ title: '已取消'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ clearCache() {
|
|
|
+ let that = this;
|
|
|
+ let os = plus.os.name;
|
|
|
+ if (os == 'Android') {
|
|
|
+ let main = plus.android.runtimeMainActivity();
|
|
|
+ let sdRoot = main.getCacheDir();
|
|
|
+ let files = plus.android.invoke(sdRoot, "listFiles");
|
|
|
+ let len = files.length;
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
+ let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
|
|
|
+ plus.io.resolveLocalFileSystemURL(filePath, function(entry) {
|
|
|
+ if (entry.isDirectory) {
|
|
|
+ entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录
|
|
|
+ uni.showToast({
|
|
|
+ title: '缓存清理完成',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ that.formatSize(); // 重新计算缓存
|
|
|
+ }, function(e) {
|
|
|
+ console.log(e.message)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ entry.remove();
|
|
|
+ }
|
|
|
+ }, function(e) {
|
|
|
+ console.log('文件路径读取失败')
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else { // ios暂时未找到清理缓存的方法,以下是官方提供的方法,但是无效,会报错
|
|
|
+ plus.cache.clear(function() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '缓存清理完成',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ that.formatSize();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 授权回调
|
|
|
*/
|
|
|
@@ -182,8 +267,7 @@
|
|
|
*/
|
|
|
Setting: function() {
|
|
|
uni.openSetting({
|
|
|
- success: function(res) {
|
|
|
- }
|
|
|
+ success: function(res) {}
|
|
|
});
|
|
|
},
|
|
|
switchAccounts: function(index) {
|
|
|
@@ -239,8 +323,7 @@
|
|
|
url: '/pages/index/index'
|
|
|
})
|
|
|
})
|
|
|
- .catch(err => {
|
|
|
- });
|
|
|
+ .catch(err => {});
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消');
|
|
|
}
|
|
|
@@ -301,7 +384,7 @@
|
|
|
let that = this,
|
|
|
value = e.detail.value,
|
|
|
userInfo = that.switchUserInfo[that.userIndex];
|
|
|
- if (!value.nickname) return that.$util.Tips({
|
|
|
+ if (!value.nickname.trim()) return that.$util.Tips({
|
|
|
title: '用户姓名不能为空'
|
|
|
});
|
|
|
value.avatar = this.userInfo.avatar;
|
|
|
@@ -327,10 +410,11 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- .cartcolor{
|
|
|
+ .cartcolor {
|
|
|
color: var(--view-theme);
|
|
|
- border: 1px solid var(--view-theme) ;
|
|
|
+ border: 1px solid var(--view-theme);
|
|
|
}
|
|
|
+
|
|
|
.personal-data .wrapper {
|
|
|
margin: 10rpx 0;
|
|
|
background-color: #fff;
|