reghao 2 년 전
부모
커밋
e84016de31
6개의 변경된 파일8개의 추가작업 그리고 438개의 파일을 삭제
  1. 8 5
      src/components/upload/PublishImage.vue
  2. 0 18
      src/router/index.js
  3. 0 134
      src/views/user/Avatar.vue
  4. 0 121
      src/views/user/Profile.vue
  5. 0 113
      src/views/user/Publish.vue
  6. 0 47
      src/views/user/Vip.vue

+ 8 - 5
src/components/upload/PublishImage.vue

@@ -30,6 +30,12 @@
           <el-form-item label="标题">
             <el-input v-model="form.title" style="width: 70%; padding-right: 2px" placeholder="标题不能超过 50 个字符" />
           </el-form-item>
+          <el-form-item label="相册">
+            <el-select v-model="form.album" placeholder="选择相册">
+              <el-option label="默认相册" value="1" />
+              <el-option label="验证码可见" value="2" />
+            </el-select>
+          </el-form-item>
           <el-form-item>
             <el-button type="primary" @click="onSubmit">立即投稿</el-button>
             <el-button>取消</el-button>
@@ -60,11 +66,6 @@ export default {
   components: { FilePond },
   data() {
     return {
-      rules: [
-        value => !value || value.size < 2000000 || 'Avatar size should be less than 2 MB!'
-      ],
-      imageList: [],
-      imageUrl: '',
       server: {
         url: '//oss.reghao.cn/',
         revert: null,
@@ -92,8 +93,10 @@ export default {
           }
         }
       },
+      imageList: [],
       form: {
         title: null,
+        album: null
       }
     }
   },

+ 0 - 18
src/router/index.js

@@ -19,9 +19,6 @@ const UserAudio = () => import('views/user/Home')
 const UserArticle = () => import('views/user/Home')
 const UserFollowing = () => import('views/user/Home')
 const UserFollower = () => import('views/user/Home')
-const ProfileIndex = () => import('views/user/Profile')
-const AvatarIndex = () => import('views/user/Avatar')
-const VipIndex = () => import('views/user/Vip')
 const CollectionIndex = () => import('views/user/Collection')
 const HistoryIndex = () => import('views/user/History')
 const PostPublish = () => import('views/post/PostPublish')
@@ -171,21 +168,6 @@ const routes = [
     name: 'UserFollower',
     component: UserFollower
   },
-  {
-    path: '/u/profile',
-    name: 'ProfileIndex',
-    component: ProfileIndex
-  },
-  {
-    path: '/u/avatar',
-    name: 'AvatarIndex',
-    component: AvatarIndex
-  },
-  {
-    path: '/u/vip',
-    name: 'VipIndex',
-    component: VipIndex
-  },
   {
     path: '/u/collection',
     name: 'CollectionIndex',

+ 0 - 134
src/views/user/Avatar.vue

@@ -1,134 +0,0 @@
-<template>
-  <div>
-    <el-row>
-      <el-col :md="4">
-        <el-menu
-          :default-active="this.$route.path"
-          router
-          class="el-menu-vertical-demo"
-        >
-          <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.path">
-            <i :class="item.icon" />
-            <span slot="title">{{ item.name }}</span>
-          </el-menu-item>
-        </el-menu>
-      </el-col>
-      <el-col :md="20">
-        <el-row style="position: center">
-          <el-row>
-            <h2>当前头像</h2>
-            <el-avatar>
-              <el-image :src="userInfo.avatarUrl" />
-            </el-avatar>
-          </el-row>
-          <el-row>
-            <h2>修改头像</h2>
-            <el-upload
-              class="avatar-uploader"
-              action="https://oss.reghao.cn/"
-              name="file"
-              :data="{
-                channelId: 4,
-                sha256sum: sha256sum
-              }"
-              :show-file-list="false"
-              :on-success="handleAvatarSuccess"
-              :before-upload="beforeAvatarUpload">
-              <img v-if="imageUrl" :src="imageUrl" class="avatar">
-              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-            </el-upload>
-            <el-button type="primary" @click="onSubmit">更新</el-button>
-          </el-row>
-        </el-row>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { getUserInfo } from '@/utils/auth'
-import { hashFile } from '@/utils/hash'
-import { updateAvatar } from '@/api/user'
-
-export default {
-  name: 'Profile',
-  data() {
-    return {
-      userInfo: null,
-      navList: [
-        { path: '/u/profile', name: '我的信息', icon: 'el-icon-user' },
-        { path: '/u/avatar', name: '我的头像', icon: 'el-icon-user' },
-        { path: '/u/vip', name: '我的会员', icon: 'el-icon-user' }
-      ],
-      imageUrl: '',
-      coverUrl: '',
-      sha256sum: null
-    }
-  },
-  created() {
-    this.userInfo = getUserInfo()
-    if (this.userInfo != null) {
-      document.title =this.userInfo.screenName + '的头像'
-    }
-  },
-  methods: {
-    beforeAvatarUpload(file) {
-      return hashFile(file).then(res => {
-        this.sha256sum = res.sha256sum
-        const isJPG = file.type === 'image/jpeg';
-        const isLt2M = file.size / 1024 / 1024 < 2;
-
-        if (!isJPG) {
-          this.$message.error('上传头像图片只能是 JPG 格式!');
-        }
-        if (!isLt2M) {
-          this.$message.error('上传头像图片大小不能超过 2MB!');
-        }
-        return isJPG && isLt2M;
-      })
-    },
-    handleAvatarSuccess(res, file) {
-      this.imageUrl = URL.createObjectURL(file.raw);
-      this.coverUrl = res.url;
-    },
-    onSubmit() {
-      const data = {
-        userId: this.userInfo.userId,
-        coverUrl: this.coverUrl
-      }
-      updateAvatar(data).then(res => {
-        if (res.code === 0) {
-          console.log('更新头像')
-          this.userInfo.avatarurl = this.coverUrl
-        }
-      })
-    }
-  }
-}
-</script>
-
-<style>
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409EFF;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 178px;
-  height: 178px;
-  line-height: 178px;
-  text-align: center;
-}
-.avatar {
-  width: 178px;
-  height: 178px;
-  display: block;
-}
-</style>

+ 0 - 121
src/views/user/Profile.vue

@@ -1,121 +0,0 @@
-<template>
-  <div>
-    <el-row>
-      <el-col :md="4">
-        <el-menu
-          :default-active="this.$route.path"
-          router
-          class="el-menu-vertical-demo"
-        >
-          <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.path">
-            <i :class="item.icon" />
-            <span slot="title">{{ item.name }}</span>
-          </el-menu-item>
-        </el-menu>
-      </el-col>
-      <el-col :md="20">
-        <el-row>
-          <h2>我的信息</h2>
-        </el-row>
-        <el-form ref="form" :model="form" label-width="80px">
-          <el-form-item label="用户名">
-            <span style="width: 30%; padding-right: 2px"> 1rentv_14001 </span>
-          </el-form-item>
-          <el-form-item label="昵称">
-            <el-input v-model="form.screenName" style="width: 30%; padding-right: 2px" placeholder="昵称不能超过 10 个字符" />
-          </el-form-item>
-          <el-form-item label="我的签名">
-            <el-input v-model="form.signature" type="textarea" style="width: 30%; padding-right: 2px" />
-          </el-form-item>
-          <el-form-item label="性别">
-            <el-input v-model="form.gender" style="width: 30%; padding-right: 2px" />
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="onSubmit">保存</el-button>
-          </el-form-item>
-        </el-form>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { getUserInfo } from '@/utils/auth'
-import { updateProfile } from '@/api/user'
-
-export default {
-  name: 'Profile',
-  data() {
-    return {
-      userId: -1,
-      navList: [
-        { path: '/u/profile', name: '我的信息', icon: 'el-icon-user' },
-        { path: '/u/avatar', name: '我的头像', icon: 'el-icon-user' },
-        { path: '/u/vip', name: '我的会员', icon: 'el-icon-user' }
-      ],
-      form: {
-        userId: null,
-        screenName: null,
-        signature: null,
-        gender: 2
-      }
-    }
-  },
-  created() {
-    const userInfo = getUserInfo()
-    if (userInfo != null) {
-      document.title = userInfo.screenName + '的个人资料'
-      this.form.userId = userInfo.userId
-      this.form.screenName = userInfo.screenName
-      this.form.signature = userInfo.signature
-    }
-  },
-  methods: {
-    onSubmit() {
-      if (this.form.title === '' || this.form.categoryId === -1) {
-        this.$notify(
-          {
-            title: '提示',
-            message: '分区和稿件标题不能为空',
-            type: 'warning',
-            duration: 3000
-          }
-        )
-        return
-      }
-
-      updateProfile(this.form)
-        .then(res => {
-          if (res.code === 0) {
-            this.$notify(
-              {
-                title: '提示',
-                message: '个人资料已更新',
-                type: 'warning',
-                duration: 3000
-              }
-            )
-          } else {
-            this.$notify(
-              {
-                title: '提示',
-                message: res.msg,
-                type: 'warning',
-                duration: 3000
-              }
-            )
-          }
-        }).catch(error => {
-        this.$notify(
-          {
-            title: '提示',
-            message: error.message,
-            type: 'warning',
-            duration: 3000
-          }
-        )
-      })
-    }
-  }
-}
-</script>

+ 0 - 113
src/views/user/Publish.vue

@@ -1,113 +0,0 @@
-<template>
-  <div>
-    <el-row>
-      <el-col :md="4">
-        <el-menu
-          default-active="1"
-          class="el-menu-vertical-demo"
-        >
-          <el-menu-item index="1">
-            <i class="el-icon-upload" />
-            <span slot="title">投稿</span>
-          </el-menu-item>
-          <el-menu-item index="2">
-            <i class="el-icon-files" />
-            <span slot="title">稿件</span>
-          </el-menu-item>
-          <el-menu-item index="3">
-            <i class="el-icon-data-analysis" />
-            <span slot="title">数据</span>
-          </el-menu-item>
-        </el-menu>
-      </el-col>
-      <el-col :md="20">
-        <el-tabs v-model="activeName" @tab-click="handleClick">
-          <el-tab-pane label="视频" name="first">
-            <publish-video v-if="activeName === 'first'" />
-          </el-tab-pane>
-          <el-tab-pane label="音频" name="second">
-            <publish-audio v-if="activeName === 'second'" />
-          </el-tab-pane>
-          <el-tab-pane label="图片" name="third">
-            <publish-image v-if="activeName === 'third'" />
-          </el-tab-pane>
-          <el-tab-pane label="文章" name="fourth">
-            <publish-article v-if="activeName === 'fourth'" />
-          </el-tab-pane>
-        </el-tabs>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import PublishVideo from '@/components/upload/PublishVideo'
-import PublishAudio from '@/components/upload/PublishAudio'
-import PublishImage from '@/components/upload/PublishImage'
-import PublishArticle from '@/components/upload/PublishArticle'
-
-export default {
-  name: 'Publish',
-  components: { PublishVideo, PublishAudio, PublishImage, PublishArticle },
-  data() {
-    return {
-      activeName: 'first',
-      coverUrl: null,
-      videoUrlId: null,
-      coverFile: null,
-      dialogImageUrl: '',
-      dialogVisible: false,
-      disabled: false,
-      imageList: [],
-      imageUrl: ''
-    }
-  },
-  created() {
-  },
-  methods: {
-  }
-}
-</script>
-
-<style>
-.uploader-example {
-  width: 500px;
-  padding: 15px;
-  margin: 40px auto 0;
-  font-size: 12px;
-  box-shadow: 0 0 10px rgba(0, 0, 0, .4);
-}
-.uploader-example .uploader-btn {
-  margin-right: 4px;
-}
-.uploader-example .uploader-list {
-  max-height: 440px;
-  overflow: auto;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409EFF;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 320px;
-  height: 240px;
-  line-height: 178px;
-  text-align: center;
-}
-.avatar {
-  width: 320px;
-  height: 240px;
-  display: block;
-}
-</style>

+ 0 - 47
src/views/user/Vip.vue

@@ -1,47 +0,0 @@
-<template>
-  <div>
-    <el-row>
-      <el-col :md="4">
-        <el-menu
-          :default-active="this.$route.path"
-          router
-          class="el-menu-vertical-demo"
-        >
-          <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.path">
-            <i :class="item.icon" />
-            <span slot="title">{{ item.name }}</span>
-          </el-menu-item>
-        </el-menu>
-      </el-col>
-      <el-col :md="20">
-        <span>小会员</span>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { getUserInfo } from '@/utils/auth'
-
-export default {
-  name: 'Profile',
-  data() {
-    return {
-      userId: -1,
-      navList: [
-        { path: '/u/profile', name: '我的信息', icon: 'el-icon-user' },
-        { path: '/u/avatar', name: '我的头像', icon: 'el-icon-user' },
-        { path: '/u/vip', name: '我的会员', icon: 'el-icon-user' }
-      ]
-    }
-  },
-  created() {
-    const userInfo = getUserInfo()
-    if (userInfo != null) {
-      document.title = userInfo.screenName + '的头像'
-    }
-  },
-  methods: {
-  }
-}
-</script>