hookehuyr

fix

Showing 60 changed files with 1 additions and 4887 deletions
...@@ -8,7 +8,7 @@ VITE_PROXY_TARGET = http://voice.onwall.cn ...@@ -8,7 +8,7 @@ VITE_PROXY_TARGET = http://voice.onwall.cn
8 VITE_PROXY_PREFIX = /srv/ 8 VITE_PROXY_PREFIX = /srv/
9 9
10 # 打包输出文件夹名称 10 # 打包输出文件夹名称
11 -VITE_OUTDIR = voice 11 +VITE_OUTDIR = map
12 12
13 # 是否开启调试 13 # 是否开启调试
14 VITE_CONSOLE = 0 14 VITE_CONSOLE = 0
......
...@@ -9,63 +9,12 @@ export {} ...@@ -9,63 +9,12 @@ export {}
9 9
10 declare module '@vue/runtime-core' { 10 declare module '@vue/runtime-core' {
11 export interface GlobalComponents { 11 export interface GlobalComponents {
12 - '图形验证码': typeof import('./src/components/图形验证码.vue')['default']
13 - Agreement: typeof import('./src/components/DonateFlower/agreement.vue')['default']
14 - AuditVideoCard: typeof import('./src/components/AuditVideoCard/index.vue')['default']
15 - Banner: typeof import('./src/components/MuiVideo/banner.vue')['default']
16 - BookCard: typeof import('./src/components/BookCard/index.vue')['default']
17 - BVideoCard: typeof import('./src/components/BVideoCard/index.vue')['default']
18 - CommentBox: typeof import('./src/components/CommentBox/index.vue')['default']
19 - CommentList: typeof import('./src/components/CommentList/index.vue')['default']
20 - DonateBar: typeof import('./src/components/DonateBar/index.vue')['default']
21 - DonateBook: typeof import('./src/components/DonateBook/index.vue')['default']
22 - DonateCert: typeof import('./src/components/DonateCert/index.vue')['default']
23 - DonateFlower: typeof import('./src/components/DonateFlower/index.vue')['default']
24 - FlowerIcon: typeof import('./src/components/FlowerIcon/index.vue')['default']
25 - ImageSliderVerify: typeof import('./src/components/ImageSliderVerify/index.vue')['default']
26 - LocalismBox: typeof import('./src/components/LocalismBox/index.vue')['default']
27 - LoginBox: typeof import('./src/components/LoginBox/index.vue')['default']
28 - MuiVideo: typeof import('./src/components/MuiVideo/index.vue')['default']
29 - MyButton: typeof import('./src/components/MyButton/index.vue')['default']
30 - NoticeOverlay: typeof import('./src/components/NoticeOverlay/index.vue')['default']
31 - NoticeOverlayModule: typeof import('./src/components/NoticeOverlayModule/index.vue')['default']
32 - RankingItem: typeof import('./src/components/RankingItem/index.vue')['default']
33 - RightSideList: typeof import('./src/components/RightSideList/index.vue')['default']
34 RouterLink: typeof import('vue-router')['RouterLink'] 12 RouterLink: typeof import('vue-router')['RouterLink']
35 RouterView: typeof import('vue-router')['RouterView'] 13 RouterView: typeof import('vue-router')['RouterView']
36 - ShortcutFixed: typeof import('./src/components/ShortcutFixed/index.vue')['default']
37 - Status: typeof import('./src/components/MuiVideo/status.vue')['default']
38 - Template: typeof import('./src/components/template/index.vue')['default']
39 - Test: typeof import('./src/components/LoginBox/test.vue')['default']
40 - VanActionSheet: typeof import('vant/es')['ActionSheet']
41 - VanButton: typeof import('vant/es')['Button']
42 - VanCellGroup: typeof import('vant/es')['CellGroup']
43 - VanCheckbox: typeof import('vant/es')['Checkbox']
44 VanCol: typeof import('vant/es')['Col'] 14 VanCol: typeof import('vant/es')['Col']
45 - VanConfigProvider: typeof import('vant/es')['ConfigProvider']
46 VanDialog: typeof import('vant/es')['Dialog'] 15 VanDialog: typeof import('vant/es')['Dialog']
47 - VanEmpty: typeof import('vant/es')['Empty']
48 - VanField: typeof import('vant/es')['Field']
49 - VanForm: typeof import('vant/es')['Form']
50 VanIcon: typeof import('vant/es')['Icon'] 16 VanIcon: typeof import('vant/es')['Icon']
51 - VanImage: typeof import('vant/es')['Image']
52 - VanList: typeof import('vant/es')['List']
53 - VanLoading: typeof import('vant/es')['Loading']
54 - VanNumberKeyboard: typeof import('vant/es')['NumberKeyboard']
55 - VanOverlay: typeof import('vant/es')['Overlay']
56 - VanPicker: typeof import('vant/es')['Picker']
57 VanPopup: typeof import('vant/es')['Popup'] 17 VanPopup: typeof import('vant/es')['Popup']
58 VanRow: typeof import('vant/es')['Row'] 18 VanRow: typeof import('vant/es')['Row']
59 - VanStepper: typeof import('vant/es')['Stepper']
60 - VanSticky: typeof import('vant/es')['Sticky']
61 - VanSwipe: typeof import('vant/es')['Swipe']
62 - VanSwipeItem: typeof import('vant/es')['SwipeItem']
63 - VanTab: typeof import('vant/es')['Tab']
64 - VanTabs: typeof import('vant/es')['Tabs']
65 - VanTag: typeof import('vant/es')['Tag']
66 - VanUploader: typeof import('vant/es')['Uploader']
67 - VideoBar: typeof import('./src/components/MuiVideo/videoBar.vue')['default']
68 - VideoCard: typeof import('./src/components/VideoCard/index.vue')['default']
69 - VideoDetail: typeof import('./src/components/VideoDetail/index.vue')['default']
70 } 19 }
71 } 20 }
......
1 -<template>
2 - <div class="video-wrapper" style="position: relative;">
3 - <div v-if="mp && detail.showStatus" class="status">
4 - <van-image round width="6rem" height="6rem" style="vertical-align: bottom;" :src="status_icon" />
5 - </div>
6 - <div :id="'mui-player-' + item.id" class="video-div" />
7 - <div v-if="mp">
8 - <div v-if="item.status === 'ENABLE'" class="normal-module">
9 - <div class="video-bar">
10 - <van-row>
11 - <van-col span="12" @click="setComment">
12 - <van-image round width="2rem" height="2rem" style="vertical-align: middle;"
13 - :src="item.avatar ? item.avatar : icon_avatar" />&nbsp;&nbsp;
14 - <span style="font-size: 1.05rem;vertical-align: middle;">{{ item.name }}</span>
15 - </van-col>
16 - <van-col span="12">
17 - <div style="padding: 0.25rem; padding-top: 0.75rem; text-align: right;">
18 - <span @click="setComment">
19 - <van-icon :name="icon_liuyan" size="1.2rem" style="vertical-align: bottom;" />
20 - {{ item.comment_num }}
21 - </span>
22 - &nbsp;&nbsp;&nbsp;
23 - <span @click="handleAction('like', detail.id)">
24 - <van-icon v-if="!detail.is_like" :name="icon_dianzan1" size="1.2rem"
25 - style="vertical-align: bottom;" />
26 - <van-icon v-else :name="icon_dianzan2" size="1.2rem" style="vertical-align: bottom;" />
27 - {{ detail.like_num }}
28 - </span>
29 - </div>
30 - </van-col>
31 - </van-row>
32 - </div>
33 - <div style="color: #999999; padding: 0px 1rem 0.5rem;" @click="goTo">
34 - {{ item.book_name }} | {{ item.localism_type }}
35 - </div>
36 - </div>
37 - <div v-else class="audit-module" style="margin-top: 1rem;">
38 - <div style="color: #222222; padding: 0px 1rem 0.5rem;">{{ item.book_name }} | {{ item.localism_type }}</div>
39 - <div v-if="item.status === 'DISABLE'" class="van-hairline--top" style="padding: 1rem; font-size: 0.85rem;">
40 - <p style="color: #999999; margin-bottom: 0.25rem;">老师留言:</p>
41 - <p>{{ item.check_note }}</p>
42 - </div>
43 - </div>
44 - </div>
45 - </div>
46 -</template>
47 -
48 -<script setup>
49 -/**
50 - * 视频组件通用模块
51 - */
52 -import icon_dianzan1 from '@images/icon-dianzan01@2x.png'
53 -import icon_dianzan2 from '@images/icon-dianzan02@2x.png'
54 -import icon_liuyan from '@images/icon-liuyan@2x.png'
55 -import icon_avatar from '@images/que-touxiang@2x.png'
56 -
57 -import icon_refuse from '@images/icon-jujue@2x.png'
58 -import icon_apply from '@images/icon-shenhe@2x.png'
59 -import icon_enable from '@images/icon-tongguo@2x.png'
60 -
61 -import 'mui-player/dist/mui-player.min.css'
62 -import MuiPlayer from 'mui-player'
63 -import _ from 'lodash';
64 -import { DEFAULT_COVER } from '@/constant'
65 -
66 -</script>
67 -
68 -<script>
69 -import mixin from 'common/mixin';
70 -
71 -export default {
72 - mixins: [mixin.likeFn],
73 - props: ['item'],
74 - data() {
75 - return {
76 - detail: {},
77 - mp: ''
78 - }
79 - },
80 - computed: {
81 - // eslint-disable-next-line vue/return-in-computed-property
82 - status_icon () {
83 - switch (this.item.status) {
84 - case 'ENABLE':
85 - return icon_enable
86 - case 'DISABLE':
87 - return icon_refuse
88 - case 'APPLY':
89 - return icon_apply
90 - }
91 - }
92 - },
93 - created() {
94 - },
95 - mounted() {
96 - // TAG: 视频组件控制
97 - setTimeout(() => {
98 - var mp = new MuiPlayer({
99 - container: '#mui-player-' + this.item.id,
100 - title: this.item.title,
101 - src: this.item.video,
102 - poster: this.item.cover ? this.item.cover : DEFAULT_COVER,
103 - // poster: DEFAULT_COVER,
104 - autoFit: false,
105 - videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
106 - { attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
107 - { attrKey: 'playsinline', attrValue: 'playsinline' },
108 - { attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
109 - ]
110 - })
111 - this.mp = mp; // 渲染速度问题,只有视频控件渲染完成后显示
112 - this.detail = _.cloneDeep(this.item);
113 - this.detail.showStatus = true;
114 - var video = mp.video();
115 - // 监听原生video事件,审核状态标签显示控制
116 - var _this = this;
117 - video && video.addEventListener('play', function () {
118 - _this.detail.showStatus = false;
119 - });
120 - video && video.addEventListener('pause', function () {
121 - _this.detail.showStatus = true;
122 - });
123 - }, 500);
124 - // 配置16:9高度比
125 - const width = document.getElementById('mui-player-' + this.item.id).clientWidth;
126 - const height = (width * 9) / 16;
127 - document.getElementById('mui-player-' + this.item.id).height = height;
128 - },
129 - methods: {
130 - goTo () { // 跳转作品详情页
131 - this.$router.push({
132 - path: '/client/videoDetail',
133 - query: {
134 - prod_id: this.item.id,
135 - type: this.item.type, // 特殊标识,判断入口 为keepAlive使用
136 - perf_id: this.item.perf_id,
137 - book_id: this.item.book_id
138 - }
139 - });
140 - },
141 - setComment() {
142 - this.$router.push({
143 - path: '/client/videoDetail/comment',
144 - query: {
145 - prod_id: this.item.id,
146 - book_id: this.item.book_id
147 - }
148 - });
149 - }
150 - }
151 -}
152 -</script>
153 -
154 -<style lang="less" scoped>
155 -.video-wrapper {
156 - margin: 1rem;
157 - border-bottom-left-radius: 5px;
158 - border-bottom-right-radius: 5px;
159 - box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
160 - .status {
161 - position: absolute;
162 - top: 0;
163 - right: 0;
164 - z-index: 999;
165 - }
166 - .video-div {
167 - border-top-left-radius: 5px;
168 - border-top-right-radius: 5px;
169 - }
170 -
171 - .video-bar {
172 - color: #713610;
173 - padding: 1rem;
174 - padding-bottom: 0.5rem;
175 -
176 - }
177 -}
178 -</style>
1 -<template>
2 - <div class="video-wrapper" style="position: relative;">
3 - <div v-if="status === 'PROCESS' && detail.showStatus" class="status">
4 - <van-image v-if="item.status === 'ENABLE'" round width="6rem" height="6rem" style="vertical-align: bottom;"
5 - :src="icon_enable" />
6 - <van-image v-if="item.status === 'DISABLE'" round width="6rem" height="6rem" style="vertical-align: bottom;"
7 - :src="icon_refuse" />
8 - <van-image v-if="item.status === 'APPLY'" round width="6rem" height="6rem" style="vertical-align: bottom;"
9 - :src="icon_apply" />
10 - </div>
11 - <div :id="'mui-player-' + item.id" class="video-div" />
12 - <div class="control-bar">
13 - <div>
14 - <div class="video-bar">
15 - <!-- <van-row align="center">
16 - <van-col span="8">
17 - <van-image round width="2rem" height="2rem" style="vertical-align: middle;" :src="item.avatar" />&nbsp;
18 - <span style="font-size: 1.05rem; vertical-align: middle;">{{ item.name }}</span>
19 - </van-col>
20 - <van-col span="16">
21 - <div style="color: #999999; text-align: right;">
22 - {{ item.book_name }} |
23 - <span style="color: #11D2B1;" @click="setLocalism">{{ item.localism_type }}</span>
24 - </div>
25 - </van-col>
26 - </van-row> -->
27 - <div>
28 - <van-image round width="2rem" height="2rem" style="vertical-align: middle;" :src="item.avatar" />&nbsp;
29 - <span style="font-size: 1.05rem; vertical-align: middle;">{{ item.name }}</span>
30 - </div>
31 - <div style="color: #999999; margin-top: 1rem;">
32 - {{ item.book_name }} |
33 - <span style="color: #11D2B1;" @click="setLocalism">{{ item.localism_type }}</span>
34 - </div>
35 - </div>
36 - </div>
37 - <div class="book-intro" style="margin-top: 1rem;">
38 - <!-- <div :id="'book-intro' + item.id" :class="{ 'van-multi-ellipsis--l3': isToggle }">{{ item.note }}</div> -->
39 - <div v-if="hasToggle">
40 - <div v-if="isToggle" class="book-toggle-icon" @click="onToggle(false)">
41 - 展开&nbsp;
42 - <van-icon style="vertical-align: middle;" size="0.9rem" :name="icon_down" />
43 - </div>
44 - <div v-else class="book-toggle-icon" @click="onToggle(true)">
45 - 折叠&nbsp;
46 - <van-icon style="vertical-align: middle;" size="0.9rem" :name="icon_up" />
47 - </div>
48 - </div>
49 - </div>
50 - <div v-if="status === 'PROCESS'">
51 - <div v-if="item.status === 'DISABLE'" class="van-hairline--top" style="padding: 1rem; font-size: 0.85rem;">
52 - <p style="color: #999999; margin-bottom: 0.25rem;">老师留言:</p>
53 - <p>{{ item.check_note }}</p>
54 - </div>
55 - </div>
56 - <div v-if="status === 'PENDING'" class="van-hairline--top book-handle">
57 - <van-row>
58 - <van-col offset="3" style="padding: 1rem;" @click="onRefuse()">
59 - <div class="disagree-btn">
60 - <van-icon name="close" />&nbsp;不通过
61 - </div>
62 - </van-col>
63 - <van-col style="padding: 1rem;" @click="onPass('pass')">
64 - <div class="agree-btn" style="">
65 - <van-icon name="passed" />&nbsp;通过
66 - </div>
67 - </van-col>
68 - </van-row>
69 - </div>
70 - </div>
71 - </div>
72 -
73 - <van-overlay :show="showNotice" z-index="1000">
74 - <div class="wrapper" @click.stop>
75 - <div class="block">
76 - <div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
77 - <van-icon name="close" color="#FFFFFF" @click="closeNotice" />
78 - </div>
79 - <div class="van-hairline--bottom"
80 - style="color: #222222; font-size: 1.25rem; font-weight: bold; text-align: center; padding-bottom: 1rem;">
81 - 作品不通过
82 - </div>
83 - <div>
84 - <van-field v-model="message" rows="2" autosize label="" type="textarea" maxlength="200"
85 - placeholder="请填写您对小朋友的温馨鼓励" show-word-limit @focus="focusInput" @blur="blurInput" />
86 - </div>
87 - <div style="margin-top: 3rem;">
88 - <my-button type="primary" @on-click="handleAudit('disable')">确定</my-button>
89 - </div>
90 - </div>
91 - </div>
92 - </van-overlay>
93 -
94 - <van-dialog v-model:show="show" title="温馨提示" show-cancel-button :confirmButtonColor="styleColor.baseColor"
95 - @confirm="handleAudit('enable')" @cancel="onCancel">
96 - <div style="padding: 1rem; text-align: center;">是否确认审核通过该视频 ?</div>
97 - </van-dialog>
98 -
99 - <localism-box :id="item.id" :title="localism_title" :show-localism="showLocalism"
100 - :localism="item.localism_type" @on-close="closeLocalism" @on-submit="submitLocalism" />
101 -</template>
102 -
103 -<script setup>
104 -import { icon_up, icon_down, icon_refuse, icon_apply, icon_enable } from '@/utils/generateIcons'
105 -
106 -import MyButton from '@/components/MyButton/index.vue'
107 -import LocalismBox from '@/components/LocalismBox/index.vue'
108 -import { checkProdAPI } from '@/api/B/audit'
109 -
110 -import { ref, onMounted } from 'vue'
111 -import 'mui-player/dist/mui-player.min.css'
112 -import MuiPlayer from 'mui-player'
113 -import _ from 'lodash';
114 -import tools from '@/common/tool'
115 -import { styleColor } from '@/constant.js';
116 -
117 -import { Toast } from 'vant';
118 -import { DEFAULT_COVER } from '@/constant'
119 -
120 -const props = defineProps({
121 - item: Object,
122 - status: String,
123 -});
124 -const emit = defineEmits(['on-click']);
125 -
126 -// 判断是否显示简介的展开图标
127 -const hasToggle = ref(false); // 判断是否有展开文字,默认没有
128 -const isToggle = ref(true); // 判断展开状态,默认展开
129 -
130 -const onToggle = (v) => { // 展开/折叠
131 - isToggle.value = v
132 -}
133 -
134 -onMounted(() => {
135 - // setTimeout(() => {
136 - // // 判断是否显示简介的展开图标
137 - // hasToggle.value = tools.hasEllipsis(`book-intro${props.item.id}`);
138 - // }, 500);
139 -})
140 -
141 -const localism_title = ref('')
142 -// 审核视频通过/不通过弹框
143 -const showNotice = ref(false);
144 -const show = ref(false);
145 -const message = ref('');
146 -const trigger_type = ref(''); // 点击入口判断,pass为点击通过按钮进入,空值为直接点击语言栏
147 -const onPass = (type) => { // 通过审核
148 - showLocalism.value = true;
149 - localism_title.value = '请确认您的方言类别是否正确'
150 - trigger_type.value = type;
151 -}
152 -const onCancel = () => {
153 - show.value = false;
154 -}
155 -
156 -const closeNotice = () => {
157 - showNotice.value = false;
158 -}
159 -const onRefuse = () => { // 不通过审核
160 - showNotice.value = true;
161 -}
162 -const handleAudit = async (status) => {
163 - const { code } = await checkProdAPI({ prod_id: props.item.id, status, check_note: message.value, })
164 - if (code === 1) {
165 - Toast.success('操作成功');
166 - message.value = '';
167 - showNotice.value = false;
168 - show.value = false;
169 - emit('on-click', props.item.id);
170 - }
171 -}
172 -
173 -const focusInput = () => {
174 -}
175 -const blurInput = () => {
176 -}
177 -
178 -// 修改语言种类
179 -const showLocalism = ref(false);
180 -const setLocalism = () => {
181 - trigger_type.value = ''
182 - localism_title.value = '设置方言类别'
183 - showLocalism.value = true;
184 -}
185 -const closeLocalism = () => {
186 - showLocalism.value = false;
187 -}
188 -const submitLocalism = (localism) => {
189 - // 接口保存成功后,静态修改语言类型
190 - props.item.localism_type = localism;
191 - showLocalism.value = false;
192 - // 通过按钮点击进入,需要走通过审核流程。
193 - if (trigger_type.value) {
194 - show.value = true;
195 - }
196 -}
197 -</script>
198 -
199 -<script>
200 -export default {
201 - data() {
202 - return {
203 - detail: {},
204 - mp: '',
205 - }
206 - },
207 - created() {
208 - },
209 - mounted() {
210 - setTimeout(() => {
211 - var mp = new MuiPlayer({
212 - container: '#mui-player-' + this.item.id,
213 - title: this.item.title,
214 - src: this.item.video,
215 - poster: this.item.cover ? this.item.cover : DEFAULT_COVER,
216 - // poster: DEFAULT_COVER,
217 - autoFit: false,
218 - videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
219 - { attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
220 - { attrKey: 'playsinline', attrValue: 'playsinline' },
221 - { attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
222 - ]
223 - })
224 - this.mp = mp;
225 - this.detail = _.cloneDeep(this.item);
226 - this.detail.showStatus = true;
227 - var video = mp.video();
228 - // 监听原生video事件,审核状态标签显示控制
229 - var _this = this;
230 - video && video.addEventListener('play', function (event) {
231 - _this.detail.showStatus = false;
232 - });
233 - video && video.addEventListener('pause', function (event) {
234 - _this.detail.showStatus = true;
235 - });
236 - }, 500);
237 - },
238 - methods: {
239 - }
240 -}
241 -</script>
242 -
243 -<style lang="less" scoped>
244 -.video-wrapper {
245 - margin: 1rem;
246 - border-bottom-left-radius: 5px;
247 - border-bottom-right-radius: 5px;
248 - box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
249 -
250 - .status {
251 - position: absolute;
252 - top: 0;
253 - right: 0;
254 - z-index: 999;
255 - }
256 -
257 - .video-div {
258 - border-top-left-radius: 5px;
259 - border-top-right-radius: 5px;
260 - height: 13rem !important;
261 - }
262 -
263 - .video-bar {
264 - color: #713610;
265 - padding: 1rem;
266 - padding-bottom: 0.5rem;
267 - }
268 -
269 - .book-intro {
270 - padding: 1rem;
271 - padding-top: 0;
272 -
273 - .book-post {
274 - color: #222222;
275 - font-size: 1.25rem;
276 - font-weight: bold;
277 - }
278 -
279 - #book-intro {
280 - color: #333333;
281 - margin-top: 0.25rem;
282 - }
283 -
284 - .book-toggle-icon {
285 - text-align: right;
286 - color: #713610;
287 - font-size: 1rem;
288 - margin-top: 0.5rem;
289 - }
290 - }
291 - .book-handle {
292 - padding: 0 1rem;
293 - .disagree-btn {
294 - background: #B4B4B3;
295 - border-radius: 15px;
296 - color: #FFFFFF;
297 - padding: 0.25rem 0.8rem;
298 - }
299 - .agree-btn {
300 - background: @base-color;
301 - border-radius: 15px;
302 - color: @base-font-color;
303 - padding: 0.25rem 1.5rem;
304 - }
305 - }
306 -}
307 -
308 -.wrapper {
309 - display: flex;
310 - align-items: center;
311 - justify-content: center;
312 - height: 100%;
313 - width: auto;
314 - text-align: center;
315 -}
316 -
317 -.block {
318 - width: 80%;
319 - // height: 25rem;
320 - background-color: #fff;
321 - border-radius: 10px;
322 - padding: 1rem;
323 - position: relative;
324 - margin-top: 1rem;
325 - margin-bottom: 5rem;
326 -}
327 -</style>
1 -<template>
2 - <div class="book-item van-hairline--bottom" @click="handle">
3 - <van-row>
4 - <van-col span="8">
5 - <van-image width="7rem" height="7rem" :src="item.cover" fit="contain" style="text-align: center;">
6 - <template #loading>
7 - <van-loading type="spinner" size="20" />
8 - </template>
9 - </van-image>
10 - </van-col>
11 - <van-col class="wrapper" span="16">
12 - <p class="title van-multi-ellipsis--l2">{{ item.name }}</p>
13 - <div v-if="type === USER_ROLE.CLIENT" class="van-multi-ellipsis--l2 content">{{ item.note }}</div>
14 - <div class="sub">
15 - <van-icon :name="icon_video" />&nbsp;&nbsp;<span>{{ item.prod_num }}个作品</span>
16 - </div>
17 - <div v-if="type === USER_ROLE.BUSINESS" class="upload" @click="onUpload(item)">上传视频</div>
18 - </van-col>
19 - </van-row>
20 - </div>
21 -
22 - <van-overlay :show="show" z-index="9999">
23 - <div class="overlay-wrapper" @click.stop>
24 - <van-loading size="24px">跳转中...</van-loading>
25 - </div>
26 - </van-overlay>
27 -</template>
28 -
29 -<script setup>
30 -import icon_video from '@images/video.png'
31 -
32 -import { ref } from 'vue'
33 -import { onBeforeRouteLeave } from 'vue-router'
34 -
35 -import { JSJ_FORM_B, USER_ROLE } from '@/constant'
36 -
37 -const props = defineProps({
38 - item: Object,
39 - type: String,
40 - user_id: Number
41 -})
42 -const emit = defineEmits(['on-click']);
43 -const handle = () => {
44 - if (props.type === USER_ROLE.CLIENT) { // 类型是客户端时,才能查看
45 - emit('on-click', props.item)
46 - }
47 -}
48 -
49 -// 上传视频
50 -const show = ref(false);
51 -const onUpload = (v) => {
52 - show.value = true;
53 - // x_field_1是金数据表单传入的参数,老师上传的格式为:user_id-book_id-perf_id,perf_id 为 0
54 - let str = `${props.user_id}-${v.id}-0`;
55 - location.href = `${JSJ_FORM_B}?x_field_1=${str}`;
56 - // BUG: 关闭loading临时处理
57 - setTimeout(() => {
58 - show.value = false;
59 - }, 2000);
60 -}
61 -
62 -onBeforeRouteLeave(() => {
63 -})
64 -</script>
65 -
66 -<script>
67 -export default {
68 - data() {
69 - return {
70 -
71 - }
72 - },
73 - mounted() {
74 -
75 - },
76 - methods: {
77 -
78 - }
79 -}
80 -</script>
81 -
82 -<style lang="less" scoped>
83 -.book-item {
84 - // margin: 1rem;
85 - padding: 1rem;
86 -
87 - .wrapper {
88 - padding-left: 1rem;
89 -
90 - .title {
91 - font-size: 1.15rem;
92 - color: #222222;
93 - font-weight: bold;
94 - margin: 0.5rem 0;
95 - }
96 -
97 - .content {
98 - font-size: 0.85rem;
99 - color: #999999;
100 - margin: 0.5rem 0;
101 - line-height: 1.75;
102 - }
103 -
104 - .sub {
105 - font-size: 0.85rem;
106 - color: #999999;
107 - margin-top: 0.5rem;
108 - }
109 -
110 - .upload {
111 - color: @base-font-color;
112 - background-color: @base-color;
113 - border-radius: 15px;
114 - width: 4rem;
115 - padding: 0.25rem 0.5rem;
116 - font-size: 0.8rem;
117 - text-align: center;
118 - margin-top: 1rem;
119 - }
120 - }
121 -}
122 -.overlay-wrapper {
123 - display: flex;
124 - align-items: center;
125 - justify-content: center;
126 - height: 100%;
127 - width: auto;
128 - text-align: center;
129 -}
130 -
131 -</style>
1 -<template>
2 - <van-popup v-model:show="show" :close-on-click-overlay="false" position="bottom" :style="{ height: '40%' }">
3 - <div class="van-hairline--bottom">
4 - <van-row>
5 - <van-col span="4" />
6 - <van-col span="16" style="color: #222222; text-align: center; line-height: 3;">
7 - <span v-if="type === 'comment'">留言</span>
8 - <span v-else>回复</span>
9 - </van-col>
10 - <van-col span="4" @click="closeBtn">
11 - <div style="padding: 1rem;">
12 - <van-icon :name="icon_y" size="1.25rem" />
13 - </div>
14 - </van-col>
15 - </van-row>
16 - </div>
17 - <div style="background-color: #F7F7F7; font-size: 0.9rem;">
18 - <p style="color: #777777; padding: 1rem;">您的留言评论将会展示在页面中,请谨慎发表留言评论</p>
19 - <van-row>
20 - <van-col span="16">
21 - <p v-if="type === 'comment'" style="padding: 1rem; padding-top: 0;">请写下你友善的留言:</p>
22 - <p v-else style="padding: 1rem; padding-top: 0;">回复<span style="color: #0B3A72;">@{{ replayUser }}:</span></p>
23 - </van-col>
24 - <van-col span="8">
25 - <div class="button-primary-comment" @click="submitComment">发送</div>
26 - </van-col>
27 - </van-row>
28 - </div>
29 - <div>
30 - <van-cell-group inset>
31 - <van-field v-model="message" rows="2" autosize label="" type="textarea" maxlength="200"
32 - :placeholder="type === 'comment' ? '请输入留言内容' : '请输入回复内容'" show-word-limit @focus="focusInput"
33 - @blur="blurInput" />
34 - </van-cell-group>
35 - </div>
36 - </van-popup>
37 -</template>
38 -
39 -<script setup>
40 -import icon_y from '@images/y.png'
41 -import { Toast } from 'vant';
42 -
43 -import { ref, watch } from 'vue'
44 -
45 -const props = defineProps({
46 - showPopup: Boolean,
47 - type: String,
48 - replayUser: String
49 -})
50 -
51 -const emit = defineEmits(['on-close', 'on-submit']);
52 -
53 -const show = ref(false)
54 -const message = ref('')
55 -
56 -const closeBtn = () => {
57 - emit('on-close', false)
58 - show.value = false;
59 -}
60 -
61 -const submitComment = () => {
62 - if (message.value) {
63 - show.value = false;
64 - emit('on-submit', message.value);
65 - message.value = '';
66 - } else {
67 - Toast.fail('留言不能为空');
68 - }
69 -}
70 -
71 -// 监听弹出框
72 -watch(() => props.showPopup, (v) => {
73 - show.value = v
74 -})
75 -
76 -// 优化处理输入框弹出遮挡问题
77 -let interval = ''
78 -const focusInput = () => {
79 - window.addEventListener("resize", function () {
80 - if (
81 - document.activeElement.tagName === "INPUT" ||
82 - document.activeElement.tagName === "TEXTAREA"
83 - ) {
84 - interval = window.setTimeout(function () {
85 - if ("scrollIntoView" in document.activeElement) {
86 - document.activeElement.scrollIntoView();
87 - } else {
88 - document.activeElement.scrollIntoViewIfNeeded();
89 - }
90 - }, 0);
91 - }
92 - });
93 -}
94 -const blurInput = () => {
95 - clearInterval(interval);
96 -}
97 -</script>
98 -
99 -<style lang="less" scoped>
100 -.comment-wrapper {
101 - color: #999999;
102 - padding: 1rem;
103 - line-height: 1.75;
104 -
105 - .reply-wrapper {
106 - background: #F7F7F7;
107 - border-radius: 10px;
108 - padding: 0.5rem;
109 - margin-top: 0.5rem;
110 - color: #0B3A72;
111 -
112 - .content {
113 - color: #222222;
114 - }
115 - }
116 -}
117 -
118 -.button-primary-comment {
119 - width: 5rem;
120 - height: auto;
121 - text-align: center;
122 - padding: 0.2rem;
123 - // margin: 0.25rem;
124 - font-size: 0.9rem;
125 - background: @base-color;
126 - border-radius: 24px;
127 - border: 1px solid @base-color;
128 - color: @base-font-color;
129 - font-weight: bold;
130 - margin-left: 1rem;
131 - margin-bottom: 1rem;
132 -}
133 -.text {
134 - text-align: center;
135 - padding: 0.7rem;
136 - margin: 0.8rem;
137 - font-size: 1rem;
138 - font-weight: bold;
139 - border-radius: 24px;
140 - // border: 1px solid F7F7F7;
141 - color: #713610;
142 - background-color: @base-color;
143 - box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.06);
144 -}
145 -</style>
1 -<template>
2 - <van-popup v-model:show="show" :close-on-click-overlay="false" round position="bottom" :style="{ height: '70%' }">
3 - <div style="position: relative;">
4 - <div class="van-hairline--bottom"
5 - style="position: fixed; width: 100%; background-color: white; border-radius: 10px; z-index: 999;">
6 - <van-row>
7 - <van-col span="4" @click="onReload">
8 - <div style="padding: 1rem; text-align: center;">
9 - <!-- <van-icon :name="icon_x" size="1.25rem" /> -->
10 - </div>
11 - </van-col>
12 - <van-col span="16" style="color: #222222; text-align: center; line-height: 3;">
13 - <span>{{ listTotal }}条回复</span>
14 - </van-col>
15 - <van-col span="4" @click="closeBtn">
16 - <div style="padding: 1rem;">
17 - <van-icon :name="icon_y" size="1.25rem" />
18 - </div>
19 - </van-col>
20 - </van-row>
21 - </div>
22 - <div style="height: 4rem;"></div>
23 - <van-list v-model:loading="loading" :finished="finished" :finished-text="finishedTextStatus ? '没有更多了' : ''"
24 - @load="onLoad" :immediate-check="false">
25 - <template v-for="(item, key) in replyList" :key="key">
26 - <div class="comment-wrapper">
27 - <van-row style="font-size: 0.9rem;">
28 - <van-col span="4">
29 - <van-image round width="3rem" height="3rem" :src="item.avatar ? item.avatar : icon_avatar" />
30 - </van-col>
31 - <van-col span="14">
32 - <p>{{ item.name }}</p>
33 - <p>{{ item.kg_name }}</p>
34 - </van-col>
35 - <van-col span="6" style="text-align: right;">
36 - <p @click="setComment(item, 'reply')" style="color: #333333;">回复</p>
37 - <p>{{ item.comment_time }}</p>
38 - </van-col>
39 - </van-row>
40 - <van-row>
41 - <van-col offset="4">
42 - <span style="color: #222222;">{{ item.note }}</span>
43 - </van-col>
44 - </van-row>
45 - </div>
46 - </template>
47 - </van-list>
48 - <van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无回复" />
49 - </div>
50 - <comment-box :showPopup="showCommentBoxPopup" :type="commentType" :replayUser="replayUser"
51 - @on-submit="submitCommentBox" @on-close="closeCommentBox"></comment-box>
52 - </van-popup>
53 -
54 - <!-- 写评论时,如果没有实名认证提示弹框 -->
55 - <notice-overlay-module :show="showNotice" :type="userInfo.can_upload" @on-submit="onSubmit" @on-close="onClose" />
56 -</template>
57 -
58 -<script setup>
59 -import CommentBox from '@/components/CommentBox/index.vue'
60 -import NoticeOverlayModule from '@/components/NoticeOverlayModule/index.vue'
61 -import no_image from '@images/que-shuju@2x.png'
62 -import icon_y from '@images/y.png'
63 -import icon_avatar from '@images/que-touxiang@2x.png'
64 -
65 -import { useRoute, useRouter } from 'vue-router'
66 -
67 -import axios from '@/utils/axios';
68 -import _ from 'lodash'
69 -import { Toast } from 'vant';
70 -
71 -import { ref, watch } from 'vue'
72 -// 获取是否实名认证
73 -import { useDefaultPerf } from '@/composables';
74 -import { USER_STATUS } from '@/constant'
75 -import { useGo } from '@/hooks/useGo'
76 -const go = useGo();
77 -
78 -const $router = useRouter();
79 -const $route = useRoute();
80 -
81 -const { userInfo } = useDefaultPerf($route.query.book_id);
82 -
83 -const props = defineProps({
84 - showPopup: Boolean,
85 - data: Object
86 -})
87 -
88 -const emit = defineEmits(['on-close']);
89 -
90 -/******** 留言框相关操作 START *******/
91 -// 回复评论控件
92 -const showCommentBoxPopup = ref(false);
93 -const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为回复
94 -
95 -/**
96 - * 回复/评论 功能
97 - * @param {*} v 单行评论数据
98 - * @param {*} type 类型 comment 为评论/类型 reply 为回复
99 - */
100 -const commentId = ref('')
101 -const replayUser = ref('')
102 -const setComment = (v, type) => { //
103 - if (userInfo.value.can_upload === USER_STATUS.PASS) {
104 - showCommentBoxPopup.value = true;
105 - commentType.value = type;
106 - replayUser.value = v.name;
107 - commentId.value = props.data.id;
108 - } else {
109 - closeBtn();
110 - showNotice.value = true;
111 - }
112 -}
113 -
114 -/**
115 - * 提交留言回调
116 - * @param {*} note 留言内容
117 - */
118 -const submitCommentBox = (note) => {
119 - let url = '';
120 - let data = {}
121 - // 判断是留言还是回复 动态调整接口名称
122 - if (commentType.value === 'comment') {
123 - url = 'add_comment';
124 - data = {
125 - prod_id: $route.query.prod_id,
126 - note
127 - }
128 - } else {
129 - url = 'add_reply';
130 - data = {
131 - comment_id: commentId.value,
132 - note
133 - }
134 - }
135 - axios.post(`/srv/?a=${url}`, data)
136 - .then(res => {
137 - showCommentBoxPopup.value = false;
138 - if (res.data.code === 1) {
139 - Toast.success('发布成功')
140 - onReload()
141 - } else {
142 - console.warn(res);
143 - if (!res.data.show) return false;
144 - Toast({
145 - icon: 'close',
146 - message: res.data.msg
147 - });
148 - }
149 - })
150 - .catch(err => {
151 - console.error(err);
152 - })
153 -}
154 -
155 -const closeCommentBox = (v) => { // 关闭留言框
156 - showCommentBoxPopup.value = v;
157 -}
158 -/******** 留言框相关操作 START *******/
159 -
160 -const showNotice = ref(false)
161 -const onClose = () => { // 关闭提示框回调
162 - showNotice.value = false;
163 -}
164 -// 跳转个人中心
165 -const onSubmit = () => {
166 - setTimeout(() => {
167 - showNotice.value = false;
168 - }, 1000);
169 - if (userInfo.value.can_upload === USER_STATUS.NON_VERIFIED) { // 未实名认证
170 - go('/me/verifyUser', { back_url: $route.fullPath })
171 - } else if (userInfo.value.can_upload === USER_STATUS.NON_DEFAULT_CHILD) { // 没有默认儿童
172 - go('/me/handleUser', { perf_id: '', kg_id: '', kg_name: '', type: 'ADD', back_url: $route.fullPath })
173 - }
174 -}
175 -
176 -const show = ref(false);
177 -const listTotal = ref(0)
178 -const replyList = ref([])
179 -const loading = ref(false)
180 -const finished = ref(false)
181 -const limit = ref(10)
182 -const offset = ref(0)
183 -
184 -// 因为不能让空图标提前出来的写法
185 -const finishedTextStatus = ref(false);
186 -const emptyStatus = ref(false);
187 -
188 -const onLoad = () => {
189 - // 异步更新数据
190 - axios.get('/srv/?a=reply_list', {
191 - params: {
192 - comment_id: props.data.id,
193 - limit: limit.value,
194 - offset: offset.value
195 - }
196 - })
197 - .then(res => {
198 - if (res.data.code === 1) {
199 - listTotal.value = res.data.data.total;
200 - replyList.value = _.concat(replyList.value, res.data.data.replylist);
201 - replyList.value = _.uniqBy(replyList.value, 'id');
202 - offset.value = replyList.value.length;
203 - loading.value = false;
204 - // 数据全部加载完成
205 - if (!res.data.data.replylist.length) {
206 - // 加载状态结束
207 - finished.value = true;
208 - }
209 - if (!replyList.value.length) {
210 - finishedTextStatus.value = false;
211 - emptyStatus.value = true;
212 - } else {
213 - emptyStatus.value = false;
214 - }
215 - } else {
216 - console.warn(res);
217 - if (!res.data.show) return false;
218 - Toast({
219 - icon: 'close',
220 - message: res.data.msg
221 - });
222 - }
223 - })
224 - .catch(err => {
225 - console.error(err);
226 - })
227 -}
228 -const onReload = () => {
229 - replyList.value = [];
230 - offset.value = 0;
231 - onLoad();
232 -}
233 -// const onClose = () => {
234 -// show.value = false;
235 -// }
236 -
237 -// 监听弹出框
238 -watch(() => props.showPopup, (v) => {
239 - show.value = v;
240 - onReload()
241 -});
242 -
243 -
244 -const closeBtn = () => {
245 - emit('on-close', { comment_id: props.data.id, total: listTotal.value })
246 - show.value = false;
247 -}
248 -</script>
249 -
250 -<style lang="less" scoped>
251 -.comment-wrapper {
252 - color: #999999;
253 - padding: 1rem;
254 - line-height: 1.75;
255 -
256 - .reply-wrapper {
257 - background: #F7F7F7;
258 - border-radius: 10px;
259 - padding: 0.5rem;
260 - margin-top: 0.5rem;
261 - color: #0B3A72;
262 -
263 - .content {
264 - color: #222222;
265 - }
266 - }
267 -}
268 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-31 18:32:38
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-07-01 17:58:30
6 - * @FilePath: /tswj/src/components/DonateBar/index.vue
7 - * @Description: 爱心助力底部固定栏
8 --->
9 -<template>
10 - <div class="fix-btn">
11 - <div class="text" @click="showDonate=true">
12 - <slot />
13 - </div>
14 - </div>
15 - <donate-flower
16 - :show-popup="showDonate"
17 - :item="donateInfo"
18 - @on-close="showDonate=false"
19 - />
20 -</template>
21 -
22 -<script setup>
23 -import { ref, onMounted } from 'vue'
24 -import { DonateFlower } from '@/utils/generateModules'
25 -import { prepareDonateAPI } from '@/api/C/donate.js'
26 -
27 -const props = defineProps({
28 - perfId: Number,
29 - kgId: {
30 - type: String,
31 - default: ''
32 - }
33 -})
34 -
35 -const donateInfo = ref({})
36 -const showDonate = ref(false);
37 -onMounted(async () => {
38 - const { data } = await prepareDonateAPI({ perf_id: props.perfId, kg_id: props.kgId });
39 - donateInfo.value = data;
40 -})
41 -
42 -</script>
43 -
44 -<style lang="less" scoped>
45 -.fix-btn {
46 - position: fixed;
47 - bottom: 0;
48 - left: 0;
49 - right: 0;
50 - background-color: white;
51 - box-shadow: 0px -2px 4px 0px rgba(0, 0, 0, 0.07);
52 - .text {
53 - text-align: center;
54 - padding: 0.7rem;
55 - margin: 1.2rem;
56 - font-size: 1rem;
57 - font-weight: bold;
58 - border-radius: 24px;
59 - // border: 1px solid F7F7F7;
60 - color: @base-font-color;
61 - background-color: @base-color;
62 - box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.06);
63 - }
64 -}
65 -</style>
1 -<template>
2 - <van-popup v-model:show="show" :close-on-click-overlay="false" round position="bottom"
3 - :style="{ height: popupHeight }">
4 - <div class="donate-wrapper">
5 - <div class="donate-header">
6 - <van-row>
7 - <van-col>
8 - <div class="donate-book">
9 - <van-image width="80" height="80" :src="item.avatar ? item.avatar : icon_avatar" />
10 - </div>
11 - </van-col>
12 - <van-col>
13 - <div class="donate-detail">
14 - <p class="text">{{ item.name }}</p>
15 - <p class="price">¥{{ item.price }}</p>
16 - </div>
17 - </van-col>
18 - </van-row>
19 - </div>
20 - <div class="donate-name">
21 - <van-row>
22 - <van-col span="4" style="line-height: 2;">捐赠人<span style="color: red;">*</span></van-col>
23 - <van-col class="donate-input" span="18">
24 - <input v-model="item.perf_name" type="text" style="border: 0; padding: 0.25rem;" />
25 - </van-col>
26 - </van-row>
27 - </div>
28 - <div class="van-hairline--bottom donate-tips">
29 - <p style="color: #999999;">
30 - <van-icon name="warning-o" />&nbsp;&nbsp;您捐献的书籍将用于多民族语言发展项目
31 - </p>
32 - </div>
33 - <div class="donate-number">
34 - <van-row>
35 - <van-col span="12"> 数量 </van-col>
36 - <van-col span="12" style="text-align: right;">
37 - <van-stepper v-model="donate_number" min="1" max="100" integer input-width="40px" button-size="32px" />
38 - </van-col>
39 - </van-row>
40 - </div>
41 - <div class="donate-handle">
42 - <div class="donate-cancel">
43 - <my-button type="plain" @on-click="cancelDonate">取消</my-button>
44 - </div>
45 - <div class="donate-imd">
46 - <my-button type="primary" @on-click="donateBook">立即捐赠</my-button>
47 - </div>
48 - </div>
49 - </div>
50 - </van-popup>
51 -</template>
52 -
53 -<script setup>
54 -import Cookies from 'js-cookie'
55 -import icon_avatar from '@images/que-touxiang@2x.png'
56 -
57 -import MyButton from '@/components/MyButton/index.vue'
58 -import { ref, reactive, onMounted, watch, nextTick } from 'vue'
59 -import { useRoute, useRouter } from 'vue-router'
60 -import axios from '@/utils/axios';
61 -import $ from 'jquery'
62 -import { Toast, Dialog } from 'vant';
63 -const $route = useRoute();
64 -const $router = useRouter();
65 -
66 -const props = defineProps({
67 - item: Object,
68 - showPopup: Boolean
69 -})
70 -
71 -const emit = defineEmits(['on-close']);
72 -
73 -let donate_number = ref(1)
74 -const donateBook = () => {
75 - // 爱心捐书接口
76 - axios.post('/srv/?a=add_donate', {
77 - book_id: props.item.book_id,
78 - qty: donate_number.value,
79 - donate_name: props.item.perf_name,
80 - })
81 - .then(res => {
82 - if (res.data.code === 1) {
83 - console.warn(res.data.data);
84 - closeBtn();
85 -
86 - // 交易成功跳转回调页面
87 - // TEMP: 临时传参 donate_id
88 - $router.push({
89 - path: '/client/wechatpayCallback',
90 - query: {
91 - donate_id: res.data.data.id
92 - }
93 - })
94 - } else {
95 - console.warn(res);
96 - if (!res.data.show) return false;
97 - Toast({
98 - icon: 'close',
99 - message: res.data.msg
100 - });
101 - }
102 - })
103 - .catch(err => {
104 - console.error(err);
105 - })
106 -}
107 -
108 -const show = ref(false);
109 -let popupHeight = ref('60%');
110 -
111 -watch(() => props.showPopup, (v) => {
112 - // 如果没有默认儿童需要用户确认一次
113 - if (v && !props.item.perf_id) {
114 - Dialog.confirm({
115 - title: '温馨提示',
116 - message: '默认儿童为空, 是否继续捐书!',
117 - confirmButtonColor: '#713610'
118 - })
119 - .then(() => {
120 - show.value = v;
121 - // DOM调整后,把弹出框高度设定到适合高度,配合不同分辨率效果
122 - nextTick(() => {
123 - let height = $('.donate-wrapper').height();
124 - popupHeight.value = height + 10 + 'px';
125 - })
126 - })
127 - .catch(() => {
128 - // 取消按钮回调
129 - closeBtn();
130 - });
131 - return false;
132 - }
133 - show.value = v;
134 - // DOM调整后,把弹出框高度设定到适合高度,配合不同分辨率效果
135 - nextTick(() => {
136 - let height = $('.donate-wrapper').height();
137 - popupHeight.value = height + 10 + 'px';
138 - })
139 -})
140 -
141 -const closeBtn = () => {
142 - emit('on-close', false)
143 - show.value = false;
144 -}
145 -
146 -const cancelDonate = () => {
147 - closeBtn();
148 -}
149 -
150 -onMounted(() => {
151 -
152 -})
153 -</script>
154 -
155 -<script>
156 -import mixin from 'common/mixin';
157 -
158 -export default {
159 - mixins: [mixin.init],
160 - data() {
161 - return {
162 - }
163 - },
164 - mounted() {
165 - },
166 - methods: {
167 - }
168 -}
169 -</script>
170 -
171 -<style lang="less" scoped>
172 -.donate-wrapper {
173 - .donate-header {
174 - padding: 1rem;
175 -
176 - .donate-book {
177 - border: 1px solid #ECECEC;
178 - border-radius: 5px;
179 - padding: 0.1rem;
180 - }
181 -
182 - .donate-detail {
183 - font-size: 1.25rem;
184 - padding: 1rem;
185 -
186 - .text {
187 - color: #292929;
188 - font-weight: bold;
189 - }
190 -
191 - .price {
192 - color: #EE332E;
193 - }
194 - }
195 - }
196 -
197 - .donate-name {
198 - padding: 1rem;
199 -
200 - .donate-input {
201 - border: 1px solid #B9B9B9;
202 - border-radius: 5px;
203 - padding: 0.2rem;
204 - margin-left: 1rem;
205 - }
206 - }
207 -
208 - .donate-tips {
209 - padding: 1rem;
210 - padding-top: 0;
211 - }
212 -
213 - .donate-number {
214 - padding: 1rem;
215 - }
216 -
217 - .donate-handle {
218 - overflow: auto;
219 -
220 - .donate-cancel {
221 - width: 49%;
222 - float: left;
223 - }
224 -
225 - .donate-imd {
226 - width: 50%;
227 - float: left;
228 - }
229 - }
230 -}
231 -
232 -.button {
233 - display: flex;
234 - flex-direction: column;
235 - justify-content: center;
236 - flex: 1;
237 - padding: 0 0.5rem;
238 -}
239 -</style>
1 -<template>
2 - <div class="donate-certificate">
3 - <div class="header-bg">
4 - <van-image width="100" height="100" fit="contain" :src="icon_cert" style="margin-top: 15vh;" />
5 - </div>
6 - <div class="title">
7 - <van-row align="center">
8 - <van-col>
9 - <span style="font-size: 0.8rem; color: #272727;">亲爱的捐赠者</span>
10 - </van-col>
11 - <van-col>
12 - <div style="color: #713610; padding: 1rem;" class="bg-gradient">{{ item.name }}</div>
13 - </van-col>
14 - <van-col>:</van-col>
15 - </van-row>
16 - </div>
17 - <div class="content">
18 - 感谢您对“童声无界”多民族儿童共读活动的关注及捐赠。上海市儿童基金会已收到您的捐款。您的爱心将用于边疆地区少数民族儿童阅读能力的培育。共读一本书传递一份爱,初心为爱童声无界。感谢您对公益事业的支持。
19 - </div>
20 - <div class="price">
21 - <div>爱心捐赠</div>
22 - <div>{{ item.amt }}&nbsp;元</div>
23 - </div>
24 - <div class="organizer">
25 - <div class="wrapper">
26 - <p>上海市儿童基金会</p>
27 - <p>上海初心为爱公益基金会</p>
28 - <div style="position: absolute; width: 50%; height: 100%; top: 0; left: 0;">
29 - <van-image height="100%" fit="contain" :src="icon_stamp01" />
30 - </div>
31 - <div style="position: absolute; width: 50%; height: 100%; top: 0; right: 0;">
32 - <van-image height="100%" fit="contain" :src="icon_stamp02" />
33 - </div>
34 - </div>
35 - </div>
36 - <!-- <div class="date">{{ item.donate_date }}</div> -->
37 - <div class="text">
38 - 证书编号:{{ item.cert_code }}
39 - </div>
40 - <div style="height: 3rem;" />
41 - <div class="wrapper-border">
42 - <div class="top-bg">
43 - <van-image :src="donate_top" style="width: 100%; height: 10rem;" />
44 - </div>
45 - <div class="center-bg">
46 - <img :src="donate_center" :style="styleObject">
47 - </div>
48 - <div class="bottom-bg">
49 - <van-image :src="donate_bottom" style="width: 100%;" />
50 - </div>
51 - <div style="height: 3rem;" />
52 - </div>
53 - </div>
54 -</template>
55 -
56 -<script setup>
57 -import icon_cert from '@images/zhengshu@2x.png'
58 -import icon_stamp01 from '@images/stamp01.png'
59 -import icon_stamp02 from '@images/stamp02.png'
60 -import donate_top from '@images/donate_top.png'
61 -import donate_center from '@images/donate_center.png'
62 -import donate_bottom from '@images/donate_bottom.png'
63 -import $ from 'jquery'
64 -
65 -</script>
66 -
67 -<script>
68 -import mixin from 'common/mixin';
69 -
70 -export default {
71 - mixins: [mixin.init],
72 - props: ['item'],
73 - data() {
74 - return {
75 - name: '',
76 - price: '',
77 - datetime: '',
78 - styleObject: {}
79 - }
80 - },
81 - mounted() {
82 - // 动态计算背景图高度
83 - const wrapper_height = $('.donate-certificate').height()
84 - const top_height = $('.top-bg').height()
85 - const bottom_height = $('.bottom-bg').height()
86 - const center_height = (wrapper_height - top_height - bottom_height).toFixed();
87 - this.styleObject = {
88 - width: '100%',
89 - height: center_height + 'px'
90 - }
91 - },
92 - methods: {
93 -
94 - }
95 -}
96 -</script>
97 -
98 -<style lang="less" scoped>
99 -.donate-certificate {
100 - background-image: url('http://gyzs.onwall.cn/zhengshu-banner.png');
101 - background-color: white;
102 - background-repeat: no-repeat;
103 - background-size: contain;
104 - width: 100%;
105 - position: relative;
106 - border-radius: 10px;
107 - // height: 85vh;
108 - box-shadow: 0px 0px 7px 0px rgba(3, 155, 178, 0.14);
109 - .header-bg {
110 - text-align: center;
111 - }
112 -
113 - .title {
114 - padding: 0 2rem;
115 - }
116 -
117 - .content {
118 - font-size: 0.85rem;
119 - padding: 2rem;
120 - line-height: 1.75;
121 - text-indent: 2rem;
122 - }
123 -
124 - .price {
125 - margin-left: 4rem;
126 -
127 - div:first-child {
128 - display: inline-block;
129 - font-size: 0.85rem;
130 - vertical-align: middle;
131 - margin-right: 0.5rem;
132 - }
133 -
134 - div:last-child {
135 - display: inline-block;
136 - font-size: 1.25rem;
137 - color: red;
138 - vertical-align: middle;
139 - }
140 - }
141 -
142 - .organizer {
143 - margin: 1rem;
144 - overflow: hidden;
145 - margin-right: 2rem;
146 - padding-bottom: 1rem;
147 - .wrapper {
148 - float: right;
149 - font-size: 0.8rem;
150 - text-align: center;
151 - line-height: 2;
152 - position: relative;
153 - color: #000;
154 - padding: 0.5rem 0;
155 - }
156 - }
157 -
158 - .date {
159 - color: #272727;
160 - font-size: 0.85rem;
161 - text-align: right;
162 - padding-right: 2rem;
163 - }
164 - .text {
165 - color: #713610;
166 - padding-left: 10%;
167 - font-size: 0.9rem;
168 - position: relative;
169 - bottom: 1rem;
170 - margin-top: 1rem;
171 - }
172 - .wrapper-border {
173 - position: absolute;
174 - // border: 0.5px solid #11D2B1;
175 - height: 95%;
176 - top: 0;
177 - width: 93%;
178 - margin: 3%;
179 - // border-radius: 1.5rem;
180 - // overflow: hidden;
181 - .top-bg {
182 - margin: 0;
183 - padding: 0;
184 - font-size: 0;
185 - position: absolute;
186 - top: 0;
187 - width: 100%;
188 - }
189 - .center-bg {
190 - margin: 0;
191 - padding: 0;
192 - font-size: 0;
193 - position: absolute;
194 - top: 10%;
195 - width: 100%;
196 - }
197 - .bottom-bg {
198 - margin: 0;
199 - padding: 0;
200 - font-size: 0;
201 - position: absolute;
202 - bottom: 0;
203 - width: 100%;
204 - }
205 - }
206 - .bg-gradient {
207 - // 文字下划线
208 - background: linear-gradient(#EAEAEA, #EAEAEA) no-repeat;
209 - /*调整下划线的宽度占百分之百 高度是3px */
210 - // background-size: 100% 3px;
211 - /* 调整下划线的起始位置 左侧是0 上边是1.15em */
212 - // background-position: 0 1rem;
213 - background-size: 100% 1px;
214 - background-position: 0 2.5rem;
215 - }
216 -}
217 -</style>
1 -/*
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-06-02 11:23:16
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-09 17:05:08
6 - * @FilePath: /tswj/src/components/DonateFlower/agreement.js
7 - * @Description:
8 - */
9 -const str = '上海XX益基金会'
10 -const html = `
11 - <div style="text-align: center; font-weight: bold; margin-bottom: 1rem; font-size: 1.25rem; color: #11D2B1;">
12 - 捐赠协议
13 - </div>
14 - <div style="text-align: justify; color: #231815; font-size: 1.05rem; line-height: 1.5;">
15 - 感谢您对中国公益慈善事业的关心与支持!${str}面向所有具有公开募捐资质的慈善组织提供服务。${str}始终秉持着最高的合规性要求,因此,只要您点击“同意”或“接受”,您的行为就已表示您无条件接受并遵守“本网络捐赠条款和条件”以及${str}不时公布的“其他公开规则”。
16 - </div>
17 - <div style="margin: 1rem 0;">
18 - <div style="margin-bottom: 0.5rem;">1.资格规定</div>
19 - <div style="line-height: 1.75;">
20 - 您声明您是符合中华人民共和国法律规定的具有完全民事行为能力的自然人。
21 - </div>
22 - </div>
23 - <div style="margin: 1rem 0;">
24 - <div style="margin-bottom: 0.5rem;">2.捐赠财产</div>
25 - <div style="margin-bottom: 0.5rem;line-height: 1.75;">您同意依照《公益事业捐赠法》的相关规定,自愿无偿地通过网络向${str}平台上具有公开募捐资质的慈善组织捐赠财产用于公益事业。</div>
26 - <div style="margin-bottom: 0.5rem;line-height: 1.75;">您声明您用于捐赠的财产是您合法持有并有权处分的财产。</div>
27 - <div style="margin-bottom: 0.5rem;line-height: 1.75;">您声明您已经了解《公益事业捐赠法》、《合同法》中关干财产捐赠的相关规定,明确同意不会撤销或部分撤销对${str}平台上具有公开募捐资质的慈善组织作出的捐赠。</div>
28 - <div style="margin-bottom: 0.5rem;line-height: 1.75;">您声明您知晓并同意,${str}平台上具有公开募捐资质的慈善组织可以为公益事业之目的合理审慎地自主决定捐赠财产的实际受助对象、以及具体使用的领域、金额、时间。</div>
29 - </div>
30 - <div style="margin: 1rem 0;">
31 - <div style="margin-bottom: 0.5rem;">3.争议解决和法律适用</div>
32 - <div style="margin-bottom: 0.5rem;line-height: 1.75;">除非另有明确约定,否则,本网络捐款条款和条件适用中华人民共和国法律,并排除一切冲突法原则的适用。</div>
33 - <div style="line-height: 1.75;">
34 - 如果各方无法通过协商解决争端,您和${str}平台上具有公开募捐资质的慈善组织,也即善款接收方,均有权向有管辖权的人民法院提起诉讼以解决争议,由此产生的诉讼费、律师费、公证费等由败诉方承担。<br/>
35 - </div>
36 - </div>
37 - <div style="margin: 1rem 0;">
38 - <div style="margin-bottom: 0.5rem;">4.其他</div>
39 - 本网络捐款条款和条件构成您与${str}之间就本网络捐款条款和条件约定事项的完整和唯一的协议,并取代就本网络捐款条款和条件事项达成的口头或书面协议。如本网络捐款条款和条件内容与${str}其他公开规则内容相冲突,则以本网络捐款条款和条件内容为准。
40 - </div>
41 - <div style="margin: 1rem 0; line-height: 1.75;">
42 - 如果本网络捐款条款和条件条文因任何原因被认定是违法、无效或者丧失执行力,该条文将从本网络捐款条款和条件中删除,而其余条款的效力则不受影响。<br/>
43 - </div>
44 - <div style="margin: 1rem 0; line-height: 1.75;">
45 - ${str}未能执行本网络捐款条款和条件中的任何条款的行为不应被解释为放弃当前或未来对该条款的权利,也不会影响${str}日后要求执行该条款的权利。${str}明确提出放弃本网络捐款条款和条件中的规定、条件或要求不构成放弃追究未来与此规定、条件或要求相一致的责任。
46 - </div>
47 - </div>
48 - <div style="height: 5rem;"></div>
49 -`
50 -
51 -export default html;
1 -<!--
2 - * @Date: 2022-06-17 17:17:13
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-17 20:39:34
5 - * @FilePath: /tswj/src/components/DonateFlower/agreement.vue
6 - * @Description: 文件描述
7 --->
8 -<template>
9 - <div class="agreement-page">
10 - <div class="title">捐赠协议</div>
11 - <div class="sub">
12 - 感谢您对中国公益慈善事业的关心与支持!上海市儿童基金会面向所有具有公开募捐资质的慈善组织提供服务。上海市儿童基金会始终秉持着最高的合规性要求,因此,只要您点击“同意”或“接受”,您的行为就已表示您无条件接受并遵守“本网络捐赠条款和条件”以及上海市儿童基金会不时公布的“其他公开规则”。
13 - </div>
14 - <div class="content">
15 - <div class="title-content">1. 资格规定</div>
16 - <div class="text-content">
17 - 您声明您是符合中华人民共和国法律规定的具有完全民事行为能力的自然人。
18 - </div>
19 - </div>
20 - <div class="content">
21 - <div class="title-content">2. 捐赠财产</div>
22 - <div class="text-content">您同意依照《公益事业捐赠法》的相关规定,自愿无偿地通过网络向上海市儿童基金会平台上具有公开募捐资质的慈善组织捐赠财产用于公益事业。</div>
23 - <div class="text-content">您声明您用于捐赠的财产是您合法持有并有权处分的财产。</div>
24 - <div class="text-content">
25 - 您声明您已经了解《公益事业捐赠法》、《民法典》中关干财产捐赠的相关规定,明确同意不会撤销或部分撤销对上海市儿童基金会平台上具有公开募捐资质的慈善组织作出的捐赠。
26 - </div>
27 - <div class="text-content">
28 - 您声明您知晓并同意,上海市儿童基金会平台上具有公开募捐资质的慈善组织可以为公益事业之目的合理审慎地自主决定捐赠财产的实际受助对象、以及具体使用的领域、金额、时间。
29 - </div>
30 - </div>
31 - <div class="content">
32 - <div class="title-content">3. 争议解决和法律适用</div>
33 - <div class="text-content">除非另有明确约定,否则,本网络捐款条款和条件适用中华人民共和国法律,并排除一切冲突法原则的适用。</div>
34 - <div class="text-content">
35 - 如果各方无法通过协商解决争端,您和上海市儿童基金会平台上具有公开募捐资质的慈善组织,也即善款接收方,均有权向有管辖权的人民法院提起诉讼以解决争议,由此产生的诉讼费、律师费、公证费等由败诉方承担。
36 - </div>
37 - </div>
38 - <div class="content">
39 - <div class="title-content">4. 其他</div>
40 - <div class="text-content">
41 - 本网络捐款条款和条件构成您与上海市儿童基金会之间就本网络捐款条款和条件约定事项的完整和唯一的协议,并取代就本网络捐款条款和条件事项达成的口头或书面协议。如本网络捐款条款和条件内容与上海市儿童基金会其他公开规则内容相冲突,则以本网络捐款条款和条件内容为准。
42 - </div>
43 - </div>
44 - <div class="content">
45 - 如果本网络捐款条款和条件条文因任何原因被认定是违法、无效或者丧失执行力,该条文将从本网络捐款条款和条件中删除,而其余条款的效力则不受影响。
46 - </div>
47 - <div class="content">
48 - 上海市儿童基金会未能执行本网络捐款条款和条件中的任何条款的行为不应被解释为放弃当前或未来对该条款的权利,也不会影响上海市儿童基金会日后要求执行该条款的权利。上海市儿童基金会明确提出放弃本网络捐款条款和条件中的规定、条件或要求不构成放弃追究未来与此规定、条件或要求相一致的责任。
49 - </div>
50 - <div style="height: 5rem;" />
51 - </div>
52 -</template>
53 -
54 -<script setup>
55 -import { ref } from 'vue'
56 -import { useRoute, useRouter } from 'vue-router'
57 -
58 -import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
59 -//import { } from '@/utils/generateModules.js'
60 -//import { } from '@/utils/generateIcons.js'
61 -//import { } from '@/composables'
62 -const $route = useRoute();
63 -const $router = useRouter();
64 -useTitle($route.meta.title);
65 -
66 -</script>
67 -
68 -<style lang="less" scoped>
69 -.agreement-page {
70 - padding: 1rem;
71 - .title {
72 - text-align: center;
73 - font-weight: bold;
74 - margin-bottom: 1rem;
75 - font-size: 1.25rem;
76 - color: #11D2B1;
77 - }
78 - .sub {
79 - text-align: justify;
80 - color: #231815;
81 - font-size: 1.05rem;
82 - line-height: 1.5;
83 - }
84 - .content {
85 - margin: 1rem 0;
86 - line-height: 1.75;
87 - .title-content {
88 - margin-bottom: 0.5rem;
89 - }
90 - .text-content {
91 - margin-bottom: 0.5rem;
92 - line-height: 1.75;
93 - }
94 - }
95 -}
96 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-31 22:09:58
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2023-02-08 13:45:09
6 - * @FilePath: /tswj/src/components/DonateFlower/index.vue
7 - * @Description: 捐花组件
8 --->
9 -<template>
10 - <van-popup v-model:show="show" :close-on-click-overlay="false" round position="bottom"
11 - :style="{ height: popupHeight, zIndex: 3000 }">
12 - <div class="donate-wrapper">
13 - <div class="donate-title">
14 - 您所有捐助的爱心
15 - <van-icon :name="icon_flower" />
16 - 都将用于多民族语言发展
17 - </div>
18 - <div class="shortcut-choose-wrapper">
19 - <van-row gutter="10">
20 - <van-col v-for="(v, index) in defaultOptions" :key="index" span="8">
21 - <div :class="['base-item', donate_number === +index ? 'checked-item' : 'uncheck-item']"
22 - @click="selectDonate(+index)">
23 - {{ v }}
24 - </div>
25 - </van-col>
26 - </van-row>
27 - </div>
28 - <!-- <div style="background: #FFFFFF; border-radius: 3px; border: 1px solid #713610; padding: 0.5rem 1rem; margin: 0.5rem 1rem; text-align: center;">更多花花</div> -->
29 - <div class="donate-number">
30 - <van-row v-if="more_donate">
31 - <van-col span="18" style="text-align: right;">
32 - <van-field v-model="donate_number" style="border: 1px solid #11D2B1; padding: 0.4rem 1rem;" type="digit"
33 - input-align="center" label="" placeholder="请输入花花数量" />
34 - </van-col>
35 - <van-col span="6" style="line-height: 2.5;">&nbsp;朵花花</van-col>
36 - </van-row>
37 - <div v-else style="border: 1px solid #11D2B1; padding: 0.4rem 1rem;" @click="more_donate = true">更多花花</div>
38 - </div>
39 - <div v-if="item.kg_id" class="donate-name">
40 - <van-row>
41 - <van-col span="4" style="line-height: 2;">幼儿园</van-col>
42 - <van-col span="18">
43 - <div class="donate-text">{{ item.kg_name }}</div>
44 - </van-col>
45 - </van-row>
46 - </div>
47 - <div v-if="item.perf_id" class="donate-name">
48 - <van-row>
49 - <van-col span="4" style="line-height: 2;">助力人</van-col>
50 - <van-col span="18">
51 - <div class="donate-text">{{ item.perf_name }}</div>
52 - </van-col>
53 - </van-row>
54 - </div>
55 - <div class="donate-name">
56 - <van-row>
57 - <van-col span="4" style="line-height: 2;">捐赠人<span style="color: red;">*</span></van-col>
58 - <van-col class="donate-input" span="18">
59 - <input v-model="item.donate_name" type="text" style="border: 0; padding: 0.25rem;">
60 - </van-col>
61 - </van-row>
62 - </div>
63 - <van-row class="agree-wrapper">
64 - <van-col span="12" offset="8">
65 - <div class="agree-content">
66 - <div class="btn">
67 - <van-checkbox v-model="agreed" checked-color="#ee0a24">同意&nbsp;</van-checkbox>
68 - </div>
69 - <div class="text">
70 - <span @click="showDA=true">捐赠协议</span>
71 - </div>
72 - </div>
73 - </van-col>
74 - </van-row>
75 -
76 - <div class="donate-handle">
77 - <div class="donate-cancel">
78 - <my-button type="plain" @on-click="cancelDonate">取消</my-button>
79 - </div>
80 - <div class="donate-imd">
81 - <my-button type="primary" @on-click="donateFlower">确定</my-button>
82 - </div>
83 - </div>
84 - </div>
85 - </van-popup>
86 - <div class="popup-wrapper">
87 - <van-popup v-model:show="showDA" position="bottom" :style="{ height: '100%', zIndex: 4000 }">
88 - <agreement />
89 - <div class="bottom-btn" @click="showDA=false">
90 - <div class="text">关闭</div>
91 - </div>
92 - </van-popup>
93 - </div>
94 -</template>
95 -
96 -<script setup>
97 -import { icon_flower } from '@/utils/generateIcons'
98 -import MyButton from '@/components/MyButton/index.vue'
99 -import agreement from './agreement.vue'
100 -import { ref, watch, nextTick } from 'vue'
101 -import { $, Toast } from '@/utils/generatePackage'
102 -import { addDonateAPI } from '@/api/C/donate.js'
103 -// import { wxJsAPI } from '@/api/wx/config'
104 -// import { wxPayAPI } from '@/api/wx/pay'
105 -// import wx from 'weixin-js-sdk'
106 -
107 -const props = defineProps({
108 - item: Object,
109 - showPopup: Boolean
110 -})
111 -const emit = defineEmits(['on-close']);
112 -
113 -let donate_number = ref(1);
114 -const donateFlower = () => {
115 - if (!agreed.value) {
116 - Toast.fail('请先查看捐赠协议,勾选同意!');
117 - return false;
118 - }
119 - if (!props.item.donate_name) {
120 - Toast.fail('捐赠人姓名不能为空!');
121 - return false;
122 - }
123 - // 业务逻辑调整,有值就传值显示
124 - let params = {
125 - qty: donate_number.value,
126 - donate_name: props.item.donate_name,
127 - perf_id: props.item.perf_id,
128 - kg_id: props.item.kg_id,
129 - };
130 - addDonate(params);
131 -}
132 -
133 -const addDonate = async (params) => {
134 - const { data } = await addDonateAPI(params);
135 - if (data.id) {
136 - closeBtn();
137 - // TAG: 微信支付
138 - wechatPay(data.id);
139 - }
140 -}
141 -
142 -const show = ref(false);
143 -let popupHeight = ref('100%');
144 -
145 -watch(() => props.showPopup, (v) => {
146 - // 现在新需求只要钱,多余步骤先屏蔽掉。
147 - // // 如果没有默认儿童需要用户确认一次
148 - // if (v && !props.item.perf_id) {
149 - // Dialog.confirm({
150 - // title: '温馨提示',
151 - // message: '默认儿童为空, 是否继续助力!',
152 - // confirmButtonColor: '#713610'
153 - // })
154 - // .then(() => {
155 - // show.value = v;
156 - // // DOM调整后,把弹出框高度设定到适合高度,配合不同分辨率效果
157 - // nextTick(() => {
158 - // let height = $('.donate-wrapper').height();
159 - // popupHeight.value = height + 10 + 'px';
160 - // })
161 - // })
162 - // .catch(() => {
163 - // // 取消按钮回调
164 - // closeBtn();
165 - // });
166 - // return false;
167 - // }
168 - show.value = v;
169 - // DOM调整后,把弹出框高度设定到适合高度,配合不同分辨率效果
170 - nextTick(() => {
171 - let height = $('.donate-wrapper').height();
172 - popupHeight.value = height + 10 + 'px';
173 - })
174 -})
175 -
176 -const closeBtn = () => {
177 - emit('on-close', false)
178 - show.value = false;
179 -}
180 -
181 -const cancelDonate = () => {
182 - closeBtn();
183 -}
184 -
185 -// TAG: 微信支付
186 -const wechatPay = (id) => {
187 - const base = 'http://voice.onwall.cn/WxpayAPI/voice_pay/jsapi_voice.php'
188 - location.href = `${base}?i=${id}`
189 -}
190 -
191 -const more_donate = ref(false);
192 -// 选择捐赠数量
193 -const selectDonate = (index) => {
194 - donate_number.value = index
195 - more_donate.value = false
196 -}
197 -const defaultOptions = ref({
198 - 1: '1朵花花',
199 - 3: '3朵花花',
200 - 5: '5朵花花',
201 -});
202 -// 捐赠协议
203 -const agreed = ref(false);
204 -// 显示捐赠协议弹框
205 -const showDA = ref(false);
206 -</script>
207 -
208 -<style lang="less" scoped>
209 -.donate-wrapper {
210 - .donate-title {
211 - padding: 1rem 1rem 0 1rem;
212 - color: #999999;
213 - text-align: center;
214 - }
215 -
216 - .shortcut-choose-wrapper {
217 - padding: 1rem;
218 -
219 - .base-item {
220 - text-align: center;
221 - padding: 0.5rem 0;
222 - }
223 -
224 - .checked-item {
225 - color: @base-font-color;
226 - background: @base-color;
227 - border-radius: 3px;
228 - border: 1px solid @base-color;
229 - }
230 -
231 - .uncheck-item {
232 - color: @base-color;
233 - background: @base-font-color;
234 - border-radius: 3px;
235 - border: 1px solid @base-color;
236 - }
237 - }
238 -
239 - .donate-name {
240 - padding: 1rem;
241 -
242 - .donate-text {
243 - background: #F4F4F4;
244 - border-radius: 3px;
245 - padding: 0.5rem;
246 - margin-left: 5%;
247 - width: 95%;
248 - }
249 -
250 - .donate-input {
251 - border: 1px solid #B9B9B9;
252 - border-radius: 5px;
253 - padding: 0.2rem;
254 - margin-left: 1rem;
255 - }
256 - }
257 -
258 - .agree-wrapper {
259 - margin: 1rem 0;
260 -
261 - .agree-content {
262 - display: flex;
263 - align-items: center;
264 - box-sizing: content-box;
265 -
266 - .btn {
267 - display: flex;
268 - flex-direction: column;
269 - justify-content: center;
270 - }
271 -
272 - .text {
273 - display: flex;
274 - flex-direction: column;
275 - justify-content: center;
276 -
277 - span {
278 - text-decoration: underline;
279 - color: #11D2B1;
280 - }
281 - }
282 - }
283 - }
284 -
285 - .donate-number {
286 - padding: 1rem;
287 - padding-top: 0;
288 - text-align: center;
289 - color: #11D2B1;
290 - }
291 -
292 - .donate-handle {
293 - overflow: auto;
294 -
295 - .donate-cancel {
296 - width: 49%;
297 - float: left;
298 - }
299 -
300 - .donate-imd {
301 - width: 50%;
302 - float: left;
303 - }
304 - }
305 -}
306 -
307 -.button {
308 - display: flex;
309 - flex-direction: column;
310 - justify-content: center;
311 - flex: 1;
312 - padding: 0 0.5rem;
313 -}
314 -
315 -.bottom-btn {
316 - position: fixed;
317 - bottom: 0;
318 - left: 0;
319 - right: 0;
320 - background-color: white;
321 - box-shadow: 0px -2px 4px 0px rgba(0, 0, 0, 0.07);
322 -
323 - .text {
324 - text-align: center;
325 - padding: 0.7rem;
326 - margin: 0.8rem;
327 - font-size: 1rem;
328 - font-weight: bold;
329 - border-radius: 24px;
330 - // border: 1px solid F7F7F7;
331 - color: @base-font-color;
332 - background-color: @base-color;
333 - box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.06);
334 - }
335 -}
336 -
337 -.popup-wrapper {
338 - .agreementHtml {
339 - padding: 1rem;
340 - }
341 -}
342 -</style>
1 -<!--
2 - * @Date: 2022-06-25 03:29:05
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-25 15:50:08
5 - * @FilePath: /tswj/src/components/FlowerIcon/index.vue
6 - * @Description: 文件描述
7 --->
8 -<template>
9 - <div :class="[type === 'center' ? 'global-center' : 'flower']">
10 - <van-icon :name="icon_flower" color="#c5c5c5" size="1.25rem" :style="{ verticalAlign: align }" />
11 - <span :style="{ color, fontSize }">&nbsp;{{ qty }}</span>
12 - </div>
13 -</template>
14 -
15 -<script setup>
16 -import { icon_flower } from '@/utils/generateIcons.js'
17 -
18 -const props = defineProps({
19 - qty: {
20 - type: Number,
21 - default: 0
22 - },
23 - color: String,
24 - align: String,
25 - type: String,
26 - fontSize: String
27 -})
28 -</script>
29 -
30 -<style lang="less" scoped>
31 -.flower {
32 - text-align: center;
33 - position: absolute;
34 - top: 40%;
35 - right: 0.5rem;
36 - color: #713610;
37 -}
38 -</style>
1 -<template>
2 - <!-- 滑块验证功能 -->
3 - <div class="sliderModel" v-if="visible">
4 - <div class="cont">
5 - <div class="title">滑块验证</div>
6 - <div class="slider-refresh">
7 - <span @click="handleRefresh">刷新</span>
8 - <span @click="handleClose">关闭</span>
9 - </div>
10 - <!-- canvas 图片 -->
11 - <div class="imgWrap">
12 - <canvas ref="sliderBlock" class="slider-block"></canvas>
13 - <canvas ref="codeImg" class="code-img"></canvas>
14 - </div>
15 - <!-- 滑块 -->
16 - <div class="sliderBox">
17 - <div class="sliderF">
18 - <div class="sliderS" @touchstart.prevent="handleTouch">
19 - <div class="btn">&gt;&gt;</div>
20 - </div>
21 - </div>
22 - <div class="bgC">
23 - {{ tips }}
24 - <div class="bgC_left"></div>
25 - </div>
26 - </div>
27 - </div>
28 - </div>
29 -</template>
30 -
31 -<script>
32 -import img1 from './images/1.jpg'
33 -import img2 from './images/2.jpg'
34 -import img3 from './images/3.jpg'
35 -import img4 from './images/4.jpg'
36 -import img5 from './images/5.jpg'
37 -import img6 from './images/6.jpg'
38 -
39 -export default {
40 - props: {
41 - isShow: {
42 - type: Boolean,
43 - default: false
44 - },
45 - options: {
46 - // 传入的参数不影响组件
47 - type: Object,
48 - default: () => ({})
49 - },
50 - imgList: { // 背景图片
51 - type: Array,
52 - default: () => {
53 - return [img1, img2, img3, img4, img5, img6]
54 - }
55 - }
56 - },
57 - data() {
58 - return {
59 - // 滑块x轴数据
60 - slider: {
61 - mx: 0,
62 - bx: 0
63 - },
64 - tips: '',
65 - visible: false,
66 - mainDom: '',
67 - blockDom: ''
68 - }
69 - },
70 - watch: {
71 - isShow: {
72 - handler(newVal) {
73 - this.visible = newVal
74 - if (newVal === true) {
75 - this.tips = '拖动左边滑块完成上方拼图'
76 - this.$nextTick(() => {
77 - this.getDom()
78 - this.canvasInit()
79 - })
80 - }
81 - },
82 - immediate: true
83 - }
84 - },
85 -
86 - methods: {
87 - // 获取 dom
88 - getDom() {
89 - this.mainDom = this.$refs.codeImg
90 - this.blockDom = this.$refs.sliderBlock
91 - },
92 -
93 - handleClose() {
94 - this.$emit('on-close', false)
95 - },
96 -
97 - // 刷新
98 - handleRefresh() {
99 - this.canvasInit()
100 - },
101 -
102 - // 移动端事件
103 - handleTouch(e) {
104 - const ev = e || window.event
105 - const dom = ev.target // dom元素
106 -
107 - const downCoordinate = {
108 - x: ev.touches[0].pageX,
109 - y: ev.touches[0].pageY
110 - }
111 - // 正确的滑块数据
112 - const checkx = Number(this.slider.mx) - 0
113 - // x轴数据
114 - let x = 0
115 - const move = (moveEV) => {
116 - x = moveEV.touches[0].pageX - downCoordinate.x
117 - // //y = moveEV.y - downCoordinate.y;
118 - if (x >= 251 || x <= 0) return false
119 - dom.style.left = x + 'px'
120 - // dom.style.top = y + "px";
121 - this.blockDom.style.left = x + 'px'
122 - }
123 -
124 - const up = () => {
125 - document.removeEventListener('touchmove', move)
126 - document.removeEventListener('touchend', up)
127 - dom.style.left = ''
128 -
129 - // console.log(x, checkx)
130 - const max = checkx - 5
131 - const min = checkx - 15
132 - // 允许正负误差1
133 - if ((max >= x && x >= min) || x === checkx) {
134 - this.tips = '验证成功'
135 - this.$emit('done', this.options.type)
136 - } else {
137 - this.tips = '验证失败,请重试'
138 - this.blockDom.style.left = 0
139 - this.canvasInit()
140 - }
141 - }
142 -
143 - document.addEventListener('touchmove', move)
144 - document.addEventListener('touchend', up)
145 - },
146 -
147 - // 拼图验证码初始化
148 - canvasInit() {
149 - // 生成指定区间的随机数
150 - const random = (min, max) => {
151 - return Math.floor(Math.random() * (max - min + 1) + min)
152 - }
153 - // x: 254, y: 109
154 - const mx = random(127, 230)
155 - const bx = random(10, 128)
156 - const y = random(10, 99)
157 -
158 - this.slider = { mx, bx }
159 -
160 - this.draw(mx, bx, y)
161 - },
162 -
163 - draw(mx = 200, bx = 20, y = 50) {
164 - const bg = this.mainDom.getContext('2d')
165 - const block = this.blockDom.getContext('2d')
166 -
167 - const width = this.mainDom.width
168 - const height = this.mainDom.height
169 -
170 - // 重新赋值,让canvas进行重新绘制
171 - this.blockDom.height = height
172 - this.mainDom.height = height
173 - this.mainDom.width = width
174 - // 随机背景图片
175 - const randomImg = () => {
176 - const num = Math.floor(Math.random() * this.imgList.length)
177 - return this.imgList[num]
178 - }
179 -
180 - const imgsrc = randomImg()
181 - const img = document.createElement('img')
182 - img.style.objectFit = 'scale-down'
183 - img.src = imgsrc
184 - img.onload = () => {
185 - bg.drawImage(img, 0, 0, width, height)
186 - block.drawImage(img, 0, 0, width, height)
187 - const ImageData = block.getImageData(mx, y, width, height)
188 - block.putImageData(ImageData, 0, y)
189 - }
190 -
191 - const mainxy = { x: mx, y: y, r: 9 }
192 - const blockxy = { x: mx, y: y, r: 9 }
193 - this.drawBlock(bg, mainxy, 'fill')
194 - this.drawBlock(block, blockxy, 'clip')
195 - },
196 -
197 - // 绘制拼图
198 - drawBlock(ctx, xy = { x: 254, y: 109, r: 9 }, type) {
199 - const x = xy.x
200 - const y = xy.y
201 - const r = xy.r
202 - const w = 40
203 - const PI = Math.PI
204 - // 绘制
205 - ctx.beginPath()
206 - // left
207 - // ctx.moveTo(x, y)
208 - // top
209 - ctx.arc(x + (w + 5) / 2, y, r, -PI, 0.15, true)
210 - ctx.lineTo(x + w + 5, y)
211 - // right
212 - ctx.arc(x + w + 5, y + w / 2, r, 1.5 * PI, 0.5 * PI, false)
213 - ctx.lineTo(x + w + 5, y + w)
214 - // bottom
215 - ctx.arc(x + (w + 5) / 2, y + w, r, 0, PI, false)
216 - ctx.lineTo(x, y + w)
217 - ctx.arc(x, y + w / 2, r, 0.5 * PI, 1.5 * PI, true)
218 - ctx.lineTo(x, y)
219 - // 修饰,没有会看不出效果
220 - ctx.lineWidth = 1
221 - ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'
222 - ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)'
223 - ctx.stroke()
224 - ctx[type]()
225 - ctx.globalCompositeOperation = 'xor'
226 - }
227 - }
228 -}
229 -</script>
230 -
231 -<style scoped lang="less">
232 -.sliderModel {
233 - position: fixed;
234 - left: 0;
235 - top: 0;
236 - width: 100%;
237 - height: 100%;
238 - background: rgba(0, 0, 0, 0.5);
239 - display: flex;
240 - justify-content: center;
241 - align-items: center;
242 -}
243 -
244 -.title {
245 - width: 100%;
246 - height: 60px;
247 - font-size: 18px;
248 - color: #333;
249 - display: flex;
250 - align-items: center;
251 - justify-content: center;
252 -}
253 -
254 -.cont {
255 - position: relative;
256 - background: #fff;
257 - width: 300px;
258 - border-radius: 8px;
259 - overflow: hidden;
260 - padding-bottom: 10px;
261 -}
262 -
263 -.imgWrap {
264 - position: relative;
265 - width: 280px;
266 - height: 150px;
267 - margin: 0 auto;
268 - overflow: hidden;
269 -
270 - .code-img,
271 - .slider-block {
272 - border-radius: 8px;
273 - height: inherit;
274 - }
275 -
276 - .code-img {
277 - width: 280px;
278 - margin: 0 auto;
279 - }
280 -
281 - .slider-block {
282 - position: absolute;
283 - z-index: 4000;
284 - left: 0;
285 - }
286 -}
287 -
288 -.slider-refresh {
289 - font-size: 14px;
290 - position: absolute;
291 - top: 20px;
292 - right: 20px;
293 - cursor: pointer;
294 - color: green;
295 -
296 - span {
297 - padding: 0 2px;
298 - }
299 -}
300 -
301 -.img {
302 - display: block;
303 - width: 100%;
304 - height: 100%;
305 -}
306 -
307 -.sliderOver {
308 - position: absolute;
309 - left: 0;
310 - top: 0;
311 - width: 50px;
312 - height: 50px;
313 - background: #ddd;
314 - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
315 -}
316 -
317 -.smartImg {
318 - position: absolute;
319 - z-index: 2;
320 - left: 0;
321 - top: 0;
322 - width: 50px;
323 - height: 50px;
324 - overflow: hidden;
325 - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
326 -}
327 -
328 -.simg {
329 - position: absolute;
330 - display: block;
331 - width: 280px;
332 - height: 150px;
333 -}
334 -
335 -.sliderBox {
336 - width: 280px;
337 - margin: 15px auto 0;
338 - height: 36px;
339 - position: relative;
340 -}
341 -
342 -.sliderF {
343 - width: 100%;
344 - height: 100%;
345 - z-index: 3;
346 -}
347 -
348 -.sliderS {
349 - cursor: pointer;
350 - position: absolute;
351 - left: 0;
352 - top: 0;
353 - z-index: 2;
354 - height: 36px;
355 - width: 36px;
356 - border-radius: 36px;
357 - display: flex;
358 - justify-content: center;
359 - align-items: center;
360 -}
361 -
362 -.icon {
363 - width: 20px;
364 - height: 20px;
365 -}
366 -
367 -.bgC {
368 - position: absolute;
369 - z-index: 1;
370 - left: 0;
371 - top: 50%;
372 - transform: translateY(-50%);
373 - width: 100%;
374 - height: 30px;
375 - border-radius: 30px;
376 - line-height: 30px;
377 - font-size: 14px;
378 - color: #999999;
379 - box-shadow: inset 0 0 4px #ccc;
380 - text-align: center;
381 - overflow: hidden;
382 -}
383 -
384 -.bgC_left {
385 - position: absolute;
386 - left: 0px;
387 - top: 50%;
388 - transform: translateY(-50%);
389 - width: 0;
390 - height: 28px;
391 - border-top-left-radius: 28px;
392 - border-bottom-left-radius: 28px;
393 - line-height: 28px;
394 - font-size: 14px;
395 - background-color: #eee;
396 - box-shadow: inset 0 0 4px #ccc;
397 - text-align: center;
398 -}
399 -
400 -.showMessage {
401 - text-align: center;
402 - font-size: 14px;
403 - height: 30px;
404 - line-height: 30px;
405 -}
406 -
407 -#closeBtn {
408 - position: fixed;
409 - z-index: 10;
410 - bottom: 10px;
411 - left: 50%;
412 -}
413 -
414 -.btn {
415 - width: 36px;
416 - height: 36px;
417 - position: absolute;
418 - border: 1px solid #ccc;
419 - cursor: move;
420 - font-family: "宋体";
421 - text-align: center;
422 - line-height: 36px;
423 - background-color: #fff;
424 - user-select: none;
425 - color: #666;
426 - font-size: 16px;
427 -}
428 -</style>
1 -<!--
2 - * @Date: 2022-06-20 11:35:50
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-21 19:10:41
5 - * @FilePath: /tswj/src/components/LocalismBox/index.vue
6 - * @Description: 调整作品方言弹框组件
7 --->
8 -<template>
9 - <van-overlay :show="show" z-index="1000" :lock-scroll="false">
10 - <div class="wrapper" @click.stop>
11 - <div class="block">
12 - <div class="close">
13 - <van-icon name="close" color="#FFFFFF" @click="handleClose" />
14 - </div>
15 - <div class="localism-title">{{ title }}</div>
16 - <div id="localism-list" class="localism-list">
17 - <div v-for="(item, index) in localismList" :id="item.id" :key="index"
18 - :class="[item.checked ? 'checked' : 'unchecked', 'van-hairline--top-bottom', 'localism-item']"
19 - @click="setLocalism(item.id)">
20 - {{ item.localism }}
21 - </div>
22 - <div v-show="show_localism" id="localism-bottom" class="van-hairline--top-bottom localism-item">
23 - <input v-model="localism_name" placeholder="请输入新增的方言名称" style="border: 0; text-align: center;"
24 - @blur="onBlur">
25 - </div>
26 - </div>
27 - <div class="bar">
28 - <div class="button">
29 - <my-button type="plain" @on-click="addLocalism">新增方言</my-button>
30 - </div>
31 - <div class="button">
32 - <my-button type="primary" @on-click="handleSubmit">确定</my-button>
33 - </div>
34 - </div>
35 - </div>
36 - </div>
37 - </van-overlay>
38 -</template>
39 -
40 -<script setup>
41 -import { ref, watch, nextTick } from 'vue'
42 -import MyButton from '@/components/MyButton/index.vue'
43 -import { localismListModiAPI, addLocalismAPI, modifyProdLocalismAPI } from '@/api/B/localism'
44 -import { Toast, Dialog } from '@/utils/generatePackage.js'
45 -
46 -const props = defineProps({
47 - showLocalism: Boolean,
48 - id: Number,
49 - localism: String,
50 - title: String,
51 -})
52 -const emit = defineEmits(['on-close', 'on-submit']);
53 -/**
54 - * 滚动到指定位置
55 - * @param {*} id
56 - */
57 -const scrollToDom = (id) => {
58 - nextTick(() => {
59 - document.getElementById(id)?.scrollIntoView({ block: 'center' });
60 - })
61 -}
62 -
63 -// 处理语言列表数据
64 -let localismList = ref([]);
65 -const raw_id = ref('')
66 -const getLocalismList = async () => {
67 - const { data } = await localismListModiAPI();
68 - localismList.value = data.map((item) => ({ id: item, localism: item, checked: false }))
69 - localismList.value.forEach((item) => {
70 - if (item.localism === props.localism) {
71 - item.checked = true;
72 - raw_id.value = item.id
73 - }
74 - });
75 - scrollToDom(props.localism);
76 -}
77 -
78 -let show = ref(false);
79 -watch(() => props.showLocalism, (v) => {
80 - show.value = v;
81 - if (v) {
82 - getLocalismList()
83 - }
84 -})
85 -
86 -// 点击行选择方言
87 -const setLocalism = (v) => {
88 - localismList.value.forEach((item) => {
89 - item.checked = false;
90 - });
91 - localismList.value.forEach((item) => {
92 - if (item.id === v) {
93 - item.checked = true;
94 - }
95 - });
96 -}
97 -
98 -// 新增方言
99 -const show_localism = ref(false)
100 -const localism_name = ref('')
101 -
102 -const addLocalism = () => { // 滚动到底部,显示新增输入框
103 - show_localism.value = true;
104 - const id = localismList.value[localismList.value.length - 1]['id'];
105 - scrollToDom(id);
106 -}
107 -
108 -const onBlur = () => { // 失焦保存录入方言
109 - if (!localism_name.value) return false;
110 - Dialog.confirm({
111 - title: '温馨提示',
112 - message: `是否确认新增${localism_name.value}?`,
113 - confirmButtonColor: '#11D2B1'
114 - })
115 - .then(async () => {
116 - const { code } = await addLocalismAPI({ localism_name: localism_name.value });
117 - if (code) {
118 - Toast.success('新增成功!');
119 - localismList.value.forEach((item) => {
120 - item.checked = false;
121 - });
122 - localismList.value.push({ id: localism_name.value, localism: localism_name.value, checked: true });
123 - scrollToDom(localism_name.value);
124 - }
125 - show_localism.value = false;
126 - localism_name.value = '';
127 - })
128 - .catch(() => {
129 - // on cancel
130 - });
131 -}
132 -
133 -const clearAll = () => {
134 - show.value = false
135 - show_localism.value = false
136 - localismList.value = []
137 - localism_name.value = ''
138 -}
139 -
140 -const handleClose = () => { // 关闭提示框回调
141 - clearAll();
142 - emit('on-close', false)
143 -}
144 -
145 -const handleSubmit = () => { // 提交选择方言
146 - const localism = localismList.value.filter((item) => item.checked === true);
147 - // 原始和提交不一致请求接口提交
148 - if (raw_id.value !== localism[0].id) {
149 - Dialog.confirm({
150 - title: '温馨提示',
151 - message: `是否确认设置方言为${localism[0].id}?`,
152 - confirmButtonColor: '#11D2B1'
153 - })
154 - .then(async () => {
155 - const { code } = await modifyProdLocalismAPI({ prod_id: props.id, localism_name: localism[0].id });
156 - if (code) {
157 - Toast.success('更新成功!');
158 - clearAll();
159 - emit('on-submit', localism[0].id);
160 - }
161 - })
162 - .catch(() => {
163 - // on cancel
164 - });
165 - } else {
166 - clearAll();
167 - emit('on-submit', raw_id.value);
168 - }
169 -}
170 -</script>
171 -
172 -<style lang="less" scoped>
173 -.wrapper {
174 - display: flex;
175 - align-items: center;
176 - justify-content: center;
177 - height: 100%;
178 - width: auto;
179 - text-align: center;
180 -}
181 -
182 -.block {
183 - width: 80%;
184 - // height: 25rem;
185 - background-color: #fff;
186 - border-radius: 10px;
187 - padding: 1rem 0;
188 - position: relative;
189 - margin-top: 1rem;
190 - margin-bottom: 5rem;
191 - .close {
192 - position: absolute;
193 - top: -2rem;
194 - right: 1rem;
195 - font-size: 1.5rem;
196 - }
197 -}
198 -.localism-title {
199 - font-size: 1.05rem;
200 -}
201 -.localism-list {
202 - margin-top: 2rem;
203 - height: 20rem;
204 - overflow: scroll;
205 -}
206 -
207 -.bar {
208 - display: flex;
209 - align-items: center;
210 - box-sizing: content-box;
211 - background-color: white;
212 - padding: 0.7rem;
213 -
214 - .button {
215 - display: flex;
216 - flex-direction: column;
217 - justify-content: center;
218 - flex: 1;
219 - padding: 0 0.5rem;
220 - }
221 -}
222 -
223 -.localism-item {
224 - padding: 1rem;
225 - text-align: center;
226 -}
227 -.checked {
228 - color: #11d2b1;
229 -}
230 -.unchecked {
231 - color: gray;
232 -}
233 -input::-webkit-input-placeholder {
234 - color: #B0B0B0;
235 -}
236 -</style>
1 -<template>
2 - <div class="login-section">
3 - <van-config-provider :theme-vars="themeVars">
4 - <van-form ref="form" @submit="onSubmit">
5 - <van-cell-group inset style="border: 1px solid #EAEAEA;">
6 - <van-field v-if="use_widget" v-model="phone" name="phone" label="手机号" placeholder="手机号" readonly clickable
7 - :rules="[{ validator, message: '请输入正确手机号' }]"
8 - @touchstart.stop="showKeyboard" />
9 - <van-field v-else v-model="phone" name="phone" label="手机号" placeholder="手机号"
10 - :rules="[{ validator, message: '请输入正确手机号' }]" />
11 - <van-field v-model="code" center clearable name="code" type="digit" label="短信验证码" placeholder="请输入短信验证码"
12 - :formatter="formatter" :rules="[{ required: true, message: '请填写验证码' }]">
13 - <template #button>
14 - <van-button @click="sendCode" v-if="countDown.current.value.total === limit" size="small" type="primary"
15 - :disabled="disabled">
16 - <span>发送验证码</span>
17 - </van-button>
18 - <van-button v-else size="small" type="primary" :disabled="disabled">
19 - <span>{{ countDown.current.value.seconds }} 秒重新发送</span>
20 - </van-button>
21 - </template>
22 - </van-field>
23 - </van-cell-group>
24 - </van-form>
25 - </van-config-provider>
26 - </div>
27 -
28 - <van-number-keyboard v-model="phone" :show="keyboard_show" :maxlength="11" @blur="onBlur" />
29 -
30 - <!-- 图片滑块验证 -->
31 - <image-slider-verify :isShow="sliderShow" @done="handleConfirm" @on-close="handleClose">
32 - </image-slider-verify>
33 -</template>
34 -
35 -<script setup>
36 -import ImageSliderVerify from '@/components/ImageSliderVerify/index.vue'
37 -
38 -import { ref, onMounted } from 'vue'
39 -import { useRoute, useRouter } from 'vue-router'
40 -import { useCountDown } from '@vant/use';
41 -import { wxInfo } from '@/utils/tools';
42 -import { styleColor } from '@/constant.js';
43 -
44 -import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
45 -//import { } from '@/utils/generateModules.js'
46 -//import { } from '@/utils/generateIcons.js'
47 -//import { } from '@/composables'
48 -const $route = useRoute();
49 -const $router = useRouter();
50 -
51 -const emit = defineEmits(['on-submit'])
52 -
53 -const form = ref(null);
54 -
55 -const submit = () => {
56 - let valid = form.value.validate();
57 - valid
58 - .then(() => {
59 - form.value.submit();
60 - })
61 - .catch(error => {
62 - console.error(error);
63 - Toast({
64 - message: '请检查后再次提交',
65 - icon: 'cross',
66 - });
67 - })
68 -}
69 -
70 -defineExpose({
71 - submit
72 -})
73 -
74 -const themeVars = {
75 - buttonPrimaryBackground: styleColor.baseColor,
76 - buttonPrimaryBorderColor: styleColor.baseColor,
77 - buttonPrimaryColor: styleColor.baseFontColor,
78 - CellVerticalPadding: '14px'
79 -};
80 -
81 -const onSubmit = () => {
82 - emit('on-submit', {
83 - phone: phone.value,
84 - code: code.value,
85 - })
86 -}
87 -
88 -// 判断是否显示控件
89 -let use_widget = ref(true);
90 -/**
91 - * 手机号码校验
92 - * 函数返回 true 表示校验通过,false 表示不通过
93 - * @param {*} val
94 - */
95 -const validator = (val) => {
96 - let flag = false;
97 - // 简单判断手机号位数
98 - if (/1\d{10}/.test(val) && phone.value.length === 11) {
99 - disabled.value = false;
100 - flag = true;
101 - } else {
102 - disabled.value = true;
103 - flag = false;
104 - }
105 - return flag
106 -};
107 -
108 -
109 -const phone = ref('');
110 -const code = ref('');
111 -// TAG: 开发环境测试数据
112 -if (import.meta.env.DEV) {
113 - phone.value = import.meta.env.VITE_ID
114 - code.value = import.meta.env.VITE_PIN
115 -}
116 -
117 -onMounted(() => {
118 - /**
119 - * 判断微信环境看是否弹出控件框
120 - * 桌面微信直接输入
121 - * 其他环境弹出输入框
122 - */
123 - if (wxInfo().isiOS || wxInfo().isAndroid) {
124 - use_widget.value = true;
125 - } else {
126 - use_widget.value = false;
127 - }
128 - // 判断微信授权状态,进入页面时未授权需要授权跳转
129 - if (!Cookies.get('PHPSESSID')) {
130 - $router.replace({
131 - path: '/auth',
132 - query: {
133 - href: location.hash,
134 - userType: 'b'
135 - }
136 - });
137 - }
138 -})
139 -
140 -// 手机号输入控件控制
141 -const keyboard_show = ref(false);
142 -const showKeyboard = () => { // 弹出数字弹框
143 - keyboard_show.value = true;
144 -};
145 -const onBlur = () => { // 数字键盘失焦回调
146 - keyboard_show.value = false;
147 - if (phone.value.length === 11) {
148 - disabled.value = false;
149 - }
150 -};
151 -
152 -// 设置发送短信倒计时
153 -// TAG: vant 自带倒计时函数
154 -const limit = ref(60000); // 配置倒计时秒数
155 -const countDown = useCountDown({
156 - // 倒计时 24 小时
157 - time: limit.value,
158 - onFinish: () => {
159 - countDown.reset();
160 - }
161 -});
162 -
163 -const sendCode = () => { // 发送验证码
164 - countDown.start();
165 - axios.post('/srv/?a=bind_phone&t=get_code', {
166 - phone: phone.value
167 - })
168 - .then(res => {
169 - if (res.data.code === 1) {
170 - Toast.success('发送成功');
171 - } else {
172 - console.warn(res.data);
173 - if (!res.data.show) return false;
174 - Toast({
175 - message: res.data.msg,
176 - icon: 'close',
177 - });
178 - }
179 - })
180 - .catch(err => {
181 - console.error(err);
182 - })
183 -};
184 -
185 -const disabled = ref(true);
186 -// 过滤输入的数字 只能四位
187 -const formatter = (value) => value.substring(0, 4);
188 -
189 -// 滑块验证成功后回调
190 -const sliderShow = ref(false);
191 -const handleConfirm = (val) => {
192 - sliderShow.value = false
193 - console.warn('验证成功');
194 -}
195 -const handleClose = () => {
196 - sliderShow.value = false
197 -}
198 -const imageVerify = () => {
199 - sliderShow.value = true;
200 -}
201 -</script>
202 -
203 -<style lang="less" scoped>
204 -</style>
1 -<template>
2 - <login-box ref="form" @on-submit="onSubmit"></login-box>
3 - <div class="btn" @click="submit">
4 - 登&nbsp;录
5 - </div>
6 -</template>
7 -
8 -<script setup>
9 -import LoginBox from '@/components/LoginBox'
10 -import { onMounted, ref } from 'vue';
11 -import { useRoute, useRouter } from 'vue-router';
12 -
13 -import {
14 - Cookies,
15 - $,
16 - _,
17 - axios,
18 - storeToRefs,
19 - mainStore,
20 - Toast,
21 - useTitle,
22 -} from '@/utils/generatePackage.js';
23 -//import { } from '@/utils/generateModules.js'
24 -//import { } from '@/utils/generateIcons.js'
25 -//import { } from '@/composables'
26 -const $route = useRoute();
27 -const $router = useRouter();
28 -useTitle($route.meta.title);
29 -
30 -const form = ref(null);
31 -
32 -const submit = () => {
33 - form.value.submit();
34 -}
35 -
36 -const onSubmit = (values) => {
37 - axios.post('/srv/?a=b_login', {
38 - phone: values.phone,
39 - pin: values.code,
40 - })
41 - .then(res => {
42 - if (res.data.code === 1) {
43 - $router.push({
44 - path: '/business/index'
45 - });
46 - } else {
47 - console.warn(res.data);
48 - Toast({
49 - message: res.data.msg,
50 - icon: 'close',
51 - });
52 - }
53 - })
54 - .catch(err => {
55 - console.error(err);
56 - })
57 -};
58 -</script>
59 -
60 -<style
61 - lang="less"
62 - scoped>
63 -</style>
1 -<template>
2 - <div
3 - @click="goToDetail(item, $router)"
4 - class="banner">
5 - {{ item.kg_name }} | {{ item.localism_type }}
6 - </div>
7 -</template>
8 -
9 -<script setup>
10 -import { goToDetail } from './methods'
11 -const props = defineProps({
12 - item: Object,
13 -});
14 -</script>
15 -
16 -<style lang="less" scoped>
17 - .banner {
18 - color: #999999;
19 - padding: 0.5rem 1rem
20 - }
21 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-23 13:42:35
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-24 12:19:30
6 - * @FilePath: /tswj/src/components/MuiVideo/index.vue
7 - * @Description:
8 --->
9 -<template>
10 - <div class="video-wrapper">
11 - <div v-if="type === 'video'">
12 - <div :id="'mui-player-' + item.id" class="video-div" />
13 - </div>
14 - <div v-else>
15 - <status :item="item" />
16 - <div :id="'mui-player-' + item.id" class="video-div" />
17 - <video-bar :item="item" :bar-type="1" />
18 - <banner v-if="type === 'bookDetail'" :item="item" />
19 - </div>
20 - </div>
21 -</template>
22 -
23 -<script setup>
24 -/**
25 - * 视频组件通用模块
26 - */
27 -import 'mui-player/dist/mui-player.min.css';
28 -import MuiPlayer from 'mui-player';
29 -import { onMounted } from 'vue';
30 -import banner from './banner';
31 -import videoBar from './videoBar';
32 -import status from './status';
33 -import { useEventListener } from '@/composables';
34 -
35 -// 视频基础属性
36 -const props = defineProps({
37 - item: Object,
38 - type: String,
39 -});
40 -// 视频播放事件回调
41 -const emit = defineEmits(['on-play']);
42 -
43 -onMounted(() => {
44 - const mp = new MuiPlayer({
45 - container: '#mui-player-' + props.item.id,
46 - title: props.item.title,
47 - src: props.item.video,
48 - poster: props.item.cover,
49 - autoFit: false,
50 - videoAttribute: [
51 - // 声明启用同层播放, 不让会自动全屏播放
52 - { attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
53 - { attrKey: 'playsinline', attrValue: 'playsinline' },
54 - { attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
55 - ],
56 - });
57 - const video = mp.video();
58 - // 监听原生video事件
59 - useEventListener(video, 'play', (event) => {
60 - emit('on-play', {
61 - event,
62 - props: props.item,
63 - });
64 - });
65 - // 配置16:9高度比
66 - const width = document.getElementById('mui-player-' + props.item.id).clientWidth;
67 - const height = (width * 9) / 16;
68 - document.getElementById('mui-player-' + props.item.id).height = height;
69 -});
70 -</script>
71 -
72 -<style lang="less" scoped>
73 -.video-wrapper {
74 - position: relative;
75 - margin: 1rem 0;
76 - border-bottom-left-radius: 5px;
77 - border-bottom-right-radius: 5px;
78 - box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
79 -
80 - .video-div {
81 - border-top-left-radius: 5px;
82 - border-top-right-radius: 5px;
83 - }
84 -
85 - .video-bar {
86 - color: #713610;
87 - padding: 1rem;
88 - padding-bottom: 0.5rem;
89 -
90 - }
91 -}
92 -</style>
1 -/*
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-23 14:33:37
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-02 13:14:23
6 - * @FilePath: /tswj/src/components/MuiVideo/methods.js
7 - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8 - */
9 -import { prodActionAPI } from '@/api/C/prod.js'
10 -import { Toast } from 'vant';
11 -
12 -export const goToDetail = ({ id, book_id, type, perf_id }, $router) => {
13 - $router.push({
14 - path: '/client/videoDetail',
15 - query: {
16 - prod_id: id,
17 - book_id,
18 - type, // 特殊标识,判断入口 为keepAlive使用
19 - perf_id
20 - }
21 - });
22 -}
23 -
24 -export const setComment = ({ id, book_id }, $router) => {
25 - $router.push({
26 - path: '/client/videoDetail/comment',
27 - query: {
28 - prod_id: id,
29 - book_id
30 - }
31 - });
32 -}
33 -
34 -export const prodAction = async (action_type, prod_id) => {
35 - const { msg } = await prodActionAPI({ action_type, prod_id });
36 - if (msg === `${action_type}-add-OK`) { // 动作操作成功
37 - if (action_type === 'favor') {
38 - Toast('收藏成功');
39 - }
40 - if (action_type === 'like') {
41 - Toast('点赞成功');
42 - }
43 - } else { // 取消操作
44 - if (action_type !== 'play') {
45 - Toast('取消成功');
46 - }
47 - }
48 - return true;
49 -}
This diff is collapsed. Click to expand it.
1 -<template>
2 - <div class="status">
3 - <van-image v-if="item.status === 'enable'" round width="6rem" height="6rem" style="vertical-align: bottom;" :src="icon_enable" />
4 - <van-image v-if="item.status === 'disable'" round width="6rem" height="6rem" style="vertical-align: bottom;" :src="icon_refuse" />
5 - <van-image v-if="item.status === 'apply'" round width="6rem" height="6rem" style="vertical-align: bottom;" :src="icon_apply" />
6 - </div>
7 -</template>
8 -
9 -<script setup>
10 -import icon_refuse from '@images/icon-jujue@2x.png'
11 -import icon_apply from '@images/icon-shenhe@2x.png'
12 -import icon_enable from '@images/icon-tongguo@2x.png'
13 -
14 -const props = defineProps({
15 - item: Object,
16 -});
17 -</script>
18 -
19 -<style lang="less" scoped>
20 -.status {
21 - position: absolute;
22 - top: 0;
23 - right: 0;
24 - z-index: 999;
25 -}
26 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-23 18:00:39
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-02 17:41:38
6 - * @FilePath: /tswj/src/components/MuiVideo/test.vue
7 - * @Description: 视频播放通用组件演示组件
8 - * @Description: type: video 为纯视频播放框,bookDetail为定制模式
9 --->
10 -<template>
11 - <mui-video
12 - v-for="(item, index) in mock"
13 - :key="index"
14 - :item="item"
15 - type="video"
16 - @on-play="onPlay"
17 - />
18 -</template>
19 -
20 -<script setup>
21 - import mock from '@/components/MuiVideo/mock';
22 - import MuiVideo from '@/components/MuiVideo/index';
23 - import { ref } from 'vue';
24 - import { useRoute, useRouter } from 'vue-router';
25 -
26 - import {
27 - Cookies,
28 - $,
29 - _,
30 - axios,
31 - storeToRefs,
32 - mainStore,
33 - Toast,
34 - useTitle,
35 - } from '@/utils/generatePackage.js';
36 - //import { } from '@/utils/generateModules.js'
37 - //import { } from '@/utils/generateIcons.js'
38 - //import { } from '@/composables'
39 - const $route = useRoute();
40 - const $router = useRouter();
41 - useTitle($route.meta.title);
42 -
43 - const onPlay = ({ event, props }) => {
44 - console.warn(event);
45 - console.warn(props);
46 - };
47 -</script>
48 -
49 -<style
50 - lang="less"
51 - scoped></style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-23 14:30:57
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-07 15:26:03
6 - * @FilePath: /tswj/src/components/MuiVideo/videoBar.vue
7 - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8 --->
9 -<template>
10 - <div v-if="barType === 1" class="video-bar">
11 - <van-row>
12 - <van-col span="12" @click="goToDetail(item, $router)">
13 - <van-image round width="2rem" height="2rem" style="vertical-align: middle;"
14 - :src="item.avatar ? item.avatar : icon_avatar" />&nbsp;
15 - <span style="font-size: 1.05rem;vertical-align: middle;">{{ item.name }}</span>
16 - </van-col>
17 - <van-col span="12">
18 - <div style="padding: 0.25rem; padding-top: 0.75rem; text-align: right;">
19 - <span @click="setComment(item, $router)">
20 - <van-icon :name="icon_liuyan" size="1.2rem" style="vertical-align: bottom;" />
21 - {{ item.comment_num }}
22 - </span>
23 - &nbsp;&nbsp;&nbsp;
24 - <span @click="handleAction('like', detail.id)">
25 - <van-icon v-if="!detail.is_like" :name="icon_dianzan1" size="1.2rem" style="vertical-align: bottom;" />
26 - <van-icon v-else :name="icon_dianzan2" size="1.2rem" style="vertical-align: bottom;" />
27 - {{ detail.like_num }}
28 - </span>
29 - </div>
30 - </van-col>
31 - </van-row>
32 - </div>
33 - <div v-if="barType === 2" class="video-bar">
34 - <van-row style="text-align: center;">
35 - <van-col span="7">
36 - <span style="color: #777777;">
37 - {{ item.play_num }}次播放
38 - </span>
39 - </van-col>
40 - <van-col span="1" style="color: #EEEDED;">
41 - |
42 - </van-col>
43 - <van-col span="8">
44 - <span @click="handleAction('favor', detail.id)">
45 - <van-icon v-if="!detail.is_favor" :name="icon_shoucang1" size="1.2rem" style="vertical-align: bottom;" />
46 - <van-icon v-else :name="icon_shoucang2" size="1.2rem" style="vertical-align: bottom;" />
47 - {{ detail.favor_num }}
48 - </span>
49 - </van-col>
50 - <van-col span="1" style="color: #EEEDED;">
51 - |
52 - </van-col>
53 - <van-col span="7">
54 - <span @click="handleAction('like', detail.id)">
55 - <van-icon v-if="!detail.is_like" :name="icon_dianzan1" size="1.2rem" style="vertical-align: bottom;" />
56 - <van-icon v-else :name="icon_dianzan2" size="1.2rem" style="vertical-align: bottom;" />
57 - {{ detail.like_num }}
58 - </span>
59 - </van-col>
60 - </van-row>
61 - </div>
62 -</template>
63 -
64 -<script setup>
65 -import { icon_shoucang1, icon_shoucang2, icon_dianzan1, icon_dianzan2, icon_liuyan, icon_avatar } from '@/utils/generateIcons.js'
66 -
67 -import { ref } from 'vue';
68 -import { goToDetail, setComment, prodAction } from './methods';
69 -import _ from 'lodash';
70 -import { prodInfoAPI } from '@/api/C/prod.js'
71 -
72 -const props = defineProps({
73 - item: Object,
74 - barType: Number
75 -});
76 -
77 -const detail = ref({});
78 -detail.value = _.cloneDeep(props.item);
79 -
80 -const handleAction = async (type, id) => {
81 - if (await prodAction(type, id)) {
82 - getProductDetail(type, id)
83 - }
84 -}
85 -
86 -// 查询作品详情
87 -async function getProductDetail(action_type, prod_id) {
88 - const { data } = await prodInfoAPI({ prod_id });
89 - // 更新详情显示
90 - detail.value[`is_${action_type}`] = data[`is_${action_type}`];
91 - detail.value[`${action_type}_num`] = data[`${action_type}_num`];
92 -}
93 -
94 -</script>
95 -
96 -<style lang="less" scoped>
97 -.video-bar {
98 - color: #713610;
99 - padding: 1rem;
100 - padding-bottom: 0.5rem;
101 -}
102 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-04-21 10:04:58
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-18 19:28:22
6 - * @FilePath: /tswj/src/components/MyButton/index.vue
7 - * @Description:
8 --->
9 -<template>
10 - <div v-if="type === 'primary'" class="button-primary" @click="handle">
11 - <slot />
12 - </div>
13 - <div v-if="type === 'plain'" class="button-plain" @click="handle">
14 - <slot />
15 - </div>
16 - <div v-if="type === 'custom'" :style="customStyle" class="button-custom" @click="handle">
17 - <slot />
18 - </div>
19 -</template>
20 -
21 -<script setup>
22 -import { onMounted } from 'vue'
23 -const props = defineProps({
24 - type: String,
25 - customStyle: Object,
26 - disable: {
27 - type: Boolean,
28 - default: false
29 - }
30 -})
31 -const emit = defineEmits(['on-click']);
32 -const handle = () => {
33 - emit('on-click', '')
34 -}
35 - onMounted(() => {
36 -
37 - })
38 -</script>
39 -
40 -<script>
41 -export default {
42 - data () {
43 - return {
44 -
45 - }
46 - },
47 - mounted () {
48 -
49 - },
50 - methods: {
51 -
52 - }
53 -}
54 -</script>
55 -
56 -<style lang="less" scoped>
57 - .button-primary {
58 - width: auto;
59 - height: auto;
60 - text-align: center;
61 - padding: 0.6rem;
62 - margin: 0.5rem;
63 - font-size: 1rem;
64 - background: #colors[base-color];
65 - border-radius: 24px;
66 - border: 1px solid #colors[base-color];
67 - color: #colors[base-font-color];
68 - font-weight: bold;
69 - }
70 - .button-plain {
71 - width: auto;
72 - height: auto;
73 - text-align: center;
74 - padding: 0.6rem;
75 - margin: 0.5rem;
76 - font-size: 1rem;
77 - background: @base-font-color;
78 - border-radius: 24px;
79 - border: 1px solid @base-color;
80 - color: @base-color;
81 - font-weight: bold;
82 - }
83 - .button-custom {
84 - width: auto;
85 - height: auto;
86 - text-align: center;
87 - padding: 0.6rem;
88 - font-size: 1rem;
89 - border-radius: 24px;
90 - border: 1px solid;
91 - }
92 -</style>
1 -<template>
2 - <van-overlay :show="showNotice" z-index="1000">
3 - <div class="wrapper" @click.stop>
4 - <div class="block">
5 - <div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
6 - <van-icon name="close" color="#FFFFFF" @click="handleClose" />
7 - </div>
8 - <div>
9 - <van-image width="100" height="100" :src="icon_notice" />
10 - <p style="margin: 1rem; font-size: 1.15rem; font-weight: bold; color: #222222;">温馨提示</p>
11 - </div>
12 - <slot></slot>
13 - <div style="margin: 3rem 0;">
14 - <my-button @on-click="handleSubmit" type="primary">{{ text }}</my-button>
15 - </div>
16 - </div>
17 - </div>
18 - </van-overlay>
19 -</template>
20 -
21 -<script setup>
22 -import MyButton from '@/components/MyButton/index.vue'
23 -import icon_notice from '@images/que-tishi@2x.png'
24 -
25 -import { ref, reactive, onMounted } from 'vue'
26 -const props = defineProps({
27 - showNotice: Boolean,
28 - text: String
29 -})
30 -const emit = defineEmits(['on-close', 'on-submit']);
31 -
32 -let show = props.showNotice;
33 -
34 -const handleClose = () => { // 关闭提示框回调
35 - show = false
36 - emit('on-close', false)
37 -}
38 -// 底部按钮
39 -const handleSubmit = () => {
40 - emit('on-submit', false)
41 -}
42 -
43 -onMounted(() => {
44 -
45 -})
46 -</script>
47 -
48 -<script>
49 -export default {
50 - data() {
51 - return {
52 -
53 - }
54 - },
55 - mounted() {
56 -
57 - },
58 - methods: {
59 -
60 - }
61 -}
62 -</script>
63 -
64 -<style lang="less" scoped>
65 -.wrapper {
66 - display: flex;
67 - align-items: center;
68 - justify-content: center;
69 - height: 100%;
70 - width: auto;
71 - text-align: center;
72 -}
73 -
74 -.block {
75 - width: 80%;
76 - // height: 25rem;
77 - background-color: #fff;
78 - border-radius: 10px;
79 - padding: 1rem;
80 - position: relative;
81 - margin-top: 1rem;
82 - margin-bottom: 5rem;
83 -}
84 -</style>
...\ No newline at end of file ...\ No newline at end of file
1 -<!--
2 - * @Date: 2022-06-30 17:48:46
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-30 18:11:08
5 - * @FilePath: /tswj/src/components/NoticeOverlayTest/index.vue
6 - * @Description: 文件描述
7 --->
8 -<template>
9 - <van-overlay :show="showNotice" z-index="1000">
10 - <div class="wrapper" @click.stop>
11 - <div class="block">
12 - <div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
13 - <van-icon name="close" color="#FFFFFF" @click="handleClose" />
14 - </div>
15 - <div>
16 - <van-image width="100" height="100" :src="icon_notice" />
17 - <p style="margin: 1rem; font-size: 1.15rem; font-weight: bold; color: #222222;">温馨提示</p>
18 - </div>
19 - <div style="color: #333333;">
20 - <div v-html="noticeHtml" />
21 - </div>
22 - <div style="margin: 3rem 0;">
23 - <my-button type="primary" @on-click="handleSubmit">{{ noticeText }}</my-button>
24 - </div>
25 - </div>
26 - </div>
27 - </van-overlay>
28 -</template>
29 -
30 -<script setup>
31 -import MyButton from '@/components/MyButton/index.vue'
32 -import icon_notice from '@images/que-tishi@2x.png'
33 -import { USER_STATUS } from '@/constant'
34 -
35 -const props = defineProps({
36 - show: Boolean,
37 - type: {
38 - type: Number,
39 - default: -1,
40 - }
41 -})
42 -
43 -const emit = defineEmits(['on-close', 'on-submit']);
44 -
45 -const handleClose = () => { // 关闭提示框回调
46 - showNotice.value = false
47 - emit('on-close', false)
48 -}
49 -// 底部按钮
50 -const handleSubmit = () => {
51 - emit('on-submit', false)
52 -}
53 -
54 -const noticeText = ref('')
55 -const noticeHtml = ref('')
56 -const showNotice = ref(false)
57 -// 监听弹出框
58 -watch(() => props.show, (v) => {
59 - showNotice.value = v;
60 - if (props.type === USER_STATUS.NON_VERIFIED) {
61 - noticeText.value = '前往认证'
62 - noticeHtml.value = `
63 - <p>您还没有实名认证</p>
64 - <p>请前往个人中心进行实名认证</p>
65 - `
66 - } else if (props.type === USER_STATUS.NON_DEFAULT_CHILD) {
67 - noticeText.value = '前往新增'
68 - noticeHtml.value = `
69 - <p>您还没有新增儿童</p>
70 - <p>请前往个人中心进行新增</p>
71 - `
72 - }
73 -})
74 -</script>
75 -
76 -<style lang="less" scoped>
77 -.wrapper {
78 - display: flex;
79 - align-items: center;
80 - justify-content: center;
81 - height: 100%;
82 - width: auto;
83 - text-align: center;
84 -}
85 -
86 -.block {
87 - width: 80%;
88 - // height: 25rem;
89 - background-color: #fff;
90 - border-radius: 10px;
91 - padding: 1rem;
92 - position: relative;
93 - margin-top: 1rem;
94 - margin-bottom: 5rem;
95 -}
96 -</style>
1 -<!--
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-30 10:20:34
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-25 20:13:49
6 - * @FilePath: /tswj/src/components/RankingItem/index.vue
7 --->
8 -<template>
9 - <div class="wrapper">
10 - <van-row>
11 - <van-col span="2" class="rank">
12 - <div :class="[{ 'text': indexKey >= 3 }, { 'avatar': indexKey < 3 }]">
13 - <van-icon v-if="indexKey < 3" :name="iconRanking(indexKey)" size="1.75rem" />
14 - <span v-else>{{ indexKey + 1 }}&nbsp;</span>
15 - </div>
16 - </van-col>
17 - <van-col span="18" class="content-wrapper">
18 - <div :class="['height3rem', 'kg-name']" @click="go('/client/chooseBook', { kg_id: rankInfo.id })">
19 - <van-row align="center" justify="center" style="position: relative; top: 50%; transform: translateY(-50%);">
20 - <van-col span="4">
21 - <van-image round width="3rem" height="3rem" :src="rankInfo.logo ? rankInfo.logo : icon_logo"
22 - style="vertical-align: text-bottom;" />
23 - </van-col>
24 - <van-col span="20">
25 - <div v-if="rankInfo.multi_name" style="margin-left: 0.5rem;">
26 - <p>{{ rankInfo.multi_name[0] }}<br>{{ rankInfo.multi_name[1] }}</p>
27 - </div>
28 - <p v-else style="margin-left: 0.5rem;">
29 - {{ rankInfo.name }}
30 - </p>
31 - </van-col>
32 - </van-row>
33 - </div>
34 - </van-col>
35 - <van-col>
36 - <flower-icon type="right" :qty="rankInfo.qty" align="text-bottom"
37 - @click="go('/client/donateList', { kg_id: rankInfo.id })" />
38 - </van-col>
39 - </van-row>
40 - </div>
41 -</template>
42 -
43 -<script setup>
44 -import { icon_logo, icon_ranking1, icon_ranking2, icon_ranking3 } from '@/utils/generateIcons.js'
45 -
46 -import { ref } from 'vue'
47 -import _ from 'lodash'
48 -import FlowerIcon from '@/components/FlowerIcon'
49 -import { useGo } from '@/hooks/useGo'
50 -const go = useGo()
51 -
52 -const iconRanking = (index) => {
53 - switch (index) {
54 - case 0:
55 - return icon_ranking1
56 - case 1:
57 - return icon_ranking2
58 - case 2:
59 - return icon_ranking3
60 - default:
61 - return 0
62 - }
63 -}
64 -
65 -const onFlowerClick = (v) => {
66 - if (v) {
67 - go('/client/donateList', { kg_id: rankInfo.value.id })
68 - }
69 -}
70 -
71 -// eslint-disable-next-line no-unused-vars
72 -const props = defineProps({
73 - item: {
74 - type: Object,
75 - default(rawProps) {
76 - return rawProps
77 - }
78 - },
79 - indexKey: {
80 - type: Number,
81 - default(rawProps) {
82 - return rawProps
83 - }
84 - }
85 -})
86 -const emit = defineEmits(['on-icon-click']);
87 -const handle = () => {
88 - emit('on-icon-click', '')
89 -}
90 -const rankInfo = ref('');
91 -rankInfo.value = _.cloneDeep(props.item);
92 -// 有空格分割name
93 -if (rankInfo.value.name.indexOf(' ') > -1) {
94 - rankInfo.value.multi_name = rankInfo.value.name.split(' ');
95 -}
96 -</script>
97 -
98 -<style lang="less" scoped>
99 -.wrapper {
100 - margin: 1rem 0;
101 - background-color: #FFF;
102 - position: relative;
103 -
104 - .rank {
105 - position: relative;
106 -
107 - .avatar {
108 - position: absolute;
109 - top: 0;
110 - left: 20%;
111 - }
112 -
113 - .text {
114 - position: absolute;
115 - top: 0.5rem;
116 - left: 40%;
117 - color: #84909F;
118 - }
119 - }
120 - .content-wrapper {
121 - padding: 1rem 0.5rem 1rem 0;
122 - }
123 - .flower {
124 - text-align: center;
125 - position: absolute;
126 - top: 40%;
127 - right: 0.5rem;
128 - color: #713610;
129 - }
130 -
131 - .kg-name {
132 - position: relative;
133 - height: 3rem;
134 - }
135 -
136 - .height3rem {
137 - height: 3rem;
138 - }
139 -
140 - .height6rem {
141 - height: 6rem;
142 - }
143 -}
144 -</style>
1 -<template>
2 - <div class="wrapper">
3 - <div class="w-image">
4 - <van-image class="van-hairline--surround avatar" round :src="avatar ? avatar : icon_avatar">
5 - <template #error>加载失败</template>
6 - </van-image>
7 - </div>
8 - <div class="text-wrapper">
9 - <van-row align="center" justify="center" class="center-content">
10 - <van-col span="20" style="color: #713610;">
11 - <slot />
12 - </van-col>
13 - <van-col span="4" style="text-align: center;" @click="handle">
14 - <van-icon name="arrow" color="#c5c5c5" size="1.25rem" />
15 - </van-col>
16 - </van-row>
17 - </div>
18 - </div>
19 -</template>
20 -
21 -<script setup>
22 -import icon_avatar from '@images/que-logo@2x.png'
23 -
24 -// eslint-disable-next-line no-unused-vars
25 -const props = defineProps({
26 - avatar: {
27 - type: String,
28 - default: ''
29 - }
30 -})
31 -const emit = defineEmits(['on-icon-click']);
32 -const handle = () => {
33 - emit('on-icon-click', '')
34 -}
35 -</script>
36 -
37 -<style lang="less" scoped>
38 -.wrapper {
39 - position: relative;
40 - background-color: #fff;
41 - margin: 2rem;
42 - margin-right: 0;
43 - margin-left: 4rem;
44 - height: 4rem;
45 - box-shadow: 0px 0px 4px 0px rgba(73, 156, 255, 0.2);
46 -
47 - .w-image {
48 - width: 4rem;
49 - height: 4rem;
50 - border-radius: 50%;
51 - background-color: #FFF;
52 - position: absolute;
53 - left: -2rem;
54 -
55 - .avatar {
56 - position: absolute;
57 - left: 0.1rem;
58 - top: 0.1rem;
59 - width: 3.8rem;
60 - height: 3.8rem;
61 - }
62 - }
63 -
64 - .text-wrapper {
65 - height: 100%;
66 - text-align: left;
67 - // line-height: 4rem;
68 - padding-left: 3rem;
69 - .center-content{
70 - position: relative; top: 50%; transform: translateY(-50%);
71 - }
72 - }
73 -}
74 -</style>
1 -<!--
2 - * @Date: 2022-05-11 11:19:14
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-24 13:19:43
5 - * @FilePath: /tswj/src/components/ShortcutFixed/index.vue
6 - * @Description: 文件描述
7 --->
8 -<template>
9 - <div class="shortcut-page" :style="customStyle">
10 - <van-image v-if="isHome" class="icon-box" :src="icon_home" @click="toHome" />
11 - <van-image v-if="isMe" class="icon-box" :src="icon_me" @click="toMe" />
12 - <van-image v-if="isRank" class="icon-box" :src="icon_rank" @click="toRank" />
13 - </div>
14 -</template>
15 -
16 -<script setup>
17 -import Cookies from 'js-cookie'
18 -import { icon_me, icon_home, icon_rank } from '@/utils/generateIcons.js'
19 -</script>
20 -
21 -<script>
22 -// FIXME: VUE2写法
23 -export default {
24 - props: ['type', 'item', 'customStyle'],
25 - data() {
26 - return {
27 - userType: Cookies.get('userType') ? Cookies.get('userType') : ''
28 - }
29 - },
30 - computed: {
31 - isHome() {
32 - return this.item.indexOf('home') !== -1 ? true : false
33 - },
34 - isMe() {
35 - return this.item.indexOf('me') !== -1 ? true : false
36 - },
37 - isRank() {
38 - return this.item.indexOf('rank') !== -1 ? true : false
39 - },
40 - },
41 - mounted() {
42 - },
43 - methods: {
44 - toHome() {
45 - // 返回首页
46 - if (this.type === 'B') { // 服务端判断
47 - this.$router.push({
48 - path: '/business/index'
49 - });
50 - } else {
51 - // C 端返回首页需要判断是否,访客或客户
52 - switch (this.userType) {
53 - case 'visitor':
54 - this.$router.push({
55 - path: '/client/chooseBook'
56 - });
57 - break;
58 - case 'client':
59 - this.$router.push({
60 - path: '/client/chooseSchool'
61 - });
62 - break;
63 - default:
64 - this.$router.push({
65 - path: '/client/index'
66 - });
67 - break;
68 - }
69 - }
70 - },
71 - toMe() {
72 - if (this.type === 'B') { // 服务端判断
73 - this.$router.push({
74 - path: '/business/me'
75 - });
76 - } else {
77 - this.$router.push({
78 - path: '/me/index'
79 - });
80 - }
81 - },
82 - toRank () {
83 - this.$router.push({
84 - path: '/client/rankList',
85 - query: {
86 - kg_id: this.$route.query.kg_id
87 - }
88 - });
89 - }
90 - }
91 -}
92 -</script>
93 -
94 -<style lang="less" scoped>
95 -.shortcut-page {
96 - position: fixed;
97 - bottom: 18rem;
98 - right: 1rem;
99 - overflow: auto;
100 - z-index: 999;
101 - width: 3rem;
102 -}
103 -.icon-box {
104 - width: 3rem;
105 - height: 3rem;
106 - margin-bottom: 0.5rem;
107 -}
108 -</style>
1 -<template>
2 - <div class="video-wrapper">
3 - <div :id="'mui-player-' + item.id" class="video-div" />
4 - <div class="normal-module">
5 - <div class="video-bar">
6 - <van-row>
7 - <van-col span="15" @click="setComment">
8 - <van-image round width="2rem" height="2rem" class="avatar" :src="item.avatar ? item.avatar : icon_avatar" />
9 - <span class="text">{{ item.name }}</span>
10 - </van-col>
11 - <van-col span="9">
12 - <div style="padding: 0.25rem; padding-top: 0.5rem; text-align: right;">
13 - <span @click="setComment">
14 - <van-icon :name="icon_liuyan" size="1.2rem" style="vertical-align: bottom;" />
15 - {{ item.comment_num }}
16 - </span>
17 - &nbsp;&nbsp;&nbsp;
18 - <span @click="handleAction('like', detail.id)">
19 - <van-icon :name="!detail.is_like ? icon_dianzan1 : icon_dianzan2" size="1.2rem"
20 - style="vertical-align: bottom;" />
21 - {{ detail.like_num }}
22 - </span>
23 - </div>
24 - </van-col>
25 - </van-row>
26 - </div>
27 - <slot name="bookDetailSub" />
28 - </div>
29 - <div class="audit-module" />
30 - </div>
31 -</template>
32 -
33 -<script setup>
34 -/**
35 - * 视频组件通用模块
36 - */
37 -import { icon_dianzan1, icon_dianzan2, icon_liuyan, icon_avatar } from '@/utils/generateIcons.js'
38 -import { ref, onMounted } from 'vue'
39 -import { _, Toast } from '@/utils/generatePackage.js'
40 -import { useRouter } from 'vue-router'
41 -import 'mui-player/dist/mui-player.min.css'
42 -import MuiPlayer from 'mui-player'
43 -import { prodActionAPI, prodInfoAPI } from '@/api/C/prod.js'
44 -import { useDebounce } from '@/hooks/useDebounce.js'
45 -import { DEFAULT_COVER } from '@/constant'
46 -
47 -const $router = useRouter();
48 -const props = defineProps({
49 - item: {
50 - type: Object,
51 - default(rawProps) {
52 - return rawProps
53 - }
54 - }
55 -})
56 -
57 -// 作品用户操作
58 -/**
59 - * 两个请求顺序执行,处理直接写在请求函数里面似乎有点问题,get请求数据似乎无法顺利渲染显示
60 - */
61 -// TAG:防抖处理
62 -const handleAction = useDebounce(async (action_type, prod_id) => {
63 - const { msg } = await prodActionAPI({ action_type, prod_id });
64 - if (msg === `${action_type}-add-OK`) { // 动作操作成功
65 - if (action_type === 'favor') {
66 - Toast('收藏成功');
67 - }
68 - if (action_type === 'like') {
69 - Toast('点赞成功');
70 - }
71 - } else { // 取消操作,播放动作不提示
72 - if (action_type !== 'play') {
73 - Toast('取消成功');
74 - }
75 - }
76 - getProductDetail(action_type, prod_id); // 更新信息
77 -});
78 -
79 -// 查询作品详情
80 -const getProductDetail = async (action_type, prod_id) => {
81 - const { data } = await prodInfoAPI({ prod_id });
82 - // 更新详情显示
83 - detail.value[`is_${action_type}`] = data[`is_${action_type}`];
84 - detail.value[`${action_type}_num`] = data[`${action_type}_num`];
85 -}
86 -
87 -let detail = ref({});
88 -
89 -onMounted(() => {
90 - const mp = new MuiPlayer({
91 - container: '#mui-player-' + props.item.id,
92 - title: props.item.title,
93 - src: props.item.video,
94 - poster: props.item.cover ? props.item.cover : DEFAULT_COVER,
95 - // poster: DEFAULT_COVER,
96 - autoFit: false,
97 - videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
98 - { attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
99 - { attrKey: 'playsinline', attrValue: 'playsinline' },
100 - { attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
101 - ]
102 - })
103 - detail.value = _.cloneDeep(props.item);
104 - const video = mp.video();
105 - // 监听原生video事件
106 - video && video.addEventListener('play', function () {
107 - handleAction('play', props.item.id)
108 - });
109 - // 配置16:9高度比
110 - const width = document.getElementById('mui-player-' + props.item.id).clientWidth;
111 - const height = (width * 9) / 16;
112 - document.getElementById('mui-player-' + props.item.id).height = height;
113 -});
114 -
115 -const goTo = () => { // 跳转作品详情页
116 - $router.push({
117 - path: '/client/videoDetail',
118 - query: {
119 - prod_id: props.item.id,
120 - book_id: props.item.book_id,
121 - type: props.item.type, // 特殊标识,判断入口 为keepAlive使用
122 - perf_id: props.item.perf_id
123 - }
124 - });
125 -}
126 -
127 -const setComment = () => {
128 - $router.push({
129 - path: '/client/videoDetail/comment',
130 - query: {
131 - prod_id: props.item.id,
132 - book_id: props.item.book_id,
133 - type: props.item.type, // 特殊标识,判断入口 为keepAlive使用
134 - }
135 - });
136 -}
137 -
138 -</script>
139 -
140 -<style lang="less" scoped>
141 -.video-wrapper {
142 - margin: 1rem;
143 - border-bottom-left-radius: 5px;
144 - border-bottom-right-radius: 5px;
145 - box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
146 -
147 - .video-div {
148 - border-top-left-radius: 5px;
149 - border-top-right-radius: 5px;
150 - }
151 -
152 - .video-bar {
153 - color: #713610;
154 - padding: 1rem;
155 - padding-bottom: 0.5rem;
156 - .avatar {
157 - vertical-align: middle;
158 - }
159 - .text {
160 - font-size: 1.05rem;vertical-align: middle; display: inline-block; padding-left: 1rem;
161 - }
162 - }
163 -}
164 -</style>
1 -<template>
2 - <div class="video-wrapper">
3 - <div class="video-div" :id="'mui-player-' + item.id"></div>
4 - <div class="video-bar">
5 - <van-row style="text-align: center;">
6 - <van-col span="7">
7 - <span style="color: #777777;">
8 - {{ item.play_num }}次播放
9 - </span>
10 - </van-col>
11 - <van-col span="1" style="color: #EEEDED;">
12 - |
13 - </van-col>
14 - <van-col span="8">
15 - <span @click="handleAction('favor', detail.id)">
16 - <van-icon v-if="!detail.is_favor" :name="icon_shoucang1" size="1.2rem" style="vertical-align: bottom;" />
17 - <van-icon v-else :name="icon_shoucang2" size="1.2rem" style="vertical-align: bottom;" />
18 - {{ detail.favor_num }}
19 - </span>
20 - </van-col>
21 - <van-col span="1" style="color: #EEEDED;">
22 - |
23 - </van-col>
24 - <van-col span="7">
25 - <span @click="handleAction('like', detail.id)">
26 - <van-icon v-if="!detail.is_like" :name="icon_dianzan1" size="1.2rem" style="vertical-align: bottom;" />
27 - <van-icon v-else :name="icon_dianzan2" size="1.2rem" style="vertical-align: bottom;" />
28 - {{ detail.like_num }}
29 - </span>
30 - </van-col>
31 - </van-row>
32 - </div>
33 - </div>
34 -</template>
35 -
36 -<script setup>
37 -/**
38 - * 该组件是放在作品详情页头部
39 - */
40 -import icon_dianzan1 from '@images/icon-dianzan01@2x.png'
41 -import icon_dianzan2 from '@images/icon-dianzan02@2x.png'
42 -import icon_shoucang1 from '@images/icon-shoucang01@2x.png'
43 -import icon_shoucang2 from '@images/icon-shoucang02@2x.png'
44 -
45 -import 'mui-player/dist/mui-player.min.css'
46 -import MuiPlayer from 'mui-player'
47 -import _ from 'lodash';
48 -import { DEFAULT_COVER } from '@/constant'
49 -
50 -</script>
51 -
52 -<script>
53 -// FIXME: VUE2写法
54 -import mixin from 'common/mixin';
55 -
56 -export default {
57 - mixins: [mixin.likeFn],
58 - props: ['item'],
59 - data() {
60 - return {
61 - detail: {
62 - mp: ''
63 - }
64 - }
65 - },
66 - created() {
67 - },
68 - mounted() {
69 - setTimeout(() => {
70 - var mp = new MuiPlayer({
71 - container: '#mui-player-' + this.item.id,
72 - title: this.item.title,
73 - src: this.item.video,
74 - poster: this.item.cover ? this.item.cover : DEFAULT_COVER,
75 - // poster: DEFAULT_COVER,
76 - autoFit: false,
77 - videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
78 - {attrKey:'webkit-playsinline',attrValue:'webkit-playsinline'},
79 - {attrKey:'playsinline',attrValue:'playsinline'},
80 - {attrKey:'x5-video-player-type',attrValue:'h5-page'},
81 - ]
82 - })
83 - this.detail = _.cloneDeep(this.item);
84 - // 传回数据
85 - this.$emit('on-click', this.detail);
86 - this.mp = mp;
87 - var video = mp.video();
88 - // 监听原生video事件
89 - var _this = this;
90 - video && video.addEventListener('play', function (event) {
91 - _this.handleAction('play', _this.item.id)
92 - });
93 - }, 500)
94 - // 配置16:9高度比
95 - const width = document.getElementById('mui-player-' + this.item.id).clientWidth;
96 - const height = (width * 9) / 16;
97 - document.getElementById('mui-player-' + this.item.id).height = height;
98 - },
99 - methods: {
100 - }
101 -}
102 -</script>
103 -
104 -<style lang="less" scoped>
105 -.video-wrapper {
106 - .video-div {
107 - border-top-left-radius: 5px;
108 - border-top-right-radius: 5px;
109 - }
110 - .video-bar {
111 - color: #713610;
112 - padding: 1rem;
113 - padding-bottom: 0.5rem;
114 - }
115 -}
116 -</style>
1 -<template>
2 - <div></div>
3 -</template>
4 -
5 -<script setup>
6 -import { ref, reactive, onMounted } from 'vue'
7 -const props = defineProps({
8 - type: String
9 -})
10 -
11 - onMounted(() => {
12 -
13 - })
14 -</script>
15 -
16 -<script>
17 -export default {
18 - data () {
19 - return {
20 -
21 - }
22 - },
23 - mounted () {
24 -
25 - },
26 - methods: {
27 -
28 - }
29 -}
30 -</script>
31 -
32 -<style lang="less" scoped>
33 -</style>
...\ No newline at end of file ...\ No newline at end of file
1 -// ts script setup 写法
2 -<template>
3 - <div class="img-verify">
4 - <canvas ref="verify" :width="state.width" :height="state.height" @click="handleDraw" />
5 - </div>
6 -</template>
7 -
8 -<script setup lang="ts">
9 -import { reactive, onMounted, ref } from 'vue'
10 -
11 -const verify = ref({} as HTMLCanvasElement)
12 -const state = reactive({
13 - pool: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', // 字符串
14 - width: 120,
15 - height: 40,
16 - imgCode: ''
17 -})
18 -onMounted(() => {
19 - // 初始化绘制图片验证码
20 - state.imgCode = draw()
21 -})
22 -
23 -// 点击图片重新绘制
24 -const handleDraw = () => {
25 - state.imgCode = draw()
26 -}
27 -
28 -// 随机数
29 -const randomNum = (min: number, max: number) => {
30 - return parseInt((Math.random() * (max - min) + min + '') as string)
31 -}
32 -// 随机颜色
33 -const randomColor = (min: number, max: number) => {
34 - const r = randomNum(min, max)
35 - const g = randomNum(min, max)
36 - const b = randomNum(min, max)
37 - return `rgb(${r},${g},${b})`
38 -}
39 -
40 -// 绘制图片
41 -const draw = () => {
42 - // 3.填充背景颜色,背景颜色要浅一点
43 - const ctx = verify.value.getContext('2d') as any
44 - // 填充颜色
45 - ctx.fillStyle = randomColor(180, 230)
46 - // 填充的位置
47 - ctx.fillRect(0, 0, state.width, state.height)
48 - // 定义paramText
49 - let imgCode = ''
50 - // 4.随机产生字符串,并且随机旋转
51 - for (let i = 0; i < 4; i++) {
52 - // 随机的四个字
53 - const text = state.pool[randomNum(0, state.pool.length)]
54 - imgCode += text
55 - // 随机的字体大小
56 - const fontSize = randomNum(18, 40)
57 - // 字体随机的旋转角度
58 - const deg = randomNum(-30, 30)
59 - /*
60 - * 绘制文字并让四个文字在不同的位置显示的思路 :
61 - * 1、定义字体
62 - * 2、定义对齐方式
63 - * 3、填充不同的颜色
64 - * 4、保存当前的状态(以防止以上的状态受影响)
65 - * 5、平移translate()
66 - * 6、旋转 rotate()
67 - * 7、填充文字
68 - * 8、restore出栈
69 - * */
70 - ctx.font = fontSize + 'px Simhei'
71 - ctx.textBaseline = 'top'
72 - ctx.fillStyle = randomColor(80, 150)
73 - /*
74 - * save() 方法把当前状态的一份拷贝压入到一个保存图像状态的栈中。
75 - * 这就允许您临时地改变图像状态,
76 - * 然后,通过调用 restore() 来恢复以前的值。
77 - * save是入栈,restore是出栈。
78 - * 用来保存Canvas的状态。save之后,可以调用Canvas的平移、放缩、旋转、错切、裁剪等操作。 restore:用来恢复Canvas之前保存的状态。防止save后对Canvas执行的操作对后续的绘制有影响。
79 - *
80 - * */
81 - ctx.save()
82 - ctx.translate(30 * i + 15, 15)
83 - ctx.rotate((deg * Math.PI) / 180)
84 - // fillText() 方法在画布上绘制填色的文本。文本的默认颜色是黑色。
85 - // 请使用 font 属性来定义字体和字号,并使用 fillStyle 属性以另一种颜色/渐变来渲染文本。
86 - // context.fillText(text,x,y,maxWidth);
87 - ctx.fillText(text, -15 + 5, -15)
88 - ctx.restore()
89 - }
90 - // 5.随机产生5条干扰线,干扰线的颜色要浅一点
91 - for (let i = 0; i < 5; i++) {
92 - ctx.beginPath()
93 - ctx.moveTo(randomNum(0, state.width), randomNum(0, state.height))
94 - ctx.lineTo(randomNum(0, state.width), randomNum(0, state.height))
95 - ctx.strokeStyle = randomColor(180, 230)
96 - ctx.closePath()
97 - ctx.stroke()
98 - }
99 - // 6.随机产生40个干扰的小点
100 - for (let i = 0; i < 40; i++) {
101 - ctx.beginPath()
102 - ctx.arc(randomNum(0, state.width), randomNum(0, state.height), 1, 0, 2 * Math.PI)
103 - ctx.closePath()
104 - ctx.fillStyle = randomColor(150, 200)
105 - ctx.fill()
106 - }
107 - return imgCode
108 -}
109 -
110 -</script>
111 -<style type="text/css">
112 -.img-verify canvas {
113 - cursor: pointer;
114 -}
115 -</style>
1 -/*
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-17 12:13:13
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-12 22:50:29
6 - * @FilePath: /tswj/src/composables/index.js
7 - * @Description:
8 - */
9 -import { onMounted, onUnmounted } from 'vue'
10 -
11 -import { useVideoList } from '@/composables/useVideoList.js'
12 -import { useDefaultPerf } from '@/composables/useDefaultPerf.js'
13 -import { useBookList, useAsyncBookList } from '@/composables/useBookList.js'
14 -import { useShortcutBar } from '@/composables/useShortcutBar.js'
15 -import { useScrollTop } from '@/composables/useScrollTop.js'
16 -import { useMessageList } from '@/composables/useMessageList.ts'
17 -
18 -export {
19 - useVideoList,
20 - useDefaultPerf,
21 - useBookList,
22 - useAsyncBookList,
23 - useShortcutBar,
24 - useScrollTop,
25 - useMessageList,
26 -}
27 -
28 -/**
29 - * 添加和清除 DOM 事件监听器
30 - * @param {*} target
31 - * @param {*} event
32 - * @param {*} callback
33 - */
34 -export function useEventListener(target, event, callback) {
35 - onMounted(() => target?.addEventListener(event, callback))
36 - onUnmounted(() => target?.removeEventListener(event, callback))
37 -}
1 -/*
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-07 17:46:54
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-12 22:55:58
6 - * @FilePath: /tswj/src/composables/useBookList.js
7 - * @Description:
8 - */
9 -import { ref } from 'vue'
10 -import axios from '@/utils/axios';
11 -import { Toast } from 'vant';
12 -import { useRoute } from 'vue-router';
13 -import { kgBookListAPI } from '@/api/C/kg'
14 -
15 -export const useBookList = () => {
16 - const $route = useRoute();
17 - const emptyStatus = ref(false);
18 - // tslint:disable-next-line: variable-name
19 - const kg_id = $route.query.kg_id ? $route.query.kg_id : '';
20 - const kgInfo = ref({
21 - id: '',
22 - logo: '',
23 - name: '',
24 - multi_name: '',
25 - book_list: []
26 - });
27 - if (kg_id) { // 从学校列表进入
28 - axios.get('/srv/?a=kg_book_list', {
29 - params: {
30 - kg_id
31 - }
32 - })
33 - .then(res => {
34 - if (res.data.code === 1) {
35 - kgInfo.value = res.data.data;
36 - kgInfo.value.book_list.forEach(item => {
37 - item.show = true; // 默认显示所有,给搜索功能留的hook
38 - });
39 - // 有空格分割name
40 - if (kgInfo.value.name.indexOf(' ') > -1) {
41 - kgInfo.value.multi_name = kgInfo.value.name.split(' ');
42 - }
43 - if (!kgInfo.value.book_list.length) {
44 - emptyStatus.value = true;
45 - }
46 - } else {
47 - // tslint:disable-next-line: no-console
48 - console.warn(res);
49 - if (!res.data.show) return false;
50 - Toast({
51 - icon: 'close',
52 - message: res.data.msg
53 - });
54 - }
55 - })
56 - .catch(err => {
57 - // tslint:disable-next-line: no-console
58 - console.error(err);
59 - })
60 - } else { // 从访客进入
61 - axios.get('/srv/?a=book_list')
62 - .then(res => {
63 - if (res.data.code === 1) {
64 - res.data.data.forEach(item => {
65 - item.show = true; // 默认显示所有,给搜索功能留的hook
66 - });
67 - kgInfo.value = {
68 - book_list: res.data.data
69 - }
70 - if (!kgInfo.value.book_list.length) {
71 - emptyStatus.value = true;
72 - }
73 - } else {
74 - // tslint:disable-next-line: no-console
75 - console.warn(res);
76 - if (!res.data.show) return false;
77 - Toast({
78 - icon: 'close',
79 - message: res.data.msg
80 - });
81 - }
82 - })
83 - .catch(err => {
84 - // tslint:disable-next-line: no-console
85 - console.error(err);
86 - })
87 - }
88 - return {
89 - kg_id,
90 - kgInfo,
91 - emptyStatus
92 - }
93 -}
94 -
95 -// !!废弃方法
96 -// 前端使用方式过于复杂
97 -export const useAsyncBookList = async () => {
98 - const $route = useRoute();
99 - const emptyStatus = ref(false);
100 - // tslint:disable-next-line: variable-name
101 - const kg_id = $route.query.kg_id ? $route.query.kg_id : '';
102 - const kgInfo = ref({
103 - id: '',
104 - logo: '',
105 - name: '',
106 - multi_name: [],
107 - book_list: []
108 - });
109 - const { data } = await kgBookListAPI({ kg_id });
110 - if (data) kgInfo.value = data;
111 - kgInfo.value.book_list.forEach(item => {
112 - item.show = true; // 默认显示所有,给搜索功能留的hook
113 - });
114 - // 有空格分割name
115 - if (kgInfo.value.name.indexOf(' ') > -1) {
116 - kgInfo.value.multi_name = kgInfo.value.name.split(' ');
117 - }
118 - if (!kgInfo.value.book_list.length) {
119 - emptyStatus.value = true;
120 - }
121 - return {
122 - kg_id,
123 - kgInfo,
124 - emptyStatus
125 - }
126 -}
1 -/*
2 - * @Author: hookehuyr hookehuyr@gmail.com
3 - * @Date: 2022-05-18 14:31:26
4 - * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-05-30 10:18:19
6 - * @FilePath: /tswj/src/composables/useDefaultPerf.js
7 - * @Description:
8 - */
9 -import { ref } from 'vue'
10 -import axios from '@/utils/axios';
11 -import { Toast } from 'vant';
12 -
13 -/**
14 - * @description: 获取默认儿童信息
15 - * @param {*} bookId
16 - * @param {*} params
17 - * @param {*} avatar
18 - * @param {*} name
19 - * @param {*} price
20 - * @param {*} user_id
21 - * @param {*} perf_id
22 - * @param {*} perf_name
23 - * @param {*} can_upload
24 - * @param {*} can_upload
25 - * @param {*} can_upload
26 - * @param {*} message
27 - * @return {*}
28 - */
29 -export const useDefaultPerf = (bookId) => {
30 - // 金数据准备数据
31 - const userInfo = ref({})
32 -
33 - axios.get('/srv/?a=default_perf', {
34 - params: {
35 - book_id: bookId
36 - }
37 - })
38 - .then(res => {
39 - if (res.data.code === 1) {
40 - userInfo.value = {
41 - book_id: res.data.data.book_id,
42 - avatar: res.data.data.book_cover,
43 - name: res.data.data.book_name,
44 - price: res.data.data.book_price,
45 - user_id: res.data.data.user_id,
46 - perf_id: res.data.data.perf_id,
47 - perf_name: res.data.data.perf_name,
48 - can_upload: res.data.data.can_upload, // can_upload :1=可上传,-1=用户没有实名,-2=用户没有儿童表演者
49 - // can_upload: -1, // can_upload :1=可上传,-1=用户没有实名,-2=用户没有儿童表演者
50 - }
51 - } else {
52 - console.warn(res);
53 - if (!res.data.show) return false;
54 - Toast({
55 - icon: 'close',
56 - message: res.data.msg
57 - });
58 - }
59 - })
60 - .catch(err => {
61 - console.error(err);
62 - });
63 - return {
64 - userInfo
65 - }
66 -}
1 -/*
2 - * @Date: 2022-06-22 00:07:42
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-30 13:45:54
5 - * @FilePath: /tswj/src/composables/useLogin.js
6 - * @Description: 文件描述
7 - */
8 -import { bLoginAPI } from '@/api/B/login'
9 -import { useRouter } from 'vue-router'
10 -import { wxInfo } from '@/utils/tools';
11 -import { ref } from 'vue'
12 -import { useCountDown } from '@vant/use';
13 -import { smsAPI } from '@/api/common'
14 -import { Toast } from 'vant'
15 -
16 -export const useLogin = () => {
17 - const phone = ref('');
18 - const code = ref('')
19 -
20 - const refForm = ref(null);
21 - const validateForm = () => {
22 - const valid = refForm.value.validate();
23 - valid
24 - .then(() => {
25 - refForm.value.submit();
26 - })
27 - .catch(error => {
28 - console.error(error);
29 - Toast({
30 - message: '请检查后再次提交',
31 - icon: 'cross',
32 - });
33 - })
34 - }
35 -
36 - /**
37 - * 判断微信环境看是否弹出控件框
38 - * 桌面微信直接输入
39 - * 其他环境弹出输入框
40 - */
41 - let use_widget = ref(true);
42 - use_widget.value = !!(wxInfo().isiOS || wxInfo().isAndroid);
43 -
44 - /**
45 - * 手机号码校验
46 - * 函数返回 true 表示校验通过,false 表示不通过
47 - * @param {*} val
48 - */
49 - const sms_disabled = ref(true);
50 - const phoneValidator = (val) => {
51 - let flag = false;
52 - // 简单判断手机号位数
53 - if (/1\d{10}/.test(val) && phone.value.length === 11) {
54 - sms_disabled.value = false;
55 - flag = true;
56 - } else {
57 - sms_disabled.value = true;
58 - flag = false;
59 - }
60 - return flag
61 - };
62 -
63 - /**
64 - * 手机号数字弹框
65 - */
66 - const keyboard_show = ref(false);
67 - const refPhone = ref(null)
68 - const showKeyboard = () => { // 弹出数字弹框
69 - keyboard_show.value = true;
70 - };
71 - const keyboardBlur = () => { // 数字键盘失焦回调
72 - keyboard_show.value = false;
73 - refPhone.value.validate();
74 - };
75 -
76 - // 设置发送短信倒计时
77 - // TAG: vant 自带倒计时函数
78 - const limitSeconds = ref(60000); // 配置倒计时秒数
79 - const countDown = useCountDown({ // 配置倒计时
80 - time: limitSeconds.value,
81 - onFinish: () => {
82 - countDown.reset();
83 - }
84 - });
85 -
86 - const sendCode = async () => { // 发送验证码
87 - countDown.start();
88 - // 验证码接口
89 - const { code } = await smsAPI({ phone: phone.value });
90 - if (code) {
91 - Toast.success('发送成功');
92 - }
93 - };
94 -
95 - // 过滤输入的数字 只能四位
96 - const smsFormatter = (value) => value.substring(0, 4);
97 -
98 - /**
99 - * 用户登录
100 - * @param {*} phone
101 - * @param {*} pin
102 - */
103 - const $router = useRouter();
104 - const onSubmit = async (values) => {
105 - const { code } = await bLoginAPI({ phone: values.phone, pin: values.code })
106 - if (code) {
107 - $router.push({
108 - path: '/business/index'
109 - });
110 - }
111 - };
112 -
113 - return {
114 - phone,
115 - code,
116 - onSubmit,
117 - use_widget,
118 - sms_disabled,
119 - phoneValidator,
120 - keyboardBlur,
121 - keyboard_show,
122 - showKeyboard,
123 - refPhone,
124 - refForm,
125 - validateForm,
126 - smsFormatter,
127 - limitSeconds,
128 - countDown,
129 - sendCode,
130 - }
131 -}
1 -/*
2 - * @Date: 2022-06-12 22:51:21
3 - * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-06-13 01:01:33
5 - * @FilePath: /tswj/src/composables/useMessageList.ts
6 - * @Description: 测试处理列表查询功能中的重复代码问题
7 - * 感觉复用意义不大,这么写反而很麻烦
8 - */
9 -import { Ref, ref } from 'vue'
10 -import { myCommentAPI } from '@/api/C/me'
11 -import _ from 'lodash'
12 -import { commentListType } from '@/@types/message/interface';
13 -import {
14 - loading,
15 - finished,
16 - limit,
17 - offset,
18 - finishedTextStatus,
19 - emptyStatus,
20 -} from '@/composables/variable';
21 -
22 -// scrollList的类型是个麻烦,其他地方调用时类型不一定一样
23 -function fn(data: [], scrollList: Ref<commentListType[]>) {
24 -// function fn(data: [], scrollList: any) {
25 - // 数据全部加载完成
26 - if (!data.length) {
27 - // 加载状态结束
28 - finished.value = true;
29 - }
30 - scrollList.value = [...scrollList.value, ...data];
31 - offset.value = scrollList.value.length;
32 - loading.value = false;
33 - // 隐藏loading标识,空列表图标
34 - if (!scrollList.value.length) {
35 - finishedTextStatus.value = false;
36 - emptyStatus.value = true;
37 - } else {
38 - emptyStatus.value = false;
39 - }
40 -
41 - return {
42 - scrollList,
43 - finished,
44 - loading,
45 - finishedTextStatus,
46 - emptyStatus,
47 - };
48 -}
49 -
50 -export const useMessageList = () => {
51 - // 我的留言接口联调
52 - const scrollList = ref<commentListType[]>([]);
53 - let obj = {
54 - scrollList,
55 - finished,
56 - loading,
57 - finishedTextStatus,
58 - emptyStatus,
59 - };
60 -
61 - const onLoad = async () => {
62 - const { data } = await myCommentAPI({ limit: limit.value, offset: offset.value });
63 - data.forEach((item: { target_name: string | null | undefined; c_action: string; c_name: string; }) => {
64 - let arr = _.split(item.target_name, '@'); // 分割评论的动作和姓名
65 - item.c_action = arr[0]; // 评论动作
66 - item.c_name = arr[1]; // 评论姓名
67 - });
68 - // fn把重复代码抽离
69 - obj = fn(data, scrollList);
70 - }
71 -
72 - return {
73 - onLoad,
74 - scrollList: obj.scrollList,
75 - loading: obj.loading,
76 - finished: obj.finished,
77 - finishedTextStatus: obj.finishedTextStatus,
78 - emptyStatus: obj.emptyStatus,
79 - };
80 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.