|
@@ -274,7 +274,7 @@
|
|
|
type="text"
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
icon="el-icon-edit"
|
|
|
class="row-action-btn"
|
|
class="row-action-btn"
|
|
|
- title="修改状态"
|
|
|
|
|
|
|
+ title="修改配置"
|
|
|
@click="handleUpdate(scope.row)"
|
|
@click="handleUpdate(scope.row)"
|
|
|
/>
|
|
/>
|
|
|
<el-button
|
|
<el-button
|
|
@@ -311,9 +311,9 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
- <!-- 修改小程序状态 -->
|
|
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
|
|
+ <!-- 修改小程序(状态 + 自定义授权) -->
|
|
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="560px" append-to-body>
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="110px" size="small">
|
|
|
<el-form-item label="状态" prop="status">
|
|
<el-form-item label="状态" prop="status">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="form.status"
|
|
v-model="form.status"
|
|
@@ -330,6 +330,42 @@
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-divider content-position="left">自定义授权配置</el-divider>
|
|
|
|
|
+ <el-form-item label="自定义授权" prop="customAuthEnabled">
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="form.customAuthEnabled"
|
|
|
|
|
+ :active-value="1"
|
|
|
|
|
+ :inactive-value="0"
|
|
|
|
|
+ active-text="启用"
|
|
|
|
|
+ inactive-text="关闭"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="form-item-tip">启用后可独立配置该小程序的授权方式,不使用全局配置</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="form.customAuthEnabled === 1"
|
|
|
|
|
+ label="授权方式"
|
|
|
|
|
+ prop="miniAppAuthType"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-radio-group v-model="form.miniAppAuthType">
|
|
|
|
|
+ <el-radio :label="1">小程序授权</el-radio>
|
|
|
|
|
+ <el-radio :label="2">服务号授权</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ <div class="form-item-tip">小程序授权:使用微信小程序原生授权组件获取用户信息</div>
|
|
|
|
|
+ <div class="form-item-tip">服务号授权:跳转 H5 页面通过服务号授权获取用户信息</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="form.customAuthEnabled === 1 && form.miniAppAuthType === 2"
|
|
|
|
|
+ label="授权域名"
|
|
|
|
|
+ prop="userCourseAuthDomain"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.userCourseAuthDomain"
|
|
|
|
|
+ placeholder="例如:https://scrm.xxx.cn/weixinOauth?appid=wx..."
|
|
|
|
|
+ clearable
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="form-item-tip">看课时跳转 H5 服务号授权的域名地址</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -358,6 +394,42 @@
|
|
|
<el-form-item label="图标" prop="img">
|
|
<el-form-item label="图标" prop="img">
|
|
|
<image-upload v-model="addForm.img" :file-type='["png", "jpg", "jpeg"]' :limit="1" />
|
|
<image-upload v-model="addForm.img" :file-type='["png", "jpg", "jpeg"]' :limit="1" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-divider content-position="left">自定义授权配置</el-divider>
|
|
|
|
|
+ <el-form-item label="自定义授权" prop="customAuthEnabled">
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="addForm.customAuthEnabled"
|
|
|
|
|
+ :active-value="1"
|
|
|
|
|
+ :inactive-value="0"
|
|
|
|
|
+ active-text="启用"
|
|
|
|
|
+ inactive-text="关闭"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="form-item-tip">启用后可独立配置该小程序的授权方式,不使用全局配置</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="addForm.customAuthEnabled === 1"
|
|
|
|
|
+ label="授权方式"
|
|
|
|
|
+ prop="miniAppAuthType"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-radio-group v-model="addForm.miniAppAuthType">
|
|
|
|
|
+ <el-radio :label="1">小程序授权</el-radio>
|
|
|
|
|
+ <el-radio :label="2">服务号授权</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ <div class="form-item-tip">小程序授权:使用微信小程序原生授权组件获取用户信息</div>
|
|
|
|
|
+ <div class="form-item-tip">服务号授权:跳转 H5 页面通过服务号授权获取用户信息</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="addForm.customAuthEnabled === 1 && addForm.miniAppAuthType === 2"
|
|
|
|
|
+ label="授权域名"
|
|
|
|
|
+ prop="userCourseAuthDomain"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="addForm.userCourseAuthDomain"
|
|
|
|
|
+ placeholder="例如:https://scrm.xxx.cn/weixinOauth?appid=wx..."
|
|
|
|
|
+ clearable
|
|
|
|
|
+ />
|
|
|
|
|
+ <div class="form-item-tip">看课时跳转 H5 服务号授权的域名地址</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" :loading="addSaving" @click="submitAdd">确 定</el-button>
|
|
<el-button type="primary" :loading="addSaving" @click="submitAdd">确 定</el-button>
|
|
@@ -378,6 +450,7 @@
|
|
|
<el-upload
|
|
<el-upload
|
|
|
ref="verifyUpload"
|
|
ref="verifyUpload"
|
|
|
action=""
|
|
action=""
|
|
|
|
|
+ accept=".txt"
|
|
|
:auto-upload="false"
|
|
:auto-upload="false"
|
|
|
:limit="1"
|
|
:limit="1"
|
|
|
:file-list="verifyFileList"
|
|
:file-list="verifyFileList"
|
|
@@ -546,6 +619,12 @@ export default {
|
|
|
rules: {
|
|
rules: {
|
|
|
status: [
|
|
status: [
|
|
|
{ required: true, message: '状态不能为空', trigger: 'change' }
|
|
{ required: true, message: '状态不能为空', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ miniAppAuthType: [
|
|
|
|
|
+ { required: true, message: '请选择授权方式', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ userCourseAuthDomain: [
|
|
|
|
|
+ { required: true, message: '请填写授权域名', trigger: 'blur' }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
addOpen: false,
|
|
addOpen: false,
|
|
@@ -560,7 +639,13 @@ export default {
|
|
|
originalId: [{ required: true, message: '原始ID不能为空', trigger: 'blur' }],
|
|
originalId: [{ required: true, message: '原始ID不能为空', trigger: 'blur' }],
|
|
|
appid: [{ required: true, message: 'AppID不能为空', trigger: 'blur' }],
|
|
appid: [{ required: true, message: 'AppID不能为空', trigger: 'blur' }],
|
|
|
secret: [{ required: true, message: 'Secret不能为空', trigger: 'blur' }],
|
|
secret: [{ required: true, message: 'Secret不能为空', trigger: 'blur' }],
|
|
|
- img: [{ required: true, message: '图标不能为空', trigger: 'change' }]
|
|
|
|
|
|
|
+ img: [{ required: true, message: '图标不能为空', trigger: 'change' }],
|
|
|
|
|
+ miniAppAuthType: [
|
|
|
|
|
+ { required: true, message: '请选择授权方式', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ userCourseAuthDomain: [
|
|
|
|
|
+ { required: true, message: '请填写授权域名', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
verifyOpen: false,
|
|
verifyOpen: false,
|
|
|
verifySaving: false,
|
|
verifySaving: false,
|
|
@@ -622,6 +707,40 @@ export default {
|
|
|
},
|
|
},
|
|
|
filteredList() {
|
|
filteredList() {
|
|
|
this.listPageNum = 1
|
|
this.listPageNum = 1
|
|
|
|
|
+ },
|
|
|
|
|
+ 'addForm.customAuthEnabled'(val) {
|
|
|
|
|
+ if (val !== 1) {
|
|
|
|
|
+ this.addForm.miniAppAuthType = null
|
|
|
|
|
+ this.addForm.userCourseAuthDomain = null
|
|
|
|
|
+ if (this.$refs.addForm) {
|
|
|
|
|
+ this.$refs.addForm.clearValidate(['miniAppAuthType', 'userCourseAuthDomain'])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'addForm.miniAppAuthType'(val) {
|
|
|
|
|
+ if (val !== 2) {
|
|
|
|
|
+ this.addForm.userCourseAuthDomain = null
|
|
|
|
|
+ if (this.$refs.addForm) {
|
|
|
|
|
+ this.$refs.addForm.clearValidate(['userCourseAuthDomain'])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'form.customAuthEnabled'(val) {
|
|
|
|
|
+ if (val !== 1) {
|
|
|
|
|
+ this.form.miniAppAuthType = null
|
|
|
|
|
+ this.form.userCourseAuthDomain = null
|
|
|
|
|
+ if (this.$refs.form) {
|
|
|
|
|
+ this.$refs.form.clearValidate(['miniAppAuthType', 'userCourseAuthDomain'])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'form.miniAppAuthType'(val) {
|
|
|
|
|
+ if (val !== 2) {
|
|
|
|
|
+ this.form.userCourseAuthDomain = null
|
|
|
|
|
+ if (this.$refs.form) {
|
|
|
|
|
+ this.$refs.form.clearValidate(['userCourseAuthDomain'])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -656,7 +775,10 @@ export default {
|
|
|
appid: null,
|
|
appid: null,
|
|
|
secret: null,
|
|
secret: null,
|
|
|
img: null,
|
|
img: null,
|
|
|
- status: 0
|
|
|
|
|
|
|
+ status: 0,
|
|
|
|
|
+ customAuthEnabled: 0,
|
|
|
|
|
+ miniAppAuthType: null,
|
|
|
|
|
+ userCourseAuthDomain: null
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleAdd() {
|
|
handleAdd() {
|
|
@@ -692,7 +814,12 @@ export default {
|
|
|
aesKey: this.addDefaultAesKey,
|
|
aesKey: this.addDefaultAesKey,
|
|
|
msgDataFormat: this.addDefaultMsgDataFormat,
|
|
msgDataFormat: this.addDefaultMsgDataFormat,
|
|
|
img: this.addForm.img,
|
|
img: this.addForm.img,
|
|
|
- status: 0
|
|
|
|
|
|
|
+ status: 0,
|
|
|
|
|
+ customAuthEnabled: this.addForm.customAuthEnabled || 0,
|
|
|
|
|
+ miniAppAuthType: this.addForm.customAuthEnabled === 1 ? this.addForm.miniAppAuthType : null,
|
|
|
|
|
+ userCourseAuthDomain: this.addForm.customAuthEnabled === 1 && this.addForm.miniAppAuthType === 2
|
|
|
|
|
+ ? this.addForm.userCourseAuthDomain
|
|
|
|
|
+ : null
|
|
|
}
|
|
}
|
|
|
add(payload).then(response => {
|
|
add(payload).then(response => {
|
|
|
if (response.code !== 200) {
|
|
if (response.code !== 200) {
|
|
@@ -990,12 +1117,15 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
|
get(row.id).then(response => {
|
|
get(row.id).then(response => {
|
|
|
|
|
+ const data = response.data || {}
|
|
|
this.form = {
|
|
this.form = {
|
|
|
- ...response.data,
|
|
|
|
|
- type: response.data.type != null ? response.data.type.toString() : response.data.type
|
|
|
|
|
|
|
+ ...data,
|
|
|
|
|
+ type: data.type != null ? data.type.toString() : data.type,
|
|
|
|
|
+ customAuthEnabled: data.customAuthEnabled == null ? 0 : data.customAuthEnabled,
|
|
|
|
|
+ miniAppAuthType: data.miniAppAuthType == null ? null : Number(data.miniAppAuthType)
|
|
|
}
|
|
}
|
|
|
this.open = true
|
|
this.open = true
|
|
|
- this.title = '修改小程序状态'
|
|
|
|
|
|
|
+ this.title = '修改小程序配置'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
submitForm() {
|
|
submitForm() {
|
|
@@ -1006,6 +1136,13 @@ export default {
|
|
|
this.msgError('获取销售公司失败')
|
|
this.msgError('获取销售公司失败')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ // 关闭自定义授权时清空关联字段,避免脏数据残留
|
|
|
|
|
+ if (this.form.customAuthEnabled !== 1) {
|
|
|
|
|
+ this.form.miniAppAuthType = null
|
|
|
|
|
+ this.form.userCourseAuthDomain = null
|
|
|
|
|
+ } else if (this.form.miniAppAuthType !== 2) {
|
|
|
|
|
+ this.form.userCourseAuthDomain = null
|
|
|
|
|
+ }
|
|
|
this.form.companyIds = [companyIdNum]
|
|
this.form.companyIds = [companyIdNum]
|
|
|
this.form.companyId = companyIdNum
|
|
this.form.companyId = companyIdNum
|
|
|
update(this.form).then(response => {
|
|
update(this.form).then(response => {
|
|
@@ -1372,4 +1509,11 @@ export default {
|
|
|
color: #c0c4cc;
|
|
color: #c0c4cc;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.form-item-tip {
|
|
|
|
|
+ margin-top: 4px;
|
|
|
|
|
+ line-height: 1.4;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #909399;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|