feature/0423
wanghousheng 8 months ago
parent 8c5f4cd9ed
commit 034ce355b9
  1. 130
      src/views/client/wxapp/Setting.vue

@ -13,9 +13,7 @@
</div> </div>
</a-form-item> </a-form-item>
<a-form-item class="mt-30" label="小程序 AppID" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item class="mt-30" label="小程序 AppID" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input <a-input v-decorator="['app_id', { rules: [{ required: true, message: '请输入小程序AppID' }] }]" />
v-decorator="['app_id', { rules: [{ required: true, message: '请输入小程序AppID' }] }]"
/>
<p class="form-item-help"> <p class="form-item-help">
<small>登录微信小程序平台开发 - 开发管理 - 开发设置记录AppID (小程序ID)</small> <small>登录微信小程序平台开发 - 开发管理 - 开发设置记录AppID (小程序ID)</small>
</p> </p>
@ -29,10 +27,65 @@
<small>登录微信小程序平台开发 - 开发管理 - 开发设置记录AppSecret (小程序密钥)</small> <small>登录微信小程序平台开发 - 开发管理 - 开发设置记录AppSecret (小程序密钥)</small>
</p> </p>
</a-form-item> </a-form-item>
<a-form-item class="mt-30" label="同城送" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['same_city', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问同城送</small>
</div>
</a-form-item>
<a-form-item class="mt-30" label="新人首礼" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['new_first_gift', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问新人首礼</small>
</div>
</a-form-item>
<a-form-item class="mt-30" label="大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['big_brand', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问大牌正品</small>
</div>
</a-form-item>
<a-form-item class="mt-30" label="新品首发" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['new_product', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问新品首发</small>
</div>
</a-form-item>
<a-form-item class="mt-30" label="排行榜" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['ranking_list', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问排行榜</small>
</div>
</a-form-item>
<a-form-item class="mt-30" label="服务" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['service', { rules: [{ required: true }] }]">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
<div class="form-item-help">
<small>如关闭用户则无法通过微信小程序端访问服务</small>
</div>
</a-form-item>
<a-divider orientation="left">授权域名设置</a-divider> <a-divider orientation="left">授权域名设置</a-divider>
<a-form-item <a-form-item
v-for="(item , index) in domainList" v-for="(item, index) in domainList"
:key="index" :key="index"
class="mt-30" class="mt-30"
:label="`${item.name}合法域名`" :label="`${item.name}合法域名`"
@ -41,11 +94,9 @@
required required
> >
<span class="f-14">{{ `${item.protocol}://${domain}` }}</span> <span class="f-14">{{ `${item.protocol}://${domain}` }}</span>
<a <a class="ml-15 f-12" href="javascript:void(0);" @click="handleCopyLink(`${item.protocol}://${domain}`)"
class="ml-15 f-12" >点击复制</a
href="javascript:void(0);" >
@click="handleCopyLink(`${item.protocol}://${domain}`)"
>点击复制</a>
<p class="form-item-help"> <p class="form-item-help">
<small>登录小程序平台开发 - 开发管理 - 开发设置 - 服务器域名修改{{ item.protocol }}协议业务域名</small> <small>登录小程序平台开发 - 开发管理 - 开发设置 - 服务器域名修改{{ item.protocol }}协议业务域名</small>
</p> </p>
@ -68,24 +119,24 @@ import * as Api from '@/api/client/wxapp/setting'
const domainList = [ const domainList = [
{ {
name: 'request', name: 'request',
protocol: 'https' protocol: 'https',
}, },
{ {
name: 'socket', name: 'socket',
protocol: 'wss' protocol: 'wss',
}, },
{ {
name: 'uploadFile', name: 'uploadFile',
protocol: 'https' protocol: 'https',
}, },
{ {
name: 'downloadFile', name: 'downloadFile',
protocol: 'https' protocol: 'https',
}, },
] ]
export default { export default {
data () { data() {
return { return {
// //
labelCol: { span: 4 }, labelCol: { span: 4 },
@ -106,46 +157,60 @@ export default {
} }
}, },
// //
created () { created() {
// //
this.getDetail() this.getDetail()
}, },
methods: { methods: {
// //
getDetail () { getDetail() {
this.isLoading = true this.isLoading = true
Api.detail(this.key) Api.detail(this.key)
.then(result => { .then((result) => {
// //
this.record = result.data.detail this.record = result.data.detail
this.domain = result.data.domain this.domain = result.data.domain
// //
this.setFieldsValue() this.setFieldsValue()
}) })
.finally(() => this.isLoading = false) .finally(() => (this.isLoading = false))
}, },
// //
setFieldsValue () { setFieldsValue() {
const { record, $nextTick, form } = this const { record, $nextTick, form } = this
!isEmpty(form.getFieldsValue()) && $nextTick(() => { !isEmpty(form.getFieldsValue()) &&
form.setFieldsValue(pick(record, ['enabled', 'app_id', 'app_secret'])) $nextTick(() => {
}) form.setFieldsValue(
pick(record, [
'enabled',
'app_id',
'app_secret',
'same_city',
'new_first_gift',
'big_brand',
'new_product',
'ranking_list',
'service',
])
)
})
}, },
// //
handleCopyLink (url) { handleCopyLink(url) {
this.$copyText(url).then(res => { this.$copyText(url).then((res) => {
this.$message.success('复制成功', 0.8) this.$message.success('复制成功', 0.8)
}) })
}, },
// //
handleSubmit (e) { handleSubmit(e) {
e.preventDefault() e.preventDefault()
// //
const { form: { validateFields } } = this const {
form: { validateFields },
} = this
validateFields((errors, values) => { validateFields((errors, values) => {
// api // api
!errors && this.onFormSubmit(values) !errors && this.onFormSubmit(values)
@ -153,14 +218,13 @@ export default {
}, },
// api // api
onFormSubmit (values) { onFormSubmit(values) {
this.isLoading = true this.isLoading = true
Api.update(this.key, { form: values }) Api.update(this.key, { form: values })
.then(result => this.$message.success(result.message, 1.5)) .then((result) => this.$message.success(result.message, 1.5))
.finally(() => this.isLoading = false) .finally(() => (this.isLoading = false))
} },
},
}
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

Loading…
Cancel
Save