diff --git a/.env b/.env
index 91b536c..beb75d4 100644
--- a/.env
+++ b/.env
@@ -8,3 +8,6 @@ VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/
VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync
VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken
VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com
+# VITE_APP_BASE_APPURL=https://ycsb-gw-uat.dcin-test.digitalyili.com
+# VITE_APP_APPKEY=62f495a0f7854e4e46ebbf40
+# VITE_APP_APPID=m5c66hlce3
diff --git a/.env.development b/.env.development
index b5cc42d..4a6493c 100644
--- a/.env.development
+++ b/.env.development
@@ -8,3 +8,6 @@ VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/
VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync
VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken
VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com
+# VITE_APP_BASE_APPURL=https://ycsb-gw-uat.dcin-test.digitalyili.com
+# VITE_APP_APPKEY=62f495a0f7854e4e46ebbf40
+# VITE_APP_APPID=m5c66hlce3
diff --git a/src/App.vue b/src/App.vue
index d1fd5a8..b9a868b 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,17 @@
diff --git a/src/api/common/index.js b/src/api/common/index.js
new file mode 100644
index 0000000..8dba855
--- /dev/null
+++ b/src/api/common/index.js
@@ -0,0 +1,10 @@
+import request from '@/utils/request.js';
+
+// 校验token返回用户信息
+export function getUserInfo(params) {
+ return request({
+ url: '/thirdPartyInterfaceInfoEx/test',
+ method: 'get',
+ params
+ });
+}
\ No newline at end of file
diff --git a/src/api/survey/index.js b/src/api/survey/index.js
new file mode 100644
index 0000000..5da858e
--- /dev/null
+++ b/src/api/survey/index.js
@@ -0,0 +1,34 @@
+import request from '@/utils/request';
+
+// 投放问卷
+export function publishSurvey(data) {
+ return request({
+ url: `/console/survey_publishes`,
+ method: 'post',
+ data
+ });
+}
+
+// 问卷详情
+export function getSurveyInfo(sn) {
+ return request({
+ url: `/console/surveys/${sn}`,
+ method: 'get'
+ });
+}
+
+// 查看二维码
+export function getQrcode(sn) {
+ return request({
+ url: `/console/survey_publishes/${sn}/qrcode`,
+ method: 'get'
+ });
+}
+
+// 获取问卷测试是否弹层
+export function getCheckSurvey(sn) {
+ return request({
+ url: `/console/check_survey_test/${sn}`,
+ method: 'get'
+ });
+}
\ No newline at end of file
diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss
index cb69b36..603da52 100644
--- a/src/assets/css/main.scss
+++ b/src/assets/css/main.scss
@@ -3,16 +3,6 @@
@import 'vant';
@import '../../fonts/moblie/iconfont.css';
-$theme-color: #70b936;
-
-::v-deep .theme-color {
- color: $theme-color;
-}
-
-::v-deep .theme-back-color {
- background-color: $theme-color;
-}
-
a,
.green {
padding: 3px;
diff --git a/src/assets/js/appBridge.js b/src/assets/js/appBridge.js
new file mode 100644
index 0000000..19ca426
--- /dev/null
+++ b/src/assets/js/appBridge.js
@@ -0,0 +1,289 @@
+export default {
+ /** ****************** ReactNative通信 ********************/
+ /**
+ * 生成唯一ID
+ * @returns {string} 唯一ID
+ */
+ generateUniqueId() {
+ return `cb_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
+ },
+ /**
+ * @desc 检查是否在ReactNative环境中
+ * @returns {Boolean} 是否在ReactNative WebView中
+ */
+ isInReactNative() {
+ return typeof window !== 'undefined' && !!window.ReactNativeWebView;
+ },
+
+ /**
+ * @desc 发送消息到ReactNative
+ * @param {Object} message 消息对象
+ * @returns {Boolean} 发送是否成功
+ */
+ postMessageToRN(data) {
+ if (!this.isInReactNative()) {
+ return false;
+ }
+ try {
+ window.ReactNativeWebView.postMessage(JSON.stringify(data));
+ return true;
+ } catch (error) {
+ return false;
+ }
+ },
+
+ /**
+ * @desc 控制头部导航栏显示/隐藏
+ * @param {Boolean} visible 是否显示导航栏
+ * @returns {Boolean} 操作是否成功
+ */
+ setHeaderShown(visible = false) {
+ return this.postMessageToRN({
+ type: 'headerShown',
+ visible
+ });
+ },
+
+ /**
+ * @desc 关闭当前页面,触发返回操作
+ * @returns {Boolean} 操作是否成功
+ */
+ navigateBack() {
+ return this.postMessageToRN({
+ type: 'back'
+ });
+ },
+
+ /**
+ * @desc 设置头部导航栏标题
+ * @param {String} title 标题文本
+ * @returns {Boolean} 操作是否成功
+ */
+ setTitle(title) {
+ if (title) {
+ return this.postMessageToRN({
+ type: 'title',
+ title
+ });
+ }
+ },
+
+ /**
+ * @desc 设置系统状态栏明暗主题
+ * @param {String} style 主题风格,'light'为浅色,'dark'为深色
+ * @returns {Boolean} 操作是否成功
+ */
+ setStatusBarStyle(style = 'light') {
+ return this.postMessageToRN({
+ type: 'statusBar',
+ style
+ });
+ },
+
+ /**
+ * @desc 跳转到APP页面
+ * @param {String} url APP内页面路由
+ * @returns {Boolean} 操作是否成功
+ */
+ navigateToAppPage(url) {
+ return this.postMessageToRN({
+ type: 'navigate',
+ url
+ });
+ },
+
+ // /**
+ // * @desc 跳转到H5页面
+ // * @param {String} h5Url 目标H5链接
+ // * @param {String} name 导航头中的标题文案
+ // * @param {Boolean} fullscreen 是否全屏显示(隐藏导航头)
+ // * @returns {Boolean} 操作是否成功
+ // */
+ // navigateToH5(h5Url, name, fullscreen = false) {
+ // if (fullscreen) {
+ // h5Url = this.appendQueryParam(h5Url, 'fullscreen', 'true');
+ // }
+ // return this.postMessageToRN({
+ // type: 'navigate',
+ // url: `authH5?url=${encodeURIComponent(h5Url)}&name=${name}`
+ // });
+ // },
+
+ // /**
+ // * @desc 给URL添加查询参数
+ // * @param {String} url 原始URL
+ // * @param {String} key 参数名
+ // * @param {String} value 参数值
+ // * @returns {String} 添加参数后的URL
+ // * @private
+ // */
+ // appendQueryParam(url, key, value) {
+ // const separator = url.includes('?') ? '&' : '?';
+ // return `${url}${separator}${key}=${value}`;
+ // },
+
+ /**
+ * @desc 禁用原生返回(Android)
+ * @returns {Boolean} 操作是否成功
+ */
+ takeOverAndroidBack() {
+ return this.postMessageToRN({
+ type: 'takeOverAndroidBack'
+ });
+ },
+
+ /**
+ * @desc 跳转到手机浏览器中打开页面
+ * @param {String} url 要打开的URL
+ * @returns {Boolean} 操作是否成功
+ */
+ openInBrowser(url) {
+ return this.postMessageToRN({
+ type: 'openLink',
+ url
+ });
+ },
+
+ /**
+ * @desc 使用原生扫码工具
+ * @param {Function} callback 扫码结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ scanCode(callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'scanCode',
+ cbId
+ });
+ },
+
+ /**
+ * @desc 分享链接到微信
+ * @param {Object} options 分享选项
+ * @param {String} options.title 分享标题
+ * @param {String} options.description 分享副标题
+ * @param {String} options.thumbImageUrl 缩略图URL
+ * @param {String} options.webpageUrl 网页链接
+ * @param {Number} options.scene 分享场景:0为微信好友,1为朋友圈
+ * @param {Function} callback 分享结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ shareToWeChat(options, callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'shareToWx',
+ title: options.title,
+ description: options.description,
+ thumbImageUrl: options.thumbImageUrl,
+ webpageUrl: options.webpageUrl,
+ scene: options.scene || 0,
+ cbId
+ });
+ },
+
+ /**
+ * @desc 分享视频到抖音
+ * @param {Object} options 分享选项
+ * @param {String} options.title 分享标题
+ * @param {String} options.shortTitle 抖音短标题
+ * @param {Array} options.videos 视频地址数组
+ * @param {Boolean} options.isPublish 是否直接跳转到发布页
+ * @param {Boolean} options.tip 是否显示APP自带的提示与loading
+ * @param {Function} callback 分享结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ shareVideoToDouyin(options, callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'shareVideoToDouyin',
+ title: options.title,
+ shortTitle: options.shortTitle,
+ videos: options.videos,
+ isPublish: options.isPublish !== false,
+ tip: options.tip !== false,
+ cbId
+ });
+ },
+
+ /**
+ * @desc 唤起抖音
+ * @param {Function} callback 操作结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ openDouyin(callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'openDouyin',
+ cbId
+ });
+ },
+
+ /**
+ * @desc 分享文本到微博
+ * @param {String} content 要分享的文本内容
+ * @param {Function} callback 分享结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ shareTextToWeibo(content, callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'shareTextToWeibo',
+ content,
+ cbId
+ });
+ },
+
+ /**
+ * @desc 保存到相册
+ * @param {String} src 媒体资源URL(图片或视频)
+ * @param {Function} callback 保存结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ save2Album(src, callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'save2Album',
+ src,
+ cbId
+ });
+ },
+
+ /**
+ * @desc 请求安卓权限
+ * @param {String} permission 权限名称,如'android.permission.CAMERA'
+ * @param {Function} callback 请求结果回调函数
+ * @returns {Boolean} 操作是否成功
+ */
+ requestAndroidPermission(permission, callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'androidPermission',
+ permission,
+ cbId
+ });
+ },
+ /**
+ * @desc 获取新的认证令牌
+ * @param {Function} callback 获取结果回调函数,参数格式为:
+ * {status: 0|1, msg: string, data: string}
+ * status: 0成功,1失败
+ * msg: 错误信息
+ * data: 新token
+ * @returns {Boolean} 操作是否成功
+ */
+ getNewAuthToken(callback) {
+ const cbId = this.generateUniqueId();
+ window[cbId] = callback;
+ return this.postMessageToRN({
+ type: 'newAuthToken',
+ cbId
+ });
+ }
+};
diff --git a/src/assets/js/common.js b/src/assets/js/common.js
new file mode 100644
index 0000000..fbcd1c1
--- /dev/null
+++ b/src/assets/js/common.js
@@ -0,0 +1,164 @@
+export default {
+ /** ****************** 数据转换工具 ********************/
+ /**
+ * @desc json转string
+ * @param {*} value 值
+ * @return {*} value 值
+ */
+ _json2string(value) {
+ return JSON.stringify(value);
+ },
+
+ /**
+ * @desc string转json
+ * @param {*} value 值
+ * @return {*} value 值
+ */
+ _string2json(value) {
+ try {
+ value = JSON.parse(value);
+ } catch (e) {}
+ return value;
+ },
+
+ /**
+ * @desc 对象解除关联(深拷贝)
+ * @param {*} obj
+ */
+ convertObj(obj) {
+ return JSON.parse(JSON.stringify(obj));
+ },
+
+ /** ****************** Cookie操作 ********************/
+ /**
+ * @desc 获取cookie
+ * @param {String} name 名称
+ * @return {*} 值
+ */
+ getCookie(name) {
+ let rs = '';
+ const nameStr = `${name}=`;
+ const ca = document.cookie.split(';');
+ for (let i = 0; i < ca.length; i++) {
+ let c = ca[i];
+ while (c.charAt(0) === ' ') {
+ c = c.substring(1);
+ }
+ if (c.indexOf(nameStr) !== -1) {
+ rs = this._string2json(c.substring(nameStr.length, c.length));
+ }
+ }
+ return rs;
+ },
+
+ /**
+ * @desc 设置cookie
+ * @param {String} name 名称
+ * @param {*} value 值
+ * @param {Number} hours 过期时间(小时)
+ */
+ setCookie(name, value, hours) {
+ let str = `${name}=${this._json2string(value)}`;
+ if (hours && hours > 0) {
+ const date = new Date();
+ date.setTime(date.getTime() + hours * 3600 * 1000);
+ str += `; expires=${date.toUTCString()}`;
+ }
+ document.cookie = str;
+ },
+
+ /**
+ * @desc 删除cookie
+ * @param {String} name 名称
+ * @param {Object} options 选项
+ * @param {Boolean} options.usePath 是否指定路径
+ */
+ delCookie(name, options = {}) {
+ const date = new Date();
+ date.setTime(date.getTime() - 10000);
+ let cookieStr = `${name}=a; expires=${date.toGMTString()}`;
+
+ if (options.usePath) {
+ cookieStr += ';path=/micro;';
+ }
+
+ document.cookie = cookieStr;
+ },
+
+ /**
+ * @desc 删除cookie(带路径)
+ * @param {String} name 名称
+ */
+ clearCookie(name) {
+ this.delCookie(name, { usePath: true });
+ },
+
+ /** ****************** 本地存储操作 ********************/
+ /**
+ * @desc 获取localStorage中指定的变量
+ * @param {String} name 名称
+ * @return {*} 值
+ */
+ getStorage(name) {
+ return this._string2json(window.localStorage[name]);
+ },
+
+ /**
+ * @desc 设置localStorage中指定的变量
+ * @param {String} name 名称
+ * @param {*} value 值
+ */
+ setStorage(name, value) {
+ window.localStorage[name] = this._json2string(value);
+ },
+
+ /**
+ * @desc 删除localStorage中指定的变量
+ * @param {String} name 名称
+ */
+ delStorage(name) {
+ window.localStorage.removeItem(name);
+ },
+
+ /**
+ * @desc 获取sessionStorage中指定的变量
+ * @param {String} name 名称
+ * @return {*} 值
+ */
+ getSessionStorage(name) {
+ return this._string2json(window.sessionStorage.getItem(name));
+ },
+
+ /**
+ * @desc 设置sessionStorage中指定的变量
+ * @param {String} name 名称
+ * @param {*} value 值
+ */
+ setSessionStorage(name, value) {
+ window.sessionStorage.setItem(name, this._json2string(value));
+ },
+
+ /**
+ * @desc 删除sessionStorage中指定的变量
+ * @param {String} name 名称
+ */
+ delSessionStorage(name) {
+ window.sessionStorage.removeItem(name);
+ },
+
+ /** ****************** URL工具 ********************/
+ /**
+ * @desc 获取URL中的参数
+ * @param {String} name 参数名
+ * @return {String} 参数值
+ */
+ getParameter(name) {
+ const reg = new RegExp(`${name}=.*`, 'g');
+ const str = window.location.href.match(reg);
+ if (str) {
+ return str[0].split('&')[0].split('=')[1];
+ } else {
+ return '';
+ }
+ }
+};
diff --git a/src/components/contenteditable.vue b/src/components/contenteditable.vue
index c689936..cf0b12a 100644
--- a/src/components/contenteditable.vue
+++ b/src/components/contenteditable.vue
@@ -134,7 +134,6 @@ onMounted(() => {
bottom: 0;
left: 0;
z-index: 2008;
- display: flex;
width: 100%;
height: 40px;
padding: 0 10px;
diff --git a/src/config.js b/src/config.js
index f3fc324..272cdfc 100644
--- a/src/config.js
+++ b/src/config.js
@@ -9,4 +9,6 @@ export default {
jsonpUrl: import.meta.env.VITE_APP_JSONPURL,
jqrUrl: import.meta.env.VITE_APP_YQRURL,
currentMode: import.meta.env.VITE_APP_CURRENTMODE
+ // appKey: import.meta.env.VITE_APP_APPKEY,
+ // appId: import.meta.env.VITE_APP_APPID
};
diff --git a/src/main.ts b/src/main.ts
index b195972..1b1e0b8 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,4 +1,4 @@
-import '@/assets/css/main.scss';
+import './assets/css/main.scss';
import 'amfe-flexible';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
@@ -6,6 +6,15 @@ import App from './App.vue';
import router from './router';
// 2. 引入组件样式
import 'vant/lib/index.css';
+// // 调整路由守卫的设置位置
+// router.beforeEach((to, from, next) => {
+// if (to.query.digitalYiliToken) {
+// utils.delCookie('xToken');
+// utils.clearCookie('xToken');
+// utils.setCookie('xToken', to.query.xToken, 7);
+// }
+// next();
+// });
const app = createApp(App);
app.use(createPinia());
app.use(router);
diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue
index ef7a969..d0e7121 100644
--- a/src/views/Design/Index.vue
+++ b/src/views/Design/Index.vue
@@ -15,7 +15,6 @@
:index="index"
:chooseQuestionId="chooseQuestionId"
@get-choose-question-id="getChooseQuestionId"
- @move="emitFun.move"
>
-
-
@@ -298,14 +295,6 @@ const actionFun = {
}
};
-// emit 事件
-
-const emitFun = {
- move: (ev) => {
- console.log(ev);
- }
-};
-
onMounted(() => {
questionInfo.value = store.questionsInfo.value;
});
diff --git a/src/views/Design/components/ActionCompoents/QuestionAction.vue b/src/views/Design/components/ActionCompoents/QuestionAction.vue
index 43440c2..a9fce0c 100644
--- a/src/views/Design/components/ActionCompoents/QuestionAction.vue
+++ b/src/views/Design/components/ActionCompoents/QuestionAction.vue
@@ -158,8 +158,6 @@ const deleteQuestion = () => {
});
};
-// emit
-const emit = defineEmits(['move', 'copy']);
// 打开题目弹窗
const openQuestionActionModel = () => {
show.value = true;
@@ -168,7 +166,6 @@ const openQuestionActionModel = () => {
const openQuestionSettingModel = () => {
questionShow.value = true;
};
-
// 题目上下移动
const questionMove = (action) => {
if (action.action === 'down') {
@@ -178,8 +175,6 @@ const questionMove = (action) => {
const temp = questions.value[props.questionIndex];
questions.value.splice(props.questionIndex, 1);
questions.value.splice(props.questionIndex + 1, 0, temp);
-
- emit('move', 'down');
} else if (action.action === 'up') {
if (props.questionIndex === 0) {
return;
@@ -187,7 +182,6 @@ const questionMove = (action) => {
const temp = questions.value[props.questionIndex];
questions.value.splice(props.questionIndex, 1);
questions.value.splice(props.questionIndex - 1, 0, temp);
- emit('move', 'up');
} else {
// 复制 题目 生成新的id 更新最新的 last index
const temp = questions.value[props.questionIndex];
@@ -197,7 +191,6 @@ const questionMove = (action) => {
question_index: questionsInfo.value.survey.last_question_index + 1
});
questionsInfo.value.survey.last_question_index += 1;
- emit('copy', 'down');
}
};
diff --git a/src/views/Design/components/ChooseQuestion.vue b/src/views/Design/components/ChooseQuestion.vue
index 1efbc81..2a8eef2 100644
--- a/src/views/Design/components/ChooseQuestion.vue
+++ b/src/views/Design/components/ChooseQuestion.vue
@@ -17,10 +17,20 @@
v-model:data="element"
:questions="questions"
:questionIndex="index"
- @move="emit('move', $event)"
- @copy="emit('copy', $event)"
>
+
+
+
+
+
+
+
+
+
+
+
+
@@ -49,14 +59,70 @@ const props = defineProps({
}
});
const element = ref(props.element);
+
// 选中题目后出现的操作
-const emit = defineEmits(['getChooseQuestionId', 'move', 'copy']);
+// const questionAction = ref([
+// {
+// icon: '',
+// name: '编辑',
+// key: 'edit',
+// class: ''
+// },
+// {
+// icon: '',
+// name: '复制',
+// key: 'copy',
+// class: ''
+// },
+// {
+// icon: '',
+// name: '移动',
+// key: 'moveUp',
+// class: 'moverQues'
+// },
+// // {
+// // icon:'',
+// // name:'下移',
+// // key:'moveDown',
+// // class:''
+// // },
+// {
+// icon: '',
+// name: '删除',
+// key: 'delete',
+// class: ''
+// }
+// ]);
+const emit = defineEmits(['getChooseQuestionId']);
// 选中题目
const chooseItem = () => {
// 使用从 defineProps 接收的 element 对象
emit('getChooseQuestionId', props.element);
};
+
+// const itemAction = (item) => {
+// switch (item.key) {
+// case 'edit':
+// // vue router跳转到/edit
+//
+// router.push({
+// path: '/design/edit',
+// query: {
+// id: props.element.id
+// }
+// });
+// break;
+// case 'copy':
+// break;
+// case 'moveUp':
+// break;
+// case 'moveDown':
+// break;
+// case 'delete':
+// break;
+// }
+// };