Commit cf403500 authored by Davve's avatar Davve

修改视频获取

parent 369f9aee
...@@ -44,11 +44,11 @@ class UserUpdateOrCreate(APIView): ...@@ -44,11 +44,11 @@ class UserUpdateOrCreate(APIView):
data = { data = {
'user_id': user_id, 'user_id': user_id,
'password': password, 'password': password,
'is_recommend': request.POST.get('is_recommend'), 'is_recommend': int(request.POST.get('is_recommend')),
'profile_pic': request.POST.get('avatar')[:-2], 'profile_pic': request.POST.get('avatar')[:-2],
'nick_name': request.POST.get('nick_name'), 'nick_name': request.POST.get('nick_name'),
'tag_ids': tag_ids, 'tag_ids': tag_ids,
'is_puppet': request.POST.get('is_puppet'), 'is_puppet': int(request.POST.get('is_puppet')),
'city_id': request.POST.get('city', '').split(":")[0], 'city_id': request.POST.get('city', '').split(":")[0],
'phone': request.POST.get('phone'), 'phone': request.POST.get('phone'),
'email': request.POST.get('email'), 'email': request.POST.get('email'),
......
...@@ -65,7 +65,6 @@ const user = { ...@@ -65,7 +65,6 @@ const user = {
setSession(data.session_key) setSession(data.session_key)
resolve() resolve()
}else{ }else{
console.log(data, '-----------')
Message.error(data['message']) Message.error(data['message'])
resolve('/login') resolve('/login')
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item style="margin-bottom: 40px;" prop="username" v-if="isEdit"> <el-form-item style="margin-bottom: 40px;" prop="username" v-if="isShow">
<MDinput v-model="postForm.username" :maxlength="100" name="username" required disabled="disabled"> <MDinput v-model="postForm.username" :maxlength="100" name="username" required disabled="disabled">
账号 账号
</MDinput> </MDinput>
...@@ -27,13 +27,7 @@ ...@@ -27,13 +27,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item style="margin-bottom: 40px;" prop="password" v-if="isEdit"> <el-form-item style="margin-bottom: 40px;" prop="password" v-show="is_show">
<MDinput v-model="postForm.password" :maxlength="100" name="password" required disabled="disabled">
密码
</MDinput>
</el-form-item>
<el-form-item style="margin-bottom: 40px;" prop="password" v-else>
<MDinput v-model="postForm.password" :maxlength="100" name="password" required> <MDinput v-model="postForm.password" :maxlength="100" name="password" required>
密码 密码
</MDinput> </MDinput>
...@@ -108,6 +102,7 @@ ...@@ -108,6 +102,7 @@
}, },
data() { data() {
const validateRequire = (rule, value, callback) => { const validateRequire = (rule, value, callback) => {
value = value.trim()
if (value === '') { if (value === '') {
this.$message({ this.$message({
message: rule.field + '为必传项', message: rule.field + '为必传项',
...@@ -120,6 +115,7 @@ ...@@ -120,6 +115,7 @@
} }
const validatePasswordLength = (rule, value, callback) => { const validatePasswordLength = (rule, value, callback) => {
value = value.trim()
if (value === '') { if (value === '') {
this.$message({ this.$message({
message: rule.field + '为必传项', message: rule.field + '为必传项',
...@@ -141,12 +137,13 @@ ...@@ -141,12 +137,13 @@
loading: false, loading: false,
userListOptions: [], userListOptions: [],
rules: { rules: {
username: [{validator: validateRequire}], username: [{validator: validateRequire, trigger: 'blur'}],
nick_name: [{validator: validateRequire}], nick_name: [{validator: validateRequire, trigger: 'blur'}],
email: [{validator: validateRequire}], email: [{validator: validateRequire, trigger: 'blur'}],
password: [{validator: validatePasswordLength, trigger: 'blur'}], password: [{validator: validatePasswordLength, trigger: 'blur'}],
phone: [{validator: validateRequire}], phone: [{validator: validateRequire, trigger: 'blur'}],
}, },
is_show: true
} }
}, },
created() { created() {
...@@ -163,7 +160,7 @@ ...@@ -163,7 +160,7 @@
fetchData(id) { fetchData(id) {
fetchAccountDetail(id).then(response => { fetchAccountDetail(id).then(response => {
this.postForm = response.data.data.data this.postForm = response.data.data.data
this.is_show = false
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
placeholder="请输入内容"/> placeholder="请输入内容"/>
<span v-show="contentShortLength" class="word-counter">{{ contentShortLength }}</span> <span v-show="contentShortLength" class="word-counter">{{ contentShortLength }}</span>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 40px;" label-width="45px" label="线:"> <el-form-item style="margin-bottom: 40px;" label-width="45px" label="是否在线:">
<el-radio-group v-model="postForm.is_online"> <el-radio-group v-model="postForm.is_online">
<el-radio :label="1"></el-radio> <el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio> <el-radio :label="0"></el-radio>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-form ref="postForm" :model="postForm" :rules="rules" class="form-container"> <el-form ref="postForm" :model="postForm" :rules="rules" class="form-container">
<sticky :class-name="'sub-navbar '+postForm.status"> <sticky :class-name="'sub-navbar '+postForm.status">
<el-button v-loading="loading" style="margin-left: 10px;" type="success" @click="submitForm">保存 <el-button v-loading="loading" style="margin-left: 10px;" type="success" @click="submitForm" :disabled="isdisabledFn">保存
</el-button> </el-button>
</sticky> </sticky>
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <!--<el-col :span="12">-->
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="密码:" v-if="isEdit"> <!--<el-form-item style="margin-bottom: 20px;" label-width="75px" label="密码:" v-if="isEdit">-->
<el-input v-model="postForm.password" type="text" style="width: 230px;" disabled/> <!--<el-input v-model="postForm.password" type="text" style="width: 230px;" disabled/>-->
</el-form-item> <!--</el-form-item>-->
</el-col> <!--</el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="帖子:" v-if="isEdit"> <el-form-item style="margin-bottom: 20px;" label-width="75px" label="帖子:" v-if="isEdit">
<el-input v-model="postForm.topic_nums" type="text" style="width: 230px;" <el-input v-model="postForm.topic_nums" type="text" style="width: 230px;"
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="用户名:" prop="username"> <el-form-item style="margin-bottom: 20px;" label-width="75px" label="用户名:" prop="nick_name">
<el-input v-model="postForm.nick_name" type="text" style="width: 230px"/> <el-input v-model="postForm.nick_name" type="text" style="width: 230px"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label-width="75px" label="性别:"> <el-form-item label-width="75px" label="性别:" prop="gender">
<el-select v-model="postForm.gender" :placeholder="'性别:'" clearable <el-select v-model="postForm.gender" :placeholder="'性别:'" clearable
class="postInfo-container-item" class="postInfo-container-item"
style="width: 230px"> style="width: 230px">
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<el-form-item label-width="75px" label="标签:"> <el-form-item label-width="75px" label="标签:">
<el-select v-model="tags" :remote-method="getRemoteTagList" filterable remote clearable <el-select v-model="tags" :remote-method="getRemoteTagList" filterable remote clearable
multiple value-key="id" multiple value-key="id"
placeholder="搜索地区" style="width: 720px"> placeholder="搜索标签" style="width: 720px">
<el-option v-for="(item,index) in tagListOptions" :key="item+index" :label="item" <el-option v-for="(item,index) in tagListOptions" :key="item+index" :label="item"
:value="item"/> :value="item"/>
</el-select> </el-select>
...@@ -196,9 +196,8 @@ ...@@ -196,9 +196,8 @@
tags: [], tags: [],
rules: { rules: {
image_uri: [{validator: validateRequire, trigger: 'blur'}], nick_name: [{validator: validateRequire, trigger: 'blur'}],
title: [{validator: validateRequire}], avatar: [{validator: validateRequire, trigger: 'blur'}],
content: [{validator: validateRequire}],
}, },
tempRoute: {}, tempRoute: {},
GenderTypeOptions: [ GenderTypeOptions: [
...@@ -208,6 +207,7 @@ ...@@ -208,6 +207,7 @@
regionListOptions: [], regionListOptions: [],
tagListOptions: [], tagListOptions: [],
uploadType: 99, uploadType: 99,
isdisabledFn: false
} }
}, },
computed: { computed: {
...@@ -243,7 +243,17 @@ ...@@ -243,7 +243,17 @@
this.$refs.postForm.validate(valid => { this.$refs.postForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true this.loading = true
if (this.city === ''){
this.$message.error('城市必填~')
this.loading = false
return false
}
if (this.postForm.gender === ''){
this.$message.error('性别必填~')
this.loading = false
return false
}
this.isdisabledFn = true
this.postForm.city = this.city; this.postForm.city = this.city;
this.postForm.tags = JSON.stringify(this.tags) this.postForm.tags = JSON.stringify(this.tags)
userCreate(this.postForm).then(response => { userCreate(this.postForm).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment