|
@@ -26,17 +26,30 @@
|
|
|
<div :class='["hw-item",index === activeVoteIndex ? "item-active":""]'
|
|
|
v-for="(item,index) in voteList" :key="index" @click="onVoteClick(item,index)">
|
|
|
<p class="hw-item-name">
|
|
|
- <span class="owner-tag" v-if="item.owner === 'school'">{{ $t('learnActivity.school') }}</span>
|
|
|
- <span class="owner-tag" v-if="item.owner === 'area'" style="background-color: #dc6f28;">{{ $t('learnActivity.area') }}</span>
|
|
|
{{ item.name }}
|
|
|
+ <Icon type="md-create" class="ac-edit-icon" color="#12cce8" size="16" @click="doEditAc('name')" title="修改活动名称" v-if="item.id"/>
|
|
|
</p>
|
|
|
<div class="hw-item-info">
|
|
|
<span class="hw-item-nums">
|
|
|
- <Icon type="md-time" size="14" style="margin-right:5px" />
|
|
|
- {{ $tools.formatTime(item.startTime || item.createTime,'yyyy-MM-dd hh:mm') }}
|
|
|
+ <span class="time-item">
|
|
|
+ <Icon type="md-time" size="14" style="margin-right:5px" />
|
|
|
+ <span>{{ $t('learnActivity.createEv.startTime') }}:</span>
|
|
|
+ {{ $tools.formatTime(item.startTime || item.createTime,'yyyy-MM-dd hh:mm') }}
|
|
|
+ </span>
|
|
|
+ <span class="time-item">
|
|
|
+ <Icon type="md-time" size="14" style="margin-right:5px" />
|
|
|
+ <span>{{ $t('learnActivity.createEv.endTime') }}:</span>
|
|
|
+ {{ $tools.formatTime(item.endTime,'yyyy-MM-dd hh:mm') }}
|
|
|
+ <Icon type="md-create" class="ac-edit-icon" size="14" v-if="item.progress == 'going'" @click="doEditAc('time')" title="修改活动结束时间" />
|
|
|
+ </span>
|
|
|
</span>
|
|
|
- <span class="hw-item-status"
|
|
|
- :style="{ background: (item.progress === 'pending' ? '#0BADD4' : item.progress === 'going' ? '#1fb06d' : '#949594')}">{{ item.progress === 'pending' ? $t('vote.pending') : item.progress === 'going' ? $t('vote.going') : $t('vote.finish') }}</span>
|
|
|
+ <div class="hw-item-status">
|
|
|
+ <span style="color: #2eafea;border-color: #2eafea;" v-if="item.owner === 'school'">{{ $t('learnActivity.school') }}</span>
|
|
|
+ <span style="color: #ca7617;border-color: #ca7617;" v-if="item.owner === 'area'">{{ $t('learnActivity.area') }}</span>
|
|
|
+ <span :style="{ color:getStatusColor(item.progress),borderColor:getStatusColor(item.progress) }">{{ item.progress === 'pending' ? $t('vote.pending') : item.progress === 'going' ? $t('vote.going') : $t('vote.finish') }}</span>
|
|
|
+ <span :style="{ color:'#ff8229' ,borderColor:'#ff8229' }" v-if="item.secret">匿名投票</span>
|
|
|
+ <span style="background: #ed4014;color: #fff;" v-if="item.progress === 'going'" @click="handleEnd(index)">{{$t('learnActivity.mgtScEv.stop')}}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -118,6 +131,32 @@
|
|
|
</div>
|
|
|
</Split>
|
|
|
</div>
|
|
|
+ <!-- 修改活动结束时间 -->
|
|
|
+ <Modal v-model="editTimeStatus" footer-hide className="ed-name-modal">
|
|
|
+ <div slot="header" class="modal-header">
|
|
|
+ {{$t('learnActivity.mgtScEv.editEndTime')}}
|
|
|
+ </div>
|
|
|
+ <div class="edit-name-content">
|
|
|
+ <p class="edit-name-label">
|
|
|
+ {{$t('cusMgt.listName')}}
|
|
|
+ </p>
|
|
|
+ <DatePicker v-model="editTime" :options="dateOpt1" type="datetime" @on-change="handleTime" format="yyyy-MM-dd HH:mm" :placeholder="$t('homework.modifyAcTimeTip')" style="width: 100%"></DatePicker>
|
|
|
+ <Button :loading="btnLoading" @click="confirmEditEndtime" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ <!-- 修改活动名称 -->
|
|
|
+ <Modal v-model="editNameStatus" footer-hide className="ed-name-modal" @on-ok="confirmEditName">
|
|
|
+ <div slot="header" class="modal-header">
|
|
|
+ {{ $t('homework.modifyAcName') }}
|
|
|
+ </div>
|
|
|
+ <div class="edit-name-content">
|
|
|
+ <p class="edit-name-label">
|
|
|
+ {{$t('cusMgt.listName')}}
|
|
|
+ </p>
|
|
|
+ <Input v-model="currentVote.name" :placeholder="$t('homework.modifyAcNameTip')" />
|
|
|
+ <Button :loading="btnLoading" @click="confirmEditName" long type="primary" class="confirm-btn">{{ $t('syllabus.confirm') }}</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -136,9 +175,13 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ editTime:null,
|
|
|
+ editTimeStatus:false,
|
|
|
+ editNameStatus:false,
|
|
|
split1: 0.2,
|
|
|
split2: 0.35,
|
|
|
tabIndex: 0,
|
|
|
+ btnLoading:false,
|
|
|
hasNewAdd: false,
|
|
|
isLoading: false,
|
|
|
isLoadList: false,
|
|
@@ -164,7 +207,103 @@
|
|
|
},
|
|
|
created() {},
|
|
|
methods: {
|
|
|
-
|
|
|
+ /* 编辑活动结束时间或者名字 */
|
|
|
+ doEditAc(type,item){
|
|
|
+ if(type === 'time'){
|
|
|
+ this.editTimeStatus = true
|
|
|
+ this.editTime = new Date(this.currentVote.endTime)
|
|
|
+ }else{
|
|
|
+ this.editNameStatus = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 格式化结束时间 */
|
|
|
+ handleTime(value) {
|
|
|
+ if (value.indexOf('00:00') > 0) {
|
|
|
+ value = value.replace('00:00', '23:59:59')
|
|
|
+ this.editTime = value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 确认修改结束时间 */
|
|
|
+ confirmEditEndtime(){
|
|
|
+ if (this.editTime) {
|
|
|
+ this.btnLoading = true
|
|
|
+ this.$api.learnActivity.updateAcInfo({
|
|
|
+ id: this.currentVote.id,
|
|
|
+ code: this.currentVote.code,
|
|
|
+ time: this.editTime.getTime()
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.voteList[this.activeVoteIndex].endTime = this.editTime.getTime()
|
|
|
+ this.onVoteClick(this.currentVote,this.activeVoteIndex)
|
|
|
+ this.$Message.success(this.$t('learnActivity.mgtScEv.updOk'))
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
|
|
|
+ }
|
|
|
+ ).finally(() => {
|
|
|
+ this.editTimeStatus = false
|
|
|
+ this.btnLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('homework.noEndTimeTip'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 确认修改活动名称 */
|
|
|
+ confirmEditName() {
|
|
|
+ if (this.currentVote.name.trim()) {
|
|
|
+ this.btnLoading = true
|
|
|
+ this.$api.learnActivity.updateAcInfo({
|
|
|
+ id: this.currentVote.id,
|
|
|
+ code: this.currentVote.code,
|
|
|
+ name: this.currentVote.name
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.voteList[this.activeVoteIndex].name = this.currentVote.name
|
|
|
+ this.onVoteClick(this.currentVote,this.activeVoteIndex)
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.updOk'))
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.updErr'))
|
|
|
+ }
|
|
|
+ ).finally(() => {
|
|
|
+ this.editNameStatus = false
|
|
|
+ this.btnLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('homework.modifyAcNameTip'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 立即结束活动 */
|
|
|
+ handleEnd(index) {
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: this.$t('learnActivity.mgtScEv.stopTitle'),
|
|
|
+ content: `${ this.$t('homework.endTip') } 【 ${this.currentVote.name} 】 ?`,
|
|
|
+ onOk: () => {
|
|
|
+ this.$api.learnActivity.FinishEva({
|
|
|
+ id: this.currentVote.id,
|
|
|
+ code: this.currentVote.code
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ if (!res.error) {
|
|
|
+ this.$Message.success(this.$t('homework.endSuc'))
|
|
|
+ this.voteList[index].progress = 'finish'
|
|
|
+ this.onVoteClick(this.currentVote,this.activeVoteIndex)
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('learnActivity.mgtScEv.actionErr'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 校本课纲与个人课纲切换
|
|
|
handleTabClick(index) {
|
|
|
this.tabIndex = index
|
|
@@ -269,7 +408,7 @@
|
|
|
i.id === queryId)[0] : list[0]
|
|
|
let queryIndex = queryId ? list.indexOf(queryVote) : 0
|
|
|
this.isFromRecord = Boolean(queryId)
|
|
|
- this.onVoteClick(queryVote, queryIndex)
|
|
|
+ this.onVoteClick(queryVote, queryIndex,false)
|
|
|
} else {
|
|
|
this.voteList = []
|
|
|
}
|
|
@@ -312,37 +451,73 @@
|
|
|
* @param item
|
|
|
* @param index
|
|
|
*/
|
|
|
- async onVoteClick(item, index) {
|
|
|
- console.log(item)
|
|
|
- let fullItem = item.id ? await this.getVoteDetails(item) : item
|
|
|
- console.log(fullItem)
|
|
|
- this.currentVote = fullItem
|
|
|
- this.activeVoteIndex = index
|
|
|
- /* 如果是区级的活动 则需要根据recordUrl去换取区级活动的作答数据 */
|
|
|
- if (this.isAreaVote && item.id) {
|
|
|
- this.areaVoteTeachers = []
|
|
|
- this.areaSchIndex = 0
|
|
|
- this.areaSchList = this.areaRecord.map(i => i.name)
|
|
|
- this.areaRecord.length && this.getAreaRecord(0)
|
|
|
- }else{
|
|
|
- /* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
|
|
|
- if (item.id && item.progress !== 'pending'){
|
|
|
- if(fullItem.targetType === 'research'){
|
|
|
- this.getVoteTeachers(fullItem, fullItem.tchLists)
|
|
|
- }else{
|
|
|
- this.getVoteStudents(fullItem, fullItem.classes)
|
|
|
+ async onVoteClick(item, index, needJudge = true) {
|
|
|
+ // 如果从未保存的活动跳到已有活动 则需要提示
|
|
|
+ if(!this.currentVote.id && item.id && needJudge){
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: this.$t('survey.questionaire.confirmTitle'),
|
|
|
+ content: this.$t('homework.noSaveTip'),
|
|
|
+ onOk: async () => {
|
|
|
+ this.voteList.splice(0,1)
|
|
|
+ index = index - 1
|
|
|
+ let fullItem = item.id ? await this.getVoteDetails(item) : item
|
|
|
+ console.log(fullItem)
|
|
|
+ this.currentVote = fullItem
|
|
|
+ this.activeVoteIndex = index
|
|
|
+ this.isAddActivity = false
|
|
|
+ /* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
|
|
|
+ if (item.id && item.progress !== 'pending') {
|
|
|
+ this.getVoteStudents(fullItem, fullItem.classes)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.$refs.voteForm && this.$refs.voteFormScroll) {
|
|
|
+ this.$refs.voteForm.voteFormEdit = false
|
|
|
+ this.$refs.voteFormScroll.scrollTo({
|
|
|
+ y: 0,
|
|
|
+ },
|
|
|
+ 200,
|
|
|
+ "easeInQuad"
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ this.hasNewAdd = false
|
|
|
+ this.isOptionView = true
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ console.log(this.currentVote)
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ let fullItem = item.id ? await this.getVoteDetails(item) : item
|
|
|
+ console.log(fullItem)
|
|
|
+ this.currentVote = fullItem
|
|
|
+ this.activeVoteIndex = index
|
|
|
+ /* 如果是区级的活动 则需要根据recordUrl去换取区级活动的作答数据 */
|
|
|
+ if (this.isAreaVote && item.id) {
|
|
|
+ this.areaVoteTeachers = []
|
|
|
+ this.areaSchIndex = 0
|
|
|
+ this.areaSchList = this.areaRecord.map(i => i.name)
|
|
|
+ this.areaRecord.length && this.getAreaRecord(0)
|
|
|
+ }else{
|
|
|
+ /* 其余类型活动则需要去根据发布对象获取对应的作答数据 */
|
|
|
+ if (item.id && item.progress !== 'pending'){
|
|
|
+ if(fullItem.targetType === 'research'){
|
|
|
+ this.getVoteTeachers(fullItem, fullItem.tchLists)
|
|
|
+ }else{
|
|
|
+ this.getVoteStudents(fullItem, fullItem.classes)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.voteForm && (this.$refs.voteForm.voteFormEdit = false)
|
|
|
+ this.$refs.voteFormScroll.scrollTo({
|
|
|
+ y: 0,
|
|
|
+ },
|
|
|
+ 200,
|
|
|
+ "easeInQuad"
|
|
|
+ );
|
|
|
+ this.hasNewAdd = false
|
|
|
+ this.isOptionView = true
|
|
|
}
|
|
|
- this.$refs.voteForm && (this.$refs.voteForm.voteFormEdit = false)
|
|
|
- this.$refs.voteFormScroll.scrollTo({
|
|
|
- y: 0,
|
|
|
- },
|
|
|
- 200,
|
|
|
- "easeInQuad"
|
|
|
- );
|
|
|
- this.hasNewAdd = false
|
|
|
- this.isOptionView = true
|
|
|
},
|
|
|
|
|
|
/* 获取区级活动的作答数据 */
|
|
@@ -540,9 +715,10 @@
|
|
|
scope: this.getCurScope
|
|
|
}).then(res => {
|
|
|
if (!res.error && res.flag) {
|
|
|
- console.log(this.voteList.indexOf(this.currentVote))
|
|
|
- this.voteList.splice(this.voteList.reverse().indexOf(this
|
|
|
- .currentVote), 1)
|
|
|
+ let newIndex = this.activeVoteIndex === this.voteList.length - 1 ? (this.activeVoteIndex - 1) : this.activeVoteIndex
|
|
|
+ this.voteList.splice(this.activeVoteIndex, 1)
|
|
|
+ this.activeVoteIndex = newIndex
|
|
|
+ if (this.voteList.length) this.onVoteClick(this.voteList[newIndex], newIndex, false)
|
|
|
setTimeout(() => {
|
|
|
this.isLoading = false
|
|
|
this.$Message.success(this.$t('vote.deleteSuc'))
|
|
@@ -564,8 +740,9 @@
|
|
|
} else {
|
|
|
this.voteList.splice(this.voteList.indexOf(this.currentVote), 1)
|
|
|
this.isLoading = false
|
|
|
+ this.isAddActivity = false
|
|
|
this.$Message.success(this.$t('vote.deleteSuc'))
|
|
|
- if (this.voteList.length) this.onVoteClick(this.voteList[0], 0)
|
|
|
+ if (this.voteList.length) this.onVoteClick(this.voteList[0], 0,false)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -801,7 +978,21 @@
|
|
|
return owner => {
|
|
|
return this.$route.name !== 'manageAreaVote' && owner === 'area'
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ getStatusColor(){
|
|
|
+ return status => {
|
|
|
+ return status === 'pending' ? '#2d8cf0' : status === 'going' ? '#19be6b' : '#515a6e'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dateOpt1() {
|
|
|
+ let that = this
|
|
|
+ return {
|
|
|
+ disabledDate(date) {
|
|
|
+ let d = that.currentVote.startTime ? that.currentVote.startTime : Date.now()
|
|
|
+ return d && d > date.valueOf() + 86400000
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
},
|
|
|
watch: {
|