|
@@ -187,6 +187,7 @@
|
|
|
<div style="flex: 1;">
|
|
|
<span v-if="item.msgtype === 'image'">【图片】: {{ item.image.pic_url }}</span>
|
|
|
<span v-if="item.msgtype === 'link'">【链接】: {{ item.link.title }}-{{item.link.desc}}</span>
|
|
|
+ <span v-if="item.msgtype === 'miniprogram'">【小程序】: {{ item.miniprogram.title }}</span>
|
|
|
</div>
|
|
|
<div style=" display: flex;gap: 10px;">
|
|
|
<el-button
|
|
@@ -210,13 +211,16 @@
|
|
|
</el-row>
|
|
|
|
|
|
<el-dropdown @command="(command) => handleCommand(command, -1)" trigger="click" placement="top-start">
|
|
|
- <el-dropdown-menu slot="dropdown" style="width: 100px;">
|
|
|
+ <el-dropdown-menu slot="dropdown" style="width: 120px;">
|
|
|
<el-dropdown-item command="image">
|
|
|
<i class="el-icon-picture" style="margin-right: 10px;"></i>图片
|
|
|
</el-dropdown-item>
|
|
|
<el-dropdown-item command="link">
|
|
|
<i class="el-icon-link" style="margin-right: 10px;"></i>链接
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="miniprogram">
|
|
|
+ <i class="el-icon-link" style="margin-right: 10px;"></i>小程序
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
<span class="el-dropdown-link">
|
|
@@ -260,7 +264,7 @@
|
|
|
<el-row>
|
|
|
<el-col style="width: 965px">
|
|
|
<div style="background-color: #fbfbfb;padding: 10px; border: 1px solid #e6e6e6; margin-bottom: 20px;">
|
|
|
- <el-form ref="friendWelcomeItemForm" :rules="itemRules" :model="item">
|
|
|
+ <el-form ref="friendWelcomeItemForm" :rules="itemRules" :model="item">
|
|
|
<div style="display: flex; gap: 10px;">
|
|
|
<el-form-item label="发起时间:" prop="week" style="flex: 8;">
|
|
|
<el-select v-model="item.week" remote multiple placeholder="请选择" filterable style="width: 580px">
|
|
@@ -307,6 +311,7 @@
|
|
|
<div style="flex: 1;">
|
|
|
<span v-if="attachment.msgtype === 'image'">【图片】: {{ attachment.image.pic_url }}</span>
|
|
|
<span v-if="attachment.msgtype === 'link'">【链接】: {{ attachment.link.title }}-{{attachment.link.desc}}</span>
|
|
|
+ <span v-if="attachment.msgtype === 'miniprogram'">【小程序】: {{ attachment.miniprogram.title }}</span>
|
|
|
</div>
|
|
|
<div style=" display: flex;gap: 10px;">
|
|
|
<el-button
|
|
@@ -330,13 +335,16 @@
|
|
|
</el-row>
|
|
|
|
|
|
<el-dropdown @command="(command) => handleCommand(command, index)" trigger="click" placement="top-start">
|
|
|
- <el-dropdown-menu slot="dropdown" style="width: 100px;">
|
|
|
+ <el-dropdown-menu slot="dropdown" style="width: 120px;">
|
|
|
<el-dropdown-item command="image">
|
|
|
<i class="el-icon-picture" style="margin-right: 10px;"></i>图片
|
|
|
</el-dropdown-item>
|
|
|
<el-dropdown-item command="link">
|
|
|
<i class="el-icon-link" style="margin-right: 10px;"></i>链接
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="miniprogram">
|
|
|
+ <i class="el-icon-link" style="margin-right: 10px;"></i>小程序
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
<span class="el-dropdown-link">
|
|
@@ -374,7 +382,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog :title="welcomeItem.title" :visible.sync="welcomeItem.open" style="width: 1300px;height: 100%" append-to-body>
|
|
|
- <el-form ref="fileFrom" :model="fileFrom" :rules="fuleRules" label-width="100px">
|
|
|
+ <el-form ref="fileFrom" :model="fileFrom" :rules="fuleRules" label-width="110px">
|
|
|
<div v-if="welcomeItem.type==='image'">
|
|
|
<el-form-item label="图片:" prop="imagePicUrl">
|
|
|
<ImageUpload v-model="fileFrom.imagePicUrl" type="image" :num="10" :width="150" :height="150" disabled/>
|
|
@@ -391,7 +399,7 @@
|
|
|
:value="parseInt(dict.dictValue)"
|
|
|
/>
|
|
|
</el-select>
|
|
|
- <el-select v-model="fileFrom.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" @change="videoIdChange(fileFrom, welcomeItem.index, welcomeItem.itemIndex)" >
|
|
|
+ <el-select v-model="fileFrom.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" @change="videoIdChange(fileFrom, welcomeItem.index, welcomeItem.itemIndex,welcomeItem.type)" >
|
|
|
<el-option
|
|
|
v-for="dict in videoList"
|
|
|
:key="dict.dictValue"
|
|
@@ -415,9 +423,19 @@
|
|
|
<el-input v-model="fileFrom.linkUrl" placeholder="请输入链接地址" style="width: 90%;"/>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
+ <el-form-item label="图文链接替换为注册链接" prop="isFixed">
|
|
|
+ <el-radio-group v-model="fileFrom.isFixed">
|
|
|
+ <el-radio
|
|
|
+ :label="1"
|
|
|
+ >是</el-radio>
|
|
|
+ <el-radio
|
|
|
+ :label="0"
|
|
|
+ >否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
<div v-if="fileFrom.videoId!=null">
|
|
|
<el-form-item label="图文链接:" label-width="100px" >
|
|
|
- <el-tag type="warning" v-model="fileFrom.linkUrl='待生成'">选择的课程小节 即为卡片链接地址</el-tag>
|
|
|
+ <el-tag type="warning" v-model="fileFrom.linkUrl='待生成'">选择的课程小节 即为卡片链接地址/注册链接</el-tag>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div v-if="fileFrom.videoId!=null">
|
|
@@ -435,6 +453,54 @@
|
|
|
<!-- <el-input v-model="fileFrom.linkUrl" :rows="2" placeholder="选择了课程小节会自动设置地址" />-->
|
|
|
<!-- </el-form-item>-->
|
|
|
</div>
|
|
|
+ <div v-if="welcomeItem.type==='miniprogram'">
|
|
|
+
|
|
|
+ <el-form-item label="选择课程">
|
|
|
+ <el-select v-model="fileFrom.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini" @change="courseChange(fileFrom,welcomeItem.index,welcomeItem.itemIndex)">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in courseList"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select v-model="fileFrom.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" @change="videoIdChange(fileFrom, welcomeItem.index, welcomeItem.itemIndex,welcomeItem.type)" >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in videoList"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="小程序标题:" prop="miniprogramTitle">
|
|
|
+ <el-input v-model="fileFrom.miniprogramTitle" :rows="2" maxlength="64" placeholder="请输入小程序消息标题,最长为64字节" @input="checkByteLength(fileFrom)" />
|
|
|
+ </el-form-item>
|
|
|
+ <div v-if="fileFrom.videoId!=null">
|
|
|
+ <el-form-item label="小程序链接:" label-width="100px" >
|
|
|
+ <el-tag type="warning" v-model="fileFrom.miniprogramPage='待生成'">选择的课程小节 即为卡片小程序链接地址</el-tag>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <el-form-item label="appid" prop="miniprogramAppid" v-show="false" >
|
|
|
+ <el-input v-model="fileFrom.miniprogramAppid='wx73f85f8d62769119' " disabled />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <div v-if="fileFrom.videoId!=null">
|
|
|
+ <el-form-item label="课节过期时间" style="margin-top: 1%" required label-width="110px">
|
|
|
+ <el-row>
|
|
|
+ <el-input-number v-model="fileFrom.expiresDays" :min="1" :max="9999" ></el-input-number>
|
|
|
+ (天)
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <span class="tip">默认为30天</span>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <!-- <el-form-item label="图文链接:" prop="linkUrl">-->
|
|
|
+ <!-- <el-input v-model="fileFrom.linkUrl" :rows="2" placeholder="选择了课程小节会自动设置地址" />-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer" style="text-align: center">
|
|
|
<el-button type="primary" @click="confirmUpload">确定</el-button>
|
|
@@ -485,6 +551,11 @@ export default {
|
|
|
videoId:null,
|
|
|
courseId:null,
|
|
|
expiresDays:30,
|
|
|
+ isFixed:0,
|
|
|
+ miniprogramTitle:null,
|
|
|
+ miniprogramPage:null,
|
|
|
+ miniprogramPicUrl:null,
|
|
|
+ miniprogramAppid:null,
|
|
|
},
|
|
|
courseList:[],
|
|
|
videoList:[],
|
|
@@ -492,6 +563,7 @@ export default {
|
|
|
imagePicUrl:[ { required: true, message: "图片不能为空", trigger: "submit" }],
|
|
|
linkTitle:[ { required: true, message: "图文标题不能为空", trigger: "submit" }],
|
|
|
linkUrl:[ { required: true, message: "图文链接不能为空", trigger: "submit" }],
|
|
|
+ miniprogramTitle:[ { required: true, message: "图文链接不能为空", trigger: "submit" }],
|
|
|
},
|
|
|
|
|
|
|
|
@@ -631,7 +703,42 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ // // 检查字节长度
|
|
|
+ checkByteLength(fileFrom) {
|
|
|
+ const text = fileFrom.miniprogramTitle;
|
|
|
+ const byteLength = this.getByteLength(text); // 获取当前字节数
|
|
|
+
|
|
|
+ // 如果字节数超过64,截断输入内容
|
|
|
+ if (byteLength > 64) {
|
|
|
+ this.$set(fileFrom, 'miniprogramTitle', this.truncateTextByByteLength(text,64));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 计算字符串的字节数
|
|
|
+ getByteLength(text) {
|
|
|
+ return new Blob([text]).size; // 使用 Blob 计算字节数
|
|
|
+ },
|
|
|
|
|
|
+ // 根据字节数截断字符串
|
|
|
+ truncateTextByByteLength(text, maxByteLength) {
|
|
|
+ let byteLength = 0;
|
|
|
+ let result = "";
|
|
|
+
|
|
|
+ for (let i = 0; i < text.length; i++) {
|
|
|
+ const char = text[i];
|
|
|
+ const charByteLength = this.getByteLength(char); // 获取当前字符的字节数
|
|
|
+
|
|
|
+ // 如果加上当前字符的字节数后不超过限制,则添加到结果中
|
|
|
+ if (byteLength + charByteLength <= maxByteLength) {
|
|
|
+ result += char;
|
|
|
+ byteLength += charByteLength;
|
|
|
+ } else {
|
|
|
+ break; // 超过限制时停止
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ },
|
|
|
|
|
|
//选择群发的企业成员账号
|
|
|
handlelistUser(){
|
|
@@ -681,13 +788,25 @@ export default {
|
|
|
|
|
|
this.welcomeItem = {
|
|
|
open: true,
|
|
|
- title: command === 'image' ? '添加图片' : '添加链接',
|
|
|
+ title: this.getTitleByCommand(command),
|
|
|
type: command,
|
|
|
index: itemIndex === -1 ? this.form.attachments.length : this.form.daypartingItemlist[itemIndex].attachments.length,
|
|
|
itemIndex
|
|
|
};
|
|
|
},
|
|
|
|
|
|
+ getTitleByCommand(command) {
|
|
|
+ switch (command) {
|
|
|
+ case 'image':
|
|
|
+ return '添加图片';
|
|
|
+ case 'link':
|
|
|
+ return '添加链接';
|
|
|
+ case 'miniprogram':
|
|
|
+ return '添加小程序';
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
courseChange(fileFrom,index,itemIndex){
|
|
|
|
|
|
// 清空 videoId 选择
|
|
@@ -705,12 +824,12 @@ export default {
|
|
|
this.$set(fileFrom, 'linkPicUrl', selectedCourse.dictImgUrl);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 获取新的 videoList
|
|
|
videoList(fileFrom.courseId).then(response => {
|
|
|
this.videoList = response.list;
|
|
|
});
|
|
|
|
|
|
- console.log("this.videoList",this.videoList )
|
|
|
}
|
|
|
//
|
|
|
// // 更新对应的数据层级
|
|
@@ -734,15 +853,20 @@ export default {
|
|
|
// });
|
|
|
// }
|
|
|
},
|
|
|
- videoIdChange(fileFrom,index, itemIndex){
|
|
|
+ videoIdChange(fileFrom,index, itemIndex,type){
|
|
|
//选择了课程小节则 默认绑上
|
|
|
if (fileFrom.videoId != null) {
|
|
|
// 根据 videoId 获取相关信息(假设有相关的 API 调用)
|
|
|
let selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === fileFrom.videoId);
|
|
|
- if (selectedVideo) {
|
|
|
+ if (selectedVideo && type==='link') {
|
|
|
this.$set(fileFrom, 'linkDesc', selectedVideo.dictLabel);
|
|
|
this.$set(fileFrom, 'expiresDays', 30);
|
|
|
}
|
|
|
+ if (selectedVideo && type==='miniprogram') {
|
|
|
+ this.$set(fileFrom, 'miniprogramTitle', this.truncateTextByByteLength(selectedVideo.dictLabel,64));
|
|
|
+ this.$set(fileFrom, 'expiresDays', 30);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// // 更新对应的数据层级
|
|
@@ -769,7 +893,7 @@ export default {
|
|
|
|
|
|
this.welcomeItem = {
|
|
|
open: true,
|
|
|
- title: item.msgtype === 'image' ? '编辑图片' : '编辑链接',
|
|
|
+ title: this.getEditTitleByMsgType(item.msgtype),
|
|
|
type: item.msgtype,
|
|
|
index,
|
|
|
itemIndex
|
|
@@ -784,14 +908,44 @@ export default {
|
|
|
this.fileFrom.videoId = item.link.videoId;
|
|
|
this.fileFrom.courseId = item.link.courseId;
|
|
|
this.fileFrom.expiresDays = item.link.expiresDays;
|
|
|
+ this.fileFrom.isFixed = item.link.isFixed;
|
|
|
+
|
|
|
+ videoList(item.link.courseId).then(response => {
|
|
|
+ this.videoList = response.list;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }else if (item.msgtype === 'miniprogram') {
|
|
|
+ this.fileFrom.miniprogramAppid = 'wx73f85f8d62769119';
|
|
|
+ this.fileFrom.miniprogramTitle = item.miniprogram.title;
|
|
|
+ this.fileFrom.miniprogramPicUrl = "待生成";
|
|
|
+ this.fileFrom.miniprogramPage = "待生成";
|
|
|
+ this.fileFrom.videoId = item.miniprogram.videoId;
|
|
|
+ this.fileFrom.courseId = item.miniprogram.courseId;
|
|
|
+ this.fileFrom.expiresDays = item.miniprogram.expiresDays;
|
|
|
+
|
|
|
+ videoList(item.miniprogram.courseId).then(response => {
|
|
|
+ this.videoList = response.list;
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- videoList(item.link.courseId).then(response => {
|
|
|
- this.videoList = response.list;
|
|
|
- });
|
|
|
|
|
|
},
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ getEditTitleByMsgType(msgType) {
|
|
|
+ switch (msgType) {
|
|
|
+ case 'image':
|
|
|
+ return '编辑图片';
|
|
|
+ case 'link':
|
|
|
+ return '编辑链接';
|
|
|
+ case 'miniprogram':
|
|
|
+ return '编辑小程序';
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
//删除附件
|
|
|
removeFileItem(data,index, itemIndex) {
|
|
|
|
|
@@ -814,9 +968,11 @@ export default {
|
|
|
},
|
|
|
|
|
|
//提交附件
|
|
|
- confirmUpload(fileFrom) {
|
|
|
+ confirmUpload() {
|
|
|
|
|
|
const { type, index, itemIndex } = this.welcomeItem;
|
|
|
+
|
|
|
+ console.log("this.fileFrom",this.fileFrom)
|
|
|
let attachment = {};
|
|
|
if (type === 'image') {
|
|
|
attachment = {
|
|
@@ -836,6 +992,20 @@ export default {
|
|
|
courseId:this.fileFrom.courseId,
|
|
|
videoId:this.fileFrom.videoId,
|
|
|
expiresDays:this.fileFrom.expiresDays,
|
|
|
+ isFixed:this.fileFrom.isFixed,
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }else if (type==='miniprogram'){
|
|
|
+ attachment = {
|
|
|
+ msgtype: 'miniprogram',
|
|
|
+ miniprogram: {
|
|
|
+ title: this.fileFrom.miniprogramTitle,
|
|
|
+ pic_media_id: "待查询",
|
|
|
+ appid: "wx73f85f8d62769119",
|
|
|
+ page: this.fileFrom.miniprogramPage,
|
|
|
+ courseId:this.fileFrom.courseId,
|
|
|
+ videoId:this.fileFrom.videoId,
|
|
|
+ expiresDays:this.fileFrom.expiresDays,
|
|
|
}
|
|
|
};
|
|
|
}
|
|
@@ -849,7 +1019,7 @@ export default {
|
|
|
// 不存在附件则插入
|
|
|
this.form.attachments.push(attachment);
|
|
|
}
|
|
|
- console.log("hujahsa:",this.form.attachments)
|
|
|
+
|
|
|
} else {
|
|
|
// 分时段欢迎语附件处理
|
|
|
if (index < this.form.daypartingItemlist[itemIndex].attachments.length) {
|
|
@@ -884,8 +1054,13 @@ export default {
|
|
|
linkPicUrl: null,
|
|
|
linkDesc: null,
|
|
|
linkUrl: null,
|
|
|
+ isFixed: 0,
|
|
|
videoId:null,
|
|
|
courseId:null,
|
|
|
+ miniprogramTitle:null,
|
|
|
+ miniprogramPage:null,
|
|
|
+ miniprogramPicUrl:null,
|
|
|
+ miniprogramAppid:null,
|
|
|
};
|
|
|
|
|
|
this.welcomeItem={
|