|
|
@ -14,24 +14,22 @@ |
|
|
|
fontSize: '32rpx', |
|
|
|
fontWeight: 'bold', |
|
|
|
}" |
|
|
|
errorType="toast" |
|
|
|
> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="用户ID" prop="id"> |
|
|
|
<uv-form-item label="用户ID" prop="userId"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<template v-if="form.id"> |
|
|
|
<text>{{ form.id }}</text> |
|
|
|
<view style="margin-left: 20rpx;"> |
|
|
|
<button class="btn-simple" plain @click="$utils.copyText(form.id)"> |
|
|
|
<uv-icon name="file-text" color="#05D9A2" size="28rpx"></uv-icon> |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<text>{{ userId }}</text> |
|
|
|
<view style="margin-left: 20rpx;"> |
|
|
|
<button class="btn-simple" plain @click="$utils.copyText(userId)"> |
|
|
|
<uv-icon name="file-text" color="#05D9A2" size="28rpx"></uv-icon> |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<!-- todo: 选择头像 --> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="选择头像" prop="imageUrl"> |
|
|
|
<uv-form-item label="选择头像" prop="headImage"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<button |
|
|
|
class="btn-avatar" |
|
|
@ -41,38 +39,25 @@ |
|
|
|
@chooseavatar="onChooseAvatar" |
|
|
|
> |
|
|
|
<image |
|
|
|
:src="form.avatarUrl || '../static/auth/avatar.png'" |
|
|
|
:src="form.headImage || '../static/auth/avatar.png'" |
|
|
|
style="width: 68rpx; height: 68rpx;" |
|
|
|
mode="" |
|
|
|
></image> |
|
|
|
</button> |
|
|
|
<!-- <formUpload v-model="form.avatarUrl"> |
|
|
|
<template v-slot="{ value }"> |
|
|
|
<view class="flex" style="min-width: 116rpx; height: 45rpx;"> |
|
|
|
<image |
|
|
|
:src="value" |
|
|
|
mode="aspectFill" |
|
|
|
style="width: 68rpx; height: 68rpx;" |
|
|
|
radius="14rpx" |
|
|
|
/> |
|
|
|
<uv-icon style="margin-left: 20rpx" name="arrow-right" color="#000000" size="28rpx"></uv-icon> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</formUpload> --> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="昵称" labelWidth="105rpx" prop="nickName"> |
|
|
|
<uv-form-item label="昵称" labelWidth="105rpx" prop="headTitle"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formInput v-model="form.nickName" placeholder="请输入你的群名称" width="540rpx"></formInput> |
|
|
|
<formInput v-model="form.headTitle" placeholder="请输入你的昵称" width="540rpx"></formInput> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="选择封面图" prop="imageUrl"> |
|
|
|
<uv-form-item label="选择封面图" prop="indexImage"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formUpload v-model="form.imageUrl"> |
|
|
|
<formUpload v-model="form.indexImage"> |
|
|
|
<template v-slot="{ value }"> |
|
|
|
<view class="flex" style="min-width: 116rpx; height: 45rpx;"> |
|
|
|
<image |
|
|
@ -89,16 +74,16 @@ |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="设置转发次数(次)" prop="times"> |
|
|
|
<uv-form-item label="设置转发次数(次)" prop="num"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formNumberBox v-model="form.times" ></formNumberBox> |
|
|
|
<formNumberBox v-model="form.num" ></formNumberBox> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="选择二维码" prop="qrCode"> |
|
|
|
<uv-form-item label="选择二维码" prop="wxCodeImage"> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formUpload v-model="form.qrCode"> |
|
|
|
<formUpload v-model="form.wxCodeImage"> |
|
|
|
<template v-slot="{ value }"> |
|
|
|
<view class="flex" style="min-width: 93rpx; height: 45rpx;"> |
|
|
|
<image |
|
|
@ -115,10 +100,10 @@ |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item label="文案描述" prop="description" labelPosition="top"> |
|
|
|
<uv-form-item label="文案描述" prop="textDetails" labelPosition="top"> |
|
|
|
<view style="margin-top: 32rpx;"> |
|
|
|
<formTextarea |
|
|
|
v-model="form.description" |
|
|
|
v-model="form.textDetails" |
|
|
|
placeholder="请输入你的文案" |
|
|
|
></formTextarea> |
|
|
|
</view> |
|
|
@ -128,17 +113,19 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 审核通过 --> |
|
|
|
<button v-if="auditStatus === 1" class="button-submit" @click="onPublish"> |
|
|
|
<button v-if="status === 1" class="button-submit" open-type="share"> |
|
|
|
发布 |
|
|
|
</button> |
|
|
|
<!-- 不是 审核中 或 已发布 -> 即 创建分享 或 审核不通过 --> |
|
|
|
<button v-else-if="![0,2].includes(auditStatus)" class="button-submit" @click="onSubmit"> |
|
|
|
<button v-else-if="![0,1].includes(status)" class="button-submit" @click="onSubmit"> |
|
|
|
提交审核 |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { mapState } from 'vuex' |
|
|
|
|
|
|
|
import formInput from '../components/formInput.vue' |
|
|
|
import formNumberBox from '../components/formNumberBox.vue' |
|
|
|
import formUpload from '../components/formUpload.vue' |
|
|
@ -154,43 +141,163 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: null, |
|
|
|
auditStatus: null, |
|
|
|
status: null, |
|
|
|
form: { |
|
|
|
id: null, |
|
|
|
avatarUrl: null, |
|
|
|
nickName: null, |
|
|
|
imageUrl: null, |
|
|
|
times: 10, |
|
|
|
qrCode: null, |
|
|
|
description: null, |
|
|
|
userId: null, |
|
|
|
headImage: null, |
|
|
|
headTitle: null, |
|
|
|
indexImage: null, |
|
|
|
num: 10, |
|
|
|
wxCodeImage: null, |
|
|
|
textDetails: null, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
// todo |
|
|
|
}, |
|
|
|
'headImage': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择头像', |
|
|
|
}, |
|
|
|
'headTitle': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请输入你的昵称', |
|
|
|
}, |
|
|
|
'indexImage': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择封面图', |
|
|
|
}, |
|
|
|
'num': { |
|
|
|
type: 'number', |
|
|
|
required: true, |
|
|
|
message: '请设置转发次数', |
|
|
|
}, |
|
|
|
'wxCodeImage': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择二维码', |
|
|
|
}, |
|
|
|
'textDetails': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请输入你的文案', |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapState(['userInfo']), |
|
|
|
userId() { |
|
|
|
return this.form.userId || this.userInfo?.id |
|
|
|
}, |
|
|
|
disabled() { |
|
|
|
// todo |
|
|
|
return ![0, 1].includes(this.status) |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
const { id } = option |
|
|
|
|
|
|
|
if (!id) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.id = id |
|
|
|
// todo: init data by id |
|
|
|
|
|
|
|
this.fetchDetails(id) |
|
|
|
}, |
|
|
|
onShareAppMessage(res) { |
|
|
|
const { |
|
|
|
headTitle, |
|
|
|
indexImage, |
|
|
|
} = this.form |
|
|
|
|
|
|
|
let o = { |
|
|
|
title : headTitle, |
|
|
|
imageUrl: indexImage, |
|
|
|
path: `/pages_order/sharing/personal?id=${this.id}` |
|
|
|
} |
|
|
|
|
|
|
|
// todo: get times and check is unlocked |
|
|
|
|
|
|
|
this.isLocked = false |
|
|
|
|
|
|
|
return o |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onChooseAvatar(res) { |
|
|
|
this.$Oss.ossUpload(res.target.avatarUrl) |
|
|
|
.then(url => { |
|
|
|
this.form.avatarUrl = url |
|
|
|
this.form.headImage = url |
|
|
|
}) |
|
|
|
}, |
|
|
|
onSubmit() { |
|
|
|
// todo |
|
|
|
async fetchDetails(id) { |
|
|
|
try { |
|
|
|
const result = await this.$fetch('getShareInfo', { id }) |
|
|
|
|
|
|
|
const { |
|
|
|
userId, |
|
|
|
headImage, |
|
|
|
headTitle, |
|
|
|
indexImage, |
|
|
|
num, |
|
|
|
wxCodeImage, |
|
|
|
textDetails, |
|
|
|
status, |
|
|
|
} = result || {} |
|
|
|
|
|
|
|
const params = { ...this.form } |
|
|
|
|
|
|
|
this.$api('submitPersonalSharing', params) |
|
|
|
this.form = { |
|
|
|
userId, |
|
|
|
headImage, |
|
|
|
headTitle, |
|
|
|
indexImage, |
|
|
|
num, |
|
|
|
wxCodeImage, |
|
|
|
textDetails, |
|
|
|
} |
|
|
|
this.status = status |
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
onPublish() { |
|
|
|
// todo |
|
|
|
async onSubmit() { |
|
|
|
try { |
|
|
|
|
|
|
|
await this.$refs.form.validate() |
|
|
|
|
|
|
|
const { |
|
|
|
headImage, |
|
|
|
headTitle, |
|
|
|
indexImage, |
|
|
|
num, |
|
|
|
wxCodeImage, |
|
|
|
textDetails, |
|
|
|
} = this.form |
|
|
|
|
|
|
|
const params = { |
|
|
|
id: this.id, |
|
|
|
userId: this.userId, |
|
|
|
headImage, |
|
|
|
headTitle, |
|
|
|
indexImage, |
|
|
|
num, |
|
|
|
wxCodeImage, |
|
|
|
textDetails, |
|
|
|
} |
|
|
|
|
|
|
|
await this.$fetch('saveOrUpdateShare', params) |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
title: '提交成功', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
|
|
|
|
setTimeout(uni.navigateBack, 1000, -1) |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|